The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119.
- 3.1. Metadata
<?php | |
$projectRepository = new ProjectRepository; | |
$project = $projectRepository->save($project); |
<?php | |
$project = new Project('project'); | |
$project->getTaskCollection()->add('a'); | |
$project->getTaskCollection()->add('b'); | |
$project->getTaskCollection()->add('c'); | |
foreach ($project->getTaskCollection() as $task) { | |
echo $task->getName(); |
<?php | |
class ProjectMysqlRepository implements ProjectRepository | |
{ | |
/** | |
* @param Project $project | |
* | |
* @return Project | |
*/ | |
public function save(Project $project) |
<?php | |
class DbTask extends Task | |
{ | |
/** | |
* @param int $id | |
* @param string $name | |
*/ | |
public function __construct($id, $name) | |
{ |
<?php | |
class DbProject extends Project | |
{ | |
/** | |
* @param int $id | |
* @param string $name | |
* @param Task[] $tasks | |
*/ | |
public function __construct($id, $name, $tasks) |
<?php | |
final class TaskCollection implements IteratorAggregate | |
{ | |
/** @var Task[] */ | |
private $tasks; | |
/** | |
* @param Task[] $tasks | |
*/ |
<?php | |
class Task | |
{ | |
/** @var null|int */ | |
protected $id; | |
/** @var string */ | |
protected $name; | |
<?php | |
class Project | |
{ | |
/** @var null|int */ | |
protected $id; | |
/** @var string */ | |
protected $name; | |
# business logic file | |
module DataStructure | |
class Array | |
def initialize(array) | |
@array = array | |
end | |
def flatten | |
_flatten @array | |
end |