本文整理匯總了PHP中OCP\Util::getChannel方法的典型用法代碼示例。如果您正苦於以下問題:PHP Util::getChannel方法的具體用法?PHP Util::getChannel怎麽用?PHP Util::getChannel使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類OCP\Util
的用法示例。
在下文中一共展示了Util::getChannel方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: displayPanel
/**
* @return TemplateResponse
*/
public function displayPanel()
{
$lastUpdateCheck = $this->dateTimeFormatter->formatDateTime($this->config->getAppValue('core', 'lastupdatedat'));
$channels = ['daily', 'beta', 'stable', 'production'];
$currentChannel = \OCP\Util::getChannel();
// Remove the currently used channel from the channels list
if (($key = array_search($currentChannel, $channels)) !== false) {
unset($channels[$key]);
}
$updateState = $this->updateChecker->getUpdateState();
$params = ['isNewVersionAvailable' => $updateState === [] ? false : true, 'lastChecked' => $lastUpdateCheck, 'currentChannel' => $currentChannel, 'channels' => $channels, 'newVersionString' => $updateState === [] ? '' : $updateState['updateVersion']];
return new TemplateResponse($this->appName, 'admin', $params, '');
}
示例2: testDisplayPanelWithoutUpdate
public function testDisplayPanelWithoutUpdate()
{
$channels = ['daily', 'beta', 'stable', 'production'];
$currentChannel = \OCP\Util::getChannel();
// Remove the currently used channel from the channels list
if (($key = array_search($currentChannel, $channels)) !== false) {
unset($channels[$key]);
}
$this->config->expects($this->exactly(2))->method('getAppValue')->willReturnMap([['core', 'lastupdatedat', '', '12345'], ['updatenotification', 'notify_groups', '["admin"]', '["admin"]']]);
$this->dateTimeFormatter->expects($this->once())->method('formatDateTime')->with('12345')->willReturn('LastCheckedReturnValue');
$this->updateChecker->expects($this->once())->method('getUpdateState')->willReturn([]);
$params = ['isNewVersionAvailable' => false, 'lastChecked' => 'LastCheckedReturnValue', 'currentChannel' => \OCP\Util::getChannel(), 'channels' => $channels, 'newVersionString' => '', 'notify_groups' => 'admin'];
$expected = new TemplateResponse('updatenotification', 'admin', $params, '');
$this->assertEquals($expected, $this->adminController->displayPanel());
}
示例3: testOverrideChannel
/**
* @dataProvider channelProvider
*
* @param string $channel
*/
public function testOverrideChannel($channel)
{
\OCP\Util::setChannel($channel);
$actual = \OCP\Util::getChannel($channel);
$this->assertEquals($channel, $actual);
}
示例4: getCurrentChannel
/**
* Get current value
* @return string
*/
public function getCurrentChannel()
{
return \OCP\Util::getChannel();
}