/** * @param string $destination * @return BrowserSession */ public function openConcurrentSession($destination = NULL) { $this->windows[] = $this->currentSession = $this->sessionFactory->create(); $this->currentSession->setContext($this); if ($destination) { $args = func_get_args(); call_user_func_array(array($this->currentSession, 'presenter'), $args); } return $this->currentSession; }
public function isPresenter($destination, $args = array()) { $destination = ltrim($destination, ':'); $action = ($i = strrpos($destination, ':')) === strlen($destination) - 1 ? '' : substr($destination, $i + 1); $destination = substr($destination, 0, -(strlen($action) + 1)); // trim ":" $args['action'] = $action ?: 'default'; if (isset(self::$isPresenterCache[$destination][$jsonArgs = json_encode($args)])) { $appRequest = self::$isPresenterCache[$destination][$jsonArgs]; } else { self::$isPresenterCache[$destination][$jsonArgs] = $appRequest = $this->session->presenter(); } if (!$appRequest || $appRequest->getPresenterName() !== $destination) { return FALSE; } foreach ($args as $param => $value) { if (!array_key_exists($param, $appRequest->parameters) || $value !== $appRequest->parameters[$param]) { return FALSE; } } return TRUE; }