1 | <?php |
||
30 | abstract class AbstractResolver implements ResolverInterface |
||
31 | { |
||
32 | /** @var array */ |
||
33 | private $cache = []; |
||
34 | |||
35 | /** @var bool */ |
||
36 | private $cacheEnabled = true; |
||
37 | |||
38 | /** |
||
39 | * @param bool $cacheEnabled |
||
40 | */ |
||
41 | 154 | public function __construct($cacheEnabled = true) |
|
45 | |||
46 | /** |
||
47 | * Resolves an alias into a Delta. |
||
48 | * |
||
49 | * @param string $alias |
||
50 | * @param Collection $collection |
||
51 | * |
||
52 | * @return DeltaInterface|null |
||
|
|||
53 | * |
||
54 | * @throws ResolverException |
||
55 | */ |
||
56 | 105 | final public function resolve($alias, Collection $collection) |
|
72 | |||
73 | /** |
||
74 | * Gets an alias from the cache. Returns false if nothing could be found, a Delta if the alias was previously |
||
75 | * resolved to a version, and null if the alias couldn't be resolved in a previous call. |
||
76 | * |
||
77 | * @param string $alias |
||
78 | * @param Collection $collection |
||
79 | * |
||
80 | * @return bool|null|DeltaInterface |
||
81 | */ |
||
82 | 105 | private function cacheGet($alias, Collection $collection) |
|
95 | |||
96 | /** |
||
97 | * Saves the result of resolving an alias against a given collection into the cache. |
||
98 | * |
||
99 | * @param string $alias |
||
100 | * @param \Baleen\Migrations\Delta\Collection\Collection $collection |
||
101 | * @param null|DeltaInterface $result |
||
102 | * |
||
103 | * @return void |
||
104 | */ |
||
105 | 101 | private function cacheSet($alias, $collection, $result) |
|
117 | |||
118 | /** |
||
119 | * @inheritdoc |
||
120 | */ |
||
121 | 146 | final public function clearCache(Collection $collection = null) |
|
130 | |||
131 | /** |
||
132 | * doResolve |
||
133 | * |
||
134 | * @param string $alias |
||
135 | * @param Collection $collection |
||
136 | * |
||
137 | * @return DeltaInterface|null |
||
138 | */ |
||
139 | abstract protected function doResolve($alias, Collection $collection); |
||
140 | } |
||
141 |
This check compares the return type specified in the
@return
annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.