getPartsAsString()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Eclipxe\XmlSchemaValidator\Exceptions;
6
7
use RuntimeException;
8
9
final class SchemaLocationPartsNotEvenException extends RuntimeException implements XmlSchemaValidatorException
10
{
11
    /** @var string[] */
12
    private $parts;
13
14
    /**
15
     * SchemaLocationPartsNotEvenException constructor.
16
     *
17
     * @param string $message
18
     * @param string[] $parts
19
     */
20 1
    private function __construct(string $message, array $parts)
21
    {
22 1
        parent::__construct($message);
23 1
        $this->parts = $parts;
24
    }
25
26
    /**
27
     * @param string[] $parts
28
     * @return self
29
     */
30 1
    public static function create(array $parts): self
31
    {
32 1
        return new self('The schemaLocation attribute does not have even parts', $parts);
33
    }
34
35
    /**
36
     * Return the parts found on the schemaLocations attribute
37
     *
38
     * @return string[]
39
     */
40 1
    public function getParts(): array
41
    {
42 1
        return $this->parts;
43
    }
44
45
    /**
46
     * Return the parts found on the schemaLocations attribute separated by a space
47
     *
48
     * @return string
49
     */
50 1
    public function getPartsAsString(): string
51
    {
52 1
        return implode(' ', $this->parts);
53
    }
54
}
55