Test Failed
Push — master ( 13f89e...978f8c )
by Php Easy Api
04:14
created
src/resta/Authenticate/ConfigProvider.php 2 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -219,8 +219,7 @@
 block discarded – undo
219 219
             $table = $this->config['guard'][$this->guard]['deviceTokenRegister'];
220 220
 
221 221
             app()->register('authenticateDeviceTokenTable',$table);
222
-        }
223
-        else{
222
+        } else{
224 223
             app()->register('authenticateDeviceTokenTable','device_tokens');
225 224
         }
226 225
 
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
     {
32 32
         $this->config();
33 33
 
34
-        if($this->guard=="default"){
34
+        if ($this->guard=="default") {
35 35
             $this->setAuthenticateNeeds();
36 36
         }
37 37
 
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
     {
50 50
         $this->config = config('authenticate');
51 51
 
52
-        if(!is_null($config = $this->provider('configuration'))){
52
+        if (!is_null($config = $this->provider('configuration'))) {
53 53
             $this->config['guard'][$this->guard] = $config($this->config['guard'][$this->guard]);
54 54
         }
55 55
 
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
      */
64 64
     public function getAddToWhere()
65 65
     {
66
-        if(isset($this->config['guard'][$this->guard]['addToWhere'])){
66
+        if (isset($this->config['guard'][$this->guard]['addToWhere'])) {
67 67
             return $this->config['guard'][$this->guard]['addToWhere'];
68 68
         }
69 69
         return null;
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
      */
77 77
     public function getConfigToken()
78 78
     {
79
-        if(isset($this->config['guard'][$this->guard]['token'])){
79
+        if (isset($this->config['guard'][$this->guard]['token'])) {
80 80
             return $this->config['guard'][$this->guard]['token'];
81 81
         }
82 82
         return null;
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
      */
171 171
     public function provider($key)
172 172
     {
173
-        if(app()->has('authenticate.'.$key) && is_callable($provider = app()->get('authenticate.'.$key))){
173
+        if (app()->has('authenticate.'.$key) && is_callable($provider = app()->get('authenticate.'.$key))) {
174 174
             return $provider;
175 175
         }
176 176
 
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
     {
210 210
         $table = $this->config['guard'][$this->guard]['table'];
211 211
 
212
-        app()->register('authenticateTable',$table);
212
+        app()->register('authenticateTable', $table);
213 213
     }
214 214
 
215 215
     /**
@@ -219,13 +219,13 @@  discard block
 block discarded – undo
219 219
      */
220 220
     public function deviceTokenTable()
221 221
     {
222
-        if(isset($this->config['guard'][$this->guard]['deviceTokenRegister'])){
222
+        if (isset($this->config['guard'][$this->guard]['deviceTokenRegister'])) {
223 223
             $table = $this->config['guard'][$this->guard]['deviceTokenRegister'];
224 224
 
225
-            app()->register('authenticateDeviceTokenTable',$table);
225
+            app()->register('authenticateDeviceTokenTable', $table);
226 226
         }
227
-        else{
228
-            app()->register('authenticateDeviceTokenTable','device_tokens');
227
+        else {
228
+            app()->register('authenticateDeviceTokenTable', 'device_tokens');
229 229
         }
230 230
 
231 231
     }
Please login to merge, or discard this patch.
src/resta/Authenticate/Driver/Eloquent/DeviceToken.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@
 block discarded – undo
8 8
     /**
9 9
      * @var array
10 10
      */
11
-    protected $fillable = ['user_id','token','token_integer','device_agent','device_agent_integer','expire'];
11
+    protected $fillable = ['user_id', 'token', 'token_integer', 'device_agent', 'device_agent_integer', 'expire'];
12 12
 
13 13
     /**
14 14
      * User constructor.
Please login to merge, or discard this patch.
src/resta/Middleware/ExcludeMiddleware.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
      * @param callable $callback
30 30
      * @return mixed
31 31
      */
32
-    public function exclude($middleware,callable $callback)
32
+    public function exclude($middleware, callable $callback)
33 33
     {
34 34
         $this->result = true;
35 35
 
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 
42 42
         //if there is exclude method
43 43
         //in service middleware class
44
-        if($this->existMethod()){
44
+        if ($this->existMethod()) {
45 45
 
46 46
             //call exclude method
47 47
             /**
@@ -50,24 +50,24 @@  discard block
 block discarded – undo
50 50
             $serviceMiddleware = $middleware['class'];
51 51
             $excludes = $serviceMiddleware->exclude();
52 52
 
53
-            foreach ($excludes as $excludeKey=>$excludeVal){
54
-                $this->excludeProcess($excludeKey,$excludeVal);
53
+            foreach ($excludes as $excludeKey=>$excludeVal) {
54
+                $this->excludeProcess($excludeKey, $excludeVal);
55 55
             }
56 56
         }
57 57
 
58 58
         //return true
59
-        return Utils::returnCallback($this->result,$callback);
59
+        return Utils::returnCallback($this->result, $callback);
60 60
     }
61 61
 
62 62
     /**
63 63
      * @param $excludeKey
64 64
      * @param $excludeVal
65 65
      */
66
-    private function excludeProcess($excludeKey,$excludeVal)
66
+    private function excludeProcess($excludeKey, $excludeVal)
67 67
     {
68
-        $this->excludeForAll($excludeKey,$excludeVal,function() use ($excludeKey,$excludeVal){
68
+        $this->excludeForAll($excludeKey, $excludeVal, function() use ($excludeKey, $excludeVal){
69 69
 
70
-            if($excludeKey == $this->excludeList['middleware']['middlewareName']){
70
+            if ($excludeKey==$this->excludeList['middleware']['middlewareName']) {
71 71
                 $this->result = true;
72 72
                 $this->inArrayExclude($excludeVal);
73 73
 
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
      */
81 81
     private function existMethod()
82 82
     {
83
-        return Utils::existMethod($this->excludeList['middleware']['class'],'exclude');
83
+        return Utils::existMethod($this->excludeList['middleware']['class'], 'exclude');
84 84
     }
85 85
 
86 86
     /**
@@ -88,8 +88,8 @@  discard block
 block discarded – undo
88 88
      */
89 89
     private function inArrayExclude($exclude)
90 90
     {
91
-        foreach($exclude as $item){
92
-            if(in_array($item,$this->middleware['odds'])){
91
+        foreach ($exclude as $item) {
92
+            if (in_array($item, $this->middleware['odds'])) {
93 93
                 $this->result = false;
94 94
             }
95 95
         }
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
      * @param callable $callback
102 102
      * @return mixed
103 103
      */
104
-    private function excludeForAll($excludeKey,$excludeVal,callable $callback)
104
+    private function excludeForAll($excludeKey, $excludeVal, callable $callback)
105 105
     {
106 106
         return ($excludeKey=="all") ? $this->inArrayExclude($excludeVal) : call_user_func($callback);
107 107
     }
Please login to merge, or discard this patch.
src/resta/Console/Source/Project/Project.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
     /**
16 16
      * @var $type
17 17
      */
18
-    public $type='project';
18
+    public $type = 'project';
19 19
 
20 20
     /**
21 21
      * @var array
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
     /**
33 33
      * @var $commandRule
34 34
      */
35
-    public $commandRule=[];
35
+    public $commandRule = [];
36 36
 
37 37
     /**
38 38
      * @method create
@@ -47,17 +47,17 @@  discard block
 block discarded – undo
47 47
         $this->directory['projectDir']          = $this->projectPath();
48 48
         $this->argument['exceptionNamespace']   = app()->namespace()->exception();
49 49
         $this->argument['resourcePath']         = app()->path()->appResourche();
50
-        $this->argument['testNamespace']             = app()->namespace()->tests();
50
+        $this->argument['testNamespace'] = app()->namespace()->tests();
51 51
 
52
-        $recursiveDefaultDirectory = explode("\\",$this->argument['project']);
52
+        $recursiveDefaultDirectory = explode("\\", $this->argument['project']);
53 53
         $this->argument['applicationName'] = pos($recursiveDefaultDirectory);
54 54
         $recursiveDefaultDirectory[] = 'V1';
55 55
         $recursiveDefaultDirectoryList = [];
56 56
 
57
-        foreach (array_slice($recursiveDefaultDirectory,1) as $defaultDirectory){
57
+        foreach (array_slice($recursiveDefaultDirectory, 1) as $defaultDirectory) {
58 58
 
59
-            $recursiveDefaultDirectoryList[]=$defaultDirectory;
60
-            $this->directory[$defaultDirectory.'Path'] = $this->projectPath().''.implode("/",$recursiveDefaultDirectoryList);
59
+            $recursiveDefaultDirectoryList[] = $defaultDirectory;
60
+            $this->directory[$defaultDirectory.'Path'] = $this->projectPath().''.implode("/", $recursiveDefaultDirectoryList);
61 61
         }
62 62
 
63 63
         //$this->directory['optionalDir'] = $this->optional();
@@ -99,11 +99,11 @@  discard block
 block discarded – undo
99 99
         $this->touch['kernel/exception']            = $this->provider().'/ExceptionServiceProvider.php';
100 100
         $this->touch['kernel/response']             = $this->provider().'/ResponseServiceProvider.php';
101 101
         $this->touch['kernel/entity']               = $this->provider().'/EntityServiceProvider.php';
102
-        $this->touch['kernel/cache']               = $this->provider().'/CacheServiceProvider.php';
102
+        $this->touch['kernel/cache'] = $this->provider().'/CacheServiceProvider.php';
103 103
         $this->touch['kernel/authenticate']         = $this->provider().'/AuthenticateServiceProvider.php';
104 104
         $this->touch['kernel/role']                 = $this->provider().'/RoleServiceProvider.php';
105 105
         $this->touch['kernel/track']                = $this->provider().'/TrackServiceProvider.php';
106
-        $this->touch['test/testcase']              = $this->test().'/TestCase.php';
106
+        $this->touch['test/testcase'] = $this->test().'/TestCase.php';
107 107
         $this->touch['kernel/consoleevent']         = $this->provider().'/ConsoleEventServiceProvider.php';
108 108
         $this->touch['middleware/authenticate']     = $this->middleware().'/Authenticate.php';
109 109
         $this->touch['middleware/ratelimit']        = $this->middleware().'/RateLimit.php';
@@ -121,16 +121,16 @@  discard block
 block discarded – undo
121 121
         $this->touch['resource/index']              = $this->resource().'/index.html';
122 122
         $this->touch['resource/index']              = $this->resource().'/'.StaticPathModel::$cache.'/index.html';
123 123
         $this->touch['stub/index']                  = $this->stub().'/index.html';
124
-        $this->touch['stub/cccrudapp']              = $this->directory['stubControllerCreateCrudFileDir'] .'/app.stub';
125
-        $this->touch['stub/cccrudconf']              = $this->directory['stubControllerCreateCrudFileDir'] .'/conf.stub';
126
-        $this->touch['stub/cccrudcontrollerfilecrud']              = $this->directory['stubControllerCreateCrudFileDir'] .'/controllerfilecrud.stub';
127
-        $this->touch['stub/cccruddeveloper']              = $this->directory['stubControllerCreateCrudFileDir'] .'/developer.stub';
128
-        $this->touch['stub/cccruddoc']              = $this->directory['stubControllerCreateCrudFileDir'] .'/doc.stub';
129
-        $this->touch['stub/cccruddummy']              = $this->directory['stubControllerCreateCrudFileDir'] .'/dummy.stub';
130
-        $this->touch['stub/cccrudroute']              = $this->directory['stubControllerCreateCrudFileDir'] .'/routecrud.stub';
131
-        $this->touch['stub/cccrudpolicy']              = $this->directory['stubControllerCreateCrudFileDir'] .'/policy.stub';
132
-        $this->touch['stub/cccrudreadme']              = $this->directory['stubControllerCreateCrudFileDir'] .'/readme.stub';
133
-        $this->touch['stub/cccrudresourceindex']              = $this->directory['stubControllerCreateCrudFileDir'] .'/resourceIndex.stub';
124
+        $this->touch['stub/cccrudapp']              = $this->directory['stubControllerCreateCrudFileDir'].'/app.stub';
125
+        $this->touch['stub/cccrudconf'] = $this->directory['stubControllerCreateCrudFileDir'].'/conf.stub';
126
+        $this->touch['stub/cccrudcontrollerfilecrud'] = $this->directory['stubControllerCreateCrudFileDir'].'/controllerfilecrud.stub';
127
+        $this->touch['stub/cccruddeveloper'] = $this->directory['stubControllerCreateCrudFileDir'].'/developer.stub';
128
+        $this->touch['stub/cccruddoc'] = $this->directory['stubControllerCreateCrudFileDir'].'/doc.stub';
129
+        $this->touch['stub/cccruddummy']              = $this->directory['stubControllerCreateCrudFileDir'].'/dummy.stub';
130
+        $this->touch['stub/cccrudroute']              = $this->directory['stubControllerCreateCrudFileDir'].'/routecrud.stub';
131
+        $this->touch['stub/cccrudpolicy']              = $this->directory['stubControllerCreateCrudFileDir'].'/policy.stub';
132
+        $this->touch['stub/cccrudreadme']              = $this->directory['stubControllerCreateCrudFileDir'].'/readme.stub';
133
+        $this->touch['stub/cccrudresourceindex'] = $this->directory['stubControllerCreateCrudFileDir'].'/resourceIndex.stub';
134 134
         $this->touch['config/hateoas']              = $this->config().'/Hateoas.php';
135 135
         //$this->touch['config/response']             = $this->config().'/Response.php';
136 136
         $this->touch['config/redis']                = $this->config().'/Redis.php';
@@ -154,9 +154,9 @@  discard block
 block discarded – undo
154 154
         $this->touch['app/gitignore']               = $this->projectPath().'/.gitignore';
155 155
         $this->touch['app/composer']                = $this->projectPath().'/composer.json';
156 156
         $this->touch['test/index']                  = $this->storage().'/index.html';
157
-        $this->touch['exception/authenticate']      = $this->directory['exceptionDir'] .'/AuthenticateException.php';
158
-        $this->touch['exception/noinput']           = $this->directory['exceptionDir'] .'/NoInputException.php';
159
-        $this->touch['helpers/general']              = $this->directory['helperDir'] .'/General.php';
157
+        $this->touch['exception/authenticate']      = $this->directory['exceptionDir'].'/AuthenticateException.php';
158
+        $this->touch['exception/noinput']           = $this->directory['exceptionDir'].'/NoInputException.php';
159
+        $this->touch['helpers/general'] = $this->directory['helperDir'].'/General.php';
160 160
 
161 161
         //set project touch
162 162
         $this->file->touch($this);
Please login to merge, or discard this patch.
src/resta/Console/ConsoleProvider.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -27,13 +27,13 @@  discard block
 block discarded – undo
27 27
     {
28 28
         // we check that they are in
29 29
         // the console to run the console commands in the kernel.
30
-        if(Utils::isNamespaceExists($this->consoleClassNamespace)){
30
+        if (Utils::isNamespaceExists($this->consoleClassNamespace)) {
31 31
             return call_user_func($callback);
32 32
         }
33 33
 
34 34
         // if the kernel console is not found
35 35
         // then we check the existence of the specific application command and run it if it is.
36
-        return (new CustomConsoleProcess($this->getConsoleArgumentsWithKey(),$this))->handle();
36
+        return (new CustomConsoleProcess($this->getConsoleArgumentsWithKey(), $this))->handle();
37 37
 
38 38
     }
39 39
 
@@ -43,29 +43,29 @@  discard block
 block discarded – undo
43 43
      * @param array $args
44 44
      * @return void|mixed
45 45
      */
46
-    protected function consoleEventHandler($args=array())
46
+    protected function consoleEventHandler($args = array())
47 47
     {
48
-        if(isset($this->app['eventDispatcher'])){
48
+        if (isset($this->app['eventDispatcher'])) {
49 49
 
50 50
             $listeners = event()->getListeners();
51 51
 
52
-            if(isset($args['event']) && isset($listeners['console'])){
52
+            if (isset($args['event']) && isset($listeners['console'])) {
53 53
 
54
-                if(strtolower($args['event'])!=='default' && isset($listeners['console'][strtolower($args['event'])])){
54
+                if (strtolower($args['event'])!=='default' && isset($listeners['console'][strtolower($args['event'])])) {
55 55
 
56 56
                     $event = $listeners['console'][strtolower($args['event'])];
57
-                    return call_user_func_array($event,['app'=>$this->app,'args'=>$args,]);
57
+                    return call_user_func_array($event, ['app'=>$this->app, 'args'=>$args, ]);
58 58
                 }
59 59
             }
60 60
 
61
-            if(isset($listeners['console']['default'])){
61
+            if (isset($listeners['console']['default'])) {
62 62
                 
63
-                if($this->app->has('arguments')){
64
-                    $args = array_merge($args,$this->app->get('arguments'));
63
+                if ($this->app->has('arguments')) {
64
+                    $args = array_merge($args, $this->app->get('arguments'));
65 65
                 }
66 66
 
67 67
                 $event = $listeners['console']['default'];
68
-                return call_user_func_array($event,['args'=>$args,'app'=>$this->app]);
68
+                return call_user_func_array($event, ['args'=>$args, 'app'=>$this->app]);
69 69
             }
70 70
         }
71 71
 
@@ -83,9 +83,9 @@  discard block
 block discarded – undo
83 83
 
84 84
         //If the console executor is a custom console application; in this case we look at the kernel directory inside the application.
85 85
         //If the console class is not available on the kernel of resta, then the system will run the command class in the application.
86
-        return $this->checkConsoleNamespace(function(){
86
+        return $this->checkConsoleNamespace(function() {
87 87
 
88
-            if($this->isRunnableKernelCommandList()){
88
+            if ($this->isRunnableKernelCommandList()) {
89 89
                 exception()->badMethodCall('this command is not runnable');
90 90
             }
91 91
 
@@ -93,10 +93,10 @@  discard block
 block discarded – undo
93 93
             $consoleArguments = $this->getConsoleArgumentsWithKey();
94 94
 
95 95
             // we get the instance data of the kernel command class of the system.
96
-            $commander = (new $this->consoleClassNamespace($consoleArguments,$this));
96
+            $commander = (new $this->consoleClassNamespace($consoleArguments, $this));
97 97
 
98 98
             // we check the command rules of each command class.
99
-            $this->prepareCommander($commander,function($commander){
99
+            $this->prepareCommander($commander, function($commander) {
100 100
                 return $commander->{$this->getConsoleClassMethod()}();
101 101
             });
102 102
 
@@ -114,12 +114,12 @@  discard block
 block discarded – undo
114 114
     public function handle()
115 115
     {
116 116
         //get is running console
117
-        if($this->app->runningInConsole()){
117
+        if ($this->app->runningInConsole()) {
118 118
 
119 119
             error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);
120 120
 
121 121
             //run console process
122
-            if(count($this->getArguments())){
122
+            if (count($this->getArguments())) {
123 123
                 return $this->consoleProcess();
124 124
             }
125 125
 
@@ -135,24 +135,24 @@  discard block
 block discarded – undo
135 135
      * @param callable $callback
136 136
      * @return mixed
137 137
      */
138
-    protected function prepareCommander(ConsoleOutputterContracts $commander,callable $callback)
138
+    protected function prepareCommander(ConsoleOutputterContracts $commander, callable $callback)
139 139
     {
140 140
         // closure binding custom command,move custom namespace as specific
141 141
         // call prepare commander firstly for checking command builder
142
-        $closureCommand = app()->resolve(ClosureDispatcher::class,['bind'=>$commander]);
142
+        $closureCommand = app()->resolve(ClosureDispatcher::class, ['bind'=>$commander]);
143 143
 
144 144
         //assign commander method name
145 145
         $closureCommand->prepareBind['methodName'] = $this->getConsoleClassMethod();
146 146
 
147 147
         $prepareCommander = $commander->prepareCommander($closureCommand);
148 148
 
149
-        if(!$prepareCommander['status']){
149
+        if (!$prepareCommander['status']) {
150 150
             echo $commander->exception($prepareCommander);
151 151
             die();
152 152
         }
153 153
 
154 154
         //callback custom console
155
-        return call_user_func_array($callback,[$commander]);
155
+        return call_user_func_array($callback, [$commander]);
156 156
     }
157 157
 
158 158
     /**
@@ -165,8 +165,8 @@  discard block
 block discarded – undo
165 165
         $commandList = $this->app->commandList();
166 166
 
167 167
         //is runnable kernel command conditions
168
-        return !array_key_exists($this->consoleClassNamespace,$commandList) OR
169
-            (array_key_exists($this->consoleClassNamespace,$commandList) AND
168
+        return !array_key_exists($this->consoleClassNamespace, $commandList) OR
169
+            (array_key_exists($this->consoleClassNamespace, $commandList) AND
170 170
                 !$commandList[$this->consoleClassNamespace]['isRunnable']);
171 171
     }
172 172
 }
173 173
\ No newline at end of file
Please login to merge, or discard this patch.
src/resta/Support/FileSystem.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
         $path = realpath($path) ?: $path;
131 131
         $tempPath = tempnam(dirname($path), basename($path));
132 132
         // Fix permissions of tempPath because `tempnam()` creates it with permissions set to 0600...
133
-        chmod($tempPath, 0777 - umask());
133
+        chmod($tempPath, 0777-umask());
134 134
         file_put_contents($tempPath, $content);
135 135
         rename($tempPath, $path);
136 136
     }
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
         $success = true;
190 190
         foreach ($paths as $path) {
191 191
             try {
192
-                if (! @unlink($path)) {
192
+                if (!@unlink($path)) {
193 193
                     $success = false;
194 194
                 }
195 195
             } catch (ErrorException $e) {
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
      */
233 233
     public function link($target, $link)
234 234
     {
235
-        if (! windows_os()) {
235
+        if (!windows_os()) {
236 236
             return symlink($target, $link);
237 237
         }
238 238
         $mode = $this->isDirectory($target) ? 'J' : 'H';
@@ -393,7 +393,7 @@  discard block
 block discarded – undo
393 393
     public function files($directory, $hidden = false)
394 394
     {
395 395
         return iterator_to_array(
396
-            Finder::create()->files()->ignoreDotFiles(! $hidden)->in($directory)->depth(0)->sortByName(),
396
+            Finder::create()->files()->ignoreDotFiles(!$hidden)->in($directory)->depth(0)->sortByName(),
397 397
             false
398 398
         );
399 399
     }
@@ -408,7 +408,7 @@  discard block
 block discarded – undo
408 408
     public function allFiles($directory, $hidden = false)
409 409
     {
410 410
         return iterator_to_array(
411
-            Finder::create()->files()->ignoreDotFiles(! $hidden)->in($directory)->sortByName(),
411
+            Finder::create()->files()->ignoreDotFiles(!$hidden)->in($directory)->sortByName(),
412 412
             false
413 413
         );
414 414
     }
@@ -455,10 +455,10 @@  discard block
 block discarded – undo
455 455
      */
456 456
     public function moveDirectory($from, $to, $overwrite = false)
457 457
     {
458
-        if ($overwrite && $this->isDirectory($to) && ! $this->deleteDirectory($to)) {
458
+        if ($overwrite && $this->isDirectory($to) && !$this->deleteDirectory($to)) {
459 459
             return false;
460 460
         }
461
-        return @rename($from, $to) === true;
461
+        return @rename($from, $to)===true;
462 462
     }
463 463
 
464 464
     /**
@@ -471,14 +471,14 @@  discard block
 block discarded – undo
471 471
      */
472 472
     public function copyDirectory($directory, $destination, $options = null)
473 473
     {
474
-        if (! $this->isDirectory($directory)) {
474
+        if (!$this->isDirectory($directory)) {
475 475
             return false;
476 476
         }
477 477
         $options = $options ?: FilesystemIterator::SKIP_DOTS;
478 478
         // If the destination directory does not actually exist, we will go ahead and
479 479
         // create it recursively, which just gets the destination prepared to copy
480 480
         // the files over. Once we make the directory we'll proceed the copying.
481
-        if (! $this->isDirectory($destination)) {
481
+        if (!$this->isDirectory($destination)) {
482 482
             $this->makeDirectory($destination, 0777, true);
483 483
         }
484 484
         $items = new FilesystemIterator($directory, $options);
@@ -489,7 +489,7 @@  discard block
 block discarded – undo
489 489
             $target = $destination.'/'.$item->getBasename();
490 490
             if ($item->isDir()) {
491 491
                 $path = $item->getPathname();
492
-                if (! $this->copyDirectory($path, $target, $options)) {
492
+                if (!$this->copyDirectory($path, $target, $options)) {
493 493
                     return false;
494 494
                 }
495 495
             }
@@ -497,7 +497,7 @@  discard block
 block discarded – undo
497 497
             // location and keep looping. If for some reason the copy fails we'll bail out
498 498
             // and return false, so the developer is aware that the copy process failed.
499 499
             else {
500
-                if (! $this->copy($item->getPathname(), $target)) {
500
+                if (!$this->copy($item->getPathname(), $target)) {
501 501
                     return false;
502 502
                 }
503 503
             }
@@ -516,7 +516,7 @@  discard block
 block discarded – undo
516 516
      */
517 517
     public function deleteDirectory($directory, $preserve = false)
518 518
     {
519
-        if (! $this->isDirectory($directory)) {
519
+        if (!$this->isDirectory($directory)) {
520 520
             return false;
521 521
         }
522 522
         $items = new FilesystemIterator($directory);
@@ -524,7 +524,7 @@  discard block
 block discarded – undo
524 524
             // If the item is a directory, we can just recurse into the function and
525 525
             // delete that sub-directory otherwise we'll just delete the file and
526 526
             // keep iterating through each file until the directory is cleaned.
527
-            if ($item->isDir() && ! $item->isLink()) {
527
+            if ($item->isDir() && !$item->isLink()) {
528 528
                 $this->deleteDirectory($item->getPathname());
529 529
             }
530 530
             // If the item is just a file, we can go ahead and delete it since we're
@@ -534,7 +534,7 @@  discard block
 block discarded – undo
534 534
                 $this->delete($item->getPathname());
535 535
             }
536 536
         }
537
-        if (! $preserve) {
537
+        if (!$preserve) {
538 538
             @rmdir($directory);
539 539
         }
540 540
         return true;
@@ -549,7 +549,7 @@  discard block
 block discarded – undo
549 549
     public function deleteDirectories($directory)
550 550
     {
551 551
         $allDirectories = $this->directories($directory);
552
-        if (! empty($allDirectories)) {
552
+        if (!empty($allDirectories)) {
553 553
             foreach ($allDirectories as $directoryName) {
554 554
                 $this->deleteDirectory($directoryName);
555 555
             }
@@ -580,17 +580,17 @@  discard block
 block discarded – undo
580 580
      */
581 581
     public function getAllFilesInDirectory($dir, $recursive = true, $basedir = '', $include_dirs = false)
582 582
     {
583
-        if ($dir == '') {return array();} else {$results = array(); $subresults = array();}
584
-        if (!is_dir($dir)) {$dir = dirname($dir);} // so a files path can be sent
585
-        if ($basedir == '') {$basedir = realpath($dir).DIRECTORY_SEPARATOR;}
583
+        if ($dir=='') {return array(); } else {$results = array(); $subresults = array(); }
584
+        if (!is_dir($dir)) {$dir = dirname($dir); } // so a files path can be sent
585
+        if ($basedir=='') {$basedir = realpath($dir).DIRECTORY_SEPARATOR; }
586 586
 
587 587
         $files = scandir($dir);
588
-        foreach ($files as $key => $value){
589
-            if ( ($value != '.') && ($value != '..') ) {
588
+        foreach ($files as $key => $value) {
589
+            if (($value!='.') && ($value!='..')) {
590 590
                 $path = realpath($dir.DIRECTORY_SEPARATOR.$value);
591 591
                 if (is_dir($path)) {
592 592
                     // optionally include directories in file list
593
-                    if ($include_dirs) {$subresults[] = str_replace($basedir, '', $path);}
593
+                    if ($include_dirs) {$subresults[] = str_replace($basedir, '', $path); }
594 594
                     // optionally get file list for all subdirectories
595 595
                     if ($recursive) {
596 596
                         $subdirresults = $this->getAllFilesInDirectory($path, $recursive, $basedir, $include_dirs);
@@ -603,7 +603,7 @@  discard block
 block discarded – undo
603 603
             }
604 604
         }
605 605
         // merge the subarray to give the list of files then subdirectory files
606
-        if (count($subresults) > 0) {$results = array_merge($subresults, $results);}
606
+        if (count($subresults)>0) {$results = array_merge($subresults, $results); }
607 607
         return $results;
608 608
     }
609 609
 
@@ -625,15 +625,15 @@  discard block
 block discarded – undo
625 625
      * @param $param
626 626
      * @return bool
627 627
      */
628
-    public function change($executionPath,$param)
628
+    public function change($executionPath, $param)
629 629
     {
630 630
         $dt = fopen($executionPath, "r");
631 631
         $content = fread($dt, filesize($executionPath));
632 632
         fclose($dt);
633 633
 
634
-        foreach ($param as $key=>$value){
634
+        foreach ($param as $key=>$value) {
635 635
 
636
-            $content=str_replace("".$key."",$value,$content);
636
+            $content = str_replace("".$key."", $value, $content);
637 637
         }
638 638
 
639 639
         $dt = fopen($executionPath, "w");
Please login to merge, or discard this patch.
src/resta/Database/Migration/Src/Resource/PushManager/Pushing.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
      */
23 23
     public function handle()
24 24
     {
25
-        foreach ($this->tableFilters() as $table=>$files){
25
+        foreach ($this->tableFilters() as $table=>$files) {
26 26
 
27 27
             $table = strtolower($table);
28 28
 
@@ -30,24 +30,24 @@  discard block
 block discarded – undo
30 30
 
31 31
                 $checkMigrationMain = $this->schema->getConnection()->checkMigrationMain();
32 32
                 
33
-                if($checkMigrationMain===false && isset($this->tableFilters()['Migrations'][0])){
34
-                    $this->apply($this->tableFilters()['Migrations'][0],'migrations');
33
+                if ($checkMigrationMain===false && isset($this->tableFilters()['Migrations'][0])) {
34
+                    $this->apply($this->tableFilters()['Migrations'][0], 'migrations');
35 35
                 }
36 36
                 
37
-                $checkMigration = $this->schema->getConnection()->checkMigration($table,$file);
37
+                $checkMigration = $this->schema->getConnection()->checkMigration($table, $file);
38 38
                 
39
-                if(!$checkMigration){
39
+                if (!$checkMigration) {
40 40
 
41
-                    $getClassName = preg_replace('@(\d+)_@is','',$file);
41
+                    $getClassName = preg_replace('@(\d+)_@is', '', $file);
42 42
                     $className = $this->getClassName($getClassName);
43 43
 
44 44
                     require_once ($file);
45 45
 
46
-                    $capsule = new SchemaCapsule($this->config,$file,$table);
46
+                    $capsule = new SchemaCapsule($this->config, $file, $table);
47 47
 
48 48
                     $this->list[$table][] = (new $className)->up($capsule);
49 49
 
50
-                    if(app()->has('arguments')){
50
+                    if (app()->has('arguments')) {
51 51
                         app()->terminate('arguments');
52 52
                     }
53 53
 
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
             }
56 56
         }
57 57
 
58
-        app()->register('arguments','connection',$this->schema->getConnection());
58
+        app()->register('arguments', 'connection', $this->schema->getConnection());
59 59
         return $this->processHandler();
60 60
     }
61 61
 
@@ -64,14 +64,14 @@  discard block
 block discarded – undo
64 64
      * @param $table
65 65
      * @return mixed|string
66 66
      */
67
-    public function apply($file,$table)
67
+    public function apply($file, $table)
68 68
     {
69
-        $getClassName = preg_replace('@(\d+)_@is','',$file);
69
+        $getClassName = preg_replace('@(\d+)_@is', '', $file);
70 70
         $className = $this->getClassName($getClassName);
71 71
 
72 72
         require_once ($file);
73 73
 
74
-        $capsule = new SchemaCapsule($this->config,$file,$table);
74
+        $capsule = new SchemaCapsule($this->config, $file, $table);
75 75
 
76 76
         $this->list[$table][] = (new $className)->up($capsule);
77 77
 
Please login to merge, or discard this patch.