Imbo\EventListener\ExifMetadata::filterProperties PHP Method

filterProperties() protected method

Filter out any unwanted properties
protected filterProperties ( array $properties ) : array
$properties array An array of properties to filter
return array A filtered array of properties
    protected function filterProperties(array $properties)
    {
        $tags = array_fill_keys($this->allowedTags, 1);
        if (empty($tags) || isset($tags['*'])) {
            return $properties;
        }
        $filtered = [];
        foreach ($properties as $key => $value) {
            if (isset($tags[$key])) {
                $filtered[$key] = $value;
                continue;
            }
            if (($pos = strpos($key, ':')) !== false) {
                $namespace = substr($key, 0, $pos);
                if (isset($tags[$namespace . ':*'])) {
                    $filtered[$key] = $value;
                    continue;
                }
            }
        }
        return $filtered;
    }