Conversation
| 'authorization' => get_class($api->getAuthorization()), | ||
| 'url' => $this->apiLink->link($api->getEndpoint()), | ||
| 'params' => $this->createParamsList($api->getHandler()), | ||
| 'params' => $this->createParamsList($this->apiDecider->getHandler($api)), |
There was a problem hiding this comment.
takto som to mal predtym? ten kod tu https://github.com/tomaj/nette-api/pull/149/changes je iny. Mame podla mna tie lazy handlery na eboxe a toto som tam nerobil urcite 🤔
There was a problem hiding this comment.
No to mi vyhadzuje pstan ze nemoze byt string v tych funkciach cize potrebujeme tam iba ApiHandler. A v API moze byt aj string ulozeny.
There was a problem hiding this comment.
a nemoze? nejde to tak? nie je to len zly typehint a phpstan je zmateny?
There was a problem hiding this comment.
predtym sa ale volalo
$versionApis = array_filter($this->apiDecider->getApis(), function (Api $api) use ($version) {
return $version === $api->getEndpoint()->getVersion();
});
a getApis() spravilo pre kazde Api to, ze zmenilo string na Handler
$handler = $this->getHandler($api);
Ano podla PHPStanu to nefungujuje lebo stale si mysli ze je tam string alebo Handler, to sedi. Ale runtime-ovo to podla mna funguje spravne. Ty si zduplikoval to volanie podla mna.
| $list = []; | ||
| foreach ($versionApis as $api) { | ||
| $handler = $api->getHandler(); | ||
| $handler = $this->apiDecider->getHandler($api); |
There was a problem hiding this comment.
toto sa uz urobilo v getApis, checkni ale podla mna to druhykrat netreba robit
| $this->sendCorsHeaders(); | ||
|
|
||
| $api = $this->getApi($request); | ||
| $handler = $api->getHandler(); |
There was a problem hiding this comment.
getApi uz vrati Api s tym ze handler nie je string ale Handler
| } | ||
|
|
||
| private function getHandler(Api $api): ApiHandlerInterface | ||
| public function getHandler(Api $api): ApiHandlerInterface |
There was a problem hiding this comment.
zbytocne aby to bola public metoda, lebo zvonku ju volat nepotrebujes. Vola ju getApi() aj getApis()


No description provided.