Merge branch 'master' of https://git.mcnd.ca/mcndave/notes
This commit is contained in:
commit
fcb332ae53
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
namespace Notes\Route\Attribute\Method;
|
namespace Notes\Route\Attribute\Method;
|
||||||
|
|
||||||
|
use Psr\Http\Message\ServerRequestInterface;
|
||||||
|
|
||||||
#[\Attribute(\Attribute::IS_REPEATABLE | \Attribute::TARGET_METHOD)]
|
#[\Attribute(\Attribute::IS_REPEATABLE | \Attribute::TARGET_METHOD)]
|
||||||
class Route implements \Notes\Attribute {
|
class Route implements \Notes\Attribute {
|
||||||
public function __construct(
|
public function __construct(
|
||||||
|
@ -12,6 +14,7 @@ class Route implements \Notes\Attribute {
|
||||||
public ? string $class = null,
|
public ? string $class = null,
|
||||||
public ? string $classMethod = null,
|
public ? string $classMethod = null,
|
||||||
public bool $currentRoute = false,
|
public bool $currentRoute = false,
|
||||||
|
public string $description = "",
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
public function getRoute() : string
|
public function getRoute() : string
|
||||||
|
@ -27,6 +30,18 @@ class Route implements \Notes\Attribute {
|
||||||
return strtolower($this->name) === strtolower($name);
|
return strtolower($this->name) === strtolower($name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function match(mixed $name) : bool
|
||||||
|
{
|
||||||
|
foreach((array) $name as $item) {
|
||||||
|
if ( fnmatch($item, $this->name) ) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public function isRoute(string $name) {
|
public function isRoute(string $name) {
|
||||||
return $this->name === $name;
|
return $this->name === $name;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue