1 | <?php |
||||
2 | |||||
3 | namespace SMW\ApprovedRevs; |
||||
4 | |||||
5 | use Psr\Log\LoggerAwareTrait; |
||||
6 | use SMW\DIProperty; |
||||
7 | use SMW\SemanticData; |
||||
8 | use SMW\ApprovedRevs\PropertyAnnotators\ApprovedStatusPropertyAnnotator; |
||||
9 | use SMW\ApprovedRevs\PropertyAnnotators\ApprovedByPropertyAnnotator; |
||||
10 | use SMW\ApprovedRevs\PropertyAnnotators\ApprovedDatePropertyAnnotator; |
||||
11 | use SMW\ApprovedRevs\PropertyAnnotators\ApprovedRevPropertyAnnotator; |
||||
12 | |||||
13 | /** |
||||
14 | * @private |
||||
15 | * |
||||
16 | * @license GNU GPL v2+ |
||||
17 | * @since 1.0 |
||||
18 | * |
||||
19 | * @author mwjames |
||||
20 | */ |
||||
21 | class PropertyAnnotator { |
||||
22 | |||||
23 | use LoggerAwareTrait; |
||||
24 | |||||
25 | /** |
||||
26 | * @var ServicesFactory |
||||
27 | */ |
||||
28 | private $servicesFactory; |
||||
29 | |||||
30 | /** |
||||
31 | * @var PropertyAnnotator[] |
||||
32 | */ |
||||
33 | private $propertyAnnotators = []; |
||||
34 | |||||
35 | /** |
||||
36 | * @since 1.0 |
||||
37 | * |
||||
38 | * @param ServicesFactory $servicesFactory |
||||
39 | */ |
||||
40 | 3 | public function __construct( ServicesFactory $servicesFactory ) { |
|||
41 | 3 | $this->servicesFactory = $servicesFactory; |
|||
42 | 3 | } |
|||
43 | |||||
44 | /** |
||||
45 | * @since 1.0 |
||||
46 | * |
||||
47 | * @param SemanticData $semanticData |
||||
48 | */ |
||||
49 | 2 | public function addAnnotation( SemanticData $semanticData ) { |
|||
50 | |||||
51 | 2 | $time = microtime( true ); |
|||
52 | |||||
53 | 2 | if ( !$this->canAnnotate( $semanticData->getSubject() ) ) { |
|||
54 | 1 | return; |
|||
55 | } |
||||
56 | |||||
57 | 1 | if ( $this->propertyAnnotators === [] ) { |
|||
58 | 1 | $this->initPropertyAnnotators(); |
|||
59 | } |
||||
60 | |||||
61 | 1 | foreach ( $this->propertyAnnotators as $propertyAnnotator ) { |
|||
62 | 1 | $propertyAnnotator->addAnnotation( $semanticData ); |
|||
63 | } |
||||
64 | |||||
65 | 1 | $this->logger->info( |
|||
0 ignored issues
–
show
|
|||||
66 | 1 | [ 'SemanticApprovedRevs', 'procTime:{procTime}' ], |
|||
0 ignored issues
–
show
array('SemanticApprovedR... 'procTime:{procTime}') of type array<integer,string> is incompatible with the type string expected by parameter $message of Psr\Log\LoggerInterface::info() .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
67 | 1 | [ 'procTime' => round( ( microtime( true ) - $time ), 5 ) ] |
|||
68 | ); |
||||
69 | 1 | } |
|||
70 | |||||
71 | 2 | private function canAnnotate( $subject ) { |
|||
72 | |||||
73 | 2 | if ( $subject === null || $subject->getTitle() === null || $subject->getTitle()->isSpecialPage() ) { |
|||
74 | 1 | return false; |
|||
75 | } |
||||
76 | |||||
77 | 1 | return true; |
|||
78 | } |
||||
79 | |||||
80 | 1 | private function initPropertyAnnotators() { |
|||
81 | 1 | $this->propertyAnnotators[] = $this->servicesFactory->newApprovedByPropertyAnnotator(); |
|||
82 | 1 | $this->propertyAnnotators[] = $this->servicesFactory->newApprovedStatusPropertyAnnotator(); |
|||
83 | 1 | $this->propertyAnnotators[] = $this->servicesFactory->newApprovedDatePropertyAnnotator(); |
|||
84 | 1 | $this->propertyAnnotators[] = $this->servicesFactory->newApprovedRevPropertyAnnotator(); |
|||
85 | 1 | } |
|||
86 | |||||
87 | } |
||||
88 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.