Conditions | 4 |
Paths | 3 |
Total Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 4 |
Changes | 0 |
1 | <?php |
||
21 | 3 | public function findForItem( Item $item ): array { |
|
22 | 3 | $references = []; |
|
23 | |||
24 | 3 | foreach ( $item->getStatements()->toArray() as $statement ) { |
|
25 | 2 | $references[] = $statement->getPropertyId(); |
|
26 | |||
27 | 2 | $mainSnak = $statement->getMainSnak(); |
|
28 | |||
29 | 2 | if ( $mainSnak instanceof PropertyValueSnak && $mainSnak->getDataValue() instanceof EntityIdValue ) { |
|
30 | 2 | $references[] = $mainSnak->getDataValue()->getEntityId(); |
|
31 | } |
||
32 | } |
||
33 | |||
34 | 3 | return array_unique( $references ); |
|
35 | } |
||
36 | |||
37 | } |