-
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.
Update Route system (add redirect command in route files); Fix BaseAc…
…tionController (fix render if set arg 'skip_render')
- Loading branch information
anthsnow
committed
May 19, 2022
1 parent
058146f
commit e55c0e0
Showing
6 changed files
with
176 additions
and
11 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
|
||
namespace FlyCubePHP\Core\Routes; | ||
|
||
class RouteRedirect | ||
{ | ||
private $_uri; | ||
private $_status; | ||
|
||
function __construct(string $uri, int $status = 303) { | ||
$this->_uri = $uri; | ||
$this->_status = $status; | ||
} | ||
|
||
/** | ||
* URL маршрута перенаправления | ||
* @return string | ||
*/ | ||
public function uri(): string { | ||
return $this->_uri; | ||
} | ||
|
||
/** | ||
* Код HTTP | ||
* @return int | ||
*/ | ||
public function status(): int { | ||
return $this->_status; | ||
} | ||
|
||
/** | ||
* Есть ли у маршрута входные аргументы? | ||
* @return bool | ||
*/ | ||
public function hasUriArgs(): bool { | ||
return preg_match('/\%\{([a-zA-Z0-9_]*)\}/i', $this->uri()); | ||
} | ||
} |
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