1 | <?php |
||
10 | class ApiDecider |
||
11 | { |
||
12 | /** @var ApiHandlerInterface[] */ |
||
13 | private $handlers = []; |
||
14 | |||
15 | /** @var string */ |
||
16 | private $title; |
||
17 | |||
18 | /** @var string */ |
||
19 | private $description; |
||
20 | |||
21 | /** |
||
22 | * Get api handler that match input method, version, package and apiAction. |
||
23 | * If decider cannot find handler for given handler, returns defaults. |
||
24 | * |
||
25 | * @param string $method |
||
26 | * @param integer $version |
||
27 | * @param string $package |
||
28 | * @param string $apiAction |
||
29 | * |
||
30 | * @return array |
||
31 | */ |
||
32 | 21 | public function getApiHandler($method, $version, $package, $apiAction = '') |
|
48 | |||
49 | /** |
||
50 | * Register new api handler |
||
51 | * |
||
52 | * @param EndpointInterface $endpointIdentifier |
||
53 | * @param ApiHandlerInterface $handler |
||
54 | * @param ApiAuthorizationInterface $apiAuthorization |
||
55 | * |
||
56 | * @return $this |
||
57 | */ |
||
58 | 21 | public function addApiHandler(EndpointInterface $endpointIdentifier, ApiHandlerInterface $handler, ApiAuthorizationInterface $apiAuthorization) |
|
67 | |||
68 | /** |
||
69 | * Get all registered handlers |
||
70 | * |
||
71 | * @return ApiHandlerInterface[] |
||
72 | */ |
||
73 | 9 | public function getHandlers() |
|
77 | |||
78 | /** |
||
79 | * @param string $title |
||
80 | * @return ApiDecider |
||
81 | */ |
||
82 | public function setTitle($title) |
||
87 | |||
88 | /** |
||
89 | * @return string |
||
90 | */ |
||
91 | public function getTitle() |
||
95 | |||
96 | /** |
||
97 | * @param string $description |
||
98 | * @return ApiDecider |
||
99 | */ |
||
100 | public function setDescription($description) |
||
105 | |||
106 | /** |
||
107 | * @return string |
||
108 | */ |
||
109 | public function getDescription() |
||
113 | } |
||
114 |
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.