Skip to content
Permalink
Browse files

Use fewer empty calls.

data() helps us avoid notice errors, so we don't need to rely on
empty().
  • Loading branch information...
markstory committed Oct 5, 2016
1 parent 1377aa8 commit b4aed2425e9a06ae32a7194935b5d069315a1b00
Showing with 4 additions and 4 deletions.
  1. +1 −1 src/Controller/Component/CsrfComponent.php
  2. +3 −3 src/Controller/Component/SecurityComponent.php
@@ -93,7 +93,7 @@ public function startup(Event $event)
if ($request->is('get') && $cookieData === null) {
$this->_setCookie($request, $response);
}
if ($request->is(['put', 'post', 'delete', 'patch']) || !empty($request->data())) {
if ($request->is(['put', 'post', 'delete', 'patch']) || $request->data()) {
$this->_validateToken($request);
unset($request->data[$this->_config['field']]);
}
@@ -109,7 +109,7 @@ public function startup(Event $event)
$controller = $event->subject();
$this->session = $this->request->session();
$this->_action = $this->request->param('action');
$hasData = !empty($this->request->data());
$hasData = (bool)$this->request->data();
try {
$this->_secureRequired($controller);
$this->_authRequired($controller);
@@ -266,7 +266,7 @@ protected function _authRequired(Controller $controller)
{
if (is_array($this->_config['requireAuth']) &&
!empty($this->_config['requireAuth']) &&
!empty($this->request->data())
$this->request->data()
) {
$requireAuth = $this->_config['requireAuth'];
@@ -318,7 +318,7 @@ protected function _authRequired(Controller $controller)
*/
protected function _validatePost(Controller $controller)
{
if (empty($controller->request->data())) {
if (!$controller->request->data()) {
return true;
}
$token = $this->_validToken($controller);

0 comments on commit b4aed24

Please sign in to comment.
You can’t perform that action at this time.