Code Duplication    Length = 9-10 lines in 4 locations

module/Applications/src/Applications/Entity/Application.php 1 location

@@ 280-288 (lines=9) @@
277
     * @return Application
278
     * @see \Applications\Entity\ApplicationInterface::setUser()
279
     */
280
    public function setUser(UserInterface $user)
281
    {
282
        if ($this->user) {
283
            $this->getPermissions()->revoke($this->user, Permissions::PERMISSION_ALL, false);
284
        }
285
        $this->getPermissions()->grant($user, Permissions::PERMISSION_ALL);
286
        $this->user = $user;
287
        return $this;
288
    }
289
    
290
    /**
291
     * {@inheritDoc}

module/Core/src/Core/Entity/FileEntity.php 1 location

@@ 91-100 (lines=10) @@
88
     * @param UserInterface $user
89
     * @return $this
90
     */
91
    public function setUser(UserInterface $user)
92
    {
93
        if ($this->user) {
94
            $this->getPermissions()->revoke($this->user, Permissions::PERMISSION_ALL, false);
95
        }
96
        $this->user = $user;
97
        $this->getPermissions()->grant($user, Permissions::PERMISSION_ALL);
98
        
99
        return $this;
100
    }
101
102
    /**
103
     * Gets the owner of a file

module/Jobs/src/Jobs/Entity/Job.php 1 location

@@ 459-467 (lines=9) @@
456
     * (non-PHPdoc)
457
     * @see \Jobs\Entity\JobInterface::setUser()
458
     */
459
    public function setUser(UserInterface $user)
460
    {
461
        if ($this->user) {
462
            $this->getPermissions()->revoke($this->user, Permissions::PERMISSION_ALL, false);
463
        }
464
        $this->user = $user;
465
        $this->getPermissions()->grant($user, Permissions::PERMISSION_ALL);
466
        return $this;
467
    }
468
    /**
469
     * (non-PHPdoc)
470
     * @see \Jobs\Entity\JobInterface::getUser()

module/Organizations/src/Organizations/Entity/Organization.php 1 location

@@ 646-654 (lines=9) @@
643
        $perms->build();
644
    }
645
646
    public function setUser(UserInterface $user)
647
    {
648
        if ($this->user) {
649
            $this->getPermissions()->revoke($this->user, Permissions::PERMISSION_ALL, false);
650
        }
651
        $this->user = $user;
652
        $this->getPermissions()->grant($user, Permissions::PERMISSION_ALL);
653
        return $this;
654
    }
655
656
    /**
657
     * Gets the owner of the organization