1 | <?php |
||
12 | class ApiDecider |
||
13 | { |
||
14 | /** |
||
15 | * @var ApiHandlerInterface[] |
||
16 | */ |
||
17 | private $handlers = []; |
||
18 | |||
19 | /** |
||
20 | * @var bool |
||
21 | */ |
||
22 | private $globalPreflight = false; |
||
23 | |||
24 | /** |
||
25 | * Get api handler that match input method, version, package and apiAction. |
||
26 | * If decider cannot find handler for given handler, returns defaults. |
||
27 | * |
||
28 | 21 | * @param string $method |
|
29 | 2 | * @param integer $version |
|
30 | 21 | * @param string $package |
|
31 | 18 | * @param string $apiAction |
|
32 | 18 | * |
|
33 | 18 | * @return array |
|
34 | 18 | */ |
|
35 | 18 | public function getApiHandler($method, $version, $package, $apiAction = '') |
|
58 | 21 | ||
59 | 21 | public function enableGlobalPreflight() |
|
63 | |||
64 | /** |
||
65 | * Register new api handler |
||
66 | * |
||
67 | * @param EndpointInterface $endpointIdentifier |
||
68 | * @param ApiHandlerInterface $handler |
||
69 | 9 | * @param ApiAuthorizationInterface $apiAuthorization |
|
70 | * |
||
71 | 9 | * @return $this |
|
72 | */ |
||
73 | public function addApiHandler(EndpointInterface $endpointIdentifier, ApiHandlerInterface $handler, ApiAuthorizationInterface $apiAuthorization) |
||
82 | |||
83 | /** |
||
84 | * Get all registered handlers |
||
85 | * |
||
86 | * @return Handlers\ApiHandlerInterface[] |
||
87 | */ |
||
88 | public function getHandlers() |
||
92 | } |
||
93 |
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.
In this case you can add the
@ignore
PhpDoc annotation to the duplicate definition and it will be ignored.