<commit_before><?php
/**
 * Server module for HiPanel
 *
 * @link      https://github.com/hiqdev/hipanel-module-server
 * @package   hipanel-module-server
 * @license   BSD-3-Clause
 * @copyright Copyright (c) 2015-2019, HiQDev (http://hiqdev.com/)
 */

namespace hipanel\modules\server\widgets;

use Yii;
use yii\base\InvalidConfigException;
use yii\base\Widget;
use yii\helpers\Html;
use yii\web\JsExpression;

class VNCOperation extends Widget
{
    protected $vncEnd;
    protected $vncEnabled;
    public $model;

    public function init()
    {
        parent::init();
        if ($this->model === null) {
            throw new InvalidConfigException('Please specify the "model" property.');
        }

        $this->vncEnabled = $this->model->vnc['enabled'];

        $this->vncEnd = $this->model->statuses['serverEnableVNC'] === null ? 0 : strtotime('+8 hours', strtotime($this->model->statuses['serverEnableVNC']));
        if (isset($this->model->vnc['endTime'])) {
            $this->vncEnd = $this->vncEnd < time() ? ($this->model->vnc['endTime'] > time() ? $this->model->vnc['endTime'] : $this->vncEnd) : $this->vncEnd;
        }
    }

    public function run()
    {<commit_msg>HP-919 access array offset on value of type null (#191)<commit_after><?php
/**
 * Server module for HiPanel
 *
 * @link      https://github.com/hiqdev/hipanel-module-server
 * @package   hipanel-module-server
 * @license   BSD-3-Clause
 * @copyright Copyright (c) 2015-2019, HiQDev (http://hiqdev.com/)
 */

namespace hipanel\modules\server\widgets;

use Yii;
use yii\base\InvalidConfigException;
use yii\base\Widget;
use yii\helpers\Html;
use yii\web\JsExpression;

class VNCOperation extends Widget
{
    protected $vncEnd;
    protected $vncEnabled;
    public $model;

    public function init()
    {
        parent::init();
        if ($this->model === null) {
            throw new InvalidConfigException('Please specify the "model" property.');
        }

        $this->vncEnabled = $this->model->vnc['enabled'];

        $this->vncEnd = 0;
        if (is_array($this->model->statuses) && isset($this->model->statuses['serverEnableVNC'])) {
            $this->vncEnd = strtotime('+8 hours', strtotime($this->model->statuses['serverEnableVNC']));
        }
        if (isset($this->model->vnc['endTime'])) {
            $this->vncEnd = $this->vncEnd < time() ? ($this->model->vnc['endTime'] > time() ? $this->model->vnc['endTime'] : $this->vncEnd) : $this->vncEnd;
        }
    }

    public function run()
    {
{'fraction_non_alphanumeric': 0.17130365659777425, 'fraction_numerical': 0.011128775834658187, 'mean_word_length': 3.0662358642972536, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 46, 'https://': 2, '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': '6585815', 'n_tokens_mistral': 848, 'n_tokens_neox': 833, 'n_words': 161}