Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions config/verify.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
],
];
14 changes: 0 additions & 14 deletions src/Contract/VerifyInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

namespace LycheeVerify\Contract;

use LycheeVerify\Exceptions\SupporterOnlyOperationException;

interface VerifyInterface
{
/**
Expand Down Expand Up @@ -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.
*
Expand Down
18 changes: 18 additions & 0 deletions src/Verify.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
}
}
18 changes: 0 additions & 18 deletions src/VerifyTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace LycheeVerify;

use LycheeVerify\Contract\Status;
use LycheeVerify\Exceptions\SupporterOnlyOperationException;

trait VerifyTrait
{
Expand Down Expand Up @@ -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.
*
Expand Down