| @@ -14,8 +14,11 @@ | ||
| 14 | 14 | * performing immutable process ( creating new instances ) |
| 15 | 15 | * we will see if we need to extend collection as time goes on |
| 16 | 16 | */ |
| 17 | 17 | class Variables_Collection extends Collection { |
| 18 | + const FORMAT_VERSION_V1 = 1; | |
| 19 | + const FORMAT_VERSION_V2 = 2; | |
| 20 | + const TOTAL_VARIABLES_COUNT = 100; | |
| 18 | 21 | |
| 19 | 22 | private int $watermark; |
| 20 | 23 | |
| 21 | 24 | private int $version; |
| @@ -24,9 +27,9 @@ | ||
| 24 | 27 | parent::__construct(); |
| 25 | 28 | |
| 26 | 29 | $this->items = $items; |
| 27 | 30 | $this->watermark = $watermark; |
| 28 | - $this->version = $version ?? Constants::FORMAT_VERSION_V1; | |
| 31 | + $this->version = $version ?? self::FORMAT_VERSION_V1; | |
| 29 | 32 | } |
| 30 | 33 | |
| 31 | 34 | public static function hydrate( array $record ): self { |
| 32 | 35 | $variables = []; |
| @@ -72,9 +75,9 @@ | ||
| 72 | 75 | public static function default(): self { |
| 73 | 76 | return new self( |
| 74 | 77 | [], |
| 75 | 78 | 0, |
| 76 | - Constants::FORMAT_VERSION_V1 | |
| 79 | + self::FORMAT_VERSION_V1 | |
| 77 | 80 | ); |
| 78 | 81 | } |
| 79 | 82 | |
| 80 | 83 | public function watermark(): int { |
| @@ -140,9 +143,9 @@ | ||
| 140 | 143 | ++$active_count; |
| 141 | 144 | } |
| 142 | 145 | } |
| 143 | 146 | |
| 144 | - if ( Constants::TOTAL_VARIABLES_COUNT <= $active_count ) { | |
| 147 | + if ( self::TOTAL_VARIABLES_COUNT <= $active_count ) { | |
| 145 | 148 | throw new VariablesLimitReached( 'Total variables count limit reached' ); |
| 146 | 149 | } |
| 147 | 150 | } |
| 148 | 151 | |