Beispiel #1
0
 /**
  * Search for Pantheon upstream info
  *
  * ### OPTIONS
  *
  * [--category=<category>]
  * : general, publishing, commerce, etc
  *
  * [--type=<type>]
  * : Pantheon internal upstream type definition
  *
  * [--framework=<drupal|wordpress>]
  * : Filter based on framework
  *
  * @subcommand list
  * @alias all
  **/
 public function all($args = array(), $assoc_args = array())
 {
     $upstreams = new Upstreams();
     $upstreams_list = $upstreams->getFilteredMemberList($assoc_args, 'id', array('id', 'longname', 'category', 'type', 'framework'));
     $this->output()->outputRecordList($upstreams_list, array('id' => 'ID', 'longname' => 'Name', 'category' => 'Category', 'type' => 'Type', 'framework' => 'Framework'));
     return $upstreams;
 }
Beispiel #2
0
 /**
  * Search for Pantheon upstream info
  *
  * ### OPTIONS
  *
  * [--category=<category>]
  * : general, publishing, commerce, etc
  *
  * [--type=<type>]
  * : Pantheon internal upstream type definition
  *
  * [--framework=<drupal|wordpress>]
  * : Filter based on framework
  *
  * @subcommand list
  * @alias all
  **/
 public function all($args = array(), $assoc_args = array())
 {
     $upstreams = new Upstreams();
     $upstreams_list = $upstreams->getFilteredMemberList($assoc_args, 'id', array('id', 'longname', 'category', 'type', 'framework'));
     $this->handleDisplay($upstreams_list, array(), array('ID', 'Name', 'Category', 'Type', 'Framework'));
     return $upstreams;
 }
Beispiel #3
0
 /**
  * @vcr upstreams_instance
  */
 public function testUpstreamsInstance()
 {
     $upstreams = new Upstreams(array());
     $test = $upstreams->get('3b754bc2-48f8-4388-b5b5-2631098d03de');
     $this->assertEquals('CiviCRM Starter Kit', $test->get('longname'));
     $test = $upstreams->all();
     $this->assertNotEmpty($test);
 }
Beispiel #4
0
 /**
  * Helper function to select valid upstream
  *
  * @param [array]   $args Args to parse value from
  * @param [string]  $key  Index to search for in args
  * @param [boolean] $exit If true, throw error when no value is found
  *
  * @return [Upstream] $upstream
  */
 public static function upstream($args, $key, $exit = true)
 {
     $upstreams = new Upstreams();
     if (isset($args[$key])) {
         $upstream = $upstreams->getByIdOrName($args[$key]);
         if ($upstream == null) {
             \Terminus::error("Couldn't find upstream: %s", array($args['upstream']));
         }
     } else {
         $upstream = $upstreams->get(\Terminus::menu($upstreams->getMemberList('id', 'longname')));
     }
     if (!$upstream && $exit) {
         \Terminus::error('Upstream is required.');
     }
     return $upstream;
 }
Beispiel #5
0
 /**
  * Helper function to select valid upstream
  *
  * @param [array]   $args Args to parse value from
  * @param [string]  $key  Index to search for in args
  * @param [boolean] $exit If true, throw error when no value is found
  *
  * @return [Upstream] $upstream
  */
 public static function upstream($args, $key, $exit = true)
 {
     $upstreams = new Upstreams();
     if (isset($args[$key])) {
         $upstream = $upstreams->getByIdOrName($args[$key]);
         if ($upstream == null) {
             throw new TerminusException('Could not find upstream: {upstream}', array('upstream' => $args['upstream']), (int) $exit);
         }
     } else {
         $upstream = $upstreams->get(Terminus::menu($upstreams->getMemberList('id', 'longname')));
     }
     return $upstream;
 }
Beispiel #6
0
 /**
  * Helper function to select valid upstream
  *
  * @param array $arg_options Elements as follow:
  *        array  args Args to parse value from
  *        string key  Index to search for in args
  *        bool   exit If true, throw error when no value is found
  * @return Upstream
  * @throws TerminusException
  */
 public function upstream(array $arg_options = [])
 {
     $default_options = ['args' => [], 'key' => 'upstream', 'exit' => true];
     $options = array_merge($default_options, $arg_options);
     $upstreams = new Upstreams();
     if (isset($options['args'][$options['key']])) {
         $upstream = $upstreams->getByIdOrName($options['args'][$options['key']]);
         if ($upstream == null) {
             throw new TerminusException('Could not find upstream: {upstream}', ['upstream' => $options['args'][$options['key']]], (int) $options['exit']);
         }
     } else {
         $upstream = $upstreams->get($this->menu(['choices' => $upstreams->getMemberList('id', 'longname')]));
     }
     return $upstream;
 }