Skip to content

Commit

Permalink
style: resolve style guide violations
Browse files Browse the repository at this point in the history
  • Loading branch information
alfonsobries authored and actions-user committed Jul 15, 2024
1 parent 57e0916 commit 958e62a
Show file tree
Hide file tree
Showing 33 changed files with 173 additions and 163 deletions.
1 change: 1 addition & 0 deletions .php-cs-fixer.cache

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/Binary/Buffer/Reader/Buffer.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public static function fromHex(string $value): self
*
* @param int $value
*
* @return \ArkEcosystem\Crypto\Binary\Buffer\Reader\Buffer
* @return Buffer
*/
public function position(int $value): self
{
Expand All @@ -79,7 +79,7 @@ public function position(int $value): self
*
* @param int $value
*
* @return \ArkEcosystem\Crypto\Binary\Buffer\Reader\Buffer
* @return Buffer
*/
public function skip(int $value): self
{
Expand Down
47 changes: 25 additions & 22 deletions src/ByteBuffer/ByteBuffer.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@
*/
class ByteBuffer
{
use Concerns\Initialisable,
Concerns\Offsetable,
Concerns\Positionable,
Concerns\Readable,
Concerns\Sizeable,
Concerns\Transformable,
Concerns\Writeable;
use Concerns\Initialisable;
use Concerns\Offsetable;
use Concerns\Positionable;
use Concerns\Readable;
use Concerns\Sizeable;
use Concerns\Transformable;
use Concerns\Writeable;

/**
* Backing ArrayBuffer.
Expand Down Expand Up @@ -66,14 +66,17 @@ private function __construct($value)
switch (gettype($value)) {
case 'array':
$this->initializeBuffer(count($value), $value);

break;

case 'integer':
$this->initializeBuffer($value, pack("x{$value}"));

break;

case 'string':
$this->initializeBuffer(strlen($value), $value);

break;

default:
Expand Down Expand Up @@ -131,7 +134,7 @@ public function __unset($offset)
*
* @param array|string|int $value
*
* @return \ArkEcosystem\Crypto\ByteBuffer\ByteBuffer
* @return ByteBuffer
*/
public static function new($value): self
{
Expand All @@ -143,7 +146,7 @@ public static function new($value): self
*
* @param int $capacity
*
* @return \ArkEcosystem\Crypto\ByteBuffer\ByteBuffer
* @return ByteBuffer
*/
public static function allocate(int $capacity): self
{
Expand Down Expand Up @@ -176,7 +179,7 @@ public function initializeBuffer(int $length, $content): void
* @param string|int $value
* @param int $offset
*
* @return \ArkEcosystem\Crypto\ByteBuffer\ByteBuffer
* @return ByteBuffer
*/
public function pack(string $format, $value, int $offset): self
{
Expand Down Expand Up @@ -227,7 +230,7 @@ public function get(int $offset)
*
* @param array $buffers
*
* @return \ArkEcosystem\Crypto\ByteBuffer\ByteBuffer
* @return ByteBuffer
*/
public static function concat(...$buffers): self
{
Expand All @@ -246,7 +249,7 @@ public static function concat(...$buffers): self
* @param mixed $value
* @param int $offset
*
* @return \ArkEcosystem\Crypto\ByteBuffer\ByteBuffer
* @return ByteBuffer
*/
public function append($value, int $offset = 0): self
{
Expand All @@ -270,10 +273,10 @@ public function append($value, int $offset = 0): self
/**
* Appends this ByteBuffers contents to another ByteBuffer.
*
* @param \ArkEcosystem\Crypto\ByteBuffer\ByteBuffer $buffer
* @param ByteBuffer $buffer
* @param int $offset
*
* @return \ArkEcosystem\Crypto\ByteBuffer\ByteBuffer
* @return ByteBuffer
*/
public function appendTo(self $buffer, int $offset = 0): self
{
Expand All @@ -286,7 +289,7 @@ public function appendTo(self $buffer, int $offset = 0): self
* @param mixed $value
* @param int $offset
*
* @return \ArkEcosystem\Crypto\ByteBuffer\ByteBuffer
* @return ByteBuffer
*/
public function prepend($value, int $offset = 0): self
{
Expand Down Expand Up @@ -314,10 +317,10 @@ public function prepend($value, int $offset = 0): self
/**
* Prepends this ByteBuffers contents to another ByteBuffer.
*
* @param \ArkEcosystem\Crypto\ByteBuffer\ByteBuffer $buffer
* @param ByteBuffer $buffer
* @param int $offset
*
* @return \ArkEcosystem\Crypto\ByteBuffer\ByteBuffer
* @return ByteBuffer
*/
public function prependTo(self $buffer, int $offset = 0): self
{
Expand All @@ -330,7 +333,7 @@ public function prependTo(self $buffer, int $offset = 0): self
* @param int $length
* @param int $start
*
* @return \ArkEcosystem\Crypto\ByteBuffer\ByteBuffer
* @return ByteBuffer
*/
public function fill(int $length, int $start = 0): self
{
Expand All @@ -351,7 +354,7 @@ public function fill(int $length, int $start = 0): self
* @param int $start
* @param int $length
*
* @return \ArkEcosystem\Crypto\ByteBuffer\ByteBuffer
* @return ByteBuffer
*/
public function flip(int $start = 0, int $length = 0): self
{
Expand All @@ -368,7 +371,7 @@ public function flip(int $start = 0, int $length = 0): self
* @param int $start
* @param int $length
*
* @return \ArkEcosystem\Crypto\ByteBuffer\ByteBuffer
* @return ByteBuffer
*/
public function reverse(int $start = 0, int $length = 0): self
{
Expand All @@ -380,7 +383,7 @@ public function reverse(int $start = 0, int $length = 0): self
*
* @param int $value
*
* @return \ArkEcosystem\Crypto\ByteBuffer\ByteBuffer
* @return ByteBuffer
*/
public function order(int $value): self
{
Expand Down Expand Up @@ -417,7 +420,7 @@ public function slice(int $offset, int $length): array
/**
* Determine if the given value is a ByteBuffer.
*
* @param \ArkEcosystem\Crypto\ByteBuffer\ByteBuffer $buffer
* @param ByteBuffer $buffer
*
* @return bool
*/
Expand Down
6 changes: 3 additions & 3 deletions src/ByteBuffer/ByteOrder.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ class ByteOrder
/**
* Most significant value in the sequence is stored first. Flip no bytes!
*/
const BE = 0;
public const BE = 0;

/**
* Least significant value in the sequence is stored first. Flip bytes!
*/
const LE = 1;
public const LE = 1;

/**
* Let the current machine determine the endianess.
*/
const MB = 2;
public const MB = 2;
}
2 changes: 1 addition & 1 deletion src/ByteBuffer/Concerns/Initialisable.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public static function fromBinary(string $value): self
*/
public static function fromHex(string $value): self
{
if (strlen($value) > 0 && !ctype_xdigit($value)) {
if (strlen($value) > 0 && ! ctype_xdigit($value)) {
throw new InvalidArgumentException('Buffer::hex: non-hex character passed');
}

Expand Down
10 changes: 5 additions & 5 deletions src/ByteBuffer/Concerns/Readable.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
*/
trait Readable
{
use Reads\Floats,
Reads\Hex,
Reads\Integer,
Reads\Strings,
Reads\UnsignedInteger;
use Reads\Floats;
use Reads\Hex;
use Reads\Integer;
use Reads\Strings;
use Reads\UnsignedInteger;
}
10 changes: 5 additions & 5 deletions src/ByteBuffer/Concerns/Writeable.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
*/
trait Writeable
{
use Writes\Floats,
Writes\Hex,
Writes\Integer,
Writes\Strings,
Writes\UnsignedInteger;
use Writes\Floats;
use Writes\Hex;
use Writes\Integer;
use Writes\Strings;
use Writes\UnsignedInteger;
}
4 changes: 2 additions & 2 deletions src/ByteBuffer/LengthMap.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class LengthMap
*
* @var array
*/
const LENGTHS = [
public const LENGTHS = [
// Chars (8 bit)
'c' => 1,
'C' => 1,
Expand Down Expand Up @@ -82,7 +82,7 @@ public static function get(string $format): int
return (int) substr($format, 1) / 2;
}

if (!array_key_exists($format, static::LENGTHS)) {
if (! array_key_exists($format, static::LENGTHS)) {
throw new InvalidArgumentException("The given format [{$format}] is not supported.");
}

Expand Down
6 changes: 3 additions & 3 deletions src/Configuration/Network.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class Network
/**
* The network used for crypto operations.
*
* @var \ArkEcosystem\Crypto\Networks\AbstractNetwork
* @var AbstractNetwork
*/
private static $network;

Expand All @@ -47,7 +47,7 @@ public static function __callStatic(string $method, array $args)
/**
* Get the network used for crypto operations.
*
* @return \ArkEcosystem\Crypto\Networks\AbstractNetwork
* @return AbstractNetwork
*/
public static function get(): AbstractNetwork
{
Expand All @@ -57,7 +57,7 @@ public static function get(): AbstractNetwork
/**
* Set the network used for crypto operations.
*
* @param \ArkEcosystem\Crypto\Networks\AbstractNetwork $network
* @param AbstractNetwork $network
*/
public static function set(AbstractNetwork $network): void
{
Expand Down
22 changes: 11 additions & 11 deletions src/Enums/Fees.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,25 +20,25 @@
*/
class Fees
{
const TRANSFER = '10000000';
public const TRANSFER = '10000000';

const SECOND_SIGNATURE_REGISTRATION = '500000000';
public const SECOND_SIGNATURE_REGISTRATION = '500000000';

const DELEGATE_REGISTRATION = '2500000000';
public const DELEGATE_REGISTRATION = '2500000000';

const VOTE = '100000000';
public const VOTE = '100000000';

const MULTI_SIGNATURE_REGISTRATION = '500000000';
public const MULTI_SIGNATURE_REGISTRATION = '500000000';

const IPFS = '500000000';
public const IPFS = '500000000';

const MULTI_PAYMENT = '10000000';
public const MULTI_PAYMENT = '10000000';

const DELEGATE_RESIGNATION = '2500000000';
public const DELEGATE_RESIGNATION = '2500000000';

const HTLC_LOCK = '10000000';
public const HTLC_LOCK = '10000000';

const HTLC_CLAIM = '0';
public const HTLC_CLAIM = '0';

const HTLC_REFUND = '0';
public const HTLC_REFUND = '0';
}
6 changes: 3 additions & 3 deletions src/Enums/TypeGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
*/
class TypeGroup
{
const TEST = 0;
public const TEST = 0;

const CORE = 1;
public const CORE = 1;

const RESERVED = 1000; // Everything above is available to anyone
public const RESERVED = 1000; // Everything above is available to anyone
}
22 changes: 11 additions & 11 deletions src/Enums/Types.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,25 +20,25 @@
*/
class Types
{
const TRANSFER = 0;
public const TRANSFER = 0;

const SECOND_SIGNATURE_REGISTRATION = 1;
public const SECOND_SIGNATURE_REGISTRATION = 1;

const DELEGATE_REGISTRATION = 2;
public const DELEGATE_REGISTRATION = 2;

const VOTE = 3;
public const VOTE = 3;

const MULTI_SIGNATURE_REGISTRATION = 4;
public const MULTI_SIGNATURE_REGISTRATION = 4;

const IPFS = 5;
public const IPFS = 5;

const MULTI_PAYMENT = 6;
public const MULTI_PAYMENT = 6;

const DELEGATE_RESIGNATION = 7;
public const DELEGATE_RESIGNATION = 7;

const HTLC_LOCK = 8;
public const HTLC_LOCK = 8;

const HTLC_CLAIM = 9;
public const HTLC_CLAIM = 9;

const HTLC_REFUND = 10;
public const HTLC_REFUND = 10;
}
2 changes: 1 addition & 1 deletion src/Helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class Helpers
/**
* Get the network version.
*
* @param \ArkEcosystem\Crypto\Networks\AbstractNetwork|int $network
* @param Networks\AbstractNetwork|int $network
*
* @return int
*/
Expand Down
Loading

0 comments on commit 958e62a

Please sign in to comment.