Code Duplication    Length = 15-19 lines in 5 locations

Behavior/AttachFileBehavior.php 5 locations

@@ 303-317 (lines=15) @@
300
     *
301
     * @param $script
302
     */
303
    protected function addGetColumnFile(&$script, $file_column)
304
    {
305
        $name = $this->CamelCase($file_column);
306
        $script .= '
307
/**
308
 * Возврашает файл '.$file_column.'
309
 *
310
 * @return \Symfony\Component\HttpFoundation\File\UploadedFile
311
 */
312
public function get'.$name.'File()
313
{
314
    return isset($this->files["'.$file_column.'"]) ? $this->files["'.$file_column.'"] : false;
315
}
316
    ';
317
    }
318
319
    /**
320
     * Запоминаем файл
@@ 324-342 (lines=19) @@
321
     *
322
     * @param $script
323
     */
324
    protected function addSetColumnFile(&$script, $file_column)
325
    {
326
        $name = $this->CamelCase($file_column);
327
        $script .= '
328
/**
329
 * Устанавливает файл
330
 *
331
 * @param \Symfony\Component\HttpFoundation\File\UploadedFile $v
332
 */
333
public function set'.$name.'File($v)
334
{
335
        $this->files["'.$file_column.'"] = $v;
336
        if ($v) {
337
            $file_object = $this->getFileObject("'.$file_column.'");
338
            $this->set'.$name.'(uniqid());
339
        }
340
}
341
    ';
342
    }
343
344
    /**
345
     * Путь до файла
@@ 350-365 (lines=16) @@
347
     * @param $script
348
     * @param $file_column
349
     */
350
    protected function addGetColumnPath(&$script, $file_column)
351
    {
352
        $name = $this->CamelCase($file_column);
353
        $script .= '
354
/**
355
 * Путь до файла '.$file_column.'
356
 *
357
 * @return \Symfony\Component\HttpFoundation\File\UploadedFile
358
 */
359
public function get'.$name.'Path()
360
{
361
    $file_object = $this->getFileObject("'.$file_column.'");
362
    return $file_object && $file_object->issetFile() ? $file_object->getFilePath() : "";
363
}
364
    ';
365
    }
366
367
    /**
368
     * Путь до файла
@@ 373-387 (lines=15) @@
370
     * @param $script
371
     * @param $file_column
372
     */
373
    protected function addGetI18nColumnPath(&$script, $file_column)
374
    {
375
        $name = $this->CamelCase($file_column);
376
        $script .= '
377
/**
378
 * Путь до файла '.$file_column.'
379
 *
380
 * @return \Symfony\Component\HttpFoundation\File\UploadedFile
381
 */
382
public function get'.$name.'Path()
383
{
384
    return $this->getCurrentTranslation()->get'.$name.'Path();
385
}
386
    ';
387
    }
388
389
    /**
390
     * Объект файла
@@ 395-409 (lines=15) @@
392
     * @param $script
393
     * @param $file_column
394
     */
395
    protected function addGetI18nColumnObject(&$script, $file_column)
396
    {
397
        $name = $this->CamelCase($file_column);
398
        $script .= '
399
/**
400
 * Путь до файла '.$file_column.'
401
 *
402
 * @return \Symfony\Component\HttpFoundation\File\UploadedFile
403
 */
404
public function get'.$name.'Object()
405
{
406
    return $this->getCurrentTranslation()->getFileObject("'.$file_column.'");;
407
}
408
    ';
409
    }
410
411
    /**
412
     * Объект файла