hhxsv5 /
laravel-s
| 1 | <?php |
||
| 2 | |||
|
0 ignored issues
–
show
Coding Style
introduced
by
Loading history...
|
|||
| 3 | namespace Hhxsv5\LaravelS\Illuminate; |
||
| 4 | |||
| 5 | use Illuminate\Container\Container; |
||
|
0 ignored issues
–
show
The type
Illuminate\Container\Container was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 6 | use Symfony\Component\HttpFoundation\Response; |
||
|
0 ignored issues
–
show
The type
Symfony\Component\HttpFoundation\Response was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 7 | |||
| 8 | class ReflectionApp |
||
|
0 ignored issues
–
show
|
|||
| 9 | { |
||
| 10 | /** |
||
|
0 ignored issues
–
show
|
|||
| 11 | * @var Container |
||
| 12 | */ |
||
| 13 | protected $app; |
||
| 14 | |||
| 15 | /** |
||
|
0 ignored issues
–
show
|
|||
| 16 | * @var \ReflectionObject |
||
| 17 | */ |
||
| 18 | protected $reflectionApp; |
||
| 19 | |||
| 20 | /** |
||
| 21 | * ReflectionApp constructor. |
||
| 22 | * |
||
| 23 | * @param Container $app |
||
|
0 ignored issues
–
show
|
|||
| 24 | */ |
||
| 25 | public function __construct(Container $app) |
||
| 26 | { |
||
| 27 | $this->app = $app; |
||
| 28 | |||
| 29 | $this->reflectionApp = new \ReflectionObject($app); |
||
| 30 | } |
||
| 31 | |||
| 32 | /** |
||
| 33 | * Get all bindings from application container. |
||
| 34 | * |
||
| 35 | * @return array |
||
| 36 | * @throws \ReflectionException |
||
| 37 | */ |
||
| 38 | public function instances() |
||
| 39 | { |
||
| 40 | $instances = $this->reflectionApp->getProperty('instances'); |
||
| 41 | $instances->setAccessible(true); |
||
| 42 | $instances = array_merge($this->app->getBindings(), $instances->getValue($this->app)); |
||
| 43 | |||
| 44 | return $instances; |
||
| 45 | } |
||
| 46 | |||
| 47 | /** |
||
| 48 | * Call terminable middleware of Lumen. |
||
| 49 | * |
||
| 50 | * @param Response $response |
||
|
0 ignored issues
–
show
|
|||
| 51 | * @throws \ReflectionException |
||
|
0 ignored issues
–
show
|
|||
| 52 | */ |
||
|
0 ignored issues
–
show
|
|||
| 53 | public function callTerminableMiddleware(Response $response) |
||
| 54 | { |
||
| 55 | $middleware = $this->reflectionApp->getProperty('middleware'); |
||
| 56 | $middleware->setAccessible(true); |
||
| 57 | |||
| 58 | if (!empty($middleware->getValue($this->app))) { |
||
| 59 | $callTerminableMiddleware = $this->reflectionApp->getMethod('callTerminableMiddleware'); |
||
| 60 | $callTerminableMiddleware->setAccessible(true); |
||
| 61 | $callTerminableMiddleware->invoke($this->app, $response); |
||
| 62 | } |
||
| 63 | } |
||
| 64 | |||
| 65 | /** |
||
| 66 | * The parameter count of 'register' method in app container. |
||
| 67 | * |
||
| 68 | * @return int |
||
| 69 | * @throws \ReflectionException |
||
| 70 | */ |
||
| 71 | public function registerMethodParameterCount() |
||
| 72 | { |
||
| 73 | return $this->reflectionApp->getMethod('register')->getNumberOfParameters(); |
||
| 74 | } |
||
| 75 | |||
| 76 | /** |
||
| 77 | * Get 'loadedProviders' of application container. |
||
| 78 | * |
||
| 79 | * @return array |
||
| 80 | * @throws \ReflectionException |
||
| 81 | */ |
||
| 82 | public function loadedProviders() |
||
| 83 | { |
||
| 84 | $loadedProviders = $this->reflectLoadedProviders(); |
||
| 85 | return $loadedProviders->getValue($this->app); |
||
| 86 | } |
||
| 87 | |||
| 88 | /** |
||
| 89 | * Set 'loadedProviders' of application container. |
||
| 90 | * |
||
| 91 | * @param array $loadedProviders |
||
|
0 ignored issues
–
show
|
|||
| 92 | * @throws \ReflectionException |
||
|
0 ignored issues
–
show
|
|||
| 93 | */ |
||
|
0 ignored issues
–
show
|
|||
| 94 | public function setLoadedProviders(array $loadedProviders) |
||
| 95 | { |
||
| 96 | $reflectLoadedProviders = $this->reflectLoadedProviders(); |
||
| 97 | $reflectLoadedProviders->setValue($this->app, $loadedProviders); |
||
| 98 | } |
||
| 99 | |||
| 100 | /** |
||
| 101 | * Get the reflect loadedProviders of application container. |
||
| 102 | * |
||
| 103 | * @return \ReflectionProperty |
||
| 104 | * @throws \ReflectionException |
||
| 105 | */ |
||
| 106 | protected function reflectLoadedProviders() |
||
| 107 | { |
||
| 108 | $loadedProviders = $this->reflectionApp->getProperty('loadedProviders'); |
||
| 109 | $loadedProviders->setAccessible(true); |
||
| 110 | return $loadedProviders; |
||
| 111 | } |
||
| 112 | } |
||
| 113 |