abterphp /
website
| 1 | <?php |
||
| 2 | |||
| 3 | use AbterPhp\Framework\Constant\Event; |
||
|
0 ignored issues
–
show
|
|||
| 4 | use AbterPhp\Framework\Constant\Module; |
||
| 5 | use AbterPhp\Framework\Constant\Priorities; |
||
| 6 | use AbterPhp\Website\Bootstrappers; |
||
| 7 | use AbterPhp\Website\Events; |
||
| 8 | |||
| 9 | return [ |
||
| 10 | Module::IDENTIFIER => 'AbterPhp\Website', |
||
| 11 | Module::DEPENDENCIES => ['AbterPhp\Admin'], |
||
| 12 | Module::ENABLED => true, |
||
| 13 | Module::BOOTSTRAPPERS => [ |
||
| 14 | Bootstrappers\Orm\OrmBootstrapper::class, |
||
| 15 | Bootstrappers\Validation\ValidatorBootstrapper::class, |
||
| 16 | ], |
||
| 17 | Module::CLI_BOOTSTRAPPERS => [ |
||
| 18 | Bootstrappers\Database\MigrationsBootstrapper::class, |
||
| 19 | ], |
||
| 20 | Module::HTTP_BOOTSTRAPPERS => [ |
||
| 21 | Bootstrappers\Http\Controllers\Website\IndexBootstrapper::class, |
||
| 22 | Bootstrappers\Http\Views\BuildersBootstrapper::class, |
||
| 23 | ], |
||
| 24 | Module::EVENTS => [ |
||
| 25 | Event::AUTH_READY => [ |
||
| 26 | /** @see \AbterPhp\Website\Events\Listeners\AuthInitializer::handle */ |
||
| 27 | Priorities::NORMAL => [sprintf('%s@handle', Events\Listeners\AuthInitializer::class)], |
||
| 28 | ], |
||
| 29 | Event::TEMPLATE_ENGINE_READY => [ |
||
| 30 | /** @see \AbterPhp\Website\Events\Listeners\TemplateInitializer::handle */ |
||
| 31 | Priorities::NORMAL => [sprintf('%s@handle', Events\Listeners\TemplateInitializer::class)], |
||
| 32 | ], |
||
| 33 | Event::NAVIGATION_READY => [ |
||
| 34 | /** @see \AbterPhp\Website\Events\Listeners\NavigationBuilder::handle */ |
||
| 35 | Priorities::NORMAL => [sprintf('%s@handle', Events\Listeners\NavigationBuilder::class)], |
||
| 36 | ], |
||
| 37 | Event::ENTITY_POST_CHANGE => [ |
||
| 38 | /** @see \AbterPhp\Website\Events\Listeners\PageInvalidator::handle */ |
||
| 39 | Priorities::NORMAL => [sprintf('%s@handle', Events\Listeners\PageInvalidator::class)], |
||
| 40 | ], |
||
| 41 | Event::DASHBOARD_READY => [ |
||
| 42 | /** @see \AbterPhp\Website\Events\Listeners\DashboardBuilder::handle */ |
||
| 43 | Priorities::NORMAL => [sprintf('%s@handle', Events\Listeners\DashboardBuilder::class)], |
||
| 44 | ], |
||
| 45 | ], |
||
| 46 | Module::ROUTE_PATHS => [ |
||
| 47 | Priorities::NORMAL => [ |
||
| 48 | __DIR__ . '/admin-routes.php', |
||
| 49 | ], |
||
| 50 | Priorities::BELOW_NORMAL => [ |
||
| 51 | __DIR__ . '/website-routes.php', |
||
| 52 | ], |
||
| 53 | ], |
||
| 54 | Module::MIGRATION_PATHS => [ |
||
| 55 | Priorities::NORMAL => [ |
||
| 56 | realpath(__DIR__ . '/src/Databases/Migrations'), |
||
| 57 | ], |
||
| 58 | ], |
||
| 59 | Module::RESOURCE_PATH => realpath(__DIR__ . '/resources'), |
||
| 60 | Module::ASSETS_PATHS => [ |
||
| 61 | 'root' => realpath(__DIR__ . '/resources/rawassets'), |
||
| 62 | 'website' => realpath(__DIR__ . '/resources/rawassets'), |
||
| 63 | ], |
||
| 64 | ]; |
||
| 65 |
Let?s assume that you have a directory layout like this:
. |-- OtherDir | |-- Bar.php | `-- Foo.php `-- SomeDir `-- Foo.phpand let?s assume the following content of
Bar.php:If both files
OtherDir/Foo.phpandSomeDir/Foo.phpare loaded in the same runtime, you will see a PHP error such as the following:PHP Fatal error: Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.phpHowever, as
OtherDir/Foo.phpdoes not necessarily have to be loaded and the error is only triggered if it is loaded beforeOtherDir/Bar.php, this problem might go unnoticed for a while. In order to prevent this error from surfacing, you must import the namespace with a different alias: