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