| 1 | <?php |
||
| 16 | abstract class Type |
||
| 17 | { |
||
| 18 | /** |
||
| 19 | * MetaItem model instance. |
||
| 20 | * |
||
| 21 | * @var \BoxedCode\Eloquent\Meta\Contracts\MetaItem |
||
| 22 | */ |
||
| 23 | protected $model; |
||
| 24 | |||
| 25 | /** |
||
| 26 | * Constructor. |
||
| 27 | * |
||
| 28 | * @param \BoxedCode\Eloquent\Meta\Contracts\MetaItem|null $model |
||
| 29 | */ |
||
| 30 | 57 | public function __construct(MetaItemContract $model = null) |
|
| 34 | |||
| 35 | /** |
||
| 36 | * Gets the model instance. |
||
| 37 | * |
||
| 38 | * @return \BoxedCode\Eloquent\Meta\Contracts\MetaItem|null |
||
| 39 | */ |
||
| 40 | 1 | public function getModel() |
|
| 44 | |||
| 45 | /** |
||
| 46 | * Parse & return the meta item value. |
||
| 47 | * |
||
| 48 | * @return mixed |
||
| 49 | */ |
||
| 50 | 19 | public function get() |
|
| 54 | |||
| 55 | /** |
||
| 56 | * Parse & set the meta item value. |
||
| 57 | * |
||
| 58 | * @param mixed $value |
||
| 59 | */ |
||
| 60 | 54 | public function set($value) |
|
| 64 | |||
| 65 | /** |
||
| 66 | * Assertain whether we can handle the |
||
| 67 | * type of variable passed. |
||
| 68 | * |
||
| 69 | * @param mixed $value |
||
| 70 | * @return bool |
||
| 71 | */ |
||
| 72 | abstract public function isType($value); |
||
| 73 | |||
| 74 | /** |
||
| 75 | * Get the types class name. |
||
| 76 | * |
||
| 77 | * @return string |
||
| 78 | */ |
||
| 79 | 54 | public function getClass() |
|
| 83 | |||
| 84 | /** |
||
| 85 | * Output value to string. |
||
| 86 | * |
||
| 87 | * @return string |
||
| 88 | */ |
||
| 89 | 1 | public function __toString() |
|
| 93 | } |
||
| 94 |