Passed
Branch 2.0 (d24509)
by Donald
02:04
created

getAnswerCallback()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
c 0
b 0
f 0
rs 9.4285
cc 1
eloc 4
nc 1
nop 2
1
<?php namespace Chekote\Phake\Stubber\Answers;
2
3
use Chekote\Phake\Exception\UnMockedResponseException;
4
use Phake_Stubber_IAnswer;
5
6
/**
7
 * Throws an Exception stating the class and method name that was called.
8
 */
9
class UnMockedResponseExceptionAnswer implements Phake_Stubber_IAnswer
10
{
11
    /**
12
     * {@inheritdoc}
13
     */
14
    public function getAnswerCallback($context, $method)
15
    {
16
        $class = get_parent_class($context);
17
18
        return function () use ($class, $method) {
19
            throw new UnMockedResponseException(
20
                "$class::$method was called on mock without having its response mocked"
21
            );
22
        };
23
    }
24
25
    /**
26
     * {@inheritdoc}
27
     */
28
    public function processAnswer($answer)
29
    {
30
    }
31
}
32