Completed
Push — master ( 782892...5bf53f )
by Juan Francisco
03:56
created

NavigationTrait   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 5
c 2
b 0
f 0
lcom 1
cbo 0
dl 0
loc 41
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A visit() 0 3 1
A getCurrentUrl() 0 3 1
A reload() 0 3 1
A forward() 0 3 1
A back() 0 3 1
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