| @@ 96-114 (lines=19) @@ | ||
| 93 | } |
|
| 94 | } |
|
| 95 | ||
| 96 | private function parseRange($definition, $match) |
|
| 97 | { |
|
| 98 | if (!empty($match[3])) { |
|
| 99 | if ($match[4] === '' && $match[5] === '') { |
|
| 100 | throw new \SwaggerGen\Exception("Empty array range: '{$definition}'"); |
|
| 101 | } |
|
| 102 | ||
| 103 | $exclusiveMinimum = isset($match[3]) ? ($match[3] == '<') : null; |
|
| 104 | $this->minItems = $match[4] === '' ? null : intval($match[4]); |
|
| 105 | $this->maxItems = $match[5] === '' ? null : intval($match[5]); |
|
| 106 | $exclusiveMaximum = isset($match[6]) ? ($match[6] == '>') : null; |
|
| 107 | if ($this->minItems && $this->maxItems && $this->minItems > $this->maxItems) { |
|
| 108 | self::swap($this->minItems, $this->maxItems); |
|
| 109 | self::swap($exclusiveMinimum, $exclusiveMaximum); |
|
| 110 | } |
|
| 111 | $this->minItems = $this->minItems === null ? null : max(0, $exclusiveMinimum ? $this->minItems + 1 : $this->minItems); |
|
| 112 | $this->maxItems = $this->maxItems === null ? null : max(0, $exclusiveMaximum ? $this->maxItems - 1 : $this->maxItems); |
|
| 113 | } |
|
| 114 | } |
|
| 115 | ||
| 116 | /** |
|
| 117 | * @param string $command The comment command |
|
| @@ 69-87 (lines=19) @@ | ||
| 66 | } |
|
| 67 | } |
|
| 68 | ||
| 69 | private function parseRange($definition, $match) |
|
| 70 | { |
|
| 71 | if (!empty($match[3])) { |
|
| 72 | if ($match[4] === '' && $match[5] === '') { |
|
| 73 | throw new \SwaggerGen\Exception("Empty object range: '{$definition}'"); |
|
| 74 | } |
|
| 75 | ||
| 76 | $exclusiveMinimum = isset($match[3]) ? ($match[3] == '<') : null; |
|
| 77 | $this->minProperties = $match[4] === '' ? null : intval($match[4]); |
|
| 78 | $this->maxProperties = $match[5] === '' ? null : intval($match[5]); |
|
| 79 | $exclusiveMaximum = isset($match[6]) ? ($match[6] == '>') : null; |
|
| 80 | if ($this->minProperties && $this->maxProperties && $this->minProperties > $this->maxProperties) { |
|
| 81 | self::swap($this->minProperties, $this->maxProperties); |
|
| 82 | self::swap($exclusiveMinimum, $exclusiveMaximum); |
|
| 83 | } |
|
| 84 | $this->minProperties = $this->minProperties === null ? null : max(0, $exclusiveMinimum ? $this->minProperties + 1 : $this->minProperties); |
|
| 85 | $this->maxProperties = $this->maxProperties === null ? null : max(0, $exclusiveMaximum ? $this->maxProperties - 1 : $this->maxProperties); |
|
| 86 | } |
|
| 87 | } |
|
| 88 | ||
| 89 | /** |
|
| 90 | * @param string $command The comment command |
|