diff --git a/src/Codec/StringCodec.php b/src/Codec/StringCodec.php index 7f35206..e74e0e9 100644 --- a/src/Codec/StringCodec.php +++ b/src/Codec/StringCodec.php @@ -121,24 +121,24 @@ class StringCodec implements CodecInterface */ protected function extractComponents($encodedUuid) { - $nameParsed = str_replace(array( + $nameParsed = str_replace([ 'urn:', 'uuid:', '{', '}', '-' - ), '', $encodedUuid); + ], '', $encodedUuid); // We have stripped out the dashes and are breaking up the string using // substr(). In this way, we can accept a full hex value that doesn't // contain dashes. - $components = array( + $components = [ substr($nameParsed, 0, 8), substr($nameParsed, 8, 4), substr($nameParsed, 12, 4), substr($nameParsed, 16, 4), substr($nameParsed, 20) - ); + ]; $nameParsed = implode('-', $components); @@ -158,13 +158,13 @@ class StringCodec implements CodecInterface */ protected function getFields(array $components) { - return array( + return [ 'time_low' => str_pad($components[0], 8, '0', STR_PAD_LEFT), 'time_mid' => str_pad($components[1], 4, '0', STR_PAD_LEFT), 'time_hi_and_version' => str_pad($components[2], 4, '0', STR_PAD_LEFT), 'clock_seq_hi_and_reserved' => str_pad(substr($components[3], 0, 2), 2, '0', STR_PAD_LEFT), 'clock_seq_low' => str_pad(substr($components[3], 2), 2, '0', STR_PAD_LEFT), 'node' => str_pad($components[4], 12, '0', STR_PAD_LEFT) - ); + ]; } } diff --git a/src/Converter/Time/BigNumberTimeConverter.php b/src/Converter/Time/BigNumberTimeConverter.php index d47c801..eb57b1c 100644 --- a/src/Converter/Time/BigNumberTimeConverter.php +++ b/src/Converter/Time/BigNumberTimeConverter.php @@ -49,10 +49,10 @@ class BigNumberTimeConverter implements TimeConverterInterface $uuidTimeHex = sprintf('%016s', $uuidTime->convertToBase(16)); - return array( + return [ 'low' => substr($uuidTimeHex, 8), 'mid' => substr($uuidTimeHex, 4, 4), 'hi' => substr($uuidTimeHex, 0, 4), - ); + ]; } } diff --git a/src/Converter/Time/PhpTimeConverter.php b/src/Converter/Time/PhpTimeConverter.php index 6a9da74..57c882d 100644 --- a/src/Converter/Time/PhpTimeConverter.php +++ b/src/Converter/Time/PhpTimeConverter.php @@ -38,10 +38,10 @@ class PhpTimeConverter implements TimeConverterInterface // UUID epoch 1582-10-15 00:00:00 and the Unix epoch 1970-01-01 00:00:00. $uuidTime = ($seconds * 10000000) + ($microSeconds * 10) + 0x01b21dd213814000; - return array( + return [ 'low' => sprintf('%08x', $uuidTime & 0xffffffff), 'mid' => sprintf('%04x', ($uuidTime >> 32) & 0xffff), 'hi' => sprintf('%04x', ($uuidTime >> 48) & 0x0fff), - ); + ]; } } diff --git a/src/Generator/DefaultTimeGenerator.php b/src/Generator/DefaultTimeGenerator.php index c9969b3..5abb631 100644 --- a/src/Generator/DefaultTimeGenerator.php +++ b/src/Generator/DefaultTimeGenerator.php @@ -96,14 +96,14 @@ class DefaultTimeGenerator implements TimeGeneratorInterface $hex = vsprintf( '%08s%04s%04s%02s%02s%012s', - array( + [ $uuidTime['low'], $uuidTime['mid'], sprintf('%04x', $timeHi), sprintf('%02x', $clockSeqHi), sprintf('%02x', $clockSeq & 0xff), $node, - ) + ] ); return hex2bin($hex); diff --git a/src/Provider/Node/SystemNodeProvider.php b/src/Provider/Node/SystemNodeProvider.php index ae6a09e..913815b 100644 --- a/src/Provider/Node/SystemNodeProvider.php +++ b/src/Provider/Node/SystemNodeProvider.php @@ -36,7 +36,7 @@ class SystemNodeProvider implements NodeProviderInterface } $pattern = '/[^:]([0-9A-Fa-f]{2}([:-])[0-9A-Fa-f]{2}(\2[0-9A-Fa-f]{2}){4})[^:]/'; - $matches = array(); + $matches = []; // first try a linux specific way $node = $this->getSysfs(); diff --git a/src/Uuid.php b/src/Uuid.php index fd4a8d3..71bcaec 100644 --- a/src/Uuid.php +++ b/src/Uuid.php @@ -140,14 +140,14 @@ class Uuid implements UuidInterface * @var array * @see UuidInterface::getFieldsHex() */ - protected $fields = array( + protected $fields = [ 'time_low' => '00000000', 'time_mid' => '0000', 'time_hi_and_version' => '0000', 'clock_seq_hi_and_reserved' => '00', 'clock_seq_low' => '00', 'node' => '000000000000', - ); + ]; /** * The number converter to use for converting hex values to/from integers. @@ -368,14 +368,14 @@ class Uuid implements UuidInterface */ public function getFields() { - return array( + return [ 'time_low' => $this->getTimeLow(), 'time_mid' => $this->getTimeMid(), 'time_hi_and_version' => $this->getTimeHiAndVersion(), 'clock_seq_hi_and_reserved' => $this->getClockSeqHiAndReserved(), 'clock_seq_low' => $this->getClockSeqLow(), 'node' => $this->getNode(), - ); + ]; } public function getFieldsHex() diff --git a/src/UuidFactory.php b/src/UuidFactory.php index 99644d4..df5d8bf 100644 --- a/src/UuidFactory.php +++ b/src/UuidFactory.php @@ -300,14 +300,14 @@ class UuidFactory implements UuidFactoryInterface $timeHi = BinaryUtils::applyVersion(substr($hash, 12, 4), $version); $clockSeqHi = BinaryUtils::applyVariant(hexdec(substr($hash, 16, 2))); - $fields = array( + $fields = [ 'time_low' => substr($hash, 0, 8), 'time_mid' => substr($hash, 8, 4), 'time_hi_and_version' => str_pad(dechex($timeHi), 4, '0', STR_PAD_LEFT), 'clock_seq_hi_and_reserved' => str_pad(dechex($clockSeqHi), 2, '0', STR_PAD_LEFT), 'clock_seq_low' => substr($hash, 18, 2), 'node' => substr($hash, 20, 12), - ); + ]; return $this->uuid($fields); }