- Added Kash interfaces
This commit is contained in:
1 parent
aba9a65a3c
commit
5bebe231c7
12 files changed
+77
-34
No files matched your search
+18
-5
@@ -18,6 +18,7 @@ use Psr\Http\Message\ResponseInterface;
|
||||
use TheBugs\Email\MailerInterface;
|
||||
|
||||
use Notes\Cronard\Annotation\Method\Cronard,
|
||||
Notes\Breadcrumb\Annotation\Method\Breadcrumb,
|
||||
Notes\Route\Annotation\Object\Route as RouteParam,
|
||||
Notes\Route\Annotation\Method\Route,
|
||||
Notes\Security\Annotation\Security,
|
||||
@@ -26,11 +27,11 @@ use Notes\Cronard\Annotation\Method\Cronard,
|
||||
|
||||
use function file_get_contents;
|
||||
|
||||
/**
|
||||
* @Security("locked" => true)
|
||||
* @RouteParam("methods" => [ "GET", "POST", "DELETE" ])
|
||||
*/
|
||||
#[\Notes\Security\Attribute\Security(locked: true)]
|
||||
#[\Notes\Route\Attribute\Object\Route(method: [ "GET", "POST", "DELETE" ])]
|
||||
trait ControllerTrait {
|
||||
public ? \Notes\Breadcrumb\Breadcrumb $breadcrumb;
|
||||
|
||||
public ? Session $session;
|
||||
|
||||
public ? Picea\Picea $picea;
|
||||
@@ -149,7 +150,8 @@ trait ControllerTrait {
|
||||
return $this->picea->compiler->getExtensionFromToken('route')->buildRouteUrl($name, $parameters);
|
||||
}
|
||||
|
||||
public function json($data, int $flags = 0) {
|
||||
public function json($data, int $flags = 0) : string
|
||||
{
|
||||
return htmlentities(json_encode($data, $flags), ENT_QUOTES, 'UTF-8');
|
||||
}
|
||||
|
||||
@@ -164,4 +166,15 @@ trait ControllerTrait {
|
||||
{
|
||||
return $name ? $this->contextList[$name] : array_values($this->contextList)[0] ?? null;
|
||||
}
|
||||
|
||||
public function isRoute(mixed $name, ServerRequestInterface $request) : bool
|
||||
{
|
||||
foreach((array) $name as $item) {
|
||||
if ( fnmatch($item, $request->getAttribute('lean.route')->name) ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user