3 * Zend Framework (http://framework.zend.com/)
5 * @link http://github.com/zendframework/zf2 for the canonical source repository
6 * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
7 * @license http://framework.zend.com/license/new-bsd New BSD License
10 namespace Zend\Text\Table\Decorator
;
12 use Zend\Text\Table\Decorator\DecoratorInterface
as Decorator
;
15 * Unicode Decorator for Zend\Text\Table
17 class Unicode
implements Decorator
20 * Defined by Zend\Text\Table\Decorator\DecoratorInterface
24 public function getTopLeft()
26 return $this->_uniChar(0x250C);
30 * Defined by Zend\Text\Table\Decorator\DecoratorInterface
34 public function getTopRight()
36 return $this->_uniChar(0x2510);
40 * Defined by Zend\Text\Table\Decorator\DecoratorInterface
44 public function getBottomLeft()
46 return $this->_uniChar(0x2514);
50 * Defined by Zend\Text\Table\Decorator\DecoratorInterface
54 public function getBottomRight()
56 return $this->_uniChar(0x2518);
60 * Defined by Zend\Text\Table\Decorator\DecoratorInterface
64 public function getVertical()
66 return $this->_uniChar(0x2502);
70 * Defined by Zend\Text\Table\Decorator\DecoratorInterface
74 public function getHorizontal()
76 return $this->_uniChar(0x2500);
80 * Defined by Zend\Text\Table\Decorator\DecoratorInterface
84 public function getCross()
86 return $this->_uniChar(0x253C);
90 * Defined by Zend\Text\Table\Decorator\DecoratorInterface
94 public function getVerticalRight()
96 return $this->_uniChar(0x251C);
100 * Defined by Zend\Text\Table\Decorator\DecoratorInterface
104 public function getVerticalLeft()
106 return $this->_uniChar(0x2524);
110 * Defined by Zend\Text\Table\Decorator\DecoratorInterface
114 public function getHorizontalDown()
116 return $this->_uniChar(0x252C);
120 * Defined by Zend\Text\Table\Decorator\DecoratorInterface
124 public function getHorizontalUp()
126 return $this->_uniChar(0x2534);
130 * Convert am unicode character code to a character
133 * @return string|false
135 protected function _uniChar($code)
139 } elseif ($code <= 0x7FF) {
140 $char = chr(0xC0 |
$code >> 6)
141 . chr(0x80 |
$code & 0x3F);
142 } elseif ($code <= 0xFFFF) {
143 $char = chr(0xE0 |
$code >> 12)
144 . chr(0x80 |
$code >> 6 & 0x3F)
145 . chr(0x80 |
$code & 0x3F);
146 } elseif ($code <= 0x10FFFF) {
147 $char = chr(0xF0 |
$code >> 18)
148 . chr(0x80 |
$code >> 12 & 0x3F)
149 . chr(0x80 |
$code >> 6 & 0x3F)
150 . chr(0x80 |
$code & 0x3F);