示例#1
0
 /**
  * Sanitize the various needles.
  *
  * @param UsageNeedle $usageNeedle
  *
  * @return UsageNeedle
  */
 public function processUsageNeedles(UsageNeedle $usageNeedle)
 {
     // Compute names from the entries
     if (count($usageNeedle->needles) === 1) {
         $usageNeedles = $this->computeNames($usageNeedle->needles[0]);
         $usageNeedle->setNeedles($usageNeedles);
     }
     return parent::processUsageNeedles($usageNeedle);
 }
示例#2
0
 /**
  * Check if multiple string appear in an array.
  *
  * @param array       $tokens
  * @param UsageNeedle $usageNeedle
  *
  * @return string|false
  */
 protected function containsTokens(array $tokens, UsageNeedle $usageNeedle)
 {
     foreach ($tokens as $token) {
         if ($usageNeedle->matches($token)) {
             return $token;
         }
     }
     return false;
 }