add phpdoc
This commit is contained in:
@@ -4,9 +4,9 @@ namespace Kletellier\PdoWrapper;
|
||||
|
||||
class Expression
|
||||
{
|
||||
private $condition;
|
||||
private $operator;
|
||||
private $value;
|
||||
private string $condition;
|
||||
private string $operator;
|
||||
private mixed $value;
|
||||
|
||||
public function __construct($condition, $operator, $value)
|
||||
{
|
||||
@@ -15,6 +15,11 @@ class Expression
|
||||
$this->value = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return raw value of the expression
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function raw(): string
|
||||
{
|
||||
$operator = trim(strtolower($this->operator));
|
||||
@@ -34,40 +39,78 @@ class Expression
|
||||
return "(" . $this->condition . " " . $this->operator . " ? )";
|
||||
}
|
||||
|
||||
/**
|
||||
* Return if the condition need to evaluate data
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function hasData()
|
||||
{
|
||||
$operator = trim(strtolower($this->operator));
|
||||
return (in_array($operator, ["isnull","notnull"])) ? false : true;
|
||||
}
|
||||
|
||||
public function getCondition()
|
||||
/**
|
||||
* Return actual condition
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCondition(): string
|
||||
{
|
||||
return $this->condition;
|
||||
}
|
||||
|
||||
public function setCondition($condition)
|
||||
/**
|
||||
* Set condition
|
||||
*
|
||||
* @param string $condition
|
||||
* @return self
|
||||
*/
|
||||
public function setCondition(string $condition): self
|
||||
{
|
||||
$this->condition = $condition;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getOperator()
|
||||
/**
|
||||
* Get actual operator
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getOperator(): string
|
||||
{
|
||||
return $this->operator;
|
||||
}
|
||||
|
||||
public function setOperator($operator)
|
||||
/**
|
||||
* Set operator
|
||||
*
|
||||
* @param string $operator
|
||||
* @return self
|
||||
*/
|
||||
public function setOperator(string $operator): self
|
||||
{
|
||||
$this->operator = $operator;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getValue()
|
||||
/**
|
||||
* Get the value of the expression
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getValue(): mixed
|
||||
{
|
||||
return $this->value;
|
||||
}
|
||||
|
||||
public function setValue($value)
|
||||
/**
|
||||
* Set the value of the expression
|
||||
*
|
||||
* @param mixed $value
|
||||
* @return void
|
||||
*/
|
||||
public function setValue(mixed $value)
|
||||
{
|
||||
$this->value = $value;
|
||||
return $this;
|
||||
|
||||
Reference in New Issue
Block a user