Code Duplication    Length = 15-16 lines in 2 locations

src/Document/OperationObject.php 2 locations

@@ 135-149 (lines=15) @@
132
     *
133
     * @return string
134
     */
135
    public function createParameterPointer($parameterName)
136
    {
137
        foreach ($this->definition->parameters as $i => $paramDefinition) {
138
            if ($paramDefinition->name === $parameterName) {
139
                return '/' . implode('/', [
140
                    'paths',
141
                    str_replace(['~', '/'], ['~0', '~1'], $this->getPath()),
142
                    $this->getMethod(),
143
                    'parameters',
144
                    $i
145
                ]);
146
            }
147
        }
148
        throw new \InvalidArgumentException("Parameter '$parameterName' not in document");
149
    }
150
151
    /**
152
     * @param string $parameterName
@@ 156-171 (lines=16) @@
153
     *
154
     * @return string
155
     */
156
    public function createParameterSchemaPointer($parameterName)
157
    {
158
        foreach ($this->definition->{'x-request-schema'}->properties as $propertyName => $schema) {
159
            if ($propertyName === $parameterName) {
160
                return '/' . implode('/', [
161
                    'paths',
162
                    str_replace(['~', '/'], ['~0', '~1'], $this->getPath()),
163
                    $this->getMethod(),
164
                    'x-request-schema',
165
                    'properties',
166
                    $propertyName
167
                ]);
168
            }
169
        }
170
        throw new \InvalidArgumentException("Parameter '$parameterName' not in document");
171
    }
172
173
    /**
174
     * @return object