@@ -48,7 +48,7 @@  | 
                                                    ||
| 48 | 48 | |
| 49 | 49 | |
| 50 | 50 | /**  | 
                                                        
| 51 | - * @param $string  | 
                                                        |
| 51 | + * @param string $string  | 
                                                        |
| 52 | 52 | * @return self  | 
                                                        
| 53 | 53 | */  | 
                                                        
| 54 | 54 | private static function instance($string)  | 
                                                        
@@ -4,67 +4,67 @@  | 
                                                    ||
| 4 | 4 | |
| 5 | 5 | class StrategyEnum  | 
                                                        
| 6 | 6 |  { | 
                                                        
| 7 | - /**  | 
                                                        |
| 8 | - * @var string  | 
                                                        |
| 9 | - */  | 
                                                        |
| 10 | - private $value;  | 
                                                        |
| 7 | + /**  | 
                                                        |
| 8 | + * @var string  | 
                                                        |
| 9 | + */  | 
                                                        |
| 10 | + private $value;  | 
                                                        |
| 11 | 11 | |
| 12 | - /**  | 
                                                        |
| 13 | - * @var self[]  | 
                                                        |
| 14 | - */  | 
                                                        |
| 15 | - static private $registry = [];  | 
                                                        |
| 12 | + /**  | 
                                                        |
| 13 | + * @var self[]  | 
                                                        |
| 14 | + */  | 
                                                        |
| 15 | + static private $registry = [];  | 
                                                        |
| 16 | 16 | |
| 17 | - private function __construct($value)  | 
                                                        |
| 18 | -    { | 
                                                        |
| 19 | - $this->value = $value;  | 
                                                        |
| 20 | - }  | 
                                                        |
| 17 | + private function __construct($value)  | 
                                                        |
| 18 | +	{ | 
                                                        |
| 19 | + $this->value = $value;  | 
                                                        |
| 20 | + }  | 
                                                        |
| 21 | 21 | |
| 22 | 22 | |
| 23 | - /**  | 
                                                        |
| 24 | - * @return self  | 
                                                        |
| 25 | - */  | 
                                                        |
| 26 | - public static function FIRST_VOTE_DECIDES()  | 
                                                        |
| 27 | -    { | 
                                                        |
| 28 | -        return static::instance('first_vote_decides'); | 
                                                        |
| 29 | - }  | 
                                                        |
| 23 | + /**  | 
                                                        |
| 24 | + * @return self  | 
                                                        |
| 25 | + */  | 
                                                        |
| 26 | + public static function FIRST_VOTE_DECIDES()  | 
                                                        |
| 27 | +	{ | 
                                                        |
| 28 | +		return static::instance('first_vote_decides'); | 
                                                        |
| 29 | + }  | 
                                                        |
| 30 | 30 | |
| 31 | 31 | |
| 32 | - /**  | 
                                                        |
| 33 | - * @return self  | 
                                                        |
| 34 | - */  | 
                                                        |
| 35 | - public static function ALLOW_UNLESS_DENIED()  | 
                                                        |
| 36 | -    { | 
                                                        |
| 37 | -        return static::instance('allow_unless_denied'); | 
                                                        |
| 38 | - }  | 
                                                        |
| 32 | + /**  | 
                                                        |
| 33 | + * @return self  | 
                                                        |
| 34 | + */  | 
                                                        |
| 35 | + public static function ALLOW_UNLESS_DENIED()  | 
                                                        |
| 36 | +	{ | 
                                                        |
| 37 | +		return static::instance('allow_unless_denied'); | 
                                                        |
| 38 | + }  | 
                                                        |
| 39 | 39 | |
| 40 | 40 | |
| 41 | - /**  | 
                                                        |
| 42 | - * @return self  | 
                                                        |
| 43 | - */  | 
                                                        |
| 44 | - public static function DENY_UNLESS_ALLOWED()  | 
                                                        |
| 45 | -    { | 
                                                        |
| 46 | -        return static::instance('deny_unless_allowed'); | 
                                                        |
| 47 | - }  | 
                                                        |
| 41 | + /**  | 
                                                        |
| 42 | + * @return self  | 
                                                        |
| 43 | + */  | 
                                                        |
| 44 | + public static function DENY_UNLESS_ALLOWED()  | 
                                                        |
| 45 | +	{ | 
                                                        |
| 46 | +		return static::instance('deny_unless_allowed'); | 
                                                        |
| 47 | + }  | 
                                                        |
| 48 | 48 | |
| 49 | 49 | |
| 50 | - /**  | 
                                                        |
| 51 | - * @param $string  | 
                                                        |
| 52 | - * @return self  | 
                                                        |
| 53 | - */  | 
                                                        |
| 54 | - private static function instance($string)  | 
                                                        |
| 55 | -    { | 
                                                        |
| 56 | -        if (!isset(static::$registry[$string])) { | 
                                                        |
| 57 | - static::$registry[$string] = new static($string);  | 
                                                        |
| 58 | - }  | 
                                                        |
| 59 | - return static::$registry[$string];  | 
                                                        |
| 60 | - }  | 
                                                        |
| 50 | + /**  | 
                                                        |
| 51 | + * @param $string  | 
                                                        |
| 52 | + * @return self  | 
                                                        |
| 53 | + */  | 
                                                        |
| 54 | + private static function instance($string)  | 
                                                        |
| 55 | +	{ | 
                                                        |
| 56 | +		if (!isset(static::$registry[$string])) { | 
                                                        |
| 57 | + static::$registry[$string] = new static($string);  | 
                                                        |
| 58 | + }  | 
                                                        |
| 59 | + return static::$registry[$string];  | 
                                                        |
| 60 | + }  | 
                                                        |
| 61 | 61 | |
| 62 | 62 | |
| 63 | - /**  | 
                                                        |
| 64 | - * @return string  | 
                                                        |
| 65 | - */  | 
                                                        |
| 66 | - public function __toString()  | 
                                                        |
| 67 | -    { | 
                                                        |
| 68 | - return $this->value;  | 
                                                        |
| 69 | - }  | 
                                                        |
| 63 | + /**  | 
                                                        |
| 64 | + * @return string  | 
                                                        |
| 65 | + */  | 
                                                        |
| 66 | + public function __toString()  | 
                                                        |
| 67 | +	{ | 
                                                        |
| 68 | + return $this->value;  | 
                                                        |
| 69 | + }  | 
                                                        |
| 70 | 70 | }  | 
                                                        
@@ -12,7 +12,7 @@ discard block  | 
                                                    ||
| 12 | 12 | /**  | 
                                                        
| 13 | 13 | * @var self[]  | 
                                                        
| 14 | 14 | */  | 
                                                        
| 15 | - static private $registry = [];  | 
                                                        |
| 15 | + static private $registry = [ ];  | 
                                                        |
| 16 | 16 | |
| 17 | 17 | private function __construct($value)  | 
                                                        
| 18 | 18 |      { | 
                                                        
@@ -53,10 +53,10 @@ discard block  | 
                                                    ||
| 53 | 53 | */  | 
                                                        
| 54 | 54 | private static function instance($string)  | 
                                                        
| 55 | 55 |      { | 
                                                        
| 56 | -        if (!isset(static::$registry[$string])) { | 
                                                        |
| 57 | - static::$registry[$string] = new static($string);  | 
                                                        |
| 56 | +        if (!isset(static::$registry[ $string ])) { | 
                                                        |
| 57 | + static::$registry[ $string ] = new static($string);  | 
                                                        |
| 58 | 58 | }  | 
                                                        
| 59 | - return static::$registry[$string];  | 
                                                        |
| 59 | + return static::$registry[ $string ];  | 
                                                        |
| 60 | 60 | }  | 
                                                        
| 61 | 61 | |
| 62 | 62 | |
@@ -39,7 +39,7 @@  | 
                                                    ||
| 39 | 39 | |
| 40 | 40 | |
| 41 | 41 | /**  | 
                                                        
| 42 | - * @param $string  | 
                                                        |
| 42 | + * @param string $string  | 
                                                        |
| 43 | 43 | * @return self  | 
                                                        
| 44 | 44 | */  | 
                                                        
| 45 | 45 | private static function instance($string)  | 
                                                        
@@ -4,58 +4,58 @@  | 
                                                    ||
| 4 | 4 | |
| 5 | 5 | final class VotingDecisionEnum  | 
                                                        
| 6 | 6 |  { | 
                                                        
| 7 | - /**  | 
                                                        |
| 8 | - * @var string  | 
                                                        |
| 9 | - */  | 
                                                        |
| 10 | - private $value;  | 
                                                        |
| 11 | -  | 
                                                        |
| 12 | - /**  | 
                                                        |
| 13 | - * @var self[]  | 
                                                        |
| 14 | - */  | 
                                                        |
| 15 | - static private $registry = [];  | 
                                                        |
| 16 | -  | 
                                                        |
| 17 | - private function __construct($value)  | 
                                                        |
| 18 | -    { | 
                                                        |
| 19 | - $this->value = $value;  | 
                                                        |
| 20 | - }  | 
                                                        |
| 21 | -  | 
                                                        |
| 22 | -  | 
                                                        |
| 23 | - /**  | 
                                                        |
| 24 | - * @return self  | 
                                                        |
| 25 | - */  | 
                                                        |
| 26 | - public static function ALLOWED()  | 
                                                        |
| 27 | -    { | 
                                                        |
| 28 | -        return static::instance('allowed'); | 
                                                        |
| 29 | - }  | 
                                                        |
| 30 | -  | 
                                                        |
| 31 | -  | 
                                                        |
| 32 | - /**  | 
                                                        |
| 33 | - * @return self  | 
                                                        |
| 34 | - */  | 
                                                        |
| 35 | - public static function DENIED()  | 
                                                        |
| 36 | -    { | 
                                                        |
| 37 | -        return static::instance('allowed'); | 
                                                        |
| 38 | - }  | 
                                                        |
| 39 | -  | 
                                                        |
| 40 | -  | 
                                                        |
| 41 | - /**  | 
                                                        |
| 42 | - * @param $string  | 
                                                        |
| 43 | - * @return self  | 
                                                        |
| 44 | - */  | 
                                                        |
| 45 | - private static function instance($string)  | 
                                                        |
| 46 | -    { | 
                                                        |
| 47 | -        if (!isset(static::$registry[$string])) { | 
                                                        |
| 48 | - static::$registry[$string] = new static($string);  | 
                                                        |
| 49 | - }  | 
                                                        |
| 50 | - return static::$registry[$string];  | 
                                                        |
| 51 | - }  | 
                                                        |
| 52 | -  | 
                                                        |
| 53 | -  | 
                                                        |
| 54 | - /**  | 
                                                        |
| 55 | - * @return string  | 
                                                        |
| 56 | - */  | 
                                                        |
| 57 | - public function __toString()  | 
                                                        |
| 58 | -    { | 
                                                        |
| 59 | - return $this->value;  | 
                                                        |
| 60 | - }  | 
                                                        |
| 7 | + /**  | 
                                                        |
| 8 | + * @var string  | 
                                                        |
| 9 | + */  | 
                                                        |
| 10 | + private $value;  | 
                                                        |
| 11 | +  | 
                                                        |
| 12 | + /**  | 
                                                        |
| 13 | + * @var self[]  | 
                                                        |
| 14 | + */  | 
                                                        |
| 15 | + static private $registry = [];  | 
                                                        |
| 16 | +  | 
                                                        |
| 17 | + private function __construct($value)  | 
                                                        |
| 18 | +	{ | 
                                                        |
| 19 | + $this->value = $value;  | 
                                                        |
| 20 | + }  | 
                                                        |
| 21 | +  | 
                                                        |
| 22 | +  | 
                                                        |
| 23 | + /**  | 
                                                        |
| 24 | + * @return self  | 
                                                        |
| 25 | + */  | 
                                                        |
| 26 | + public static function ALLOWED()  | 
                                                        |
| 27 | +	{ | 
                                                        |
| 28 | +		return static::instance('allowed'); | 
                                                        |
| 29 | + }  | 
                                                        |
| 30 | +  | 
                                                        |
| 31 | +  | 
                                                        |
| 32 | + /**  | 
                                                        |
| 33 | + * @return self  | 
                                                        |
| 34 | + */  | 
                                                        |
| 35 | + public static function DENIED()  | 
                                                        |
| 36 | +	{ | 
                                                        |
| 37 | +		return static::instance('allowed'); | 
                                                        |
| 38 | + }  | 
                                                        |
| 39 | +  | 
                                                        |
| 40 | +  | 
                                                        |
| 41 | + /**  | 
                                                        |
| 42 | + * @param $string  | 
                                                        |
| 43 | + * @return self  | 
                                                        |
| 44 | + */  | 
                                                        |
| 45 | + private static function instance($string)  | 
                                                        |
| 46 | +	{ | 
                                                        |
| 47 | +		if (!isset(static::$registry[$string])) { | 
                                                        |
| 48 | + static::$registry[$string] = new static($string);  | 
                                                        |
| 49 | + }  | 
                                                        |
| 50 | + return static::$registry[$string];  | 
                                                        |
| 51 | + }  | 
                                                        |
| 52 | +  | 
                                                        |
| 53 | +  | 
                                                        |
| 54 | + /**  | 
                                                        |
| 55 | + * @return string  | 
                                                        |
| 56 | + */  | 
                                                        |
| 57 | + public function __toString()  | 
                                                        |
| 58 | +	{ | 
                                                        |
| 59 | + return $this->value;  | 
                                                        |
| 60 | + }  | 
                                                        |
| 61 | 61 | }  | 
                                                        
| 62 | 62 | \ No newline at end of file  | 
                                                        
@@ -12,7 +12,7 @@ discard block  | 
                                                    ||
| 12 | 12 | /**  | 
                                                        
| 13 | 13 | * @var self[]  | 
                                                        
| 14 | 14 | */  | 
                                                        
| 15 | - static private $registry = [];  | 
                                                        |
| 15 | + static private $registry = [ ];  | 
                                                        |
| 16 | 16 | |
| 17 | 17 | private function __construct($value)  | 
                                                        
| 18 | 18 |      { | 
                                                        
@@ -44,10 +44,10 @@ discard block  | 
                                                    ||
| 44 | 44 | */  | 
                                                        
| 45 | 45 | private static function instance($string)  | 
                                                        
| 46 | 46 |      { | 
                                                        
| 47 | -        if (!isset(static::$registry[$string])) { | 
                                                        |
| 48 | - static::$registry[$string] = new static($string);  | 
                                                        |
| 47 | +        if (!isset(static::$registry[ $string ])) { | 
                                                        |
| 48 | + static::$registry[ $string ] = new static($string);  | 
                                                        |
| 49 | 49 | }  | 
                                                        
| 50 | - return static::$registry[$string];  | 
                                                        |
| 50 | + return static::$registry[ $string ];  | 
                                                        |
| 51 | 51 | }  | 
                                                        
| 52 | 52 | |
| 53 | 53 | |
@@ -5,43 +5,43 @@  | 
                                                    ||
| 5 | 5 | |
| 6 | 6 | class VotingResult implements IVotingResult  | 
                                                        
| 7 | 7 |  { | 
                                                        
| 8 | - /**  | 
                                                        |
| 9 | - * @var VotingDecisionEnum  | 
                                                        |
| 10 | - */  | 
                                                        |
| 11 | - private $decision;  | 
                                                        |
| 12 | -  | 
                                                        |
| 13 | - /**  | 
                                                        |
| 14 | - * @var ISingleVoterResult[]  | 
                                                        |
| 15 | - */  | 
                                                        |
| 16 | - private $partialResults;  | 
                                                        |
| 17 | -  | 
                                                        |
| 18 | -  | 
                                                        |
| 19 | - /**  | 
                                                        |
| 20 | - * VotingResult constructor.  | 
                                                        |
| 21 | - * @param VotingDecisionEnum $decision  | 
                                                        |
| 22 | - * @param ISingleVoterResult[] $partialResults  | 
                                                        |
| 23 | - */  | 
                                                        |
| 24 | - public function __construct(VotingDecisionEnum $decision, $partialResults)  | 
                                                        |
| 8 | + /**  | 
                                                        |
| 9 | + * @var VotingDecisionEnum  | 
                                                        |
| 10 | + */  | 
                                                        |
| 11 | + private $decision;  | 
                                                        |
| 12 | +  | 
                                                        |
| 13 | + /**  | 
                                                        |
| 14 | + * @var ISingleVoterResult[]  | 
                                                        |
| 15 | + */  | 
                                                        |
| 16 | + private $partialResults;  | 
                                                        |
| 17 | +  | 
                                                        |
| 18 | +  | 
                                                        |
| 19 | + /**  | 
                                                        |
| 20 | + * VotingResult constructor.  | 
                                                        |
| 21 | + * @param VotingDecisionEnum $decision  | 
                                                        |
| 22 | + * @param ISingleVoterResult[] $partialResults  | 
                                                        |
| 23 | + */  | 
                                                        |
| 24 | + public function __construct(VotingDecisionEnum $decision, $partialResults)  | 
                                                        |
| 25 | 25 |  	{ | 
                                                        
| 26 | - $this->decision = $decision;  | 
                                                        |
| 27 | - $this->partialResults = $partialResults;  | 
                                                        |
| 28 | - }  | 
                                                        |
| 29 | -  | 
                                                        |
| 30 | -  | 
                                                        |
| 31 | - /**  | 
                                                        |
| 32 | - * @return VotingDecisionEnum  | 
                                                        |
| 33 | - */  | 
                                                        |
| 34 | - public function getDecision()  | 
                                                        |
| 35 | -    { | 
                                                        |
| 36 | - return $this->decision;  | 
                                                        |
| 37 | - }  | 
                                                        |
| 38 | -  | 
                                                        |
| 39 | -  | 
                                                        |
| 40 | - /**  | 
                                                        |
| 41 | - * @return ISingleVoterResult[]  | 
                                                        |
| 42 | - */  | 
                                                        |
| 43 | - public function getPartialResults()  | 
                                                        |
| 44 | -    { | 
                                                        |
| 45 | - return $this->partialResults;  | 
                                                        |
| 46 | - }  | 
                                                        |
| 26 | + $this->decision = $decision;  | 
                                                        |
| 27 | + $this->partialResults = $partialResults;  | 
                                                        |
| 28 | + }  | 
                                                        |
| 29 | +  | 
                                                        |
| 30 | +  | 
                                                        |
| 31 | + /**  | 
                                                        |
| 32 | + * @return VotingDecisionEnum  | 
                                                        |
| 33 | + */  | 
                                                        |
| 34 | + public function getDecision()  | 
                                                        |
| 35 | +	{ | 
                                                        |
| 36 | + return $this->decision;  | 
                                                        |
| 37 | + }  | 
                                                        |
| 38 | +  | 
                                                        |
| 39 | +  | 
                                                        |
| 40 | + /**  | 
                                                        |
| 41 | + * @return ISingleVoterResult[]  | 
                                                        |
| 42 | + */  | 
                                                        |
| 43 | + public function getPartialResults()  | 
                                                        |
| 44 | +	{ | 
                                                        |
| 45 | + return $this->partialResults;  | 
                                                        |
| 46 | + }  | 
                                                        |
| 47 | 47 | }  | 
                                                        
@@ -25,10 +25,10 @@  | 
                                                    ||
| 25 | 25 | */  | 
                                                        
| 26 | 26 | public function vote($action, $votingSubject, IVotingContext $votingContext)  | 
                                                        
| 27 | 27 |  	{ | 
                                                        
| 28 | -        if (!($votingSubject instanceof IVotingSubject)) { | 
                                                        |
| 29 | - $votingSubject = new VotingSubject($votingSubject);  | 
                                                        |
| 30 | - }  | 
                                                        |
| 28 | +		if (!($votingSubject instanceof IVotingSubject)) { | 
                                                        |
| 29 | + $votingSubject = new VotingSubject($votingSubject);  | 
                                                        |
| 30 | + }  | 
                                                        |
| 31 | 31 | |
| 32 | - return $this->innerVote($action, $votingSubject, $votingContext);  | 
                                                        |
| 32 | + return $this->innerVote($action, $votingSubject, $votingContext);  | 
                                                        |
| 33 | 33 | }  | 
                                                        
| 34 | 34 | }  | 
                                                        
| 35 | 35 | \ No newline at end of file  | 
                                                        
@@ -89,7 +89,7 @@ discard block  | 
                                                    ||
| 89 | 89 |  	{ | 
                                                        
| 90 | 90 |  		foreach ($this->voters as $voter) { | 
                                                        
| 91 | 91 |  			if (($lastResult = $voter->vote($votingSubject, $votingContext)) !== null) { | 
                                                        
| 92 | - return new VotingResult($lastResult->getDecision(), [$lastResult]);  | 
                                                        |
| 92 | + return new VotingResult($lastResult->getDecision(), [$lastResult]);  | 
                                                        |
| 93 | 93 | }  | 
                                                        
| 94 | 94 | }  | 
                                                        
| 95 | 95 |  		throw new InvalidVotingResultException('Voting assembly did not decide on any result!'); | 
                                                        
@@ -103,13 +103,13 @@ discard block  | 
                                                    ||
| 103 | 103 | */  | 
                                                        
| 104 | 104 | private function strategyAllowUnlessDenied($votingSubject, $votingContext)  | 
                                                        
| 105 | 105 |  	{ | 
                                                        
| 106 | - $results = [];  | 
                                                        |
| 106 | + $results = [];  | 
                                                        |
| 107 | 107 |  		foreach ($this->voters as $name => $voter) { | 
                                                        
| 108 | 108 |  			if (($lastResult = $voter->vote($votingSubject, $votingContext)) !== null) { | 
                                                        
| 109 | - $results[] = $lastResult;  | 
                                                        |
| 110 | -			    if ($lastResult->getDecision() == VotingDecisionEnum::DENIED()) { | 
                                                        |
| 111 | - return new VotingResult(VotingDecisionEnum::DENIED(), $results);  | 
                                                        |
| 112 | - }  | 
                                                        |
| 109 | + $results[] = $lastResult;  | 
                                                        |
| 110 | +				if ($lastResult->getDecision() == VotingDecisionEnum::DENIED()) { | 
                                                        |
| 111 | + return new VotingResult(VotingDecisionEnum::DENIED(), $results);  | 
                                                        |
| 112 | + }  | 
                                                        |
| 113 | 113 | }  | 
                                                        
| 114 | 114 | }  | 
                                                        
| 115 | 115 | return new VotingResult(VotingDecisionEnum::ALLOWED(), $results);  | 
                                                        
@@ -123,16 +123,16 @@ discard block  | 
                                                    ||
| 123 | 123 | */  | 
                                                        
| 124 | 124 | private function strategyDenyUnlessAllowed($votingSubject, $votingContext)  | 
                                                        
| 125 | 125 |  	{ | 
                                                        
| 126 | - $results = [];  | 
                                                        |
| 127 | -        foreach ($this->voters as $name => $voter) { | 
                                                        |
| 128 | -            if (($lastResult = $voter->vote($votingSubject, $votingContext)) !== null) { | 
                                                        |
| 129 | - $results[] = $lastResult;  | 
                                                        |
| 130 | -                if ($lastResult->getDecision() == VotingDecisionEnum::DENIED()) { | 
                                                        |
| 131 | - return new VotingResult(VotingDecisionEnum::ALLOWED(), $results);  | 
                                                        |
| 132 | - }  | 
                                                        |
| 133 | - }  | 
                                                        |
| 134 | - }  | 
                                                        |
| 135 | - return new VotingResult(VotingDecisionEnum::DENIED(), $results);  | 
                                                        |
| 126 | + $results = [];  | 
                                                        |
| 127 | +		foreach ($this->voters as $name => $voter) { | 
                                                        |
| 128 | +			if (($lastResult = $voter->vote($votingSubject, $votingContext)) !== null) { | 
                                                        |
| 129 | + $results[] = $lastResult;  | 
                                                        |
| 130 | +				if ($lastResult->getDecision() == VotingDecisionEnum::DENIED()) { | 
                                                        |
| 131 | + return new VotingResult(VotingDecisionEnum::ALLOWED(), $results);  | 
                                                        |
| 132 | + }  | 
                                                        |
| 133 | + }  | 
                                                        |
| 134 | + }  | 
                                                        |
| 135 | + return new VotingResult(VotingDecisionEnum::DENIED(), $results);  | 
                                                        |
| 136 | 136 | }  | 
                                                        
| 137 | 137 | |
| 138 | 138 | |
@@ -89,7 +89,7 @@ discard block  | 
                                                    ||
| 89 | 89 |  	{ | 
                                                        
| 90 | 90 |  		foreach ($this->voters as $voter) { | 
                                                        
| 91 | 91 |  			if (($lastResult = $voter->vote($votingSubject, $votingContext)) !== null) { | 
                                                        
| 92 | - return new VotingResult($lastResult->getDecision(), [$lastResult]);  | 
                                                        |
| 92 | + return new VotingResult($lastResult->getDecision(), [ $lastResult ]);  | 
                                                        |
| 93 | 93 | }  | 
                                                        
| 94 | 94 | }  | 
                                                        
| 95 | 95 |  		throw new InvalidVotingResultException('Voting assembly did not decide on any result!'); | 
                                                        
@@ -103,10 +103,10 @@ discard block  | 
                                                    ||
| 103 | 103 | */  | 
                                                        
| 104 | 104 | private function strategyAllowUnlessDenied($votingSubject, $votingContext)  | 
                                                        
| 105 | 105 |  	{ | 
                                                        
| 106 | - $results = [];  | 
                                                        |
| 106 | + $results = [ ];  | 
                                                        |
| 107 | 107 |  		foreach ($this->voters as $name => $voter) { | 
                                                        
| 108 | 108 |  			if (($lastResult = $voter->vote($votingSubject, $votingContext)) !== null) { | 
                                                        
| 109 | - $results[] = $lastResult;  | 
                                                        |
| 109 | + $results[ ] = $lastResult;  | 
                                                        |
| 110 | 110 |  			    if ($lastResult->getDecision() == VotingDecisionEnum::DENIED()) { | 
                                                        
| 111 | 111 | return new VotingResult(VotingDecisionEnum::DENIED(), $results);  | 
                                                        
| 112 | 112 | }  | 
                                                        
@@ -123,10 +123,10 @@ discard block  | 
                                                    ||
| 123 | 123 | */  | 
                                                        
| 124 | 124 | private function strategyDenyUnlessAllowed($votingSubject, $votingContext)  | 
                                                        
| 125 | 125 |  	{ | 
                                                        
| 126 | - $results = [];  | 
                                                        |
| 126 | + $results = [ ];  | 
                                                        |
| 127 | 127 |          foreach ($this->voters as $name => $voter) { | 
                                                        
| 128 | 128 |              if (($lastResult = $voter->vote($votingSubject, $votingContext)) !== null) { | 
                                                        
| 129 | - $results[] = $lastResult;  | 
                                                        |
| 129 | + $results[ ] = $lastResult;  | 
                                                        |
| 130 | 130 |                  if ($lastResult->getDecision() == VotingDecisionEnum::DENIED()) { | 
                                                        
| 131 | 131 | return new VotingResult(VotingDecisionEnum::ALLOWED(), $results);  | 
                                                        
| 132 | 132 | }  | 
                                                        
@@ -4,8 +4,8 @@  | 
                                                    ||
| 4 | 4 | |
| 5 | 5 | interface IResult  | 
                                                        
| 6 | 6 |  { | 
                                                        
| 7 | - /**  | 
                                                        |
| 8 | - * @return VotingDecisionEnum  | 
                                                        |
| 9 | - */  | 
                                                        |
| 10 | - public function getDecision();  | 
                                                        |
| 7 | + /**  | 
                                                        |
| 8 | + * @return VotingDecisionEnum  | 
                                                        |
| 9 | + */  | 
                                                        |
| 10 | + public function getDecision();  | 
                                                        |
| 11 | 11 | }  | 
                                                        
| 12 | 12 | \ No newline at end of file  | 
                                                        
@@ -12,28 +12,28 @@  | 
                                                    ||
| 12 | 12 | private $allowedRoles;  | 
                                                        
| 13 | 13 | |
| 14 | 14 | /**  | 
                                                        
| 15 | - * @var VotingDecisionEnum  | 
                                                        |
| 16 | - */  | 
                                                        |
| 17 | - private $resultDecision;  | 
                                                        |
| 18 | -  | 
                                                        |
| 19 | - /**  | 
                                                        |
| 20 | - * @var mixed|null  | 
                                                        |
| 21 | - */  | 
                                                        |
| 22 | - private $reason;  | 
                                                        |
| 23 | -  | 
                                                        |
| 24 | -  | 
                                                        |
| 25 | - /**  | 
                                                        |
| 26 | - * RoleVoter constructor.  | 
                                                        |
| 27 | - * @param VotingDecisionEnum $resultDecision  | 
                                                        |
| 28 | - * @param string|string[] $allowedRoles  | 
                                                        |
| 29 | - * @param mixed $reason  | 
                                                        |
| 30 | - */  | 
                                                        |
| 15 | + * @var VotingDecisionEnum  | 
                                                        |
| 16 | + */  | 
                                                        |
| 17 | + private $resultDecision;  | 
                                                        |
| 18 | +  | 
                                                        |
| 19 | + /**  | 
                                                        |
| 20 | + * @var mixed|null  | 
                                                        |
| 21 | + */  | 
                                                        |
| 22 | + private $reason;  | 
                                                        |
| 23 | +  | 
                                                        |
| 24 | +  | 
                                                        |
| 25 | + /**  | 
                                                        |
| 26 | + * RoleVoter constructor.  | 
                                                        |
| 27 | + * @param VotingDecisionEnum $resultDecision  | 
                                                        |
| 28 | + * @param string|string[] $allowedRoles  | 
                                                        |
| 29 | + * @param mixed $reason  | 
                                                        |
| 30 | + */  | 
                                                        |
| 31 | 31 | public function __construct(VotingDecisionEnum $resultDecision, $allowedRoles, $reason = null)  | 
                                                        
| 32 | 32 |  	{ | 
                                                        
| 33 | 33 | $this->allowedRoles = (array) $allowedRoles;  | 
                                                        
| 34 | - $this->resultDecision = $resultDecision;  | 
                                                        |
| 35 | - $this->reason = $reason;  | 
                                                        |
| 36 | - }  | 
                                                        |
| 34 | + $this->resultDecision = $resultDecision;  | 
                                                        |
| 35 | + $this->reason = $reason;  | 
                                                        |
| 36 | + }  | 
                                                        |
| 37 | 37 | |
| 38 | 38 | |
| 39 | 39 | /**  | 
                                                        
@@ -30,7 +30,7 @@  | 
                                                    ||
| 30 | 30 | */  | 
                                                        
| 31 | 31 | public function __construct(VotingDecisionEnum $resultDecision, $allowedRoles, $reason = null)  | 
                                                        
| 32 | 32 |  	{ | 
                                                        
| 33 | - $this->allowedRoles = (array) $allowedRoles;  | 
                                                        |
| 33 | + $this->allowedRoles = (array)$allowedRoles;  | 
                                                        |
| 34 | 34 | $this->resultDecision = $resultDecision;  | 
                                                        
| 35 | 35 | $this->reason = $reason;  | 
                                                        
| 36 | 36 | }  | 
                                                        
@@ -27,12 +27,12 @@  | 
                                                    ||
| 27 | 27 | */  | 
                                                        
| 28 | 28 | public function getVotingSubjectName()  | 
                                                        
| 29 | 29 |  	{ | 
                                                        
| 30 | -	    if (is_string($this->subject)) { | 
                                                        |
| 31 | - return $this->subject;  | 
                                                        |
| 32 | - }  | 
                                                        |
| 33 | -        if (is_object($this->subject)) { | 
                                                        |
| 34 | - return get_class($this->subject);  | 
                                                        |
| 35 | - }  | 
                                                        |
| 30 | +		if (is_string($this->subject)) { | 
                                                        |
| 31 | + return $this->subject;  | 
                                                        |
| 32 | + }  | 
                                                        |
| 33 | +		if (is_object($this->subject)) { | 
                                                        |
| 34 | + return get_class($this->subject);  | 
                                                        |
| 35 | + }  | 
                                                        |
| 36 | 36 | return (string) $this->subject;  | 
                                                        
| 37 | 37 | }  | 
                                                        
| 38 | 38 | }  | 
                                                        
@@ -33,6 +33,6 @@  | 
                                                    ||
| 33 | 33 |          if (is_object($this->subject)) { | 
                                                        
| 34 | 34 | return get_class($this->subject);  | 
                                                        
| 35 | 35 | }  | 
                                                        
| 36 | - return (string) $this->subject;  | 
                                                        |
| 36 | + return (string)$this->subject;  | 
                                                        |
| 37 | 37 | }  | 
                                                        
| 38 | 38 | }  | 
                                                        
@@ -5,8 +5,8 @@  | 
                                                    ||
| 5 | 5 | |
| 6 | 6 | interface ISingleVoterResult extends IResult  | 
                                                        
| 7 | 7 |  { | 
                                                        
| 8 | - /**  | 
                                                        |
| 9 | - * @return mixed  | 
                                                        |
| 10 | - */  | 
                                                        |
| 11 | - public function getReason();  | 
                                                        |
| 8 | + /**  | 
                                                        |
| 9 | + * @return mixed  | 
                                                        |
| 10 | + */  | 
                                                        |
| 11 | + public function getReason();  | 
                                                        |
| 12 | 12 | }  | 
                                                        
| 13 | 13 | \ No newline at end of file  |