private function shouldOptimizeByExtension(string $extension, array $validExtensions): bool
    {
        return \in_array($extension === 'jpeg' ? 'jpg' : $extension, $validExtensions, true);
    }
private function shouldOptimizeByExtension(string $extension, array $validExtensions): bool
    {
        return \in_array($extension === 'jpeg' ? 'jpg' : $extension, $validExtensions, true);
    }
private function shouldOptimizeByExtension ( string $ extension , array $ validExtensions ) : bool { return \ in_array ( $ extension === 'jpeg' ? 'jpg' : $ extension , $ validExtensions , true ) ; }
Checks if extension is in array of extensions

@param string $extension
@param array  $validExtensions

@return bool
Checks if extension is in array of extensions