introduced sub-namespace Domain

This commit is contained in:
Dominik Liebler
2018-06-14 17:19:47 +02:00
parent 477a6d623a
commit 4cb353fe3e
3 changed files with 4 additions and 2 deletions

View File

@@ -0,0 +1,62 @@
<?php
namespace DesignPatterns\More\Repository\Domain;
class Post
{
/**
* @var int|null
*/
private $id;
/**
* @var string
*/
private $title;
/**
* @var string
*/
private $text;
public static function fromState(array $state): Post
{
return new self(
$state['id'],
$state['title'],
$state['text']
);
}
/**
* @param int|null $id
* @param string $text
* @param string $title
*/
public function __construct($id, string $title, string $text)
{
$this->id = $id;
$this->text = $text;
$this->title = $title;
}
public function setId(int $id)
{
$this->id = $id;
}
public function getId(): int
{
return $this->id;
}
public function getText(): string
{
return $this->text;
}
public function getTitle(): string
{
return $this->title;
}
}