bytic /
database
| 1 | <?php |
||
| 2 | |||
| 3 | namespace Nip\Database\Adapters\Profiler; |
||
| 4 | |||
| 5 | /** |
||
| 6 | * Class Profiler |
||
| 7 | * @package Nip\Database\Adapters\Profiler |
||
| 8 | */ |
||
| 9 | class Profiler extends \Nip_Profiler |
||
| 10 | { |
||
| 11 | public $filterTypes = null; |
||
| 12 | |||
| 13 | /** |
||
| 14 | * @param $id |
||
| 15 | * @return QueryProfile|\Nip\Profiler\Profile |
||
| 16 | */ |
||
| 17 | public function newProfile($id) |
||
| 18 | { |
||
| 19 | return new QueryProfile($id); |
||
| 20 | } |
||
| 21 | |||
| 22 | /** |
||
| 23 | * @param $profile |
||
| 24 | * @return bool |
||
| 25 | */ |
||
| 26 | protected function applyFilters($profile) |
||
| 27 | { |
||
| 28 | if (parent::applyFilters($profile)) { |
||
| 29 | return $this->secondsFilter($profile); |
||
| 30 | } |
||
| 31 | } |
||
| 32 | |||
| 33 | /** |
||
| 34 | * @param $profile |
||
| 35 | * @return bool |
||
| 36 | */ |
||
| 37 | public function typeFilter($profile) |
||
| 38 | { |
||
| 39 | if (is_array($this->filterTypes) && in_array($profile->type, $this->filterTypes)) { |
||
| 40 | $this->deleteProfile($profile); |
||
| 41 | |||
| 42 | return false; |
||
| 43 | } |
||
| 44 | |||
| 45 | return true; |
||
| 46 | } |
||
| 47 | |||
| 48 | /** |
||
| 49 | * @param null $queryTypes |
||
|
0 ignored issues
–
show
Documentation
Bug
introduced
by
Loading history...
|
|||
| 50 | * @return $this |
||
| 51 | */ |
||
| 52 | public function setFilterQueryType($queryTypes = null) |
||
| 53 | { |
||
| 54 | $this->filterTypes = $queryTypes; |
||
| 55 | |||
| 56 | return $this; |
||
| 57 | } |
||
| 58 | } |
||
| 59 |