Completed
Push — master ( 157f8e...ae8c4e )
by f
03:53
created
src/Packager.php 3 patches
Doc Comments   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
      * This file contains the base package information
16 16
      *
17 17
      * @param Spec $spec
18
-     * @return \wapmorgan\rpm\Spec
18
+     * @return Packager
19 19
      */
20 20
     public function setSpec(Spec $spec)
21 21
     {
@@ -124,6 +124,9 @@  discard block
 block discarded – undo
124 124
         return $command;
125 125
     }
126 126
 
127
+    /**
128
+     * @param string $dest
129
+     */
127 130
     private function pathToPath($path, $dest) {
128 131
         if (is_dir($path)) {
129 132
             $iterator = new DirectoryIterator($path);
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
             $iterator = new DirectoryIterator($this->getOutputPath());
62 62
             foreach ($iterator as $path) {
63 63
                 if ($path != '.' && $path != '..') {
64
-                    echo "OUTPUT DIRECTORY MUST BE EMPTY! Something exists, exit immediately!" . PHP_EOL;
64
+                    echo "OUTPUT DIRECTORY MUST BE EMPTY! Something exists, exit immediately!".PHP_EOL;
65 65
                     exit();
66 66
                 }
67 67
             }
@@ -129,11 +129,11 @@  discard block
 block discarded – undo
129 129
             $iterator = new DirectoryIterator($path);
130 130
             foreach ($iterator as $element) {
131 131
                 if ($element != '.' && $element != '..') {
132
-                    $fullPath = $path . DIRECTORY_SEPARATOR . $element;
132
+                    $fullPath = $path.DIRECTORY_SEPARATOR.$element;
133 133
                     if (is_dir($fullPath)) {
134
-                        $this->pathToPath($fullPath, $dest . DIRECTORY_SEPARATOR . $element);
134
+                        $this->pathToPath($fullPath, $dest.DIRECTORY_SEPARATOR.$element);
135 135
                     } else {
136
-                        $this->copy($fullPath, $dest . DIRECTORY_SEPARATOR . $element);
136
+                        $this->copy($fullPath, $dest.DIRECTORY_SEPARATOR.$element);
137 137
                     }
138 138
                 }
139 139
             }
Please login to merge, or discard this patch.
Braces   +12 added lines, -8 removed lines patch added patch discarded remove patch
@@ -52,10 +52,12 @@  discard block
 block discarded – undo
52 52
     }
53 53
 
54 54
     public function run() {
55
-        if (!is_dir($_SERVER['HOME'].'/rpmbuild/SOURCES'))
56
-            mkdir($_SERVER['HOME'].'/rpmbuild/SOURCES', 0777);
57
-        if (!is_dir($_SERVER['HOME'].'/rpmbuild/SPECS'))
58
-            mkdir($_SERVER['HOME'].'/rpmbuild/SPECS', 0777);
55
+        if (!is_dir($_SERVER['HOME'].'/rpmbuild/SOURCES')) {
56
+                    mkdir($_SERVER['HOME'].'/rpmbuild/SOURCES', 0777);
57
+        }
58
+        if (!is_dir($_SERVER['HOME'].'/rpmbuild/SPECS')) {
59
+                    mkdir($_SERVER['HOME'].'/rpmbuild/SPECS', 0777);
60
+        }
59 61
 
60 62
         if (file_exists($this->getOutputPath())) {
61 63
             $iterator = new DirectoryIterator($this->getOutputPath());
@@ -67,8 +69,9 @@  discard block
 block discarded – undo
67 69
             }
68 70
         }
69 71
 
70
-        if (!is_dir($this->getOutputPath()))
71
-            mkdir($this->getOutputPath(), 0777);
72
+        if (!is_dir($this->getOutputPath())) {
73
+                    mkdir($this->getOutputPath(), 0777);
74
+        }
72 75
 
73 76
         foreach ($this->mountPoints as $path => $dest) {
74 77
             $this->pathToPath($path, $this->getOutputPath().DIRECTORY_SEPARATOR.$dest);
@@ -148,7 +151,8 @@  discard block
 block discarded – undo
148 151
             mkdir($destFolder, 0777, true);
149 152
         }
150 153
         copy($source, $dest);
151
-        if (fileperms($source) != fileperms($dest))
152
-            chmod($dest, fileperms($source));
154
+        if (fileperms($source) != fileperms($dest)) {
155
+                    chmod($dest, fileperms($source));
156
+        }
153 157
     }
154 158
 }
155 159
\ No newline at end of file
Please login to merge, or discard this patch.
src/Spec.php 1 patch
Braces   +8 added lines, -6 removed lines patch added patch discarded remove patch
@@ -105,10 +105,11 @@  discard block
 block discarded – undo
105 105
     }
106 106
 
107 107
     public function __get($prop) {
108
-        if (array_key_exists($prop, $this->_keys))
109
-            return $this->_keys[$prop];
110
-        else if (array_key_exists($prop, $this->_blocks))
111
-            return $this->_blocks[$prop];
108
+        if (array_key_exists($prop, $this->_keys)) {
109
+                    return $this->_keys[$prop];
110
+        } else if (array_key_exists($prop, $this->_blocks)) {
111
+                    return $this->_blocks[$prop];
112
+        }
112 113
     }
113 114
 
114 115
     public function setKey($prop, $value) {
@@ -119,8 +120,9 @@  discard block
 block discarded – undo
119 120
     public function __toString() {
120 121
         $spec = '';
121 122
         foreach ($this->_keys as $key => $value) {
122
-            if ($value === '')
123
-                continue;
123
+            if ($value === '') {
124
+                            continue;
125
+            }
124 126
             $spec .= sprintf('%s: %s'."\n", $key, $value);
125 127
         }
126 128
 
Please login to merge, or discard this patch.