-
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.
- Loading branch information
Ahmard
authored and
Ahmard
committed
Oct 28, 2020
1 parent
f4eb5d7
commit 187eeec
Showing
8 changed files
with
294 additions
and
168 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
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,63 @@ | ||
<?php | ||
|
||
|
||
namespace QuickRoute\Route; | ||
|
||
|
||
use FastRoute\Dispatcher as FastDispatcher; | ||
|
||
class DispatchResult | ||
{ | ||
private array $dispatchResult; | ||
|
||
public function __construct(array $dispatchResult) | ||
{ | ||
$this->dispatchResult = $dispatchResult; | ||
} | ||
|
||
|
||
/** | ||
* If url is found | ||
* @return bool | ||
*/ | ||
public function isFound() | ||
{ | ||
return $this->dispatchResult[0] === FastDispatcher::FOUND; | ||
} | ||
|
||
/** | ||
* If url is not found | ||
* @return bool | ||
*/ | ||
public function isNotFound() | ||
{ | ||
return $this->dispatchResult[0] === FastDispatcher::NOT_FOUND; | ||
} | ||
|
||
/** | ||
* If url method is not allowed | ||
* @return bool | ||
*/ | ||
public function isMethodNotAllowed() | ||
{ | ||
return $this->dispatchResult[0] === FastDispatcher::METHOD_NOT_ALLOWED; | ||
} | ||
|
||
/** | ||
* Get dispatched url parameters | ||
* @return mixed|null | ||
*/ | ||
public function getUrlParameters() | ||
{ | ||
return $this->dispatchResult[2] ?? null; | ||
} | ||
|
||
/** | ||
* Get found url class | ||
* @return array | ||
*/ | ||
public function getRoute(): array | ||
{ | ||
return $this->dispatchResult[1] ?? []; | ||
} | ||
} |
Oops, something went wrong.