Automattic /
jetpack
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 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.1.0 |
||
| 9 | * @package Jetpack |
||
| 10 | */ |
||
| 11 | |||
| 12 | /** |
||
| 13 | * A buffer for constructing master sitemap xml files. |
||
| 14 | * |
||
| 15 | * @since 5.1.0 |
||
| 16 | */ |
||
| 17 | class Jetpack_Sitemap_Buffer_Master extends Jetpack_Sitemap_Buffer { |
||
|
0 ignored issues
–
show
|
|||
| 18 | |||
| 19 | public function __construct( $item_limit, $byte_limit, $time = '1970-01-01 00:00:00' ) { |
||
| 20 | parent::__construct( $item_limit, $byte_limit, $time ); |
||
| 21 | |||
| 22 | $this->doc->appendChild( |
||
| 23 | $this->doc->createComment( "generator='jetpack-" . JETPACK__VERSION . "'" ) |
||
| 24 | ); |
||
| 25 | |||
| 26 | $this->doc->appendChild( |
||
| 27 | $this->doc->createProcessingInstruction( |
||
| 28 | 'xml-stylesheet', |
||
| 29 | 'type="text/xsl" href="' . $this->finder->construct_sitemap_url( 'sitemap-index.xsl' ) . '"' |
||
| 30 | ) |
||
| 31 | ); |
||
| 32 | } |
||
| 33 | |||
| 34 | protected function get_root_element() { |
||
| 35 | if ( ! isset( $this->root ) ) { |
||
| 36 | $this->root = $this->doc->createElement( 'sitemapindex' ); |
||
| 37 | $this->root->setAttribute( 'xmlns', 'http://www.sitemaps.org/schemas/sitemap/0.9' ); |
||
| 38 | $this->doc->appendChild( $this->root ); |
||
| 39 | $this->byte_capacity -= strlen( $this->doc->saveXML( $this->root ) ); |
||
| 40 | } |
||
| 41 | |||
| 42 | return $this->root; |
||
| 43 | } |
||
| 44 | } |
||
| 45 |
This check looks for classes that have been defined more than once.
If you can, we would recommend to use standard object-oriented programming techniques. For example, to avoid multiple types, it might make sense to create a common interface, and then multiple, different implementations for that interface.
This also has the side-effect of providing you with better IDE auto-completion, static analysis and also better OPCode caching from PHP.