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