Passed
Push — master ( 7a1a9c...a128e0 )
by Bence
05:24
created
src/Shell/CommandRunner.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,11 +13,11 @@
 block discarded – undo
13 13
 
14 14
     private $tempmrg;
15 15
 
16
-    public function __construct() {
16
+    public function __construct () {
17 17
         $this->tempmrg = new TempManager("csf_command_runner");
18 18
     }
19 19
 
20
-    public function run(int $type, string $dir, string $command, bool $sudo = false) : TempFile {
20
+    public function run (int $type, string $dir, string $command, bool $sudo = false) : TempFile {
21 21
         $tempfile = $this->tempmrg->createFile();
22 22
         $temp_path = $tempfile->getPath();
23 23
 
Please login to merge, or discard this patch.
src/TempFiles/TempFile.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -9,28 +9,28 @@  discard block
 block discarded – undo
9 9
     private $id;
10 10
     private $full_path;
11 11
 
12
-    public function __construct(string $id, string $path) {
12
+    public function __construct (string $id, string $path) {
13 13
         $this->id = $id;
14 14
         $this->full_path = $path;
15 15
     }
16 16
 
17
-    public function getId() : string {
17
+    public function getId () : string {
18 18
         return $this->id;
19 19
     }
20 20
 
21
-    public function getPath() : string {
21
+    public function getPath () : string {
22 22
         return $this->full_path;
23 23
     }
24 24
 
25
-    public function __toString() : string {
25
+    public function __toString () : string {
26 26
         return $this->full_path;
27 27
     }
28 28
 
29
-    public function getText() : string {
29
+    public function getText () : string {
30 30
         return file_get_contents($this->full_path);
31 31
     }
32 32
 
33
-    public function getLastLines(int $lines = 10, $buffer = 4096) : string {
33
+    public function getLastLines (int $lines = 10, $buffer = 4096) : string {
34 34
         $f = fopen($this->full_path, "rb");
35 35
         if ($f === false) {
36 36
             throw new Exception("Cant open file");
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
         return $output;
59 59
     }
60 60
 
61
-    public function delete() {
61
+    public function delete () {
62 62
         unlink($this->full_path);
63 63
     }
64 64
 
Please login to merge, or discard this patch.
src/TempFiles/TempManager.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 
12 12
     private $dir;
13 13
 
14
-    public function __construct(string $context) {
14
+    public function __construct (string $context) {
15 15
         if (!preg_match('/^[a-z0-9\_\-]+$/i', $context)) {
16 16
             throw new Exception("The temp context must be an alphanumeric string");
17 17
         }
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
         }
28 28
     }
29 29
 
30
-    private function IdToPath(string $id) : string {
30
+    private function IdToPath (string $id) : string {
31 31
         $path = $this->dir . "/" . $id;
32 32
         if (!file_exists($path)) {
33 33
             touch($path);
@@ -35,12 +35,12 @@  discard block
 block discarded – undo
35 35
         return $path;
36 36
     }
37 37
 
38
-    public function createFile() : TempFile {
38
+    public function createFile () : TempFile {
39 39
         $id = uniqid("", true);
40 40
         return new TempFile($id, $this->IdToPath($id));
41 41
     }
42 42
 
43
-    public function getFile(string $id) : TempFile {
43
+    public function getFile (string $id) : TempFile {
44 44
         return new TempFile($id, $this->IdToPath($id));
45 45
     }
46 46
 
Please login to merge, or discard this patch.
src/RecursiveFileListing.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
     private $files;
11 11
     private $filters = [];
12 12
 
13
-    public function __construct(string $dir) {
13
+    public function __construct (string $dir) {
14 14
         if (!is_dir($dir)) {
15 15
             throw new Exception("Directory required");
16 16
         }
@@ -18,22 +18,22 @@  discard block
 block discarded – undo
18 18
         $this->root_dir = $dir;
19 19
     }
20 20
 
21
-    public function addFilter(string $regex) {
21
+    public function addFilter (string $regex) {
22 22
         $this->filters[] = $regex;
23 23
     }
24 24
 
25
-    public function clearFilters() {
25
+    public function clearFilters () {
26 26
         $this->filters = [];
27 27
     }
28 28
 
29
-    public function scan() : array {
29
+    public function scan () : array {
30 30
         $this->files = [];
31 31
         $this->recursiveScan($this->root_dir);
32 32
         sort($this->files);
33 33
         return $this->files;
34 34
     }
35 35
 
36
-    private function recursiveScan(string $dir) {
36
+    private function recursiveScan (string $dir) {
37 37
         $files = scandir($dir);
38 38
         foreach ($files as $filename) {
39 39
             if ($filename !== "." && $filename !== "..") {
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
         }
50 50
     }
51 51
 
52
-    private function isFileOk(string $path) : bool {
52
+    private function isFileOk (string $path) : bool {
53 53
         if (count($this->filters) == 0) {
54 54
             return true;
55 55
         }
Please login to merge, or discard this patch.
tests/RecursiveFileListingTest.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -10,18 +10,18 @@  discard block
 block discarded – undo
10 10
     /**
11 11
      * @expectedException Exception
12 12
      */
13
-    public function testInvalidDirectory() {
13
+    public function testInvalidDirectory () {
14 14
         new RecursiveFileListing(__DIR__ . "/not_existing_dir");
15 15
     }
16 16
 
17
-    public function testFindFiles() {
17
+    public function testFindFiles () {
18 18
         $finder = new RecursiveFileListing(__DIR__ . "/RecFileListTestDir");
19 19
         $files = $finder->scan();
20 20
 
21 21
         $this->assertEquals(3, count($files));
22 22
     }
23 23
 
24
-    public function testFilterFiles() {
24
+    public function testFilterFiles () {
25 25
         $finder = new RecursiveFileListing(__DIR__ . "/RecFileListTestDir");
26 26
         $finder->addFilter('/.*\.txt$/i');
27 27
         $files = $finder->scan();
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
         $this->assertEquals(2, count($files));
30 30
     }
31 31
 
32
-    public function testFilterRemoval() {
32
+    public function testFilterRemoval () {
33 33
         $finder = new RecursiveFileListing(__DIR__ . "/RecFileListTestDir");
34 34
         $finder->addFilter('/.*\.txt$/i');
35 35
         $finder->clearFilters();
Please login to merge, or discard this patch.
tests/CommandRunnerTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@
 block discarded – undo
7 7
 
8 8
 final class CommandRunnerTest extends TestCase {
9 9
 
10
-    public function testRunningCommand() {
10
+    public function testRunningCommand () {
11 11
         $runner = new CommandRunner();
12 12
         $file = $runner->run(CommandRunner::COMMAND_SYNC, __DIR__ . "/RecFileListTestDir", "ls");
13 13
         $file_lists = $file->getText();
Please login to merge, or discard this patch.
src/Azure/Storage.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 
17 17
     private $exec;
18 18
 
19
-    public function __construct(string $container, string $connection_string) {
19
+    public function __construct (string $container, string $connection_string) {
20 20
         $this->exec = new CommandRunner();
21 21
 
22 22
         $this->connection_string = $connection_string;
@@ -33,22 +33,22 @@  discard block
 block discarded – undo
33 33
         }
34 34
     }
35 35
 
36
-    protected function run($cmd) : string {
36
+    protected function run ($cmd) : string {
37 37
         $logfile = $this->exec->run(CommandRunner::COMMAND_SYNC, __DIR__, $cmd, true);
38 38
         $log = $logfile->getText();
39 39
         $logfile->delete();
40 40
         return $log;
41 41
     }
42 42
 
43
-    public function getContainer() : string {
43
+    public function getContainer () : string {
44 44
         return $this->container;
45 45
     }
46 46
 
47
-    public function getAccountName() : string {
47
+    public function getAccountName () : string {
48 48
         $this->account_name;
49 49
     }
50 50
 
51
-    public function uploadToBlob(string $file, string $name, string $content_type = null) {
51
+    public function uploadToBlob (string $file, string $name, string $content_type = null) {
52 52
         if (!file_exists($file) || !is_file($file) || !is_readable($file)) {
53 53
             throw new Exception("Invalid file");
54 54
         }
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
         return $log;*/
83 83
     }
84 84
 
85
-    public function GenerateBlobSas(string $name, int $expire = 5 * 60 * 60, string $ip = null) : string {
85
+    public function GenerateBlobSas (string $name, int $expire = 5 * 60 * 60, string $ip = null) : string {
86 86
         $signedPermissions = "r";
87 87
         //$signedStart = gmdate("Y-m-d\TH:i\Z", time());
88 88
         $signedExpiry = gmdate("Y-m-d\TH:i\Z", time() + $expire);
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
         return $sas;
134 134
     }
135 135
 
136
-    public function getBlobUrl(string $name) {
136
+    public function getBlobUrl (string $name) {
137 137
         $url = "https://" . $this->account_name . ".blob.core.windows.net/" . $this->container . "/" . $name;
138 138
         return $url;
139 139
     }
Please login to merge, or discard this patch.