| Total Complexity | 5 |
| Total Lines | 58 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 2 | ||
| Bugs | 2 | Features | 0 |
| 1 | <?php |
||
| 12 | class AuditingServiceProvider extends ServiceProvider implements DeferrableProvider |
||
| 13 | { |
||
| 14 | /** |
||
| 15 | * Bootstrap the service provider. |
||
| 16 | * |
||
| 17 | * @return void |
||
| 18 | */ |
||
| 19 | 196 | public function boot() |
|
| 20 | { |
||
| 21 | 196 | $this->registerPublishing(); |
|
| 22 | 196 | $this->mergeConfigFrom(__DIR__ . '/../config/audit.php', 'audit'); |
|
| 23 | } |
||
| 24 | |||
| 25 | /** |
||
| 26 | * Register the service provider. |
||
| 27 | * |
||
| 28 | * @return void |
||
| 29 | */ |
||
| 30 | 196 | public function register() |
|
| 39 | }); |
||
| 40 | } |
||
| 41 | |||
| 42 | /** |
||
| 43 | * Register the package's publishable resources. |
||
| 44 | * |
||
| 45 | * @return void |
||
| 46 | */ |
||
| 47 | 196 | private function registerPublishing() |
|
| 60 | } |
||
| 61 | } |
||
| 62 | |||
| 63 | /** |
||
| 64 | * {@inheritdoc} |
||
| 65 | */ |
||
| 66 | public function provides() |
||
| 73 |
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: