public function ImagemagickExecArguments::find in ImageMagick 8.3
Same name and namespace in other branches
- 8.2 src/ImagemagickExecArguments.php \Drupal\imagemagick\ImagemagickExecArguments::find()
Returns an array of the indexes of arguments matching specific criteria.
Parameters
string $regex: The regular expression pattern to be matched in the argument.
int $mode: (optional) If set, limits the search to the mode of the argument. Defaults to NULL.
array $info: (optional) If set, limits the search to the arguments whose $info array key/values match the key/values specified. Defaults to an empty array.
Return value
array Returns an array with the matching arguments.
File
- src/
ImagemagickExecArguments.php, line 178
Class
- ImagemagickExecArguments
- Stores arguments for execution of ImageMagick/GraphicsMagick commands.
Namespace
Drupal\imagemagickCode
public function find(string $regex, int $mode = NULL, array $info = []) : array {
$ret = [];
foreach ($this->arguments as $i => $a) {
if ($mode !== NULL && $a['mode'] !== $mode) {
continue;
}
if (!empty($info)) {
$intersect = array_intersect($info, $a['info']);
if ($intersect != $info) {
continue;
}
}
if (preg_match($regex, $a['argument']) === 1) {
$ret[$i] = $a;
}
}
return $ret;
}