add phpdoc

This commit is contained in:
2025-01-09 22:54:48 +01:00
parent 293eb9e555
commit ee3ea44a81
5 changed files with 329 additions and 17 deletions

View File

@@ -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;