Code Duplication    Length = 9-10 lines in 4 locations

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/Applications/src/Applications/Entity/Application.php 1 location

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

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

@@ 468-476 (lines=9) @@
465
     * (non-PHPdoc)
466
     * @see \Jobs\Entity\JobInterface::setUser()
467
     */
468
    public function setUser(UserInterface $user)
469
    {
470
        if ($this->user) {
471
            $this->getPermissions()->revoke($this->user, Permissions::PERMISSION_ALL, false);
472
        }
473
        $this->user = $user;
474
        $this->getPermissions()->grant($user, Permissions::PERMISSION_ALL);
475
        return $this;
476
    }
477
    /**
478
     * (non-PHPdoc)
479
     * @see \Jobs\Entity\JobInterface::getUser()

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

@@ 631-639 (lines=9) @@
628
        $perms->build();
629
    }
630
631
    public function setUser(UserInterface $user)
632
    {
633
        if ($this->user) {
634
            $this->getPermissions()->revoke($this->user, Permissions::PERMISSION_ALL, false);
635
        }
636
        $this->user = $user;
637
        $this->getPermissions()->grant($user, Permissions::PERMISSION_ALL);
638
        return $this;
639
    }
640
641
    /**
642
     * Gets the owner of the organization