Passed
Push — dev ( 44a5a9...75307b )
by Yan
02:18
created
src/Lincable/Parsers/Parser.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
             // Now that we have verified the option is dynamic and has 
87 87
             // matches, we get the Option object from the implemented
88 88
             // method to deal with the matches.  
89
-            $parameter =  $this->parseMatches($this->getMatches($option));
89
+            $parameter = $this->parseMatches($this->getMatches($option));
90 90
 
91 91
             // Return the content of the option executed.
92 92
             return $this->runForParameter($parameter);
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
      */
104 104
     public function addFormatters($formatters)
105 105
     {
106
-        array_walk($formatters, function ($formatter, $name) {
106
+        array_walk($formatters, function($formatter, $name) {
107 107
             $this->addFormatter($formatter, is_int($name) ? null : $name);
108 108
         });
109 109
 
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
      * @param  array $params
212 212
      * @return mixed
213 213
      */
214
-    protected function callFormatter($formatter, array $params = [])
214
+    protected function callFormatter($formatter, array $params = [ ])
215 215
     {
216 216
         return $this->getContainer()->call($formatter, $params);
217 217
     }
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
             $formatter = $this->getContainer()->make($formatter);
237 237
         }
238 238
 
239
-        return [$formatter, 'format'];
239
+        return [ $formatter, 'format' ];
240 240
     }
241 241
 
242 242
     /**
Please login to merge, or discard this patch.
src/Lincable/Parsers/Options.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -42,6 +42,6 @@
 block discarded – undo
42 42
      */
43 43
     public function getParams(): array
44 44
     {
45
-       return $this->params; 
45
+        return $this->params; 
46 46
     }
47 47
 }
48 48
\ No newline at end of file
Please login to merge, or discard this patch.
src/Lincable/Eloquent/Lincable.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@
 block discarded – undo
11 11
      */
12 12
     public static function bootLincable()
13 13
     {
14
-        static::creating(function ($model) {
14
+        static::creating(function($model) {
15 15
             $model->addLincableFields();
16 16
         });
17 17
     }
Please login to merge, or discard this patch.
src/Lincable/Concerns/BuildClassnames.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@
 block discarded – undo
39 39
     protected function buildNamespace(array $classes)
40 40
     {
41 41
         // Transform all class names.
42
-        array_walk($classes, function (&$class, $key) {
42
+        array_walk($classes, function(&$class, $key) {
43 43
 
44 44
             // Determine wheter class starts with backslash.
45 45
             $appends = starts_with($class, '\\');
Please login to merge, or discard this patch.
src/Lincable/UrlConf.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
      *
16 16
      * @var array
17 17
      */
18
-    protected $configuration = [];
18
+    protected $configuration = [ ];
19 19
 
20 20
     /**
21 21
      * The base namespace for the models.
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
      */
44 44
     public function has($key)
45 45
     {
46
-        return isset($this->configuration[$key]);
46
+        return isset($this->configuration[ $key ]);
47 47
     }
48 48
 
49 49
     /**
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
      */
56 56
     public function get($key, $default = null)
57 57
     {
58
-        return $this->has($key) ? $this->configuration[$key] : $default;
58
+        return $this->has($key) ? $this->configuration[ $key ] : $default;
59 59
     }
60 60
 
61 61
     /**
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
             $key = $this->getModelFromKey($key);
90 90
 
91 91
             // Set the configuration.
92
-            $this->configuration[$key] = $value;
92
+            $this->configuration[ $key ] = $value;
93 93
         }
94 94
     }
95 95
 
@@ -143,12 +143,12 @@  discard block
 block discarded – undo
143 143
     {
144 144
         $model = $key;
145 145
 
146
-        if (str_contains($key, '.') || ! str_contains($key, '\\')) {
146
+        if (str_contains($key, '.') || !str_contains($key, '\\')) {
147 147
             
148 148
             // Build the class namespace using the base model namespace
149 149
             // and the parts of the key splitted by dots.
150
-            $model =  $this->buildNamespace(array_merge(
151
-                [$this->modelsNamespace],
150
+            $model = $this->buildNamespace(array_merge(
151
+                [ $this->modelsNamespace ],
152 152
                 array_map('ucfirst', explode('.', $key))
153 153
             ));
154 154
         }
Please login to merge, or discard this patch.
src/Lincable/UrlGenerator.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
      * @param  array $params
76 76
      * @return this
77 77
      */
78
-    public function forModel(Model $model, array $params = [])
78
+    public function forModel(Model $model, array $params = [ ])
79 79
     {
80 80
         // Verify wheter we have the model fully configured on the url configuration.
81 81
         $this->guardModel($model);
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
         // The model class name.
101 101
         $className = get_class($model);
102 102
 
103
-        if (! $this->urlConf->has($className)) {
103
+        if (!$this->urlConf->has($className)) {
104 104
             throw new NoModelConfException("Model [{$className}] is not configured. Check your lincable url configuration.");
105 105
         }
106 106
 
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
      * @param  array $params
116 116
      * @return void
117 117
      */
118
-    protected function setModelFormatters(array $customParams = [])
118
+    protected function setModelFormatters(array $customParams = [ ])
119 119
     {
120 120
         $attributes = $this->getModel()->getAttributes();
121 121
 
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
      */
137 137
     public function generate()
138 138
     {
139
-        return $this->availableParsers->reduce(function ($url, Parser $parser) {
139
+        return $this->availableParsers->reduce(function($url, Parser $parser) {
140 140
 
141 141
             // Set the compiler current parser.
142 142
             $this->compiler->setParser($parser);
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
         $url = $this->getRawUrl();
252 252
 
253 253
         // Get all dynamic parameters on url from model parsers.
254
-        $dynamics = $this->availableParsers->map(function (Parser $parser) use ($url) {
254
+        $dynamics = $this->availableParsers->map(function(Parser $parser) use ($url) {
255 255
 
256 256
             // Set the current parser.
257 257
             $this->compiler->setParser($parser);
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
             return $this->compiler->parseDynamics($url);
260 260
         })->flatten()->all();
261 261
         
262
-        return array_filter($parameters, function ($key) use ($dynamics) {
262
+        return array_filter($parameters, function($key) use ($dynamics) {
263 263
             return in_array($key, $dynamics);
264 264
         }, ARRAY_FILTER_USE_KEY);
265 265
     }
@@ -272,18 +272,18 @@  discard block
 block discarded – undo
272 272
      */
273 273
     protected function injectFormatterToAvailableParsers(array $dynamicParameters)
274 274
     {
275
-        $this->availableParsers->each(function (Parser $parser) use ($dynamicParameters) {
275
+        $this->availableParsers->each(function(Parser $parser) use ($dynamicParameters) {
276 276
             foreach ($dynamicParameters as $key => $value) {
277 277
 
278 278
                 // Register the formatter for the key, and the logic function is to return
279
-                $parser->addFormatter(function () use ($value, $parser) {
279
+                $parser->addFormatter(function() use ($value, $parser) {
280 280
                     if ($this->parameterResolver) {
281 281
 
282 282
                         // Get the container instance on parser class.
283 283
                         $container = $parser->getContainer();
284 284
 
285 285
                         // Call the parameter resolver for the value returned.
286
-                        $value = $container->call($this->parameterResolver, [$value]);
286
+                        $value = $container->call($this->parameterResolver, [ $value ]);
287 287
                     }
288 288
 
289 289
                     return $value;
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
         $url = $this->getRawUrl();
304 304
 
305 305
         // Get parsers that has dynamic parameters for model url.
306
-        $availableParsers = $this->parsers->filter(function (Parser $parser) use ($url) {
306
+        $availableParsers = $this->parsers->filter(function(Parser $parser) use ($url) {
307 307
 
308 308
             // Change the current compiler parser.
309 309
             $this->compiler->setParser($parser);
Please login to merge, or discard this patch.
src/Lincable/UrlCompiler.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
     public function compile(string $url): string
35 35
     {
36 36
         // Parse each fragment on url.
37
-        $fragments = array_map(function ($fragment) {
37
+        $fragments = array_map(function($fragment) {
38 38
             if ($this->getParser()->isParameterDynamic($fragment)) {
39 39
 
40 40
                 // We assume the parameter fragment is dynamic for
@@ -58,14 +58,14 @@  discard block
 block discarded – undo
58 58
     {
59 59
         $fragments = $this->parseUrlFragments($url);
60 60
 
61
-        $dynamicParameters = array_filter($fragments, function ($parameter) {
61
+        $dynamicParameters = array_filter($fragments, function($parameter) {
62 62
 
63 63
             // Determine wheter the parameter is dynamic on parser
64 64
             // and should be kept.
65 65
             return $this->getParser()->isParameterDynamic($parameter);
66 66
         });
67 67
 
68
-        return array_map(function ($parameter) {
68
+        return array_map(function($parameter) {
69 69
 
70 70
             // Return the matches for the dynamic parameter.
71 71
             return $this->getParser()->getMatches($parameter);
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
      */
81 81
     public function hasDynamics(string $url): bool
82 82
     {
83
-        return ! empty(array_values($this->parseDynamics($url)));
83
+        return !empty(array_values($this->parseDynamics($url)));
84 84
     }
85 85
 
86 86
     /**
Please login to merge, or discard this patch.
src/Lincable/Http/FileRequest.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
      */
126 126
     protected function parseValidationRules(UploadedFile $file)
127 127
     {
128
-        return [$this->getParameter() => $this->rules($file)];
128
+        return [ $this->getParameter() => $this->rules($file) ];
129 129
     }
130 130
 
131 131
     /**
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
         $eventMethod = 'beforeSend';
153 153
 
154 154
         if (method_exists($this, $eventMethod)) {
155
-            $app->call([$this, $method], $file);
155
+            $app->call([ $this, $method ], $file);
156 156
         }
157 157
     }
158 158
 
Please login to merge, or discard this patch.