-
-
Save IMSoP/47488b87412ae4e2b1719d7e3a818c7d to your computer and use it in GitHub Desktop.
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 INCLUDE_NONE(false, false); | |
case INCLUDE_START(true, false); | |
case INCLUDE_END(false, true); | |
case INCLUDE_ALL(true, true); | |
protected bool $startIncluded; | |
protected bool $endIncluded; | |
private function __construct($startIncluded, $endIncluded) | |
{ | |
$this->startIncluded = $startIncluded; | |
$this->endIncluded = $endIncluded; | |
} | |
public function startIncluded(): bool | |
{ | |
return $this->startIncluded; | |
} | |
public function endIncluded(): bool | |
{ | |
return $this->endIncluded; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Example based on this blog post: https://stitcher.io/blog/enums-without-enums