Skip to content

Commit 9e0bd47

Browse files
committed
Added Zip Adapters (PclZip & ZipArchive) (PHPCS Fixes)
1 parent 87031e0 commit 9e0bd47

File tree

7 files changed

+11
-13
lines changed

7 files changed

+11
-13
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,4 @@
3737
## 0.2.5
3838

3939
### Features
40-
- Added Zip Adapter (PclZip & ZipArchive)
40+
- Added Zip Adapters (PclZip & ZipArchive)

src/Common/Adapter/Zip/PclZipAdapter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,4 @@ public function addFromString($localname, $contents)
5555
unlink($this->tmpDir.'/'.$pathData['basename']);
5656
return $this;
5757
}
58-
}
58+
}

src/Common/Adapter/Zip/ZipArchiveAdapter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class ZipArchiveAdapter implements ZipInterface
2121
* @throws \Exception Could not open $this->filename for writing.
2222
* @return mixed
2323
*/
24-
public function open($filename){
24+
public function open($filename) {
2525
$this->filename = $filename;
2626
$this->oZipArchive = new ZipArchive();
2727

@@ -55,4 +55,4 @@ public function addFromString($localname, $contents)
5555
{
5656
return $this->oZipArchive->addFromString($localname, $contents);
5757
}
58-
}
58+
}

src/Common/Adapter/Zip/ZipInterface.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@
22

33
namespace PhpOffice\Common\Adapter\Zip;
44

5-
65
interface ZipInterface
76
{
87
public function open($filename);
98
public function close();
109
public function addFromString($localname, $contents);
11-
}
10+
}

tests/Common/Tests/Adapter/Zip/PclZipAdapterTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,4 @@ public function testAddFromString()
5151
$this->assertTrue(TestHelperZip::assertFileExists($this->zipTest, $expectedPath));
5252
$this->assertTrue(TestHelperZip::assertFileContent($this->zipTest, $expectedPath, $expectedContent));
5353
}
54-
}
54+
}

tests/Common/Tests/Adapter/Zip/ZipArchiveAdapterTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
use PhpOffice\Common\Adapter\Zip\ZipArchiveAdapter;
66
use PhpOffice\Common\Tests\TestHelperZip;
77

8-
98
class ZipArchiveAdapterTest extends \PHPUnit_Framework_TestCase
109
{
1110
protected $zipTest;
@@ -52,4 +51,4 @@ public function testAddFromString()
5251
$this->assertTrue(TestHelperZip::assertFileExists($this->zipTest, $expectedPath));
5352
$this->assertTrue(TestHelperZip::assertFileContent($this->zipTest, $expectedPath, $expectedContent));
5453
}
55-
}
54+
}

tests/Common/Tests/_includes/TestHelperZip.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,19 @@
33

44
class TestHelperZip
55
{
6-
static public function assertFileExists($fileZip, $path)
6+
public static function assertFileExists($fileZip, $path)
77
{
88
$oZip = new \ZipArchive;
99
if ($oZip->open($fileZip) !== true) {
1010
return false;
1111
}
12-
if($oZip->statName($path) === false) {
12+
if ($oZip->statName($path) === false) {
1313
return false;
1414
}
1515
return true;
1616
}
1717

18-
static public function assertFileContent($fileZip, $path, $content)
18+
public static function assertFileContent($fileZip, $path, $content)
1919
{
2020
$oZip = new \ZipArchive;
2121
if ($oZip->open($fileZip) !== true) {
@@ -30,4 +30,4 @@ static public function assertFileContent($fileZip, $path, $content)
3030
}
3131
return true;
3232
}
33-
}
33+
}

0 commit comments

Comments
 (0)