3 * @see https://github.com/zendframework/zend-text for the canonical source repository
4 * @copyright Copyright (c) 2005-2018 Zend Technologies USA Inc. (https://www.zend.com)
5 * @license https://github.com/zendframework/zend-text/blob/master/LICENSE.md New BSD License
8 namespace Zend\Text\Table\Decorator
;
10 use Zend\Text\Table\Decorator\DecoratorInterface
as Decorator
;
13 * Unicode Decorator for Zend\Text\Table
15 class Unicode
implements Decorator
18 * Defined by Zend\Text\Table\Decorator\DecoratorInterface
22 public function getTopLeft()
24 return $this->_uniChar(0x250C);
28 * Defined by Zend\Text\Table\Decorator\DecoratorInterface
32 public function getTopRight()
34 return $this->_uniChar(0x2510);
38 * Defined by Zend\Text\Table\Decorator\DecoratorInterface
42 public function getBottomLeft()
44 return $this->_uniChar(0x2514);
48 * Defined by Zend\Text\Table\Decorator\DecoratorInterface
52 public function getBottomRight()
54 return $this->_uniChar(0x2518);
58 * Defined by Zend\Text\Table\Decorator\DecoratorInterface
62 public function getVertical()
64 return $this->_uniChar(0x2502);
68 * Defined by Zend\Text\Table\Decorator\DecoratorInterface
72 public function getHorizontal()
74 return $this->_uniChar(0x2500);
78 * Defined by Zend\Text\Table\Decorator\DecoratorInterface
82 public function getCross()
84 return $this->_uniChar(0x253C);
88 * Defined by Zend\Text\Table\Decorator\DecoratorInterface
92 public function getVerticalRight()
94 return $this->_uniChar(0x251C);
98 * Defined by Zend\Text\Table\Decorator\DecoratorInterface
102 public function getVerticalLeft()
104 return $this->_uniChar(0x2524);
108 * Defined by Zend\Text\Table\Decorator\DecoratorInterface
112 public function getHorizontalDown()
114 return $this->_uniChar(0x252C);
118 * Defined by Zend\Text\Table\Decorator\DecoratorInterface
122 public function getHorizontalUp()
124 return $this->_uniChar(0x2534);
128 * Convert am unicode character code to a character
131 * @return string|false
133 // @codingStandardsIgnoreStart
134 protected function _uniChar($code)
136 // @codingStandardsIgnoreEnd
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);