| Total Complexity | 10 |
| Total Lines | 53 |
| Duplicated Lines | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 7 | class Record |
||
| 8 | { |
||
| 9 | |||
| 10 | protected $reflector; |
||
| 11 | protected $collection; |
||
| 12 | protected $entity; |
||
| 13 | protected $values; |
||
| 14 | |||
| 15 | public function __construct(ObjectReflector $reflector, Collection $collection) |
||
| 16 | { |
||
| 17 | $this->reflector = $reflector; |
||
| 18 | $this->collection = $collection; |
||
| 19 | } |
||
| 20 | |||
| 21 | public function attach($entity, $values = []) |
||
| 22 | { |
||
| 23 | if (!$this->collection->support($entity)) { |
||
| 24 | throw new \InvalidArgumentException('Given entity is not supported by the collection'); |
||
| 25 | } |
||
| 26 | |||
| 27 | $this->entity = $entity; |
||
| 28 | $this->values = $values; |
||
| 29 | } |
||
| 30 | |||
| 31 | public function getEntity() |
||
| 32 | { |
||
| 33 | return $this->entity; |
||
| 34 | } |
||
| 35 | |||
| 36 | public function all() |
||
| 37 | { |
||
| 38 | return $this->values; |
||
| 39 | } |
||
| 40 | |||
| 41 | public function has($key) |
||
| 44 | } |
||
| 45 | |||
| 46 | public function get($key) |
||
| 50 | } |
||
| 51 | } |
||
| 52 | |||
| 53 | public function equals($key, $value) |
||
| 60 | } |
||
| 61 | } |
||
| 62 |