Completed
Push — master ( 4783ce...1821eb )
by Dennis
03:38
created

SimpleXmlRandomItemAccessBench   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 1
dl 0
loc 25
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A benchRandomItemAccess() 0 6 1
1
<?php
2
3
/**
4
 * (c) Dennis Meckel
5
 *
6
 * For the full copyright and license information,
7
 * please view the LICENSE file that was distributed with this source code.
8
 */
9
10
namespace Rayne\wz2008\Graph\Benchmark\Graph;
11
12
use Rayne\wz2008\Graph\Benchmark\RandomItemAccessCase;
13
use Rayne\wz2008\Graph\Factory\WzClassificationFactory;
14
use SimpleXMLElement;
15
16
class SimpleXmlRandomItemAccessBench extends RandomItemAccessCase
17
{
18
    /**
19
     * @var SimpleXMLElement
20
     */
21
    public $xml;
22
23
    /**
24
     *
25
     */
26
    public function __construct()
27
    {
28
        $this->xml = simplexml_load_file($this->getAssetFile(WzClassificationFactory::SUPPLIED_CLASSIFICATION_FILE));
29
    }
30
31
    /**
32
     * @inheritdoc
33
     */
34
    public function benchRandomItemAccess($params)
35
    {
36
        $child = $this->xml->xpath('//Item[@id="' . $params['id'] . '"][1]')[0];
37
38
        $this->assertSame($params['id'], (string) $child['id']);
39
    }
40
}
41