1 | <?php |
||
16 | abstract class AbstractMockingStrategy implements MockingStrategyInterface |
||
17 | { |
||
18 | /** |
||
19 | * @var string |
||
20 | */ |
||
21 | private $mockType; |
||
22 | |||
23 | /** |
||
24 | * @param string $fqcn |
||
25 | * @return object |
||
26 | * |
||
27 | * @throws MockNotCreatedException |
||
28 | */ |
||
29 | 89 | public function build(string $fqcn) |
|
43 | |||
44 | /** |
||
45 | * @param object $mock |
||
46 | * @param StubSet $stubs |
||
47 | * @return void |
||
48 | * |
||
49 | * @throws NotImplementedException |
||
50 | * @throws InvalidArgumentException |
||
51 | */ |
||
52 | 89 | public function decorate($mock, StubSet $stubs) |
|
61 | |||
62 | /** |
||
63 | * @param object $mock |
||
64 | * @return object |
||
65 | * |
||
66 | * @throws NotImplementedException |
||
67 | * @throws InvalidArgumentException |
||
68 | */ |
||
69 | 50 | public function get($mock) |
|
75 | |||
76 | /** |
||
77 | * @return string |
||
78 | * |
||
79 | * @throws NotImplementedException |
||
80 | */ |
||
81 | 23 | public function getMockType(): string |
|
87 | |||
88 | /** |
||
89 | * @param string $fqcn |
||
90 | */ |
||
91 | 7 | final protected function setMockType(string $fqcn) |
|
95 | |||
96 | /** |
||
97 | * @param object $mock |
||
98 | * |
||
99 | * @throws NotImplementedException |
||
100 | * @throws InvalidArgumentException |
||
101 | */ |
||
102 | 89 | final protected function checkMockType($mock) |
|
116 | |||
117 | /** |
||
118 | * @param string $fqcn |
||
119 | * @return object |
||
120 | */ |
||
121 | abstract protected function doBuild(string $fqcn); |
||
122 | |||
123 | /** |
||
124 | * @param object $mock |
||
125 | * @param Stub $stub |
||
126 | * @return void |
||
127 | */ |
||
128 | abstract protected function doDecorate($mock, Stub $stub); |
||
129 | |||
130 | /** |
||
131 | * @param object $mock |
||
132 | * @return object |
||
133 | */ |
||
134 | abstract protected function doGet($mock); |
||
135 | |||
136 | /** |
||
137 | * @return void |
||
138 | * |
||
139 | * @throws NotImplementedException |
||
140 | */ |
||
141 | 90 | private function verifyMockType() |
|
147 | } |
||
148 |