| 1 | <?php |
||
| 14 | class AttributeFactory |
||
| 15 | { |
||
| 16 | /** |
||
| 17 | * @param $attribute |
||
| 18 | * @param $value |
||
| 19 | * |
||
| 20 | * @return mixed |
||
| 21 | */ |
||
| 22 | 9 | public static function create($attribute, $value) |
|
| 23 | { |
||
| 24 | 9 | $attributesType = self::getAllAttributeType(); |
|
| 25 | 9 | foreach ($attributesType as $attributeType) { |
|
| 26 | 9 | if ($attributeType->isMember($attribute)) { |
|
| 27 | 9 | return $attributeType->create($value); |
|
| 28 | } |
||
| 29 | 8 | } |
|
| 30 | |||
| 31 | return $value; |
||
| 32 | } |
||
| 33 | |||
| 34 | /** |
||
| 35 | * @return AbstractAttributeChecker[] |
||
| 36 | */ |
||
| 37 | 9 | private static function getAllAttributeType() |
|
| 49 | } |
||
| 50 |