Code Duplication    Length = 14-18 lines in 2 locations

src/Phinx/Config/Config.php 2 locations

@@ 64-77 (lines=14) @@
61
     *
62
     * @return \Phinx\Config\Config
63
     */
64
    public static function fromYaml($configFilePath)
65
    {
66
        $configFile = file_get_contents($configFilePath);
67
        $configArray = Yaml::parse($configFile);
68
69
        if (!is_array($configArray)) {
70
            throw new RuntimeException(sprintf(
71
                'File \'%s\' must be valid YAML',
72
                $configFilePath
73
            ));
74
        }
75
76
        return new static($configArray, $configFilePath);
77
    }
78
79
    /**
80
     * Create a new instance of the config class using a JSON file path.
@@ 114-131 (lines=18) @@
111
     *
112
     * @return \Phinx\Config\Config
113
     */
114
    public static function fromPhp($configFilePath)
115
    {
116
        ob_start();
117
        /** @noinspection PhpIncludeInspection */
118
        $configArray = include($configFilePath);
119
120
        // Hide console output
121
        ob_end_clean();
122
123
        if (!is_array($configArray)) {
124
            throw new RuntimeException(sprintf(
125
                'PHP file \'%s\' must return an array',
126
                $configFilePath
127
            ));
128
        }
129
130
        return new static($configArray, $configFilePath);
131
    }
132
133
    /**
134
     * @inheritDoc