1 | <?php |
||
21 | final class QuoteProcessor implements DelimiterProcessorInterface |
||
22 | { |
||
23 | /** @var string */ |
||
24 | private $normalizedCharacter; |
||
25 | |||
26 | /** @var string */ |
||
27 | private $openerCharacter; |
||
28 | |||
29 | /** @var string */ |
||
30 | private $closerCharacter; |
||
31 | |||
32 | /** |
||
33 | * QuoteProcessor constructor. |
||
34 | * |
||
35 | * @param string $char |
||
36 | * @param string $opener |
||
37 | * @param string $closer |
||
38 | */ |
||
39 | 57 | private function __construct(string $char, string $opener, string $closer) |
|
45 | |||
46 | /** |
||
47 | * {@inheritdoc} |
||
48 | */ |
||
49 | 57 | public function getOpeningCharacter(): string |
|
53 | |||
54 | /** |
||
55 | * {@inheritdoc} |
||
56 | */ |
||
57 | 57 | public function getClosingCharacter(): string |
|
61 | |||
62 | /** |
||
63 | * {@inheritdoc} |
||
64 | */ |
||
65 | 6 | public function getMinLength(): int |
|
69 | |||
70 | /** |
||
71 | * {@inheritdoc} |
||
72 | */ |
||
73 | 36 | public function getDelimiterUse(DelimiterInterface $opener, DelimiterInterface $closer): int |
|
77 | |||
78 | /** |
||
79 | * {@inheritdoc} |
||
80 | */ |
||
81 | 36 | public function process(AbstractStringContainer $opener, AbstractStringContainer $closer, int $delimiterUse) |
|
86 | |||
87 | /** |
||
88 | * Create a double-quote processor |
||
89 | * |
||
90 | * @param string $opener |
||
91 | * @param string $closer |
||
92 | * |
||
93 | * @return QuoteProcessor |
||
94 | */ |
||
95 | 54 | public static function createDoubleQuoteProcessor(string $opener = Quote::DOUBLE_QUOTE_OPENER, string $closer = Quote::DOUBLE_QUOTE_CLOSER): self |
|
99 | |||
100 | /** |
||
101 | * Create a single-quote processor |
||
102 | * |
||
103 | * @param string $opener |
||
104 | * @param string $closer |
||
105 | * |
||
106 | * @return QuoteProcessor |
||
107 | */ |
||
108 | 54 | public static function createSingleQuoteProcessor(string $opener = Quote::SINGLE_QUOTE_OPENER, string $closer = Quote::SINGLE_QUOTE_CLOSER): self |
|
112 | } |
||
113 |