Conditions | 3 |
Paths | 3 |
Total Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Tests | 4 |
CRAP Score | 3.3332 |
Changes | 0 |
1 | <?php |
||
70 | 1 | private function getPageViewCount( $page ) { |
|
71 | |||
72 | 1 | if ( class_exists( '\HitCounters\HitCounters' ) ) { |
|
73 | return \HitCounters\HitCounters::getCount( $page->getTitle() ); |
||
74 | } |
||
75 | |||
76 | 1 | if ( method_exists( $page, 'getCount' ) ) { |
|
77 | 1 | return $page->getCount(); |
|
78 | } |
||
79 | |||
80 | return null; |
||
81 | } |
||
82 | |||
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: