Code Duplication    Length = 21-21 lines in 2 locations

code/blocks/slider/models/VideoSliderItem.php 1 location

@@ 273-293 (lines=21) @@
270
    /**
271
     * @return \ValidationResult
272
     */
273
    protected function validate() {
274
        $validation = parent::validate();
275
276
        if (! empty($this->URL) && $this->Type != 'File') {
277
            try {
278
                $result = $this->getVideoId();
279
            } catch (ProviderNotFound $ex) {
280
                $validation->error($ex->getMessage());
281
282
                return $validation;
283
            }
284
285
            // if we can't parse url address, return an error with bad url address or
286
            // the type is not of the url address providers.
287
            if (! $result) {
288
                $validation->error(_t('VideoSliderItem.INVALID_URL_ADDRESS_OR_THE_TYPE', 'Invalid URL address or the type'));
289
            }
290
        }
291
292
        return $validation;
293
    }
294
295
    /**
296
     * @return Image|false

code/blocks/video/models/VideoBlock.php 1 location

@@ 224-244 (lines=21) @@
221
    /**
222
     * @return \ValidationResult
223
     */
224
    protected function validate() {
225
        $validation = parent::validate();
226
227
        if (! empty($this->URL) && $this->Type != 'File') {
228
            try {
229
                $result = $this->getVideoId();
230
            } catch (ProviderNotFound $ex) {
231
                $validation->error($ex->getMessage());
232
233
                return $validation;
234
            }
235
236
            // if we can't parse url address, return an error with bad url address or
237
            // the type is not of the url address providers.
238
            if (! $result) {
239
                $validation->error(_t('VideoSliderItem.INVALID_URL_ADDRESS_OR_THE_TYPE', 'Invalid URL address or the type'));
240
            }
241
        }
242
243
        return $validation;
244
    }
245
246
    /**
247
     * @return Image|false