Passed
Push — master ( b4e552...a91d54 )
by y
03:05
created
src/Reactor.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
      * @param ReactiveInterface $socket
23 23
      * @return $this
24 24
      */
25
-    public function add (ReactiveInterface $socket) {
25
+    public function add(ReactiveInterface $socket) {
26 26
         $this->sockets[$socket->getId()] = $socket;
27 27
         return $this;
28 28
     }
@@ -32,14 +32,14 @@  discard block
 block discarded – undo
32 32
      *
33 33
      * @return int
34 34
      */
35
-    public function count () {
35
+    public function count() {
36 36
         return count($this->sockets);
37 37
     }
38 38
 
39 39
     /**
40 40
      * @return SocketInterface[]
41 41
      */
42
-    public function getSockets () {
42
+    public function getSockets() {
43 43
         return $this->sockets;
44 44
     }
45 45
 
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
      * @throws Error
51 51
      * @return int Number of sockets that reacted.
52 52
      */
53
-    public function react ($timeout = null) {
53
+    public function react($timeout = null) {
54 54
         /** @var ReactiveInterface[][] $rwe */
55 55
         $rwe = [$this->sockets, [], $this->sockets];
56 56
         $count = AbstractSocket::select($rwe[0], $rwe[1], $rwe[2], $timeout);
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
      * @param int $id
70 70
      * @return $this
71 71
      */
72
-    public function remove ($id) {
72
+    public function remove($id) {
73 73
         unset($this->sockets[$id]);
74 74
         return $this;
75 75
     }
Please login to merge, or discard this patch.
src/Error.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
      * @param resource $resource PHP socket resource, or `null` for the global error.
28 28
      * @return int If the resource is closed or not a socket, `SOCKET_EBADF` is returned.
29 29
      */
30
-    public static function getLast ($resource = null) {
30
+    public static function getLast($resource = null) {
31 31
         if (isset($resource)) {
32 32
             if (@get_resource_type($resource) !== 'Socket') {
33 33
                 return SOCKET_EBADF;
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
      *     PHP's last suppressed warning is used for the message.
54 54
      *
55 55
      */
56
-    public function __construct ($subject = null, $fallback = 0) {
56
+    public function __construct($subject = null, $fallback = 0) {
57 57
         if (is_int($subject)) {
58 58
             $errno = $subject;
59 59
         }
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
     /**
74 74
      * @return mixed
75 75
      */
76
-    public function getExtra () {
76
+    public function getExtra() {
77 77
         return $this->extra;
78 78
     }
79 79
 
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
      * @param mixed $extra
82 82
      * @return $this
83 83
      */
84
-    public function setExtra ($extra) {
84
+    public function setExtra($extra) {
85 85
         $this->extra = $extra;
86 86
         return $this;
87 87
     }
Please login to merge, or discard this patch.
src/AbstractClient.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
      *
15 15
      * @return string
16 16
      */
17
-    public function __toString () {
17
+    public function __toString() {
18 18
         try {
19 19
             return implode(':', $this->getPeerName());
20 20
         }
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
      * @throws Error
39 39
      * @return $this
40 40
      */
41
-    public function connect ($address, $port = 0) {
41
+    public function connect($address, $port = 0) {
42 42
         if (!@socket_connect($this->resource, $address, $port)) {
43 43
             // ignore expected errors for non-blocking connections
44 44
             $errno = Error::getLast($this->resource);
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
      * @throws Error
59 59
      * @return array Address and port at indices `0` and `1`.
60 60
      */
61
-    public function getPeerName () {
61
+    public function getPeerName() {
62 62
         if ($this->domain === AF_UNIX) {
63 63
             return [$this->getOption(self::SO_PEERCRED), 0];
64 64
         }
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
      * @throws Error
81 81
      * @return int Total bytes sent.
82 82
      */
83
-    public function send ($data, $flags = 0) {
83
+    public function send($data, $flags = 0) {
84 84
         $count = @socket_send($this->resource, $data, PHP_INT_MAX, $flags);
85 85
         if ($count === false) {
86 86
             $error = new Error($this->resource); // reliable errno
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
      * @throws Error Total bytes sent is set as the error's extra data.
100 100
      * @return $this
101 101
      */
102
-    public function write ($data) {
102
+    public function write($data) {
103 103
         $data = (string)$data;
104 104
         $length = strlen($data);
105 105
         $total = 0;
Please login to merge, or discard this patch.
src/DatagramServer.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
      *
13 13
      * @return int
14 14
      */
15
-    final public static function getType () {
15
+    final public static function getType() {
16 16
         return SOCK_DGRAM;
17 17
     }
18 18
 
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
      * @throws Error
31 31
      * @return string
32 32
      */
33
-    public function recv ($length, $flags = 0, &$name = null, &$port = 0) {
33
+    public function recv($length, $flags = 0, &$name = null, &$port = 0) {
34 34
         $count = @socket_recvfrom($this->resource, $data, $length, $flags, $name, $port);
35 35
         if ($count === false) {
36 36
             $error = new Error($this->resource, SOCKET_EOPNOTSUPP);
Please login to merge, or discard this patch.
src/DatagramClient.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@
 block discarded – undo
12 12
      *
13 13
      * @return int
14 14
      */
15
-    final public static function getType () {
15
+    final public static function getType() {
16 16
         return SOCK_DGRAM;
17 17
     }
18 18
 
Please login to merge, or discard this patch.
src/WebSocketFrame.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
      * @param bool $final
26 26
      * @return string
27 27
      */
28
-    public static function pack (string $payload, int $opCode = self::OP_TEXT, bool $final = true): string {
28
+    public static function pack(string $payload, int $opCode = self::OP_TEXT, bool $final = true): string {
29 29
         $frame = chr(0x80 | $opCode);
30 30
         $len = strlen($payload);
31 31
         if ($len > 65535) {
@@ -39,14 +39,14 @@  discard block
 block discarded – undo
39 39
         else {
40 40
             $frame .= chr($len);
41 41
         }
42
-        return $frame . $payload;
42
+        return $frame.$payload;
43 43
     }
44 44
 
45
-    public function __construct (string $data) {
45
+    public function __construct(string $data) {
46 46
         $this->data = $data;
47 47
     }
48 48
 
49
-    final public function getLength () {
49
+    final public function getLength() {
50 50
         switch ($char = ord($this->data[1]) & 0x7f) {
51 51
             case 127: // big-endian long-long
52 52
                 return unpack('J', substr($this->data, 2, 8));
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
     /**
61 61
      * @return int[]
62 62
      */
63
-    final public function getMask () {
63
+    final public function getMask() {
64 64
         if ($this->isMasked()) {
65 65
             switch (ord($this->data[1]) & 0x7f) {
66 66
                 case 127:
@@ -74,11 +74,11 @@  discard block
 block discarded – undo
74 74
         return [0, 0, 0, 0];
75 75
     }
76 76
 
77
-    final public function getOpCode (): int {
77
+    final public function getOpCode(): int {
78 78
         return ord($this->data[0]) & 0x0f;
79 79
     }
80 80
 
81
-    final public function getPayload (): string {
81
+    final public function getPayload(): string {
82 82
         $length = $this->getLength();
83 83
         if ($length === 0) {
84 84
             return '';
@@ -102,27 +102,27 @@  discard block
 block discarded – undo
102 102
         return $decoded;
103 103
     }
104 104
 
105
-    final public function isBinary (): bool {
105
+    final public function isBinary(): bool {
106 106
         return $this->getOpCode() === self::OP_BINARY;
107 107
     }
108 108
 
109
-    final public function isClose (): bool {
109
+    final public function isClose(): bool {
110 110
         return $this->getOpCode() === self::OP_CLOSE;
111 111
     }
112 112
 
113
-    final public function isFinal (): bool {
113
+    final public function isFinal(): bool {
114 114
         return (bool)(ord($this->data[0]) & 0x80);
115 115
     }
116 116
 
117
-    final public function isMasked (): bool {
117
+    final public function isMasked(): bool {
118 118
         return (bool)(ord($this->data[1]) & 0x80);
119 119
     }
120 120
 
121
-    final public function isPong (): bool {
121
+    final public function isPong(): bool {
122 122
         return $this->getOpCode() === self::OP_PONG;
123 123
     }
124 124
 
125
-    final public function isText (): bool {
125
+    final public function isText(): bool {
126 126
         return $this->getOpCode() === self::OP_TEXT;
127 127
     }
128 128
 
Please login to merge, or discard this patch.
src/ReactiveInterface.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,13 +14,13 @@
 block discarded – undo
14 14
      *
15 15
      * @return void
16 16
      */
17
-    public function onOutOfBand ();
17
+    public function onOutOfBand();
18 18
 
19 19
     /**
20 20
      * Called by the reactor when the socket has readable data.
21 21
      *
22 22
      * @return void
23 23
      */
24
-    public function onReadable ();
24
+    public function onReadable();
25 25
 
26 26
 }
27 27
\ No newline at end of file
Please login to merge, or discard this patch.
src/SocketInterface.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -42,34 +42,34 @@
 block discarded – undo
42 42
      *
43 43
      * @return int `SOCK_*`
44 44
      */
45
-    public static function getType ();
45
+    public static function getType();
46 46
 
47 47
     /**
48 48
      * Returns the address family constant of the socket.
49 49
      *
50 50
      * @return int `AF_*`
51 51
      */
52
-    public function getDomain ();
52
+    public function getDomain();
53 53
 
54 54
     /**
55 55
      * Returns the underlying socket resource as an integer.
56 56
      *
57 57
      * @return int
58 58
      */
59
-    public function getId ();
59
+    public function getId();
60 60
 
61 61
     /**
62 62
      * Returns the protocol constant used by the socket.
63 63
      *
64 64
      * @return int
65 65
      */
66
-    public function getProtocol ();
66
+    public function getProtocol();
67 67
 
68 68
     /**
69 69
      * Returns the underlying socket resource.
70 70
      *
71 71
      * @return resource
72 72
      */
73
-    public function getResource ();
73
+    public function getResource();
74 74
 
75 75
 }
76 76
\ No newline at end of file
Please login to merge, or discard this patch.
src/AbstractServer.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
      *
15 15
      * @return string
16 16
      */
17
-    public function __toString () {
17
+    public function __toString() {
18 18
         try {
19 19
             return implode(':', $this->getSockName());
20 20
         }
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
      * @throws Error
37 37
      * @return $this
38 38
      */
39
-    public function bind (string $address, int $port = 0) {
39
+    public function bind(string $address, int $port = 0) {
40 40
         if (!@socket_bind($this->resource, $address, $port)) {
41 41
             throw new Error($this->resource, SOCKET_EOPNOTSUPP);
42 42
         }
Please login to merge, or discard this patch.