コード例 #1
0
ファイル: StringTest.php プロジェクト: grrr-amsterdam/garp3
 public function testHumanList()
 {
     $array = array('apples', 'pears', 'carrots');
     $this->assertEquals('apples, pears and carrots', Garp_Util_String::humanList($array));
     $this->assertEquals('|apples|, |pears| >> |carrots|', Garp_Util_String::humanList($array, '|', '>>'));
 }
コード例 #2
0
ファイル: Content.php プロジェクト: grrr-amsterdam/garp3
 protected function _validateSyncArguments(array $args)
 {
     $valid = false;
     $argCount = count($args);
     if (!array_key_exists(0, $args)) {
         Garp_Cli::errorOut("No source environment provided.");
     } elseif (!array_key_exists(1, $args)) {
         Garp_Cli::errorOut("No target environment provided.");
     } elseif (!in_array($args[0], $this->_environments)) {
         Garp_Cli::errorOut("Source environment is invalid. Try: " . Garp_Util_String::humanList($this->_environments, null, 'or') . '.');
     } elseif (!in_array($args[1], $this->_environments)) {
         Garp_Cli::errorOut("Target environment is invalid. Try: " . Garp_Util_String::humanList($this->_environments, null, 'or') . '.');
     } else {
         $valid = true;
     }
     if (!$valid) {
         $this->help();
         return false;
     }
     return true;
 }
コード例 #3
0
ファイル: CinemaNl.php プロジェクト: grrr-amsterdam/garp3
 protected function _extractPeopleProp(SimpleXmlElement $response, $propName, $propChildName)
 {
     if (property_exists($response, $propName) && property_exists($response->{$propName}, $propChildName) && count($response->{$propName}->{$propChildName})) {
         $people = array();
         foreach ($response->{$propName}->{$propChildName} as $person) {
             if (property_exists($person, 'name') && !empty($person->name)) {
                 $people[] = $person->name;
             }
         }
         if ($people) {
             return Garp_Util_String::humanList($people, null, 'en');
         }
     }
 }