setRoute() public method

set the relative redirect url
Since: 3.0.0
public setRoute ( string $text = null, string $route = null ) : Messenger
$text string text of the action
$route string relative route of the action
return Messenger
Example #1
0
 /**
  * show the error
  *
  * @since 3.0.0
  *
  * @param array $errorArray
  *
  * @return string
  */
 protected function _error($errorArray = [])
 {
     $messenger = new Messenger($this->_registry);
     return $messenger->setRoute($this->_language->get('back'), 'register')->error($errorArray['message'], $this->_language->get('error_occurred'));
 }
Example #2
0
 /**
  * show the error
  *
  * @since 3.0.0
  *
  * @return string
  */
 protected function _error()
 {
     $messenger = new Messenger($this->_registry);
     return $messenger->setRoute($this->_language->get('back'), 'login')->error($this->_language->get('something_wrong'), $this->_language->get('error_occurred'));
 }
Example #3
0
 /**
  * error
  *
  * @since 3.0.0
  *
  * @return string
  */
 protected static function _error()
 {
     $messenger = new Messenger(Registry::getInstance());
     return $messenger->setRoute(Language::get('back'), 'login')->doRedirect()->error(Language::get('something_wrong'), Language::get('error_occurred'));
 }
Example #4
0
 /**
  * testError
  *
  * @since 3.0.0
  *
  * @param array $error
  * @param array $actionArray
  * @param string $expect
  *
  * @dataProvider providerError
  */
 public function testError($error = null, $actionArray = null, $expect = null)
 {
     /* setup */
     $messenger = new Messenger($this->_registry);
     $messenger->setRoute($actionArray['text'], $actionArray['route']);
     /* actual */
     $actual = $messenger->error($error['message'], $error['title']);
     /* compare */
     $this->assertEquals($expect, $actual);
 }
Example #5
0
 /**
  * show the info
  *
  * @since 3.0.0
  *
  * @param array $infoArray array of the info
  *
  * @return string
  */
 protected function _info($infoArray = [])
 {
     $messenger = new Messenger($this->_registry);
     return $messenger->setRoute($this->_language->get('back'), 'home')->info($infoArray['message'], $this->_language->get('something_wrong'));
 }
Example #6
0
 /**
  * error
  *
  * @since 3.0.0
  *
  * @param array $errorArray array of the error
  *
  * @return string
  */
 protected static function _error($errorArray = [])
 {
     $messenger = new Messenger(Registry::getInstance());
     return $messenger->setRoute(Language::get('home'), Registry::get('root'))->error($errorArray['message'], Language::get('error_occurred'));
 }