1 | <?php |
||
12 | class BorderManager |
||
13 | { |
||
14 | const STYLE_UNDERLINE = 'underlineBorder'; |
||
15 | const STYLE_DOUBLE_UNDERLINE = 'doubleUnderlineBorder'; |
||
16 | const STYLE_BORDER = 'border'; |
||
17 | const STYLE_DOUBLE_BORDER = 'doubleBorder'; |
||
18 | |||
19 | /** |
||
20 | * Static calls interface |
||
21 | */ |
||
22 | public static function __callstatic($name, $params) |
||
34 | |||
35 | /** |
||
36 | * Get known borders |
||
37 | * |
||
38 | * @return string[] |
||
39 | */ |
||
40 | public static function getKnownBorders() |
||
51 | |||
52 | /** |
||
53 | * Render bordered string |
||
54 | * |
||
55 | * @param string $string |
||
56 | * @param Border $border |
||
57 | * |
||
58 | * @return string |
||
59 | * @throws Exception |
||
60 | */ |
||
61 | 1 | public static function buildBorder($string, Border $border) |
|
76 | |||
77 | /** |
||
78 | * Underline with the given Border the given string |
||
79 | * |
||
80 | * @param string $string |
||
81 | * @param Border $border |
||
82 | * |
||
83 | * @return string |
||
84 | */ |
||
85 | private static function buildUnderline($string, Border $border) |
||
94 | |||
95 | /** |
||
96 | * Frame with the given Border the given string |
||
97 | * |
||
98 | * @param string $string |
||
99 | * @param Border $border |
||
100 | * |
||
101 | * @return string |
||
102 | */ |
||
103 | private static function buildFrame($string, Border $border) |
||
117 | |||
118 | /** |
||
119 | * Underline a string with '-' |
||
120 | * |
||
121 | * Be careful, this adds two end-of-line |
||
122 | * |
||
123 | * @param string $string |
||
124 | * |
||
125 | * @return string |
||
126 | */ |
||
127 | private static function __underlineBorder($string) |
||
134 | |||
135 | /** |
||
136 | * Underline a string with '=' |
||
137 | * |
||
138 | * Be careful, this adds two end-of-line |
||
139 | * |
||
140 | * @param string $string |
||
141 | * |
||
142 | * @return string |
||
143 | */ |
||
144 | private static function __doubleUnderlineBorder($string) |
||
151 | |||
152 | /** |
||
153 | * Draw a border around a string |
||
154 | * |
||
155 | * @param string $string |
||
156 | * |
||
157 | * @return string |
||
158 | */ |
||
159 | private static function __border($string) |
||
166 | |||
167 | /** |
||
168 | * Draw a double border around a string |
||
169 | * |
||
170 | * @param string $string |
||
171 | * |
||
172 | * @return string |
||
173 | */ |
||
174 | private static function __doubleBorder($string) |
||
181 | } |
||
182 |