Minor fixes

This commit is contained in:
Dennis Eichhorn 2017-02-27 20:42:02 +01:00
parent bbf3e93402
commit fdfdbb2146
8 changed files with 53 additions and 8 deletions

View File

@ -38,6 +38,8 @@ class Autoloader
*
* @param string $class Class path
*
* @example Autoloader::default_autoloader('\phpOMS\Autoloader') // void
*
* @return void
*
* @throws AutoloadException Throws this exception if the class to autoload doesn't exist. This could also be related to a wrong namespace/file path correlation.
@ -59,7 +61,9 @@ class Autoloader
*
* @param string $class Class path
*
* @return false|string
* @example Autoloader::exists('\phpOMS\Autoloader') // true
*
* @return bool
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>

View File

@ -17,9 +17,6 @@ declare(strict_types=1);
namespace phpOMS\Message;
use phpOMS\DataStorage\Cookie\CookieJar;
use phpOMS\DataStorage\Session\HttpSession;
/**
* Response class.
*

View File

@ -322,6 +322,16 @@ class Request extends RequestAbstract
return $this->browser;
}
/**
* Set browser type
*
* @param string $browser Browser type
*
* @return void
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public function setBrowser(string $browser) /* : void */
{
$this->browser = $browser;
@ -351,6 +361,16 @@ class Request extends RequestAbstract
return $this->os;
}
/**
* Set OS type
*
* @param string $os OS type
*
* @return void
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public function setOS(string $os) /* : void */
{
$this->os = $os;

View File

@ -34,7 +34,7 @@ class Rest
/**
* Make request.
*
* @param mixed $data Data to pass
* @param Request $request Request
*
* @return string
*
@ -49,7 +49,7 @@ class Rest
case RequestMethod::POST:
curl_setopt($curl, CURLOPT_POST, 1);
if ($data) {
if ($request->getData() !== null) {
curl_setopt($curl, CURLOPT_POSTFIELDS, $request->getData());
}
break;

View File

@ -1 +0,0 @@
Request

View File

@ -289,9 +289,13 @@ abstract class RequestAbstract implements MessageInterface
*/
public function getData($key = null)
{
if(!isset($key)) {
return $this->data;
}
$key = mb_strtolower($key);
return !isset($key) ? $this->data : $this->data[$key] ?? null;
return $this->data[$key] ?? null;
}
/**

View File

@ -72,6 +72,17 @@ class Directory extends FileAbstract implements DirectoryInterface
}
}
/**
* List all files in directorz.
*
* @param string $path Path
* @param string $filter Filter
*
* @return array
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public static function list(string $path, string $filter = '*') : array
{
$list = [];

View File

@ -32,6 +32,16 @@ namespace phpOMS\Utils;
*/
class ImageUtils
{
/**
* Decode base64 image.
*
* @param string $img Encoded image
*
* @return string Decoded image
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public static function decodeBase64Image(string $img) : string
{
$img = str_replace('data:image/png;base64,', '', $img);