This repository has been archived by the owner on Nov 2, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feature/move-route-execution-from-router-to-route' into…
… develop
- Loading branch information
Showing
7 changed files
with
205 additions
and
107 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
namespace Zepto\Route; | ||
|
||
/** | ||
* ErrorRoute | ||
* | ||
* This route is executed on any application error. | ||
* | ||
* @package Zepto | ||
* @subpackage Route | ||
* @author Hassan Khan <contact@hassankhan.me> | ||
* @link https://github.com/hassankhan/Zepto | ||
* @license MIT | ||
* @since 0.7 | ||
*/ | ||
class ErrorRoute extends \Zepto\Route | ||
{ | ||
|
||
/** | ||
* Initializes the route by creating a regex pattern from the provided URL, | ||
* and assigns the callable function for this route | ||
* | ||
* @param string $url | ||
* @codeCoverageIgnore | ||
*/ | ||
public function __construct($url = '', $title, $body) | ||
{ | ||
$callback = function() use ($title, $body) { | ||
return sprintf('<html><head><title>%s</title><style>body{margin:0;padding:30px;font:12px/1.5 Helvetica,Arial,Verdana,sans-serif;}h1{margin:0;font-size:48px;font-weight:normal;line-height:48px;}strong{display:inline-block;width:65px;}</style></head><body><h1>%s</h1><p>%s</p></body></html>', $title, $title, $body); | ||
}; | ||
parent::__construct($url, $callback); | ||
} | ||
|
||
} |
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
Oops, something went wrong.