110 lines
1.8 KiB
PHP
110 lines
1.8 KiB
PHP
<?php
|
|
|
|
namespace NoccyLabs\Juicer\Recipe;
|
|
|
|
use NoccyLabs\Juicer\Ingredient\IngredientInterface;
|
|
|
|
class Recipe implements RecipeInterface
|
|
{
|
|
/** @var string */
|
|
protected $name;
|
|
|
|
/** @var string */
|
|
protected $author;
|
|
|
|
/** @var string[] */
|
|
protected $tags = [];
|
|
|
|
/** @var array */
|
|
protected $extra = [];
|
|
|
|
/** @var string */
|
|
protected $description;
|
|
|
|
/** @var IngredientInterface[] */
|
|
protected $ingredients = [];
|
|
|
|
public function setRecipeName(?string $name)
|
|
{
|
|
$this->name = $name;
|
|
}
|
|
|
|
public function setRecipeAuthor(?string $author)
|
|
{
|
|
$this->author = $author;
|
|
}
|
|
|
|
public function setTags(array $tags)
|
|
{
|
|
$this->tags = $tags;
|
|
}
|
|
|
|
public function addTag(string $tag)
|
|
{
|
|
$this->tags[] = $tag;
|
|
}
|
|
|
|
public function setDescription(?string $description)
|
|
{
|
|
$this->description = $description;
|
|
}
|
|
|
|
public function addIngredient(IngredientInterface $ingredient)
|
|
{
|
|
$this->ingredients[] = $ingredient;
|
|
}
|
|
|
|
public function setExtra(array $extra)
|
|
{
|
|
$this->extra = $extra;
|
|
}
|
|
|
|
/**
|
|
* {@inheritDoc}
|
|
*/
|
|
public function getRecipeName(): ?string
|
|
{
|
|
return $this->name;
|
|
}
|
|
|
|
/**
|
|
* {@inheritDoc}
|
|
*/
|
|
public function getRecipeAuthor(): ?string
|
|
{
|
|
return $this->author;
|
|
}
|
|
|
|
/**
|
|
* {@inheritDoc}
|
|
*/
|
|
public function getTags(): array
|
|
{
|
|
return $this->tags;
|
|
}
|
|
|
|
/**
|
|
* {@inheritDoc}
|
|
*/
|
|
public function getExtra(): array
|
|
{
|
|
return $this->extra;
|
|
}
|
|
|
|
/**
|
|
* {@inheritDoc}
|
|
*/
|
|
public function getDescription(): ?string
|
|
{
|
|
return $this->description;
|
|
}
|
|
|
|
/**
|
|
* {@inheritDoc}
|
|
*/
|
|
public function getIngredients(): array
|
|
{
|
|
return $this->ingredients;
|
|
}
|
|
|
|
} |