1 | <?php |
||
5 | class Flank extends BasicTerminalObject |
||
6 | { |
||
7 | /** |
||
8 | * The string that will be flanked |
||
9 | * |
||
10 | * @var string $str |
||
11 | */ |
||
12 | protected $str; |
||
13 | |||
14 | /** |
||
15 | * The character(s) to repeat on either side of the string |
||
16 | * |
||
17 | * @var string $char |
||
18 | */ |
||
19 | protected $char = '#'; |
||
20 | |||
21 | /** |
||
22 | * How many times the character(s) should be repeated on either side |
||
23 | * |
||
24 | * @var integer $repeat |
||
25 | */ |
||
26 | protected $repeat = 3; |
||
27 | |||
28 | 52 | public function __construct($str, $char = null, $repeat = null) |
|
34 | |||
35 | /** |
||
36 | * Set the character(s) to repeat on either side |
||
37 | * |
||
38 | * @param string $char |
||
39 | * |
||
40 | * @return Flank |
||
41 | */ |
||
42 | 52 | public function char($char) |
|
48 | |||
49 | /** |
||
50 | * Set the repeat of the flank character(s) |
||
51 | * |
||
52 | * @param integer $repeat |
||
53 | * |
||
54 | * @return Flank |
||
55 | */ |
||
56 | 52 | public function repeat($repeat) |
|
62 | |||
63 | /** |
||
64 | * Return the flanked string |
||
65 | * |
||
66 | * @return string |
||
67 | */ |
||
68 | 52 | public function result() |
|
74 | } |
||
75 |