StorePage   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
open() 0 1 ?
A openStorePage() 0 5 1
A setPageObjectPath() 0 6 3
1
<?php
2
namespace Magefix\Plugin;
3
4
/**
5
 * Class StorePage
6
 * @package Magefix\Plugin
7
 * @author  Carlo Tasca <[email protected]>
8
 */
9
trait StorePage
10
{
11
    /**
12
     * @param array $urlParameters
13
     * @return mixed
14
     */
15
    public abstract function open(array $urlParameters = array());
16
17
    /**
18
     * @param string $toBeReplaced
19
     * @param string $replace
20
     * @param array $urlParameters
21
     */
22
    public function openStorePage($toBeReplaced = '', $replace = '', array $urlParameters = [])
23
    {
24
        $this->setPageObjectPath($toBeReplaced, $replace);
25
        $this->open($urlParameters);
26
    }
27
28
    /**
29
     * @param string $toBeReplaced
30
     * @param string $replace
31
     */
32
    public function setPageObjectPath($toBeReplaced, $replace)
33
    {
34
        if (!empty($toBeReplaced) && !empty($replace)) {
35
            $this->path = str_replace($toBeReplaced, $replace, $this->path);
36
        }
37
    }
38
}
39