-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactoring to minimal dependencies + add native support for baraja-c…
…ore/cas. (#46) * Native support for baraja-core/cas. * Simplify internal implementation, use native code. * Schema: Remove legacy experiment. * Response: Remove legacy getArray method. * Codestyle formatting. * Remove experimental firewall method. * Tracy is only possible dependecy.
- Loading branch information
1 parent
dc503e6
commit b94baa6
Showing
12 changed files
with
94 additions
and
322 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Baraja\StructuredApi\Bridge; | ||
|
||
|
||
use Nette\Application\LinkGenerator; | ||
|
||
final class LinkGeneratorBridge | ||
{ | ||
public function __construct( | ||
private ?LinkGenerator $linkGenerator = null, | ||
) { | ||
} | ||
|
||
|
||
/** | ||
* Generates URL to presenter. | ||
* | ||
* @param string $dest in format "[[[module:]presenter:]action] [#fragment]" | ||
* @param array<string, mixed> $params | ||
* @throws \InvalidArgumentException | ||
*/ | ||
public function link(string $dest, array $params = []): string | ||
{ | ||
if ($this->linkGenerator === null) { | ||
throw new \RuntimeException('Service LinkGenerator is not available. Did you install nette/application?'); | ||
} | ||
|
||
try { | ||
return $this->linkGenerator->link(ltrim($dest, ':'), $params); | ||
} catch (\Throwable $e) { | ||
throw new \InvalidArgumentException($e->getMessage(), $e->getCode()); | ||
} | ||
} | ||
} |
Oops, something went wrong.