Code Duplication    Length = 18-18 lines in 2 locations

src/ForecastIO.php 2 locations

@@ 109-126 (lines=18) @@
106
        $cur = new Current();
107
108
        $precipType = self::PRECIP_TYPE_NONE;
109
        if ($result['precipProbability'] > 0) {
110
            switch ($result['precipType']) {
111
                case 'rain':
112
                    $precipType = self::PRECIP_TYPE_RAIN;
113
                    break;
114
                case 'snow':
115
                    $precipType = self::PRECIP_TYPE_SNOW;
116
                    break;
117
                case 'sleet':
118
                    $precipType = self::PRECIP_TYPE_SLEET;
119
                    break;
120
                case 'hail':
121
                    $precipType = self::PRECIP_TYPE_HAIL;
122
                    break;
123
                default:
124
                    throw new \Exception('Не известный тип precipType: ' . $result['precipType']);
125
            }
126
        }
127
        $cur->setData([
128
            'summary' => $result['summary'],
129
            'temperature' => [
@@ 185-202 (lines=18) @@
182
        $hours = [];
183
        foreach ($result['data'] as $item) {
184
            $precipType = self::PRECIP_TYPE_NONE;
185
            if ($item['precipProbability'] > 0) {
186
                switch ($item['precipType']) {
187
                    case 'rain':
188
                        $precipType = self::PRECIP_TYPE_RAIN;
189
                        break;
190
                    case 'snow':
191
                        $precipType = self::PRECIP_TYPE_SNOW;
192
                        break;
193
                    case 'sleet':
194
                        $precipType = self::PRECIP_TYPE_SLEET;
195
                        break;
196
                    case 'hail':
197
                        $precipType = self::PRECIP_TYPE_HAIL;
198
                        break;
199
                    default:
200
                        throw new \Exception('Не известный тип precipType: ' . $item['precipType']);
201
                }
202
            }
203
204
            $hours[] = [
205
                'summary' => $item['summary'],