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