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