| 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) |
||
| 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() |
||
| 35 | |||
| 36 | public function all() |
||
| 40 | |||
| 41 | public function has($key) |
||
| 45 | |||
| 46 | public function get($key) |
||
| 52 | |||
| 53 | public function equals($key, $value) |
||
| 61 | } |
||
| 62 |
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.
To visualize
will produce issues in the first and second line, while this second example
will produce no issues.