PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / 28.3
Yoast SEO – Advanced SEO with real-time guidance and built-in AI v28.3
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 19.1 All 128 releases
wordpress-seo / admin / class-collector.php

class-collector.php in Yoast SEO – Advanced SEO with real-time guidance and built-in AI 28.3, at admin/class-collector.php

55 lines 1005 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * WPSEO plugin file.
4 *
5 * @package WPSEO\Admin
6 */
7
8 /**
9 * Collects the data from the added collection objects.
10 */
11 class WPSEO_Collector {
12
13 /**
14 * Holds the collections.
15 *
16 * @var WPSEO_Collection[]
17 */
18 protected $collections = [];
19
20 /**
21 * Adds a collection object to the collections.
22 *
23 * @param WPSEO_Collection $collection The collection object to add.
24 *
25 * @return void
26 */
27 public function add_collection( WPSEO_Collection $collection ) {
28 $this->collections[] = $collection;
29 }
30
31 /**
32 * Collects the data from the collection objects.
33 *
34 * @return array The collected data.
35 */
36 public function collect() {
37 $data = [];
38
39 foreach ( $this->collections as $collection ) {
40 $data = array_merge( $data, $collection->get() );
41 }
42
43 return $data;
44 }
45
46 /**
47 * Returns the collected data as a JSON encoded string.
48 *
49 * @return string|false The encode string.
50 */
51 public function get_as_json() {
52 return WPSEO_Utils::format_json_encode( $this->collect() );
53 }
54 }
55