Code Duplication    Length = 3-3 lines in 2 locations

src/Jms/PathGenerator/Psr4PathGenerator.php 1 location

@@ 18-20 (lines=3) @@
15
            $pos = strpos($ns, $namespace);
16
17
            if ($pos === 0) {
18
                if (!is_dir($dir) && !mkdir($dir, 0777, true)) {
19
                    throw new PathGeneratorException("Can't create the folder '$dir'");
20
                }
21
                $f = trim(strtr(substr($ns, strlen($namespace)), "\\/", ".."), ".");
22
                return $dir . "/" . $f . ".yml";
23
            }

src/Php/PathGenerator/Psr4PathGenerator.php 1 location

@@ 17-19 (lines=3) @@
14
            if (strpos(trim($php->getNamespaceName()) . "\\", $namespace) === 0) {
15
                $d = strtr(substr($php->getNamespaceName(), strlen($namespace)), "\\", "/");
16
                $dir = rtrim($dir, "/") . "/" . $d;
17
                if (!is_dir($dir) && !mkdir($dir, 0777, true)) {
18
                    throw new PathGeneratorException("Can't create the '$dir' directory");
19
                }
20
21
                return rtrim($dir, "/") . "/" . $php->getName() . ".php";
22
            }