Skip to content

Conversation

@Martin-Beranek
Copy link
Contributor

No description provided.

'authorization' => get_class($api->getAuthorization()),
'url' => $this->apiLink->link($api->getEndpoint()),
'params' => $this->createParamsList($api->getHandler()),
'params' => $this->createParamsList($this->apiDecider->getHandler($api)),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a nemoze? nejde to tak? nie je to len zly typehint a phpstan je zmateny?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image Nemyslim lebo napriklad tu je potrebne $handler->params() cize na stringu to muselo padnut.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To iste aj na open api a ApiPresenter
image

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@Martin-Beranek Martin-Beranek requested a review from lulco January 28, 2026 09:21
$list = [];
foreach ($versionApis as $api) {
$handler = $api->getHandler();
$handler = $this->apiDecider->getHandler($api);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

toto sa uz urobilo v getApis, checkni ale podla mna to druhykrat netreba robit

$this->sendCorsHeaders();

$api = $this->getApi($request);
$handler = $api->getHandler();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

zbytocne aby to bola public metoda, lebo zvonku ju volat nepotrebujes. Vola ju getApi() aj getApis()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants