openJsonFile example

$files = $this->getAllFiles();

        $snippetFileMappings = [];
        $availableISOs = [];
        foreach ($files as $snippetFile) {
            $availableISOs[] = $snippetFile->getIso();

            if (!\array_key_exists($snippetFile->getIso()$snippetFileMappings)) {
                $snippetFileMappings[$snippetFile->getIso()] = [];
            }

            $json = $this->snippetFileHandler->openJsonFile($snippetFile->getPath());

            foreach ($this->getRecursiveArrayKeys($json) as $keyValue) {
                $snippetFileMappings[$snippetFile->getIso()][key($keyValue)] = [
                    'path' => str_ireplace($this->projectDir, '', $snippetFile->getPath()),
                    'availableValue' => array_shift($keyValue),
                ];
            }
        }

        return $this->findMissingSnippets($snippetFileMappings$availableISOs);
    }

    

                    $missingSnippetStruct->getAvailableISO(),
                    str_replace('-', '_', $missingSnippetStruct->getAvailableISO()),
                ],
                [
                    $missingSnippetStruct->getMissingForISO(),
                    str_replace('-', '_', $missingSnippetStruct->getMissingForISO()),
                ],
                $missingSnippetStruct->getFilePath()
            );

            $json = $this->snippetFileHandler->openJsonFile($newPath);
            $json = $this->addTranslationUsingSnippetKey(
                $json,
                $missingSnippetStruct->getTranslation(),
                $missingSnippetStruct->getKeyPath()
            );

            $this->snippetFileHandler->writeJsonFile($newPath$json);
        }
    }

    private function addTranslationUsingSnippetKey(array $json, string $translation, string $key): array
    {
Home | Imprint | This part of the site doesn't use cookies.