Code Duplication    Length = 22-22 lines in 2 locations

src/Api/Container.php 2 locations

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