本文整理汇总了PHP中Terminus\Helpers\Input::orgName方法的典型用法代码示例。如果您正苦于以下问题:PHP Input::orgName方法的具体用法?PHP Input::orgName怎么用?PHP Input::orgName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Terminus\Helpers\Input
的用法示例。
在下文中一共展示了Input::orgName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: organizations
/**
* List site organizations
*
* ## OPTIONS
*
* <list|add|remove>
* : subfunction to run
*
* [--site=<site>]
* : Site's name
*
* [--org=<name|id>]
* : Organization to add/remove from membership, name or UUID
*
* [--role=<role>]
* : Max role for organization on this site ... default "team_member"
*
*/
public function organizations($args, $assoc_args)
{
$action = array_shift($args);
$site = $this->sites->get(Input::siteName(array('args' => $assoc_args)));
$data = array();
switch ($action) {
case 'add':
$role = Input::optional(array('key' => 'role', 'choices' => $assoc_args, 'default' => 'team_member'));
$org = Input::orgName(array('args' => $assoc_args));
if (!$this->isOrgAccessible($org)) {
$this->failure("Organization is either invalid or you are not a member.");
}
$workflow = $site->org_memberships->addMember($org, $role);
$workflow->wait();
break;
case 'remove':
$org = Input::orgId(array('args' => $assoc_args));
if (!$this->isOrgAccessible($org)) {
$this->failure("Organization is either invalid or you are not a member.");
}
$member = $site->org_memberships->get($org);
if ($member == null) {
$this->failure('{org} is not a member of {site}', array('org' => $org, 'site' => $site->get('name')));
}
$workflow = $member->removeMember('organization', $org);
$workflow->wait();
break;
case 'list':
default:
$orgs = $site->org_memberships->all();
if (empty($orgs)) {
$this->log()->warning('No organizations');
}
foreach ($orgs as $org) {
$org_data = $org->get('organization');
$data[] = array('label' => $org_data->profile->name, 'name' => $org_data->profile->machine_name, 'role' => $org->get('role'), 'id' => $org->get('organization_id'));
}
$this->output()->outputRecordList($data);
break;
}
if (isset($workflow)) {
$this->workflowOutput($workflow);
}
}
示例2: testOrgNameAcceptsUuid
/**
* @vcr input_helper_org_helpers
*/
function testOrgNameAcceptsUuid()
{
$args = array('org' => 'd59379eb-0c23-429c-a7bc-ff51e0a960c2');
$org = Input::orgName(compact('args'));
$this->assertEquals('Terminus Testing', $org);
}