php-juicer/src/Recipe/Mixer/MeasuredIngredient.php

70 lines
1.6 KiB
PHP

<?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;
}
}