Conditions | 3 |
Paths | 3 |
Total Lines | 23 |
Lines | 0 |
Ratio | 0 % |
Tests | 17 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
57 | 1 | public function addAnnotation( DIProperty $property, SemanticData $semanticData ) { |
|
58 | |||
59 | 1 | $title = $semanticData->getSubject()->getTitle(); |
|
60 | 1 | $page = $this->appFactory->newWikiPage( $title ); |
|
|
|||
61 | |||
62 | 1 | $user = $this->appFactory->newUserFromID( $page->getUser() ); |
|
63 | 1 | $authors = $page->getContributors(); |
|
64 | |||
65 | 1 | $dataItem = null; |
|
66 | |||
67 | 1 | while ( $user ) { |
|
68 | //no anonymous users (hidden users are not returned) |
||
69 | 1 | if ( $this->isNotAnonymous( $user ) ) { |
|
70 | 1 | $semanticData->addPropertyObjectValue( |
|
71 | 1 | $property, |
|
72 | 1 | DIWikiPage::newFromTitle( $user->getUserPage() ) |
|
73 | 1 | ); |
|
74 | 1 | } |
|
75 | |||
76 | 1 | $user = $authors->current(); |
|
77 | 1 | $authors->next(); |
|
78 | 1 | } |
|
79 | 1 | } |
|
80 | |||
86 |
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: