Code Duplication    Length = 15-15 lines in 2 locations

src/Handlers/OpenApiHandler.php 1 location

@@ 320-334 (lines=15) @@
317
        return rtrim(str_replace($baseUrl, '', $basePath), '/');
318
    }
319
320
    private function getLongestCommonSubstring($path1, $path2)
321
    {
322
        if ($path1 === null) {
323
            return $path2;
324
        }
325
        $commonSubstring = '';
326
        $shortest = min(strlen($path1), strlen($path2));
327
        for ($i = 0; $i <= $shortest; ++$i) {
328
            if (substr($path1, 0, $i) !== substr($path2, 0, $i)) {
329
                break;
330
            }
331
            $commonSubstring = substr($path1, 0, $i);
332
        }
333
        return $commonSubstring;
334
    }
335
336
    /**
337
     * Create array with params for specified handler

src/Handlers/SwaggerHandler.php 1 location

@@ 263-277 (lines=15) @@
260
        return rtrim(str_replace($baseUrl, '', $basePath), '/');
261
    }
262
263
    private function getLongestCommonSubstring($path1, $path2)
264
    {
265
        if ($path1 === null) {
266
            return $path2;
267
        }
268
        $commonSubstring = '';
269
        $shortest = min(strlen($path1), strlen($path2));
270
        for ($i = 0; $i <= $shortest; ++$i) {
271
            if (substr($path1, 0, $i) !== substr($path2, 0, $i)) {
272
                break;
273
            }
274
            $commonSubstring = substr($path1, 0, $i);
275
        }
276
        return $commonSubstring;
277
    }
278
279
    /**
280
     * Create array with params for specified handler