1 | <?php |
||
36 | class Capture |
||
37 | { |
||
38 | |||
39 | /** |
||
40 | * Array of snippets |
||
41 | * @var string[] |
||
42 | */ |
||
43 | private static $snippets = []; |
||
44 | |||
45 | /** |
||
46 | * Id counter for auto id's |
||
47 | * @var int |
||
48 | */ |
||
49 | private static $idCounter = 0; |
||
50 | |||
51 | /** |
||
52 | * Whenever capture is opened |
||
53 | * @var bool |
||
54 | */ |
||
55 | private static $isOpen = false; |
||
56 | |||
57 | /** |
||
58 | * Currently capturing id |
||
59 | * @var int|string |
||
60 | */ |
||
61 | private static $currentId = 0; |
||
62 | |||
63 | /** |
||
64 | * Currently captured file |
||
65 | * @var string |
||
66 | */ |
||
67 | private static $currentFile = ''; |
||
68 | |||
69 | /** |
||
70 | * Currentlty captured starting line |
||
71 | * @var int |
||
72 | */ |
||
73 | private static $currentLine = 0; |
||
74 | |||
75 | /** |
||
76 | * Open PHP capturing block |
||
77 | * |
||
78 | * @param int|string $id |
||
79 | */ |
||
80 | public static function open($id = null) |
||
96 | |||
97 | /** |
||
98 | * Close php capturing block |
||
99 | */ |
||
100 | public static function close() |
||
114 | |||
115 | /** |
||
116 | * Get last snipped or choosen by id. |
||
117 | * @param int|string $id |
||
118 | * @return Wrapper |
||
119 | */ |
||
120 | public static function get($id = null) |
||
132 | |||
133 | /** |
||
134 | * Get captured PHP block, additionally wrapped by markdown |
||
135 | * fenced PHP code mark. This can be directly outputted to md file. |
||
136 | * @param int|string $id |
||
137 | */ |
||
138 | public static function getMd($id = null) |
||
142 | |||
143 | /** |
||
144 | * Get captured PHP block, additionally wrapped by html pre and code tags. |
||
145 | * This can be directly outputted to HTML file. |
||
146 | * @param int|string $id |
||
147 | */ |
||
148 | public static function getHtml($id = null) |
||
152 | |||
153 | } |
||
154 |