Code Duplication    Length = 22-22 lines in 2 locations

src/Api/Container.php 2 locations

@@ 912-933 (lines=22) @@
909
     *
910
     * @return JsonConverter The module file converter.
911
     */
912
    public function getLegacyModuleFileConverter()
913
    {
914
        if (!$this->legacyModuleFileConverter) {
915
            $this->legacyModuleFileConverter = $this->createValidatingConverter(
916
                new MigratingConverter(
917
                    $this->getModuleFileConverter(),
918
                    ModuleFileConverter::VERSION,
919
                    $this->getModuleFileMigrationManager()
920
                ),
921
                function (stdClass $jsonData) {
922
                    if (isset($jsonData->{'$schema'})) {
923
                        return $jsonData->{'$schema'};
924
                    }
925
926
                    // BC with 1.0
927
                    return 'http://puli.io/schema/1.0/manager/module';
928
                }
929
            );
930
        }
931
932
        return $this->legacyModuleFileConverter;
933
    }
934
935
    /**
936
     * Returns the module file converter.
@@ 956-977 (lines=22) @@
953
     *
954
     * @return JsonConverter The module file converter.
955
     */
956
    public function getLegacyRootModuleFileConverter()
957
    {
958
        if (!$this->legacyRootModuleFileConverter) {
959
            $this->legacyRootModuleFileConverter = $this->createValidatingConverter(
960
                new MigratingConverter(
961
                    $this->getRootModuleFileConverter(),
962
                    RootModuleFileConverter::VERSION,
963
                    $this->getModuleFileMigrationManager()
964
                ),
965
                function (stdClass $jsonData) {
966
                    if (isset($jsonData->{'$schema'})) {
967
                        return $jsonData->{'$schema'};
968
                    }
969
970
                    // BC with 1.0
971
                    return 'http://puli.io/schema/1.0/manager/module';
972
                }
973
            );
974
        }
975
976
        return $this->legacyRootModuleFileConverter;
977
    }
978
979
    /**
980
     * Returns the JSON encoder.