| @@ -29,7 +29,7 @@ | ||
| 29 | 29 | * | 
| 30 | 30 | * @return Underscore | 
| 31 | 31 | */ | 
| 32 | -if (!function_exists('__')) { | |
| 32 | +if ( ! function_exists('__')) { | |
| 33 | 33 | /** | 
| 34 | 34 | * @param $type | 
| 35 | 35 | * | 
| @@ -40,11 +40,11 @@ | ||
| 40 | 40 | */ | 
| 41 | 41 | public static function unpack($object, $attribute = null) | 
| 42 | 42 |      { | 
| 43 | - $object = (array) $object; | |
| 43 | + $object = (array)$object; | |
| 44 | 44 | $object = $attribute | 
| 45 | 45 | ? ArraysMethods::get($object, $attribute) | 
| 46 | 46 | : ArraysMethods::first($object); | 
| 47 | 47 | |
| 48 | - return (object) $object; | |
| 48 | + return (object)$object; | |
| 49 | 49 | } | 
| 50 | 50 | } | 
| @@ -58,7 +58,7 @@ discard block | ||
| 58 | 58 | return $collection; | 
| 59 | 59 | } | 
| 60 | 60 | |
| 61 | - $collection = (array) $collection; | |
| 61 | + $collection = (array)$collection; | |
| 62 | 62 | |
| 63 | 63 |          if (isset($collection[$key])) { | 
| 64 | 64 | return $collection[$key]; | 
| @@ -66,9 +66,9 @@ discard block | ||
| 66 | 66 | |
| 67 | 67 | // Crawl through collection, get key according to object or not | 
| 68 | 68 |          foreach (explode('.', $key) as $segment) { | 
| 69 | - $collection = (array) $collection; | |
| 69 | + $collection = (array)$collection; | |
| 70 | 70 | |
| 71 | -            if (!isset($collection[$segment])) { | |
| 71 | +            if ( ! isset($collection[$segment])) { | |
| 72 | 72 | return $default instanceof Closure ? $default() : $default; | 
| 73 | 73 | } | 
| 74 | 74 | |
| @@ -106,7 +106,7 @@ discard block | ||
| 106 | 106 | public static function setAndGet(&$collection, $key, $default = null) | 
| 107 | 107 |      { | 
| 108 | 108 | // If the key doesn't exist, set it | 
| 109 | -        if (!static::has($collection, $key)) { | |
| 109 | +        if ( ! static::has($collection, $key)) { | |
| 110 | 110 | $collection = static::set($collection, $key, $default); | 
| 111 | 111 | } | 
| 112 | 112 | |
| @@ -147,9 +147,9 @@ discard block | ||
| 147 | 147 | */ | 
| 148 | 148 | public static function pluck($collection, $property) | 
| 149 | 149 |      { | 
| 150 | -        $plucked = array_map(function ($value) use ($property) { | |
| 150 | +        $plucked = array_map(function($value) use ($property) { | |
| 151 | 151 | return ArraysMethods::get($value, $property); | 
| 152 | - }, (array) $collection); | |
| 152 | + }, (array)$collection); | |
| 153 | 153 | |
| 154 | 154 | // Convert back to object if necessary | 
| 155 | 155 |          if (\is_object($collection)) { | 
| @@ -172,48 +172,48 @@ discard block | ||
| 172 | 172 | */ | 
| 173 | 173 | public static function filterBy($collection, $property, $value, $comparisonOp = null) | 
| 174 | 174 |      { | 
| 175 | -        if (!$comparisonOp) { | |
| 175 | +        if ( ! $comparisonOp) { | |
| 176 | 176 | $comparisonOp = \is_array($value) ? 'contains' : 'eq'; | 
| 177 | 177 | } | 
| 178 | 178 | $ops = [ | 
| 179 | -            'eq' => function ($item, $prop, $value) { | |
| 179 | +            'eq' => function($item, $prop, $value) { | |
| 180 | 180 | return $item[$prop] === $value; | 
| 181 | 181 | }, | 
| 182 | -            'gt' => function ($item, $prop, $value) { | |
| 182 | +            'gt' => function($item, $prop, $value) { | |
| 183 | 183 | return $item[$prop] > $value; | 
| 184 | 184 | }, | 
| 185 | -            'gte' => function ($item, $prop, $value) { | |
| 185 | +            'gte' => function($item, $prop, $value) { | |
| 186 | 186 | return $item[$prop] >= $value; | 
| 187 | 187 | }, | 
| 188 | -            'lt' => function ($item, $prop, $value) { | |
| 188 | +            'lt' => function($item, $prop, $value) { | |
| 189 | 189 | return $item[$prop] < $value; | 
| 190 | 190 | }, | 
| 191 | -            'lte' => function ($item, $prop, $value) { | |
| 191 | +            'lte' => function($item, $prop, $value) { | |
| 192 | 192 | return $item[$prop] <= $value; | 
| 193 | 193 | }, | 
| 194 | -            'ne' => function ($item, $prop, $value) { | |
| 194 | +            'ne' => function($item, $prop, $value) { | |
| 195 | 195 | return $item[$prop] !== $value; | 
| 196 | 196 | }, | 
| 197 | -            'contains' => function ($item, $prop, $value) { | |
| 197 | +            'contains' => function($item, $prop, $value) { | |
| 198 | 198 | return \in_array($item[$prop], (array)$value, true); | 
| 199 | 199 | }, | 
| 200 | -            'notContains' => function ($item, $prop, $value) { | |
| 200 | +            'notContains' => function($item, $prop, $value) { | |
| 201 | 201 | return ! \in_array($item[$prop], (array)$value, true); | 
| 202 | 202 | }, | 
| 203 | -            'newer' => function ($item, $prop, $value) { | |
| 203 | +            'newer' => function($item, $prop, $value) { | |
| 204 | 204 | return strtotime($item[$prop]) > strtotime($value); | 
| 205 | 205 | }, | 
| 206 | -            'older' => function ($item, $prop, $value) { | |
| 206 | +            'older' => function($item, $prop, $value) { | |
| 207 | 207 | return strtotime($item[$prop]) < strtotime($value); | 
| 208 | 208 | }, | 
| 209 | 209 | ]; | 
| 210 | - $result = array_values(array_filter((array) $collection, function ($item) use ( | |
| 210 | + $result = array_values(array_filter((array)$collection, function($item) use ( | |
| 211 | 211 | $property, | 
| 212 | 212 | $value, | 
| 213 | 213 | $ops, | 
| 214 | 214 | $comparisonOp | 
| 215 | 215 |          ) { | 
| 216 | - $item = (array) $item; | |
| 216 | + $item = (array)$item; | |
| 217 | 217 | $item[$property] = static::get($item, $property, []); | 
| 218 | 218 | |
| 219 | 219 | return $ops[$comparisonOp]($item, $property, $value); | 
| @@ -385,8 +385,7 @@ discard block | ||
| 385 | 385 |                  $collection->{$key} = static::get($collection, $key, []); | 
| 386 | 386 |                  $collection         = &$collection->{$key}; | 
| 387 | 387 | // If we're dealing with an array | 
| 388 | - } | |
| 389 | -            else { | |
| 388 | +            } else { | |
| 390 | 389 | $collection[$key] = static::get($collection, $key, []); | 
| 391 | 390 | $collection = &$collection[$key]; | 
| 392 | 391 | } | 
| @@ -396,8 +395,7 @@ discard block | ||
| 396 | 395 | $key = array_shift($keys); | 
| 397 | 396 |          if (\is_array($collection)) { | 
| 398 | 397 | $collection[$key] = $value; | 
| 399 | - } | |
| 400 | -        else { | |
| 398 | +        } else { | |
| 401 | 399 |              $collection->{$key} = $value; | 
| 402 | 400 | } | 
| 403 | 401 | } | 
| @@ -427,8 +425,7 @@ discard block | ||
| 427 | 425 |              if (\is_object($collection)) { | 
| 428 | 426 |                  $collection = &$collection->{$key}; | 
| 429 | 427 | // If we're dealing with an array | 
| 430 | - } | |
| 431 | -            else { | |
| 428 | +            } else { | |
| 432 | 429 | $collection = &$collection[$key]; | 
| 433 | 430 | } | 
| 434 | 431 | } | 
| @@ -436,8 +433,7 @@ discard block | ||
| 436 | 433 | $key = array_shift($keys); | 
| 437 | 434 |          if (\is_object($collection)) { | 
| 438 | 435 |              unset($collection->{$key}); | 
| 439 | - } | |
| 440 | -        else { | |
| 436 | +        } else { | |
| 441 | 437 | unset($collection[$key]); | 
| 442 | 438 | } | 
| 443 | 439 | } | 
| @@ -105,11 +105,11 @@ | ||
| 105 | 105 | public static function randomStrings($words, $length = 10) : string | 
| 106 | 106 |      { | 
| 107 | 107 |          return Strings::from('0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ') | 
| 108 | - ->shuffle() | |
| 109 | - ->split($length) | |
| 110 | - ->slice(0, $words) | |
| 111 | -                      ->implode(' ') | |
| 112 | - ->obtain(); | |
| 108 | + ->shuffle() | |
| 109 | + ->split($length) | |
| 110 | + ->slice(0, $words) | |
| 111 | +                        ->implode(' ') | |
| 112 | + ->obtain(); | |
| 113 | 113 | } | 
| 114 | 114 | |
| 115 | 115 | //////////////////////////////////////////////////////////////////// | 
| @@ -231,7 +231,7 @@ discard block | ||
| 231 | 231 | } | 
| 232 | 232 | |
| 233 | 233 | // If not case sensitive | 
| 234 | -        if (!$caseSensitive) { | |
| 234 | +        if ( ! $caseSensitive) { | |
| 235 | 235 | $string = strtolower($string); | 
| 236 | 236 | $needle = strtolower($needle); | 
| 237 | 237 | } | 
| @@ -239,7 +239,7 @@ discard block | ||
| 239 | 239 | // If string found | 
| 240 | 240 | $pos = strpos($string, $needle); | 
| 241 | 241 | |
| 242 | - return !($pos === false); | |
| 242 | + return ! ($pos === false); | |
| 243 | 243 | } | 
| 244 | 244 | |
| 245 | 245 | /** | 
| @@ -39,11 +39,9 @@ | ||
| 39 | 39 |      { | 
| 40 | 40 |          if ($count === 1) { | 
| 41 | 41 | $output = $one; | 
| 42 | - } | |
| 43 | -        elseif ($count === 0 && ! empty($zero)) { | |
| 42 | +        } elseif ($count === 0 && ! empty($zero)) { | |
| 44 | 43 | $output = $zero; | 
| 45 | - } | |
| 46 | -        else { | |
| 44 | +        } else { | |
| 47 | 45 | $output = $many; | 
| 48 | 46 | } | 
| 49 | 47 | |
| @@ -82,9 +82,7 @@ | ||
| 82 | 82 | // Else, increment the count | 
| 83 | 83 |              if ($numberOfTimesCalled >= $canBeCalledTimes) { | 
| 84 | 84 | return false; | 
| 85 | - } | |
| 86 | - | |
| 87 | - ++FunctionsMethods::$canBeCalledTimes[$signature]; | |
| 85 | + }++FunctionsMethods::$canBeCalledTimes[$signature]; | |
| 88 | 86 | |
| 89 | 87 | return \call_user_func_array($function, $arguments); | 
| 90 | 88 | }; | 
| @@ -38,8 +38,7 @@ discard block | ||
| 38 | 38 | // Dynamic arguments | 
| 39 | 39 |          if ($stop !== null) { | 
| 40 | 40 | $start = $_base; | 
| 41 | - } | |
| 42 | -        else { | |
| 41 | +        } else { | |
| 43 | 42 | $start = 1; | 
| 44 | 43 | $stop = $_base; | 
| 45 | 44 | } | 
| @@ -471,8 +470,7 @@ discard block | ||
| 471 | 470 | $direction = (strtolower($direction) === 'desc') ? SORT_DESC : SORT_ASC; | 
| 472 | 471 |          if ($direction === SORT_ASC) { | 
| 473 | 472 | ksort($array); | 
| 474 | - } | |
| 475 | -        else { | |
| 473 | +        } else { | |
| 476 | 474 | krsort($array); | 
| 477 | 475 | } | 
| 478 | 476 | |
| @@ -539,8 +537,7 @@ discard block | ||
| 539 | 537 |          foreach ($_flattened as $key => $value) { | 
| 540 | 538 |              if (\is_array($value)) { | 
| 541 | 539 | $flattened = array_merge($flattened, $value); | 
| 542 | - } | |
| 543 | -            else { | |
| 540 | +            } else { | |
| 544 | 541 | $flattened[$key] = $value; | 
| 545 | 542 | } | 
| 546 | 543 | } | 
| @@ -84,7 +84,7 @@ discard block | ||
| 84 | 84 | |
| 85 | 85 | // Explodes rows | 
| 86 | 86 | $data = static::explodeWith($data, [PHP_EOL, "\r", "\n"]); | 
| 87 | -        $data = array_map(function ($row) { | |
| 87 | +        $data = array_map(function($row) { | |
| 88 | 88 | return Parse::explodeWith($row, [';', "\t", ',']); | 
| 89 | 89 | }, $data); | 
| 90 | 90 | |
| @@ -234,7 +234,7 @@ discard block | ||
| 234 | 234 | */ | 
| 235 | 235 | public static function toObject($data) | 
| 236 | 236 |      { | 
| 237 | - return (object) $data; | |
| 237 | + return (object)$data; | |
| 238 | 238 | } | 
| 239 | 239 | |
| 240 | 240 | //////////////////////////////////////////////////////////////////// | 
| @@ -58,7 +58,7 @@ | ||
| 58 | 58 | public static function option($option) | 
| 59 | 59 |      { | 
| 60 | 60 | // Get config file | 
| 61 | -        if (!static::$options) { | |
| 61 | +        if ( ! static::$options) { | |
| 62 | 62 | static::$options = include __DIR__.'/../config/underscore.php'; | 
| 63 | 63 | } | 
| 64 | 64 | |
| @@ -16,7 +16,6 @@ | ||
| 16 | 16 | |
| 17 | 17 | /** | 
| 18 | 18 | * Strings repository. | 
| 19 | - | |
| 20 | 19 | * | 
| 21 | 20 | *@mixin StringsMethods | 
| 22 | 21 | */ |