ElementObjectGetter::createElement()
last analyzed

Size

Total Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 1
nc 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