Skip to content
This repository was archived by the owner on Dec 26, 2023. It is now read-only.

Commit 48da03f

Browse files
committed
Update README.md
1 parent 918eed7 commit 48da03f

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

README.md

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,34 +10,42 @@ Enumerated type for PHP by [Petr Knap].
1010

1111
### Usage of php-enum
1212

13+
#### Enum declaration
1314
```php
1415
/**
16+
* @method static DayOfWeekEnum SUNDAY()
1517
* @method static DayOfWeekEnum MONDAY()
1618
* @method static DayOfWeekEnum TUESDAY()
1719
* @method static DayOfWeekEnum WEDNESDAY()
1820
* @method static DayOfWeekEnum THURSDAY()
1921
* @method static DayOfWeekEnum FRIDAY()
2022
* @method static DayOfWeekEnum SATURDAY()
21-
* @method static DayOfWeekEnum SUNDAY()
2223
*/
2324
class DayOfWeekEnum extends \PetrKnap\Php\Enum\AbstractEnum
2425
{
2526
protected function __construct($constantName)
2627
{
2728
self::setConstants([
28-
"MONDAY" => 0,
29-
"TUESDAY" => 1,
30-
"WEDNESDAY" => 2,
31-
"THURSDAY" => 3,
32-
"FRIDAY" => 4,
33-
"SATURDAY" => 5,
34-
"SUNDAY" => 6
29+
"SUNDAY" => 0,
30+
"MONDAY" => 1,
31+
"TUESDAY" => 2,
32+
"WEDNESDAY" => 3,
33+
"THURSDAY" => 4,
34+
"FRIDAY" => 5,
35+
"SATURDAY" => 6
3536
]);
3637
parent::__construct($constantName);
3738
}
3839
}
3940
```
4041

42+
#### Enum usage
43+
```php
44+
if (date('w') == DayOfWeekEnum::FRIDAY()->getValue()) {
45+
echo "Finally It's Friday!"
46+
}
47+
```
48+
4149

4250
## How to install
4351

0 commit comments

Comments
 (0)