Factory::getPreprocessor()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
c 0
b 0
f 0
rs 9.4285
cc 2
eloc 5
nc 2
nop 0
1
<?php
2
3
declare(strict_types = 1);
4
5
namespace Foo\Pdo\Statement\Preprocessor;
6
7
use Foo\Pdo\Statement\Preprocessor;
8
use Foo\Pdo\Statement\Preprocessor\ArrayParameter\Associative;
9
use Foo\Pdo\Statement\Preprocessor\ArrayParameter\Numeric;
10
11
class Factory
12
{
13
    /** @var Preprocessor */
14
    protected static $instance;
15
16
    /**
17
     * @return Preprocessor
18
     */
19
    public static function getPreprocessor()
20
    {
21
        if (self::$instance instanceof Preprocessor) {
22
            return self::$instance;
23
        }
24
25
        self::$instance = new Preprocessor(new ArrayParameter(new Numeric(), new Associative()));
26
27
        return self::$instance;
28
    }
29
}
30