You are here

public function PHPUnit_Framework_MockObject_Stub_ReturnCallback::toString in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/phpunit/phpunit-mock-objects/src/Framework/MockObject/Stub/ReturnCallback.php \PHPUnit_Framework_MockObject_Stub_ReturnCallback::toString()

Returns a string representation of the object.

Return value

string

Overrides PHPUnit_Framework_SelfDescribing::toString

File

vendor/phpunit/phpunit-mock-objects/src/Framework/MockObject/Stub/ReturnCallback.php, line 28

Class

PHPUnit_Framework_MockObject_Stub_ReturnCallback
@since Class available since Release 1.0.0

Code

public function toString() {
  if (is_array($this->callback)) {
    if (is_object($this->callback[0])) {
      $class = get_class($this->callback[0]);
      $type = '->';
    }
    else {
      $class = $this->callback[0];
      $type = '::';
    }
    return sprintf('return result of user defined callback %s%s%s() with the ' . 'passed arguments', $class, $type, $this->callback[1]);
  }
  else {
    return 'return result of user defined callback ' . $this->callback . ' with the passed arguments';
  }
}