1 | <?php |
||
15 | abstract class AbstractMockingStrategy implements MockingStrategyInterface |
||
16 | { |
||
17 | /** |
||
18 | * @var string |
||
19 | */ |
||
20 | private $mockType; |
||
21 | |||
22 | /** |
||
23 | * @param string $fqcn |
||
24 | * @return object |
||
25 | * |
||
26 | * @throws MockNotCreatedException |
||
27 | */ |
||
28 | 40 | public function build(string $fqcn) |
|
42 | |||
43 | /** |
||
44 | * @param object $mock |
||
45 | * @param StubSet $stubs |
||
46 | * @return void |
||
47 | * |
||
48 | * @throws NotImplementedException |
||
49 | * @throws InvalidArgumentException |
||
50 | */ |
||
51 | 9 | public function decorate($mock, StubSet $stubs) |
|
57 | |||
58 | /** |
||
59 | * @param object $mock |
||
60 | * @return object |
||
61 | * |
||
62 | * @throws NotImplementedException |
||
63 | * @throws InvalidArgumentException |
||
64 | */ |
||
65 | 23 | public function get($mock) |
|
71 | |||
72 | /** |
||
73 | * @return string |
||
74 | * |
||
75 | * @throws NotImplementedException |
||
76 | */ |
||
77 | 19 | public function getMockType(): string |
|
83 | |||
84 | /** |
||
85 | * @param string $fqcn |
||
86 | */ |
||
87 | 5 | final protected function setMockType(string $fqcn) |
|
91 | |||
92 | /** |
||
93 | * @param object $mock |
||
94 | * |
||
95 | * @throws NotImplementedException |
||
96 | * @throws InvalidArgumentException |
||
97 | */ |
||
98 | 26 | final protected function checkMockType($mock) |
|
112 | |||
113 | /** |
||
114 | * @param string $fqcn |
||
115 | * @return object |
||
116 | */ |
||
117 | abstract protected function doBuild(string $fqcn); |
||
118 | |||
119 | /** |
||
120 | * @param object $mock |
||
121 | * @param StubSet $stubs |
||
122 | * @return void |
||
123 | */ |
||
124 | abstract protected function doDecorate($mock, StubSet $stubs); |
||
125 | |||
126 | /** |
||
127 | * @param object $mock |
||
128 | * @return object |
||
129 | */ |
||
130 | abstract protected function doGet($mock); |
||
131 | |||
132 | /** |
||
133 | * @return void |
||
134 | * |
||
135 | * @throws NotImplementedException |
||
136 | */ |
||
137 | 45 | private function verifyMockType() |
|
143 | } |
||
144 |