Code Duplication    Length = 24-24 lines in 2 locations

src/Config/XmlConfigFileLoader.php 1 location

@@ 65-88 (lines=24) @@
62
    /**
63
     * @inheritdoc
64
     */
65
    public function load(string $file, array $params): Config
66
    {
67
        $pshConfigNode = $this->loadXmlRoot($file);
68
        $this->configBuilder->start();
69
70
        $headers = $this->extractNodes(self::NODE_HEADER, $pshConfigNode);
71
72
        foreach ($headers as $header) {
73
            $this->configBuilder
74
                ->setHeader($header->nodeValue);
75
        }
76
77
        $this->setConfigData($file, $pshConfigNode);
78
79
        $environments = $this->extractNodes(self::NODE_ENVIRONMENT, $pshConfigNode);
80
81
        foreach ($environments as $node) {
82
            $this->configBuilder->start($node->getAttribute('name'));
83
            $this->setConfigData($file, $node);
84
        }
85
86
        return $this->configBuilder
87
            ->create($params);
88
    }
89
90
    /**
91
     * @param string $file

src/Config/YamlConfigFileLoader.php 1 location

@@ 65-88 (lines=24) @@
62
    /**
63
     * @inheritdoc
64
     */
65
    public function load(string $file, array $params): Config
66
    {
67
        $contents = $this->loadFileContents($file);
68
        $rawConfigData = $this->parseFileContents($contents);
69
70
        $this->configBuilder->start();
71
72
        $this->configBuilder
73
            ->setHeader(
74
                $this->extractData(self::KEY_HEADER, $rawConfigData, '')
75
            );
76
77
        $this->setConfigData($file, $rawConfigData);
78
79
        $environments = $this->extractData(self::KEY_ENVIRONMENTS, $rawConfigData, []);
80
81
        foreach ($environments as $name => $data) {
82
            $this->configBuilder->start($name);
83
            $this->setConfigData($file, $data);
84
        }
85
86
        return $this->configBuilder
87
            ->create($params);
88
    }
89
90
    /**
91
     * @param string $file