1 | <?php |
||
23 | class MockConfigurationBuilder |
||
24 | { |
||
25 | protected $name; |
||
26 | protected $blackListedMethods = array( |
||
27 | '__call', |
||
28 | '__callStatic', |
||
29 | '__clone', |
||
30 | '__wakeup', |
||
31 | '__set', |
||
32 | '__get', |
||
33 | '__toString', |
||
34 | '__isset', |
||
35 | '__destruct', |
||
36 | |||
37 | // below are reserved words in PHP |
||
38 | "__halt_compiler", "abstract", "and", "array", "as", |
||
39 | "break", "callable", "case", "catch", "class", |
||
40 | "clone", "const", "continue", "declare", "default", |
||
41 | "die", "do", "echo", "else", "elseif", |
||
42 | "empty", "enddeclare", "endfor", "endforeach", "endif", |
||
43 | "endswitch", "endwhile", "eval", "exit", "extends", |
||
44 | "final", "for", "foreach", "function", "global", |
||
45 | "goto", "if", "implements", "include", "include_once", |
||
46 | "instanceof", "insteadof", "interface", "isset", "list", |
||
47 | "namespace", "new", "or", "print", "private", |
||
48 | "protected", "public", "require", "require_once", "return", |
||
49 | "static", "switch", "throw", "trait", "try", |
||
50 | "unset", "use", "var", "while", "xor" |
||
51 | ); |
||
52 | |||
53 | protected $php7SemiReservedKeywords = [ |
||
54 | "callable", "class", "trait", "extends", "implements", "static", "abstract", "final", |
||
55 | "public", "protected", "private", "const", "enddeclare", "endfor", "endforeach", "endif", |
||
56 | "endwhile", "and", "global", "goto", "instanceof", "insteadof", "interface", "namespace", "new", |
||
57 | "or", "xor", "try", "use", "var", "exit", "list", "clone", "include", "include_once", "throw", |
||
58 | "array", "print", "echo", "require", "require_once", "return", "else", "elseif", "default", |
||
59 | "break", "continue", "switch", "yield", "function", "if", "endswitch", "finally", "for", "foreach", |
||
60 | "declare", "case", "do", "while", "as", "catch", "die", "self", "parent", |
||
61 | ]; |
||
62 | |||
63 | protected $whiteListedMethods = array(); |
||
64 | protected $instanceMock = false; |
||
65 | protected $parameterOverrides = array(); |
||
66 | |||
67 | protected $mockOriginalDestructor = false; |
||
68 | protected $targets = array(); |
||
69 | |||
70 | |||
71 | 428 | public function __construct() |
|
72 | { |
||
73 | 428 | if (version_compare(PHP_VERSION, '7.0.0') >= 0) { |
|
74 | $this->blackListedMethods = array_diff($this->blackListedMethods, $this->php7SemiReservedKeywords); |
||
75 | } |
||
76 | 428 | } |
|
77 | |||
78 | 399 | public function addTarget($target) |
|
84 | |||
85 | 6 | public function addTargets($targets) |
|
93 | |||
94 | 21 | public function setName($name) |
|
99 | |||
100 | 12 | public function addBlackListedMethod($blackListedMethod) |
|
105 | |||
106 | 424 | public function addBlackListedMethods(array $blackListedMethods) |
|
113 | |||
114 | public function setBlackListedMethods(array $blackListedMethods) |
||
119 | |||
120 | public function addWhiteListedMethod($whiteListedMethod) |
||
125 | |||
126 | public function addWhiteListedMethods(array $whiteListedMethods) |
||
133 | |||
134 | 16 | public function setWhiteListedMethods(array $whiteListedMethods) |
|
139 | |||
140 | 12 | public function setInstanceMock($instanceMock) |
|
144 | |||
145 | 426 | public function setParameterOverrides(array $overrides) |
|
149 | |||
150 | 414 | public function setMockOriginalDestructor($mockDestructor) |
|
155 | |||
156 | 426 | public function getMockConfiguration() |
|
168 | } |
||
169 |