GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

RendererFactory   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
lcom 0
cbo 4
dl 0
loc 29
rs 10
c 1
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A createService() 0 19 3
1
<?php
2
/**
3
 * Description
4
 *
5
 * @category  Acsi
6
 * @package   Acsi\
7
 * @copyright 2012 Bram Gerritsen
8
 * @version   SVN: $Id$
9
 */
10
11
namespace StrokerForm\Factory;
12
13
use StrokerForm\FormManager;
14
use StrokerForm\Options\ModuleOptions;
15
use StrokerForm\Renderer\RendererCollection;
16
use StrokerForm\Renderer\RendererInterface;
17
use Zend\ServiceManager\FactoryInterface;
18
use Zend\ServiceManager\ServiceLocatorInterface;
19
20
class RendererFactory implements FactoryInterface
21
{
22
    /**
23
     * Create service
24
     *
25
     * @param  ServiceLocatorInterface $serviceLocator
26
     *
27
     * @return RendererInterface
28
     */
29
    public function createService(ServiceLocatorInterface $serviceLocator)
30
    {
31
        /** @var $options ModuleOptions */
32
        $options = $serviceLocator->get(ModuleOptions::class);
33
        $rendererCollection = new RendererCollection();
34
        foreach ($options->getActiveRenderers() as $rendererAlias) {
35
            /** @var $renderer RendererInterface */
36
            $renderer = $serviceLocator->get($rendererAlias);
37
            $renderer->setDefaultOptions($options->getRendererOptions($rendererAlias));
38
            $renderer->setFormManager($serviceLocator->get(FormManager::class));
39
            if ($serviceLocator->has('translator')) {
40
                $renderer->setTranslator($serviceLocator->get('translator'));
41
            }
42
            $renderer->setHttpRouter($serviceLocator->get('HttpRouter'));
0 ignored issues
show
Documentation introduced by
$serviceLocator->get('HttpRouter') is of type object|array, but the function expects a object<Zend\Mvc\Router\RouteInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
43
            $rendererCollection->addRenderer($renderer);
44
        }
45
46
        return $rendererCollection;
47
    }
48
}
49