Skip to content

Commit

Permalink
Filter for arithmetic operations laminas#28
Browse files Browse the repository at this point in the history
Signed-off-by: Flávio Gomes da Silva Lisboa <[email protected]>
  • Loading branch information
fgsl committed Oct 25, 2021
1 parent bd03206 commit 8bbf689
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/FiveOperations.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class FiveOperations extends AbstractFilter
'operand' => null
];

protected $operations = [
protected array $operations = [
self::ADD,
self::SUB,
self::MUL,
Expand Down Expand Up @@ -61,7 +61,7 @@ public function __construct(array $options = null)
* @param string $operation
* @throws InvalidArgumentException
*/
public function setOperation($operation)
public function setOperation(string $operation): FiveOperations
{
if (! in_array($operation, $this->operations)) {
throw new InvalidArgumentException(sprintf('%s expects argument operation string with one of theses values: add, sub, mul, div or mod; received "%s"', __METHOD__, $operation));
Expand All @@ -71,7 +71,11 @@ public function setOperation($operation)
return $this;
}

public function setOperand($operand)
/**
*
* @param integer | float $operand
*/
public function setOperand($operand): FiveOperations
{
$this->options['operand'] = $operand;
return $this;
Expand Down

0 comments on commit 8bbf689

Please sign in to comment.