Code Duplication    Length = 15-18 lines in 2 locations

src/Api/Services.php 2 locations

@@ 59-73 (lines=15) @@
56
57
        $this->response = $this->cacheValue($cache);
58
59
        if ($this->response == null) {
60
            $response = $this->_get(
61
                'v3.1/lookup/service-categories',
62
                $lang
63
            );
64
            if($response['success'] == false){
65
                return ;
66
            }
67
            if($this->config->getCache()){
68
                (!file_exists($this->cacheDir)) ?
69
                    mkdir($this->cacheDir, 0777, false) : ((file_exists($cache)) ? unlink($cache) : touch($cache));
70
                file_put_contents($cache, serialize($response['ServiceCategories']));
71
            }
72
            $this->response = $response['ServiceCategories'];
73
        }
74
75
        return $this;
76
    }
@@ 113-130 (lines=18) @@
110
111
        $this->response = $this->cacheValue($cache);
112
113
        if ($this->config->getCache() && $this->response == null) {
114
            $response = $this->_get(
115
                'v3.1/lookup/services-sub-categories',
116
                $lang,
117
                [
118
                    'servicecategoryid' => $serviceId
119
                ]
120
            );
121
            if ($response['success'] == false) {
122
                return;
123
            }
124
            if($this->config->getCache()){
125
                (!file_exists($this->cacheDir)) ?
126
                    mkdir($this->cacheDir, 0777, false) : ((file_exists($cache)) ? unlink($cache) : touch($cache));
127
                file_put_contents($cache, serialize($response['ServiceSubCategories']));
128
            }
129
            $this->response = $response['ServiceSubCategories'];
130
        }
131
132
        return $this;
133
    }