Driver_SimpleXML   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 1
lcom 1
cbo 3
dl 0
loc 19
ccs 0
cts 7
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A initialize() 0 7 1
1
<?php
2
3
namespace Openbuildings\Spiderling;
4
5
use Openbuildings\EnvironmentBackup\Environment;
6
use Openbuildings\EnvironmentBackup\Environment_Group_Globals;
7
use Openbuildings\EnvironmentBackup\Environment_Group_Server;
8
use Openbuildings\EnvironmentBackup\Environment_Group_Static;
9
10
/**
11
 * Use Curl to load urls.
12
 * In memory.
13
 * No Javascript
14
 *
15
 * @package    Openbuildings\Spiderling
16
 * @author     Ivan Kerin
17
 * @copyright  (c) 2013 OpenBuildings Ltd.
18
 * @license    http://spdx.org/licenses/BSD-3-Clause
19
 */
20
class Driver_SimpleXML extends Driver_Simple {
21
22
	/**
23
	 * The name of the driver
24
	 * @var string
25
	 */
26
	public $name = 'simpleXML';
27
28
	/**
29
	 * Initialze the dom, xpath and forms objects, based on the content string
30
	 */
31
	public function initialize()
32
	{
33
		@ $this->_dom->loadXML($this->content());
0 ignored issues
show
Security Best Practice introduced by
It seems like you do not handle an error condition here. This can introduce security issues, and is generally not recommended.

If you suppress an error, we recommend checking for the error condition explicitly:

// For example instead of
@mkdir($dir);

// Better use
if (@mkdir($dir) === false) {
    throw new \RuntimeException('The directory '.$dir.' could not be created.');
}
Loading history...
34
		$this->_dom->encoding = 'utf-8';
35
		$this->_xpath = new Driver_Simple_Xpath($this->_dom);
0 ignored issues
show
Documentation Bug introduced by
It seems like new \Openbuildings\Spide...mple_Xpath($this->_dom) of type object<Openbuildings\Spi...ng\Driver_Simple_Xpath> is incompatible with the declared type object<Openbuildings\Spiderling\DOMXpath> of property $_xpath.

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...
36
		$this->_forms = new Driver_Simple_Forms($this->_xpath);
37
	}
38
}
39