| Conditions | 4 |
| Paths | 4 |
| Total Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 4 |
| Changes | 0 | ||
| 1 | <?php |
||
| 20 | 11 | public function hash($object) |
|
| 21 | { |
||
| 22 | 11 | if (is_object($object)) { |
|
| 23 | 1 | return spl_object_hash($object); |
|
| 24 | 10 | } elseif (is_string($object)) { |
|
| 25 | 9 | return md5($object); |
|
| 26 | 3 | } elseif (is_array($object)) { |
|
| 27 | 2 | return md5(serialize($object)); |
|
| 28 | } |
||
| 29 | |||
| 30 | 1 | throw new \InvalidArgumentException(sprintf('Object of type "%s" can not be hashed.', gettype($object))); |
|
| 31 | } |
||
| 32 | } |
||
| 33 |