mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-02-08 05:18:40 +00:00
Minor fixes
This commit is contained in:
parent
bbf3e93402
commit
fdfdbb2146
|
|
@ -38,6 +38,8 @@ class Autoloader
|
||||||
*
|
*
|
||||||
* @param string $class Class path
|
* @param string $class Class path
|
||||||
*
|
*
|
||||||
|
* @example Autoloader::default_autoloader('\phpOMS\Autoloader') // void
|
||||||
|
*
|
||||||
* @return 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.
|
* @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
|
* @param string $class Class path
|
||||||
*
|
*
|
||||||
* @return false|string
|
* @example Autoloader::exists('\phpOMS\Autoloader') // true
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
*
|
*
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||||
|
|
|
||||||
|
|
@ -17,9 +17,6 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace phpOMS\Message;
|
namespace phpOMS\Message;
|
||||||
|
|
||||||
use phpOMS\DataStorage\Cookie\CookieJar;
|
|
||||||
use phpOMS\DataStorage\Session\HttpSession;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Response class.
|
* Response class.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -322,6 +322,16 @@ class Request extends RequestAbstract
|
||||||
return $this->browser;
|
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 */
|
public function setBrowser(string $browser) /* : void */
|
||||||
{
|
{
|
||||||
$this->browser = $browser;
|
$this->browser = $browser;
|
||||||
|
|
@ -351,6 +361,16 @@ class Request extends RequestAbstract
|
||||||
return $this->os;
|
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 */
|
public function setOS(string $os) /* : void */
|
||||||
{
|
{
|
||||||
$this->os = $os;
|
$this->os = $os;
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ class Rest
|
||||||
/**
|
/**
|
||||||
* Make request.
|
* Make request.
|
||||||
*
|
*
|
||||||
* @param mixed $data Data to pass
|
* @param Request $request Request
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*
|
*
|
||||||
|
|
@ -49,7 +49,7 @@ class Rest
|
||||||
case RequestMethod::POST:
|
case RequestMethod::POST:
|
||||||
curl_setopt($curl, CURLOPT_POST, 1);
|
curl_setopt($curl, CURLOPT_POST, 1);
|
||||||
|
|
||||||
if ($data) {
|
if ($request->getData() !== null) {
|
||||||
curl_setopt($curl, CURLOPT_POSTFIELDS, $request->getData());
|
curl_setopt($curl, CURLOPT_POSTFIELDS, $request->getData());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
Request
|
|
||||||
|
|
@ -289,9 +289,13 @@ abstract class RequestAbstract implements MessageInterface
|
||||||
*/
|
*/
|
||||||
public function getData($key = null)
|
public function getData($key = null)
|
||||||
{
|
{
|
||||||
|
if(!isset($key)) {
|
||||||
|
return $this->data;
|
||||||
|
}
|
||||||
|
|
||||||
$key = mb_strtolower($key);
|
$key = mb_strtolower($key);
|
||||||
|
|
||||||
return !isset($key) ? $this->data : $this->data[$key] ?? null;
|
return $this->data[$key] ?? null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -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
|
public static function list(string $path, string $filter = '*') : array
|
||||||
{
|
{
|
||||||
$list = [];
|
$list = [];
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,16 @@ namespace phpOMS\Utils;
|
||||||
*/
|
*/
|
||||||
class ImageUtils
|
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
|
public static function decodeBase64Image(string $img) : string
|
||||||
{
|
{
|
||||||
$img = str_replace('data:image/png;base64,', '', $img);
|
$img = str_replace('data:image/png;base64,', '', $img);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user