NavigationTrait::getCurrentUrl()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Zumba\Mink\Driver;
4
5
/**
6
 * Trait NavigationTrait
7
 * @package Zumba\Mink\Driver
8
 */
9
trait NavigationTrait {
10
  /**
11
   * Visits a given url
12
   * @param string $url
13
   */
14
  public function visit($url) {
15
    $this->browser->visit($url);
0 ignored issues
show
Bug introduced by
The property browser does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
16
  }
17
18
  /**
19
   * Gets the current url if any
20
   * @return string
21
   */
22
  public function getCurrentUrl() {
23
    return $this->browser->currentUrl();
24
  }
25
26
27
  /**
28
   * Reloads the page if possible
29
   */
30
  public function reload() {
31
    $this->browser->reload();
32
  }
33
34
  /**
35
   * Goes forward if possible
36
   */
37
  public function forward() {
38
    $this->browser->goForward();
39
  }
40
41
  /**
42
   * Goes back if possible
43
   */
44
  public function back() {
45
    $this->browser->goBack();
46
  }
47
48
49
}
50