<commit_before><?php

use yii\helpers\Html;
use yii\widgets\DetailView;

/* @var $this yii\web\View */
/* @var $model common\models\User */

$this->title = $model->id;
$this->params['breadcrumbs'][] = ['label' => 'Users', 'url' => ['index']];
$this->params['breadcrumbs'][] = Html::encode($this->title);
?>
<div class="user-view">

    <h1><?= Html::encode($this->title) ?></h1>

    <p>
        <?= Html::a('Update', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
        <?=
        Html::a('Delete', ['delete', 'id' => $model->id], [
            'class' => 'btn btn-danger',
            'data' => [
                'confirm' => 'Are you sure you want to delete this item?',
                'method' => 'post',
            ],
        ])
        ?>
    </p>
    <p>
<?php $escapedUsername = Html::encode($model->username); ?>
        <?= 'Username: ' . $escapedUsername; ?>
    </p>
    <p>
        <?= 'Key: ' . $key; ?>
    </p>
    <p>
        <?php $encodedUsername = Yii::$app->security->encryptByPassword(
                $escapedUsername, $key);
        ?>
        <?= 'Username: ' . $encodedUsername; ?>
    </p>
    <p>
    <?php $decodedUsername = Yii::$app->security->decryptByPassword(
            $encodedUsername, $key);
    ?>
    <?= 'Username: ' . $decodedUsername; ?>
    </p>
    <?=
    DetailView::widget([
        'model' => $model,
        'attributes' => [
            'id',
            'username',
            'auth_key',
            'password_hash',
            'password_reset_token',
            'email:email',
            'status',
            'created_at',
            'updated_at',
        ],
    ])
    ?>

</div><commit_msg>fragment caching in view with 'variations' of model id <commit_after><?php

use yii\helpers\Html;
use yii\widgets\DetailView;

/* @var $this yii\web\View */
/* @var $model common\models\User */

$this->title = $model->id;
$this->params['breadcrumbs'][] = ['label' => 'Users', 'url' => ['index']];
$this->params['breadcrumbs'][] = Html::encode($this->title);
?>
<div class="user-view">

    <h1><?= Html::encode($this->title) ?></h1>

    <p>
        <?= Html::a('Update', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
        <?=
        Html::a('Delete', ['delete', 'id' => $model->id], [
            'class' => 'btn btn-danger',
            'data' => [
                'confirm' => 'Are you sure you want to delete this item?',
                'method' => 'post',
            ],
        ])
        ?>
    </p>
    <p>
<?php $escapedUsername = Html::encode($model->username); ?>
        <?= 'Username: ' . $escapedUsername; ?>
    </p>
    <p>
        <?= 'Key: ' . $key; ?>
    </p>
    <p>
        <?php $encodedUsername = Yii::$app->security->encryptByPassword(
                $escapedUsername, $key);
        ?>
        <?= 'Username: ' . $encodedUsername; ?>
    </p>
    <p>
    <?php $decodedUsername = Yii::$app->security->decryptByPassword(
            $encodedUsername, $key);
    ?>
    <?= 'Username: ' . $decodedUsername; ?>
    </p>
    <?php
    // cache table with variations of $model->id, means with model id change cache exchange
    if($this->beginCache('user_detail', ['variations'=>$model->id])){
        echo DetailView::widget([
            'model' => $model,
            'attributes' => [
                'id',
                'username',
                'auth_key',
                'password_<PASSWORD>',
                'password_reset_token',
                'email:email',
                'status',
                'created_at',
                'updated_at',
            ],
        ]);
        // show message in log for the first time cache store
        Yii::trace('Store user details table log');        
        $this->endCache();
    }
    ?>

</div>
{'fraction_non_alphanumeric': 0.20924702774108322, 'fraction_numerical': 0.0010568031704095112, 'mean_word_length': 1.9056024558710667, 'pattern_counts': {'":': 0, '<': 56, '<?xml version=': 0, '>': 109, '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': '788472', 'n_tokens_mistral': 1231, 'n_tokens_neox': 1216, 'n_words': 235}