mirror of
https://github.com/Karaka-Management/oms-Admin.git
synced 2026-01-31 13:58:40 +00:00
Fix bugs from draft
This commit is contained in:
parent
5023d2077b
commit
3e6ee5ecdc
47
Models/Exceptions/InvalidSignatureException.php
Normal file
47
Models/Exceptions/InvalidSignatureException.php
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
<?php
|
||||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.1
|
||||
*
|
||||
* @category TBD
|
||||
* @package TBD
|
||||
* @author OMS Development Team <dev@oms.com>
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
* @link http://orange-management.com
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\Admin\Models\Exceptions;
|
||||
|
||||
/**
|
||||
* Permission exception class.
|
||||
*
|
||||
* @category Framework
|
||||
* @package phpOMS\System\File
|
||||
* @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 InvalidSignatureException extends \RuntimeException
|
||||
{
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param string $message Exception message
|
||||
* @param int $code Exception code
|
||||
* @param \Exception Previous exception
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function __construct(string $message, int $code = 0, \Exception $previous = null)
|
||||
{
|
||||
parent::__construct('Signature "' . $message . '" is invalid.', $code, $previous);
|
||||
}
|
||||
}
|
||||
47
Models/Exceptions/InvalidVersionException.php
Normal file
47
Models/Exceptions/InvalidVersionException.php
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
<?php
|
||||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.1
|
||||
*
|
||||
* @category TBD
|
||||
* @package TBD
|
||||
* @author OMS Development Team <dev@oms.com>
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
* @link http://orange-management.com
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\Admin\Models\Exceptions;
|
||||
|
||||
/**
|
||||
* Permission exception class.
|
||||
*
|
||||
* @category Framework
|
||||
* @package phpOMS\System\File
|
||||
* @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 InvalidVersionException extends \RuntimeException
|
||||
{
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param string $message Exception message
|
||||
* @param int $code Exception code
|
||||
* @param \Exception Previous exception
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function __construct(string $message, int $code = 0, \Exception $previous = null)
|
||||
{
|
||||
parent::__construct('Version "' . $message . '" is invalid.', $code, $previous);
|
||||
}
|
||||
}
|
||||
|
|
@ -17,6 +17,8 @@ declare(strict_types=1);
|
|||
namespace Modules\Admin\Models;
|
||||
|
||||
use phpOMS\Utils\IO\Zip\Zip;
|
||||
use Modules\Admin\Models\Exceptions\InvalidSignatureException;
|
||||
use Modules\Admin\Models\Exceptions\InvalidVersionException;
|
||||
|
||||
class Package
|
||||
{
|
||||
|
|
@ -38,14 +40,14 @@ class Package
|
|||
return true;
|
||||
}
|
||||
|
||||
public function validated() : bool;
|
||||
public function validated() : bool
|
||||
{
|
||||
if(!$this->validateSignature()) {
|
||||
throw new InvalidSignature();
|
||||
throw new InvalidSignatureException();
|
||||
}
|
||||
|
||||
if(!$this->validateVersion()) {
|
||||
throw new InvalidVersion();
|
||||
throw new InvalidVersionException();
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user