Created
June 24, 2016 11:32
-
-
Save eminetto/51c932a311d982dc0da5f5aa0bb44b0f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
public function unsubscribe($user, $category) { | |
// Se o usuário pode ser bloqueado | |
if ($this->isUserLockable($user)) { | |
// Se a categoria pode ser bloqueada | |
if ($this->isCategoryLockable($category)) { | |
// Se essa opção não foi executada ainda, ou seja, usuário e categoria não estão bloqueados ainda | |
if (!$this->isUserAndCategoryLocked($user, $category)) { | |
return [ | |
'type' => 'success', | |
'message' => 'Pronto! Você não receberá mais ' . $category['name'] . ' de ' . $user['name'] . '. Para reativar o recebimento dessas mensagens, <a href="' . $this->getRequest()->getBasePath() . '/messages/setting">acesse suas configurações</a>' | |
]; | |
} else { | |
return [ | |
'type' => 'success', | |
'message' => 'Você não está recebendo ' . $category['name'] . ' de ' . $user['name'] . '.' | |
]; | |
} | |
} else { | |
return [ | |
'type' => 'error', | |
'message' => 'Algo deu errado. A categoria ' . $category['name'] . ' parece não ser passível de bloqueio.' | |
]; | |
} | |
} else { | |
return [ | |
'type' => 'error', | |
'message' => 'Algo deu errado. O usuário ' . $user['name'] . ' parece não ser passível de bloqueio.' | |
]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment