1 | <?php |
||||||
2 | |||||||
3 | |||||||
4 | namespace Zebrainsteam\LaravelRepos; |
||||||
5 | |||||||
6 | use Illuminate\Support\Facades\App; |
||||||
7 | use Illuminate\Support\ServiceProvider; |
||||||
8 | use Repositories\Core\Contracts\ResolverInterface; |
||||||
9 | use Repositories\Core\RepositoryFactory; |
||||||
10 | use Repositories\Core\Resolvers\ChainResolver; |
||||||
11 | use Repositories\Core\Resolvers\ContainerAwareResolver; |
||||||
12 | use Zebrainsteam\LaravelRepos\Console\RepositoryInterfaceMakeCommand; |
||||||
13 | use Zebrainsteam\LaravelRepos\Console\RepositoryMakeCommand; |
||||||
14 | |||||||
15 | class LaravelReposServiceProvider extends ServiceProvider |
||||||
16 | { |
||||||
17 | public function boot() |
||||||
18 | { |
||||||
19 | if ($this->app->runningInConsole()) { |
||||||
0 ignored issues
–
show
|
|||||||
20 | $this->commands([ |
||||||
0 ignored issues
–
show
The method
commands() does not exist on Zebrainsteam\LaravelRepo...velReposServiceProvider .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. ![]() |
|||||||
21 | RepositoryInterfaceMakeCommand::class, |
||||||
22 | RepositoryMakeCommand::class, |
||||||
23 | ]); |
||||||
24 | } |
||||||
25 | |||||||
26 | $this->publishes([ |
||||||
0 ignored issues
–
show
The method
publishes() does not exist on Zebrainsteam\LaravelRepo...velReposServiceProvider .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. ![]() |
|||||||
27 | __DIR__.'/config/repositories.php' => config_path('repositories.php'), |
||||||
28 | ]); |
||||||
29 | } |
||||||
30 | |||||||
31 | public function register() |
||||||
32 | { |
||||||
33 | $this->app->singleton(ContainerAwareResolver::class, function ($app) { |
||||||
0 ignored issues
–
show
The method
singleton() does not exist on Tests\Laravel\App .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. ![]() |
|||||||
34 | return new ContainerAwareResolver($app); |
||||||
35 | }); |
||||||
36 | |||||||
37 | if (empty(config('repositories.resolvers')) |
||||||
38 | || empty(config('repositories.bindings')) |
||||||
39 | ) { |
||||||
40 | throw new \Exception('Invalid repository config'); |
||||||
41 | } |
||||||
42 | |||||||
43 | $this->app->singleton(RepositoryFactory::class, function ($app) { |
||||||
0 ignored issues
–
show
The parameter
$app is not used and could be removed.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for parameters that have been defined for a function or method, but which are not used in the method body. ![]() |
|||||||
44 | foreach (config('repositories.resolvers') as $resolverClass) { |
||||||
45 | $resolver = App::get($resolverClass); |
||||||
46 | |||||||
47 | if ($resolver instanceof ResolverInterface) { |
||||||
48 | $resolvers[] = $resolver; |
||||||
49 | } else { |
||||||
50 | throw new \Exception('Invalid resolver class ' . $resolverClass); |
||||||
51 | } |
||||||
52 | } |
||||||
53 | |||||||
54 | $resolver = new ChainResolver($resolvers); |
||||||
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||||||
55 | |||||||
56 | return new RepositoryFactory($resolver, config('repositories.bindings')); |
||||||
57 | }); |
||||||
58 | } |
||||||
59 | } |
||||||
60 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.