32 lines
625 B
PHP
32 lines
625 B
PHP
<?php
|
|
// HttpRoute.php
|
|
// Created: 2024-03-28
|
|
// Updated: 2024-03-28
|
|
|
|
namespace Index\Http\Routing;
|
|
|
|
/**
|
|
* Provides an attribute for marking methods in a class as a route.
|
|
*/
|
|
class HttpRoute extends HandlerAttribute {
|
|
private string $method;
|
|
|
|
/**
|
|
* @param string $method
|
|
* @param string $path
|
|
*/
|
|
public function __construct(string $method, string $path) {
|
|
parent::__construct($path);
|
|
$this->method = $method;
|
|
}
|
|
|
|
/**
|
|
* Returns the target method name.
|
|
*
|
|
* @return string
|
|
*/
|
|
public function getMethod(): string {
|
|
return $this->method;
|
|
}
|
|
}
|