Conditions | 3 |
Paths | 4 |
Total Lines | 14 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 11 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
51 | 1 | public function addAnnotation( DIProperty $property, SemanticData $semanticData ) { |
|
52 | |||
53 | 1 | $page = $this->appFactory->newWikiPage( $semanticData->getSubject()->getTitle() ); |
|
|
|||
54 | 1 | $creator = $page->getCreator(); |
|
55 | 1 | $dataItem = null; |
|
56 | |||
57 | 1 | if ( $creator ) { |
|
58 | 1 | $dataItem = DIWikiPage::newFromTitle( $creator->getUserPage() ); |
|
59 | 1 | } |
|
60 | |||
61 | 1 | if ( $dataItem instanceof DataItem ) { |
|
62 | 1 | $semanticData->addPropertyObjectValue( $property, $dataItem ); |
|
63 | 1 | } |
|
64 | 1 | } |
|
65 | |||
67 |
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: