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

Breadcrumb

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

class Call

Call object.

@author Konstantin Kudryashov <ever.zet@gmail.com>

Hierarchy

  • class \Prophecy\Call\Call

Expanded class hierarchy of Call

9 files declare their use of Call
CallbackPrediction.php in vendor/phpspec/prophecy/src/Prophecy/Prediction/CallbackPrediction.php
CallPrediction.php in vendor/phpspec/prophecy/src/Prophecy/Prediction/CallPrediction.php
CallTimesPrediction.php in vendor/phpspec/prophecy/src/Prophecy/Prediction/CallTimesPrediction.php
NoCallsPrediction.php in vendor/phpspec/prophecy/src/Prophecy/Prediction/NoCallsPrediction.php
ObjectProphecy.php in vendor/phpspec/prophecy/src/Prophecy/Prophecy/ObjectProphecy.php

... See full list

4 string references to 'Call'
BinaryInstaller::determineBinaryCaller in vendor/composer/composer/src/Composer/Installer/BinaryInstaller.php
CreateWidgetTypeCallbackSniff::process in vendor/squizlabs/php_codesniffer/src/Standards/MySource/Sniffs/Objects/CreateWidgetTypeCallbackSniff.php
Processes this test, when one of its tokens is encountered.
XmlDumper::addMethodCalls in vendor/symfony/dependency-injection/Dumper/XmlDumper.php
XmlFileLoader::parseDefinition in vendor/symfony/dependency-injection/Loader/XmlFileLoader.php
Parses an individual Definition.

File

vendor/phpspec/prophecy/src/Prophecy/Call/Call.php, line 22

Namespace

Prophecy\Call
View source
class Call {
    private $methodName;
    private $arguments;
    private $returnValue;
    private $exception;
    
    /**
     * @var string|null
     */
    private $file;
    
    /**
     * @var int|null
     */
    private $line;
    
    /**
     * @var \SplObjectStorage<ArgumentsWildcard, int|false>
     */
    private $scores;
    
    /**
     * Initializes call.
     *
     * @param string      $methodName
     * @param array<mixed> $arguments
     * @param mixed       $returnValue
     * @param Exception|null $exception
     * @param null|string $file
     * @param null|int    $line
     */
    public function __construct($methodName, array $arguments, $returnValue, ?Exception $exception, $file, $line) {
        $this->methodName = $methodName;
        $this->arguments = $arguments;
        $this->returnValue = $returnValue;
        $this->exception = $exception;
        $this->scores = new \SplObjectStorage();
        if ($file) {
            $this->file = $file;
            $this->line = intval($line);
        }
    }
    
    /**
     * Returns called method name.
     *
     * @return string
     */
    public function getMethodName() {
        return $this->methodName;
    }
    
    /**
     * Returns called method arguments.
     *
     * @return array<mixed>
     */
    public function getArguments() {
        return $this->arguments;
    }
    
    /**
     * Returns called method return value.
     *
     * @return null|mixed
     */
    public function getReturnValue() {
        return $this->returnValue;
    }
    
    /**
     * Returns exception that call thrown.
     *
     * @return null|Exception
     */
    public function getException() {
        return $this->exception;
    }
    
    /**
     * Returns callee filename.
     *
     * @return string|null
     */
    public function getFile() {
        return $this->file;
    }
    
    /**
     * Returns callee line number.
     *
     * @return int|null
     */
    public function getLine() {
        return $this->line;
    }
    
    /**
     * Returns short notation for callee place.
     *
     * @return string
     */
    public function getCallPlace() {
        if (null === $this->file) {
            return 'unknown';
        }
        return sprintf('%s:%d', $this->file, $this->line);
    }
    
    /**
     * Adds the wildcard match score for the provided wildcard.
     *
     * @param ArgumentsWildcard $wildcard
     * @param false|int $score
     *
     * @return $this
     */
    public function addScore(ArgumentsWildcard $wildcard, $score) {
        $this->scores[$wildcard] = $score;
        return $this;
    }
    
    /**
     * Returns wildcard match score for the provided wildcard. The score is
     * calculated if not already done.
     *
     * @param ArgumentsWildcard $wildcard
     *
     * @return false|int False OR integer score (higher - better)
     */
    public function getScore(ArgumentsWildcard $wildcard) {
        if (isset($this->scores[$wildcard])) {
            return $this->scores[$wildcard];
        }
        return $this->scores[$wildcard] = $wildcard->scoreArguments($this->getArguments());
    }

}

Members

Title Sort descending Modifiers Object type Summary
Call::$arguments private property
Call::$exception private property
Call::$file private property
Call::$line private property
Call::$methodName private property
Call::$returnValue private property
Call::$scores private property
Call::addScore public function Adds the wildcard match score for the provided wildcard.
Call::getArguments public function Returns called method arguments.
Call::getCallPlace public function Returns short notation for callee place.
Call::getException public function Returns exception that call thrown.
Call::getFile public function Returns callee filename.
Call::getLine public function Returns callee line number.
Call::getMethodName public function Returns called method name.
Call::getReturnValue public function Returns called method return value.
Call::getScore public function Returns wildcard match score for the provided wildcard. The score is
calculated if not already done.
Call::__construct public function Initializes call.

API Navigation

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