| 1 |
<?php |
| 2 |
// phpcs:disable Yoast.NamingConventions.NamespaceName.TooLong -- Needed in the folder structure. |
| 3 |
namespace Yoast\WP\SEO\Schema_Aggregator\Domain; |
| 4 |
|
| 5 |
/** |
| 6 |
* Class to contain a collection of Indexable_Count objects. |
| 7 |
*/ |
| 8 |
class Indexable_Count_Collection { |
| 9 |
|
| 10 |
/** |
| 11 |
* The array of Indexable_Count objects. |
| 12 |
* |
| 13 |
* @var array<int, Indexable_Count> |
| 14 |
*/ |
| 15 |
private array $indexable_counts; |
| 16 |
|
| 17 |
/** |
| 18 |
* Constructor. |
| 19 |
*/ |
| 20 |
public function __construct() { |
| 21 |
$this->indexable_counts = []; |
| 22 |
} |
| 23 |
|
| 24 |
/** |
| 25 |
* Adds an Indexable_Count object to the collection. |
| 26 |
* |
| 27 |
* @param Indexable_Count $indexable_count The Indexable_Count object to add. |
| 28 |
* @return void |
| 29 |
*/ |
| 30 |
public function add_indexable_count( Indexable_Count $indexable_count ): void { |
| 31 |
$this->indexable_counts[] = $indexable_count; |
| 32 |
} |
| 33 |
|
| 34 |
/** |
| 35 |
* Gets all indexable counts. |
| 36 |
* |
| 37 |
* @return array<int, Indexable_Count> The array of Indexable_Count objects. |
| 38 |
*/ |
| 39 |
public function get_indexable_counts(): array { |
| 40 |
return $this->indexable_counts; |
| 41 |
} |
| 42 |
} |
| 43 |
|