Completed
Push — master ( 749c3b...eac076 )
by Ivan
01:59
created
src/CollectionRepository.php 1 patch
Spacing   +8 added lines, -10 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
         $this->collection = $collection;
36 36
         $this->original = clone $collection;
37 37
         $this->id = is_array($id) ? $id : [$id];
38
-        $this->searching = $searching ?? function () {
38
+        $this->searching = $searching ?? function() {
39 39
             return true;
40 40
         };
41 41
     }
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
     }
61 61
     public function reject(string $column, $value) : Repository
62 62
     {
63
-        $this->collection = $this->collection->reject(function ($v) use ($column, $value) {
63
+        $this->collection = $this->collection->reject(function($v) use ($column, $value) {
64 64
             $strict = false;
65 65
             $vv = is_object($v) ? (isset($v->{$column}) ? $v->{$column} : null) : (isset($v[$column]) ? $v[$column] : null);
66 66
             if (!$vv || ($strict && $vv !== $value) || (!$strict && $vv != $value)) {
@@ -72,13 +72,11 @@  discard block
 block discarded – undo
72 72
     }
73 73
     public function sort(string $column, bool $desc = false) : Repository
74 74
     {
75
-        $this->collection = $this->collection->sortBy(function ($a, $b) use ($column, $desc) {
75
+        $this->collection = $this->collection->sortBy(function($a, $b) use ($column, $desc) {
76 76
             $v1 = is_object($a) ?
77
-                (isset($a->{$column}) ? $a->{$column} : null) :
78
-                (isset($a[$column]) ? $a[$column] : null);
77
+                (isset($a->{$column}) ? $a->{$column} : null) : (isset($a[$column]) ? $a[$column] : null);
79 78
             $v2 = is_object($b) ?
80
-                (isset($b->{$column}) ? $b->{$column} : null) :
81
-                (isset($b[$column]) ? $b[$column] : null);
79
+                (isset($b->{$column}) ? $b->{$column} : null) : (isset($b[$column]) ? $b[$column] : null);
82 80
             return $desc ? $v2 <=> $v1 : $v1 <=> $v2;
83 81
         });
84 82
         return $this;
@@ -99,7 +97,7 @@  discard block
 block discarded – undo
99 97
     }
100 98
     public function current()
101 99
     {
102
-        if(!($data = $this->collection->current())) {
100
+        if (!($data = $this->collection->current())) {
103 101
             return null;
104 102
         }
105 103
         $this->consumed = true;
@@ -107,7 +105,7 @@  discard block
 block discarded – undo
107 105
     }
108 106
     public function offsetGet($offset)
109 107
     {
110
-        if(!($data = $this->collection->offsetGet($offset))) {
108
+        if (!($data = $this->collection->offsetGet($offset))) {
111 109
             return null;
112 110
         }
113 111
         $this->consumed = true;
@@ -182,7 +180,7 @@  discard block
 block discarded – undo
182 180
 
183 181
     public function search(string $q) : Repository
184 182
     {
185
-        $this->collection = $this->collection->filter(function ($v) use ($q) {
183
+        $this->collection = $this->collection->filter(function($v) use ($q) {
186 184
             return call_user_func($this->searching, $v, $q);
187 185
         });
188 186
         return $this;
Please login to merge, or discard this patch.
src/Manager.php 1 patch
Spacing   +3 added lines, -4 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
      */
60 60
     public function registerGenericMapperWithClassName(string $table, string $class)
61 61
     {
62
-        return $this->registerGenericMapper($table, function () use ($class) {
62
+        return $this->registerGenericMapper($table, function() use ($class) {
63 63
             return new $class;
64 64
         });
65 65
     }
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
     public function getMapper(string $table)
83 83
     {
84 84
         if (!isset($this->map[$table])) {
85
-            $this->registerGenericMapper($table, function () {
85
+            $this->registerGenericMapper($table, function() {
86 86
                 return new class() extends \StdClass implements LazyLoadable {
87 87
                     use LazyLoad;
88 88
                 };
@@ -94,8 +94,7 @@  discard block
 block discarded – undo
94 94
     {
95 95
         $collection = $this->fromTable($table);
96 96
         return !count($args) ?
97
-            $collection :
98
-            $collection->find($args[0]);
97
+            $collection : $collection->find($args[0]);
99 98
     }
100 99
     /**
101 100
      * Get a repository from a table query
Please login to merge, or discard this patch.