| Conditions | 3 |
| Paths | 3 |
| Total Lines | 13 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 56 | 2 | public function addAnnotation( DIProperty $property, SemanticData $semanticData ) { |
|
| 57 | |||
| 58 | 2 | if ( $this->appFactory->getOption( 'wgDisableCounters' ) ) { |
|
| 59 | 1 | return null; |
|
| 60 | } |
||
| 61 | |||
| 62 | 1 | $page = $this->appFactory->newWikiPage( $semanticData->getSubject()->getTitle() ); |
|
|
|
|||
| 63 | 1 | $count = $this->getPageViewCount( $page ); |
|
| 64 | |||
| 65 | 1 | if ( is_numeric( $count ) ) { |
|
| 66 | 1 | $semanticData->addPropertyObjectValue( $property, new DINumber( $count ) ); |
|
| 67 | 1 | } |
|
| 68 | 1 | } |
|
| 69 | |||
| 84 |
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: