<commit_before><?php

namespace PHPCD\View;

use PHPCD\Element\ObjectElementInfo\PropertyInfoCollection;
use PHPCD\Element\ObjectElementInfo\MethodInfoCollection;
use PHPCD\Element\FunctionInfo\FunctionCollection;
use PHPCD\Element\ConstantInfo\ConstantInfoCollection;
use PHPCD\Element\ClassInfo\ClassInfo;
use PHPCD\Element\ObjectElementInfo\PropertyInfo;
use PHPCD\Element\ConstantInfo\ConstantInfo;
use PHPCD\Element\FunctionInfo\FunctionInfo;
use PHPCD\Element\ObjectElementInfo\ObjectElementInfo;
use PHPCD\PHPFileInfo\PHPFileInfo;

class VimMenuItemView implements View
{
    public function renderConstantInfoCollection(ConstantInfoCollection $collection)
    {
        $visitor = new VimMenuRenderConstantVisitor();
        $collection->accept($visitor);
        return $visitor->getOutput();
    }

    public function renderClassInfo(ClassInfo $classInfo)
    {
        $out = new VimMenuItem();
        $out->setWord($classInfo->getName());
        $out->setAbbr('');
        $out->setKind('');
        $out->setInfo('');

        return $out->render();
    }

    public function renderMethodCollection(MethodInfoCollection $collection)
    {
        $visitor = new VimMenuRenderMethodVisitor();
        $collection->accept($visitor);
        return $visitor->getOutput();
    }

    public function renderFunctionCollection(FunctionCollection $collection)
    {
        $visitor = new VimMenuRenderFunctionVisitor();
        $collection->accept($visitor);
        return $visitor->getOutput();
    }

    public function renderPropertyCollection(PropertyInfoCollection $collection)
    {
        $visitor = new VimMenuRenderPropertyVisitor();
        $collection->accept($visitor);
        return $visitor->getOutput();
    }

    public function renderPHPFileInfo(PHPFileInfo $fileInfo)
    {
        return [
            'namespace' => $fileInfo->getNamespace(),
            'class' => $fileInfo->getClassName(),
            'imports' => $fileInfo->getImports(),
        ];
    }
}
<commit_msg>Yet another deduplication in VimMenuItemView<commit_after><?php

namespace PHPCD\View;

use PHPCD\View\VimMenuRenderAbstractVisitor;
use PHPCD\Collection\Collection;
use PHPCD\Element\ObjectElementInfo\PropertyInfoCollection;
use PHPCD\Element\ObjectElementInfo\MethodInfoCollection;
use PHPCD\Element\FunctionInfo\FunctionCollection;
use PHPCD\Element\ConstantInfo\ConstantInfoCollection;
use PHPCD\Element\ClassInfo\ClassInfo;
use PHPCD\Element\ObjectElementInfo\PropertyInfo;
use PHPCD\Element\ConstantInfo\ConstantInfo;
use PHPCD\Element\FunctionInfo\FunctionInfo;
use PHPCD\Element\ObjectElementInfo\ObjectElementInfo;
use PHPCD\PHPFileInfo\PHPFileInfo;

class VimMenuItemView implements View
{
    public function renderConstantInfoCollection(ConstantInfoCollection $collection)
    {
        $visitor = new VimMenuRenderConstantVisitor();

        return $this->renderCollectionWithVisitor($collection, $visitor);
    }

    public function renderClassInfo(ClassInfo $classInfo)
    {
        $out = new VimMenuItem();
        $out->setWord($classInfo->getName());
        $out->setAbbr('');
        $out->setKind('');
        $out->setInfo('');

        return $out->render();
    }

    public function renderMethodCollection(MethodInfoCollection $collection)
    {
        $visitor = new VimMenuRenderMethodVisitor();

        return $this->renderCollectionWithVisitor($collection, $visitor);
    }

    public function renderFunctionCollection(FunctionCollection $collection)
    {
        $visitor = new VimMenuRenderFunctionVisitor();

        return $this->renderCollectionWithVisitor($collection, $visitor);
    }

    public function renderPropertyCollection(PropertyInfoCollection $collection)
    {
        $visitor = new VimMenuRenderPropertyVisitor();

        return $this->renderCollectionWithVisitor($collection, $visitor);
    }

    public function renderPHPFileInfo(PHPFileInfo $fileInfo)
    {
        return [
            'namespace' => $fileInfo->getNamespace(),
            'class' => $fileInfo->getClassName(),
            'imports' => $fileInfo->getImports(),
        ];
    }

    private function renderCollectionWithVisitor(Collection $collection, VimMenuRenderAbstractVisitor $visitor)
    {
        $collection->accept($visitor);

        return $visitor->getOutput();
    }
}

{'fraction_non_alphanumeric': 0.10823311748381129, 'fraction_numerical': 0.0, 'mean_word_length': 3.79490022172949, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 41, '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': '6932362', 'n_tokens_mistral': 1183, 'n_tokens_neox': 1140, 'n_words': 199}