Completed
Push — fix/nosara ( 09438e...93ba64 )
by
unknown
11:29
created

Jetpack_Sitemap_Buffer_Master   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
dl 0
loc 22
rs 10
c 0
b 0
f 0
wmc 3
lcom 1
cbo 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A get_root_element() 0 19 2
1
<?php
2
/**
3
 * Sitemaps (per the protocol) are essentially lists of XML fragments;
4
 * lists which are subject to size constraints. The Jetpack_Sitemap_Buffer_Master
5
 * extends the Jetpack_Sitemap_Buffer class to represent the master sitemap
6
 * buffer.
7
 *
8
 * @since 5.3.0
9
 * @package Jetpack
10
 */
11
12
/**
13
 * A buffer for constructing master sitemap xml files for users without libxml support.
14
 *
15
 * @since 5.3.0
16
 */
17
class Jetpack_Sitemap_Buffer_Master extends Jetpack_Sitemap_Buffer_Fallback {
18
19
	protected function get_root_element() {
20
21
		if ( ! isset( $this->root ) ) {
22
23
			$sitemap_index_xsl_url = $this->finder->construct_sitemap_url( 'sitemap-index.xsl' );
24
			$jetpack_version = JETPACK__VERSION;
25
26
			$this->root = array(
0 ignored issues
show
Documentation Bug introduced by
It seems like array("<!-- generator='j...EOL, '</sitemapindex>') of type array<integer,string,{"0":"string","1":"string"}> is incompatible with the declared type object<DOMElement> of property $root.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
27
				"<!-- generator='jetpack-{$jetpack_version}' -->" . PHP_EOL
28
				. "<?xml-stylesheet type='text/xsl' href='{$sitemap_index_xsl_url}'?>" . PHP_EOL
29
				. "<sitemapindex xmlns='http://www.sitemaps.org/schemas/sitemap/0.9'>" . PHP_EOL,
30
				'</sitemapindex>'
31
			);
32
33
			$this->byte_capacity -= strlen( join( '', $this->root ) );
34
		}
35
36
		return $this->root;
37
	}
38
}
39