X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Flibs%2FTiming.php;h=57c253d50e332e25ead79bce574b14143c1eaa6b;hb=d36d987c4ee02b7793ae579b43d2d0acd0241d6b;hp=00ceda3e7818ccc4494a400bb32a92b8a254c6ba;hpb=d9a34ea8c09f790f557ea3017fe8c6ad1dca68ff;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/libs/Timing.php b/includes/libs/Timing.php index 00ceda3e78..57c253d50e 100644 --- a/includes/libs/Timing.php +++ b/includes/libs/Timing.php @@ -36,21 +36,21 @@ use Psr\Log\NullLogger; * getEntryByName(). * * The in-line documentation incorporates content from the User Timing Specification - * http://www.w3.org/TR/user-timing/ + * https://www.w3.org/TR/user-timing/ * Copyright © 2013 World Wide Web Consortium, (MIT, ERCIM, Keio, Beihang). - * http://www.w3.org/Consortium/Legal/2015/doc-license + * https://www.w3.org/Consortium/Legal/2015/doc-license * * @since 1.27 */ class Timing implements LoggerAwareInterface { /** @var array[] */ - private $entries = array(); + private $entries = []; /** @var LoggerInterface */ protected $logger; - public function __construct( array $params = array() ) { + public function __construct( array $params = [] ) { $this->clearMarks(); $this->setLogger( isset( $params['logger'] ) ? $params['logger'] : new NullLogger() ); } @@ -73,12 +73,12 @@ class Timing implements LoggerAwareInterface { * @return array The mark that has been created. */ public function mark( $markName ) { - $this->entries[$markName] = array( + $this->entries[$markName] = [ 'name' => $markName, 'entryType' => 'mark', 'startTime' => microtime( true ), 'duration' => 0, - ); + ]; return $this->entries[$markName]; } @@ -90,16 +90,16 @@ class Timing implements LoggerAwareInterface { if ( $markName !== null ) { unset( $this->entries[$markName] ); } else { - $this->entries = array( - 'requestStart' => array( + $this->entries = [ + 'requestStart' => [ 'name' => 'requestStart', 'entryType' => 'mark', 'startTime' => isset( $_SERVER['REQUEST_TIME_FLOAT'] ) ? $_SERVER['REQUEST_TIME_FLOAT'] : $_SERVER['REQUEST_TIME'], 'duration' => 0, - ), - ); + ], + ]; } } @@ -142,12 +142,12 @@ class Timing implements LoggerAwareInterface { $endTime = microtime( true ); } - $this->entries[$measureName] = array( + $this->entries[$measureName] = [ 'name' => $measureName, 'entryType' => 'measure', 'startTime' => $startTime, 'duration' => $endTime - $startTime, - ); + ]; return $this->entries[$measureName]; } @@ -176,7 +176,7 @@ class Timing implements LoggerAwareInterface { */ public function getEntriesByType( $entryType ) { $this->sortEntries(); - $entries = array(); + $entries = []; foreach ( $this->entries as $entry ) { if ( $entry['entryType'] === $entryType ) { $entries[] = $entry;