Skip to content

Commit 7219d57

Browse files
authored
Change boolean helper methods names (#52)
Change boolean helper methods names
1 parent 538517a commit 7219d57

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+100
-528
lines changed

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,18 @@ All notable changes to `laravel-eloquent-flag` will be documented in this file.
1313

1414
- All methods are strict typed now
1515
- `Carbon\Carbon` replaced with `Illuminate\Support\Facades\Date`
16+
- `isRejected` method renamed to `isNotAccepted`
17+
- `isDeactivated` method renamed to `isNotActivated`
18+
- `isDisapproved` method renamed to `isNotApproved`
19+
- `isUninvited` method renamed to `isNotInvited`
20+
- `isUnkept` method renamed to `isNotKept`
21+
- `isUnpublished` method renamed to `isNotPublished`
22+
- `isUnverified` method renamed to `isNotVerified`
23+
- `isUnarchived` method renamed to `isNotArchived`
24+
- `isOpened` method renamed to `isNotClosed`
25+
- `isUndrafted` method renamed to `isNotDrafted`
26+
- `isUnended` method renamed to `isNotEnded`
27+
- `isUnexpired` method renamed to `isNotExpired`
1628

1729
### Removed
1830

src/Traits/Classic/HasAcceptedAtHelpers.php

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -22,31 +22,16 @@ public function initializeHasAcceptedAtHelpers(): void
2222
$this->dates[] = 'accepted_at';
2323
}
2424

25-
/**
26-
* If entity is accepted.
27-
*
28-
* @return bool
29-
*/
3025
public function isAccepted(): bool
3126
{
3227
return !is_null($this->getAttributeValue('accepted_at'));
3328
}
3429

35-
/**
36-
* If entity is rejected.
37-
*
38-
* @return bool
39-
*/
40-
public function isRejected(): bool
30+
public function isNotAccepted(): bool
4131
{
4232
return !$this->isAccepted();
4333
}
4434

45-
/**
46-
* Mark entity as accepted.
47-
*
48-
* @return void
49-
*/
5035
public function accept(): void
5136
{
5237
$this->setAttribute('accepted_at', Date::now());
@@ -55,11 +40,6 @@ public function accept(): void
5540
$this->fireModelEvent('accepted', false);
5641
}
5742

58-
/**
59-
* Mark entity as rejected.
60-
*
61-
* @return void
62-
*/
6343
public function reject(): void
6444
{
6545
$this->setAttribute('accepted_at', null);

src/Traits/Classic/HasAcceptedFlagHelpers.php

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -20,31 +20,16 @@ public function initializeHasAcceptedFlagHelpers(): void
2020
$this->casts['is_accepted'] = 'boolean';
2121
}
2222

23-
/**
24-
* If entity is accepted.
25-
*
26-
* @return bool
27-
*/
2823
public function isAccepted(): bool
2924
{
3025
return $this->getAttributeValue('is_accepted');
3126
}
3227

33-
/**
34-
* If entity is rejected.
35-
*
36-
* @return bool
37-
*/
38-
public function isRejected(): bool
28+
public function isNotAccepted(): bool
3929
{
4030
return !$this->isAccepted();
4131
}
4232

43-
/**
44-
* Mark entity as accepted.
45-
*
46-
* @return void
47-
*/
4833
public function accept(): void
4934
{
5035
$this->setAttribute('is_accepted', true);
@@ -53,11 +38,6 @@ public function accept(): void
5338
$this->fireModelEvent('accepted', false);
5439
}
5540

56-
/**
57-
* Mark entity as rejected.
58-
*
59-
* @return void
60-
*/
6141
public function reject(): void
6242
{
6343
$this->setAttribute('is_accepted', false);

src/Traits/Classic/HasActiveFlagHelpers.php

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -20,31 +20,16 @@ public function initializeHasActiveFlagHelpers(): void
2020
$this->casts['is_active'] = 'boolean';
2121
}
2222

23-
/**
24-
* If entity is activated.
25-
*
26-
* @return bool
27-
*/
2823
public function isActivated(): bool
2924
{
3025
return $this->getAttributeValue('is_active');
3126
}
3227

33-
/**
34-
* If entity is deactivated.
35-
*
36-
* @return bool
37-
*/
38-
public function isDeactivated(): bool
28+
public function isNotActivated(): bool
3929
{
4030
return !$this->isActivated();
4131
}
4232

43-
/**
44-
* Mark entity as active.
45-
*
46-
* @return void
47-
*/
4833
public function activate(): void
4934
{
5035
$this->setAttribute('is_active', true);
@@ -53,11 +38,6 @@ public function activate(): void
5338
$this->fireModelEvent('activated', false);
5439
}
5540

56-
/**
57-
* Mark entity as deactivated.
58-
*
59-
* @return void
60-
*/
6141
public function deactivate(): void
6242
{
6343
$this->save();

src/Traits/Classic/HasApprovedAtHelpers.php

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -22,31 +22,16 @@ public function initializeHasApprovedAtHelpers(): void
2222
$this->dates[] = 'approved_at';
2323
}
2424

25-
/**
26-
* If entity is approved.
27-
*
28-
* @return bool
29-
*/
3025
public function isApproved(): bool
3126
{
3227
return !is_null($this->getAttributeValue('approved_at'));
3328
}
3429

35-
/**
36-
* If entity is disapproved.
37-
*
38-
* @return bool
39-
*/
40-
public function isDisapproved(): bool
30+
public function isNotApproved(): bool
4131
{
4232
return !$this->isApproved();
4333
}
4434

45-
/**
46-
* Mark entity as approved.
47-
*
48-
* @return void
49-
*/
5035
public function approve(): void
5136
{
5237
$this->setAttribute('approved_at', Date::now());
@@ -55,11 +40,6 @@ public function approve(): void
5540
$this->fireModelEvent('approved', false);
5641
}
5742

58-
/**
59-
* Mark entity as disapproved.
60-
*
61-
* @return void
62-
*/
6343
public function disapprove(): void
6444
{
6545
$this->setAttribute('approved_at', null);

src/Traits/Classic/HasApprovedFlagHelpers.php

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -20,31 +20,16 @@ public function initializeHasApprovedFlagHelpers(): void
2020
$this->casts['is_approved'] = 'boolean';
2121
}
2222

23-
/**
24-
* If entity is approved.
25-
*
26-
* @return bool
27-
*/
2823
public function isApproved(): bool
2924
{
3025
return $this->getAttributeValue('is_approved');
3126
}
3227

33-
/**
34-
* If entity is disapproved.
35-
*
36-
* @return bool
37-
*/
38-
public function isDisapproved(): bool
28+
public function isNotApproved(): bool
3929
{
4030
return !$this->isApproved();
4131
}
4232

43-
/**
44-
* Mark entity as approved.
45-
*
46-
* @return void
47-
*/
4833
public function approve(): void
4934
{
5035
$this->setAttribute('is_approved', true);
@@ -53,11 +38,6 @@ public function approve(): void
5338
$this->fireModelEvent('approved', false);
5439
}
5540

56-
/**
57-
* Mark entity as disapproved.
58-
*
59-
* @return void
60-
*/
6141
public function disapprove(): void
6242
{
6343
$this->setAttribute('is_approved', false);

src/Traits/Classic/HasInvitedAtHelpers.php

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -22,31 +22,16 @@ public function initializeHasInvitedAtHelpers(): void
2222
$this->dates[] = 'invited_at';
2323
}
2424

25-
/**
26-
* If entity is invited.
27-
*
28-
* @return bool
29-
*/
3025
public function isInvited(): bool
3126
{
3227
return !is_null($this->getAttributeValue('invited_at'));
3328
}
3429

35-
/**
36-
* If entity is uninvited.
37-
*
38-
* @return bool
39-
*/
40-
public function isUninvited(): bool
30+
public function isNotInvited(): bool
4131
{
4232
return !$this->isInvited();
4333
}
4434

45-
/**
46-
* Mark entity as invited.
47-
*
48-
* @return void
49-
*/
5035
public function invite(): void
5136
{
5237
$this->setAttribute('invited_at', Date::now());
@@ -55,11 +40,6 @@ public function invite(): void
5540
$this->fireModelEvent('invited', false);
5641
}
5742

58-
/**
59-
* Mark entity as uninvited.
60-
*
61-
* @return void
62-
*/
6343
public function uninvite(): void
6444
{
6545
$this->setAttribute('invited_at', null);

src/Traits/Classic/HasInvitedFlagHelpers.php

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -20,31 +20,16 @@ public function initializeHasInvitedFlagHelpers(): void
2020
$this->casts['is_invited'] = 'boolean';
2121
}
2222

23-
/**
24-
* If entity is invited.
25-
*
26-
* @return bool
27-
*/
2823
public function isInvited(): bool
2924
{
3025
return $this->getAttributeValue('is_invited');
3126
}
3227

33-
/**
34-
* If entity is uninvited.
35-
*
36-
* @return bool
37-
*/
38-
public function isUninvited(): bool
28+
public function isNotInvited(): bool
3929
{
4030
return !$this->isInvited();
4131
}
4232

43-
/**
44-
* Mark entity as invited.
45-
*
46-
* @return void
47-
*/
4833
public function invite(): void
4934
{
5035
$this->setAttribute('is_invited', true);
@@ -53,11 +38,6 @@ public function invite(): void
5338
$this->fireModelEvent('invited', false);
5439
}
5540

56-
/**
57-
* Mark entity as uninvited.
58-
*
59-
* @return void
60-
*/
6141
public function uninvite(): void
6242
{
6343
$this->setAttribute('is_invited', false);

src/Traits/Classic/HasKeptFlagHelpers.php

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -24,31 +24,16 @@ public function initializeHasKeptFlagHelpers(): void
2424
$this->casts['is_kept'] = 'boolean';
2525
}
2626

27-
/**
28-
* If entity is kept.
29-
*
30-
* @return bool
31-
*/
3227
public function isKept(): bool
3328
{
3429
return $this->getAttributeValue('is_kept');
3530
}
3631

37-
/**
38-
* If entity is unkept.
39-
*
40-
* @return bool
41-
*/
42-
public function isUnkept(): bool
32+
public function isNotKept(): bool
4333
{
4434
return !$this->isKept();
4535
}
4636

47-
/**
48-
* Mark entity as kept.
49-
*
50-
* @return void
51-
*/
5237
public function keep(): void
5338
{
5439
$this->setAttribute('is_kept', true);
@@ -57,11 +42,6 @@ public function keep(): void
5742
$this->fireModelEvent('kept', false);
5843
}
5944

60-
/**
61-
* Mark entity as unkept.
62-
*
63-
* @return void
64-
*/
6545
public function unkeep(): void
6646
{
6747
$this->setAttribute('is_kept', false);

0 commit comments

Comments
 (0)