Initial checkin
This commit is contained in:
70
src/Recipe/Mixer/MeasuredIngredient.php
Normal file
70
src/Recipe/Mixer/MeasuredIngredient.php
Normal file
@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
namespace NoccyLabs\Juicer\Recipe\Mixer;
|
||||
|
||||
use NoccyLabs\Juicer\Ingredient\IngredientInterface;
|
||||
use NoccyLabs\Juicer\Ingredient\Base;
|
||||
|
||||
class MeasuredIngredient implements IngredientInterface
|
||||
{
|
||||
/** @var string */
|
||||
protected $name;
|
||||
/** @var string|null */
|
||||
protected $brand;
|
||||
/** @var string */
|
||||
protected $base;
|
||||
/** @var float The apparent specific gravity (ASG) of this ingredient in g/mL */
|
||||
protected $asg;
|
||||
/** @var float The percent of this ingredient in the final mix */
|
||||
protected $pecent;
|
||||
/** @var float Volume in milliliters (mL) */
|
||||
protected $volume;
|
||||
/** @var float Weight in grams (g) */
|
||||
protected $weight;
|
||||
|
||||
public function __construct(string $name, ?string $brand, string $base, float $asg, float $percent, float $volume)
|
||||
{
|
||||
$this->name = $name;
|
||||
$this->brand = $brand;
|
||||
$this->base = $base;
|
||||
$this->asg = $asg;
|
||||
$this->percent = $percent;
|
||||
$this->volume = $volume;
|
||||
$this->weight = $volume * $asg;
|
||||
}
|
||||
|
||||
public function getFlavorName(): string
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
public function getFlavorBrand(): ?string
|
||||
{
|
||||
return $this->brand;
|
||||
}
|
||||
|
||||
public function getBase(): ?string
|
||||
{
|
||||
return $this->base;
|
||||
}
|
||||
|
||||
public function getPercent(): float
|
||||
{
|
||||
return $this->percent;
|
||||
}
|
||||
|
||||
public function getSpecificGravity(): float
|
||||
{
|
||||
return $this->asg;
|
||||
}
|
||||
|
||||
public function getVolume(): float
|
||||
{
|
||||
return $this->volume;
|
||||
}
|
||||
|
||||
public function getWeight(): float
|
||||
{
|
||||
return $this->weight;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user