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
eloc 5
c 1
b 0
f 0
dl 0
loc 12
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 10 1
1
<?php
2
3
namespace Rvdlee\ZfImageResizer\Factory\Controller;
4
5
use Interop\Container\ContainerInterface;
6
use Rvdlee\ZfImageResizer\Controller\ConsoleController;
7
use Rvdlee\ZfImageResizer\Service\ImageResizerService;
8
use Zend\Log\Logger;
9
use Zend\Log\Writer\Stream;
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 ImageResizerService $imageResizerService */
21
        $imageResizerService = $container->build(ImageResizerService::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
        $imageResizerService = $container->build(ImageResizerService::class, ['logger' => $logger]);
Loading history...
22
23
        return new ConsoleController($imageResizerService);
24
    }
25
}