<commit_before><?php
namespace DlcCategory\Form;

use DlcCategory\Form\BaseForm;
use DlcCategory\Service\Category as CategoryService;
use Zend\Form\FormInterface;

class EditCategory extends BaseForm
{
    public function init()
    {
        parent::init();
        
        $this->setLabel('Edit category');
    }
    
    public function bind($category, $flags = FormInterface::VALUES_NORMALIZED)
    {
        parent::bind($category, $flags);
        
        $node = $this->getServiceLocator()
                     ->get('dlccategory_category_service')
                     ->getNestedSetManager()
                     ->wrapNode($category);
        
        if ($node->isRoot()) {
            $insertionAs = CategoryService::ROOT_NODE;
            $insertionOf = '';
        } elseif ($node->hasNextSibling()) {
            $insertionAs = CategoryService::PREV_SIBILING_OF;
            $insertionOf = $node->getNextSibiling()->getNode()->getId();
        } elseif ($node->hasPrevSibling()) {
            $insertionAs = CategoryService::NEXT_SIBILING_OF;
            $insertionOf = $node->getPrivSibiling()->getNode()->getId();
        } elseif ($node->hasParent()) {
            $insertionAs = CategoryService::FIRST_CHILD_OF;
            $insertionOf = $node->getParent()->getNode()->getId();
        } else {
            $insertionAs = '';
            $insertionOf = '';
        }
        
        $this->byName['category']->get('insertion-method')->setValue($insertionAs);
        $this->byName['category']->get('insertion-point')->setValue($insertionOf);
    }
}<commit_msg>Fix typo in edit form<commit_after><?php
namespace DlcCategory\Form;

use DlcCategory\Form\BaseForm;
use DlcCategory\Service\Category as CategoryService;
use Zend\Form\FormInterface;

class EditCategory extends BaseForm
{
    public function init()
    {
        parent::init();
        
        $this->setLabel('Edit category');
    }
    
    public function bind($category, $flags = FormInterface::VALUES_NORMALIZED)
    {
        parent::bind($category, $flags);
        
        $node = $this->getServiceLocator()
                     ->get('dlccategory_category_service')
                     ->getNestedSetManager()
                     ->wrapNode($category);
        
        if ($node->isRoot()) {
            $insertionAs = CategoryService::ROOT_NODE;
            $insertionOf = '';
        } elseif ($node->hasNextSibling()) {
            $insertionAs = CategoryService::PREV_SIBILING_OF;
            $insertionOf = $node->getNextSibling()->getNode()->getId();
        } elseif ($node->hasPrevSibling()) {
            $insertionAs = CategoryService::NEXT_SIBILING_OF;
            $insertionOf = $node->getPrivSibiling()->getNode()->getId();
        } elseif ($node->hasParent()) {
            $insertionAs = CategoryService::FIRST_CHILD_OF;
            $insertionOf = $node->getParent()->getNode()->getId();
        } else {
            $insertionAs = '';
            $insertionOf = '';
        }
        
        $this->byName['category']->get('insertion-method')->setValue($insertionAs);
        $this->byName['category']->get('insertion-point')->setValue($insertionOf);
    }
}
{'fraction_non_alphanumeric': 0.14929133858267715, 'fraction_numerical': 0.0, 'mean_word_length': 2.3608465608465607, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 51, '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': '2749077', 'n_tokens_mistral': 889, 'n_tokens_neox': 908, 'n_words': 126}