| Total Complexity | 6 |
| Total Lines | 32 |
| Duplicated Lines | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 8 | class Bag |
||
| 9 | { |
||
| 10 | protected $reflector; |
||
| 11 | protected $collections = []; |
||
| 12 | |||
| 13 | public function __construct(ObjectReflector $reflector) |
||
| 14 | { |
||
| 15 | $this->reflector = $reflector; |
||
| 16 | } |
||
| 17 | |||
| 18 | public function clear() |
||
| 19 | { |
||
| 20 | $this->collections = []; |
||
| 21 | } |
||
| 22 | |||
| 23 | public function getCollection($entity) |
||
| 24 | { |
||
| 25 | foreach ($this->collections as $collection) { |
||
| 26 | if ($collection->support($entity)) { |
||
| 27 | return $collection; |
||
| 28 | } |
||
| 29 | } |
||
| 30 | |||
| 31 | $new = new Collection($this->reflector); |
||
| 32 | $new->support($entity); |
||
| 33 | |||
| 34 | return $this->collections[] = $new; |
||
| 35 | } |
||
| 36 | |||
| 37 | public function count() |
||
| 40 | } |
||
| 41 | } |
||
| 42 |