Skip to content

Commit 44e9061

Browse files
authored
Remove authorize method to avoid conflict at interface level (#6)
1 parent 348aa24 commit 44e9061

File tree

4 files changed

+20
-34
lines changed

4 files changed

+20
-34
lines changed

config/verify.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414
ValidateSupporter::class => 'ef1a42701af6dc36e052556a0ee1c762394f9428',
1515
ValidatePro::class => '482b48f1a026684b6c1754e45ca180ffc52483ff',
1616
ValidateSignature::class => '5a8a855d4b59c44c298daa66801c79f2aba20492',
17-
Verify::class => 'aba420193a9d017e36a215ef8dbd6332bd2c2525',
17+
Verify::class => 'f15a25c69847bf635c7b0cc730ea24a5aaf008b8',
1818
VerifySupporterStatus::class => '6358c45ed0414c1e2697e0881238659fa6221bed',
1919
VerifyProStatus::class => '212e6ada794587ee8e2b81cf76e243d134a7e823',
2020
VerifyServiceProvider::class => '923b63b15d25e69b95ed1d5ec1c82ba57f1a7d74',
21-
VerifyTrait::class => '1a0679c1d63b209b9427de6073e48bb1246e02a4',
21+
VerifyTrait::class => '2a2543fb702b95fe0d4cc78319bef6906a41f093',
2222
],
2323
];

src/Contract/VerifyInterface.php

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
namespace LycheeVerify\Contract;
44

5-
use LycheeVerify\Exceptions\SupporterOnlyOperationException;
6-
75
interface VerifyInterface
86
{
97
/**
@@ -43,18 +41,6 @@ public function is_pro(): bool;
4341
*/
4442
public function is_signature(): bool;
4543

46-
/**
47-
* Authorize the operation if the installation is verified.
48-
* Otherwise throw an exception.
49-
*
50-
* @param Status $required_status (default to SUPPORTER_EDITION)
51-
*
52-
* @return void
53-
*
54-
* @throws SupporterOnlyOperationException
55-
*/
56-
public function authorize(Status $required_status = Status::SUPPORTER_EDITION): void;
57-
5844
/**
5945
* Fork depending whether the installation is verified or not.
6046
*

src/Verify.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use Illuminate\Support\Facades\DB;
66
use LycheeVerify\Contract\Status;
77
use LycheeVerify\Contract\VerifyInterface;
8+
use LycheeVerify\Exceptions\SupporterOnlyOperationException;
89
use LycheeVerify\Validators\ValidatePro;
910
use LycheeVerify\Validators\ValidateSignature;
1011
use LycheeVerify\Validators\ValidateSupporter;
@@ -87,4 +88,21 @@ public function validate(): bool
8788

8889
return true;
8990
}
91+
92+
/**
93+
* Authorize the operation if the installation is verified.
94+
* Otherwise throw an exception.
95+
*
96+
* @param Status $required_status (default to SUPPORTER_EDITION)
97+
*
98+
* @return void
99+
*
100+
* @throws SupporterOnlyOperationException
101+
*/
102+
public function authorize(Status $required_status = Status::SUPPORTER_EDITION): void
103+
{
104+
if (!$this->check($required_status)) {
105+
throw new SupporterOnlyOperationException($required_status);
106+
}
107+
}
90108
}

src/VerifyTrait.php

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace LycheeVerify;
44

55
use LycheeVerify\Contract\Status;
6-
use LycheeVerify\Exceptions\SupporterOnlyOperationException;
76

87
trait VerifyTrait
98
{
@@ -62,23 +61,6 @@ public function is_signature(): bool
6261
return $this->check(Status::SIGNATURE_EDITION);
6362
}
6463

65-
/**
66-
* Authorize the operation if the installation is verified.
67-
* Otherwise throw an exception.
68-
*
69-
* @param Status $required_status (default to SUPPORTER_EDITION)
70-
*
71-
* @return void
72-
*
73-
* @throws SupporterOnlyOperationException
74-
*/
75-
public function authorize(Status $required_status = Status::SUPPORTER_EDITION): void
76-
{
77-
if (!$this->check($required_status)) {
78-
throw new SupporterOnlyOperationException($required_status);
79-
}
80-
}
81-
8264
/**
8365
* Fork depending whether the installation is verified or not.
8466
*

0 commit comments

Comments
 (0)