|
@@ 1506-1526 (lines=21) @@
|
| 1503 |
|
* |
| 1504 |
|
* @since 2.0 |
| 1505 |
|
*/ |
| 1506 |
|
public function doOPTIONS($request) |
| 1507 |
|
{ |
| 1508 |
|
$HTTPMethods = array('HEAD', 'GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'OPTIONS'); |
| 1509 |
|
$supported = array(); |
| 1510 |
|
|
| 1511 |
|
foreach ($HTTPMethods as $HTTPMethod) { |
| 1512 |
|
$reflector = new \ReflectionMethod($this, 'do'.$HTTPMethod); |
| 1513 |
|
$isOverridden = ($reflector->getDeclaringClass()->getName() === get_class($this)); |
| 1514 |
|
|
| 1515 |
|
if ($isOverridden) { |
| 1516 |
|
$supported[] = $HTTPMethod; |
| 1517 |
|
} |
| 1518 |
|
} |
| 1519 |
|
|
| 1520 |
|
$supported = implode(',', $supported); |
| 1521 |
|
|
| 1522 |
|
$response = new Response(200); |
| 1523 |
|
$response->setHeader('Allow', $supported); |
| 1524 |
|
|
| 1525 |
|
return $response; |
| 1526 |
|
} |
| 1527 |
|
|
| 1528 |
|
/** |
| 1529 |
|
* {@inheritdoc} |
|
@@ 1533-1553 (lines=21) @@
|
| 1530 |
|
* |
| 1531 |
|
* @since 2.0.2 |
| 1532 |
|
*/ |
| 1533 |
|
public function doTRACE($request) |
| 1534 |
|
{ |
| 1535 |
|
$HTTPMethods = array('HEAD', 'GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'OPTIONS'); |
| 1536 |
|
$supported = array(); |
| 1537 |
|
|
| 1538 |
|
foreach ($HTTPMethods as $HTTPMethod) { |
| 1539 |
|
$reflector = new \ReflectionMethod($this, 'do'.$HTTPMethod); |
| 1540 |
|
$isOverridden = ($reflector->getDeclaringClass()->getName() === get_class($this)); |
| 1541 |
|
|
| 1542 |
|
if ($isOverridden) { |
| 1543 |
|
$supported[] = $HTTPMethod; |
| 1544 |
|
} |
| 1545 |
|
} |
| 1546 |
|
|
| 1547 |
|
$supported = implode(',', $supported); |
| 1548 |
|
|
| 1549 |
|
$response = new Response(405); |
| 1550 |
|
$response->setHeader('Allow', $supported); |
| 1551 |
|
|
| 1552 |
|
return $response; |
| 1553 |
|
} |
| 1554 |
|
|
| 1555 |
|
/** |
| 1556 |
|
* Maps the supplied request with the appropiate method to run on this controller, for example |