You are here

public function ArrayEveryEntryToken::scoreArgument in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/phpspec/prophecy/src/Prophecy/Argument/Token/ArrayEveryEntryToken.php \Prophecy\Argument\Token\ArrayEveryEntryToken::scoreArgument()

Calculates token match score for provided argument.

Parameters

$argument:

Return value

bool|int

Overrides TokenInterface::scoreArgument

File

vendor/phpspec/prophecy/src/Prophecy/Argument/Token/ArrayEveryEntryToken.php, line 41

Class

ArrayEveryEntryToken
Array every entry token.

Namespace

Prophecy\Argument\Token

Code

public function scoreArgument($argument) {
  if (!$argument instanceof \Traversable && !is_array($argument)) {
    return false;
  }
  $scores = array();
  foreach ($argument as $key => $argumentEntry) {
    $scores[] = $this->value
      ->scoreArgument($argumentEntry);
  }
  if (empty($scores) || in_array(false, $scores, true)) {
    return false;
  }
  return array_sum($scores) / count($scores);
}