/var/www/hkosl.com/aga/wp-content/plugins/wordpress-seo/admin/class-collector.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
/**
 * WPSEO plugin file.
 *
 * @package WPSEO\Admin
 */

/**
 * Collects the data from the added collection objects.
 */
class WPSEO_Collector {

    
/**
     * @var WPSEO_Collection[]
     */
    
protected $collections = array();

    
/**
     * Adds a collection object to the collections.
     *
     * @param WPSEO_Collection $collection The collection object to add.
     */
    
public function add_collectionWPSEO_Collection $collection ) {
        
$this->collections[] = $collection;
    }

    
/**
     * Collects the data from the collection objects.
     *
     * @return array The collected data.
     */
    
public function collect() {
        
$data = array();

        foreach ( 
$this->collections as $collection ) {
            
$data array_merge$data$collection->get() );
        }

        return 
$data;
    }

    
/**
     * Returns the collected data as a JSON encoded string.
     *
     * @return false|string The encode string.
     */
    
public function get_as_json() {
        return 
WPSEO_Utils::format_json_encode$this->collect() );
    }
}