Code Duplication    Length = 8-8 lines in 7 locations

src/Api/Cities.php 1 location

@@ 105-112 (lines=8) @@
102
     * @param   int     $cityId
103
     * @return  array
104
     */
105
    public function getId(int $cityId)
106
    {
107
        $this->check();
108
109
        $key = array_search($cityId, array_column($this->response['Cities'], 'Id'));
110
111
        return $this->response['Cities'][$key];
112
    }
113
114
    /**
115
     * Returns a specific city from a region by ID.

src/Api/Districts.php 2 locations

@@ 96-103 (lines=8) @@
93
     * @param   int     $districtId
94
     * @return  array
95
     */
96
    public function getId(int $districtId)
97
    {
98
        $this->check();
99
100
        $key = array_search($districtId, array_column($this->response['Districts'], 'Id'));
101
102
        return $this->response['Districts'][$key];
103
    }
104
105
    /**
106
     * Returns a specific district from a city by ID.
@@ 133-140 (lines=8) @@
130
     * @param   string  $districtName
131
     * @return  array
132
     */
133
    public function getName($districtName)
134
    {
135
        $this->check();
136
137
        $key = array_search($districtName, array_column($this->response['Districts'], 'Name'));
138
139
        return $this->response[$key];
140
    }
141
142
    /**
143
     * Returns a certian district from a city by name.

src/Api/Regions.php 2 locations

@@ 92-99 (lines=8) @@
89
     * @param   int     $regionId
90
     * @return  array
91
     */
92
    public function getId(int $regionId)
93
    {
94
        $this->check();
95
96
        $key = array_search($regionId, array_column($this->response['Regions'], 'Id'));
97
98
        return $this->response['Regions'][$key];
99
    }
100
101
    /**
102
     * Returns a certian region info by id.
@@ 129-136 (lines=8) @@
126
     * @param   string  $name
127
     * @return  array
128
     */
129
    public function getName($name)
130
    {
131
        $this->check();
132
133
        $key = array_search(ucwords($name), array_column($this->response['Regions'], 'Name'));
134
135
        return $this->response['Regions'][$key];
136
    }
137
138
    /**
139
     * Returns a certian region info by name.

src/Api/Services.php 2 locations

@@ 177-184 (lines=8) @@
174
     * @param   int     $serviceId
175
     * @return  array
176
     */
177
    public function getId(int $serviceId)
178
    {
179
        $this->check();
180
181
        $key = array_search($serviceId, array_column($this->response, 'Id'));
182
183
        return $this->response[$key];
184
    }
185
186
    /**
187
     * Returns a specific service by id.
@@ 214-221 (lines=8) @@
211
     * @param   string  $serviceName
212
     * @return  array
213
     */
214
    public function getName($serviceName)
215
    {
216
        $this->check();
217
218
        $key = array_search($serviceName, array_column($this->response, 'Name'));
219
220
        return $this->response[$key];
221
    }
222
223
    /**
224
     * Returns a specific service by name.