Code Duplication    Length = 17-17 lines in 2 locations

src/AppBundle/Entity/Article.php 1 location

@@ 520-536 (lines=17) @@
517
     * @ORM\PostPersist()
518
     * @ORM\PostUpdate()
519
     */
520
    public function upload()
521
    {
522
        if (null === $this->getFile()) {
523
            return;
524
        }
525
526
        $this->getFile()->move($this->getUploadRootDir(), $this->picture);
527
528
        if (isset($this->temp)) {
529
            unlink($this->getUploadRootDir().'/'.$this->temp);
530
531
            $this->clearCache($this->getUploadDir().'/'.$this->temp);
532
533
            $this->temp = null;
534
        }
535
        $this->file = null;
536
    }
537
538
    /**
539
     * @ORM\PostRemove()

src/AppBundle/Entity/User.php 1 location

@@ 511-527 (lines=17) @@
508
     * @ORM\PostPersist()
509
     * @ORM\PostUpdate()
510
     */
511
    public function upload()
512
    {
513
        if (null === $this->getFile()) {
514
            return;
515
        }
516
517
        $this->getFile()->move($this->getUploadRootDir(), $this->photo);
518
519
        if (isset($this->temp)) {
520
            unlink($this->getUploadRootDir().'/'.$this->temp);
521
522
            $this->clearCache($this->getUploadDir().'/'.$this->temp);
523
524
            $this->temp = null;
525
        }
526
        $this->file = null;
527
    }
528
529
    /**
530
     * @ORM\PostRemove()