/** * 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); }
/** * 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; }