Code Duplication    Length = 22-22 lines in 2 locations

src/Api/Container.php 2 locations

@@ 893-914 (lines=22) @@
890
     *
891
     * @return JsonConverter The module file converter.
892
     */
893
    public function getLegacyModuleFileConverter()
894
    {
895
        if (!$this->legacyModuleFileConverter) {
896
            $this->legacyModuleFileConverter = $this->createValidatingConverter(
897
                new MigratingConverter(
898
                    $this->getModuleFileConverter(),
899
                    ModuleFileConverter::VERSION,
900
                    $this->getModuleFileMigrationManager()
901
                ),
902
                function (stdClass $jsonData) {
903
                    if (isset($jsonData->{'$schema'})) {
904
                        return $jsonData->{'$schema'};
905
                    }
906
907
                    // BC with 1.0
908
                    return 'http://puli.io/schema/1.0/manager/module';
909
                }
910
            );
911
        }
912
913
        return $this->legacyModuleFileConverter;
914
    }
915
916
    /**
917
     * Returns the module file converter.
@@ 937-958 (lines=22) @@
934
     *
935
     * @return JsonConverter The module file converter.
936
     */
937
    public function getLegacyRootModuleFileConverter()
938
    {
939
        if (!$this->legacyRootModuleFileConverter) {
940
            $this->legacyRootModuleFileConverter = $this->createValidatingConverter(
941
                new MigratingConverter(
942
                    $this->getRootModuleFileConverter(),
943
                    RootModuleFileConverter::VERSION,
944
                    $this->getModuleFileMigrationManager()
945
                ),
946
                function (stdClass $jsonData) {
947
                    if (isset($jsonData->{'$schema'})) {
948
                        return $jsonData->{'$schema'};
949
                    }
950
951
                    // BC with 1.0
952
                    return 'http://puli.io/schema/1.0/manager/module';
953
                }
954
            );
955
        }
956
957
        return $this->legacyRootModuleFileConverter;
958
    }
959
960
    /**
961
     * Returns the JSON encoder.