Code Duplication    Length = 13-13 lines in 2 locations

src/Api/Puli.php 2 locations

@@ 857-869 (lines=13) @@
854
    {
855
        $homeDir = self::parseHomeDirectory();
856
857
        if (null !== $homeDir) {
858
            Assert::fileExists($homeDir, 'Could not load Puli context: The home directory %s does not exist.');
859
            Assert::directory($homeDir, 'Could not load Puli context: The home directory %s is a file. Expected a directory.');
860
861
            // Create a storage without the factory manager
862
            $configStorage = new ConfigFileStorage($this->getStorage(), $this->getConfigFileSerializer());
863
            $configPath = Path::canonicalize($homeDir).'/config.json';
864
            $configFile = $configStorage->loadConfigFile($configPath, new DefaultConfig());
865
            $baseConfig = $configFile->getConfig();
866
        } else {
867
            $configFile = null;
868
            $baseConfig = new DefaultConfig();
869
        }
870
871
        $config = new EnvConfig($baseConfig);
872
@@ 903-915 (lines=13) @@
900
901
        $homeDir = self::parseHomeDirectory();
902
903
        if (null !== $homeDir) {
904
            Assert::fileExists($homeDir, 'Could not load Puli context: The home directory %s does not exist.');
905
            Assert::directory($homeDir, 'Could not load Puli context: The home directory %s is a file. Expected a directory.');
906
907
            // Create a storage without the factory manager
908
            $configStorage = new ConfigFileStorage($this->getStorage(), $this->getConfigFileSerializer());
909
            $configPath = Path::canonicalize($homeDir).'/config.json';
910
            $configFile = $configStorage->loadConfigFile($configPath, new DefaultConfig());
911
            $baseConfig = $configFile->getConfig();
912
        } else {
913
            $configFile = null;
914
            $baseConfig = new DefaultConfig();
915
        }
916
917
        // Create a storage without the factory manager
918
        $packageFileStorage = new PackageFileStorage($this->getStorage(), $this->getPackageFileSerializer());