@@ -43,9 +43,9 @@ |
||
43 | 43 | |
44 | 44 | private function get_recent_posts() |
45 | 45 | { |
46 | - global $container; |
|
47 | - $postRepository = new MysqlPostRepository($container['db_connection_locator']); |
|
48 | - $recentPosts = $postRepository->getActivePosts(3); |
|
46 | + global $container; |
|
47 | + $postRepository = new MysqlPostRepository($container['db_connection_locator']); |
|
48 | + $recentPosts = $postRepository->getActivePosts(3); |
|
49 | 49 | |
50 | 50 | $recent_post_array = array(); |
51 | 51 | foreach($recentPosts as $postResult) |
@@ -18,8 +18,8 @@ discard block |
||
18 | 18 | private function __construct() |
19 | 19 | { |
20 | 20 | $this->console = new Console(); |
21 | - $this->profiler = new PhpQuickProfiler(); |
|
22 | - $this->profiler->setConsole($this->console); |
|
21 | + $this->profiler = new PhpQuickProfiler(); |
|
22 | + $this->profiler->setConsole($this->console); |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | public static function instance() |
@@ -82,29 +82,29 @@ discard block |
||
82 | 82 | |
83 | 83 | public static function display() |
84 | 84 | { |
85 | - if ($_COOKIE['debugger'] == 'display' && self::instance()->display) { |
|
86 | - $pdo = ''; |
|
87 | - global $container; |
|
88 | - if (!empty($container) && !empty($container['db_connection_locator'])) { |
|
89 | - $pdo = $container['db_connection_locator']->getRead(); |
|
90 | - } |
|
91 | - if (!empty($pdo)) { |
|
92 | - $profiles = $pdo->getProfiler()->getProfiles(); |
|
93 | - $profiles = array_filter($profiles, function ($profile) { |
|
94 | - return $profile['function'] == 'perform'; |
|
95 | - }); |
|
96 | - $profiles = array_map(function ($profile) { |
|
97 | - return array( |
|
98 | - 'sql' => trim(preg_replace('/\s+/', ' ', $profile['statement'])), |
|
99 | - 'parameters' => $profile['bind_values'], |
|
100 | - 'time' => $profile['duration'] |
|
101 | - ); |
|
102 | - }, $profiles); |
|
103 | - self::instance()->profiler->setProfiledQueries($profiles); |
|
104 | - } |
|
105 | - self::instance()->profiler->setDisplay(new Particletree\Pqp\Display()); |
|
106 | - self::instance()->profiler->display($pdo); |
|
107 | - } |
|
85 | + if ($_COOKIE['debugger'] == 'display' && self::instance()->display) { |
|
86 | + $pdo = ''; |
|
87 | + global $container; |
|
88 | + if (!empty($container) && !empty($container['db_connection_locator'])) { |
|
89 | + $pdo = $container['db_connection_locator']->getRead(); |
|
90 | + } |
|
91 | + if (!empty($pdo)) { |
|
92 | + $profiles = $pdo->getProfiler()->getProfiles(); |
|
93 | + $profiles = array_filter($profiles, function ($profile) { |
|
94 | + return $profile['function'] == 'perform'; |
|
95 | + }); |
|
96 | + $profiles = array_map(function ($profile) { |
|
97 | + return array( |
|
98 | + 'sql' => trim(preg_replace('/\s+/', ' ', $profile['statement'])), |
|
99 | + 'parameters' => $profile['bind_values'], |
|
100 | + 'time' => $profile['duration'] |
|
101 | + ); |
|
102 | + }, $profiles); |
|
103 | + self::instance()->profiler->setProfiledQueries($profiles); |
|
104 | + } |
|
105 | + self::instance()->profiler->setDisplay(new Particletree\Pqp\Display()); |
|
106 | + self::instance()->profiler->display($pdo); |
|
107 | + } |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | } |