Conditions | 4 |
Paths | 4 |
Total Lines | 17 |
Lines | 0 |
Ratio | 0 % |
Tests | 13 |
CRAP Score | 4 |
Changes | 0 |
1 | <?php |
||
56 | 4 | public function addAnnotation( DIProperty $property, SemanticData $semanticData ) { |
|
57 | |||
58 | 4 | $page = $this->appFactory->newWikiPage( |
|
59 | 4 | $semanticData->getSubject()->getTitle() |
|
|
|||
60 | 4 | ); |
|
61 | |||
62 | 4 | $pageID = $page->getId(); |
|
63 | 4 | $dataItem = null; |
|
64 | |||
65 | 4 | if ( is_integer( $pageID ) && $pageID > 0 ) { |
|
66 | 1 | $dataItem = new DINumber( $pageID ); |
|
67 | 1 | } |
|
68 | |||
69 | 4 | if ( $dataItem instanceof DataItem ) { |
|
70 | 1 | $semanticData->addPropertyObjectValue( $property, $dataItem ); |
|
71 | 1 | } |
|
72 | 4 | } |
|
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: