Completed
Push — 1.5 ( 09e907...fb52dd )
by Colin
01:21
created

Reference::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 3
crap 1
1
<?php
2
3
/*
4
 * This file is part of the league/commonmark package.
5
 *
6
 * (c) Colin O'Dell <[email protected]>
7
 *
8
 * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js)
9
 *  - (c) John MacFarlane
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 League\CommonMark\Reference;
16
17
use League\CommonMark\Normalizer\TextNormalizer;
18
19
final class Reference implements ReferenceInterface
20
{
21
    /**
22
     * @var string
23
     */
24
    protected $label;
25
26
    /**
27
     * @var string
28
     */
29
    protected $destination;
30
31
    /**
32
     * @var string
33
     */
34
    protected $title;
35
36 318
    public function __construct(string $label, string $destination, string $title)
37
    {
38 318
        $this->label = $label;
39 318
        $this->destination = $destination;
40 318
        $this->title = $title;
41 318
    }
42
43 309
    public function getLabel(): string
44
    {
45 309
        return $this->label;
46
    }
47
48 258
    public function getDestination(): string
49
    {
50 258
        return $this->destination;
51
    }
52
53 249
    public function getTitle(): string
54
    {
55 249
        return $this->title;
56
    }
57
58
    /**
59
     * Normalize reference label
60
     *
61
     * This enables case-insensitive label matching
62
     *
63
     * @param string $string
64
     *
65
     * @return string
66
     *
67
     * @deprecated Use TextNormalizer::normalize() instead
68
     */
69
    public static function normalizeReference(string $string): string
70
    {
71
        @trigger_error(sprintf('%s::normlizeReference() is deprecated; use %s::normalize() instead', self::class, TextNormalizer::class), E_USER_DEPRECATED);
72
73
        return (new TextNormalizer())->normalize($string);
74
    }
75
}
76