|
| 1 | +<?php |
| 2 | + |
| 3 | +declare(strict_types=1); |
| 4 | + |
| 5 | +namespace FactorioItemBrowser\Api\Client\Request\Item; |
| 6 | + |
| 7 | +use FactorioItemBrowser\Api\Client\Request\RequestInterface; |
| 8 | + |
| 9 | +/** |
| 10 | + * The request of the item list. |
| 11 | + * |
| 12 | + * @author BluePsyduck <bluepsyduck@gmx.com> |
| 13 | + * @license http://opensource.org/licenses/GPL-3.0 GPL v3 |
| 14 | + */ |
| 15 | +class ItemListRequest implements RequestInterface |
| 16 | +{ |
| 17 | + /** |
| 18 | + * The number of results to return. |
| 19 | + * @var int |
| 20 | + */ |
| 21 | + protected $numberOfResults = 10; |
| 22 | + |
| 23 | + /** |
| 24 | + * The 0-based index of the first result to return. |
| 25 | + * @var int |
| 26 | + */ |
| 27 | + protected $indexOfFirstResult = 0; |
| 28 | + |
| 29 | + /** |
| 30 | + * The number of recipes to return for each result. |
| 31 | + * @var int |
| 32 | + */ |
| 33 | + protected $numberOfRecipesPerResult = 3; |
| 34 | + |
| 35 | + /** |
| 36 | + * Sets the number of results to return. |
| 37 | + * @param int $numberOfResults |
| 38 | + * @return $this |
| 39 | + */ |
| 40 | + public function setNumberOfResults(int $numberOfResults): self |
| 41 | + { |
| 42 | + $this->numberOfResults = $numberOfResults; |
| 43 | + return $this; |
| 44 | + } |
| 45 | + |
| 46 | + /** |
| 47 | + * Returns the number of results to return. |
| 48 | + * @return int |
| 49 | + */ |
| 50 | + public function getNumberOfResults(): int |
| 51 | + { |
| 52 | + return $this->numberOfResults; |
| 53 | + } |
| 54 | + |
| 55 | + /** |
| 56 | + * Sets the 0-based index of the first result to return. |
| 57 | + * @param int $indexOfFirstResult |
| 58 | + * @return $this |
| 59 | + */ |
| 60 | + public function setIndexOfFirstResult(int $indexOfFirstResult): self |
| 61 | + { |
| 62 | + $this->indexOfFirstResult = $indexOfFirstResult; |
| 63 | + return $this; |
| 64 | + } |
| 65 | + |
| 66 | + /** |
| 67 | + * Returns the 0-based index of the first result to return. |
| 68 | + * @return int |
| 69 | + */ |
| 70 | + public function getIndexOfFirstResult(): int |
| 71 | + { |
| 72 | + return $this->indexOfFirstResult; |
| 73 | + } |
| 74 | + |
| 75 | + /** |
| 76 | + * Sets the number of recipes to return for each result. |
| 77 | + * @param int $numberOfRecipesPerResult |
| 78 | + * @return $this |
| 79 | + */ |
| 80 | + public function setNumberOfRecipesPerResult(int $numberOfRecipesPerResult): self |
| 81 | + { |
| 82 | + $this->numberOfRecipesPerResult = $numberOfRecipesPerResult; |
| 83 | + return $this; |
| 84 | + } |
| 85 | + |
| 86 | + /** |
| 87 | + * Returns the the number of recipes to return for each result. |
| 88 | + * @return int |
| 89 | + */ |
| 90 | + public function getNumberOfRecipesPerResult(): int |
| 91 | + { |
| 92 | + return $this->numberOfRecipesPerResult; |
| 93 | + } |
| 94 | +} |
0 commit comments