Problem/Motivation
Some of the code in the recently added gate plugin can be simplified.
Proposed resolution
There are three tests like this:
if (empty($this->configuration['valid_keys']) && !array_key_exists('valid_keys', $this->configuration)) {
throw new MigrateException('Gate plugin is missing valid_keys configuration.');
}
Just the second condition is enough:
if (!array_key_exists('valid_keys', $this->configuration)) {
throw new MigrateException('Gate plugin is missing valid_keys configuration.');
}
The line
$valid_keys = is_array($this->configuration['valid_keys']) ? $this->configuration['valid_keys'] : [$this->configuration['valid_keys']];
can be replaced with
$valid_keys = (array) $this->configuration['valid_keys'];
Remaining tasks
User interface changes
None
API changes
None
Data model changes
None
Comments
Comment #2
matroskeenComment #4
v.kydyba commentedComment #6
matroskeen2 more conditions to fix :)
Comment #7
v.kydyba commentedComment #8
matroskeenComment #10
matroskeenLooks good to me. Thanks!