removeReceipt($licenseId); foreach (array_keys(TribeObj::getPairs()) as $tribeId) { $this->removeLicense($licenseId, $tribeId); $this->removePremiumReceipt($licenseId, $tribeId); } } /** * @param $licenseId * @param $tribeId * @return void */ public function removeLicense($licenseId, $tribeId) { $type = Entity::TYPE_LICENSE; $file = constant('WWW_PATH') . '/download/' . $type . '/' . $type . '-' . $licenseId . '_' . $tribeId . '.pdf'; if (file_exists($file)) { unlink($file); } } /** * @param $licenseId * @return void */ public function removeReceipt($licenseId) { $type = Entity::TYPE_RECEIPT; $file = constant('WWW_PATH') . '/download/' . $type . '/' . $type . '-' . $licenseId . '.pdf'; if (file_exists($file)) { unlink($file); } } /** * @param $licenseId * @param $tribeId * @return void */ public function removePremiumReceipt($licenseId, $tribeId) { $type = Entity::TYPE_PREMIUM_RECEIPT; $file = constant('WWW_PATH') . '/download/' . $type . '/' . $type . '-' . $licenseId . '_' . $tribeId . '.pdf'; if (file_exists($file)) { unlink($file); } } }