3 * This file is part of the PHPUnit_MockObject package.
5 * (c) Sebastian Bergmann <sebastian@phpunit.de>
7 * For the full copyright and license information, please view the LICENSE
8 * file that was distributed with this source code.
12 * @since Class available since Release 1.0.0
14 class PHPUnit_Framework_MockObject_Stub_ReturnCallback implements PHPUnit_Framework_MockObject_Stub
18 public function __construct($callback)
20 $this->callback = $callback;
23 public function invoke(PHPUnit_Framework_MockObject_Invocation $invocation)
25 return call_user_func_array($this->callback, $invocation->parameters);
28 public function toString()
30 if (is_array($this->callback)) {
31 if (is_object($this->callback[0])) {
32 $class = get_class($this->callback[0]);
35 $class = $this->callback[0];
40 'return result of user defined callback %s%s%s() with the ' .
47 return 'return result of user defined callback ' . $this->callback .
48 ' with the passed arguments';