diff --git a/config/verify.php b/config/verify.php index b46b3ec..1b3048a 100644 --- a/config/verify.php +++ b/config/verify.php @@ -14,10 +14,10 @@ ValidateSupporter::class => 'ef1a42701af6dc36e052556a0ee1c762394f9428', ValidatePro::class => '482b48f1a026684b6c1754e45ca180ffc52483ff', ValidateSignature::class => '5a8a855d4b59c44c298daa66801c79f2aba20492', - Verify::class => 'aba420193a9d017e36a215ef8dbd6332bd2c2525', + Verify::class => 'f15a25c69847bf635c7b0cc730ea24a5aaf008b8', VerifySupporterStatus::class => '6358c45ed0414c1e2697e0881238659fa6221bed', VerifyProStatus::class => '212e6ada794587ee8e2b81cf76e243d134a7e823', VerifyServiceProvider::class => '923b63b15d25e69b95ed1d5ec1c82ba57f1a7d74', - VerifyTrait::class => '1a0679c1d63b209b9427de6073e48bb1246e02a4', + VerifyTrait::class => '2a2543fb702b95fe0d4cc78319bef6906a41f093', ], ]; diff --git a/src/Contract/VerifyInterface.php b/src/Contract/VerifyInterface.php index 5b6f910..e2c0013 100644 --- a/src/Contract/VerifyInterface.php +++ b/src/Contract/VerifyInterface.php @@ -2,8 +2,6 @@ namespace LycheeVerify\Contract; -use LycheeVerify\Exceptions\SupporterOnlyOperationException; - interface VerifyInterface { /** @@ -43,18 +41,6 @@ public function is_pro(): bool; */ public function is_signature(): bool; - /** - * Authorize the operation if the installation is verified. - * Otherwise throw an exception. - * - * @param Status $required_status (default to SUPPORTER_EDITION) - * - * @return void - * - * @throws SupporterOnlyOperationException - */ - public function authorize(Status $required_status = Status::SUPPORTER_EDITION): void; - /** * Fork depending whether the installation is verified or not. * diff --git a/src/Verify.php b/src/Verify.php index 7dde5d9..b1892dd 100755 --- a/src/Verify.php +++ b/src/Verify.php @@ -5,6 +5,7 @@ use Illuminate\Support\Facades\DB; use LycheeVerify\Contract\Status; use LycheeVerify\Contract\VerifyInterface; +use LycheeVerify\Exceptions\SupporterOnlyOperationException; use LycheeVerify\Validators\ValidatePro; use LycheeVerify\Validators\ValidateSignature; use LycheeVerify\Validators\ValidateSupporter; @@ -87,4 +88,21 @@ public function validate(): bool return true; } + + /** + * Authorize the operation if the installation is verified. + * Otherwise throw an exception. + * + * @param Status $required_status (default to SUPPORTER_EDITION) + * + * @return void + * + * @throws SupporterOnlyOperationException + */ + public function authorize(Status $required_status = Status::SUPPORTER_EDITION): void + { + if (!$this->check($required_status)) { + throw new SupporterOnlyOperationException($required_status); + } + } } diff --git a/src/VerifyTrait.php b/src/VerifyTrait.php index 12471ad..8e02855 100644 --- a/src/VerifyTrait.php +++ b/src/VerifyTrait.php @@ -3,7 +3,6 @@ namespace LycheeVerify; use LycheeVerify\Contract\Status; -use LycheeVerify\Exceptions\SupporterOnlyOperationException; trait VerifyTrait { @@ -62,23 +61,6 @@ public function is_signature(): bool return $this->check(Status::SIGNATURE_EDITION); } - /** - * Authorize the operation if the installation is verified. - * Otherwise throw an exception. - * - * @param Status $required_status (default to SUPPORTER_EDITION) - * - * @return void - * - * @throws SupporterOnlyOperationException - */ - public function authorize(Status $required_status = Status::SUPPORTER_EDITION): void - { - if (!$this->check($required_status)) { - throw new SupporterOnlyOperationException($required_status); - } - } - /** * Fork depending whether the installation is verified or not. *