Failed Conditions
Push — complex_graph_v3 ( 6aae2b )
by Donald
02:29
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
cc 1
eloc 4
nc 1
nop 2
dl 0
loc 7
rs 10
c 0
b 0
f 0
1
<?php namespace Unit\Chekote\Phake\Stubber\Answers;
2
3
use Unit\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