CopyrightHolder::__construct()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 12
rs 9.8666
c 0
b 0
f 0
cc 3
nc 3
nop 1
1
<?php
2
3
namespace CultuurNet\UDB3\Media\Properties;
4
5
use InvalidArgumentException;
6
use ValueObjects\Exception\InvalidNativeArgumentException;
7
use ValueObjects\StringLiteral\StringLiteral;
8
9
final class CopyrightHolder extends StringLiteral
10
{
11
    public function __construct($value)
12
    {
13
        if (false === \is_string($value)) {
14
            throw new InvalidNativeArgumentException($value, array('string'));
15
        }
16
17
        if (strlen($value) < 2) {
18
            throw new InvalidArgumentException('The name of a copyright holder should be at least 2 characters');
19
        }
20
21
        parent::__construct(substr($value, 0, 250));
22
    }
23
}
24