<commit_before><?php declare(strict_types=1);
/**
 * @author    <NAME> <<EMAIL>>
 * @copyright Copyright (c) 2015-2019, Darvin Studio
 * @link      https://www.darvin-studio.ru
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Darvin\AdminBundle\Menu;

/**
 * Menu item
 */
class Item
{
    /**
     * @var string
     */
    protected $name;

    /**
     * @var string|null
     */
    protected $indexTitle;

    /**
     * @var string|null
     */
    protected $indexUrl;

    /**
     * @var int|null
     */
    protected $position;

    /**
     * @var string|null
     */
    protected $associatedObject;

    /**
     * @var string|null
     */
    protected $parentName;

    /**
     * @var Item[]
     */
    protected $children;

    /**
     * @var int|null
     */
    protected $newObjectCount;

    /**
     * @var bool
     */
    protected $active;

    /**
     * @param string $name Name
     */
    public function __construct(string $name)
    {
        $this->name = $name;

        $this->children = [];
        $this->active   = false;
    }

    /**
     * @return bool
     */
    public function isSeparator(): bool
    {
        return null === $this->indexTitle && !$this->hasChildren();
    }

    /**
     * @return bool
     */
    public function isEmpty(): bool
    {
        return null === $this->indexUrl && !$this->hasChildren();
    }

    /**
     * @return bool
     */
    public function hasChildren(): bool
    {
        return !empty($this->children);
    }

    /**
     * @return bool
     */
    public function hasParent(): bool
    {
        return null !== $this->parentName;
    }

    /**<commit_msg>Add menu separators.<commit_after><?php declare(strict_types=1);
/**
 * @author    <NAME> <<EMAIL>>
 * @copyright Copyright (c) 2015-2019, <NAME>
 * @link      https://www.darvin-studio.ru
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Darvin\AdminBundle\Menu;

/**
 * Menu item
 */
class Item
{
    /**
     * @var string
     */
    protected $name;

    /**
     * @var string|null
     */
    protected $indexTitle;

    /**
     * @var string|null
     */
    protected $indexUrl;

    /**
     * @var int|null
     */
    protected $position;

    /**
     * @var string|null
     */
    protected $associatedObject;

    /**
     * @var string|null
     */
    protected $parentName;

    /**
     * @var Item[]
     */
    protected $children;

    /**
     * @var int|null
     */
    protected $newObjectCount;

    /**
     * @var bool
     */
    protected $active;

    /**
     * @param string $name Name
     */
    public function __construct(string $name)
    {
        $this->name = $name;

        $this->children = [];
        $this->active   = false;
    }

    /**
     * @return bool
     */
    public function isSeparator(): bool
    {
        return null === $this->indexTitle && !$this->hasChildren();
    }

    /**
     * @return bool
     */
    public function isEmpty(): bool
    {
        if (null === $this->indexTitle) {
            return true;
        }

        return null === $this->indexUrl && !$this->hasChildren();
    }

    /**
     * @return bool
     */
    public function hasChildren(): bool
    {
        return !empty($this->children);
    }

    /**
     * @return bool
     */
    public function hasParent(): bool
    {
        return null !== $this->parentName;
    }

    /**
{'fraction_non_alphanumeric': 0.15251396648044693, 'fraction_numerical': 0.005027932960893855, 'mean_word_length': 1.7273419649657273, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 29, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, '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': '1298221', 'n_tokens_mistral': 1114, 'n_tokens_neox': 1070, 'n_words': 254}