Skip to content

Commit

Permalink
Supported only full ascii for types and langs in the list of values.
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Berthereau authored and Daniel Berthereau committed Jan 29, 2021
1 parent 998e7af commit 2c1cb43
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -344,26 +344,26 @@ public function value($term, array $options = [])
if (empty($options['type'])) {
$types = false;
} elseif (is_array($options['type'])) {
$types = array_fill_keys(array_map('mb_strtolower', $options['type']), true);
$types = array_fill_keys(array_map('strtolower', $options['type']), true);
} else {
$types = [mb_strtolower($options['type']) => true];
$types = [strtolower($options['type']) => true];
}

if (empty($options['lang'])) {
$langs = false;
} elseif (is_array($options['lang'])) {
$langs = array_fill_keys(array_map('mb_strtolower', $options['lang']), true);
$langs = array_fill_keys(array_map('strtolower', $options['lang']), true);
} else {
$langs = [mb_strtolower($options['lang']) => true];
$langs = [strtolower($options['lang']) => true];
}

// Match only the representations that fit all the criteria.
$matchingValues = [];
foreach ($this->values()[$term]['values'] as $value) {
if ($types && empty($types[mb_strtolower($value->type())])) {
if ($types && empty($types[strtolower($value->type())])) {
continue;
}
if ($langs && empty($langs[mb_strtolower($value->lang())])) {
if ($langs && empty($langs[strtolower($value->lang())])) {
continue;
}
$matchingValues[] = $value;
Expand Down

0 comments on commit 2c1cb43

Please sign in to comment.