Component   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 6
c 1
b 0
f 1
dl 0
loc 31
rs 10
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A preAssertions() 0 2 1
A __construct() 0 6 1
A preActions() 0 2 1
A browser() 0 3 1
1
<?php
2
3
namespace Zenstruck\Browser;
4
5
use Zenstruck\Browser;
6
7
/**
8
 * @author Kevin Bond <[email protected]>
9
 */
10
abstract class Component
11
{
12
    private Browser $browser;
13
14
    final public function __construct(Browser $browser)
15
    {
16
        $this->browser = $browser;
17
18
        $this->preActions();
19
        $this->preAssertions();
20
    }
21
22
    final public function browser(): Browser
23
    {
24
        return $this->browser;
25
    }
26
27
    /**
28
     * Runs when component is created. Override to add your own
29
     * component pre-actions (ie navigate to page).
30
     */
31
    protected function preActions(): void
32
    {
33
    }
34
35
    /**
36
     * Runs when component is created. Override to add your own
37
     * component pre-assertions (runs after preActions()).
38
     */
39
    protected function preAssertions(): void
40
    {
41
    }
42
}
43