These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace SMW; |
||
4 | |||
5 | use SMw\MediaWiki\RedirectTargetFinder; |
||
6 | use SMW\PropertyAnnotators\CategoryPropertyAnnotator; |
||
7 | use SMW\PropertyAnnotators\DisplayTitlePropertyAnnotator; |
||
8 | use SMW\PropertyAnnotators\MandatoryTypePropertyAnnotator; |
||
9 | use SMW\PropertyAnnotators\NullPropertyAnnotator; |
||
10 | use SMW\PropertyAnnotators\PredefinedPropertyAnnotator; |
||
11 | use SMW\PropertyAnnotators\RedirectPropertyAnnotator; |
||
12 | use SMW\PropertyAnnotators\SortKeyPropertyAnnotator; |
||
13 | use SMW\PropertyAnnotators\EditProtectedPropertyAnnotator; |
||
14 | use SMW\Store; |
||
15 | use Title; |
||
16 | |||
17 | /** |
||
18 | * @license GNU GPL v2+ |
||
19 | * @since 2.0 |
||
20 | * |
||
21 | * @author mwjames |
||
22 | */ |
||
23 | class PropertyAnnotatorFactory { |
||
24 | |||
25 | /** |
||
26 | * @since 2.0 |
||
27 | * |
||
28 | * @param SemanticData $semanticData |
||
29 | * |
||
30 | 220 | * @return NullPropertyAnnotator |
|
31 | 220 | */ |
|
32 | public function newNullPropertyAnnotator( SemanticData $semanticData ) { |
||
33 | return new NullPropertyAnnotator( $semanticData ); |
||
34 | } |
||
35 | |||
36 | /** |
||
37 | * @since 2.0 |
||
38 | * |
||
39 | * @param SemanticData $semanticData |
||
40 | * @param RedirectTargetFinder $redirectTargetFinder |
||
41 | * |
||
42 | 219 | * @return RedirectPropertyAnnotator |
|
43 | 219 | */ |
|
44 | public function newRedirectPropertyAnnotator( PropertyAnnotator $propertyAnnotator, RedirectTargetFinder $redirectTargetFinder ) { |
||
45 | return new RedirectPropertyAnnotator( |
||
46 | $propertyAnnotator, |
||
47 | $redirectTargetFinder |
||
48 | ); |
||
49 | } |
||
50 | |||
51 | /** |
||
52 | * @since 2.0 |
||
53 | * |
||
54 | * @param SemanticData $semanticData |
||
55 | * @param PageInfo $pageInfo |
||
56 | * |
||
57 | 218 | * @return PredefinedPropertyAnnotator |
|
58 | */ |
||
59 | 218 | public function newPredefinedPropertyAnnotator( PropertyAnnotator $propertyAnnotator, PageInfo $pageInfo ) { |
|
60 | |||
61 | $predefinedPropertyAnnotator = new PredefinedPropertyAnnotator( |
||
62 | $propertyAnnotator, |
||
63 | $pageInfo |
||
64 | 218 | ); |
|
65 | 218 | ||
66 | $predefinedPropertyAnnotator->setPredefinedPropertyList( |
||
67 | ApplicationFactory::getInstance()->getSettings()->get( 'smwgPageSpecialProperties' ) |
||
68 | 218 | ); |
|
69 | |||
70 | return $predefinedPropertyAnnotator; |
||
71 | } |
||
72 | |||
73 | /** |
||
74 | * @since 2.5 |
||
75 | * |
||
76 | * @param SemanticData $semanticData |
||
0 ignored issues
–
show
|
|||
77 | * @param Title $title |
||
78 | * |
||
79 | 212 | * @return EditProtectedPropertyAnnotator |
|
80 | 212 | */ |
|
81 | public function newEditProtectedPropertyAnnotator( PropertyAnnotator $propertyAnnotator, Title $title ) { |
||
82 | |||
83 | $editProtectedPropertyAnnotator = new EditProtectedPropertyAnnotator( |
||
84 | $propertyAnnotator, |
||
85 | $title |
||
86 | ); |
||
87 | |||
88 | $editProtectedPropertyAnnotator->setEditProtectionRight( |
||
89 | ApplicationFactory::getInstance()->getSettings()->get( 'smwgEditProtectionRight' ) |
||
90 | ); |
||
91 | |||
92 | return $editProtectedPropertyAnnotator; |
||
93 | } |
||
94 | |||
95 | 211 | /** |
|
96 | * @since 2.0 |
||
97 | 211 | * |
|
98 | * @param SemanticData $semanticData |
||
99 | * @param string $sortkey |
||
100 | * |
||
101 | * @return SortKeyPropertyAnnotator |
||
102 | */ |
||
103 | 211 | public function newSortKeyPropertyAnnotator( PropertyAnnotator $propertyAnnotator, $sortkey ) { |
|
104 | 211 | return new SortKeyPropertyAnnotator( |
|
105 | $propertyAnnotator, |
||
106 | $sortkey |
||
107 | 211 | ); |
|
108 | } |
||
109 | |||
110 | /** |
||
111 | * @since 2.4 |
||
112 | * |
||
113 | * @param SemanticData $semanticData |
||
114 | * @param string|false $displayTitle |
||
115 | * @param string $defaultSort |
||
116 | * |
||
117 | * @return DisplayTitlePropertyAnnotator |
||
118 | 212 | */ |
|
119 | public function newDisplayTitlePropertyAnnotator( PropertyAnnotator $propertyAnnotator, $displayTitle, $defaultSort ) { |
||
120 | 212 | ||
121 | $displayTitlePropertyAnnotator = new DisplayTitlePropertyAnnotator( |
||
122 | $propertyAnnotator, |
||
123 | $displayTitle, |
||
124 | $defaultSort |
||
125 | 212 | ); |
|
126 | 212 | ||
127 | $displayTitlePropertyAnnotator->canCreateAnnotation( |
||
128 | ( ApplicationFactory::getInstance()->getSettings()->get( 'smwgDVFeatures' ) & SMW_DV_WPV_DTITLE ) != 0 |
||
129 | 212 | ); |
|
130 | 212 | ||
131 | return $displayTitlePropertyAnnotator; |
||
132 | } |
||
133 | 212 | ||
134 | 212 | /** |
|
135 | * @since 2.0 |
||
136 | * |
||
137 | 212 | * @param SemanticData $semanticData |
|
0 ignored issues
–
show
There is no parameter named
$semanticData . Was it maybe removed?
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function. Consider the following example. The parameter /**
* @param array $germany
* @param array $island
* @param array $italy
*/
function finale($germany, $island) {
return "2:1";
}
The most likely cause is that the parameter was removed, but the annotation was not.
Loading history...
|
|||
138 | * @param array $categories |
||
139 | * |
||
140 | * @return CategoryPropertyAnnotator |
||
141 | */ |
||
142 | public function newCategoryPropertyAnnotator( PropertyAnnotator $propertyAnnotator, array $categories ) { |
||
143 | |||
144 | $categoryPropertyAnnotator = new CategoryPropertyAnnotator( |
||
145 | $propertyAnnotator, |
||
146 | $categories |
||
147 | 212 | ); |
|
148 | 212 | ||
149 | $categoryPropertyAnnotator->setShowHiddenCategoriesState( |
||
150 | ApplicationFactory::getInstance()->getSettings()->get( 'smwgShowHiddenCategories' ) |
||
151 | ); |
||
152 | |||
153 | $categoryPropertyAnnotator->setCategoryInstanceUsageState( |
||
154 | ApplicationFactory::getInstance()->getSettings()->get( 'smwgCategoriesAsInstances' ) |
||
155 | ); |
||
156 | |||
157 | $categoryPropertyAnnotator->setCategoryHierarchyUsageState( |
||
158 | ApplicationFactory::getInstance()->getSettings()->get( 'smwgUseCategoryHierarchy' ) |
||
159 | ); |
||
160 | |||
161 | return $categoryPropertyAnnotator; |
||
162 | } |
||
163 | |||
164 | /** |
||
165 | * @since 2.2 |
||
166 | * |
||
167 | * @param SemanticData $semanticData |
||
168 | * |
||
169 | * @return MandatoryTypePropertyAnnotator |
||
170 | */ |
||
171 | public function newMandatoryTypePropertyAnnotator( PropertyAnnotator $propertyAnnotator ) { |
||
172 | return new MandatoryTypePropertyAnnotator( |
||
173 | $propertyAnnotator |
||
174 | ); |
||
175 | } |
||
176 | |||
177 | } |
||
178 |
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italy
is not defined by the methodfinale(...)
.The most likely cause is that the parameter was removed, but the annotation was not.