PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / 28.2
Yoast SEO – Advanced SEO with real-time guidance and built-in AI v28.2
28.5 28.4 28.3 28.2 28.1 28.0 27.9 27.8 27.7 27.6 27.5 trunk 18.0 18.1 18.2 18.3 18.4 18.4.1 18.5 18.5.1 18.6 18.7 18.8 18.9 19.0 All 129 releases
wordpress-seo / src / introductions / domain / introductions-bucket.php

introductions-bucket.php in Yoast SEO – Advanced SEO with real-time guidance and built-in AI 28.2, at src/introductions/domain/introductions-bucket.php

50 lines 864 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Yoast\WP\SEO\Introductions\Domain;
4
5 /**
6 * A collection domain object.
7 */
8 class Introductions_Bucket {
9
10 /**
11 * Holds the introductions.
12 *
13 * @var Introduction_Item[]
14 */
15 private $introductions;
16
17 /**
18 * The constructor.
19 */
20 public function __construct() {
21 $this->introductions = [];
22 }
23
24 /**
25 * Adds an introduction to this bucket.
26 *
27 * @param Introduction_Item $introduction The introduction.
28 *
29 * @return void
30 */
31 public function add_introduction( Introduction_Item $introduction ) {
32 $this->introductions[] = $introduction;
33 }
34
35 /**
36 * Returns the array representation of the introductions.
37 *
38 * @return array
39 */
40 public function to_array() {
41 // No sorting here because that is done in JS.
42 return \array_map(
43 static function ( $item ) {
44 return $item->to_array();
45 },
46 $this->introductions,
47 );
48 }
49 }
50