PEAR2_Console_Color-0.1.0 › PEAR2_Console_Color-0.1.0/php/PEAR2/Console/Color/Mapper.php
- PEAR2_Console_Color-0.1.0/
- php/
- PEAR2/
- php/
- package.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
/**
* Mapper class for PEAR2_Console_Color
* the Abstract class used to construct mappers to colors
*
* @category Console
* @package PEAR2_Console_Color
* @author Ivo Nascimento <ivo@o8o.com.br>
* @copyright 2011 Ivo Nascimento
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License
* @link http://svn.php.net/repository/pear2/PEAR2_Console_Color
*/
namespace PEAR2\Console\Color;
/**
*
* A mapper to use into concrete mappers
* @author Ivo Nascimento <ivo@o8o.com.br>
* @copyright 2011 Ivo Nascimento
* @abstract
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License
*
*/
abstract class Mapper
{
/**
*
* this function look into mapper class to search for values
* @param string $name the value user insert in text
* @access public
* @return string
*/
public static function get( $name )
{
$name = str_replace('%', 'percent', $name);
$rColorMapper = New \ReflectionClass( get_called_class() );
if( ($item=$rColorMapper->getConstant($name) )!==false )
return $item;
else if( ($item=$rColorMapper->getProperty($name) )!==false )
return $item->getValue( get_called_class() );
else
return false;
}
}
EOF
