| 1 |
<?php |
| 2 |
|
| 3 |
namespace Yoast\WP\SEO\Analytics\Domain; |
| 4 |
|
| 5 |
/** |
| 6 |
* A collection domain object. |
| 7 |
*/ |
| 8 |
class Missing_Indexable_Bucket { |
| 9 |
|
| 10 |
/** |
| 11 |
* All the missing indexable count objects. |
| 12 |
* |
| 13 |
* @var array<Missing_Indexable_Count> |
| 14 |
*/ |
| 15 |
private $missing_indexable_counts; |
| 16 |
|
| 17 |
/** |
| 18 |
* The constructor. |
| 19 |
*/ |
| 20 |
public function __construct() { |
| 21 |
$this->missing_indexable_counts = []; |
| 22 |
} |
| 23 |
|
| 24 |
/** |
| 25 |
* Adds a missing indexable count object to this bucket. |
| 26 |
* |
| 27 |
* @param Missing_Indexable_Count $missing_indexable_count The missing indexable count object. |
| 28 |
* |
| 29 |
* @return void |
| 30 |
*/ |
| 31 |
public function add_missing_indexable_count( Missing_Indexable_Count $missing_indexable_count ): void { |
| 32 |
$this->missing_indexable_counts[] = $missing_indexable_count; |
| 33 |
} |
| 34 |
|
| 35 |
/** |
| 36 |
* Returns the array representation of all indexable counts. |
| 37 |
* |
| 38 |
* @return array |
| 39 |
*/ |
| 40 |
public function to_array() { |
| 41 |
return \array_map( |
| 42 |
static function ( $item ) { |
| 43 |
return $item->to_array(); |
| 44 |
}, |
| 45 |
$this->missing_indexable_counts, |
| 46 |
); |
| 47 |
} |
| 48 |
} |
| 49 |
|