Skip to content

Instantly share code, notes, and snippets.

@stepanselyuk
Created September 1, 2014 13:44
Show Gist options
  • Save stepanselyuk/fed9bb4e66d29f641482 to your computer and use it in GitHub Desktop.
Save stepanselyuk/fed9bb4e66d29f641482 to your computer and use it in GitHub Desktop.
AppThread Trait
<?php
/**
* Created by PhpStorm.
* Author: Stepan Seliuk <stepan@selyuk.com>
* Date: 01/06/14
* Time: 15:46
*/
namespace app\components\traits;
/**
* Trait AppThreadTrait
* @package app\components\traits
*/
trait AppThreadTrait
{
protected static $_thread;
public function setThread()
{
self::$_thread = microtime( true ) * 10000;
return $this;
}
public function getThread()
{
return self::$_thread;
}
}
@stepanselyuk
Copy link
Author

/**
 * Created by PhpStorm.
 * Author: Stepan Seliuk <stepan@selyuk.com>
 * Date: 04/06/14
 * Time: 15:30
 */

namespace app\components\yiiExt;

use app\components\traits\AppThreadTrait;
use yii\web\Application;

/**
 * Class WebApplication
 * @package app\components\yiiExt
 */
class WebApplication extends Application
{

    use AppThreadTrait;

    /**
     * @inheritdoc
     */
    public function __construct( $config = [ ] )
    {

        $this->setThread();
        parent::__construct( $config );
    }
} 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment