Completed
Branch master (03f360)
by
unknown
13:33 queued 11:19
created
core/admin/templates/admin_details_legend.template.php 2 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -24,13 +24,13 @@  discard block
 block discarded – undo
24 24
     </dl>
25 25
     <dl class="alignleft ee-list-table-legend">
26 26
                 <?php $count = 1;
27
-            endif; ?>
27
+			endif; ?>
28 28
         <dt id="ee-legend-item-<?php echo esc_attr($item); ?>">
29 29
             <?php $class = ! empty($details['class']) ? $details['class'] : 'ee-legend-img-container'; ?>
30 30
             <?php
31
-            if (strpos($details['class'], '<span') !== false) {
32
-                echo wp_kses($class, AllowedTags::getWithFormTags());
33
-            } else { ?>
31
+			if (strpos($details['class'], '<span') !== false) {
32
+				echo wp_kses($class, AllowedTags::getWithFormTags());
33
+			} else { ?>
34 34
             <span class="<?php echo esc_attr($class); ?>">
35 35
                 <?php if (! empty($details['icon'])) : ?>
36 36
                     <img alt="<?php echo esc_attr($details['desc']); ?>"
@@ -40,11 +40,11 @@  discard block
 block discarded – undo
40 40
                 <?php endif; ?>
41 41
             </span>
42 42
                 <?php
43
-            } ?>
43
+			} ?>
44 44
             <span class="ee-legend-description"><?php echo esc_html($details['desc']); ?></span>
45 45
         </dt>
46 46
             <?php $count++;
47
-        endforeach; ?>
47
+		endforeach; ?>
48 48
     </dl>
49 49
     <div style="clear:both"></div>
50 50
 </div>
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@
 block discarded – undo
32 32
                 echo wp_kses($class, AllowedTags::getWithFormTags());
33 33
             } else { ?>
34 34
             <span class="<?php echo esc_attr($class); ?>">
35
-                <?php if (! empty($details['icon'])) : ?>
35
+                <?php if ( ! empty($details['icon'])) : ?>
36 36
                     <img alt="<?php echo esc_attr($details['desc']); ?>"
37 37
                          class="ee-legend-icon"
38 38
                          src="<?php echo esc_url_raw($details['icon']); ?>"
Please login to merge, or discard this patch.
core/admin/templates/about_admin_wrapper.template.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -26,9 +26,9 @@
 block discarded – undo
26 26
     <?php echo wp_kses($nav_tabs, AllowedTags::getWithFormTags()); ?>
27 27
 
28 28
     <?php
29
-    do_action('AHEE__admin_wrapper__template__before_about_admin_page_content');
30
-    echo wp_kses($about_admin_page_content, AllowedTags::getWithFormTags());
31
-    do_action('AHEE__admin_wrapper__template__after_about_admin_page_content');
32
-    ?>
29
+	do_action('AHEE__admin_wrapper__template__before_about_admin_page_content');
30
+	echo wp_kses($about_admin_page_content, AllowedTags::getWithFormTags());
31
+	do_action('AHEE__admin_wrapper__template__after_about_admin_page_content');
32
+	?>
33 33
 
34 34
 </div>
Please login to merge, or discard this patch.
core/admin/templates/admin_details_wrapper.template.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 do_action('add_meta_boxes', (string) $post_type, $post);
15 15
 ?>
16 16
 
17
-<?php if (! empty($admin_page_header)) : ?>
17
+<?php if ( ! empty($admin_page_header)) : ?>
18 18
     <div id="admin-page-header">
19 19
         <?php echo wp_kses($admin_page_header, AllowedTags::getWithFormTags()); ?>
20 20
     </div>
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
     <!-- admin-page-header -->
24 24
     <div id="post-body" class="metabox-holder columns-2">
25 25
 
26
-        <?php if (! empty($post_body_content)) : ?>
26
+        <?php if ( ! empty($post_body_content)) : ?>
27 27
             <div id="post-body-content">
28 28
                 <?php echo wp_kses($post_body_content, AllowedTags::getWithFormTags()); ?>
29 29
             </div>
Please login to merge, or discard this patch.
core/admin/templates/admin_details_wrapper_no_sidebar.template.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
 <div id="<?php echo esc_attr($admin_page_wrapper_div_id); ?>">
14 14
     <div id="post-body" class="metabox-holder columns-1">
15 15
 
16
-        <?php if (! empty($admin_page_header)) : ?>
16
+        <?php if ( ! empty($admin_page_header)) : ?>
17 17
             <div id="admin-page-header">
18 18
                 <?php echo wp_kses($admin_page_header, AllowedTags::getWithFormTags()); ?>
19 19
             </div>
Please login to merge, or discard this patch.
core/admin/templates/admin_wrapper.template.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -21,11 +21,11 @@
 block discarded – undo
21 21
     <?php echo wp_kses($nav_tabs, AllowedTags::getWithFormTags()); ?>
22 22
 
23 23
     <?php
24
-    do_action('AHEE__admin_wrapper__template__before_admin_page_content');
25
-    echo wp_kses($before_admin_page_content, AllowedTags::getWithFormTags());
26
-    echo wp_kses($admin_page_content, AllowedTags::getWithFormTags());
27
-    echo wp_kses($after_admin_page_content, AllowedTags::getWithFormTags());
28
-    do_action('AHEE__admin_wrapper__template__after_admin_page_content');
29
-    ?>
24
+	do_action('AHEE__admin_wrapper__template__before_admin_page_content');
25
+	echo wp_kses($before_admin_page_content, AllowedTags::getWithFormTags());
26
+	echo wp_kses($admin_page_content, AllowedTags::getWithFormTags());
27
+	echo wp_kses($after_admin_page_content, AllowedTags::getWithFormTags());
28
+	do_action('AHEE__admin_wrapper__template__after_admin_page_content');
29
+	?>
30 30
 
31 31
 </div>
Please login to merge, or discard this patch.
core/admin/templates/admin_wrapper_ajax.template.php 2 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -17,11 +17,11 @@
 block discarded – undo
17 17
 
18 18
     <div class="ee-notices"><?php echo isset($ajax_notices) ? $ajax_notices  : '';// already escaped ?></div>
19 19
     <?php
20
-    do_action('AHEE__admin_wrapper__template__before_admin_page_content');
21
-    echo wp_kses($before_admin_page_content, AllowedTags::getWithFormTags());
22
-    echo wp_kses($admin_page_content, AllowedTags::getWithFormTags());
23
-    echo wp_kses($after_admin_page_content, AllowedTags::getWithFormTags());
24
-    do_action('AHEE__admin_wrapper__template__after_admin_page_content');
25
-    ?>
20
+	do_action('AHEE__admin_wrapper__template__before_admin_page_content');
21
+	echo wp_kses($before_admin_page_content, AllowedTags::getWithFormTags());
22
+	echo wp_kses($admin_page_content, AllowedTags::getWithFormTags());
23
+	echo wp_kses($after_admin_page_content, AllowedTags::getWithFormTags());
24
+	do_action('AHEE__admin_wrapper__template__after_admin_page_content');
25
+	?>
26 26
 </div>
27 27
 <!-- espresso-admin -->
28 28
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 block discarded – undo
15 15
 <div class="wrap espresso-admin">
16 16
     <h1><?php esc_attr_e('Event Espresso', 'event_espresso'); ?>&nbsp;-&nbsp;<?php echo wp_kses($admin_page_title, AllowedTags::getWithFormTags()); ?></h1>
17 17
 
18
-    <div class="ee-notices"><?php echo isset($ajax_notices) ? $ajax_notices  : '';// already escaped ?></div>
18
+    <div class="ee-notices"><?php echo isset($ajax_notices) ? $ajax_notices : ''; // already escaped ?></div>
19 19
     <?php
20 20
     do_action('AHEE__admin_wrapper__template__before_admin_page_content');
21 21
     echo wp_kses($before_admin_page_content, AllowedTags::getWithFormTags());
Please login to merge, or discard this patch.
core/services/request/middleware/PreProductionVersionWarning.php 1 patch
Indentation   +79 added lines, -79 removed lines patch added patch discarded remove patch
@@ -19,91 +19,91 @@
 block discarded – undo
19 19
 class PreProductionVersionWarning extends Middleware
20 20
 {
21 21
 
22
-    /**
23
-     * converts a Request to a Response
24
-     *
25
-     * @param RequestInterface  $request
26
-     * @param ResponseInterface $response
27
-     * @return ResponseInterface
28
-     */
29
-    public function handleRequest(RequestInterface $request, ResponseInterface $response)
30
-    {
31
-        $this->request = $request;
32
-        $this->response = $response;
33
-        $this->displayPreProductionVersionWarning();
34
-        $this->response = $this->processRequestStack($this->request, $this->response);
35
-        return $this->response;
36
-    }
22
+	/**
23
+	 * converts a Request to a Response
24
+	 *
25
+	 * @param RequestInterface  $request
26
+	 * @param ResponseInterface $response
27
+	 * @return ResponseInterface
28
+	 */
29
+	public function handleRequest(RequestInterface $request, ResponseInterface $response)
30
+	{
31
+		$this->request = $request;
32
+		$this->response = $response;
33
+		$this->displayPreProductionVersionWarning();
34
+		$this->response = $this->processRequestStack($this->request, $this->response);
35
+		return $this->response;
36
+	}
37 37
 
38 38
 
39
-    /**
40
-     * displays message on frontend of site notifying admin that EE has been temporarily placed into maintenance mode
41
-     *
42
-     * @return void
43
-     */
44
-    public function displayPreProductionVersionWarning()
45
-    {
46
-        // skip AJAX requests
47
-        if ($this->request->isAjax()) {
48
-            return;
49
-        }
50
-        // skip stable releases
51
-        if (substr(EVENT_ESPRESSO_VERSION, -5) !== '.beta') {
52
-            return;
53
-        }
54
-        // site admin has authorized use of non-stable release candidate for production
55
-        if (defined('ALLOW_NON_STABLE_RELEASE_ON_LIVE_SITE') && ALLOW_NON_STABLE_RELEASE_ON_LIVE_SITE) {
56
-            return;
57
-        }
58
-        // post release candidate warning
59
-        if ($this->request->isAdmin()) {
60
-            add_action('admin_notices', array($this, 'preProductionVersionAdminNotice'), -999);
61
-        } else {
62
-            add_action('shutdown', array($this, 'preProductionVersionWarningNotice'), 10);
63
-        }
64
-    }
39
+	/**
40
+	 * displays message on frontend of site notifying admin that EE has been temporarily placed into maintenance mode
41
+	 *
42
+	 * @return void
43
+	 */
44
+	public function displayPreProductionVersionWarning()
45
+	{
46
+		// skip AJAX requests
47
+		if ($this->request->isAjax()) {
48
+			return;
49
+		}
50
+		// skip stable releases
51
+		if (substr(EVENT_ESPRESSO_VERSION, -5) !== '.beta') {
52
+			return;
53
+		}
54
+		// site admin has authorized use of non-stable release candidate for production
55
+		if (defined('ALLOW_NON_STABLE_RELEASE_ON_LIVE_SITE') && ALLOW_NON_STABLE_RELEASE_ON_LIVE_SITE) {
56
+			return;
57
+		}
58
+		// post release candidate warning
59
+		if ($this->request->isAdmin()) {
60
+			add_action('admin_notices', array($this, 'preProductionVersionAdminNotice'), -999);
61
+		} else {
62
+			add_action('shutdown', array($this, 'preProductionVersionWarningNotice'), 10);
63
+		}
64
+	}
65 65
 
66 66
 
67
-    /**
68
-     * displays admin notice that current version of EE is not a stable release
69
-     *
70
-     * @return void
71
-     * @throws InvalidDataTypeException
72
-     */
73
-    public function preProductionVersionAdminNotice()
74
-    {
75
-        new PersistentAdminNotice(
76
-            'preProductionVersionAdminNotice_' . EVENT_ESPRESSO_VERSION,
77
-            $this->warningNotice()
78
-        );
79
-    }
67
+	/**
68
+	 * displays admin notice that current version of EE is not a stable release
69
+	 *
70
+	 * @return void
71
+	 * @throws InvalidDataTypeException
72
+	 */
73
+	public function preProductionVersionAdminNotice()
74
+	{
75
+		new PersistentAdminNotice(
76
+			'preProductionVersionAdminNotice_' . EVENT_ESPRESSO_VERSION,
77
+			$this->warningNotice()
78
+		);
79
+	}
80 80
 
81 81
 
82
-    /**
83
-     * displays message on frontend of site notifying admin that current version of EE is not a stable release
84
-     *
85
-     * @return void
86
-     */
87
-    public function preProductionVersionWarningNotice()
88
-    {
89
-        echo '<div id="ee-release-candidate-notice-dv" class="ee-really-important-notice-dv"><p>';
90
-        echo wp_kses($this->warningNotice(), AllowedTags::getAllowedTags());
91
-        echo '</p></div>';
92
-    }
82
+	/**
83
+	 * displays message on frontend of site notifying admin that current version of EE is not a stable release
84
+	 *
85
+	 * @return void
86
+	 */
87
+	public function preProductionVersionWarningNotice()
88
+	{
89
+		echo '<div id="ee-release-candidate-notice-dv" class="ee-really-important-notice-dv"><p>';
90
+		echo wp_kses($this->warningNotice(), AllowedTags::getAllowedTags());
91
+		echo '</p></div>';
92
+	}
93 93
 
94 94
 
95
-    /**
96
-     * @return string
97
-     */
98
-    private function warningNotice()
99
-    {
100
-        return sprintf(
101
-            esc_html__(
102
-                'This version of Event Espresso is for testing and/or evaluation purposes only. It is %1$snot%2$s considered a stable release and should therefore %1$snot%2$s be activated on a live or production website.',
103
-                'event_espresso'
104
-            ),
105
-            '<strong>',
106
-            '</strong>'
107
-        );
108
-    }
95
+	/**
96
+	 * @return string
97
+	 */
98
+	private function warningNotice()
99
+	{
100
+		return sprintf(
101
+			esc_html__(
102
+				'This version of Event Espresso is for testing and/or evaluation purposes only. It is %1$snot%2$s considered a stable release and should therefore %1$snot%2$s be activated on a live or production website.',
103
+				'event_espresso'
104
+			),
105
+			'<strong>',
106
+			'</strong>'
107
+		);
108
+	}
109 109
 }
Please login to merge, or discard this patch.
core/services/notices/AdminNotice.php 1 patch
Indentation   +111 added lines, -111 removed lines patch added patch discarded remove patch
@@ -15,115 +15,115 @@
 block discarded – undo
15 15
 class AdminNotice
16 16
 {
17 17
 
18
-    const ERROR = 'notice-error';
19
-
20
-    const WARNING = 'notice-warning';
21
-
22
-    const SUCCESS = 'notice-success';
23
-
24
-    const INFORMATION = 'notice-info';
25
-
26
-    const DISMISSABLE = ' is-dismissible';
27
-
28
-    /**
29
-     * generic system notice to be converted into a WP admin notice
30
-     *
31
-     * @var NoticeInterface $notice
32
-     */
33
-    private $notice;
34
-
35
-
36
-    /**
37
-     * AdminNotice constructor.
38
-     *
39
-     * @param NoticeInterface $notice
40
-     * @param bool            $display_now
41
-     */
42
-    public function __construct(NoticeInterface $notice, $display_now = true)
43
-    {
44
-        $this->notice = $notice;
45
-        if (! did_action('admin_notices')) {
46
-            add_action('admin_notices', array($this, 'displayNotice'));
47
-        } elseif ($display_now) {
48
-            $this->displayNotice();
49
-        }
50
-    }
51
-
52
-
53
-    /**
54
-     * @return void
55
-     */
56
-    public function displayNotice()
57
-    {
58
-        echo wp_kses($this->getNotice(), AllowedTags::getAllowedTags());
59
-    }
60
-
61
-
62
-    /**
63
-     * produces something  like:
64
-     *  <div class="notice notice-success is-dismissible event-espresso-admin-notice">
65
-     *      <p>YOU DID IT!</p>
66
-     *      <button type="button" class="notice-dismiss"><span class="screen-reader-text">Dismiss this
67
-     *      notice.</span></button>
68
-     *  </div>
69
-     *
70
-     * @return string
71
-     */
72
-    public function getNotice()
73
-    {
74
-        return sprintf(
75
-            '<div class="notice %1$s%2$s event-espresso-admin-notice"><p>%3$s</p></div>',
76
-            $this->getType(),
77
-            $this->notice->isDismissible() ? AdminNotice::DISMISSABLE : '',
78
-            $this->getMessage()
79
-        );
80
-    }
81
-
82
-
83
-    /**
84
-     * @return string
85
-     */
86
-    private function getType()
87
-    {
88
-        switch ($this->notice->type()) {
89
-            case Notice::ERROR:
90
-                return AdminNotice::ERROR;
91
-            case Notice::ATTENTION:
92
-                return AdminNotice::WARNING;
93
-            case Notice::SUCCESS:
94
-                return AdminNotice::SUCCESS;
95
-            case Notice::INFORMATION:
96
-            default:
97
-                return AdminNotice::INFORMATION;
98
-        }
99
-    }
100
-
101
-
102
-    /**
103
-     * @return string
104
-     */
105
-    protected function getMessage()
106
-    {
107
-        $message = $this->notice->message();
108
-        if (WP_DEBUG && $this->getType() === AdminNotice::ERROR) {
109
-            $message .= '<br/><span class="tiny-text">' . $this->generateErrorCode() . '</span>';
110
-        }
111
-        return $message;
112
-    }
113
-
114
-
115
-    /**
116
-     * create error code from filepath, function name,
117
-     * and line number where notice was generated
118
-     *
119
-     * @return string
120
-     */
121
-    protected function generateErrorCode()
122
-    {
123
-        $file = explode('.', basename($this->notice->file()));
124
-        $error_code = ! empty($file[0]) ? $file[0] : '';
125
-        $error_code .= ! empty($error_code) ? ' - ' . $this->notice->func() : $this->notice->func();
126
-        $error_code .= ' - ' . $this->notice->line();
127
-        return $error_code;
128
-    }
18
+	const ERROR = 'notice-error';
19
+
20
+	const WARNING = 'notice-warning';
21
+
22
+	const SUCCESS = 'notice-success';
23
+
24
+	const INFORMATION = 'notice-info';
25
+
26
+	const DISMISSABLE = ' is-dismissible';
27
+
28
+	/**
29
+	 * generic system notice to be converted into a WP admin notice
30
+	 *
31
+	 * @var NoticeInterface $notice
32
+	 */
33
+	private $notice;
34
+
35
+
36
+	/**
37
+	 * AdminNotice constructor.
38
+	 *
39
+	 * @param NoticeInterface $notice
40
+	 * @param bool            $display_now
41
+	 */
42
+	public function __construct(NoticeInterface $notice, $display_now = true)
43
+	{
44
+		$this->notice = $notice;
45
+		if (! did_action('admin_notices')) {
46
+			add_action('admin_notices', array($this, 'displayNotice'));
47
+		} elseif ($display_now) {
48
+			$this->displayNotice();
49
+		}
50
+	}
51
+
52
+
53
+	/**
54
+	 * @return void
55
+	 */
56
+	public function displayNotice()
57
+	{
58
+		echo wp_kses($this->getNotice(), AllowedTags::getAllowedTags());
59
+	}
60
+
61
+
62
+	/**
63
+	 * produces something  like:
64
+	 *  <div class="notice notice-success is-dismissible event-espresso-admin-notice">
65
+	 *      <p>YOU DID IT!</p>
66
+	 *      <button type="button" class="notice-dismiss"><span class="screen-reader-text">Dismiss this
67
+	 *      notice.</span></button>
68
+	 *  </div>
69
+	 *
70
+	 * @return string
71
+	 */
72
+	public function getNotice()
73
+	{
74
+		return sprintf(
75
+			'<div class="notice %1$s%2$s event-espresso-admin-notice"><p>%3$s</p></div>',
76
+			$this->getType(),
77
+			$this->notice->isDismissible() ? AdminNotice::DISMISSABLE : '',
78
+			$this->getMessage()
79
+		);
80
+	}
81
+
82
+
83
+	/**
84
+	 * @return string
85
+	 */
86
+	private function getType()
87
+	{
88
+		switch ($this->notice->type()) {
89
+			case Notice::ERROR:
90
+				return AdminNotice::ERROR;
91
+			case Notice::ATTENTION:
92
+				return AdminNotice::WARNING;
93
+			case Notice::SUCCESS:
94
+				return AdminNotice::SUCCESS;
95
+			case Notice::INFORMATION:
96
+			default:
97
+				return AdminNotice::INFORMATION;
98
+		}
99
+	}
100
+
101
+
102
+	/**
103
+	 * @return string
104
+	 */
105
+	protected function getMessage()
106
+	{
107
+		$message = $this->notice->message();
108
+		if (WP_DEBUG && $this->getType() === AdminNotice::ERROR) {
109
+			$message .= '<br/><span class="tiny-text">' . $this->generateErrorCode() . '</span>';
110
+		}
111
+		return $message;
112
+	}
113
+
114
+
115
+	/**
116
+	 * create error code from filepath, function name,
117
+	 * and line number where notice was generated
118
+	 *
119
+	 * @return string
120
+	 */
121
+	protected function generateErrorCode()
122
+	{
123
+		$file = explode('.', basename($this->notice->file()));
124
+		$error_code = ! empty($file[0]) ? $file[0] : '';
125
+		$error_code .= ! empty($error_code) ? ' - ' . $this->notice->func() : $this->notice->func();
126
+		$error_code .= ' - ' . $this->notice->line();
127
+		return $error_code;
128
+	}
129 129
 }
Please login to merge, or discard this patch.
core/services/Benchmark.php 2 patches
Indentation   +320 added lines, -320 removed lines patch added patch discarded remove patch
@@ -16,324 +16,324 @@
 block discarded – undo
16 16
 class Benchmark
17 17
 {
18 18
 
19
-    /**
20
-     * @var string $output
21
-     */
22
-    private static $output;
23
-
24
-    /**
25
-     * @var array $start_times array containing the start time for the timers
26
-     */
27
-    private static $start_times;
28
-
29
-    /**
30
-     * @var array $times array containing all the timer'd times, which can be outputted via show_times()
31
-     */
32
-    private static $times = array();
33
-
34
-    /**
35
-     * @var array $memory_usage
36
-     */
37
-    protected static $memory_usage = array();
38
-
39
-
40
-    /**
41
-     * @param string $output
42
-     * @param bool   $formatted
43
-     */
44
-    public static function addOutput($output, $formatted = true)
45
-    {
46
-        Benchmark::$output .= $formatted
47
-            ? "<br />{$output}"
48
-            : "\n{$output}";
49
-    }
50
-
51
-
52
-    /**
53
-     * @return void
54
-     */
55
-    public static function resetOutput()
56
-    {
57
-        Benchmark::$output = '';
58
-    }
59
-
60
-    /**
61
-     * whether to benchmark code or not
62
-     */
63
-    public static function doNotRun()
64
-    {
65
-        return ! WP_DEBUG || (defined('DOING_AJAX') && DOING_AJAX);
66
-    }
67
-
68
-
69
-    /**
70
-     * resetTimes
71
-     */
72
-    public static function resetTimes()
73
-    {
74
-        Benchmark::$times = array();
75
-    }
76
-
77
-
78
-    /**
79
-     * Add Benchmark::startTimer() before a block of code you want to measure the performance of
80
-     *
81
-     * @param null $timer_name
82
-     */
83
-    public static function startTimer($timer_name = null)
84
-    {
85
-        if (Benchmark::doNotRun()) {
86
-            return;
87
-        }
88
-        $timer_name = $timer_name !== '' ? $timer_name : get_called_class();
89
-        Benchmark::$start_times[ $timer_name ] = microtime(true);
90
-    }
91
-
92
-
93
-    /**
94
-     * Add Benchmark::stopTimer() after a block of code you want to measure the performance of
95
-     *
96
-     * @param string $timer_name
97
-     */
98
-    public static function stopTimer($timer_name = '')
99
-    {
100
-        if (Benchmark::doNotRun()) {
101
-            return;
102
-        }
103
-        $timer_name = $timer_name !== '' ? $timer_name : get_called_class();
104
-        if (isset(Benchmark::$start_times[ $timer_name ])) {
105
-            $start_time = Benchmark::$start_times[ $timer_name ];
106
-            unset(Benchmark::$start_times[ $timer_name ]);
107
-        } else {
108
-            $start_time = array_pop(Benchmark::$start_times);
109
-        }
110
-        Benchmark::$times[ $timer_name ] = number_format(microtime(true) - $start_time, 8);
111
-    }
112
-
113
-
114
-    /**
115
-     * Measure the memory usage by PHP so far.
116
-     *
117
-     * @param string  $label      The label to show for this time eg "Start of calling Some_Class::some_function"
118
-     * @param boolean $output_now whether to echo now, or wait until EEH_Debug_Tools::show_times() is called
119
-     * @param bool    $formatted
120
-     * @return void
121
-     */
122
-    public static function measureMemory($label = 'memory usage', $output_now = false, $formatted = true)
123
-    {
124
-        if (Benchmark::doNotRun()) {
125
-            return;
126
-        }
127
-        $memory_used = Benchmark::convert(memory_get_usage(true));
128
-        Benchmark::$memory_usage[ $label ] = $memory_used;
129
-        if ($output_now) {
130
-            echo ($formatted
131
-                ? "<br>{$label} : {$memory_used}"
132
-                : "\n {$label} : {$memory_used}");
133
-        }
134
-    }
135
-
136
-
137
-    /**
138
-     * will display the benchmarking results at shutdown
139
-     *
140
-     * @param bool $formatted
141
-     * @return void
142
-     */
143
-    public static function displayResultsAtShutdown($formatted = true)
144
-    {
145
-        Benchmark::resetOutput();
146
-        add_action(
147
-            'shutdown',
148
-            function () use ($formatted) {
149
-                Benchmark::displayResults(true, $formatted);
150
-            },
151
-            999999
152
-        );
153
-    }
154
-
155
-
156
-    /**
157
-     * will display the benchmarking results at shutdown
158
-     *
159
-     * @param string $filepath
160
-     * @param bool   $formatted
161
-     * @param bool   $append
162
-     * @return void
163
-     */
164
-    public static function writeResultsAtShutdown($filepath = '', $formatted = true, $append = true)
165
-    {
166
-        Benchmark::resetOutput();
167
-        add_action(
168
-            'shutdown',
169
-            function () use ($filepath, $formatted, $append) {
170
-                Benchmark::writeResultsToFile($filepath, $formatted, $append);
171
-            },
172
-            999999
173
-        );
174
-    }
175
-
176
-
177
-    /**
178
-     * @param bool $formatted
179
-     * @return string
180
-     */
181
-    private static function generateResults($formatted = true)
182
-    {
183
-        if (Benchmark::doNotRun()) {
184
-            return '';
185
-        }
186
-        if (! empty(Benchmark::$times)) {
187
-            $total = 0;
188
-            Benchmark::$output .= $formatted
189
-                ? '<span style="color:#999999; font-size:.8em;">( time in milliseconds )</span><br />'
190
-                : '';
191
-            foreach (Benchmark::$times as $timer_name => $total_time) {
192
-                Benchmark::$output .= Benchmark::formatTime($timer_name, $total_time, $formatted);
193
-                Benchmark::$output .= $formatted ? '<br />' : "\n";
194
-                $total += $total_time;
195
-            }
196
-            if ($formatted) {
197
-                Benchmark::$output .= '<br />';
198
-                Benchmark::$output .= '<h4>TOTAL TIME</h4>';
199
-                Benchmark::$output .= Benchmark::formatTime('', $total, $formatted);
200
-                Benchmark::$output .= '<span style="color:#999999; font-size:.8em;"> milliseconds</span><br />';
201
-                Benchmark::$output .= '<br />';
202
-                Benchmark::$output .= '<h5>Performance scale (from best to worse)</h5>';
203
-                Benchmark::$output .= '<span style="color:mediumpurple">Like wow! How about a Scooby snack?</span><br />';
204
-                Benchmark::$output .= '<span style="color:deepskyblue">Like...no way man!</span><br />';
205
-                Benchmark::$output .= '<span style="color:limegreen">Like...groovy!</span><br />';
206
-                Benchmark::$output .= '<span style="color:gold">Ruh Oh</span><br />';
207
-                Benchmark::$output .= '<span style="color:darkorange">Zoinks!</span><br />';
208
-                Benchmark::$output .= '<span style="color:red">Like...HEEELLLP</span><br />';
209
-            }
210
-        }
211
-        if (! empty(Benchmark::$memory_usage)) {
212
-            Benchmark::$output .= $formatted
213
-                ? '<h5>Memory</h5>'
214
-                : "\nMemory";
215
-            foreach (Benchmark::$memory_usage as $label => $memory_usage) {
216
-                Benchmark::$output .= $formatted
217
-                    ? "<br />{$memory_usage} : {$label}"
218
-                    : "\n{$memory_usage} : {$label}";
219
-            }
220
-        }
221
-        if (empty(Benchmark::$output)) {
222
-            return '';
223
-        }
224
-        Benchmark::$output = $formatted
225
-            ? '<div style="border:1px solid #dddddd; background-color:#ffffff;'
226
-              . (is_admin()
227
-                ? ' margin:2em 2em 2em 180px;'
228
-                : ' margin:2em;')
229
-              . ' padding:2em;">'
230
-              . '<h4>BENCHMARKING</h4>'
231
-              . Benchmark::$output
232
-              . '</div>'
233
-            : Benchmark::$output;
234
-        return Benchmark::$output;
235
-    }
236
-
237
-
238
-    /**
239
-     * @param bool $echo
240
-     * @param bool $formatted
241
-     * @return string
242
-     */
243
-    public static function displayResults($echo = true, $formatted = true)
244
-    {
245
-        $results = Benchmark::generateResults($formatted);
246
-        if ($echo) {
247
-            echo wp_kses($results, AllowedTags::getWithFormTags());
248
-            return '';
249
-        }
250
-        return $results;
251
-    }
252
-
253
-
254
-    /**
255
-     * @param string $filepath
256
-     * @param bool   $formatted
257
-     * @param bool   $append
258
-     * @throws EE_Error
259
-     */
260
-    public static function writeResultsToFile($filepath = '', $formatted = true, $append = true)
261
-    {
262
-        $filepath = ! empty($filepath) && is_readable(dirname($filepath))
263
-            ? $filepath
264
-            : '';
265
-        if (empty($filepath)) {
266
-            $filepath = EVENT_ESPRESSO_UPLOAD_DIR . 'logs/benchmarking-' . date('Y-m-d') . '.html';
267
-        }
268
-        EEH_File::ensure_file_exists_and_is_writable($filepath);
269
-        file_put_contents(
270
-            $filepath,
271
-            "\n" . date('Y-m-d H:i:s') . Benchmark::generateResults($formatted),
272
-            $append ? FILE_APPEND | LOCK_EX : LOCK_EX
273
-        );
274
-    }
275
-
276
-
277
-    /**
278
-     * Converts a measure of memory bytes into the most logical units (eg kb, mb, etc)
279
-     *
280
-     * @param int $size
281
-     * @return string
282
-     */
283
-    public static function convert($size)
284
-    {
285
-        $unit = array('b', 'kb', 'mb', 'gb', 'tb', 'pb');
286
-        return round(
287
-            $size / pow(1024, $i = floor(log($size, 1024))),
288
-            2
289
-        ) . ' ' . $unit[ absint($i) ];
290
-    }
291
-
292
-
293
-    /**
294
-     * @param string $timer_name
295
-     * @param float  $total_time
296
-     * @param bool   $formatted
297
-     * @return string
298
-     */
299
-    public static function formatTime($timer_name, $total_time, $formatted = true)
300
-    {
301
-        $total_time *= 1000;
302
-        switch ($total_time) {
303
-            case $total_time > 12500:
304
-                $color = 'red';
305
-                $bold = 'bold';
306
-                break;
307
-            case $total_time > 2500:
308
-                $color = 'darkorange';
309
-                $bold = 'bold';
310
-                break;
311
-            case $total_time > 500:
312
-                $color = 'gold';
313
-                $bold = 'bold';
314
-                break;
315
-            case $total_time > 100:
316
-                $color = 'limegreen';
317
-                $bold = 'normal';
318
-                break;
319
-            case $total_time > 20:
320
-                $color = 'deepskyblue';
321
-                $bold = 'normal';
322
-                break;
323
-            default:
324
-                $color = 'mediumpurple';
325
-                $bold = 'normal';
326
-                break;
327
-        }
328
-        return $formatted
329
-            ? '<span style="min-width: 10px; margin:0 1em; color:'
330
-              . $color
331
-              . '; font-weight:'
332
-              . $bold
333
-              . '; font-size:1.2em;">'
334
-              . str_pad(number_format($total_time, 3), 9, '0', STR_PAD_LEFT)
335
-              . '</span> '
336
-              . $timer_name
337
-            : str_pad(number_format($total_time, 3), 9, '0', STR_PAD_LEFT);
338
-    }
19
+	/**
20
+	 * @var string $output
21
+	 */
22
+	private static $output;
23
+
24
+	/**
25
+	 * @var array $start_times array containing the start time for the timers
26
+	 */
27
+	private static $start_times;
28
+
29
+	/**
30
+	 * @var array $times array containing all the timer'd times, which can be outputted via show_times()
31
+	 */
32
+	private static $times = array();
33
+
34
+	/**
35
+	 * @var array $memory_usage
36
+	 */
37
+	protected static $memory_usage = array();
38
+
39
+
40
+	/**
41
+	 * @param string $output
42
+	 * @param bool   $formatted
43
+	 */
44
+	public static function addOutput($output, $formatted = true)
45
+	{
46
+		Benchmark::$output .= $formatted
47
+			? "<br />{$output}"
48
+			: "\n{$output}";
49
+	}
50
+
51
+
52
+	/**
53
+	 * @return void
54
+	 */
55
+	public static function resetOutput()
56
+	{
57
+		Benchmark::$output = '';
58
+	}
59
+
60
+	/**
61
+	 * whether to benchmark code or not
62
+	 */
63
+	public static function doNotRun()
64
+	{
65
+		return ! WP_DEBUG || (defined('DOING_AJAX') && DOING_AJAX);
66
+	}
67
+
68
+
69
+	/**
70
+	 * resetTimes
71
+	 */
72
+	public static function resetTimes()
73
+	{
74
+		Benchmark::$times = array();
75
+	}
76
+
77
+
78
+	/**
79
+	 * Add Benchmark::startTimer() before a block of code you want to measure the performance of
80
+	 *
81
+	 * @param null $timer_name
82
+	 */
83
+	public static function startTimer($timer_name = null)
84
+	{
85
+		if (Benchmark::doNotRun()) {
86
+			return;
87
+		}
88
+		$timer_name = $timer_name !== '' ? $timer_name : get_called_class();
89
+		Benchmark::$start_times[ $timer_name ] = microtime(true);
90
+	}
91
+
92
+
93
+	/**
94
+	 * Add Benchmark::stopTimer() after a block of code you want to measure the performance of
95
+	 *
96
+	 * @param string $timer_name
97
+	 */
98
+	public static function stopTimer($timer_name = '')
99
+	{
100
+		if (Benchmark::doNotRun()) {
101
+			return;
102
+		}
103
+		$timer_name = $timer_name !== '' ? $timer_name : get_called_class();
104
+		if (isset(Benchmark::$start_times[ $timer_name ])) {
105
+			$start_time = Benchmark::$start_times[ $timer_name ];
106
+			unset(Benchmark::$start_times[ $timer_name ]);
107
+		} else {
108
+			$start_time = array_pop(Benchmark::$start_times);
109
+		}
110
+		Benchmark::$times[ $timer_name ] = number_format(microtime(true) - $start_time, 8);
111
+	}
112
+
113
+
114
+	/**
115
+	 * Measure the memory usage by PHP so far.
116
+	 *
117
+	 * @param string  $label      The label to show for this time eg "Start of calling Some_Class::some_function"
118
+	 * @param boolean $output_now whether to echo now, or wait until EEH_Debug_Tools::show_times() is called
119
+	 * @param bool    $formatted
120
+	 * @return void
121
+	 */
122
+	public static function measureMemory($label = 'memory usage', $output_now = false, $formatted = true)
123
+	{
124
+		if (Benchmark::doNotRun()) {
125
+			return;
126
+		}
127
+		$memory_used = Benchmark::convert(memory_get_usage(true));
128
+		Benchmark::$memory_usage[ $label ] = $memory_used;
129
+		if ($output_now) {
130
+			echo ($formatted
131
+				? "<br>{$label} : {$memory_used}"
132
+				: "\n {$label} : {$memory_used}");
133
+		}
134
+	}
135
+
136
+
137
+	/**
138
+	 * will display the benchmarking results at shutdown
139
+	 *
140
+	 * @param bool $formatted
141
+	 * @return void
142
+	 */
143
+	public static function displayResultsAtShutdown($formatted = true)
144
+	{
145
+		Benchmark::resetOutput();
146
+		add_action(
147
+			'shutdown',
148
+			function () use ($formatted) {
149
+				Benchmark::displayResults(true, $formatted);
150
+			},
151
+			999999
152
+		);
153
+	}
154
+
155
+
156
+	/**
157
+	 * will display the benchmarking results at shutdown
158
+	 *
159
+	 * @param string $filepath
160
+	 * @param bool   $formatted
161
+	 * @param bool   $append
162
+	 * @return void
163
+	 */
164
+	public static function writeResultsAtShutdown($filepath = '', $formatted = true, $append = true)
165
+	{
166
+		Benchmark::resetOutput();
167
+		add_action(
168
+			'shutdown',
169
+			function () use ($filepath, $formatted, $append) {
170
+				Benchmark::writeResultsToFile($filepath, $formatted, $append);
171
+			},
172
+			999999
173
+		);
174
+	}
175
+
176
+
177
+	/**
178
+	 * @param bool $formatted
179
+	 * @return string
180
+	 */
181
+	private static function generateResults($formatted = true)
182
+	{
183
+		if (Benchmark::doNotRun()) {
184
+			return '';
185
+		}
186
+		if (! empty(Benchmark::$times)) {
187
+			$total = 0;
188
+			Benchmark::$output .= $formatted
189
+				? '<span style="color:#999999; font-size:.8em;">( time in milliseconds )</span><br />'
190
+				: '';
191
+			foreach (Benchmark::$times as $timer_name => $total_time) {
192
+				Benchmark::$output .= Benchmark::formatTime($timer_name, $total_time, $formatted);
193
+				Benchmark::$output .= $formatted ? '<br />' : "\n";
194
+				$total += $total_time;
195
+			}
196
+			if ($formatted) {
197
+				Benchmark::$output .= '<br />';
198
+				Benchmark::$output .= '<h4>TOTAL TIME</h4>';
199
+				Benchmark::$output .= Benchmark::formatTime('', $total, $formatted);
200
+				Benchmark::$output .= '<span style="color:#999999; font-size:.8em;"> milliseconds</span><br />';
201
+				Benchmark::$output .= '<br />';
202
+				Benchmark::$output .= '<h5>Performance scale (from best to worse)</h5>';
203
+				Benchmark::$output .= '<span style="color:mediumpurple">Like wow! How about a Scooby snack?</span><br />';
204
+				Benchmark::$output .= '<span style="color:deepskyblue">Like...no way man!</span><br />';
205
+				Benchmark::$output .= '<span style="color:limegreen">Like...groovy!</span><br />';
206
+				Benchmark::$output .= '<span style="color:gold">Ruh Oh</span><br />';
207
+				Benchmark::$output .= '<span style="color:darkorange">Zoinks!</span><br />';
208
+				Benchmark::$output .= '<span style="color:red">Like...HEEELLLP</span><br />';
209
+			}
210
+		}
211
+		if (! empty(Benchmark::$memory_usage)) {
212
+			Benchmark::$output .= $formatted
213
+				? '<h5>Memory</h5>'
214
+				: "\nMemory";
215
+			foreach (Benchmark::$memory_usage as $label => $memory_usage) {
216
+				Benchmark::$output .= $formatted
217
+					? "<br />{$memory_usage} : {$label}"
218
+					: "\n{$memory_usage} : {$label}";
219
+			}
220
+		}
221
+		if (empty(Benchmark::$output)) {
222
+			return '';
223
+		}
224
+		Benchmark::$output = $formatted
225
+			? '<div style="border:1px solid #dddddd; background-color:#ffffff;'
226
+			  . (is_admin()
227
+				? ' margin:2em 2em 2em 180px;'
228
+				: ' margin:2em;')
229
+			  . ' padding:2em;">'
230
+			  . '<h4>BENCHMARKING</h4>'
231
+			  . Benchmark::$output
232
+			  . '</div>'
233
+			: Benchmark::$output;
234
+		return Benchmark::$output;
235
+	}
236
+
237
+
238
+	/**
239
+	 * @param bool $echo
240
+	 * @param bool $formatted
241
+	 * @return string
242
+	 */
243
+	public static function displayResults($echo = true, $formatted = true)
244
+	{
245
+		$results = Benchmark::generateResults($formatted);
246
+		if ($echo) {
247
+			echo wp_kses($results, AllowedTags::getWithFormTags());
248
+			return '';
249
+		}
250
+		return $results;
251
+	}
252
+
253
+
254
+	/**
255
+	 * @param string $filepath
256
+	 * @param bool   $formatted
257
+	 * @param bool   $append
258
+	 * @throws EE_Error
259
+	 */
260
+	public static function writeResultsToFile($filepath = '', $formatted = true, $append = true)
261
+	{
262
+		$filepath = ! empty($filepath) && is_readable(dirname($filepath))
263
+			? $filepath
264
+			: '';
265
+		if (empty($filepath)) {
266
+			$filepath = EVENT_ESPRESSO_UPLOAD_DIR . 'logs/benchmarking-' . date('Y-m-d') . '.html';
267
+		}
268
+		EEH_File::ensure_file_exists_and_is_writable($filepath);
269
+		file_put_contents(
270
+			$filepath,
271
+			"\n" . date('Y-m-d H:i:s') . Benchmark::generateResults($formatted),
272
+			$append ? FILE_APPEND | LOCK_EX : LOCK_EX
273
+		);
274
+	}
275
+
276
+
277
+	/**
278
+	 * Converts a measure of memory bytes into the most logical units (eg kb, mb, etc)
279
+	 *
280
+	 * @param int $size
281
+	 * @return string
282
+	 */
283
+	public static function convert($size)
284
+	{
285
+		$unit = array('b', 'kb', 'mb', 'gb', 'tb', 'pb');
286
+		return round(
287
+			$size / pow(1024, $i = floor(log($size, 1024))),
288
+			2
289
+		) . ' ' . $unit[ absint($i) ];
290
+	}
291
+
292
+
293
+	/**
294
+	 * @param string $timer_name
295
+	 * @param float  $total_time
296
+	 * @param bool   $formatted
297
+	 * @return string
298
+	 */
299
+	public static function formatTime($timer_name, $total_time, $formatted = true)
300
+	{
301
+		$total_time *= 1000;
302
+		switch ($total_time) {
303
+			case $total_time > 12500:
304
+				$color = 'red';
305
+				$bold = 'bold';
306
+				break;
307
+			case $total_time > 2500:
308
+				$color = 'darkorange';
309
+				$bold = 'bold';
310
+				break;
311
+			case $total_time > 500:
312
+				$color = 'gold';
313
+				$bold = 'bold';
314
+				break;
315
+			case $total_time > 100:
316
+				$color = 'limegreen';
317
+				$bold = 'normal';
318
+				break;
319
+			case $total_time > 20:
320
+				$color = 'deepskyblue';
321
+				$bold = 'normal';
322
+				break;
323
+			default:
324
+				$color = 'mediumpurple';
325
+				$bold = 'normal';
326
+				break;
327
+		}
328
+		return $formatted
329
+			? '<span style="min-width: 10px; margin:0 1em; color:'
330
+			  . $color
331
+			  . '; font-weight:'
332
+			  . $bold
333
+			  . '; font-size:1.2em;">'
334
+			  . str_pad(number_format($total_time, 3), 9, '0', STR_PAD_LEFT)
335
+			  . '</span> '
336
+			  . $timer_name
337
+			: str_pad(number_format($total_time, 3), 9, '0', STR_PAD_LEFT);
338
+	}
339 339
 }
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
             return;
87 87
         }
88 88
         $timer_name = $timer_name !== '' ? $timer_name : get_called_class();
89
-        Benchmark::$start_times[ $timer_name ] = microtime(true);
89
+        Benchmark::$start_times[$timer_name] = microtime(true);
90 90
     }
91 91
 
92 92
 
@@ -101,13 +101,13 @@  discard block
 block discarded – undo
101 101
             return;
102 102
         }
103 103
         $timer_name = $timer_name !== '' ? $timer_name : get_called_class();
104
-        if (isset(Benchmark::$start_times[ $timer_name ])) {
105
-            $start_time = Benchmark::$start_times[ $timer_name ];
106
-            unset(Benchmark::$start_times[ $timer_name ]);
104
+        if (isset(Benchmark::$start_times[$timer_name])) {
105
+            $start_time = Benchmark::$start_times[$timer_name];
106
+            unset(Benchmark::$start_times[$timer_name]);
107 107
         } else {
108 108
             $start_time = array_pop(Benchmark::$start_times);
109 109
         }
110
-        Benchmark::$times[ $timer_name ] = number_format(microtime(true) - $start_time, 8);
110
+        Benchmark::$times[$timer_name] = number_format(microtime(true) - $start_time, 8);
111 111
     }
112 112
 
113 113
 
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
             return;
126 126
         }
127 127
         $memory_used = Benchmark::convert(memory_get_usage(true));
128
-        Benchmark::$memory_usage[ $label ] = $memory_used;
128
+        Benchmark::$memory_usage[$label] = $memory_used;
129 129
         if ($output_now) {
130 130
             echo ($formatted
131 131
                 ? "<br>{$label} : {$memory_used}"
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
         Benchmark::resetOutput();
146 146
         add_action(
147 147
             'shutdown',
148
-            function () use ($formatted) {
148
+            function() use ($formatted) {
149 149
                 Benchmark::displayResults(true, $formatted);
150 150
             },
151 151
             999999
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
         Benchmark::resetOutput();
167 167
         add_action(
168 168
             'shutdown',
169
-            function () use ($filepath, $formatted, $append) {
169
+            function() use ($filepath, $formatted, $append) {
170 170
                 Benchmark::writeResultsToFile($filepath, $formatted, $append);
171 171
             },
172 172
             999999
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
         if (Benchmark::doNotRun()) {
184 184
             return '';
185 185
         }
186
-        if (! empty(Benchmark::$times)) {
186
+        if ( ! empty(Benchmark::$times)) {
187 187
             $total = 0;
188 188
             Benchmark::$output .= $formatted
189 189
                 ? '<span style="color:#999999; font-size:.8em;">( time in milliseconds )</span><br />'
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
                 Benchmark::$output .= '<span style="color:red">Like...HEEELLLP</span><br />';
209 209
             }
210 210
         }
211
-        if (! empty(Benchmark::$memory_usage)) {
211
+        if ( ! empty(Benchmark::$memory_usage)) {
212 212
             Benchmark::$output .= $formatted
213 213
                 ? '<h5>Memory</h5>'
214 214
                 : "\nMemory";
@@ -263,12 +263,12 @@  discard block
 block discarded – undo
263 263
             ? $filepath
264 264
             : '';
265 265
         if (empty($filepath)) {
266
-            $filepath = EVENT_ESPRESSO_UPLOAD_DIR . 'logs/benchmarking-' . date('Y-m-d') . '.html';
266
+            $filepath = EVENT_ESPRESSO_UPLOAD_DIR.'logs/benchmarking-'.date('Y-m-d').'.html';
267 267
         }
268 268
         EEH_File::ensure_file_exists_and_is_writable($filepath);
269 269
         file_put_contents(
270 270
             $filepath,
271
-            "\n" . date('Y-m-d H:i:s') . Benchmark::generateResults($formatted),
271
+            "\n".date('Y-m-d H:i:s').Benchmark::generateResults($formatted),
272 272
             $append ? FILE_APPEND | LOCK_EX : LOCK_EX
273 273
         );
274 274
     }
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
         return round(
287 287
             $size / pow(1024, $i = floor(log($size, 1024))),
288 288
             2
289
-        ) . ' ' . $unit[ absint($i) ];
289
+        ).' '.$unit[absint($i)];
290 290
     }
291 291
 
292 292
 
Please login to merge, or discard this patch.