<commit_before><?php
namespace Czim\CmsCore\Console\Commands;

use Czim\CmsCore\Contracts\Menu\MenuRepositoryInterface;
use Czim\CmsCore\Contracts\Modules\Data\MenuPresenceInterface;
use Illuminate\Console\Command;

class ShowMenu extends Command
{

    protected $signature = 'cms:menu:show 
        {--locale= : Show translation information for given locale}';

    protected $description = 'Show menu information';


    /**
     * Execute the console command.
     *
     * @param MenuRepositoryInterface $repository
     */
    public function handle(MenuRepositoryInterface $repository)
    {
        $this->setLocale();

        $repository->ignorePermission()->initialize();

        $groups = $repository->getMenuLayout();

        if (count($groups)) {

            $this->comment('Menu layout:');
            $this->info('');

            foreach ($groups as $key => $group) {

                $this->displaySingle($group, $key, 1);
            }
        }
    }

    /**
     * Sets locale if option is set.
     */
    protected function setLocale()
    {
        if ( ! ($locale = $this->option('locale'))) {
            return;
        }

        app()->setLocale($locale);
    }

    /**
     * @param MenuPresenceInterface $presence
     * @param string|null           $key
     * @param int                   $depth
     */
    protected function displaySingle(MenuPresenceInterface $presence, $key = null, $depth = 0)
    {
        $indent = str_repeat(' ', $depth * 2);

        $this->comment($indent . ucfirst($presence->type()) . ($key && ! is_numeric($key) ? " (key: {$key})" : null));

        if ($presence->label()) {
            $this->info($indent . 'Label       : ' . $presence->label());
        }

        if ($presence->translationKey()) {

            // Add a flag for currently undefined translation keys
            $isTranslated = $presence->label(true) !== $presence->label(false);

            $this->info(
                $indent . 'Transl. key : ' . $presence->translationKey()
                . ($isTranslated ? null : ' (' .  app()->getLocale() . ' unset)')
            );
        }

        if ($presence->action()) {
            $this->info($indent . 'Action      : ' . $presence->action());
        }

        if (count($presence->permissions())) {
            $this->info($indent . 'Permissions : ' . implode(', ', $presence->permissions()));
        }

        $children = $presence->children();

        if (count($children)) {

            $this->info($indent . 'Children :');
            $this->info('');

            foreach ($children as $key => $child) {

                $this->displaySingle($child, ! is_numeric($key) ? $key : null, $depth + 1);
            }
        }
        
        $this->info('');
    }

    /**
     * @param string $info
     * @param int    $indents
     */
    protected function infoIndent($info, $indents = 1)
    {
        $this->info(str_repeat(' ', $indents * 4) . $info);
    }

}
<commit_msg>Show menu command no longer shows layout keys<commit_after><?php
namespace Czim\CmsCore\Console\Commands;

use Czim\CmsCore\Contracts\Menu\MenuRepositoryInterface;
use Czim\CmsCore\Contracts\Modules\Data\MenuPresenceInterface;
use Illuminate\Console\Command;

class ShowMenu extends Command
{

    protected $signature = 'cms:menu:show 
        {--locale= : Show translation information for given locale}';

    protected $description = 'Show menu information';


    /**
     * Execute the console command.
     *
     * @param MenuRepositoryInterface $repository
     */
    public function handle(MenuRepositoryInterface $repository)
    {
        $this->setLocale();

        $repository->ignorePermission()->initialize();

        $groups = $repository->getMenuLayout();

        if (count($groups)) {

            $this->comment('Menu layout:');
            $this->info('');

            foreach ($groups as $key => $group) {

                $this->displaySingle($group, $key, 1);
            }
        }
    }

    /**
     * Sets locale if option is set.
     */
    protected function setLocale()
    {
        if ( ! ($locale = $this->option('locale'))) {
            return;
        }

        app()->setLocale($locale);
    }

    /**
     * @param MenuPresenceInterface $presence
     * @param string|null           $key
     * @param int                   $depth
     */
    protected function displaySingle(MenuPresenceInterface $presence, $key = null, $depth = 0)
    {
        $indent = str_repeat(' ', $depth * 2);

        $this->comment($indent . ucfirst($presence->type()));

        if ($presence->label()) {
            $this->info($indent . 'Label       : ' . $presence->label());
        }

        if ($presence->translationKey()) {

            // Add a flag for currently undefined translation keys
            $isTranslated = $presence->label(true) !== $presence->label(false);

            $this->info(
                $indent . 'Transl. key : ' . $presence->translationKey()
                . ($isTranslated ? null : ' (' .  app()->getLocale() . ' unset)')
            );
        }

        if ($presence->action()) {
            $this->info($indent . 'Action      : ' . $presence->action());
        }

        if (count($presence->permissions())) {
            $this->info($indent . 'Permissions : ' . implode(', ', $presence->permissions()));
        }

        $children = $presence->children();

        if (count($children)) {

            $this->info($indent . 'Children :');
            $this->info('');

            foreach ($children as $key => $child) {

                $this->displaySingle($child, ! is_numeric($key) ? $key : null, $depth + 1);
            }
        }
        
        $this->info('');
    }

    /**
     * @param string $info
     * @param int    $indents
     */
    protected function infoIndent($info, $indents = 1)
    {
        $this->info(str_repeat(' ', $indents * 4) . $info);
    }

}

{'fraction_non_alphanumeric': 0.16057902709981484, 'fraction_numerical': 0.0020198619760983, 'mean_word_length': 1.92133726647001, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 71, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3083600', 'n_tokens_mistral': 1717, 'n_tokens_neox': 1652, 'n_words': 342}