本文整理汇总了PHP中Workflow::requestCacheJson方法的典型用法代码示例。如果您正苦于以下问题:PHP Workflow::requestCacheJson方法的具体用法?PHP Workflow::requestCacheJson怎么用?PHP Workflow::requestCacheJson使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Workflow
的用法示例。
在下文中一共展示了Workflow::requestCacheJson方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: foreach
foreach ($subs as $key => $sub) {
Workflow::addItem(Item::create()->title($parts[0] . ' ' . $key)->subtitle($sub)->arg('https://github.com/' . $parts[0] . '/' . $key));
}
foreach (array('watch', 'unwatch') as $key) {
Workflow::addItem(Item::create()->title($parts[0] . ' ' . $key)->subtitle(ucfirst($key) . ' ' . $parts[0])->arg($key . ' ' . $parts[0]));
}
if (empty($parts[1])) {
$subs = array('#' => 'Show a specific issue by number', '@' => 'Show a specific branch');
foreach ($subs as $key => $subtitle) {
Workflow::addItem(Item::create()->title($parts[0] . ' ' . $key)->subtitle($subtitle)->arg($key . ' ' . $parts[0])->valid(false));
}
}
}
} elseif (!$isUser && !$isMy) {
$path = $isRepo ? 'repos_for/' . $queryUser : 'repos';
$repos = Workflow::requestCacheJson('https://github.com/command_bar/' . $path, 'repositories');
foreach ($repos as $repo) {
Workflow::addItem(Item::create()->title($repo->command . ' ')->subtitle($repo->description)->arg('https://github.com/' . $repo->command)->prio(3 + $repo->multiplier));
}
}
if (!$isMy) {
if ($isUser && isset($parts[1])) {
foreach (array('follow', 'unfollow') as $key) {
Workflow::addItem(Item::create()->title($parts[0] . ' ' . $key)->subtitle(ucfirst($key) . ' ' . $queryUser)->arg($key . ' ' . $queryUser));
}
} elseif (!$isRepo) {
foreach ($users as $user) {
$name = substr($user->command, 1);
Workflow::addItem(Item::create()->prefix('@', false)->title($name . ' ')->subtitle($user->description)->arg('https://github.com/' . $name)->prio(2));
}
}
示例2: foreach
$path = $isRepo ? 'repos_for/' . $queryUser : 'repos';
$repos = Workflow::requestCacheJson('https://github.com/command_bar/' . $path, 'results');
foreach ($repos as $repo) {
Workflow::addItem(Item::create()->title($repo->command . ' ')->subtitle($repo->description)->arg('https://github.com/' . $repo->command)->prio(30 + (isset($repo->multiplier) ? $repo->multiplier : 1)));
}
}
if ($isUser && isset($parts[1])) {
$subs = array('contributions' => array($queryUser, "View {$queryUser}'s contributions"), 'repositories' => array($queryUser . '?tab=repositories', "View {$queryUser}'s repositories"), 'activity' => array($queryUser . '?tab=activity', "View {$queryUser}'s public activity"), 'stars' => array('stars/' . $queryUser, "View {$queryUser}'s stars"));
$prio = count($subs);
foreach ($subs as $key => $sub) {
Workflow::addItem(Item::create()->prefix('@', false)->title($queryUser . ' ' . $key)->subtitle($sub[1])->arg('https://github.com/' . $sub[0])->prio($prio--));
}
} elseif (!$isMy) {
if (!$isRepo) {
if ($queryUser) {
$users = Workflow::requestCacheJson('https://github.com/command_bar/users?q=' . urlencode($queryUser), 'results');
}
foreach ($users as $user) {
$name = substr($user->command, 1);
Workflow::addItem(Item::create()->prefix('@', false)->title($name . ' ')->subtitle($user->description)->arg('https://github.com/' . $name)->prio(20 + (isset($user->multiplier) ? $user->multiplier : 1)));
}
}
Workflow::addItem(Item::create()->title('my ')->subtitle('Dashboard, settings, and more')->prio(10)->valid(false));
} else {
$myPages = array('dashboard' => array('', 'View your dashboard'), 'pulls' => array('dashboard/pulls', 'View your pull requests'), 'issues' => array('dashboard/issues', 'View your issues'), 'stars' => array('stars', 'View your starred repositories'), 'profile' => array(Workflow::getConfig('user'), 'View your public user profile'), 'settings' => array('settings', 'View or edit your account settings'), 'notifications' => array('notifications', 'View all your notifications'));
foreach ($myPages as $key => $my) {
Workflow::addItem(Item::create()->title('my ' . $key)->subtitle($my[1])->arg('https://github.com/' . $my[0])->prio(1));
}
}
Workflow::sortItems();
if ($query) {
示例3: array
$subs = array('#' => 'Show a specific issue by number', ':' => 'Show a specific branch', '/' => 'Show a blob');
foreach ($subs as $key => $subtitle) {
Workflow::addItem(Item::create()->title($parts[0] . ' ' . $key)->subtitle($subtitle)->arg($key . ' ' . $parts[0])->valid(false));
}
}
}
} elseif (!$isUser && !$isMy) {
$path = $isRepo ? 'repos_for/' . $queryUser : 'repos';
$repos = Workflow::requestCacheJson('https://github.com/command_bar/' . $path, $isRepo ? 'repositories' : 'results');
foreach ($repos as $repo) {
Workflow::addItem(Item::create()->title($repo->command . ' ')->subtitle($repo->description)->arg('https://github.com/' . $repo->command)->prio(30 + (isset($repo->multiplier) ? $repo->multiplier : 1)));
}
}
if (!$isMy) {
if (!$isRepo) {
$users = Workflow::requestCacheJson('https://github.com/command_bar/users', 'results');
foreach ($users as $user) {
$name = substr($user->command, 1);
Workflow::addItem(Item::create()->prefix('@', false)->title($name)->subtitle($user->description)->arg('https://github.com/' . $name)->prio(20 + (isset($user->multiplier) ? $user->multiplier : 1)));
}
}
Workflow::addItem(Item::create()->title('my ')->subtitle('Dashboard, settings, and more')->prio(10)->valid(false));
} else {
$myPages = array('dashboard' => array('', 'View your dashboard'), 'pulls' => array('dashboard/pulls', 'View your pull requests'), 'issues' => array('dashboard/issues', 'View your issues'), 'stars' => array('stars', 'View your starred repositories'), 'profile' => array(Workflow::getConfig('user'), 'View your public user profile'), 'settings' => array('settings', 'View or edit your account settings'), 'notifications' => array('notifications', 'View all your notifications'));
foreach ($myPages as $key => $my) {
Workflow::addItem(Item::create()->title('my ' . $key)->subtitle($my[1])->arg('https://github.com/' . $my[0])->prio(1));
}
}
Workflow::sortItems();
if ($query) {
$path = $isUser ? $queryUser : 'search?q=' . urlencode($query);