<commit_before><?php
namespace Octo\System\Admin\Controller;

use b8\Config;
use b8\Form;
use b8\Http\Response\RedirectResponse;
use Octo\Event;
use Octo\Store;
use Octo\Admin\Controller;
use Octo\Admin\Menu;
use Octo\System\Model\Contact;

class ContactController extends Controller
{
    /**
     * @var \Octo\System\Store\ContactStore
     */
    protected $contactStore;

    /**
     * Setup page
     *
     * @return void
     */
    public function init()
    {
        $this->setTitle('Contacts');
        $this->addBreadcrumb('Contacts', '/contact');

        $this->contactStore = Store::get('Contact');
    }

    public static function registerMenus(Menu $menu)
    {
        /** @var \Octo\AssetManager $assets */
        $assets = Config::getInstance()->get('Octo.AssetManager');
        $assets->addJs('System', 'contact');

        $thisMenu = $menu->addRoot('Contacts', '/contact')->setIcon('users');
        $thisMenu->addChild(new Menu\Item('Add Contact', '/contact/add'));
        $thisMenu->addChild(new Menu\Item('Contact Popup', '/contact/popup', true));
        $thisMenu->addChild(new Menu\Item('Manage Contacts', '/contact'));
        $thisMenu->addChild(new Menu\Item('Edit Contact', '/contact/edit', true));

        $thisMenu->addChild(new Menu\Item('Contact Autocomplete', '/contact/autocomplete', true));
        $thisMenu->addChild(new Menu\Item('Contact Autocomplete', '/contact/autocomplete', true));
        $thisMenu->addChild(new Menu\Item('Block Contact', '/contact/block', true));
        $thisMenu->addChild(new Menu\Item('Unblock Contact', '/contact/unblock', true));

        $thisMenu->addChild(new Menu\Item('Opt-In Contact', '/contact/opt-in', true));
        $thisMenu->addChild(new Menu\Item('Opt-Out Contact', '/contact/opt-out', true));
    }

    public function autocomplete()
    {
        $contacts = Store::get('Contact')->search($this->getParam('q', ''));

        $rtn = ['results' => [], 'more' => false];

        foreach ($contacts as $contact) {
            $name = $contact->getFirstName() . ' ' . $contact->getLastName();

            if ($contact->getCompany()) {
                $name .= ' (' . $contact->getCompany() . ')';
            }

            $rtn['results'][] = ['id' => $contact->getId(), 'text' => $name];
        }<commit_msg>Removing duplicate permissions option.<commit_after><?php
namespace Octo\System\Admin\Controller;

use b8\Config;
use b8\Form;
use b8\Http\Response\RedirectResponse;
use Octo\Event;
use Octo\Store;
use Octo\Admin\Controller;
use Octo\Admin\Menu;
use Octo\System\Model\Contact;

class ContactController extends Controller
{
    /**
     * @var \Octo\System\Store\ContactStore
     */
    protected $contactStore;

    /**
     * Setup page
     *
     * @return void
     */
    public function init()
    {
        $this->setTitle('Contacts');
        $this->addBreadcrumb('Contacts', '/contact');

        $this->contactStore = Store::get('Contact');
    }

    public static function registerMenus(Menu $menu)
    {
        /** @var \Octo\AssetManager $assets */
        $assets = Config::getInstance()->get('Octo.AssetManager');
        $assets->addJs('System', 'contact');

        $thisMenu = $menu->addRoot('Contacts', '/contact')->setIcon('users');
        $thisMenu->addChild(new Menu\Item('Add Contact', '/contact/add'));
        $thisMenu->addChild(new Menu\Item('Contact Popup', '/contact/popup', true));
        $thisMenu->addChild(new Menu\Item('Manage Contacts', '/contact'));
        $thisMenu->addChild(new Menu\Item('Edit Contact', '/contact/edit', true));

        $thisMenu->addChild(new Menu\Item('Contact Autocomplete', '/contact/autocomplete', true));
        $thisMenu->addChild(new Menu\Item('Block Contact', '/contact/block', true));
        $thisMenu->addChild(new Menu\Item('Unblock Contact', '/contact/unblock', true));

        $thisMenu->addChild(new Menu\Item('Opt-In Contact', '/contact/opt-in', true));
        $thisMenu->addChild(new Menu\Item('Opt-Out Contact', '/contact/opt-out', true));
    }

    public function autocomplete()
    {
        $contacts = Store::get('Contact')->search($this->getParam('q', ''));

        $rtn = ['results' => [], 'more' => false];

        foreach ($contacts as $contact) {
            $name = $contact->getFirstName() . ' ' . $contact->getLastName();

            if ($contact->getCompany()) {
                $name .= ' (' . $contact->getCompany() . ')';
            }

            $rtn['results'][] = ['id' => $contact->getId(), 'text' => $name];
        }
{'fraction_non_alphanumeric': 0.18879576532862816, 'fraction_numerical': 0.0013233348037053375, 'mean_word_length': 2.9366319444444446, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 58, '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': '4223557', 'n_tokens_mistral': 1373, 'n_tokens_neox': 1343, 'n_words': 252}