Skip to content

Commit b113c43

Browse files
committed
Fixed adding or subtracting licenses by 0
1 parent 9254e28 commit b113c43

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

CHANGELOG.md

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

33
All notable changes to `laravel-licenser` will be documented in this file.
44

5+
### 1.0.2
6+
- Fixed adding or subtracting licenses by 0
7+
58
### 1.0.1
69
- Added publish option for older versions of Laravel.
710
- Fixed setting a new value for the license amount.

src/License.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ abstract protected function subtracted();
139139
*/
140140
final public function add($quantity = 1)
141141
{
142-
if (!is_int($quantity) || $quantity <= 0) {
142+
if (!is_int($quantity) || $quantity < 0) {
143143
throw new LicenseException("Quantity must be a positive integer.");
144144
}
145145

@@ -161,7 +161,7 @@ final public function add($quantity = 1)
161161
*/
162162
final public function sub($quantity = 1)
163163
{
164-
if (!is_int($quantity) || $quantity <= 0) {
164+
if (!is_int($quantity) || $quantity < 0) {
165165
throw new LicenseException("Quantity must be a positive integer.");
166166
}
167167

@@ -187,7 +187,7 @@ final public function sub($quantity = 1)
187187
*/
188188
final public function set($quantity)
189189
{
190-
if (!is_int($quantity) || $quantity <= 0) {
190+
if (!is_int($quantity) || $quantity < 0) {
191191
throw new LicenseException("Quantity must be a positive integer.");
192192
}
193193

0 commit comments

Comments
 (0)