mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2025-10-11 10:08:08 +02:00
Optimized for SPA
This commit is contained in:
18
application/symfony/src/Logic/Operation/OperandInterface.php
Normal file
18
application/symfony/src/Logic/Operation/OperandInterface.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Logic\Operation;
|
||||
|
||||
use App\Logic\Result\ResultInterface;
|
||||
|
||||
/**
|
||||
* @author kevinfrantz
|
||||
*/
|
||||
interface OperandInterface
|
||||
{
|
||||
/**
|
||||
* Returns the result of the Operation.
|
||||
*
|
||||
* @return ResultInterface
|
||||
*/
|
||||
public function getResult(): ResultInterface;
|
||||
}
|
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Logic\Operation;
|
||||
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
|
||||
/**
|
||||
* @author kevinfrantz
|
||||
*/
|
||||
interface OperationInterface extends OperandInterface
|
||||
{
|
||||
/**
|
||||
* Sets the Operators the operation has to deal with.
|
||||
*
|
||||
* @param Collection $operands | OperandInterface[]
|
||||
*/
|
||||
public function setOperands(Collection $operands): void;
|
||||
|
||||
/**
|
||||
* Process the logic.
|
||||
*/
|
||||
public function process(): void;
|
||||
}
|
47
application/symfony/src/Logic/Result/Result.php
Normal file
47
application/symfony/src/Logic/Result/Result.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace App\Logic\Result;
|
||||
|
||||
/**
|
||||
* @author kevinfrantz
|
||||
*/
|
||||
class Result implements ResultInterface
|
||||
{
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
protected $bool;
|
||||
|
||||
/**
|
||||
* The concrete result value.
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $value;
|
||||
|
||||
public function getValue()
|
||||
{
|
||||
return $this->value;
|
||||
}
|
||||
|
||||
public function getBool(): bool
|
||||
{
|
||||
return $this->bool;
|
||||
}
|
||||
|
||||
public function setBool(bool $bool): void
|
||||
{
|
||||
$this->bool = $bool;
|
||||
}
|
||||
|
||||
public function setValue($value): void
|
||||
{
|
||||
$this->value = $value;
|
||||
}
|
||||
|
||||
public function setAll($value): void
|
||||
{
|
||||
$this->bool = (bool) $value;
|
||||
$this->value = $value;
|
||||
}
|
||||
}
|
41
application/symfony/src/Logic/Result/ResultInterface.php
Normal file
41
application/symfony/src/Logic/Result/ResultInterface.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace App\Logic\Result;
|
||||
|
||||
/**
|
||||
* @author kevinfrantz
|
||||
*/
|
||||
interface ResultInterface
|
||||
{
|
||||
/**
|
||||
* Returns the Result as a string.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
//public function __toString():string;
|
||||
|
||||
/**
|
||||
* Returns if the result is true.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function getBool(): bool;
|
||||
|
||||
public function setBool(bool $bool): void;
|
||||
|
||||
/**
|
||||
* Returns the concrete result value.
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
public function getValue();
|
||||
|
||||
public function setValue($value): void;
|
||||
|
||||
/**
|
||||
* Sets bool and value attribut.
|
||||
*
|
||||
* @param mixed $value
|
||||
*/
|
||||
public function setAll($value): void;
|
||||
}
|
Reference in New Issue
Block a user