delboy1978uk /
bone-controller
| 1 | <?php |
||||||
| 2 | |||||||
| 3 | namespace Bone\Controller; |
||||||
| 4 | |||||||
| 5 | use Barnacle\Container; |
||||||
| 6 | use Bone\BoneDoctrine\EntityManagerAwareInterface; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 7 | use Bone\Controller\Controller; |
||||||
| 8 | use Bone\Db\DbProviderInterface; |
||||||
| 9 | use Bone\I18n\I18nAwareInterface; |
||||||
| 10 | use Bone\View\ViewEngine; |
||||||
| 11 | use Bone\Log\LoggerAwareInterface; |
||||||
| 12 | use Bone\Server\SessionAwareInterface; |
||||||
| 13 | use Bone\Server\SiteConfig; |
||||||
| 14 | use Bone\Server\SiteConfigAwareInterface; |
||||||
| 15 | use Bone\View\ViewAwareInterface; |
||||||
| 16 | use Del\SessionManager; |
||||||
| 17 | use Doctrine\ORM\EntityManager; |
||||||
|
0 ignored issues
–
show
The type
Doctrine\ORM\EntityManager 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...
|
|||||||
| 18 | use Laminas\I18n\Translator\Translator; |
||||||
| 19 | use PDO; |
||||||
| 20 | use Psr\Log\LoggerInterface; |
||||||
| 21 | |||||||
| 22 | class Init |
||||||
| 23 | { |
||||||
| 24 | /** |
||||||
| 25 | * @param Controller $controller |
||||||
| 26 | * @param Container $container |
||||||
| 27 | * @return Controller |
||||||
| 28 | */ |
||||||
| 29 | 1 | public static function controller(Controller $controller, Container $container): Controller |
|||||
| 30 | { |
||||||
| 31 | 1 | self::i18nCheck($controller, $container); |
|||||
| 32 | 1 | self::viewCheck($controller, $container); |
|||||
| 33 | 1 | self::pdoCheck($controller, $container); |
|||||
| 34 | 1 | self::entityManagerCheck($controller, $container); |
|||||
| 35 | 1 | self::siteConfigCheck($controller, $container); |
|||||
| 36 | 1 | self::sessionCheck($controller, $container); |
|||||
| 37 | 1 | self::loggerCheck($controller, $container); |
|||||
| 38 | |||||||
| 39 | 1 | return $controller; |
|||||
| 40 | } |
||||||
| 41 | |||||||
| 42 | /** |
||||||
| 43 | * @param \Bone\Controller\Controller $controller |
||||||
| 44 | * @param Container $container |
||||||
| 45 | */ |
||||||
| 46 | 1 | private static function pdoCheck(Controller $controller, Container $container): void |
|||||
| 47 | { |
||||||
| 48 | 1 | if ($controller instanceof DbProviderInterface) { |
|||||
| 49 | $controller->setDb($container->get(PDO::class)); |
||||||
| 50 | } |
||||||
| 51 | 1 | } |
|||||
| 52 | |||||||
| 53 | /** |
||||||
| 54 | * @param \Bone\Controller\Controller $controller |
||||||
| 55 | * @param Container $container |
||||||
| 56 | */ |
||||||
| 57 | 1 | private static function entityManagerCheck(Controller $controller, Container $container): void |
|||||
| 58 | { |
||||||
| 59 | 1 | if (in_array('Bone\BoneDoctrine\EntityManagerAwareInterface', class_implements($controller))) { |
|||||
| 60 | $controller->setEntityManager($container->get(EntityManager::class)); |
||||||
|
0 ignored issues
–
show
The method
setEntityManager() does not exist on Bone\Controller\Controller.
(
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. Loading history...
|
|||||||
| 61 | } |
||||||
| 62 | 1 | } |
|||||
| 63 | |||||||
| 64 | /** |
||||||
| 65 | * @param \Bone\Controller\Controller $controller |
||||||
| 66 | * @param Container $container |
||||||
| 67 | */ |
||||||
| 68 | 1 | private static function i18nCheck(Controller $controller, Container $container): void |
|||||
| 69 | { |
||||||
| 70 | 1 | if ($controller instanceof I18nAwareInterface) { |
|||||
| 71 | 1 | $controller->setTranslator($container->get(Translator::class)); |
|||||
| 72 | } |
||||||
| 73 | 1 | } |
|||||
| 74 | |||||||
| 75 | /** |
||||||
| 76 | * @param \Bone\Controller\Controller $controller |
||||||
| 77 | * @param Container $container |
||||||
| 78 | */ |
||||||
| 79 | 1 | private static function viewCheck(Controller $controller, Container $container): void |
|||||
| 80 | { |
||||||
| 81 | 1 | if ($controller instanceof ViewAwareInterface) { |
|||||
| 82 | 1 | $controller->setView($container->get(ViewEngine::class)); |
|||||
| 83 | } |
||||||
| 84 | 1 | } |
|||||
| 85 | |||||||
| 86 | /** |
||||||
| 87 | * @param \Bone\Controller\Controller $controller |
||||||
| 88 | * @param Container $container |
||||||
| 89 | */ |
||||||
| 90 | 1 | private static function siteConfigCheck(Controller $controller, Container $container): void |
|||||
| 91 | { |
||||||
| 92 | 1 | if ($controller instanceof SiteConfigAwareInterface) { |
|||||
| 93 | 1 | $controller->setSiteConfig($container->get(SiteConfig::class)); |
|||||
| 94 | } |
||||||
| 95 | 1 | } |
|||||
| 96 | |||||||
| 97 | /** |
||||||
| 98 | * @param \Bone\Controller\Controller $controller |
||||||
| 99 | * @param Container $container |
||||||
| 100 | */ |
||||||
| 101 | 1 | private static function sessionCheck(Controller $controller, Container $container): void |
|||||
| 102 | { |
||||||
| 103 | 1 | if ($controller instanceof SessionAwareInterface) { |
|||||
| 104 | 1 | $controller->setSession($container->get(SessionManager::class)); |
|||||
| 105 | } |
||||||
| 106 | 1 | } |
|||||
| 107 | |||||||
| 108 | /** |
||||||
| 109 | * @param \Bone\Controller\Controller $controller |
||||||
| 110 | * @param Container $container |
||||||
| 111 | */ |
||||||
| 112 | 1 | private static function loggerCheck(Controller $controller, Container $container): void |
|||||
| 113 | { |
||||||
| 114 | 1 | if ($controller instanceof LoggerAwareInterface) { |
|||||
| 115 | 1 | $channel = $controller->getChannel(); |
|||||
| 116 | 1 | $loggers = $container->get(LoggerInterface::class); |
|||||
| 117 | 1 | $logger = in_array($channel, $loggers) ? $loggers['channel'] : $loggers['default']; |
|||||
| 118 | 1 | $controller->setLogger($logger); |
|||||
| 119 | } |
||||||
| 120 | } |
||||||
| 121 | } |
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.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths