Applied CS fixer

This commit is contained in:
Kevin Frantz
2018-10-29 19:01:00 +01:00
parent 91c41105c7
commit 6bc95f9729
46 changed files with 270 additions and 281 deletions

View File

@@ -1,4 +1,5 @@
<?php
namespace App\Entity;
use App\Entity\Attribut\IdAttribut;
@@ -6,7 +7,6 @@ use Doctrine\ORM\Mapping as ORM;
use App\Entity\Attribut\VersionAttribut;
/**
*
* @author kevinfrantz
*/
abstract class AbstractEntity implements EntityInterface
@@ -14,7 +14,6 @@ abstract class AbstractEntity implements EntityInterface
use IdAttribut, VersionAttribut;
/**
*
* @ORM\Id()
* @ORM\GeneratedValue
* @ORM\Column(type="integer")(strategy="AUTO")
@@ -24,8 +23,8 @@ abstract class AbstractEntity implements EntityInterface
protected $id;
/**
*
* @version @ORM\Column(type="integer")
*
* @var int
*/
protected $version;

View File

@@ -1,25 +1,24 @@
<?php
namespace App\Entity\Attribut;
/**
*
* @author kevinfrantz
*
*/
trait VersionAttribut
{
/**
*
* @var int
*/
protected $version;
public function setVersion(int $version):void{
public function setVersion(int $version): void
{
$this->version = $version;
}
public function getVersion():int{
public function getVersion(): int
{
return $this->version;
}
}

View File

@@ -1,24 +1,28 @@
<?php
namespace App\Entity\Attribut;
/**
* Entities which implement this interface can lock stuff on an optimistic base.
* Entities which implement this interface can lock stuff on an optimistic base.
*
* @see https://www.doctrine-project.org/projects/doctrine-orm/en/2.6/reference/transactions-and-concurrency.html
* @see https://en.wikipedia.org/wiki/Optimistic_concurrency_control
*
* @author kevinfrantz
*/
interface VersionAttributInterface
{
/**
* Returns the revision version of the entity
* Returns the revision version of the entity.
*
* @return int
*/
public function getVersion():int;
public function getVersion(): int;
/**
* Sets the revision version of the entity
* Sets the revision version of the entity.
*
* @param int $version
*/
public function setVersion(int $version):void;
public function setVersion(int $version): void;
}

View File

@@ -1,15 +1,13 @@
<?php
namespace App\Entity;
use App\Entity\Attribut\VersionAttributInterface;
use App\Entity\Attribut\IdAttributInterface;
/**
*
* @author kevinfrantz
*
*/
interface EntityInterface extends VersionAttributInterface, IdAttributInterface
{
}

View File

@@ -1,13 +1,12 @@
<?php
namespace App\Entity\Meta;
use App\Entity\AbstractEntity;
/**
*
* @author kevinfrantz
*
*/
abstract class AbstractMeta extends AbstractEntity implements MetaInterface
{
}
}

View File

@@ -1,4 +1,5 @@
<?php
namespace App\Entity\Meta;
use Doctrine\ORM\Mapping as ORM;
@@ -7,7 +8,6 @@ use Doctrine\Common\Collections\ArrayCollection;
use App\Entity\Attribut\RelationAttribut;
/**
*
* @author kevinfrantz
* @ORM\Table(name="meta_law")
* @ORM\Entity(repositoryClass="App\Repository\LawRepository")
@@ -17,7 +17,6 @@ final class Law extends AbstractMeta implements LawInterface
use RightsAttribute, RelationAttribut;
/**
*
* @ORM\OneToMany(targetEntity="Right", mappedBy="law", cascade={"persist", "remove"})
*
* @var ArrayCollection | Right[]
@@ -36,7 +35,7 @@ final class Law extends AbstractMeta implements LawInterface
public function isGranted(RelationInterface $relation, string $layer, string $right): bool
{
/**
/*
*
* @var RightInterface
*/

View File

@@ -3,7 +3,6 @@
namespace App\Entity\Meta;
use App\Entity\Attribut\RightsAttributInterface;
use App\Entity\Attribut\RelationAttributInterface;
use App\Entity\Method\RelationGrantedInterface;
/**

View File

@@ -1,15 +1,15 @@
<?php
namespace App\Entity\Meta;
use App\Entity\EntityInterface;
/**
* Meta entities contain informations which describe sources.
* If you refer from a meta entity to an source be aware to catch infinite loops!
* If you refer from a meta entity to an source be aware to catch infinite loops!
*
* @author kevinfrantz
*
*/
interface MetaInterface extends EntityInterface
{
}

View File

@@ -9,7 +9,7 @@ use App\Entity\Attribut\RelationAttributInterface;
/**
* @author kevinfrantz
*/
interface RecieverGroupInterface extends RelationAttributInterface, RecieverAttributInterface,MetaInterface
interface RecieverGroupInterface extends RelationAttributInterface, RecieverAttributInterface, MetaInterface
{
public function getAllRecievers(): ArrayCollection;
}

View File

@@ -13,10 +13,12 @@ use App\Entity\Source\SourceInterface;
use Doctrine\Common\Collections\Collection;
/**
* This class represents a relation.
* This class represents a relation.
* It allows a better right management of the meta informations.
* Also it is used to capsel the logic relation to an own logical unit.
* Also it is used to capsel the logic relation to an own logical unit.
*
* @author kevinfrantz
*
* @todo rename and refactor this class
* @ORM\Table(name="meta_relation")
* @ORM\Entity()
@@ -28,9 +30,10 @@ final class Relation extends AbstractMeta implements RelationInterface
ParentsAttribut,
LawAttribut,
ChildsAttribut;
/**
* Parents represent the creators of the relation
* Parents represent the creators of the relation.
*
* @ORM\ManyToMany(targetEntity="Relation")
* @ORM\JoinTable(name="meta_relation_parents",
* joinColumns={@ORM\JoinColumn(name="relation_id", referencedColumnName="id")},
@@ -40,10 +43,12 @@ final class Relation extends AbstractMeta implements RelationInterface
* @var Collection|RelationInterface[]
*/
protected $parents;
/**
* Childs represent the by the object produced relations
* @todo Replace this by self referencing
* Childs represent the by the object produced relations.
*
* @todo Replace this by self referencing
*
* @see https://www.doctrine-project.org/projects/doctrine-orm/en/2.6/reference/association-mapping.html
* @ORM\ManyToMany(targetEntity="Relation")
* @ORM\JoinTable(name="meta_relation_childs",

View File

@@ -11,6 +11,6 @@ use App\Entity\Attribut\LawAttributInterface;
/**
* @author kevinfrantz
*/
interface RelationInterface extends SourceAttributInterface, IdAttributInterface, ParentsAttributInterface, ChildsAttributeInterface, LawAttributInterface,MetaInterface
interface RelationInterface extends SourceAttributInterface, IdAttributInterface, ParentsAttributInterface, ChildsAttributeInterface, LawAttributInterface, MetaInterface
{
}

View File

@@ -1,4 +1,5 @@
<?php
namespace App\Entity\Meta;
use App\Entity\Attribut\TypeAttributInterface;
@@ -11,7 +12,6 @@ use App\Entity\Method\RelationGrantedInterface;
use App\Entity\Attribut\RelationAttributInterface;
/**
*
* @author kevinfrantz
*/
interface RightInterface extends TypeAttributInterface, LawAttributInterface, RelationGrantedInterface, GrantAttributInterface, RecieverGroupAttributInterface, RelationAttributInterface, ConditionAttributInterface, LayerAttributInterface, MetaInterface

View File

@@ -11,9 +11,11 @@ interface RelationGrantedInterface
{
/**
* @deprecated Methods shouldn't be used on the entity level
*
* @param RelationInterface $relation
* @param string $layer
* @param string $right
* @param string $layer
* @param string $right
*
* @return bool
*/
public function isGranted(RelationInterface $relation, string $layer, string $right): bool;

View File

@@ -1,4 +1,5 @@
<?php
namespace App\Entity\Source;
use Doctrine\ORM\Mapping as ORM;
@@ -15,9 +16,8 @@ use App\Entity\Meta\Law;
use Doctrine\Common\Collections\ArrayCollection;
/**
*
* @author kevinfrantz
*
*
* @see https://www.doctrine-project.org/projects/doctrine-orm/en/2.6/reference/inheritance-mapping.html
* @ORM\Entity
* @ORM\Table(name="source")
@@ -30,7 +30,6 @@ abstract class AbstractSource extends AbstractEntity implements SourceInterface
use RelationAttribut,GroupSourcesAttribut, LawAttribut;
/**
*
* @var RelationInterface
* @ORM\OneToOne(targetEntity="App\Entity\Meta\Relation",cascade={"persist", "remove"})
* @ORM\JoinColumn(name="relation_id", referencedColumnName="id")
@@ -39,16 +38,15 @@ abstract class AbstractSource extends AbstractEntity implements SourceInterface
protected $relation;
/**
*
* @todo Implement that just one table on database level is needed!
* @todo Rename table to use the right schema
*
* @var Collection|GroupSource[]
* @ORM\ManyToMany(targetEntity="GroupSource")
*/
protected $groups;
/**
*
* @ORM\OneToOne(targetEntity="Law",cascade={"persist", "remove"})
* @ORM\JoinColumn(name="law_id", referencedColumnName="id")
*

View File

@@ -1,36 +1,33 @@
<?php
namespace App\Entity\Source\Attribut;
use Doctrine\Common\Collections\Collection;
use App\Entity\Source\GroupSourceInterface;
/**
*
* @author kevinfrantz
*
*/
trait GroupSourcesAttribut
{
/**
*
* @var Collection|GroupSourceInterface[]
*/
protected $groups;
/**
*
* @return Collection|GroupSourceInterface[]
*/
public function getGroupSources():Collection{
public function getGroupSources(): Collection
{
return $this->groups;
}
/**
*
* @param Collection|GroupSourceInterface[] $groups
*/
public function setGroupSources(Collection $groups):void{
public function setGroupSources(Collection $groups): void
{
$this->groups = $groups;
}
}

View File

@@ -1,24 +1,22 @@
<?php
namespace App\Entity\Source\Attribut;
use Doctrine\Common\Collections\Collection;
use App\Entity\Source\GroupSourceInterface;
/**
*
* @author kevinfrantz
*
*/
interface GroupSourcesAttributInterface
{
/**
* @param Collection|GroupSourceInterface[] $groups
*/
public function setGroupSources(Collection $groups):void;
public function setGroupSources(Collection $groups): void;
/**
* @return Collection|GroupSourceInterface[]
*/
public function getGroupSources():Collection;
public function getGroupSources(): Collection;
}

View File

@@ -1,18 +1,15 @@
<?php
namespace App\Entity\Source\Attribut;
use Doctrine\Common\Collections\Collection;
/**
*
* @author kevinfrantz
*
*/
trait MembersAttribut
{
/**
*
* @var Collection
*/
protected $members;
@@ -27,4 +24,3 @@ trait MembersAttribut
$this->members = $members;
}
}

View File

@@ -1,17 +1,16 @@
<?php
namespace App\Entity\Source\Attribut;
use Doctrine\Common\Collections\Collection;
/**
* Allows to group other sources in a source
* Allows to group other sources in a source.
*
* @author kevinfrantz
*
*/
interface MembersAttributInterface
{
/**
* @param Collection $members
*/
@@ -21,4 +20,4 @@ interface MembersAttributInterface
* @return Collection
*/
public function getMembers(): Collection;
}
}

View File

@@ -1,4 +1,5 @@
<?php
namespace App\Entity\Source;
use Doctrine\ORM\Mapping as ORM;
@@ -8,7 +9,6 @@ use App\Entity\Source\Attribut\MembersAttribut;
use Doctrine\Common\Collections\ArrayCollection;
/**
*
* @author kevinfrantz
* @ORM\Table(name="source_group")
* @ORM\Entity
@@ -18,15 +18,14 @@ final class GroupSource extends AbstractSource implements MembersAttributInterfa
use MembersAttribut;
/**
*
* @var Collection
* @ORM\ManyToMany(targetEntity="AbstractSource")
*/
protected $members;
public function __construct() {
public function __construct()
{
parent::__construct();
$this->members = new ArrayCollection();
}
}

View File

@@ -1,14 +1,14 @@
<?php
namespace App\Entity\Source;
use App\Entity\Source\Attribut\MembersAttributInterface;
/**
* @author kevinfrantz
*
* @todo Map the not jet mapped functions!
*
*/
interface GroupSourceInterface extends MembersAttributInterface
{
}

View File

@@ -5,7 +5,6 @@ namespace App\Entity\Source;
use App\Entity\Attribut\NameAttribut;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
use App\Entity\Source\NameSourceInterface;
/**
* @author kevinfrantz

View File

@@ -1,4 +1,5 @@
<?php
namespace App\Entity\Source\Operation;
use App\Logic\Result\ResultInterface;
@@ -9,7 +10,6 @@ use Doctrine\ORM\Mapping as ORM;
use App\Entity\Source\AbstractSource;
/**
*
* @author kevinfrantz
* @ORM\Entity
* @ORM\Table(name="source_operation")
@@ -19,7 +19,6 @@ use App\Entity\Source\AbstractSource;
*/
abstract class AbstractOperation extends AbstractSource implements OperationInterface
{
/**
* The result MUST NOT be saved via Doctrine!
*
@@ -28,7 +27,6 @@ abstract class AbstractOperation extends AbstractSource implements OperationInte
protected $result;
/**
*
* @var ArrayCollection|OperandInterface[]
*/
protected $operands;

View File

@@ -19,12 +19,13 @@ class AndOperation extends AbstractOperation
throw new \Exception('Operands must be defined!');
}
$this->result = new Result();
/**
/*
* @var OperandInterface
*/
foreach ($this->operands->toArray() as $operand) {
if (!$operand->getResult()->getBool()) {
$this->result->setAll(false);
return;
}
}

View File

@@ -1,4 +1,5 @@
<?php
namespace App\Entity\Source;
use App\Entity\Attribut\IdAttributInterface;
@@ -7,7 +8,6 @@ use App\Entity\Source\Attribut\GroupSourcesAttributInterface;
use App\Entity\Attribut\LawAttributInterface;
/**
*
* @author kevinfrantz
*/
interface SourceInterface extends IdAttributInterface, EntityInterface, GroupSourcesAttributInterface, LawAttributInterface

View File

@@ -38,10 +38,10 @@ class User extends BaseUser implements UserInterface
* @ORM\Column(type="integer")(strategy="AUTO")
*/
protected $id;
/**
*
* @version @ORM\Column(type="integer")
*
* @var int
*/
protected $version;

View File

@@ -1,4 +1,5 @@
<?php
namespace App\Entity;
use FOS\UserBundle\Model\UserInterface as FOSUserInterface;
@@ -7,9 +8,7 @@ use App\Entity\Attribut\VersionAttributInterface;
/**
* @author kevinfrantz
*
*/
interface UserInterface extends FOSUserInterface, SourceAttributInterface, VersionAttributInterface
{
}
}