本文整理汇总了PHP中Terminus\Helpers\Input::orglist方法的典型用法代码示例。如果您正苦于以下问题:PHP Input::orglist方法的具体用法?PHP Input::orglist怎么用?PHP Input::orglist使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Terminus\Helpers\Input
的用法示例。
在下文中一共展示了Input::orglist方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get
/**
* Retrieves the model of the given ID
*
* @param [string] $id ID or name of desired organization
* @return [UserOrganizationMembership] $model
*/
public function get($id)
{
$orgs = $this->getMembers();
$orglist = \Terminus\Helpers\Input::orglist();
$model = null;
if (isset($orgs[$id])) {
$model = $this->models[$id];
} elseif (($location = array_search($id, $orglist)) !== false) {
$model = $this->models[$location];
}
return $model;
}
示例2: orgid
public static function orgid($args, $key, $default = null)
{
$orglist = Input::orglist();
$flip = array_flip($orglist);
if (isset($args[$key]) and array_key_exists($args[$key], $flip)) {
// if we have a valid name provided and we need the id
return $flip[$args[$key]];
} elseif (isset($args[$key]) and array_key_exists($args[$key], $orglist)) {
return $args[$key];
}
$orglist = Input::orglist();
$org = \Terminus::menu($orglist, false, "Choose organization");
if ('-' === $org) {
return $default;
}
return $org;
}
示例3: testOrgHelpers
/**
* @vcr input_helper_org_helpers
*/
function testOrgHelpers()
{
$orglist = Input::orglist();
$this->assertInternalType('array', $orglist);
$this->assertArrayHasKey('-', $orglist);
$this->assertArrayHasKey('d59379eb-0c23-429c-a7bc-ff51e0a960c2', $orglist);
// test normal usage
$args = array('org' => 'Terminus Testing');
$org = Input::orgname($args, 'org');
$this->assertEquals('Terminus Testing', $org);
// test case where an orgid is sent and a name should be returned
$args = array('org' => 'd59379eb-0c23-429c-a7bc-ff51e0a960c2');
$org = Input::orgname($args, 'org');
$this->assertEquals('Terminus Testing', $org);
// test case where an orgid is sent and a name should be returned
$args = array('org' => 'd59379eb-0c23-429c-a7bc-ff51e0a960c2');
$org = Input::orgid($args, 'org');
$this->assertEquals('d59379eb-0c23-429c-a7bc-ff51e0a960c2', $org);
$args = array('org' => 'Terminus Testing');
$org = Input::orgid($args, 'org');
$this->assertEquals('d59379eb-0c23-429c-a7bc-ff51e0a960c2', $org);
}
示例4: orgname
/**
* Input helper that provides interactive menu to select org name
*
* @param [array] $args The args passed in from argv
* @param [string] $key Args key to search for
* @return [string] Site name
*/
public static function orgname($args, $key)
{
$orglist = Input::orglist();
if (isset($args[$key])) {
//If org id is sent, fetch the name
if (array_key_exists($args[$key], $orglist)) {
return $orglist[$args[$key]];
}
return $args[$key];
}
$org = \Terminus::menu($orglist, false, "Choose organization");
return $orglist[$org];
}
示例5: import
/**
* Import a new site
* @package 2.0
*
* ## OPTIONS
*
* [--url=<url>]
* : Url of archive to import
*
* [--name=<name>]
* : Name of the site to create (machine-readable)
*
* [--label=<label>]
* : Label for the site
*
* [--org=<org>]
* : UUID of organization to add this site to
*
* @subcommand create-from-import
*/
public function import($args, $assoc_args)
{
$url = Input::string($assoc_args, 'url', "Url of archive to import");
$label = Input::string($assoc_args, 'label', "Human readable label for the site");
$slug = Utils\sanitize_name($label);
$name = Input::string($assoc_args, 'name', "Machine name of the site; used as part of the default URL [ if left blank will be {$slug}]");
$name = $name ? $name : $slug;
$organization = Terminus::menu(Input::orglist(), false, "Choose organization");
if (!$url) {
Terminus::error("Please enter a url.");
}
Terminus::launch_self('sites', array('create'), array('label' => $label, 'name' => $name, 'org' => $organization));
Terminus::launch_self('site', array('import'), array('url' => $url, 'site' => $name, 'nocache' => True));
}