本文整理匯總了PHP中Buzz\Browser::getListener方法的典型用法代碼示例。如果您正苦於以下問題:PHP Browser::getListener方法的具體用法?PHP Browser::getListener怎麽用?PHP Browser::getListener使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Buzz\Browser
的用法示例。
在下文中一共展示了Browser::getListener方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: hasListener
/**
* @param Browser $client
* @param ListenerInterface $listener
*
* @return bool
*/
protected function hasListener(Browser $client, ListenerInterface $listener)
{
/** @var ListenerInterface $listenerClient */
if (!($listenerClient = $client->getListener())) {
return false;
}
if (!$listenerClient instanceof ListenerChain) {
return $listenerClient instanceof $listener;
}
/** @var ListenerChain $listenerBrowser */
/** @var ListenerInterface $listenerItem */
foreach ($listenerClient->getListeners() as $listenerItem) {
if ($listenerItem instanceof $listener) {
return true;
}
}
return false;
}
示例2: prependAuthCookie
/**
* Add UserAuth Cookie to the local storage
* for later requests.
* It needs to be prepended otherwise only the incorrect AUTH Cookie from the original request will be send
*
* @see self::initContaoRequestHeaders()
* @param Browser $browser
*/
protected function prependAuthCookie(Browser $browser)
{
// Append the FE_USER_AUTH Cookie to the current request, so followed request like loadlayout don't have
// to run through the autologin / 303 process
foreach ($browser->getListener()->getCookies() as $cookie) {
if ($cookie->getName() == 'FE_USER_AUTH' && !$cookie->isExpired()) {
$this->cookieAppendix = 'FE_USER_AUTH=' . $cookie->getValue() . '; ';
}
}
}
示例3: createConnection
/**
* Create Sahi API Connection with custom SID.
*
* @param string $sid sahi id
* @param Browser $browser
* @param boolean $correct add correct responses to browser Queue for browser creation
*
* @return Connection
*/
protected function createConnection($sid, Browser $browser, $correct = false)
{
if ($correct) {
$browser->getClient()->sendToQueue($this->createResponse('1.0 200 OK', 'true'));
$browser->getClient()->sendToQueue($this->createResponse('1.0 200 OK'));
}
$connection = new Connection($sid, 'localhost', 9999, $browser);
if ($correct) {
$browser->getListener()->getJournal()->clear();
}
return $connection;
}