You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 6, 2023. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+17-17Lines changed: 17 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -377,35 +377,35 @@ See the [ddd helper](#ddd) for example output.
377
377
378
378
## Class helpers
379
379
380
-
### Constants trait
380
+
### Enum trait
381
381
382
-
The primary use of the `Constants` trait is to enable you to store all constants of a specific type in a single class or value object and have it return those with a single call.
382
+
The primary use of the `Enum` trait is to enable you to store all cases of a specific type in a single class or value object and have it return those with a single call.
383
383
384
-
This can be useful for instance when your database uses integers to store states, but you want to use descriptive strings throughout your code (i.e. enums). It also allows you to refactor these constants at any time without having to waste time searching your code for any raw values (and probably miss a few, introducing new bugs along the way).
384
+
This can be useful for instance when your database uses integers to store states, but you want to use descriptive strings throughout your code (i.e. enums). It also allows you to refactor these elements at any time without having to waste time searching your code for any raw values (and probably miss a few, introducing new bugs along the way).
385
385
386
-
#### Retrieving constants
386
+
#### Retrieving elements
387
387
388
-
Returns an array of constant keys and their values.
388
+
Returns an array of element keys and their values.
389
389
390
390
```php
391
391
<?php
392
392
393
-
use SebastiaanLuca\PhpHelpers\Classes\Constants;
393
+
use SebastiaanLuca\PhpHelpers\Classes\Enum;
394
394
395
395
class UserStates
396
396
{
397
-
use Constants;
397
+
use Enum;
398
398
399
399
public const REGISTERED = 'registered';
400
400
public const ACTIVATED = 'activated';
401
401
public const DISABLED = 'disabled';
402
402
}
403
403
404
-
UserStates::constants();
404
+
UserStates::enums();
405
405
406
406
// or
407
407
408
-
(new UserStates)->constants();
408
+
(new UserStates)->enums();
409
409
410
410
/*
411
411
[
@@ -416,18 +416,18 @@ UserStates::constants();
416
416
*/
417
417
```
418
418
419
-
#### Retrieving constant keys
419
+
#### Retrieving element keys
420
420
421
-
Returns all the keys of constants in a class.
421
+
Returns all the keys of the elements in an enum.
422
422
423
423
```php
424
424
<?php
425
425
426
-
use SebastiaanLuca\PhpHelpers\Classes\Constants;
426
+
use SebastiaanLuca\PhpHelpers\Classes\Enum;
427
427
428
428
class UserStates
429
429
{
430
-
use Constants;
430
+
use Enum;
431
431
432
432
public const REGISTERED = 'registered';
433
433
public const ACTIVATED = 'activated';
@@ -447,16 +447,16 @@ UserStates::keys();
447
447
448
448
#### Retrieving constant values
449
449
450
-
Returns all the values of constants in a class.
450
+
Returns all the values of the elements in an enum.
451
451
452
452
```php
453
453
<?php
454
454
455
-
use SebastiaanLuca\PhpHelpers\Classes\Constants;
455
+
use SebastiaanLuca\PhpHelpers\Classes\Enum;
456
456
457
457
class UserStates
458
458
{
459
-
use Constants;
459
+
use Enum;
460
460
461
461
public const REGISTERED = 'registered';
462
462
public const ACTIVATED = 'activated';
@@ -561,7 +561,7 @@ composer test
561
561
562
562
## Contributing
563
563
564
-
Please see [CONTRIBUTING](CONTRIBUTING.md) and [CONDUCT](CONDUCT.md) for details.
564
+
Please see [CONTRIBUTING](CONTRIBUTING.md) and [CODE OF CONDUCT](CODE_OF_CONDUCT.md) for details.
0 commit comments