Skip to content

Commit d022c43

Browse files
committed
Committing some PHPCS code cleanup.
1 parent b019e1d commit d022c43

2 files changed

Lines changed: 32 additions & 33 deletions

File tree

src/String.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,16 @@ public function __construct($readOnly = false, $compressionLevel = 6, $filepath
2020
$this->replaceStream($readOnly, $compressionLevel, $filepath);
2121
}
2222

23-
public function replaceStream($readOnly = false, $compressionLevel = 6, $filepath = 'php://memory')
24-
{
25-
if (substr($filepath, 0, 6) !== 'php://') {
26-
$this->isRealFile = true;
27-
}
28-
$this->compressionLevel = $compressionLevel;
23+
public function replaceStream($readOnly = false, $compressionLevel = 6, $filepath = 'php://memory')
24+
{
25+
if (substr($filepath, 0, 6) !== 'php://') {
26+
$this->isRealFile = true;
27+
}
28+
$this->compressionLevel = $compressionLevel;
2929
$this->stream = fopen($filepath, 'r+');
3030
$this->streamObject = Psr7\stream_for($this->stream);
3131
$this->gzStream = new GzStreamGuzzle($this->streamObject, $readOnly, $this->compressionLevel);
32-
}
32+
}
3333

3434
public function write($string, $options = 0, $depth = 512)
3535
{
@@ -114,11 +114,11 @@ public function getStreamObject()
114114

115115
public function getReadOnlyStream()
116116
{
117-
if ($this->isRealFile) {
118-
return $this->getGzStream();
119-
}
117+
if ($this->isRealFile) {
118+
return $this->getGzStream();
119+
}
120120

121-
// More specifically for the in-memory streams:
121+
// More specifically for the in-memory streams:
122122
$this->prepareForRead();
123123
$gzStreamReadOnly = $this->getGzStream()->readOnlyStream();
124124

tests/StringTest.php

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -117,30 +117,29 @@ public function testDifferentCompressionModes()
117117

118118
public function testReadGzipFile()
119119
{
120-
$this->memoryUsage(__METHOD__, 'Start');
120+
$this->memoryUsage(__METHOD__, 'Start');
121121
$compressedStringFile = new String(true, 6, __DIR__.'/files/companies_first_10.gz');
122122

123123
$readOnlyStream = $compressedStringFile->getReadOnlyStream();
124-
$i = 0;
125-
$firstLineOutput = '';
126-
while($buffer = $readOnlyStream->read()) {
127-
if ($i < 1) {
128-
$firstLineOutput = $buffer;
129-
}
124+
$i = 0;
125+
$firstLineOutput = '';
126+
while ($buffer = $readOnlyStream->read()) {
127+
if ($i < 1) {
128+
$firstLineOutput = $buffer;
129+
}
130130

131-
$i++;
132-
}
131+
$i++;
132+
}
133133

134-
$this->assertContains('_id', $firstLineOutput);
134+
$this->assertContains('_id', $firstLineOutput);
135135

136136
$this->log(__METHOD__, false);
137137
$this->memoryUsage(__METHOD__, 'Finish');
138-
139138
}
140139

141140
public function testWriteFileAndReadStream()
142141
{
143-
$this->memoryUsage(__METHOD__, 'Start');
142+
$this->memoryUsage(__METHOD__, 'Start');
144143

145144
$compressedString = new String();
146145

@@ -149,20 +148,20 @@ public function testWriteFileAndReadStream()
149148

150149
$compressedString->writeCompressedContents(__DIR__.'/files/tmp/write_test.gz');
151150

152-
$readOnlyStream = $compressedString->getReadOnlyStream();
151+
$readOnlyStream = $compressedString->getReadOnlyStream();
153152
$i = 0;
154-
$firstLineOutput = '';
155-
while($buffer = $readOnlyStream->read()) {
156-
if ($i < 1) {
157-
$firstLineOutput = $buffer;
158-
}
153+
$firstLineOutput = '';
154+
while ($buffer = $readOnlyStream->read()) {
155+
if ($i < 1) {
156+
$firstLineOutput = $buffer;
157+
}
159158

160-
$i++;
161-
}
159+
$i++;
160+
}
162161

163-
$this->assertContains('_id', $firstLineOutput);
162+
$this->assertContains('_id', $firstLineOutput);
164163

165-
$this->log(__METHOD__, false);
164+
$this->log(__METHOD__, false);
166165
$this->memoryUsage(__METHOD__, 'Finish');
167166
}
168167
}

0 commit comments

Comments
 (0)