Laravel version update
Laravel version update
This commit is contained in:
@@ -39,11 +39,11 @@ abstract class ArrayUtils
|
||||
*/
|
||||
public static function hasStringKeys($value, $allowEmpty = false)
|
||||
{
|
||||
if (!is_array($value)) {
|
||||
if (! is_array($value)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!$value) {
|
||||
if (! $value) {
|
||||
return $allowEmpty;
|
||||
}
|
||||
|
||||
@@ -59,11 +59,11 @@ abstract class ArrayUtils
|
||||
*/
|
||||
public static function hasIntegerKeys($value, $allowEmpty = false)
|
||||
{
|
||||
if (!is_array($value)) {
|
||||
if (! is_array($value)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!$value) {
|
||||
if (! $value) {
|
||||
return $allowEmpty;
|
||||
}
|
||||
|
||||
@@ -86,11 +86,11 @@ abstract class ArrayUtils
|
||||
*/
|
||||
public static function hasNumericKeys($value, $allowEmpty = false)
|
||||
{
|
||||
if (!is_array($value)) {
|
||||
if (! is_array($value)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!$value) {
|
||||
if (! $value) {
|
||||
return $allowEmpty;
|
||||
}
|
||||
|
||||
@@ -119,11 +119,11 @@ abstract class ArrayUtils
|
||||
*/
|
||||
public static function isList($value, $allowEmpty = false)
|
||||
{
|
||||
if (!is_array($value)) {
|
||||
if (! is_array($value)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!$value) {
|
||||
if (! $value) {
|
||||
return $allowEmpty;
|
||||
}
|
||||
|
||||
@@ -161,11 +161,11 @@ abstract class ArrayUtils
|
||||
*/
|
||||
public static function isHashTable($value, $allowEmpty = false)
|
||||
{
|
||||
if (!is_array($value)) {
|
||||
if (! is_array($value)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!$value) {
|
||||
if (! $value) {
|
||||
return $allowEmpty;
|
||||
}
|
||||
|
||||
@@ -187,7 +187,7 @@ abstract class ArrayUtils
|
||||
*/
|
||||
public static function inArray($needle, array $haystack, $strict = false)
|
||||
{
|
||||
if (!$strict) {
|
||||
if (! $strict) {
|
||||
if (is_int($needle) || is_float($needle)) {
|
||||
$needle = (string) $needle;
|
||||
}
|
||||
@@ -215,11 +215,11 @@ abstract class ArrayUtils
|
||||
*/
|
||||
public static function iteratorToArray($iterator, $recursive = true)
|
||||
{
|
||||
if (!is_array($iterator) && !$iterator instanceof Traversable) {
|
||||
if (! is_array($iterator) && ! $iterator instanceof Traversable) {
|
||||
throw new Exception\InvalidArgumentException(__METHOD__ . ' expects an array or Traversable object');
|
||||
}
|
||||
|
||||
if (!$recursive) {
|
||||
if (! $recursive) {
|
||||
if (is_array($iterator)) {
|
||||
return $iterator;
|
||||
}
|
||||
@@ -274,7 +274,7 @@ abstract class ArrayUtils
|
||||
} elseif (isset($a[$key]) || array_key_exists($key, $a)) {
|
||||
if ($value instanceof MergeRemoveKey) {
|
||||
unset($a[$key]);
|
||||
} elseif (!$preserveNumericKeys && is_int($key)) {
|
||||
} elseif (! $preserveNumericKeys && is_int($key)) {
|
||||
$a[] = $value;
|
||||
} elseif (is_array($value) && is_array($a[$key])) {
|
||||
$a[$key] = static::merge($a[$key], $value, $preserveNumericKeys);
|
||||
@@ -282,7 +282,7 @@ abstract class ArrayUtils
|
||||
$a[$key] = $value;
|
||||
}
|
||||
} else {
|
||||
if (!$value instanceof MergeRemoveKey) {
|
||||
if (! $value instanceof MergeRemoveKey) {
|
||||
$a[$key] = $value;
|
||||
}
|
||||
}
|
||||
@@ -292,12 +292,13 @@ abstract class ArrayUtils
|
||||
}
|
||||
|
||||
/**
|
||||
* Compatibility Method for array_filter on <5.6 systems
|
||||
* @deprecated Since 3.2.0; use the native array_filter methods
|
||||
*
|
||||
* @param array $data
|
||||
* @param callable $callback
|
||||
* @param null|int $flag
|
||||
* @return array
|
||||
* @throws Exception\InvalidArgumentException
|
||||
*/
|
||||
public static function filter(array $data, $callback, $flag = null)
|
||||
{
|
||||
@@ -308,28 +309,6 @@ abstract class ArrayUtils
|
||||
));
|
||||
}
|
||||
|
||||
if (version_compare(PHP_VERSION, '5.6.0') >= 0) {
|
||||
return array_filter($data, $callback, $flag);
|
||||
}
|
||||
|
||||
$output = [];
|
||||
foreach ($data as $key => $value) {
|
||||
$params = [$value];
|
||||
|
||||
if ($flag === static::ARRAY_FILTER_USE_BOTH) {
|
||||
$params[] = $key;
|
||||
}
|
||||
|
||||
if ($flag === static::ARRAY_FILTER_USE_KEY) {
|
||||
$params = [$key];
|
||||
}
|
||||
|
||||
$response = call_user_func_array($callback, $params);
|
||||
if ($response) {
|
||||
$output[$key] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
return $output;
|
||||
return array_filter($data, $callback, $flag);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user