ManagerFactory::create()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 8
ccs 0
cts 7
cp 0
rs 9.4285
c 1
b 0
f 0
cc 1
eloc 5
nc 1
nop 0
crap 2
1
<?php
2
3
namespace Portiere\WebServer;
4
5
use Symfony\Component\Filesystem\Filesystem;
6
use Symfony\Component\Templating\Loader\FilesystemLoader;
7
use Symfony\Component\Templating\PhpEngine;
8
use Symfony\Component\Templating\TemplateNameParser;
9
10
/**
11
 * Class ManagerFactory.
12
 *
13
 * The ManagerFactory creates a Manager instances of the currently running web server
14
 *
15
 * @author Ignacio Velazquez <[email protected]>
16
 */
17
class ManagerFactory
18
{
19
    /**
20
     * Creates a Manager depending on the running web server.
21
     *
22
     * @return NginxManager
23
     */
24
    public static function create()
25
    {
26
        $fs = new Filesystem();
27
        $loader = new FilesystemLoader(__DIR__.'/../Resources/views/%name%');
0 ignored issues
show
Documentation introduced by
__DIR__ . '/../Resources/views/%name%' is of type string, but the function expects a array.

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...
28
        $templating = new PhpEngine(new TemplateNameParser(), $loader);
29
30
        return new NginxManager($fs, $templating);
31
    }
32
}
33