X-Git-Url: http://git.cyclocoop.org/%28?a=blobdiff_plain;f=includes%2Flibs%2FTiming.php;h=65a924795acd64edb19b1d9a45a9d9c71169ccb4;hb=46b361d7431d71c86f8c34f5e43549426dd67fb7;hp=7b1a9140dfb43467030f52eb2d931e52856ee11e;hpb=305a056dac55de31f00aee05b8c5cd7bfeec88a6;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/libs/Timing.php b/includes/libs/Timing.php index 7b1a9140df..65a924795a 100644 --- a/includes/libs/Timing.php +++ b/includes/libs/Timing.php @@ -52,7 +52,7 @@ class Timing implements LoggerAwareInterface { public function __construct( array $params = [] ) { $this->clearMarks(); - $this->setLogger( isset( $params['logger'] ) ? $params['logger'] : new NullLogger() ); + $this->setLogger( $params['logger'] ?? new NullLogger() ); } /** @@ -83,7 +83,7 @@ class Timing implements LoggerAwareInterface { } /** - * @param string $markName The name of the mark that should + * @param string|null $markName The name of the mark that should * be cleared. If not specified, all marks will be cleared. */ public function clearMarks( $markName = null ) { @@ -117,7 +117,7 @@ class Timing implements LoggerAwareInterface { * * @param string $measureName * @param string $startMark - * @param string $endMark + * @param string|null $endMark * @return array|bool The measure that has been created, or false if either * the start mark or the end mark do not exist. */ @@ -155,7 +155,7 @@ class Timing implements LoggerAwareInterface { */ private function sortEntries() { uasort( $this->entries, function ( $a, $b ) { - return 10000 * ( $a['startTime'] - $b['startTime'] ); + return $a['startTime'] <=> $b['startTime']; } ); } @@ -188,6 +188,6 @@ class Timing implements LoggerAwareInterface { * @return array|null Entry named $name or null if it does not exist. */ public function getEntryByName( $name ) { - return isset( $this->entries[$name] ) ? $this->entries[$name] : null; + return $this->entries[$name] ?? null; } }