Conditions | 4 |
Paths | 4 |
Total Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Tests | 6 |
CRAP Score | 4.25 |
Changes | 0 |
1 | <?php |
||
54 | 3 | public function getHash() { |
|
55 | 3 | $data = $this->getData(); |
|
56 | 1 | if ( is_object( $data ) ) { |
|
57 | if ( method_exists( $data, 'getHash' ) ) { |
||
58 | return $data->getHash(); |
||
59 | 1 | } else { |
|
60 | return sha1( serialize( $data ) ); |
||
61 | } |
||
62 | 2 | } |
|
63 | 2 | if ( is_string( $data ) ) { |
|
64 | return sha1( $data ); |
||
65 | } |
||
66 | throw new LogicException( "Cant get hash for data of type: " . gettype( $data ) ); |
||
67 | } |
||
68 | |||
86 |