@@ -30,6 +30,9 @@ |
||
30 | 30 | return $this->_bound; |
31 | 31 | } |
32 | 32 | |
33 | + /** |
|
34 | + * @param integer $size |
|
35 | + */ |
|
33 | 36 | public function __construct($size) { |
34 | 37 | $this->_size = $size; |
35 | 38 | } |
@@ -14,9 +14,9 @@ |
||
14 | 14 | |
15 | 15 | public function align($type) { |
16 | 16 | switch ($type) { |
17 | - case 'left': $this->_pad = STR_PAD_RIGHT;break; |
|
18 | - case 'center': $this->_pad = STR_PAD_BOTH;break; |
|
19 | - case 'right': $this->_pad = STR_PAD_LEFT;break; |
|
17 | + case 'left': $this->_pad = STR_PAD_RIGHT; break; |
|
18 | + case 'center': $this->_pad = STR_PAD_BOTH; break; |
|
19 | + case 'right': $this->_pad = STR_PAD_LEFT; break; |
|
20 | 20 | } |
21 | 21 | $this->_align = $type; |
22 | 22 | } |
@@ -6,15 +6,15 @@ |
||
6 | 6 | private function _hex2bin($hexstr) |
7 | 7 | { |
8 | 8 | $n = strlen($hexstr); |
9 | - $sbin=""; |
|
10 | - $i=0; |
|
11 | - while($i<$n) |
|
9 | + $sbin = ""; |
|
10 | + $i = 0; |
|
11 | + while ($i < $n) |
|
12 | 12 | { |
13 | - $a =substr($hexstr,$i,2); |
|
14 | - $c = pack("H*",$a); |
|
15 | - if ($i==0){$sbin=$c;} |
|
16 | - else {$sbin.=$c;} |
|
17 | - $i+=2; |
|
13 | + $a = substr($hexstr, $i, 2); |
|
14 | + $c = pack("H*", $a); |
|
15 | + if ($i==0) {$sbin = $c; } |
|
16 | + else {$sbin .= $c; } |
|
17 | + $i += 2; |
|
18 | 18 | } |
19 | 19 | return $sbin; |
20 | 20 | } |
@@ -12,8 +12,7 @@ |
||
12 | 12 | { |
13 | 13 | $a =substr($hexstr,$i,2); |
14 | 14 | $c = pack("H*",$a); |
15 | - if ($i==0){$sbin=$c;} |
|
16 | - else {$sbin.=$c;} |
|
15 | + if ($i==0){$sbin=$c;} else {$sbin.=$c;} |
|
17 | 16 | $i+=2; |
18 | 17 | } |
19 | 18 | return $sbin; |
@@ -10,21 +10,21 @@ |
||
10 | 10 | 'yellow' => '18' |
11 | 11 | ), |
12 | 12 | 'red' => array( |
13 | - 'black' => '08',// |
|
14 | - 'red' => '08',// |
|
15 | - 'green' => '08',// |
|
13 | + 'black' => '08', // |
|
14 | + 'red' => '08', // |
|
15 | + 'green' => '08', // |
|
16 | 16 | 'yellow' => '19', |
17 | 17 | ), |
18 | 18 | 'green' => array( |
19 | 19 | 'black' => '02', |
20 | 20 | 'red' => '08', // |
21 | - 'green' => '08',// |
|
21 | + 'green' => '08', // |
|
22 | 22 | 'yellow' => '08'// |
23 | 23 | ), |
24 | 24 | 'yellow' => array( |
25 | - 'black' => '08',// |
|
25 | + 'black' => '08', // |
|
26 | 26 | 'red' => '0B', |
27 | - 'green' => '08',// |
|
27 | + 'green' => '08', // |
|
28 | 28 | 'yellow' => '08'// |
29 | 29 | ) |
30 | 30 | ); |
@@ -30,7 +30,9 @@ |
||
30 | 30 | ); |
31 | 31 | |
32 | 32 | public static function get($fore, $back) { |
33 | - if (!isset(self::$_map[$back][$fore])) return '08'; |
|
33 | + if (!isset(self::$_map[$back][$fore])) { |
|
34 | + return '08'; |
|
35 | + } |
|
34 | 36 | return self::$_map[$back][$fore]; |
35 | 37 | } |
36 | 38 | } |
37 | 39 | \ No newline at end of file |
@@ -74,7 +74,7 @@ |
||
74 | 74 | } |
75 | 75 | // add padding |
76 | 76 | if ($length < $this->_length) { |
77 | - for ($i=$length; $i < $this->_length; $i++) { |
|
77 | + for ($i = $length; $i < $this->_length; $i++) { |
|
78 | 78 | $output .= $this->_char(' ', null, $this->_background); |
79 | 79 | } |
80 | 80 | } |
@@ -63,12 +63,16 @@ |
||
63 | 63 | |
64 | 64 | foreach ($this->_params as $key => $param) { |
65 | 65 | $p = $param['param']; |
66 | - if (!$p->bound()) continue; |
|
66 | + if (!$p->bound()) { |
|
67 | + continue; |
|
68 | + } |
|
67 | 69 | $this->_text = substr_replace($this->_text, $p->value(), $param['offset'], strlen($p->value())); |
68 | 70 | } |
69 | 71 | // apply colours |
70 | 72 | foreach (str_split($this->_text) as $key => $char) { |
71 | - if ($length++ > $this->_length) break; |
|
73 | + if ($length++ > $this->_length) { |
|
74 | + break; |
|
75 | + } |
|
72 | 76 | $fore = $this->_getColour($key); |
73 | 77 | $output .= $this->_char($char, $fore); |
74 | 78 | } |