@@ -49,7 +49,7 @@ |
||
49 | 49 | $stream = @fopen($this->resource->getUri(), 'r'); |
50 | 50 | |
51 | 51 | if ($stream === false) { |
52 | - throw new \RuntimeException('Unable to open ' . $this->resource->getUri() . ' for reading'); |
|
52 | + throw new \RuntimeException('Unable to open '.$this->resource->getUri().' for reading'); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | $this->streams[] = $stream; |
@@ -26,15 +26,15 @@ |
||
26 | 26 | { |
27 | 27 | $targetResource = @fopen($target->getUri(), 'w+', true); |
28 | 28 | |
29 | - if (! is_resource($targetResource)) { |
|
30 | - throw new \RuntimeException('Unable to open ' . $target->getUri() . ' for writing'); |
|
29 | + if (!is_resource($targetResource)) { |
|
30 | + throw new \RuntimeException('Unable to open '.$target->getUri().' for writing'); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | $sourceResource = $reader->getContentsAsStream(); |
34 | 34 | $bytesCopied = @stream_copy_to_stream($sourceResource, $targetResource); |
35 | 35 | |
36 | 36 | if ($bytesCopied <= 0) { |
37 | - throw new \RuntimeException('Unable to write to ' . $target->getUri()); |
|
37 | + throw new \RuntimeException('Unable to write to '.$target->getUri()); |
|
38 | 38 | }; |
39 | 39 | |
40 | 40 | fclose($targetResource); |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | */ |
34 | 34 | public function addWriter(ResourceWriter $writer, $protocols) |
35 | 35 | { |
36 | - $protocols = is_array($protocols) ? $protocols : [ $protocols ]; |
|
36 | + $protocols = is_array($protocols) ? $protocols : [$protocols]; |
|
37 | 37 | $index = count($this->writers); |
38 | 38 | |
39 | 39 | $this->writers[$index] = $writer; |
@@ -51,8 +51,8 @@ discard block |
||
51 | 51 | */ |
52 | 52 | public function resolveWriter(ResourceUri $resource) |
53 | 53 | { |
54 | - if (! array_key_exists($resource->getProtocol(), $this->protocolWriterIndexes)) { |
|
55 | - throw new \RuntimeException('Unsupported protocol: ' . $resource->getProtocol() . '( ' . $resource . ')'); |
|
54 | + if (!array_key_exists($resource->getProtocol(), $this->protocolWriterIndexes)) { |
|
55 | + throw new \RuntimeException('Unsupported protocol: '.$resource->getProtocol().'( '.$resource.')'); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | /** @var int $index */ |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | */ |
35 | 35 | public function addFactory(ResourceReaderFactory $factory, $protocols) |
36 | 36 | { |
37 | - $protocols = is_array($protocols) ? $protocols : [ $protocols ]; |
|
37 | + $protocols = is_array($protocols) ? $protocols : [$protocols]; |
|
38 | 38 | $index = count($this->factories); |
39 | 39 | |
40 | 40 | $this->factories[$index] = $factory; |
@@ -52,8 +52,8 @@ discard block |
||
52 | 52 | */ |
53 | 53 | public function resolveReader(ResourceUri $resource) |
54 | 54 | { |
55 | - if (! array_key_exists($resource->getProtocol(), $this->protocolFactoryIndexes)) { |
|
56 | - throw new \RuntimeException('Unsupported protocol: ' . $resource->getProtocol() . '( ' . $resource . ')'); |
|
55 | + if (!array_key_exists($resource->getProtocol(), $this->protocolFactoryIndexes)) { |
|
56 | + throw new \RuntimeException('Unsupported protocol: '.$resource->getProtocol().'( '.$resource.')'); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | /** @var int $factoryIndex */ |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | */ |
23 | 23 | private static function getNonEmptyParts($uri) |
24 | 24 | { |
25 | - $nonEmptyStringFilter = function ($value) { |
|
25 | + $nonEmptyStringFilter = function($value) { |
|
26 | 26 | return $value != ''; |
27 | 27 | }; |
28 | 28 | |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | */ |
48 | 48 | public static function fromProtocolAndResource($protocol, $resource) |
49 | 49 | { |
50 | - return new self($protocol . self::PROTOCOL_SEPARATOR . $resource); |
|
50 | + return new self($protocol.self::PROTOCOL_SEPARATOR.$resource); |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | /** |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | |
63 | 63 | $parts = self::getNonEmptyParts($uri); |
64 | 64 | |
65 | - if (! self::validateResourceParts($parts)) { |
|
65 | + if (!self::validateResourceParts($parts)) { |
|
66 | 66 | return false; |
67 | 67 | } |
68 | 68 | |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | public static function fromString($uri) |
77 | 77 | { |
78 | 78 | if (strpos($uri, self::PROTOCOL_SEPARATOR) === false) { |
79 | - $uri = self::DEFAULT_PROTOCOL . self::PROTOCOL_SEPARATOR . $uri; |
|
79 | + $uri = self::DEFAULT_PROTOCOL.self::PROTOCOL_SEPARATOR.$uri; |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | return new self($uri); |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | */ |
115 | 115 | public function __construct($uri) |
116 | 116 | { |
117 | - if (! self::isValidUri($uri)) { |
|
117 | + if (!self::isValidUri($uri)) { |
|
118 | 118 | throw new \InvalidArgumentException(sprintf( |
119 | 119 | 'Malformed URI: required format is "protocol://resource", got "%s"', |
120 | 120 | $uri |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | |
183 | 183 | public function child($childRelativePath) |
184 | 184 | { |
185 | - return self::fromProtocolAndResource($this->protocol, $this->resource . '/' . ltrim($childRelativePath, '/')); |
|
185 | + return self::fromProtocolAndResource($this->protocol, $this->resource.'/'.ltrim($childRelativePath, '/')); |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | /** |