@@ -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) |
@@ -48,7 +48,7 @@ |
||
48 | 48 | $recentPosts = $postRepository->getActivePosts(3); |
49 | 49 | |
50 | 50 | $recent_post_array = array(); |
51 | - foreach($recentPosts as $postResult) |
|
51 | + foreach ($recentPosts as $postResult) |
|
52 | 52 | { |
53 | 53 | $post = new stdclass(); |
54 | 54 | $post->title = $postResult['title']; |
@@ -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 | } |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | |
9 | 9 | private static $UNKNOWN_ERROR_FILE = 'Unknown File'; |
10 | 10 | private static $UNKNOWN_ERROR_LINE = 'Unknown Line'; |
11 | - private static $UNKNOWN_ERROR_CONTEXT = 'Unknown Context'; |
|
11 | + private static $UNKNOWN_ERROR_CONTEXT = 'Unknown Context'; |
|
12 | 12 | |
13 | 13 | private $profiler; |
14 | 14 | private $display = true; |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | |
25 | 25 | public static function instance() |
26 | 26 | { |
27 | - if(!isset(self::$instance)) |
|
27 | + if (!isset(self::$instance)) |
|
28 | 28 | self::$instance = new Debugger(); |
29 | 29 | return self::$instance; |
30 | 30 | } |
@@ -52,11 +52,11 @@ discard block |
||
52 | 52 | |
53 | 53 | public static function internal_error($code, $string, $file = null, $line = null, $context = null) |
54 | 54 | { |
55 | - if($file == null) |
|
55 | + if ($file == null) |
|
56 | 56 | $file = self::$UNKNOWN_ERROR_FILE; |
57 | - if($line == null) |
|
57 | + if ($line == null) |
|
58 | 58 | $line = self::$UNKNOWN_ERROR_LINE; |
59 | - if($context == null) |
|
59 | + if ($context == null) |
|
60 | 60 | $context = self::$UNKNOWN_ERROR_CONTEXT; |
61 | 61 | |
62 | 62 | self::instance()->console->logError(new Exception($string), "{$string}... TYPE: {$code}"); |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | { |
69 | 69 | $error = error_get_last(); |
70 | 70 | |
71 | - if(isset($error)) |
|
71 | + if (isset($error)) |
|
72 | 72 | self::internal_error($error['type'], $error['message'], $error['file'], $error['line']); |
73 | 73 | |
74 | 74 | self::display(); |
@@ -90,10 +90,10 @@ discard block |
||
90 | 90 | } |
91 | 91 | if (!empty($pdo)) { |
92 | 92 | $profiles = $pdo->getProfiler()->getProfiles(); |
93 | - $profiles = array_filter($profiles, function ($profile) { |
|
93 | + $profiles = array_filter($profiles, function($profile) { |
|
94 | 94 | return $profile['function'] == 'perform'; |
95 | 95 | }); |
96 | - $profiles = array_map(function ($profile) { |
|
96 | + $profiles = array_map(function($profile) { |
|
97 | 97 | return array( |
98 | 98 | 'sql' => trim(preg_replace('/\s+/', ' ', $profile['statement'])), |
99 | 99 | 'parameters' => $profile['bind_values'], |
@@ -24,8 +24,9 @@ discard block |
||
24 | 24 | |
25 | 25 | public static function instance() |
26 | 26 | { |
27 | - if(!isset(self::$instance)) |
|
28 | - self::$instance = new Debugger(); |
|
27 | + if(!isset(self::$instance)) { |
|
28 | + self::$instance = new Debugger(); |
|
29 | + } |
|
29 | 30 | return self::$instance; |
30 | 31 | } |
31 | 32 | |
@@ -52,12 +53,15 @@ discard block |
||
52 | 53 | |
53 | 54 | public static function internal_error($code, $string, $file = null, $line = null, $context = null) |
54 | 55 | { |
55 | - if($file == null) |
|
56 | - $file = self::$UNKNOWN_ERROR_FILE; |
|
57 | - if($line == null) |
|
58 | - $line = self::$UNKNOWN_ERROR_LINE; |
|
59 | - if($context == null) |
|
60 | - $context = self::$UNKNOWN_ERROR_CONTEXT; |
|
56 | + if($file == null) { |
|
57 | + $file = self::$UNKNOWN_ERROR_FILE; |
|
58 | + } |
|
59 | + if($line == null) { |
|
60 | + $line = self::$UNKNOWN_ERROR_LINE; |
|
61 | + } |
|
62 | + if($context == null) { |
|
63 | + $context = self::$UNKNOWN_ERROR_CONTEXT; |
|
64 | + } |
|
61 | 65 | |
62 | 66 | self::instance()->console->logError(new Exception($string), "{$string}... TYPE: {$code}"); |
63 | 67 | |
@@ -68,8 +72,9 @@ discard block |
||
68 | 72 | { |
69 | 73 | $error = error_get_last(); |
70 | 74 | |
71 | - if(isset($error)) |
|
72 | - self::internal_error($error['type'], $error['message'], $error['file'], $error['line']); |
|
75 | + if(isset($error)) { |
|
76 | + self::internal_error($error['type'], $error['message'], $error['file'], $error['line']); |
|
77 | + } |
|
73 | 78 | |
74 | 79 | self::display(); |
75 | 80 | return true; |