Crawler::__construct()   A
last analyzed

Complexity

Conditions 4
Paths 4

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 4

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 4
eloc 3
c 1
b 0
f 0
nc 4
nop 3
dl 0
loc 7
ccs 4
cts 4
cp 1
crap 4
rs 10
1
<?php
2
3
namespace Pilipinews\Common;
4
5
use Symfony\Component\DomCrawler\Crawler as DomCrawler;
6
7
/**
8
 * Crawler
9
 *
10
 * @package Pilipinews
11
 * @author  Rougin Gutib <[email protected]>
12
 */
13
class Crawler extends DomCrawler
14
{
15
    /**
16
     * Initializes the crawler instance.
17
     *
18
     * @param mixed  $node
19
     * @param string $uri
20
     * @param string $href
21
     */
22 12
    public function __construct($node = null, $uri = null, $href = null)
23
    {
24 12
        $html = $node !== null && is_string($node);
25
26 12
        parent::__construct($html ? null : $node, $uri, $href);
27
28 12
        $html && $this->addHtmlContent((string) $node);
29 12
    }
30
}
31