| Conditions | 6 |
| Paths | 4 |
| Total Lines | 17 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 6 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 38 | 4 | public function getMonologService() |
|
| 39 | { |
||
| 40 | 4 | if (null === $this->monologService) { |
|
| 41 | 3 | if ($this instanceof ServiceLocatorAwareInterface || method_exists($this, 'getServiceLocator')) { |
|
|
|
|||
| 42 | 1 | $this->monologService = $this->getServiceLocator()->get($this->monologLoggerName); |
|
| 43 | } else { |
||
| 44 | 2 | if (property_exists($this, 'serviceLocator') |
|
| 45 | 2 | && $this->serviceLocator instanceof ServiceLocatorInterface |
|
| 46 | ) { |
||
| 47 | 1 | $this->monologService = $this->serviceLocator->get($this->monologLoggerName); |
|
| 48 | } else { |
||
| 49 | 1 | throw new RuntimeException('Service locator not found'); |
|
| 50 | } |
||
| 51 | } |
||
| 52 | } |
||
| 53 | 3 | return $this->monologService; |
|
| 54 | } |
||
| 55 | } |
||
| 56 |
This error could be the result of:
1. Missing dependencies
PHP Analyzer uses your
composer.jsonfile (if available) to determine the dependencies of your project and to determine all the available classes and functions. It expects thecomposer.jsonto be in the root folder of your repository.Are you sure this class is defined by one of your dependencies, or did you maybe not list a dependency in either the
requireorrequire-devsection?2. Missing use statement
PHP does not complain about undefined classes in
ìnstanceofchecks. For example, the following PHP code will work perfectly fine:If you have not tested against this specific condition, such errors might go unnoticed.