*/ class Tar { public static function getComposerJson(string $pathToArchive): ?string { $phar = new \PharData($pathToArchive); if (!$phar->valid()) { return null; } return self::extractComposerJsonFromFolder($phar); } /** * @throws \RuntimeException */ private static function extractComposerJsonFromFolder(\PharData $phar): string { if (isset($phar['composer.json'])) { return $phar['composer.json']->getContent(); } $topLevelPaths = []; foreach ($phar as $folderFile) { $name = $folderFile->getBasename(); if ($folderFile->isDir()) { $topLevelPaths[$name] = true; if (\count($topLevelPaths) > 1) { throw new \RuntimeException('Archive has more than one top level directories, and no composer.json was found on the top level, so it\'s an invalid archive. Top level paths found were: '.implode(',', array_keys($topLevelPaths))); } } } $composerJsonPath = key($topLevelPaths).'/composer.json'; if ($topLevelPaths && isset($phar[$composerJsonPath])) { return $phar[$composerJsonPath]->getContent(); } throw new \RuntimeException('No composer.json found either at the top level or within the topmost directory'); } } __halt_compiler();----SIGNATURE:----zeYiTJUJP+KdGsMMIqr0aVFg3g5HGnoVUK/q7qtuI9JksXdeQqaHgJg/+LNDm4bVWdzqkvL4EThIwwsw/xPspf3ubsFrzopJ6158UVRU8FAaDrN2io4o/GZqBsBdLmg35swcCibtedsqpRQ82x47jz3lSGybwAxpGQcjihtvemMhWE2WWLQQkWyNtbXWmBFTBNxQfafzPyOvjRmcKEF/lz4rhOjuE3rrM9FxLNbar+RRFzpzFXuqiGmtdwxj9LWvSZcppD2iPLKqWe/R1UU//AxlQhiVk5Gu4hmd8IdUjkAg8R2f/quBN+kz+UeT6GQetldlLIAyr/Khqbt+z8Fuj7NYg23zyZFirnNLaZi5E+nay0m9bGC6c5lQnrFNgfT6z2duaS+zAOx4l2mgao0TzTpjVgWrXUjt3PjME8vbpv+Ft775LL7oImxuU/EtsKGtpt557oVGlNc3AcAS54dNPlFu0fHoGCBnbIHrbCIwGuWxLg8ophlr+373AZAeIWygn1+0pP92lHOCx+GOdngNNJZzMydAPAboxvPrxlxTiVkb9Cml08hbqq1xOuQLD8eWLSgnZ0X3GixXgKupYfOKsCdOL3Ki2Od+DlqQw6A6u9t68fmzBy8r/offWqEGD2UOGuFvkgNBhY3TWPM8qnfzq98XsKQWg/OVupkyvXuUUr8=----ATTACHMENT:----NTUxNDM2MDUzODA5Mjc2IDU2MTc0MTQyNjU4NDgxIDEzNjQyMTk2NTE1ODA4NTk=