ConsoleControllerFactory   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
eloc 5
dl 0
loc 12
rs 10
c 1
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 10 1
1
<?php
2
3
namespace Rvdlee\ZfImageOptimiser\Factory\Controller;
4
5
use Interop\Container\ContainerInterface;
6
use Rvdlee\ZfImageOptimiser\Controller\ConsoleController;
7
use Rvdlee\ZfImageOptimiser\Service\ImageOptimiserService;
8
use Zend\Log\Logger;
0 ignored issues
show
Bug introduced by
The type Zend\Log\Logger 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. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
9
use Zend\Log\Writer\Stream;
0 ignored issues
show
Bug introduced by
The type Zend\Log\Writer\Stream 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. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
10
use Zend\ServiceManager\Factory\FactoryInterface;
11
12
class ConsoleControllerFactory implements FactoryInterface
13
{
14
    public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
15
    {
16
        /** @var Logger $logger */
17
        $logger = $container->get(Logger::class);
18
        /** @var Stream $writer */
19
        $logger->addWriter(new Stream('php://output'));
20
        /** @var ImageOptimiserService $imageOptimiserService */
21
        $imageOptimiserService = $container->build(ImageOptimiserService::class, ['logger' => $logger]);
0 ignored issues
show
Bug introduced by
The method build() does not exist on Interop\Container\ContainerInterface. It seems like you code against a sub-type of Interop\Container\ContainerInterface such as Zend\ServiceManager\ServiceLocatorInterface. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

21
        /** @scrutinizer ignore-call */ 
22
        $imageOptimiserService = $container->build(ImageOptimiserService::class, ['logger' => $logger]);
Loading history...
22
23
        return new ConsoleController($imageOptimiserService);
24
    }
25
}