fix some inspections related to crafting recipes

This commit is contained in:
Dylan K. Taylor
2017-07-13 13:59:45 +01:00
parent 7f99d9019a
commit b9355387da
4 changed files with 57 additions and 21 deletions

View File

@ -31,6 +31,7 @@ class ShapelessRecipe implements Recipe{
/** @var Item */
private $output;
/** @var UUID|null */
private $id = null;
/** @var Item[] */
@ -40,10 +41,16 @@ class ShapelessRecipe implements Recipe{
$this->output = clone $result;
}
/**
* @return UUID|null
*/
public function getId(){
return $this->id;
}
/**
* @param UUID $id
*/
public function setId(UUID $id){
if($this->id !== null){
throw new \InvalidStateException("Id is already set");
@ -52,14 +59,14 @@ class ShapelessRecipe implements Recipe{
$this->id = $id;
}
public function getResult(){
public function getResult() : Item{
return clone $this->output;
}
/**
* @param Item $item
*
* @returns ShapelessRecipe
* @return ShapelessRecipe
*
* @throws \InvalidArgumentException
*/
@ -101,7 +108,7 @@ class ShapelessRecipe implements Recipe{
/**
* @return Item[]
*/
public function getIngredientList(){
public function getIngredientList() : array{
$ingredients = [];
foreach($this->ingredients as $ingredient){
$ingredients[] = clone $ingredient;
@ -113,7 +120,7 @@ class ShapelessRecipe implements Recipe{
/**
* @return int
*/
public function getIngredientCount(){
public function getIngredientCount() : int{
$count = 0;
foreach($this->ingredients as $ingredient){
$count += $ingredient->getCount();