| 1 | <?php namespace BuildR\Collection\Collection; |
||
| 19 | trait StrictlyTypedCollectionTrait { |
||
| 20 | |||
| 21 | /** |
||
| 22 | * @type NULL|callable |
||
| 23 | */ |
||
| 24 | protected $typeChecker; |
||
| 25 | |||
| 26 | /** |
||
| 27 | * @type NULL|string |
||
| 28 | */ |
||
| 29 | protected $typeCheckFailMessage; |
||
| 30 | |||
| 31 | /** |
||
| 32 | * {@inheritdoc} |
||
| 33 | */ |
||
| 34 | 5 | public function setStrictType(callable $typeCheck, $message = NULL) { |
|
| 38 | |||
| 39 | /** |
||
| 40 | * {@inheritdoc} |
||
| 41 | */ |
||
| 42 | 83 | public function isStrict() { |
|
| 45 | |||
| 46 | /** |
||
| 47 | * Executes the type check if the collection is strict. Always |
||
| 48 | * returns true, when the collection is not strictly typed |
||
| 49 | * |
||
| 50 | * @param mixed $value |
||
| 51 | * |
||
| 52 | * @return bool |
||
| 53 | * |
||
| 54 | * @throws \BuildR\Collection\Exception\CollectionException |
||
| 55 | */ |
||
| 56 | 82 | protected function doTypeCheck($value) { |
|
| 69 | |||
| 70 | } |
||
| 71 |