General bug fixes

This commit is contained in:
Dennis Eichhorn 2016-04-03 21:14:54 +02:00
parent 1f1090424b
commit bab6abfd0d
16 changed files with 72 additions and 71 deletions

View File

@ -73,6 +73,8 @@ class Autoloader
return $class;
}
echo $class;
return false;
}

View File

@ -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

View File

@ -0,0 +1,32 @@
<?php
/**
* Orange Management
*
* PHP Version 7.0
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @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 <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @license OMS License 1.0
* @link http://orange-management.com
* @since 1.0.0
*/
class HeaderAbstract
{
private static $isLocked = false;
}

View File

@ -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.
*

View File

@ -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) {

View File

@ -13,7 +13,7 @@
* @version 1.0.0
* @link http://orange-management.com
*/
namespace phpOMS\Message;
namespace phpOMS\Message\Http;
use phpOMS\Datatypes\Enum;

View File

@ -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;
}

View File

@ -15,7 +15,7 @@
*/
namespace phpOMS\Message\Http;
use phpOMS\Message\RequestMethod;
use phpOMS\Message\Http\RequestMethod;
/**
* Rest request class.

View File

@ -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}
*/

View File

@ -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;
}

View File

@ -15,7 +15,6 @@
*/
namespace phpOMS\Router;
use phpOMS\Message\RequestMethod;
use phpOMS\Views\ViewLayout;
/**

View File

@ -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;
}

View File

@ -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;
}

View File

@ -184,7 +184,7 @@ abstract class FileAbstract
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
abstract private function createNode() : bool;
abstract public function createNode() : bool;
/**
* Get created at.

View File

@ -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 <d.eichhorn@oms.com>
*/
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)