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