1 | <?php |
||
8 | class FeaturedFlagsImpl implements FeaturedFlags |
||
9 | { |
||
10 | protected $_pdo; |
||
11 | protected $_redis; |
||
12 | protected $_date; |
||
13 | |||
14 | CONST TABLE_NAME = 'featured_flags'; |
||
15 | CONST ISENABLED_PREFIX = 'isEnabled_'; |
||
16 | CONST GETVALUES_PREFIX = 'getEnabledValues_'; |
||
17 | |||
18 | /** |
||
19 | * FeaturedFlags constructor. |
||
20 | * @param PDO $pdo |
||
21 | * @param Redis|null $redis |
||
22 | * @param string|null $date |
||
23 | */ |
||
24 | public function __construct(PDO $pdo, Redis $redis = null, $date = null) |
||
34 | |||
35 | /** |
||
36 | * @param PDO $pdo |
||
37 | * @param Redis $redis |
||
38 | * @return FeaturedFlags |
||
39 | */ |
||
40 | public static function getInstance(PDO $pdo, Redis $redis = null) { |
||
43 | |||
44 | /** |
||
45 | * @param string $flagName |
||
46 | * @param array $filterParams |
||
47 | * @return boolean |
||
48 | */ |
||
49 | public function isEnabled($flagName, $filterParams = null) |
||
62 | |||
63 | /** |
||
64 | * @param $flagName |
||
65 | * @param $filterParams |
||
66 | * @return array |
||
67 | */ |
||
68 | public function getEnabledValues($flagName, $filterParams = null) |
||
81 | |||
82 | /** |
||
83 | * @param Redis $redis |
||
84 | */ |
||
85 | public function setRedis(Redis $redis) |
||
89 | |||
90 | /** |
||
91 | * @param string $flagName |
||
92 | * @param array $filterParams |
||
93 | * @return FeaturedFlagsModel |
||
94 | */ |
||
95 | private function _getBDFlag($flagName, $filterParams) |
||
107 | |||
108 | /** |
||
109 | * @param string $cacheKey |
||
110 | * @return FeaturedFlagsModel |
||
111 | */ |
||
112 | private function _getCacheModel($cacheKey) |
||
121 | |||
122 | /** |
||
123 | * @param string $cacheKey |
||
124 | * @param FeaturedFlagsModel $featuredFlagsModel |
||
125 | */ |
||
126 | private function _setCacheKey($cacheKey, FeaturedFlagsModel $featuredFlagsModel) |
||
133 | |||
134 | /** |
||
135 | * @param string $flagName |
||
136 | * @return array |
||
137 | */ |
||
138 | private function _getDBFlagsData($flagName) |
||
164 | |||
165 | /** |
||
166 | * @return string |
||
167 | */ |
||
168 | private function _getDate() { |
||
175 | |||
176 | /** |
||
177 | * @param array $flagParams |
||
178 | * @param array $filterParams |
||
179 | * @return boolean |
||
180 | */ |
||
181 | private function _compareParams($flagParams, $filterParams) |
||
191 | |||
192 | /** |
||
193 | * @param string $flagParamsJson |
||
194 | * @param array $filterParams |
||
195 | * @return boolean |
||
196 | */ |
||
197 | private function _checkParams($flagParamsJson, $filterParams = null) |
||
210 | |||
211 | /** |
||
212 | * @param string $flagName |
||
213 | * @param array|null $filterParams |
||
214 | * @return boolean |
||
215 | */ |
||
216 | private function _getKey($flagName, $filterParams = null) |
||
220 | |||
221 | /** |
||
222 | * @param string $endDate |
||
223 | * @return int |
||
224 | */ |
||
225 | private function _getTimeout($endDate) |
||
233 | } |
||
234 |
This check looks at variables that have been passed in as parameters and are passed out again to other methods.
If the outgoing method call has stricter type requirements than the method itself, an issue is raised.
An additional type check may prevent trouble.