Skip to content

Commit

Permalink
Update architecture
Browse files Browse the repository at this point in the history
  • Loading branch information
mckenziearts committed Mar 27, 2024
2 parents 016a149 + bd40dc6 commit 9ece21e
Show file tree
Hide file tree
Showing 62 changed files with 331 additions and 332 deletions.
2 changes: 1 addition & 1 deletion .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# These are supported funding model platforms
github: mckenziearts
github: [mckenziearts, shopperlabs]
7 changes: 4 additions & 3 deletions .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
name: phpstan
name: "phpstan Static Analysis"

on:
push:
pull_request:
branches:
- main

jobs:
phpstan:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php: [8.2]
laravel: [10.*, 11.*]
laravel: [10.*]
dependencies: ["highest"]

name: "PHP ${{ matrix.php }} - L${{ matrix.laravel }} ${{ matrix.dependencies == 'highest' && '↑' || '↓' }}"
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,3 @@ phpunit.xml
.php-cs-fixer.cache
build
Thumbs.db

480 changes: 244 additions & 236 deletions composer.lock

Large diffs are not rendered by default.

15 changes: 15 additions & 0 deletions monorepo-builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,18 @@
declare(strict_types=1);

use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symplify\ComposerJsonManipulator\ValueObject\ComposerJsonSection;
use Symplify\MonorepoBuilder\Release\ReleaseWorker\PushNextDevReleaseWorker;
use Symplify\MonorepoBuilder\Release\ReleaseWorker\PushTagReleaseWorker;
use Symplify\MonorepoBuilder\Release\ReleaseWorker\SetCurrentMutualDependenciesReleaseWorker;
use Symplify\MonorepoBuilder\Release\ReleaseWorker\SetNextMutualDependenciesReleaseWorker;
use Symplify\MonorepoBuilder\Release\ReleaseWorker\TagVersionReleaseWorker;
use Symplify\MonorepoBuilder\Release\ReleaseWorker\UpdateBranchAliasReleaseWorker;
use Symplify\MonorepoBuilder\Release\ReleaseWorker\UpdateReplaceReleaseWorker;
use Symplify\MonorepoBuilder\ValueObject\Option;

return static function (ContainerConfigurator $containerConfigurator): void {
$parameters = $containerConfigurator->parameters();
$services = $containerConfigurator->services();

// Release workers - in order to execute
Expand All @@ -22,4 +25,16 @@
$services->set(SetNextMutualDependenciesReleaseWorker::class);
$services->set(UpdateBranchAliasReleaseWorker::class);
$services->set(PushNextDevReleaseWorker::class);

$parameters->set(Option::PACKAGE_DIRECTORIES, [
__DIR__ . '/packages',
]);

// for "merge" command
$parameters->set(Option::DATA_TO_APPEND, [
ComposerJsonSection::REQUIRE_DEV => [
'phpunit/phpunit' => '^9.5',
'symplify/monorepo-builder' => '^10.0',
],
]);
};
2 changes: 1 addition & 1 deletion packages/admin/src/Actions/AttemptToAuthenticate.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use Illuminate\Validation\ValidationException;
use Shopper\Facades\Shopper;

final class AttemptToAuthenticate
class AttemptToAuthenticate
{
public function handle(array $request, Closure $next)
{
Expand Down
2 changes: 1 addition & 1 deletion packages/admin/src/Actions/ConfirmPassword.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

use Illuminate\Contracts\Auth\StatefulGuard;

final class ConfirmPassword
class ConfirmPassword
{
public function __invoke(StatefulGuard $guard, $user, string $password): bool
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Shopper\Actions;

final class DisableTwoFactorAuthentication
class DisableTwoFactorAuthentication
{
public function __invoke($user): void
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use Shopper\Contracts\TwoFactorAuthenticationProvider;
use Shopper\Events\TwoFactor\TwoFactorAuthenticationEnabled;

final class EnableTwoFactorAuthentication
class EnableTwoFactorAuthentication
{
public function __construct(protected TwoFactorAuthenticationProvider $provider)
{
Expand Down
2 changes: 1 addition & 1 deletion packages/admin/src/Actions/GenerateNewRecoveryCodes.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

use Illuminate\Support\Collection;

final class GenerateNewRecoveryCodes
class GenerateNewRecoveryCodes
{
public function __invoke($user): void
{
Expand Down
2 changes: 1 addition & 1 deletion packages/admin/src/Actions/RecoveryCode.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

use Illuminate\Support\Str;

final class RecoveryCode
class RecoveryCode
{
public static function generate(): string
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use Shopper\Facades\Shopper;
use Shopper\Traits\TwoFactorAuthenticatable;

final class RedirectIfTwoFactorAuthenticatable
class RedirectIfTwoFactorAuthenticatable
{
public function handle(array $data, Closure $next)
{
Expand Down
8 changes: 5 additions & 3 deletions packages/admin/src/Console/SymlinkCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace Shopper\Console;

use Illuminate\Console\Command;
use Shopper\Shopper;

final class SymlinkCommand extends Command
{
Expand All @@ -14,14 +15,15 @@ final class SymlinkCommand extends Command

public function handle(): void
{
$link = public_path('shopper');
$prefix = Shopper::prefix();
$link = public_path($prefix);
$target = realpath(__DIR__ . '/../../public/');

if (file_exists($link)) {
$this->error('The "public/shopper" directory already exists.');
$this->error('The "public/' . $prefix . '" directory already exists.');
} else {
$this->laravel->make('files')->link($target, $link);
$this->info('The [public/shopper] directory has been linked.');
$this->info('The [public/' . $prefix . '] directory has been linked.');
}

$this->info('The link have been created.');
Expand Down
2 changes: 1 addition & 1 deletion packages/admin/src/Events/CatalogSidebar.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use Shopper\Sidebar\Contracts\Builder\Item;
use Shopper\Sidebar\Contracts\Builder\Menu;

final class CatalogSidebar extends AbstractAdminSidebar
class CatalogSidebar extends AbstractAdminSidebar
{
public function extendWith(Menu $menu): Menu
{
Expand Down
2 changes: 1 addition & 1 deletion packages/admin/src/Events/CustomerSidebar.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use Shopper\Sidebar\Contracts\Builder\Item;
use Shopper\Sidebar\Contracts\Builder\Menu;

final class CustomerSidebar extends AbstractAdminSidebar
class CustomerSidebar extends AbstractAdminSidebar
{
public function extendWith(Menu $menu): Menu
{
Expand Down
2 changes: 1 addition & 1 deletion packages/admin/src/Events/DashboardSidebar.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
use Shopper\Sidebar\Contracts\Builder\Item;
use Shopper\Sidebar\Contracts\Builder\Menu;

final class DashboardSidebar extends AbstractAdminSidebar
class DashboardSidebar extends AbstractAdminSidebar
{
public function extendWith(Menu $menu): Menu
{
Expand Down
2 changes: 1 addition & 1 deletion packages/admin/src/Events/SalesSidebar.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
use Shopper\Sidebar\Contracts\Builder\Item;
use Shopper\Sidebar\Contracts\Builder\Menu;

final class SalesSidebar extends AbstractAdminSidebar
class SalesSidebar extends AbstractAdminSidebar
{
public function extendWith(Menu $menu): Menu
{
Expand Down
2 changes: 1 addition & 1 deletion packages/admin/src/Exports/ProductInventoryExport.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
use Maatwebsite\Excel\Concerns\WithMapping;
use Shopper\Core\Models\InventoryHistory;

final class ProductInventoryExport implements FromQuery, WithHeadings, WithMapping
class ProductInventoryExport implements FromQuery, WithHeadings, WithMapping
{
use Exportable;

Expand Down
17 changes: 0 additions & 17 deletions packages/admin/src/Http/Controllers/SettingController.php

This file was deleted.

2 changes: 1 addition & 1 deletion packages/admin/src/Http/Middleware/Authenticate.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

use Illuminate\Auth\Middleware\Authenticate as Middleware;

final class Authenticate extends Middleware
class Authenticate extends Middleware
{
protected function authenticate($request, array $guards): void
{
Expand Down
2 changes: 1 addition & 1 deletion packages/admin/src/Http/Middleware/Dashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
use Shopper\Core\Models\User;
use Shopper\Facades\Shopper;

final class Dashboard
class Dashboard
{
public function handle(Request $request, Closure $next)
{
Expand Down
2 changes: 1 addition & 1 deletion packages/admin/src/Http/Middleware/DispatchShopper.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use Illuminate\Http\Request;
use Shopper\Events\LoadShopper;

final class DispatchShopper
class DispatchShopper
{
public function handle(Request $request, Closure $next)
{
Expand Down
2 changes: 1 addition & 1 deletion packages/admin/src/Http/Middleware/HasConfiguration.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use Illuminate\Http\Request;
use Shopper\Core\Models\Setting;

final class HasConfiguration
class HasConfiguration
{
public function handle(Request $request, Closure $next)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,13 @@
namespace Shopper\Http\Middleware;

use Closure;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Shopper\Facades\Shopper;

final class RedirectIfAuthenticated
class RedirectIfAuthenticated
{
public function handle(Request $request, Closure $next): RedirectResponse | Response
public function handle(Request $request, Closure $next)
{
if (Shopper::auth()->check()) {
if (shopper()->auth()->check()) {
return redirect()->route('shopper.dashboard');
}

Expand Down
2 changes: 1 addition & 1 deletion packages/admin/src/Http/Requests/TwoFactorLoginRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use Shopper\Facades\Shopper;
use Shopper\Http\Responses\FailedTwoFactorLoginResponse;

final class TwoFactorLoginRequest extends FormRequest
class TwoFactorLoginRequest extends FormRequest
{
protected $challengedUser;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@

namespace Shopper\Http\Responses;

use Illuminate\Http\RedirectResponse;
use Illuminate\Validation\ValidationException;
use Shopper\Contracts\FailedTwoFactorLoginResponse as FailedTwoFactorLoginResponseContract;

final class FailedTwoFactorLoginResponse implements FailedTwoFactorLoginResponseContract
class FailedTwoFactorLoginResponse implements FailedTwoFactorLoginResponseContract
{
public function toResponse($request): RedirectResponse
public function toResponse($request)
{
[$key, $message] = $request->filled('recovery_code')
? ['recovery_code', __('The provided two factor recovery code was invalid.')]
Expand Down
2 changes: 1 addition & 1 deletion packages/admin/src/Http/Responses/LoginResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

use Shopper\Contracts\LoginResponse as Responsable;

final class LoginResponse implements Responsable
class LoginResponse implements Responsable
{
public function toResponse($request)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@

use Illuminate\Http\JsonResponse;
use Shopper\Contracts\TwoFactorLoginResponse as TwoFactorLoginResponseContract;
use Symfony\Component\HttpFoundation\Response;

final class TwoFactorDisabledResponse implements TwoFactorLoginResponseContract
class TwoFactorDisabledResponse implements TwoFactorLoginResponseContract
{
public function toResponse($request): Response
public function toResponse($request)
{
return $request->wantsJson()
? new JsonResponse('', 200)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@

use Illuminate\Http\JsonResponse;
use Shopper\Contracts\TwoFactorLoginResponse as TwoFactorLoginResponseContract;
use Symfony\Component\HttpFoundation\Response;

final class TwoFactorEnabledResponse implements TwoFactorLoginResponseContract
class TwoFactorEnabledResponse implements TwoFactorLoginResponseContract
{
public function toResponse($request): Response
public function toResponse($request)
{
return $request->wantsJson()
? new JsonResponse('', 200)
Expand Down
5 changes: 2 additions & 3 deletions packages/admin/src/Http/Responses/TwoFactorLoginResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@

use Illuminate\Http\JsonResponse;
use Shopper\Contracts\TwoFactorLoginResponse as TwoFactorLoginResponseContract;
use Symfony\Component\HttpFoundation\Response;

final class TwoFactorLoginResponse implements TwoFactorLoginResponseContract
class TwoFactorLoginResponse implements TwoFactorLoginResponseContract
{
public function toResponse($request): Response
public function toResponse($request)
{
return $request->wantsJson()
? new JsonResponse('', 204)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
use Shopper\Traits\CanBeCacheable;
use Shopper\Traits\HasCollectionPaginate;

final class IconPicker extends Component
class IconPicker extends Component
{
use CanBeCacheable;
use HasCollectionPaginate;
Expand Down
2 changes: 1 addition & 1 deletion packages/admin/src/Livewire/Components/Forms/Trix.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use Illuminate\Contracts\View\View;
use Livewire\Component;

final class Trix extends Component
class Trix extends Component
{
public string $trixId;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use Livewire\WithFileUploads;
use Spatie\MediaLibrary\MediaCollections\Models\Media;

final class Multiple extends Component
class Multiple extends Component
{
use WithFileUploads;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
use Livewire\WithFileUploads;
use Spatie\MediaLibrary\MediaCollections\Models\Media;

final class Single extends Component
class Single extends Component
{
use WithFileUploads;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
use Shopper\Core\Models\AttributeProduct;
use Shopper\Core\Repositories\Store\ProductRepository;

final class MultipleChoice extends Component
class MultipleChoice extends Component
{
public Collection $values;

Expand Down
Loading

0 comments on commit 9ece21e

Please sign in to comment.