/**
  * Returns flush messages
  *
  * @access public
  *
  * @return array
  */
 public function getMessages()
 {
     $flush = array();
     if ($this->session->has('flush')) {
         $flush = $this->session->get('flush');
         $this->session->unsetParam('flush');
     }
     return $flush;
 }
 /**
  * Checks authentication
  *
  * @access public
  *
  * @return bool
  * @throws SecurityException
  */
 public function isAuthenticated()
 {
     if (!is_null($user = $this->session->get('user'))) {
         if (!$user instanceof UserInterface) {
             throw new SecurityException("Your \"user class\" must to be instance of\n                    Framework\\Security\\Model\\UserInterface");
         }
         $fields = $user->getFieldsNames();
         foreach ($fields as $field) {
             if (is_null($user->{$field})) {
                 return false;
             }
         }
         return true;
     }
     return false;
 }