Added logic draft and optimized rights

This commit is contained in:
Kevin Frantz
2018-09-21 13:15:59 +02:00
parent fb6cf53785
commit a4fdb07cb6
8 changed files with 226 additions and 3 deletions

View File

@@ -0,0 +1,19 @@
<?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;
}

View File

@@ -0,0 +1,26 @@
<?php
namespace App\Logic\Operation;
use App\Logic\Result\ResultInterface;
use Doctrine\Common\Collections\ArrayCollection;
/**
*
* @author kevinfrantz
*
*/
interface OperationInterface extends OperandInterface
{
/**
* Sets the Operators the operation has to deal with
* @param ArrayCollection $operands | OperandInterface[]
*/
public function setOperators(ArrayCollection $operands):void;
/**
* Process the logic
*/
public function process():void;
}

View File

@@ -0,0 +1,49 @@
<?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;
}
}

View File

@@ -0,0 +1,39 @@
<?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;
}