@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | { |
45 | 45 | $this->stream = Stream::new(32); |
46 | 46 | |
47 | - $this->stream->onRead(function (string $sources) { |
|
47 | + $this->stream->onRead(function(string $sources) { |
|
48 | 48 | foreach ($this->then as $handler) { |
49 | 49 | $sources = $handler($sources); |
50 | 50 | } |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | return $sources; |
53 | 53 | }); |
54 | 54 | |
55 | - $this->where(function (string $class, string $pathname) use ($vendorDirectory): bool { |
|
55 | + $this->where(function(string $class, string $pathname) use ($vendorDirectory): bool { |
|
56 | 56 | if ($this->vendor) { |
57 | 57 | return true; |
58 | 58 | } |
@@ -109,10 +109,10 @@ discard block |
||
109 | 109 | */ |
110 | 110 | public function through(CacheInterface $cache, callable $then): self |
111 | 111 | { |
112 | - return $this->then(function (string $sources) use ($cache, $then) { |
|
112 | + return $this->then(function(string $sources) use ($cache, $then) { |
|
113 | 113 | $key = \md5($sources); |
114 | 114 | |
115 | - if (! $cache->has($key)) { |
|
115 | + if (!$cache->has($key)) { |
|
116 | 116 | $cache->set($key, $then($sources)); |
117 | 117 | } |
118 | 118 |
@@ -22,7 +22,7 @@ |
||
22 | 22 | public function match(string $class, string $path): bool |
23 | 23 | { |
24 | 24 | foreach ($this->filters as $filter) { |
25 | - if (! $filter($class, $path)) { |
|
25 | + if (!$filter($class, $path)) { |
|
26 | 26 | return false; |
27 | 27 | } |
28 | 28 | } |
@@ -10,7 +10,7 @@ |
||
10 | 10 | use Serafim\Stream\Stream; |
11 | 11 | use Serafim\Stream\StreamInterface; |
12 | 12 | |
13 | -if (! \function_exists('\\restream')) { |
|
13 | +if (!\function_exists('\\restream')) { |
|
14 | 14 | /** |
15 | 15 | * @param string $protocol |
16 | 16 | * @param Closure $then |
@@ -52,10 +52,10 @@ discard block |
||
52 | 52 | |
53 | 53 | $this->stream = Stream::get($this->protocol); |
54 | 54 | |
55 | - if (\STREAM_USE_PATH & $options && ! \is_file($this->pathname)) { |
|
55 | + if (\STREAM_USE_PATH & $options && !\is_file($this->pathname)) { |
|
56 | 56 | $trace = \debug_backtrace(\DEBUG_BACKTRACE_IGNORE_ARGS); |
57 | 57 | |
58 | - $this->pathname = \dirname($trace[1]['file']) . '/' . $this->pathname; |
|
58 | + $this->pathname = \dirname($trace[1]['file']).'/'.$this->pathname; |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | $this->resource = \fopen('php://memory', 'rb+'); |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | */ |
89 | 89 | public function stream_read(int $length): string |
90 | 90 | { |
91 | - return ! \feof($this->resource) ? \fread($this->resource, $length) : ''; |
|
91 | + return !\feof($this->resource) ? \fread($this->resource, $length) : ''; |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | /** |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | */ |
128 | 128 | public function stream_tell(): int |
129 | 129 | { |
130 | - return (int)\ftell($this->resource); |
|
130 | + return (int) \ftell($this->resource); |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | /** |
@@ -101,7 +101,7 @@ |
||
101 | 101 | return false; |
102 | 102 | } |
103 | 103 | |
104 | - if (! \is_string($file = $this->composer->findFile($class))) { |
|
104 | + if (!\is_string($file = $this->composer->findFile($class))) { |
|
105 | 105 | return false; |
106 | 106 | } |
107 | 107 |
@@ -35,8 +35,8 @@ discard block |
||
35 | 35 | */ |
36 | 36 | public function not(callable $filter): self |
37 | 37 | { |
38 | - return $this->where(function (string $class, string $file) use ($filter): bool { |
|
39 | - return ! $filter($class, $file); |
|
38 | + return $this->where(function(string $class, string $file) use ($filter): bool { |
|
39 | + return !$filter($class, $file); |
|
40 | 40 | }); |
41 | 41 | } |
42 | 42 | |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | */ |
58 | 58 | public function every(\Closure $then): self |
59 | 59 | { |
60 | - return $this->where(function (string $class, string $file) use ($then): bool { |
|
60 | + return $this->where(function(string $class, string $file) use ($then): bool { |
|
61 | 61 | $then($conjunction = new Conjunction()); |
62 | 62 | |
63 | 63 | return $conjunction->match($class, $file); |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | */ |
71 | 71 | public function any(\Closure $then): self |
72 | 72 | { |
73 | - return $this->where(function (string $class, string $file) use ($then): bool { |
|
73 | + return $this->where(function(string $class, string $file) use ($then): bool { |
|
74 | 74 | $then($disjunction = new Disjunction()); |
75 | 75 | |
76 | 76 | return $disjunction->match($class, $file); |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | */ |
84 | 84 | public function fqn(string $fqn): self |
85 | 85 | { |
86 | - return $this->where(function (string $class) use ($fqn): bool { |
|
86 | + return $this->where(function(string $class) use ($fqn): bool { |
|
87 | 87 | return \trim($class, '\\') === \trim($fqn, '\\'); |
88 | 88 | }); |
89 | 89 | } |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | { |
97 | 97 | $name = \trim($name, '\\'); |
98 | 98 | |
99 | - return $this->where(function (string $fqn) use ($name): bool { |
|
99 | + return $this->where(function(string $fqn) use ($name): bool { |
|
100 | 100 | return \substr($fqn, -\strlen($name)) === $name; |
101 | 101 | }); |
102 | 102 | } |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | { |
110 | 110 | $prefix = \trim($prefix, '\\'); |
111 | 111 | |
112 | - return $this->where(function (string $class) use ($prefix): bool { |
|
112 | + return $this->where(function(string $class) use ($prefix): bool { |
|
113 | 113 | return \strpos(\trim($class, '\\'), $prefix) === 0; |
114 | 114 | }); |
115 | 115 | } |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | */ |
121 | 121 | public function fileName(string $name): self |
122 | 122 | { |
123 | - return $this->where(function (string $_, string $file) use ($name): bool { |
|
123 | + return $this->where(function(string $_, string $file) use ($name): bool { |
|
124 | 124 | $file = \str_replace('\\', '/', $file); |
125 | 125 | |
126 | 126 | return \pathinfo($file, \PATHINFO_FILENAME) === $name; |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | { |
136 | 136 | $regex = $this->regex($regex, false); |
137 | 137 | |
138 | - return $this->where(function (string $_, string $file) use ($regex): bool { |
|
138 | + return $this->where(function(string $_, string $file) use ($regex): bool { |
|
139 | 139 | return \preg_match($regex, $file) !== 0; |
140 | 140 | }); |
141 | 141 | } |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | { |
149 | 149 | $regex = $this->regex($regex); |
150 | 150 | |
151 | - return $this->where(function (string $_, string $file) use ($regex): bool { |
|
151 | + return $this->where(function(string $_, string $file) use ($regex): bool { |
|
152 | 152 | return \preg_match($regex, \pathinfo($file, \PATHINFO_FILENAME)) !== 0; |
153 | 153 | }); |
154 | 154 | } |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | { |
162 | 162 | $regex = $this->regex($regex, true); |
163 | 163 | |
164 | - return $this->where(function (string $fqn) use ($regex): bool { |
|
164 | + return $this->where(function(string $fqn) use ($regex): bool { |
|
165 | 165 | $class = \basename(\str_replace('\\', '/', $fqn)); |
166 | 166 | |
167 | 167 | return \preg_match($regex, $class) !== 0; |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | { |
177 | 177 | $regex = $this->regex($regex); |
178 | 178 | |
179 | - return $this->where(function (string $fqn) use ($regex): bool { |
|
179 | + return $this->where(function(string $fqn) use ($regex): bool { |
|
180 | 180 | return \preg_match($regex, $fqn) !== 0; |
181 | 181 | }); |
182 | 182 | } |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | */ |
189 | 189 | private function regex(string $regex, bool $strict = false): string |
190 | 190 | { |
191 | - $regex = $strict ? '^' . $regex . '$' : $regex; |
|
191 | + $regex = $strict ? '^'.$regex.'$' : $regex; |
|
192 | 192 | |
193 | 193 | return \sprintf('#%s#isuS', \str_replace('#', '\\#', $regex)); |
194 | 194 | } |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | * @var string |
33 | 33 | */ |
34 | 34 | private const STREAM_DUPLICATION_EXCEPTION = |
35 | - 'Could not create stream "%s", because stream ' . |
|
35 | + 'Could not create stream "%s", because stream '. |
|
36 | 36 | 'with same name already has been registered.'; |
37 | 37 | |
38 | 38 | /** |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | { |
102 | 102 | \assert($complexity > 0, 'Name complexity should be greater than 0'); |
103 | 103 | |
104 | - $name = 'stream' . \bin2hex(\random_bytes($complexity)); |
|
104 | + $name = 'stream'.\bin2hex(\random_bytes($complexity)); |
|
105 | 105 | |
106 | 106 | return static::create($name, $wrapper); |
107 | 107 | } |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | */ |
192 | 192 | public static function get(string $protocol): StreamInterface |
193 | 193 | { |
194 | - if (! isset(static::$streams[$protocol])) { |
|
194 | + if (!isset(static::$streams[$protocol])) { |
|
195 | 195 | $error = \sprintf('Protocol "%s://" should be registered', $protocol); |
196 | 196 | throw new StreamCreatingException($error); |
197 | 197 | } |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | */ |
322 | 322 | private function assertIsFile(string $pathname): void |
323 | 323 | { |
324 | - if (! \is_file($pathname)) { |
|
324 | + if (!\is_file($pathname)) { |
|
325 | 325 | $error = \sprintf('File %s not found', $pathname); |
326 | 326 | throw new NotFoundException($error); |
327 | 327 | } |
@@ -334,7 +334,7 @@ discard block |
||
334 | 334 | */ |
335 | 335 | private function assertIsReadable(string $pathname): void |
336 | 336 | { |
337 | - if (! \is_readable($pathname)) { |
|
337 | + if (!\is_readable($pathname)) { |
|
338 | 338 | $error = \sprintf('File %s not readable', $pathname); |
339 | 339 | throw new NotReadableException($error); |
340 | 340 | } |