1<?php 2 3/* 4 * This file is part of the league/commonmark package. 5 * 6 * (c) Colin O'Dell <colinodell@gmail.com> 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 15namespace League\CommonMark\Reference; 16 17use League\CommonMark\Normalizer\TextNormalizer; 18 19final 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 public function __construct(string $label, string $destination, string $title) 37 { 38 $this->label = $label; 39 $this->destination = $destination; 40 $this->title = $title; 41 } 42 43 public function getLabel(): string 44 { 45 return $this->label; 46 } 47 48 public function getDestination(): string 49 { 50 return $this->destination; 51 } 52 53 public function getTitle(): string 54 { 55 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 * @group legacy 69 */ 70 public static function normalizeReference(string $string): string 71 { 72 @trigger_error(sprintf('%s::normlizeReference() is deprecated; use %s::normalize() instead', self::class, TextNormalizer::class), E_USER_DEPRECATED); 73 74 return (new TextNormalizer())->normalize($string); 75 } 76} 77