@@ -152,7 +152,7 @@ public function filterByParent($parent)
152152 public function insert ($ data , $ parent = null )
153153 {
154154 $ row = new Row ($ data , $ this );
155- if ($ parent ){
155+ if ($ parent ) {
156156 $ parentName = $ this ->getParentKeyName ($ parent ['table ' ]);
157157 $ row ->$ parentName = $ parent ['id ' ];
158158 }
@@ -204,7 +204,7 @@ public function getNewId()
204204 foreach ($ this ->rows as $ row ) {
205205 $ ids [] = $ row ->id ;
206206 }
207- if (count ($ ids ) === 0 ){
207+ if (count ($ ids ) === 0 ) {
208208 return 1 ;
209209 }
210210 sort ($ ids );
@@ -329,7 +329,7 @@ public function _sort($field)
329329 public function _order ($ order )
330330 {
331331 $ order = mb_strtolower ($ order );
332- if ($ order !== 'asc ' && $ order !== 'desc ' ) {
332+ if ($ order !== 'asc ' && $ order !== 'desc ' ) {
333333 throw new \DomainException ("Unknown sort type $ order " );
334334 }
335335 $ this ->sortOrder = $ order ;
@@ -344,7 +344,7 @@ public function _order($order)
344344 */
345345 public function _start ($ start )
346346 {
347- if ( !is_numeric ($ start ) || $ start < 0 ){
347+ if ( !is_numeric ($ start ) || $ start < 0 ) {
348348 throw new \DomainException ("Start ' $ start' must be a positive integer " );
349349 }
350350 $ this ->start = $ start ;
@@ -359,7 +359,7 @@ public function _start($start)
359359 */
360360 public function _end ($ end )
361361 {
362- if ( !is_numeric ($ end ) || $ end < 0 ){
362+ if ( !is_numeric ($ end ) || $ end < 0 ) {
363363 throw new \DomainException ("end ' $ end'' must be a positive integer " );
364364 }
365365 $ this ->end = $ end ;
@@ -374,7 +374,7 @@ public function _end($end)
374374 */
375375 public function _limit ($ limit )
376376 {
377- if ( !is_numeric ($ limit ) || $ limit < 0 ){
377+ if ( !is_numeric ($ limit ) || $ limit < 0 ) {
378378 throw new \DomainException ("limit ' $ limit'' must be a positive integer " );
379379 }
380380 $ this ->limit = $ limit ;
@@ -431,18 +431,18 @@ private function sort()
431431 {
432432 $ sortField = $ this ->sortField ;
433433 $ sortOrder = $ this ->sortOrder ;
434- $ sortFunc = function ($ a , $ b ) use ( $ sortField , $ sortOrder ) {
435- if ($ a ->$ sortField === $ b ->$ sortField ){
434+ $ sortFunc = function ($ a , $ b ) use ($ sortField , $ sortOrder) {
435+ if ($ a ->$ sortField === $ b ->$ sortField ) {
436436 return 0 ;
437437 }
438- if ($ a ->$ sortField > $ b ->$ sortField ){
438+ if ($ a ->$ sortField > $ b ->$ sortField ) {
439439 return $ sortOrder === 'asc ' ? 1 : -1 ;
440440 }
441- if ($ a ->$ sortField < $ b ->$ sortField ){
441+ if ($ a ->$ sortField < $ b ->$ sortField ) {
442442 return $ sortOrder === 'asc ' ? -1 : 1 ;
443443 }
444444 };
445- usort ($ this ->rows , $ sortFunc );
445+ usort ($ this ->rows , $ sortFunc );
446446 }
447447
448448 /**
@@ -454,7 +454,7 @@ private function sort()
454454 private function filter ($ callback )
455455 {
456456 $ table = clone $ this ;
457- $ table ->rows = array_slice (array_filter ($ this ->rows , $ callback ),0 );
457+ $ table ->rows = array_slice (array_filter ($ this ->rows , $ callback ), 0 );
458458 return $ table ;
459459 }
460460
0 commit comments