matchWildcard() публичный статический Метод

public static matchWildcard ( $wildcard_pattern, $haystack )
Пример #1
0
 public function getBlueprintLabels($filter = null)
 {
     $labels = [];
     foreach ($this->config->getBlueprintNames() as $blueprintName) {
         try {
             $effectiveStackName = $this->getBlueprint($blueprintName)->getStackName();
         } catch (\StackFormation\Exception\InvalidStackNameException $e) {
             $effectiveStackName = '<fg=red>[Invalid stack name "' . $e->getStackName() . '"]</>';
         } catch (\StackFormation\Exception\ValueResolverException $e) {
             $previousException = $e->getPrevious();
             if ($previousException instanceof MissingEnvVarException) {
                 $effectiveStackName = '<fg=red>[Missing env var "' . $previousException->getEnvVar() . '"]</>';
             } else {
                 throw $e;
             }
         }
         $label = $blueprintName;
         if (!is_null($filter) && !Finder::matchWildcard($filter, $label)) {
             continue;
         }
         if ($effectiveStackName != $blueprintName) {
             $label .= " <fg=yellow>(Effective: {$effectiveStackName})</>";
         }
         $labels[] = $label;
     }
     return $labels;
 }
Пример #2
0
 /**
  * @param $logGroupName
  * @param string $logStreamNameFilter
  * @return \AwsInspector\Model\Collection
  */
 public function findLogStreams($logGroupName, $logStreamNameFilter = null)
 {
     if (empty($logGroupName)) {
         throw new \InvalidArgumentException('LogGroupName cannot be empty');
     }
     $result = $this->cloudWatchLogsClient->describeLogStreams(['logGroupName' => $logGroupName, 'orderBy' => 'LastEventTime', 'descending' => true]);
     $rows = $result->search('logStreams[]');
     $collection = new \AwsInspector\Model\Collection();
     foreach ($rows as $row) {
         if (!$logStreamNameFilter || Finder::matchWildcard($logStreamNameFilter, $row['logStreamName'])) {
             $collection->attach(new LogStream($row));
         }
     }
     return $collection;
 }