/** * @title -> getTitle() -> title * @description -> getDescription() -> description * @slug -> getSlug() -> slug */ public function __construct(Uuid $uuid, \DateTime $createdOn, $title, $description, $slug) { parent::__construct($uuid, $createdOn); $this->title = $title; $this->description = $description; $this->slug = $slug; }
/** * @keyname -> getKeyname() -> keyname * @title -> getTitle() -> title * @description -> getDescription() -> description * @defaultRoles -> getDefaultRoles() -> roles ** @type -> iRESTful\Authenticated\Domain\Entities\Roles\Role */ public function __construct(Uuid $uuid, \DateTime $createdOn, $keyname, $title, $description, array $defaultRoles = null) { if (empty($defaultRoles)) { $defaultRoles = null; } if (!is_string($keyname) || empty($keyname)) { throw new EntityException('The keyname (' . $keyname . ') must be a non-empty string.'); } if (!is_string($title) || empty($title)) { throw new EntityException('The title (' . $title . ') must be a non-empty string.'); } if (!is_string($description)) { throw new EntityException('The description (' . $description . ') must be a string.'); } $matches = []; preg_match_all('/[a-z\\_]+/s', $keyname, $matches); if (!isset($matches[0][0]) || $matches[0][0] != $keyname) { throw new EntityException('The keyname (' . $keyname . ') must only contain lowercase letter and underscores.'); } if (!empty($defaultRoles) && !$this->contains($defaultRoles, 'iRESTful\\Authenticated\\Domain\\Entities\\Roles\\Role')) { throw new EntityException('The defaultRoles array must only contain Role objects. At least one of its instances is not a Role object.'); } parent::__construct($uuid, $createdOn); $this->keyname = $keyname; $this->title = $title; $this->description = $description; $this->defaultRoles = $defaultRoles; }
/** * @title -> getTitle() -> title * @someDescription -> getSomeDescription() -> some_description * @longPropertyNameWithSomeStringInIt -> getLongPropertyNameWithSomeStringInIt() -> long_property_name_with_some_string_in_it * @subEntity -> getSubEntity() -> sub_entity * @bigProperty -> getBigProperty() -> big_property */ public function __construct(Uuid $uuid, \DateTime $createdOn, $title, $someDescription, $longPropertyNameWithSomeStringInIt, SimpleEntityInterface $subEntity, BigProperty $bigProperty) { parent::__construct($uuid, $createdOn); $this->title = $title; $this->someDescription = $someDescription; $this->longPropertyNameWithSomeStringInIt = $longPropertyNameWithSomeStringInIt; $this->subEntity = $subEntity; $this->bigProperty = $bigProperty; }
/** * @name -> getName() -> name * @notes -> getNotes() -> notes * @user -> getUser() -> user */ public function __construct(Uuid $uuid, \DateTime $createdOn, User $user, Name $name, $notes) { if (!is_string($notes)) { throw new EntityException('The notes (' . $notes . ') must be a string.'); } parent::__construct($uuid, $createdOn); $this->name = $name; $this->notes = $notes; $this->user = $user; }
/** * @name -> getName() -> name * @credentials -> getCredentials()->getToken() -> credentials ** iRESTful\Authenticated\Domain\Credentials\CredentialsAdapter::fromTokenToCredentials * @roles -> getRoles() -> roles ** @type -> iRESTful\Authenticated\Domain\Entities\Roles\Role */ public function __construct(Uuid $uuid, \DateTime $createdOn, $name, Credentials $credentials, array $roles = null) { if (empty($roles)) { $roles = null; } if (!is_string($name) || empty($name)) { throw new EntityException('The name (' . $name . ') must be a non-empty string.'); } if (!empty($roles) && !$this->contains($roles, 'iRESTful\\Authenticated\\Domain\\Entities\\Roles\\Role')) { throw new EntityException('The roles array must only contain Role objects. At least one of its instances is not a Role object.'); } parent::__construct($uuid, $createdOn); $this->name = $name; $this->credentials = $credentials; $this->roles = $roles; }
/** * @title -> getTitle() -> title * @canRead -> canRead() -> can_read * @canWrite -> canWrite() -> can_write * @canDelete -> canDelete() -> can_delete * @description -> getDescription() -> description */ public function __construct(Uuid $uuid, \DateTime $createdOn, $title, $canRead, $canWrite, $canDelete, $description = null) { if (empty($description)) { $description = null; } $canRead = (bool) $canRead; $canWrite = (bool) $canWrite; $canDelete = (bool) $canDelete; if (!is_string($title) || empty($title)) { throw new EntityException('The title (' . $title . ') must be a non-empty string.'); } if (!is_null($description) && (!is_string($description) || empty($description))) { throw new EntityException('The description (' . $description . ') must be a non-empty string if not empty.'); } parent::__construct($uuid, $createdOn); $this->title = $title; $this->canRead = $canRead; $this->canWrite = $canWrite; $this->canDelete = $canDelete; $this->description = $description; }
/** * @title -> getTitle() -> title * @description -> getDescription() -> description * @permissions -> getPermissions() -> permissions ** @type -> iRESTful\Authenticated\Domain\Entities\Roles\Permissions\Permission */ public function __construct(Uuid $uuid, \DateTime $createdOn, $title, $description = null, array $permissions = null) { if (empty($description)) { $description = null; } if (empty($permissions)) { $permissions = null; } if (!is_string($title) || empty($title)) { throw new EntityException('The title (' . $title . ') must be a non-empty string.'); } if (!is_null($description) && (!is_string($description) || empty($description))) { throw new EntityException('The description (' . $description . ') must be a non-empty string if not empty.'); } if (!empty($permissions) && !$this->contains($permissions, 'iRESTful\\Authenticated\\Domain\\Entities\\Roles\\Permissions\\Permission')) { throw new EntityException('The permissions array must only contain Permission objects. At least one of its instances is not a Permission object.'); } parent::__construct($uuid, $createdOn); $this->title = $title; $this->description = $description; $this->permissions = $permissions; }
/** * @name -> getName() -> name * @userIsMandatory -> userIsMandatory() -> user_is_mandatory * @permissions -> getPermissions() -> permissions ** @type -> iRESTful\Authenticated\Domain\Entities\Roles\Permissions\Permission, */ public function __construct(Uuid $uuid, \DateTime $createdOn, $name, $userIsMandatory, array $permissions = null) { $userIsMandatory = (bool) $userIsMandatory; if (empty($permissions)) { $permissions = null; } if (!is_string($name) || empty($name)) { throw new EntityException('The name (' . $name . ') must be a non-empty string.'); } $matches = array(); preg_match_all('/([a-z\\_]+)/s', $name, $matches); if (!isset($matches[1][0]) || empty($matches[1][0])) { throw new EntityException('The name (' . $name . ') can only contain lower case letters and underscores.'); } if (!empty($permissions) && !$this->contains($permissions, 'iRESTful\\Authenticated\\Domain\\Entities\\Roles\\Permissions\\Permission')) { throw new EntityException('The permissions array must only contain Permission objects. At least one of its instances is not a Permission object.'); } parent::__construct($uuid, $createdOn); $this->name = $name; $this->userIsMandatory = $userIsMandatory; $this->permissions = $permissions; }
/** * @container -> getContainer() -> container_reference * @user -> getUserOwner() -> owner_user * @software -> getSoftwareOwner() -> owner_software * @permissions -> getPermissions() -> permissions ** @type -> iRESTful\Authenticated\Domain\Entities\Roles\Permissions\Permission * @users -> getUsers() -> users ** @type -> iRESTful\Authenticated\Domain\Entities\Users\User * @userIsMandatory -> userIsMandatory() -> user_is_mandatory */ public function __construct(Uuid $uuid, \DateTime $createdOn, Container $container, Software $software, $userIsMandatory, User $user = null, array $permissions = null, array $users = null) { if (empty($permissions)) { $permissions = null; } if (empty($users)) { $users = null; } $userIsMandatory = (bool) $userIsMandatory; if (!empty($permissions) && !$this->contains($permissions, 'iRESTful\\Authenticated\\Domain\\Entities\\Roles\\Permissions\\Permission')) { throw new EntityException('The permissions array must only contain Permission objects. At least one of its instances is not a Permission object.'); } if (!empty($users) && !$this->contains($users, 'iRESTful\\Authenticated\\Domain\\Entities\\Users\\User')) { throw new EntityException('The users array must only contain User objects. At least one of its instances is not a User object.'); } parent::__construct($uuid, $createdOn); $this->container = $container; $this->user = $user; $this->software = $software; $this->permissions = $permissions; $this->users = $users; $this->userIsMandatory = $userIsMandatory; }