<commit_before><?php

/**
 * This class is used for building navGroups in admin
 *
 * @package     Nails
 * @subpackage  module-admin
 * @category    Helper
 * @author      Nails Dev Team
 * @link
 */

namespace Nails\Admin;

class Nav
{
    protected $label;
    protected $icon;
    protected $actions;

    // --------------------------------------------------------------------------

    /**
     * Construct the navGroup
     * @param string $label The label to give the navGroup
     * @param string $icon  The icon to give the navGroup
     */
    public function __construct($label = '', $icon = '')
    {
        $this->setLabel($label);
        $this->setIcon($icon);
        $this->actions = array();
    }

    // --------------------------------------------------------------------------

    /**
     * Set the navGroup's label
     * @return $this
     */
    public function setLabel($label = '')
    {
        $this->label = $label;
        return $this;
    }

    // --------------------------------------------------------------------------

    /**
     * Returns the navGroup's label
     * @return string
     */
    public function getLabel()
    {
        return $this->label;
    }

    // --------------------------------------------------------------------------

    /**
     * Set the navGroup's icon
     * @return string
     */
    public function setIcon($icon)
    {
        $this->icon = $icon;
        return $this;
    }

    // --------------------------------------------------------------------------

    /**
     * Returns the navGroup's icon
     * @return string
     */
    public function getIcon()
    {
        return $this->icon;
    }

    // --------------------------------------------------------------------------

    /**
     * Returns the navGroup's actions
     * @return string
     */
    public function getActions()
    {
        return $this->actions;
    }

    // --------------------------------------------------------------------------

    /**
     * Adds a new action to the navGroup. An action is menu item essentially.
     * @param string $label  The label to give the action
     * @param string $url    The url this action applies to
     * @param array  $alerts An array of alerts to have along side this action
     * @param mixed  $order  An optional order index, used to push menu items up and down the group
     */
    public function addAction($label, $url = 'index', $alerts = array(), $order = null)
    {
        $this->actions[$url]         = new \stdClass();
        $this->actions[$url]->label  = $label;
        $this->actions[$url]->alerts = $alerts;

        if (is_null($order)) {

            $this->actions[$url]->order = count($this->actions);
<commit_msg>Allowing nav alerts to be passed as is<commit_after><?php

/**
 * This class is used for building navGroups in admin
 *
 * @package     Nails
 * @subpackage  module-admin
 * @category    Helper
 * @author      Nails Dev Team
 * @link
 */

namespace Nails\Admin;

class Nav
{
    protected $label;
    protected $icon;
    protected $actions;

    // --------------------------------------------------------------------------

    /**
     * Construct the navGroup
     * @param string $label The label to give the navGroup
     * @param string $icon  The icon to give the navGroup
     */
    public function __construct($label = '', $icon = '')
    {
        $this->setLabel($label);
        $this->setIcon($icon);
        $this->actions = array();
    }

    // --------------------------------------------------------------------------

    /**
     * Set the navGroup's label
     * @return $this
     */
    public function setLabel($label = '')
    {
        $this->label = $label;
        return $this;
    }

    // --------------------------------------------------------------------------

    /**
     * Returns the navGroup's label
     * @return string
     */
    public function getLabel()
    {
        return $this->label;
    }

    // --------------------------------------------------------------------------

    /**
     * Set the navGroup's icon
     * @return string
     */
    public function setIcon($icon)
    {
        $this->icon = $icon;
        return $this;
    }

    // --------------------------------------------------------------------------

    /**
     * Returns the navGroup's icon
     * @return string
     */
    public function getIcon()
    {
        return $this->icon;
    }

    // --------------------------------------------------------------------------

    /**
     * Returns the navGroup's actions
     * @return string
     */
    public function getActions()
    {
        return $this->actions;
    }

    // --------------------------------------------------------------------------

    /**
     * Adds a new action to the navGroup. An action is menu item essentially.
     * @param string $label  The label to give the action
     * @param string $url    The url this action applies to
     * @param array  $alerts An array of alerts to have along side this action
     * @param mixed  $order  An optional order index, used to push menu items up and down the group
     */
    public function addAction($label, $url = 'index', $alerts = array(), $order = null)
    {
        $this->actions[$url]         = new \stdClass();
        $this->actions[$url]->label  = $label;
        $this->actions[$url]->alerts = !is_array($alerts) ? array($alerts) : $alerts;

        if (is_null($order)) {

            $this->actions[$url]->order = count($this->actions);

{'fraction_non_alphanumeric': 0.2892799425390555, 'fraction_numerical': 0.0, 'mean_word_length': 1.11787072243346, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 35, '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': '4385337', 'n_tokens_mistral': 1379, 'n_tokens_neox': 1333, 'n_words': 409}