Code Duplication    Length = 7-7 lines in 2 locations

src/DirectAdmin/Objects/Users/Reseller.php 1 location

@@ 56-62 (lines=7) @@
53
    /**
54
     * @return ResellerContext
55
     */
56
    public function impersonate()
57
    {
58
        /** @var AdminContext $context */
59
        if (!($context = $this->getContext()) instanceof AdminContext) {
60
            throw new DirectAdminException('You need to be an admin to impersonate a reseller');
61
        }
62
        return $context->impersonateReseller($this->getUsername());
63
    }
64
}
65

src/DirectAdmin/Objects/Users/Admin.php 1 location

@@ 35-41 (lines=7) @@
32
    /**
33
     * @return AdminContext
34
     */
35
    public function impersonate()
36
    {
37
        /** @var AdminContext $context */
38
        if (!($context = $this->getContext()) instanceof AdminContext) {
39
            throw new DirectAdminException('You need to be an admin to impersonate another admin');
40
        }
41
        return $context->impersonateAdmin($this->getUsername());
42
    }
43
}
44