Code Duplication    Length = 22-22 lines in 2 locations

src/plugins/onTick/evemails.php 1 location

@@ 81-102 (lines=22) @@
78
    /**
79
     *
80
     */
81
    public function tick()
82
    {
83
        // What was the servers last reported state
84
        $lastStatus = getPermCache('serverState');
85
        if ($lastStatus === 'online') {
86
            foreach ($this->apiKey as $apiKey) {
87
                //Check if api is set
88
                if ($apiKey['keyID'] === '' || $apiKey['vCode'] === '' || $apiKey['characterID'] === null) {
89
                    continue;
90
                }
91
                //Get
92
                $lastChecked = getPermCache('mailLastChecked');
93
                if ($lastChecked <= time()) {
94
                    $lastCheckedAPI = getPermCache("mailLastChecked{$apiKey['keyID']}");
95
                    if ($lastCheckedAPI <= time()) {
96
                        $this->logger->addInfo("Mails: Checking API Key {$apiKey['keyID']} for new mail...");
97
                        $this->checkMails($apiKey['keyID'], $apiKey['vCode'], $apiKey['characterID']);
98
                    }
99
                }
100
            }
101
        }
102
    }
103
104
    private function checkMails($keyID, $vCode, $characterID)
105
    {

src/plugins/onTick/notifications.php 1 location

@@ 86-107 (lines=22) @@
83
    /**
84
     *
85
     */
86
    public function tick()
87
    {
88
        // What was the servers last reported state
89
        $lastStatus = getPermCache('serverState');
90
        if ($lastStatus === 'online') {
91
            foreach ($this->apiKey as $apiKey) {
92
                //Check if api is set
93
                if ($apiKey['keyID'] === '' || $apiKey['vCode'] === '' || $apiKey['characterID'] === null) {
94
                    continue;
95
                }
96
                //Get
97
                $lastChecked = getPermCache('notificationsLastChecked');
98
                if ($lastChecked <= time()) {
99
                    $lastCheckedAPI = getPermCache("notificationsLastChecked{$apiKey['keyID']}");
100
                    if ($lastCheckedAPI <= time()) {
101
                        $this->logger->addInfo("Notifications: Checking API Key {$apiKey['keyID']} for notifications..");
102
                        $this->getNotifications($apiKey['keyID'], $apiKey['vCode'], $apiKey['characterID']);
103
                    }
104
                }
105
            }
106
        }
107
    }
108
109
    /**
110
     * @param $keyID