1 | <?php |
||
20 | class DocHelper |
||
21 | { |
||
22 | /** |
||
23 | * The position of the end token of the doc block. |
||
24 | * |
||
25 | * @var int|null|bool If false then it will be loaded in the getter. |
||
26 | */ |
||
27 | private $blockEndPosition = false; |
||
28 | |||
29 | /** |
||
30 | * The php cs file. |
||
31 | * |
||
32 | * @var File |
||
33 | */ |
||
34 | private $file; |
||
35 | |||
36 | /** |
||
37 | * Position to the token which is to be listened. |
||
38 | * |
||
39 | * @var int |
||
40 | */ |
||
41 | private $stackPos; |
||
42 | |||
43 | /** |
||
44 | * Token stack of the current file. |
||
45 | * |
||
46 | 121 | * @var array |
|
47 | */ |
||
48 | 121 | private $tokens; |
|
49 | 121 | ||
50 | 121 | /** |
|
51 | 121 | * DocHelper constructor. |
|
52 | * |
||
53 | * @param File $file File object of file which is processed. |
||
54 | * @param int $stackPos Position to the token which is processed. |
||
55 | */ |
||
56 | public function __construct(File $file, $stackPos) |
||
62 | 121 | ||
63 | 121 | /** |
|
64 | * Returns position to the class comment end. |
||
65 | 121 | * |
|
66 | 121 | * @return int|null Position to the class comment end. |
|
67 | */ |
||
68 | 4 | public function getBlockEndPosition(): ?int |
|
76 | |||
77 | 117 | /** |
|
78 | * Returns token data of the evaluated class comment end. |
||
79 | * |
||
80 | * @return array Token data of the comment end. |
||
81 | */ |
||
82 | public function getBlockEndToken(): array |
||
92 | 4 | ||
93 | 4 | /** |
|
94 | 4 | * Returns pointer to the class comment start. |
|
95 | * |
||
96 | * @return int Pointer to the class comment start. |
||
97 | 4 | */ |
|
98 | public function getBlockStartPosition(): int |
||
104 | |||
105 | /** |
||
106 | * Returns token data of the evaluated class comment start. |
||
107 | * |
||
108 | 117 | * @return array Token data of the comment start. |
|
109 | */ |
||
110 | 117 | public function getBlockStartToken(): array |
|
116 | |||
117 | /** |
||
118 | * Returns true if there is a doc block. |
||
119 | * |
||
120 | 117 | * @return bool |
|
121 | */ |
||
122 | 117 | public function hasDocBlock(): bool |
|
126 | |||
127 | /** |
||
128 | * Returns true if this doc block is a multi line comment. |
||
129 | * |
||
130 | * @return bool |
||
131 | */ |
||
132 | 121 | public function isMultiLine(): bool |
|
139 | 121 | ||
140 | 121 | /** |
|
141 | 121 | * Returns the position of the token for the doc block end. |
|
142 | 121 | * |
|
143 | 121 | * @return int|null |
|
144 | */ |
||
145 | private function loadBlockEndPosition(): ?int |
||
160 | } |
||
161 |