Merge "Improve docs for Title::getInternalURL/getCanonicalURL"
[lhc/web/wiklou.git] / includes / profiler / output / ProfilerOutputText.php
index 100304f..95b5ff9 100644 (file)
@@ -33,10 +33,13 @@ class ProfilerOutputText extends ProfilerOutput {
 
        function __construct( Profiler $collector, array $params ) {
                parent::__construct( $collector, $params );
-               $this->thresholdMs = isset( $params['thresholdMs'] )
-                       ? $params['thresholdMs']
-                       : 1.0;
+               $this->thresholdMs = $params['thresholdMs'] ?? 1.0;
        }
+
+       public function logsToOutput() {
+               return true;
+       }
+
        public function log( array $stats ) {
                if ( $this->collector->getTemplated() ) {
                        $out = '';
@@ -48,7 +51,7 @@ class ProfilerOutputText extends ProfilerOutput {
                        } );
                        // Sort descending by time elapsed
                        usort( $stats, function ( $a, $b ) {
-                               return $a['real'] < $b['real'];
+                               return $b['real'] <=> $a['real'];
                        } );
 
                        array_walk( $stats,
@@ -62,8 +65,7 @@ class ProfilerOutputText extends ProfilerOutput {
                        if ( wfIsCLI() ) {
                                print "<!--\n{$out}\n-->\n";
                        } elseif ( $contentType === 'text/html' ) {
-                               $visible = isset( $this->params['visible'] ) ?
-                                       $this->params['visible'] : false;
+                               $visible = $this->params['visible'] ?? false;
                                if ( $visible ) {
                                        print "<pre>{$out}</pre>";
                                } else {