Code Duplication    Length = 17-17 lines in 2 locations

SwaggerGen/Swagger/Type/IntegerType.php 1 location

@@ 58-74 (lines=17) @@
55
		$this->format = self::$formats[$type];
56
	}
57
58
	private function parseRange($definition, $match)
59
	{
60
		if (!empty($match[2])) {
61
			if ($match[3] === '' && $match[4] === '') {
62
				throw new \SwaggerGen\Exception("Empty integer range: '{$definition}'");
63
			}
64
65
			$this->exclusiveMinimum = isset($match[2]) ? ($match[2] == '<') : null;
66
			$this->minimum = $match[3] === '' ? null : intval($match[3]);
67
			$this->maximum = $match[4] === '' ? null : intval($match[4]);
68
			$this->exclusiveMaximum = isset($match[5]) ? ($match[5] == '>') : null;
69
			if ($this->minimum && $this->maximum && $this->minimum > $this->maximum) {
70
				self::swap($this->minimum, $this->maximum);
71
				self::swap($this->exclusiveMinimum, $this->exclusiveMaximum);
72
			}
73
		}
74
	}
75
76
	private function parseDefault($definition, $match)
77
	{

SwaggerGen/Swagger/Type/NumberType.php 1 location

@@ 52-68 (lines=17) @@
49
		$this->format = self::$formats[strtolower($match[1])];
50
	}
51
52
	private function parseRange($definition, $match)
53
	{
54
		if (!empty($match[2])) {
55
			if ($match[3] === '' && $match[4] === '') {
56
				throw new \SwaggerGen\Exception("Empty number range: '{$definition}'");
57
			}
58
59
			$this->exclusiveMinimum = isset($match[2]) ? ($match[2] == '<') : null;
60
			$this->minimum = $match[3] === '' ? null : doubleval($match[3]);
61
			$this->maximum = $match[4] === '' ? null : doubleval($match[4]);
62
			$this->exclusiveMaximum = isset($match[5]) ? ($match[5] == '>') : null;
63
			if ($this->minimum && $this->maximum && $this->minimum > $this->maximum) {
64
				self::swap($this->minimum, $this->maximum);
65
				self::swap($this->exclusiveMinimum, $this->exclusiveMaximum);
66
			}
67
		}
68
	}
69
70
	private function parseDefault($definition, $match)
71
	{