css-javascript-toolbox
/
framework
/
developer
/
interface
/
block
/
shortcode
/
parameters
/
base
/
abstract.php
abstract.php in CSS & JavaScript Toolbox 8.1, at framework/developer/interface/block/shortcode/parameters/base/abstract.php
| 1 | <?php |
| 2 | /** |
| 3 | * |
| 4 | */ |
| 5 | |
| 6 | /** |
| 7 | * |
| 8 | */ |
| 9 | abstract class CJT_Framework_Developer_Interface_Block_Shortcode_Parameters_Base_Abstract |
| 10 | implements CJT_Framework_Developer_Interface_Block_Parameters_Types_Interface_Type, |
| 11 | CJT_Framework_Developer_Interface_Block_Shortcode_Parameters_Interface_Type { |
| 12 | |
| 13 | /** |
| 14 | * put your comment there... |
| 15 | * |
| 16 | * @var mixed |
| 17 | */ |
| 18 | protected $typeObject; |
| 19 | |
| 20 | /** |
| 21 | * put your comment there... |
| 22 | * |
| 23 | * @param mixed $parameter |
| 24 | * @param mixed $factory |
| 25 | * @return CJT_Framework_Developer_Interface_Block_Shortcode_Parameters_Base_Abstract |
| 26 | */ |
| 27 | public function __construct($parameter, $factory) { |
| 28 | // Get base type factory. |
| 29 | $baseTypeFactory = $this->getBaseTypeFactory($parameter); |
| 30 | // Share the supplied factory! |
| 31 | $this->typeObject = $baseTypeFactory['factory']->create($baseTypeFactory['typeName'], $parameter, $factory); |
| 32 | } |
| 33 | |
| 34 | /** |
| 35 | * put your comment there... |
| 36 | * |
| 37 | * @param mixed $parameter |
| 38 | */ |
| 39 | public function getBaseTypeFactory($parameter) { |
| 40 | // Hold local instance! |
| 41 | static $baseTypeFactory; |
| 42 | if (!$baseTypeFactory) { |
| 43 | $baseTypeFactory = new CJT_Framework_Developer_Interface_Block_Parameters_Types_Base_Factory(); |
| 44 | } |
| 45 | // Base type name is mapped to this class name! |
| 46 | // boolean => boolean, texts => texts, etc.... |
| 47 | $className = get_class($this); |
| 48 | $name = substr($className, strrpos($className, '_') + 1); |
| 49 | // Type factory |
| 50 | return array( |
| 51 | 'factory' => $baseTypeFactory, |
| 52 | 'typeName' => $name, |
| 53 | ); |
| 54 | } |
| 55 | |
| 56 | /** |
| 57 | * put your comment there... |
| 58 | * |
| 59 | */ |
| 60 | public function getDefinition() { |
| 61 | return $this->getTypeObject()->getDefinition(); |
| 62 | } |
| 63 | |
| 64 | /** |
| 65 | * put your comment there... |
| 66 | * |
| 67 | */ |
| 68 | public function getFactory() { |
| 69 | return $this->getTypeObject()->getFactory(); |
| 70 | } |
| 71 | |
| 72 | /** |
| 73 | * put your comment there... |
| 74 | * |
| 75 | */ |
| 76 | public function getParent() { |
| 77 | return $this->getTypeObject()->getParent(); |
| 78 | } |
| 79 | |
| 80 | /** |
| 81 | * put your comment there... |
| 82 | * |
| 83 | */ |
| 84 | public function getTypeObject() { |
| 85 | return $this->typeObject; |
| 86 | } |
| 87 | |
| 88 | /** |
| 89 | * put your comment there... |
| 90 | * |
| 91 | */ |
| 92 | public function getValue($useRealNames = null) { |
| 93 | return $this->getTypeObject()->getValue($useRealNames); |
| 94 | } |
| 95 | |
| 96 | /** |
| 97 | * put your comment there... |
| 98 | * |
| 99 | * @param mixed $parent |
| 100 | */ |
| 101 | public function setParent($parent) { |
| 102 | return $this->getTypeObject()->setParent($parent); |
| 103 | } |
| 104 | /** |
| 105 | * put your comment there... |
| 106 | * |
| 107 | * @param mixed $value |
| 108 | */ |
| 109 | public function setValue($value) { |
| 110 | return $this->getTypeObject()->setValue($value); |
| 111 | } |
| 112 | |
| 113 | /** |
| 114 | * put your comment there... |
| 115 | * |
| 116 | */ |
| 117 | public function validate() { |
| 118 | return $this->getTypeObject()->validate(); |
| 119 | } |
| 120 | |
| 121 | } // End class. |
| 122 |