Completed
Push — develop ( d73a05...7ce957 )
by Mike
07:24
created

ProjectFactoryFactory::create()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 25

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
nc 2
nop 1
dl 0
loc 25
rs 9.52
c 0
b 0
f 0
1
<?php
2
declare(strict_types=1);
3
4
/**
5
 * This file is part of phpDocumentor.
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 *
10
 * @author    Mike van Riel <[email protected]>
11
 * @copyright 2010-2018 Mike van Riel / Naenius (http://www.naenius.com)
12
 * @license   http://www.opensource.org/licenses/mit-license.php MIT
13
 * @link      http://phpdoc.org
14
 */
15
16
namespace phpDocumentor\Parser;
17
18
use phpDocumentor\Reflection\DocBlockFactory;
19
use phpDocumentor\Reflection\Php\Factory;
20
use phpDocumentor\Reflection\Php\NodesFactory;
21
use phpDocumentor\Reflection\Php\ProjectFactory;
22
use phpDocumentor\Reflection\PrettyPrinter;
23
24
final class ProjectFactoryFactory
25
{
26
    public static function create(iterable $fileMiddlewaresBuilder): ProjectFactory
27
    {
28
        $fileMiddlewares = [];
29
        foreach ($fileMiddlewaresBuilder as $middleware) {
30
            $fileMiddlewares[] = $middleware;
31
        }
32
33
        $strategies = [
34
            new Factory\Argument(new PrettyPrinter()),
35
            new Factory\Class_(),
36
            new Factory\Constant(new PrettyPrinter()),
37
            new Factory\DocBlock(DocBlockFactory::createInstance()),
38
            new Factory\Function_(),
39
            new Factory\Interface_(),
40
            new Factory\Method(),
41
            new Factory\Property(new PrettyPrinter()),
42
            new Factory\Trait_(),
43
            new Factory\File(
44
                NodesFactory::createInstance(),
45
                $fileMiddlewares
46
            ),
47
        ];
48
49
        return new ProjectFactory($strategies);
50
    }
51
}
52