Last active
June 7, 2020 13:54
-
-
Save iluuu1994/b6614f2db0b1f6e733638e0fc972da4b to your computer and use it in GitHub Desktop.
Boundaries enum example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
enum Boundaries | |
{ | |
case includeNone; | |
case includeStart; | |
case includeEnd; | |
case includeAll; | |
public function startIncluded(): bool | |
{ | |
return match ($this) { | |
self::includeStart, self::includeAll => true, | |
default => false, | |
}; | |
} | |
public function endIncluded(): bool | |
{ | |
return match ($this) { | |
self::includeEnd, self::includeAll => true, | |
default => false, | |
}; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment