Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. ArgumentsWildcard.php

function ArgumentsWildcard::scoreArguments

Calculates wildcard match score for provided arguments.

Parameters

array<mixed> $arguments:

Return value

false|int False OR integer score (higher - better)

File

vendor/phpspec/prophecy/src/Prophecy/Argument/ArgumentsWildcard.php, line 53

Class

ArgumentsWildcard
Arguments wildcarding.

Namespace

Prophecy\Argument

Code

public function scoreArguments(array $arguments) {
    if (0 == count($arguments) && 0 == count($this->tokens)) {
        return 1;
    }
    $arguments = array_values($arguments);
    $totalScore = 0;
    foreach ($this->tokens as $i => $token) {
        $argument = isset($arguments[$i]) ? $arguments[$i] : null;
        if (1 >= ($score = $token->scoreArgument($argument))) {
            return false;
        }
        $totalScore += $score;
        if (true === $token->isLast()) {
            return $totalScore;
        }
    }
    if (count($arguments) > count($this->tokens)) {
        return false;
    }
    return $totalScore;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal