*prechod na novsiu verziu ZF
[sport-group.git] / library / Zend / Text / Table / Decorator / Unicode.php
blob123493706923484c7f422799a23088db0940331c
1 <?php
2 /**
3 * Zend Framework
5 * LICENSE
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.
15 * @category Zend
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 $
22 /**
23 * @see Zend_Text_Table_Decorator_Interface
25 require_once 'Zend/Text/Table/Decorator/Interface.php';
27 /**
28 * Unicode Decorator for Zend_Text_Table
30 * @category Zend
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
38 /**
39 * Defined by Zend_Text_Table_Decorator_Interface
41 * @return string
43 public function getTopLeft()
45 return $this->_uniChar(0x250C);
48 /**
49 * Defined by Zend_Text_Table_Decorator_Interface
51 * @return string
53 public function getTopRight()
55 return $this->_uniChar(0x2510);
58 /**
59 * Defined by Zend_Text_Table_Decorator_Interface
61 * @return string
63 public function getBottomLeft()
65 return $this->_uniChar(0x2514);
68 /**
69 * Defined by Zend_Text_Table_Decorator_Interface
71 * @return string
73 public function getBottomRight()
75 return $this->_uniChar(0x2518);
78 /**
79 * Defined by Zend_Text_Table_Decorator_Interface
81 * @return string
83 public function getVertical()
85 return $this->_uniChar(0x2502);
88 /**
89 * Defined by Zend_Text_Table_Decorator_Interface
91 * @return string
93 public function getHorizontal()
95 return $this->_uniChar(0x2500);
98 /**
99 * Defined by Zend_Text_Table_Decorator_Interface
101 * @return string
103 public function getCross()
105 return $this->_uniChar(0x253C);
109 * Defined by Zend_Text_Table_Decorator_Interface
111 * @return string
113 public function getVerticalRight()
115 return $this->_uniChar(0x251C);
119 * Defined by Zend_Text_Table_Decorator_Interface
121 * @return string
123 public function getVerticalLeft()
125 return $this->_uniChar(0x2524);
129 * Defined by Zend_Text_Table_Decorator_Interface
131 * @return string
133 public function getHorizontalDown()
135 return $this->_uniChar(0x252C);
139 * Defined by Zend_Text_Table_Decorator_Interface
141 * @return string
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)
156 if ($code <= 0x7F) {
157 $char = chr($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);
170 } else {
171 return false;
174 return $char;