Passed
Push — master ( e0f6a7...4e7cde )
by Théo
02:22
created

FullyQualifiedFactory   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
dl 0
loc 20
rs 10
c 1
b 0
f 0
wmc 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 2 1
A concat() 0 10 3
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the humbug/php-scoper package.
7
 *
8
 * Copyright (c) 2017 Théo FIDRY <[email protected]>,
9
 *                    Pádraic Brady <[email protected]>
10
 *
11
 * For the full copyright and license information, please view the LICENSE
12
 * file that was distributed with this source code.
13
 */
14
15
namespace Humbug\PhpScoper\PhpParser\Node;
16
17
use InvalidArgumentException;
18
use PhpParser\Node\Name;
19
use PhpParser\Node\Name\FullyQualified;
20
21
final class FullyQualifiedFactory
22
{
23
    /**
24
     * @param string|string[]|Name|null $name1
25
     * @param string|string[]|Name|null $name2
26
     */
27
    public static function concat($name1, $name2, array $attributes = []): FullyQualified
28
    {
29
        if (null === $name1 && null === $name2) {
30
            throw new InvalidArgumentException('Expected one of the names to not be null');
31
        }
32
33
        /** @var FullyQualified $fqName */
34
        $fqName = FullyQualified::concat($name1, $name2, $attributes);
35
36
        return $fqName;
37
    }
38
39
    private function __construct()
40
    {
41
    }
42
}
43