Completed
Push — master ( fc4353...2e8e64 )
by Haralan
01:19
created

Page::__construct()   A

Complexity

Conditions 3
Paths 4

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 3.3332

Importance

Changes 0
Metric Value
dl 0
loc 9
ccs 4
cts 6
cp 0.6667
rs 9.6666
c 0
b 0
f 0
cc 3
eloc 4
nc 4
nop 2
crap 3.3332
1
<?php
2
3
namespace Openbuildings\Spiderling;
4
5
/**
6
 * Page - represents HTML Page
7
 *
8
 * @package    Openbuildings\Spiderling
9
 * @author     Ivan Kerin
10
 * @copyright  (c) 2013 OpenBuildings Ltd.
11
 * @license    http://spdx.org/licenses/BSD-3-Clause
12
 */
13
class Page extends Node {
14
15 1
	function __construct(Driver $driver = NULL, $extension = NULL)
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
16
	{
17 1
		$this->_driver = $driver ?: new Driver_Simple;
18
19
		if ($extension)
20 1
		{
21
			$this->_extension = $extension;
22
		}
23 1
	}
24
25
	/**
26
	 * Initiate a visit with the currently selected driver
27
	 * @param  string $uri
28
	 * @param  array  $query
29
	 * @return $this
30
	 */
31
	public function visit($uri, array $query = array())
32
	{
33
		$this->driver()->visit($uri, $query);
34
35
		return $this;
36
	}
37
38
	/**
39
	 * Return the content of the last request from the currently selected driver
40
	 * @return string
41
	 */
42
	public function content()
43
	{
44
		return $this->driver()->content();
45
	}
46
47
	/**
48
	 * Return the current browser url without the domain
49
	 * @return string
50
	 */
51
	public function current_path()
52
	{
53
		return $this->driver()->current_path();
54
	}
55
56
	/**
57
	 * Return the current url
58
	 * @return string
59
	 */
60
	public function current_url()
61
	{
62
		return $this->driver()->current_url();
63
	}
64
}
65