diff --git a/Autoloader.php b/Autoloader.php index 6907dfad7..8d5f545bf 100644 --- a/Autoloader.php +++ b/Autoloader.php @@ -73,6 +73,8 @@ class Autoloader return $class; } + echo $class; + return false; } diff --git a/Dispatcher/Dispatcher.php b/Dispatcher/Dispatcher.php index 1ce64f549..bd961a9c9 100644 --- a/Dispatcher/Dispatcher.php +++ b/Dispatcher/Dispatcher.php @@ -118,7 +118,7 @@ class Dispatcher throw new \UnexpectedValueException('Unexpected function.'); } - return $views + return $views; } private function dispatchArray(array $controller, RequestAbstract $request, ResponseAbstract $response, $data = null) : array diff --git a/Message/HeaderAbstract.php b/Message/HeaderAbstract.php new file mode 100644 index 000000000..def6fb17c --- /dev/null +++ b/Message/HeaderAbstract.php @@ -0,0 +1,32 @@ + + * @author Dennis Eichhorn + * @copyright 2013 Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +namespace phpOMS\Message; + +/** + * Response class. + * + * @category Framework + * @package phpOMS\Response + * @author OMS Development Team + * @author Dennis Eichhorn + * @license OMS License 1.0 + * @link http://orange-management.com + * @since 1.0.0 + */ +class HeaderAbstract +{ + private static $isLocked = false; +} \ No newline at end of file diff --git a/Message/Http/Header.php b/Message/Http/Header.php index dd0943f2e..0ca37694e 100644 --- a/Message/Http/Header.php +++ b/Message/Http/Header.php @@ -15,10 +15,7 @@ */ namespace phpOMS\Message\Http; -use phpOMS\Contract\ArrayableInterface; -use phpOMS\Contract\RenderableInterface; -use phpOMS\Message\ResponseAbstract; -use phpOMS\Model\Html\Head; +use phpOMS\Message\HeaderAbstract; use phpOMS\Utils\ArrayUtils; use phpOMS\DataStorage\Cookie\CookieJar; use phpOMS\DataStorage\Session\HttpSession; @@ -50,6 +47,19 @@ class Header extends HeaderAbstract $this->setHeader('Content-Type', 'text/html; charset=utf-8'); } + public function getHeaders() : array + { + return getallheaders(); + } + + /** + * {@inheritdoc} + */ + public function getHeader(string $name) : string + { + return getallheaders()[$name]; + } + /** * Remove header by ID. * diff --git a/Message/Http/Request.php b/Message/Http/Request.php index b67174a82..6780bc4ee 100644 --- a/Message/Http/Request.php +++ b/Message/Http/Request.php @@ -399,31 +399,7 @@ class Request extends RequestAbstract public function getProtocolVersion() : string { return $_SERVER['SERVER_PROTOCOL']; - } - - /** - * {@inheritdoc} - */ - public function getHeaders() : array - { - return getallheaders(); - } - - /** - * {@inheritdoc} - */ - public function hasHeader(string $name) : bool - { - return array_key_exists($name, getallheaders()); - } - - /** - * {@inheritdoc} - */ - public function getHeader(string $name) : string - { - return getallheaders()[$name]; - } + } /** * {@inheritdoc} @@ -454,11 +430,6 @@ class Request extends RequestAbstract return $this->files; } - public function setHeader($key, string $header, bool $overwrite = true) - { - // NOT Required for Http request - } - public function getRouteVerb() : int { switch($this->method) { diff --git a/Message/Http/RequestMethod.php b/Message/Http/RequestMethod.php index 9f51448fb..dcdd4c4f7 100644 --- a/Message/Http/RequestMethod.php +++ b/Message/Http/RequestMethod.php @@ -13,7 +13,7 @@ * @version 1.0.0 * @link http://orange-management.com */ -namespace phpOMS\Message; +namespace phpOMS\Message\Http; use phpOMS\Datatypes\Enum; diff --git a/Message/Http/Response.php b/Message/Http/Response.php index fe4ed8917..3f5a1c812 100644 --- a/Message/Http/Response.php +++ b/Message/Http/Response.php @@ -15,10 +15,9 @@ */ namespace phpOMS\Message\Http; -use phpOMS\Contract\ArrayableInterface; +use phpOMS\System\MimeType; use phpOMS\Contract\RenderableInterface; use phpOMS\Message\ResponseAbstract; -use phpOMS\Model\Html\Head; use phpOMS\Utils\ArrayUtils; use phpOMS\DataStorage\Cookie\CookieJar; use phpOMS\DataStorage\Session\HttpSession; @@ -44,6 +43,7 @@ class Response extends ResponseAbstract implements RenderableInterface */ public function __construct() { + $this->header = new Header(); } /** @@ -160,7 +160,7 @@ class Response extends ResponseAbstract implements RenderableInterface throw new \Exception('Wrong response type'); } } - + return $render; } diff --git a/Message/Http/Rest.php b/Message/Http/Rest.php index d99435014..39210d4c3 100644 --- a/Message/Http/Rest.php +++ b/Message/Http/Rest.php @@ -15,7 +15,7 @@ */ namespace phpOMS\Message\Http; -use phpOMS\Message\RequestMethod; +use phpOMS\Message\Http\RequestMethod; /** * Rest request class. diff --git a/Message/RequestAbstract.php b/Message/RequestAbstract.php index c8b595076..a59e9d70b 100644 --- a/Message/RequestAbstract.php +++ b/Message/RequestAbstract.php @@ -122,6 +122,8 @@ abstract class RequestAbstract implements MessageInterface */ protected $hash = []; + protected $header = null; + /** * Constructor. * @@ -321,6 +323,11 @@ abstract class RequestAbstract implements MessageInterface return $this->status; } + public function getHeader() : HeaderAbstract + { + return $this->header; + } + /** * {@inheritdoc} */ diff --git a/Message/Http/RequestStatus.php b/Message/RequestStatus.php similarity index 100% rename from Message/Http/RequestStatus.php rename to Message/RequestStatus.php diff --git a/Message/ResponseAbstract.php b/Message/ResponseAbstract.php index 205927c03..4c1ecb88b 100644 --- a/Message/ResponseAbstract.php +++ b/Message/ResponseAbstract.php @@ -15,10 +15,9 @@ */ namespace phpOMS\Message; -use phpOMS\Contract\ArrayableInterface; -use phpOMS\Contract\JsonableInterface; use phpOMS\Localization\Localization; use phpOMS\Utils\ArrayUtils; +use phpOMS\Message\Http\Header; /** * Response abstract class. @@ -31,7 +30,7 @@ use phpOMS\Utils\ArrayUtils; * @link http://orange-management.com * @since 1.0.0 */ -abstract class ResponseAbstract implements MessageInterface, ArrayableInterface, JsonableInterface +abstract class ResponseAbstract implements MessageInterface { /** @@ -162,5 +161,5 @@ abstract class ResponseAbstract implements MessageInterface, ArrayableInterface, return $this->header; } - public function getBody() : string; + abstract public function getBody() : string; } diff --git a/Router/Router.php b/Router/Router.php index aebd6fe63..bb1703aeb 100644 --- a/Router/Router.php +++ b/Router/Router.php @@ -15,7 +15,6 @@ */ namespace phpOMS\Router; -use phpOMS\Message\RequestMethod; use phpOMS\Views\ViewLayout; /** diff --git a/System/File/Directory.php b/System/File/Directory.php index 1d6b15dbe..62f66d96a 100644 --- a/System/File/Directory.php +++ b/System/File/Directory.php @@ -217,7 +217,7 @@ class Directory extends FileAbstract implements \Iterator, \ArrayAccess /** * {@inheritdoc} */ - private function createNode() : bool + public function createNode() : bool { return self::createPath($this->path, $this->permission, true); } @@ -225,7 +225,7 @@ class Directory extends FileAbstract implements \Iterator, \ArrayAccess /** * {@inheritdoc} */ - private function removeNode() : bool + public function removeNode() : bool { return true; } diff --git a/System/File/File.php b/System/File/File.php index 611548f07..4af2bd6d9 100644 --- a/System/File/File.php +++ b/System/File/File.php @@ -77,7 +77,7 @@ class File extends FileAbstract /** * {@inheritdoc} */ - private function createNode() : bool + public function createNode() : bool { return self::create($this->path); } @@ -85,7 +85,7 @@ class File extends FileAbstract /** * {@inheritdoc} */ - private function removeNode() : bool + public function removeNode() : bool { return true; } diff --git a/System/File/FileAbstract.php b/System/File/FileAbstract.php index 87dca8ef3..88ce3f03f 100644 --- a/System/File/FileAbstract.php +++ b/System/File/FileAbstract.php @@ -184,7 +184,7 @@ abstract class FileAbstract * @since 1.0.0 * @author Dennis Eichhorn */ - abstract private function createNode() : bool; + abstract public function createNode() : bool; /** * Get created at. diff --git a/Views/View.php b/Views/View.php index 028197018..c58fed212 100644 --- a/Views/View.php +++ b/Views/View.php @@ -34,7 +34,7 @@ use phpOMS\Validation\Validator; * @link http://orange-management.com * @since 1.0.0 */ -class View implements \Serializeable +class View implements \Serializable { /** @@ -250,25 +250,6 @@ class View implements \Serializeable } } - /** - * Get view/template response of all views. - * - * @return string - * - * @since 1.0.0 - * @author Dennis Eichhorn - */ - public function renderAll() : string - { - ob_start(); - - foreach ($this->views as $key => $view) { - echo $view->render(); - } - - return ob_get_clean(); - } - /** * Get view/template response. * @@ -373,7 +354,7 @@ class View implements \Serializeable public function serialize() { - return $this->renderAll(); + return $this->render(); } public function unserialize($raw)