composer package updates
[openemr.git] / vendor / zendframework / zend-text / src / Table / Decorator / Unicode.php
blob322bf4015b09c04bb630eb5b62efdb6b519f1959
1 <?php
2 /**
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
6 */
8 namespace Zend\Text\Table\Decorator;
10 use Zend\Text\Table\Decorator\DecoratorInterface as Decorator;
12 /**
13 * Unicode Decorator for Zend\Text\Table
15 class Unicode implements Decorator
17 /**
18 * Defined by Zend\Text\Table\Decorator\DecoratorInterface
20 * @return string
22 public function getTopLeft()
24 return $this->_uniChar(0x250C);
27 /**
28 * Defined by Zend\Text\Table\Decorator\DecoratorInterface
30 * @return string
32 public function getTopRight()
34 return $this->_uniChar(0x2510);
37 /**
38 * Defined by Zend\Text\Table\Decorator\DecoratorInterface
40 * @return string
42 public function getBottomLeft()
44 return $this->_uniChar(0x2514);
47 /**
48 * Defined by Zend\Text\Table\Decorator\DecoratorInterface
50 * @return string
52 public function getBottomRight()
54 return $this->_uniChar(0x2518);
57 /**
58 * Defined by Zend\Text\Table\Decorator\DecoratorInterface
60 * @return string
62 public function getVertical()
64 return $this->_uniChar(0x2502);
67 /**
68 * Defined by Zend\Text\Table\Decorator\DecoratorInterface
70 * @return string
72 public function getHorizontal()
74 return $this->_uniChar(0x2500);
77 /**
78 * Defined by Zend\Text\Table\Decorator\DecoratorInterface
80 * @return string
82 public function getCross()
84 return $this->_uniChar(0x253C);
87 /**
88 * Defined by Zend\Text\Table\Decorator\DecoratorInterface
90 * @return string
92 public function getVerticalRight()
94 return $this->_uniChar(0x251C);
97 /**
98 * Defined by Zend\Text\Table\Decorator\DecoratorInterface
100 * @return string
102 public function getVerticalLeft()
104 return $this->_uniChar(0x2524);
108 * Defined by Zend\Text\Table\Decorator\DecoratorInterface
110 * @return string
112 public function getHorizontalDown()
114 return $this->_uniChar(0x252C);
118 * Defined by Zend\Text\Table\Decorator\DecoratorInterface
120 * @return string
122 public function getHorizontalUp()
124 return $this->_uniChar(0x2534);
128 * Convert am unicode character code to a character
130 * @param int $code
131 * @return string|false
133 // @codingStandardsIgnoreStart
134 protected function _uniChar($code)
136 // @codingStandardsIgnoreEnd
137 if ($code <= 0x7F) {
138 $char = chr($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);
151 } else {
152 return false;
155 return $char;