-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Convert RETSVersion to enum and only accept in the constructor. This …
…ensures we initialize our parsers with the correct version and avoid various bugs.
- Loading branch information
Showing
13 changed files
with
115 additions
and
265 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace PHRETS\Enums; | ||
|
||
enum RETSVersion: string | ||
{ | ||
case VERSION_1_5 = '1.5'; | ||
case VERSION_1_7 = '1.7'; | ||
case VERSION_1_7_1 = '1.7.1'; | ||
case VERSION_1_7_2 = '1.7.2'; | ||
case VERSION_1_8 = '1.8'; | ||
|
||
public function asHeader(): string | ||
{ | ||
return 'RETS/' . $this->value; | ||
} | ||
|
||
public function isAtLeast(self $version): bool | ||
{ | ||
return version_compare($this->value, $version->value) >= 0; | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
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
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
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
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.