Code Duplication    Length = 18-18 lines in 2 locations

src/library/ThreemaGateway/Handler/Action/GatewayServer.php 2 locations

@@ 59-76 (lines=18) @@
56
     * @throws XenForo_Exception
57
     * @return string|false
58
     */
59
    public function lookupMail($mail)
60
    {
61
        // check permission
62
        if (!$this->permissions->hasPermission('lookup')) {
63
            throw new XenForo_Exception(new XenForo_Phrase('threemagw_permission_error'));
64
        }
65
66
        /** @var array Return value $threemaId */
67
        $threemaId = false;
68
69
        /** @var Threema\MsgApi\Commands\Results\LookupIdResult $result */
70
        $result = $this->getConnector()->keyLookupByEmail($mail);
71
        if ($result->isSuccess()) {
72
            $threemaId = $result->getId();
73
        }
74
75
        return $threemaId;
76
    }
77
78
    /**
79
     * Returns the capabilities of a Threema ID.
@@ 86-103 (lines=18) @@
83
     * @param  string                                           $threemaId
84
     * @return Threema\MsgApi\Commands\Results\CapabilityResult
85
     */
86
    public function getCapabilities($threemaId)
87
    {
88
        // check permission
89
        if (!$this->permissions->hasPermission('lookup')) {
90
            throw new XenForo_Exception(new XenForo_Phrase('threemagw_permission_error'));
91
        }
92
93
        /** @var array $return Return value */
94
        $return = false;
95
96
        /** @var Threema\MsgApi\Commands\Results\LookupIdResult $result */
97
        $result = $this->getConnector()->keyCapability($threemaId);
98
        if ($result->isSuccess()) {
99
            $return = $result;
100
        }
101
102
        return $return;
103
    }
104
105
    /**
106
     * Returns the remaining credits of the Gateway account.