Code Duplication    Length = 13-13 lines in 2 locations

src/Models/BaseModel.php 1 location

@@ 34-46 (lines=13) @@
31
        $this->properties[$name] = $value;
32
    }
33
34
    public function __call($method, $parameters)
35
    {
36
        if (!method_exists($this, $method)) {
37
            preg_match_all('/((?:^|[A-Z])[a-z]+)/', $method, $partials);
38
            $method = array_shift($partials[0]);
39
            if (!method_exists($this, $method)) {
40
                throw new \Exception('Sorry! you are calling wrong method');
41
            }
42
            array_unshift($parameters, strtolower(implode('_', $partials[0])));
43
        }
44
45
        return $this->$method(...$parameters);
46
    }
47
48
    public static function __callStatic($method, $parameters)
49
    {

src/WooCommerce.php 1 location

@@ 56-68 (lines=13) @@
53
        $this->properties[$name] = $value;
54
    }
55
56
    public function __call($method, $parameters)
57
    {
58
        if (!method_exists($this, $method)) {
59
            preg_match_all('/((?:^|[A-Z])[a-z]+)/', $method, $partials);
60
            $method = array_shift($partials[0]);
61
            if (!method_exists($this, $method)) {
62
                throw new \Exception('Sorry! you are calling wrong method');
63
            }
64
            array_unshift($parameters, strtolower(implode('_', $partials[0])));
65
        }
66
67
        return $this->$method(...$parameters);
68
    }
69
70
    public static function __callStatic($method, $parameters)
71
    {