1 | <?php |
||
7 | class PlaceholderContainer extends Collection |
||
8 | { |
||
9 | /** |
||
10 | * Hash used in placeholders. |
||
11 | * |
||
12 | * @var string |
||
13 | */ |
||
14 | protected $replacementHash; |
||
15 | |||
16 | /** |
||
17 | * Create a new placeholdercontainer. |
||
18 | * |
||
19 | * @param array $items |
||
20 | */ |
||
21 | 28 | public function __construct($items = []) |
|
27 | |||
28 | /** |
||
29 | * @param string $contents |
||
30 | * |
||
31 | * @return string |
||
32 | */ |
||
33 | 4 | public function restorePlaceholders($contents) |
|
41 | |||
42 | /** |
||
43 | * Replace ```$value``` with a placeholder and store it in the container. |
||
44 | * |
||
45 | * @param string $value |
||
46 | * @param string $content |
||
47 | * |
||
48 | * @return string $contents |
||
49 | */ |
||
50 | 3 | public function addPlaceholder($value, $content) |
|
56 | |||
57 | /** |
||
58 | * Create a unique placeholder for the given contents. |
||
59 | * |
||
60 | * @param string $value |
||
61 | * |
||
62 | * @return string $placeholder |
||
|
|||
63 | */ |
||
64 | 5 | public function createPlaceholder($value) |
|
77 | |||
78 | /** |
||
79 | * Calculate the byte size of the placeholders. |
||
80 | * |
||
81 | * @param string $contentsWithPlaceholders |
||
82 | * @return int |
||
83 | */ |
||
84 | 4 | public function getContentSize($contentsWithPlaceholders) |
|
94 | |||
95 | /** |
||
96 | * Create an unique placeholder. |
||
97 | * |
||
98 | * @return string |
||
99 | */ |
||
100 | 5 | protected function createUniquePlaceholder() |
|
104 | |||
105 | /** |
||
106 | * Remove nested placeholders so no nested placholders remain in the original contents. |
||
107 | * |
||
108 | * @param string $originalContent |
||
109 | * |
||
110 | * @return string |
||
111 | */ |
||
112 | protected function removeNestedPlaceholders($originalContent) |
||
118 | } |
||
119 |
This check compares the return type specified in the
@return
annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.