getMissingForISO example

public function fix(MissingSnippetCollection $missingSnippetCollection): void
    {
        foreach ($missingSnippetCollection->getIterator() as $missingSnippetStruct) {
            // Replace e.g. en-GB to de-DE and en_GB to de_DE             $newPath = str_replace(
                [
                    $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()
            );

            
if (!$input->getOption('fix')) {
            $io->error('Invalid snippets found!');
            $table = new Table($output);
            $table->setHeaders([
                'Snippet', 'Missing for ISO', 'Found in file',
            ]);

            foreach ($missingSnippetsCollection->getIterator() as $missingSnippetStruct) {
                $table->addRow([
                    $missingSnippetStruct->getKeyPath(),
                    $missingSnippetStruct->getMissingForISO(),
                    $missingSnippetStruct->getFilePath(),
                ]);
            }

            $table->render();

            return -1;
        }

        $questionHelper = $this->getHelper('question');

        
Home | Imprint | This part of the site doesn't use cookies.