| @@ 83-98 (lines=16) @@ | ||
| 80 | $this->Items = $this->validateItems($match[2]); |
|
| 81 | } |
|
| 82 | ||
| 83 | if (!empty($match[3])) { |
|
| 84 | if ($match[4] === '' && $match[5] === '') { |
|
| 85 | throw new \SwaggerGen\Exception("Empty array range: '{$definition}'"); |
|
| 86 | } |
|
| 87 | ||
| 88 | $exclusiveMinimum = isset($match[3]) ? ($match[3] == '<') : null; |
|
| 89 | $this->minItems = $match[4] === '' ? null : intval($match[4]); |
|
| 90 | $this->maxItems = $match[5] === '' ? null : intval($match[5]); |
|
| 91 | $exclusiveMaximum = isset($match[6]) ? ($match[6] == '>') : null; |
|
| 92 | if ($this->minItems && $this->maxItems && $this->minItems > $this->maxItems) { |
|
| 93 | self::swap($this->minItems, $this->maxItems); |
|
| 94 | self::swap($exclusiveMinimum, $exclusiveMaximum); |
|
| 95 | } |
|
| 96 | $this->minItems = $this->minItems === null ? null : max(0, $exclusiveMinimum ? $this->minItems + 1 : $this->minItems); |
|
| 97 | $this->maxItems = $this->maxItems === null ? null : max(0, $exclusiveMaximum ? $this->maxItems - 1 : $this->maxItems); |
|
| 98 | } |
|
| 99 | } |
|
| 100 | ||
| 101 | /** |
|
| @@ 69-84 (lines=16) @@ | ||
| 66 | ||
| 67 | private function parseRange($definition, $match) |
|
| 68 | { |
|
| 69 | if (!empty($match[3])) { |
|
| 70 | if ($match[4] === '' && $match[5] === '') { |
|
| 71 | throw new \SwaggerGen\Exception("Empty object range: '{$definition}'"); |
|
| 72 | } |
|
| 73 | ||
| 74 | $exclusiveMinimum = isset($match[3]) ? ($match[3] == '<') : null; |
|
| 75 | $this->minProperties = $match[4] === '' ? null : intval($match[4]); |
|
| 76 | $this->maxProperties = $match[5] === '' ? null : intval($match[5]); |
|
| 77 | $exclusiveMaximum = isset($match[6]) ? ($match[6] == '>') : null; |
|
| 78 | if ($this->minProperties && $this->maxProperties && $this->minProperties > $this->maxProperties) { |
|
| 79 | self::swap($this->minProperties, $this->maxProperties); |
|
| 80 | self::swap($exclusiveMinimum, $exclusiveMaximum); |
|
| 81 | } |
|
| 82 | $this->minProperties = $this->minProperties === null ? null : max(0, $exclusiveMinimum ? $this->minProperties + 1 : $this->minProperties); |
|
| 83 | $this->maxProperties = $this->maxProperties === null ? null : max(0, $exclusiveMaximum ? $this->maxProperties - 1 : $this->maxProperties); |
|
| 84 | } |
|
| 85 | } |
|
| 86 | ||
| 87 | /** |
|