Augmentation vers version 3.3.0
This commit is contained in:
@@ -88,6 +88,18 @@ class ExprBuilder
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests if the value is empty.
|
||||
*
|
||||
* @return ExprBuilder
|
||||
*/
|
||||
public function ifEmpty()
|
||||
{
|
||||
$this->ifPart = function ($v) { return empty($v); };
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests if the value is an array.
|
||||
*
|
||||
@@ -124,6 +136,19 @@ class ExprBuilder
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Transforms variables of any type into an array.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function castToArray()
|
||||
{
|
||||
$this->ifPart = function ($v) { return !\is_array($v); };
|
||||
$this->thenPart = function ($v) { return [$v]; };
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the closure to run if the test pass.
|
||||
*
|
||||
@@ -143,7 +168,7 @@ class ExprBuilder
|
||||
*/
|
||||
public function thenEmptyArray()
|
||||
{
|
||||
$this->thenPart = function ($v) { return array(); };
|
||||
$this->thenPart = function ($v) { return []; };
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user