ElementObjectGetter   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
createElement() 0 1 ?
A getElementObject() 0 4 1
1
<?php
2
3
namespace Magefix\Plugin;
4
5
use Behat\Mink\Element\NodeElement;
6
7
/**
8
 * Class ElementObjectGetter
9
 *
10
 * Provide functionality to create an Element object without throwing an
11
 * Exception when xpath cannot be found and need the instance of the element.
12
 *
13
 * Allows for dynamic xpath selectors in Element instances.
14
 *
15
 * @package Magefix\Plugin
16
 * @author  Carlo Tasca <[email protected]>
17
 */
18
trait ElementObjectGetter
19
{
20
    /**
21
     * @param $name
22
     * @return mixed
23
     */
24
    public abstract function createElement($name);
25
26
    /**
27
     * @param string $name
28
     *
29
     * @return NodeElement
30
     */
31
    public function getElementObject($name)
32
    {
33
        return $this->createElement($name);
34
    }
35
}
36