Conditions | 4 |
Paths | 4 |
Total Lines | 17 |
Lines | 0 |
Ratio | 0 % |
Tests | 13 |
CRAP Score | 4 |
Changes | 0 |
1 | <?php |
||
56 | 2 | public function addAnnotation( DIProperty $property, SemanticData $semanticData ) { |
|
57 | |||
58 | 2 | $page = $this->appFactory->newWikiPage( |
|
59 | 2 | $semanticData->getSubject()->getTitle() |
|
|
|||
60 | 2 | ); |
|
61 | |||
62 | 2 | $revID = $page->getLatest(); |
|
63 | 2 | $dataItem = null; |
|
64 | |||
65 | 2 | if ( is_integer( $revID ) && $revID > 0 ) { |
|
66 | 1 | $dataItem = new DINumber( $revID ); |
|
67 | 1 | } |
|
68 | |||
69 | 2 | if ( $dataItem instanceof DataItem ) { |
|
70 | 1 | $semanticData->addPropertyObjectValue( $property, $dataItem ); |
|
71 | 1 | } |
|
72 | 2 | } |
|
73 | |||
75 |
Unless you are absolutely sure that the expression can never be null because of other conditions, we strongly recommend to add an additional type check to your code: