7 * This source file is subject to the new BSD license that is bundled
8 * with this package in the file LICENSE.txt.
9 * It is also available through the world-wide-web at this URL:
10 * http://framework.zend.com/license/new-bsd
11 * If you did not receive a copy of the license and are unable to
12 * obtain it through the world-wide-web, please send an email
13 * to license@zend.com so we can send you a copy immediately.
16 * @package Zend_Text_Table
17 * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
18 * @license http://framework.zend.com/license/new-bsd New BSD License
19 * @version $Id: Unicode.php 16209 2009-06-21 19:20:34Z thomas $
23 * @see Zend_Text_Table_Decorator_Interface
25 require_once 'Zend/Text/Table/Decorator/Interface.php';
28 * Unicode Decorator for Zend_Text_Table
31 * @package Zend_Text_Table
32 * @uses Zend_Text_Table_Decorator_Interface
33 * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
34 * @license http://framework.zend.com/license/new-bsd New BSD License
36 class Zend_Text_Table_Decorator_Unicode
implements Zend_Text_Table_Decorator_Interface
39 * Defined by Zend_Text_Table_Decorator_Interface
43 public function getTopLeft()
45 return $this->_uniChar(0x250C);
49 * Defined by Zend_Text_Table_Decorator_Interface
53 public function getTopRight()
55 return $this->_uniChar(0x2510);
59 * Defined by Zend_Text_Table_Decorator_Interface
63 public function getBottomLeft()
65 return $this->_uniChar(0x2514);
69 * Defined by Zend_Text_Table_Decorator_Interface
73 public function getBottomRight()
75 return $this->_uniChar(0x2518);
79 * Defined by Zend_Text_Table_Decorator_Interface
83 public function getVertical()
85 return $this->_uniChar(0x2502);
89 * Defined by Zend_Text_Table_Decorator_Interface
93 public function getHorizontal()
95 return $this->_uniChar(0x2500);
99 * Defined by Zend_Text_Table_Decorator_Interface
103 public function getCross()
105 return $this->_uniChar(0x253C);
109 * Defined by Zend_Text_Table_Decorator_Interface
113 public function getVerticalRight()
115 return $this->_uniChar(0x251C);
119 * Defined by Zend_Text_Table_Decorator_Interface
123 public function getVerticalLeft()
125 return $this->_uniChar(0x2524);
129 * Defined by Zend_Text_Table_Decorator_Interface
133 public function getHorizontalDown()
135 return $this->_uniChar(0x252C);
139 * Defined by Zend_Text_Table_Decorator_Interface
143 public function getHorizontalUp()
145 return $this->_uniChar(0x2534);
149 * Convert am unicode character code to a character
151 * @param integer $code
152 * @return string|false
154 protected function _uniChar($code)
158 } else if ($code <= 0x7FF) {
159 $char = chr(0xC0 |
$code >> 6)
160 . chr(0x80 |
$code & 0x3F);
161 } else if ($code <= 0xFFFF) {
162 $char = chr(0xE0 |
$code >> 12)
163 . chr(0x80 |
$code >> 6 & 0x3F)
164 . chr(0x80 |
$code & 0x3F);
165 } else if ($code <= 0x10FFFF) {
166 $char = chr(0xF0 |
$code >> 18)
167 . chr(0x80 |
$code >> 12 & 0x3F)
168 . chr(0x80 |
$code >> 6 & 0x3F)
169 . chr(0x80 |
$code & 0x3F);