1 | <?php |
||
18 | class Geolocate |
||
19 | { |
||
20 | const KEY = 'GEOLOCATE'; |
||
21 | |||
22 | /** |
||
23 | * @var Geocoder |
||
24 | */ |
||
25 | private $geocoder; |
||
26 | |||
27 | /** |
||
28 | * @var bool |
||
29 | */ |
||
30 | private $saveInSession = false; |
||
31 | |||
32 | /** |
||
33 | * Returns the client location. |
||
34 | * |
||
35 | * @param ServerRequestInterface $request |
||
36 | * |
||
37 | * @return AddressCollection|null |
||
38 | */ |
||
39 | public static function getLocation(ServerRequestInterface $request) |
||
43 | |||
44 | /** |
||
45 | * Constructor. Set the geocoder instance. |
||
46 | * |
||
47 | * @param null|Geocoder $geocoder |
||
48 | */ |
||
49 | public function __construct(Geocoder $geocoder = null) |
||
58 | |||
59 | /** |
||
60 | * Wheter or not save the geolocation in a session variable |
||
61 | * |
||
62 | * @param bool $save |
||
63 | * |
||
64 | * @return self |
||
65 | */ |
||
66 | public function saveInSession($save = true) |
||
72 | |||
73 | /** |
||
74 | * Execute the middleware. |
||
75 | * |
||
76 | * @param ServerRequestInterface $request |
||
77 | * @param ResponseInterface $response |
||
78 | * @param callable $next |
||
79 | * |
||
80 | * @return ResponseInterface |
||
81 | */ |
||
82 | public function __invoke(ServerRequestInterface $request, ResponseInterface $response, callable $next) |
||
108 | |||
109 | /** |
||
110 | * Returns the geolocation from the session storage |
||
111 | * |
||
112 | * @param ResponseInterface $response |
||
|
|||
113 | * @param string $ip |
||
114 | * |
||
115 | * @return AddressCollection|null |
||
116 | */ |
||
117 | static private function fromSession(ServerRequestInterface $request, $ip) |
||
126 | |||
127 | /** |
||
128 | * Saves the geolocation in the session storage |
||
129 | * |
||
130 | * @param ResponseInterface $response |
||
131 | * @param string $ip |
||
132 | * @param AddressCollection $address |
||
133 | */ |
||
134 | static private function toSession(ServerRequestInterface $request, $ip, AddressCollection $address) |
||
141 | } |
||
142 |
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.