* 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() );
}
* @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];
}
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,
- ),
- );
+ ],
+ ];
}
}
$endTime = microtime( true );
}
- $this->entries[$measureName] = array(
+ $this->entries[$measureName] = [
'name' => $measureName,
'entryType' => 'measure',
'startTime' => $startTime,
'duration' => $endTime - $startTime,
- );
+ ];
return $this->entries[$measureName];
}
*/
public function getEntriesByType( $entryType ) {
$this->sortEntries();
- $entries = array();
+ $entries = [];
foreach ( $this->entries as $entry ) {
if ( $entry['entryType'] === $entryType ) {
$entries[] = $entry;