Formatting and namespace fixes

This commit is contained in:
Dennis Eichhorn 2016-03-26 14:59:09 +01:00
parent bb31881f59
commit cb9ee501d0
5 changed files with 23 additions and 21 deletions

View File

@ -50,7 +50,7 @@ class Autoloader
/** @noinspection PhpIncludeInspection */
include __DIR__ . '/../' . $class . '.php';
} else {
throw new \Exception();
throw new \Exception($class);
}
}

View File

@ -18,7 +18,7 @@ NOT IN USE
Will be implemented later
*/
/* TODO: implement */
namespace phpOMS\Cookie;
namespace phpOMS\DataStorage\Cookie;
/**
* @since 1.0.0

View File

@ -134,22 +134,22 @@ class Request extends RequestAbstract
{
$this->data = $_GET ?? [];
if (isset($_SERVER['CONTENT_TYPE'])) {
if (strpos($_SERVER['CONTENT_TYPE'], 'application/json') !== false) {
if (($json = json_decode(($input = file_get_contents('php://input')), true)) === false || $json === null) {
throw new \Exception('Is not valid json ' . $input);
}
$this->data += $json;
} elseif (strpos($_SERVER['CONTENT_TYPE'], 'application/x-www-form-urlencoded') !== false) {
parse_str(file_get_contents('php://input'), $temp);
$this->data += $temp;
} elseif (strpos($_SERVER['CONTENT_TYPE'], 'multipart/form-data') !== false) {
$this->files = $_FILES;
if (isset($_SERVER['CONTENT_TYPE'])) {
if (strpos($_SERVER['CONTENT_TYPE'], 'application/json') !== false) {
if (($json = json_decode(($input = file_get_contents('php://input')), true)) === false || $json === null) {
throw new \Exception('Is not valid json ' . $input);
}
}
$this->uri->set(Http::getCurrent());
$this->data += $json;
} elseif (strpos($_SERVER['CONTENT_TYPE'], 'application/x-www-form-urlencoded') !== false) {
parse_str(file_get_contents('php://input'), $temp);
$this->data += $temp;
} elseif (strpos($_SERVER['CONTENT_TYPE'], 'multipart/form-data') !== false) {
$this->files = $_FILES;
}
}
$this->uri->set(Http::getCurrent());
}
/**
@ -354,10 +354,10 @@ class Request extends RequestAbstract
}
return
(!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off')
|| (empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')
|| (!empty($_SERVER['HTTP_X_FORWARDED_SSL']) && $_SERVER['HTTP_X_FORWARDED_SSL'] == 'on')
|| $_SERVER['SERVER_PORT'] == $port;
(!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off')
|| (empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')
|| (!empty($_SERVER['HTTP_X_FORWARDED_SSL']) && $_SERVER['HTTP_X_FORWARDED_SSL'] == 'on')
|| $_SERVER['SERVER_PORT'] == $port;
}
/**

View File

@ -20,6 +20,8 @@ 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;
/**
* Response class.

View File

@ -13,7 +13,7 @@
* @version 1.0.0
* @link http://orange-management.com
*/
namespace phpOMS\System;
namespace phpOMS\System\File;
/**
* Filesystem class.