Completed
Branch master (e16ac9)
by Keoghan
06:23
created
src/Transformer.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -366,7 +366,7 @@
 block discarded – undo
366 366
     }
367 367
 
368 368
     /**
369
-     * @param RulePack|String $rulePack
369
+     * @param RulePack $rulePack
370 370
      *
371 371
      * @return bool
372 372
      */
Please login to merge, or discard this patch.
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -6,7 +6,6 @@
 block discarded – undo
6 6
 use Illuminate\Support\Collection;
7 7
 use Konsulting\Laravel\Transformer\RulePacks\RulePack;
8 8
 use Konsulting\Laravel\Transformer\Exceptions\InvalidRule;
9
-use Konsulting\Laravel\Transformer\Exceptions\UnexpectedValue;
10 9
 
11 10
 class Transformer
12 11
 {
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
      */
82 82
     public function __construct($rulePacks = [], $rules = [])
83 83
     {
84
-        $this->addRulePacks((array)$rulePacks)->setRules($rules);
84
+        $this->addRulePacks((array) $rulePacks)->setRules($rules);
85 85
     }
86 86
 
87 87
     /**
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
         $regex = str_replace(['.', '*'], ['\.', '([^\\.|]+)'], $fieldExpression);
259 259
         preg_match_all("/({$regex})/", $this->dataKeysForRegex, $matches, PREG_SET_ORDER);
260 260
 
261
-        return array_reduce($matches, function ($results, $match) {
261
+        return array_reduce($matches, function($results, $match) {
262 262
             $results[$match[0]] = array_slice($match, 2);
263 263
             return $results;
264 264
         }, []);
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
      */
306 306
     protected function validateRule($rule): string
307 307
     {
308
-        if ( ! isset($this->ruleMethods[$this->getRuleMethod($rule)])) {
308
+        if (!isset($this->ruleMethods[$this->getRuleMethod($rule)])) {
309 309
             throw new InvalidRule($rule);
310 310
         }
311 311
 
@@ -351,11 +351,11 @@  discard block
 block discarded – undo
351 351
         $rulePackClass = $this->getClassName($rulePack);
352 352
         $rulePack = new $rulePackClass;
353 353
 
354
-        if ( ! ($rulePack instanceof RulePack)) {
354
+        if (!($rulePack instanceof RulePack)) {
355 355
             throw new \UnexpectedValueException('RulePack must be an instance of ' . RulePack::class);
356 356
         }
357 357
 
358
-        if ( ! $this->hasRulePack($rulePack)) {
358
+        if (!$this->hasRulePack($rulePack)) {
359 359
             $this->rulePacks[$rulePackClass] = $rulePack->transformer($this);
360 360
 
361 361
             $ruleMethods = array_fill_keys($rulePack->provides(), $rulePackClass);
Please login to merge, or discard this patch.
src/TransformerServiceProvider.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
      */
35 35
     public function checkForCollectionExtensions()
36 36
     {
37
-        if (! Arr::hasMacro('fromDot') || ! Collection::hasMacro('fromDot')) {
37
+        if (!Arr::hasMacro('fromDot') || !Collection::hasMacro('fromDot')) {
38 38
             throw new \ErrorException(
39 39
                 'Please register the CollectionsServiceProvider from the laravel-extend-collections package. ' .
40 40
                 'Transformer requires the fromDot method for Illuminate Support Arr and Collection.'
@@ -47,15 +47,15 @@  discard block
 block discarded – undo
47 47
      */
48 48
     public function registerTransformer()
49 49
     {
50
-        $this->app->singleton(Transformer::class, function () {
50
+        $this->app->singleton(Transformer::class, function() {
51 51
             return new Transformer(config('transformer.rule_packs', []));
52 52
         });
53 53
     }
54 54
 
55 55
     public function registerRequestTransformMacro()
56 56
     {
57
-        if (! Request::hasMacro('transform')) {
58
-            Request::macro('transform', function ($rules = []) {
57
+        if (!Request::hasMacro('transform')) {
58
+            Request::macro('transform', function($rules = []) {
59 59
                 $this->replace(
60 60
                     app(Transformer::class)
61 61
                         ->transform($this->all(), $rules)
Please login to merge, or discard this patch.
src/Transform.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -100,7 +100,7 @@
 block discarded – undo
100 100
      */
101 101
     protected function constructRule($rule, $arguments = []) : string
102 102
     {
103
-        return $rule . (! empty($arguments) ? ':' . implode(',', $arguments) : '');
103
+        return $rule . (!empty($arguments) ? ':' . implode(',', $arguments) : '');
104 104
     }
105 105
 
106 106
     /**
Please login to merge, or discard this patch.
src/helpers.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (! function_exists('str_putcsv')) {
3
+if (!function_exists('str_putcsv')) {
4 4
     function str_putcsv($input, $delimiter = ',', $enclosure = '"')
5 5
     {
6 6
         $fp = fopen('php://temp', 'r+b');
Please login to merge, or discard this patch.
src/RulePacks/RulePack.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@
 block discarded – undo
17 17
 
18 18
     public function provides()
19 19
     {
20
-        return array_filter(get_class_methods($this), function ($method) {
20
+        return array_filter(get_class_methods($this), function($method) {
21 21
             return substr($method, 0, 4) == 'rule';
22 22
         });
23 23
     }
Please login to merge, or discard this patch.
src/RulePacks/RelatedFieldsRulePack.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
      */
38 38
     public function ruleNullWith($value, $check)
39 39
     {
40
-        return ! is_null($this->transformer->getValue($check)) ? null : $value;
40
+        return !is_null($this->transformer->getValue($check)) ? null : $value;
41 41
     }
42 42
 
43 43
     /*
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
      */
46 46
     public function ruleDropWith($value, $check)
47 47
     {
48
-        $this->transformer->drop(! is_null($this->transformer->getValue($check)));
48
+        $this->transformer->drop(!is_null($this->transformer->getValue($check)));
49 49
 
50 50
         return $value;
51 51
     }
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
     */
56 56
     public function ruleBailWith($value, $check)
57 57
     {
58
-        $this->transformer->bail(! is_null($this->transformer->getValue($check)));
58
+        $this->transformer->bail(!is_null($this->transformer->getValue($check)));
59 59
 
60 60
         return $value;
61 61
     }
Please login to merge, or discard this patch.