<commit_before><?php

/*
 * Ticket Plugin for HiPanel
 *
 * @link      https://github.com/hiqdev/hipanel-module-ticket
 * @package   hipanel-module-ticket
 * @license   BSD-3-Clause
 * @copyright Copyright (c) 2014-2015, HiQDev (https://hiqdev.com/)
 */

namespace hipanel\modules\ticket\widgets;

use common\components\Lang;
use yii\helpers\Html;
use yii\jui\Widget;

class Topic extends Widget
{
    public $topics;

    private function _getColor($item)
    {
        $colors = [
           'general'   => 'label-default',
           'technical' => 'label-primary',
           'domain'    => 'label-success',
           'financial' => 'label-warning',
       ];
        if (array_key_exists($item, $colors)) {
            return $colors[$item];
        } else {
            return reset($colors);
        }
    }

    public function init()
    {
        parent::init();
        if ($this->topics) {
            $html = '';
            $html .= '<ul class="list-inline">';
            foreach ($this->topics as $item => $label) {
                $html .= Html::tag('li', '<span class="label ' . $this->_getColor($item) . '">' . Lang::l($label) . '</span>');
            }<commit_msg>+ info color for VDS topic<commit_after><?php

/*
 * Ticket Plugin for HiPanel
 *
 * @link      https://github.com/hiqdev/hipanel-module-ticket
 * @package   hipanel-module-ticket
 * @license   BSD-3-Clause
 * @copyright Copyright (c) 2014-2015, HiQDev (https://hiqdev.com/)
 */

namespace hipanel\modules\ticket\widgets;

use common\components\Lang;
use yii\helpers\Html;
use yii\jui\Widget;

class Topic extends Widget
{
    public $topics;

    private function _getColor($item)
    {
        $colors = [
           'general'   => 'label-default',
           'technical' => 'label-primary',
           'vds'       => 'label-info',
           'domain'    => 'label-success',
           'financial' => 'label-warning',
       ];
        if (array_key_exists($item, $colors)) {
            return $colors[$item];
        } else {
            return reset($colors);
        }
    }

    public function init()
    {
        parent::init();
        if ($this->topics) {
            $html = '';
            $html .= '<ul class="list-inline">';
            foreach ($this->topics as $item => $label) {
                $html .= Html::tag('li', '<span class="label ' . $this->_getColor($item) . '">' . Lang::l($label) . '</span>');
            }
{'fraction_non_alphanumeric': 0.17030927835051546, 'fraction_numerical': 0.007422680412371134, 'mean_word_length': 2.013664596273292, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 26, 'https://': 4, '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': '3671933', 'n_tokens_mistral': 780, 'n_tokens_neox': 766, 'n_words': 153}