Passed
Push — master ( 166838...df99f5 )
by Bruno
06:43 queued 17s
created

NamespaceTrait::getNamespaces()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
ccs 0
cts 0
cp 0
rs 10
cc 1
nc 1
nop 0
crap 2
1
<?php declare(strict_types=1);
2
3
namespace Formularium\Factory;
4
5
trait NamespaceTrait
6
{
7
    /**
8
     * Namespaces to search
9
     *
10
     * @var string[]
11
     */
12
    protected static $namespaces = [];
13
14
    /**
15
     * External factory functions.
16
     *
17
     * @var callable[]
18
     */
19
    protected static $factories = [];
20
21
    public static function registerFactory(callable $factory): void
22
    {
23
        static::$factories[] = $factory;
24
    }
25
26
    /**
27
     * @param string $ns The namespace to add
28
     * @return void
29
     * @codeCoverageIgnore
30
     */
31
    public static function appendNamespace(string $ns): void
32
    {
33
        static::$namespaces[] = $ns;
34
    }
35
36
    /**
37
     * @return string[]
38
     * @codeCoverageIgnore
39
     */
40
    public static function getNamespaces(): array
41
    {
42
        return static::$namespaces;
43
    }
44
}
45