for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* Phossa Project
*
* PHP version 5.4
* @category Library
* @package Phossa2\Db
* @copyright Copyright (c) 2016 phossa.com
* @license http://mit-license.org/ MIT License
* @link http://www.phossa.com/
*/
/*# declare(strict_types=1); */
namespace Phossa2\Db\Traits;
use Phossa2\Db\Profiler;
use Phossa2\Db\Interfaces\ProfilerInterface;
use Phossa2\Db\Interfaces\ProfilerAwareInterface;
* ProfilerAwareTrait
* @author Hong Zhang <[email protected]>
* @see ProfilerAwareInterface
* @version 2.0.0
* @since 2.0.0 added
trait ProfilerAwareTrait
{
* the profiler
* @var ProfilerInterface
* @access protected
protected $profiler;
* @var bool
protected $profiling_enabled = false;
* {@inheritDoc}
public function isProfiling()/*# : bool */
return $this->profiling_enabled;
}
public function enableProfiling(/*# bool */ $flag = true)
$this->profiling_enabled = (bool) $flag;
return $this;
public function setProfiler(ProfilerInterface $profiler)
$this->profiler = $profiler;
$this->profiler->setDriver($this);
public function getProfiler()/*# : ProfilerInterface */
if (is_null($this->profiler)) {
$this->setProfiler(new Profiler());
return $this->profiler;