public function validate($key): bool
    {
        if (!is_string($key) || strlen($key) === 0 || $key === '.' || $key === '..' || strpos($key, '/../') !== false || strpos($key, '/./') !== false || strpos($key, '/') === 0 || strpos($key, './') === 0 || strpos($key, '../') === 0 || substr($key, -2) === '/.' || substr($key, -3) === '/..' || substr($key, -1) === '/') {
            return false;
        }
        return preg_match("/^[a-z0-9\.\/\-\_]*$/", $key) === 1;
    }
public function validate($key): bool
    {
        if (!is_string($key) || strlen($key) === 0 || $key === '.' || $key === '..' || strpos($key, '/../') !== false || strpos($key, '/./') !== false || strpos($key, '/') === 0 || strpos($key, './') === 0 || strpos($key, '../') === 0 || substr($key, -2) === '/.' || substr($key, -3) === '/..' || substr($key, -1) === '/') {
            return false;
        }
        return preg_match("/^[a-z0-9\.\/\-\_]*$/", $key) === 1;
    }
public function validate ( $ key ) : bool { if ( ! is_string ( $ key ) || strlen ( $ key ) === 0 || $ key === '.' || $ key === '..' || strpos ( $ key , '/../' ) !== false || strpos ( $ key , '/./' ) !== false || strpos ( $ key , '/' ) === 0 || strpos ( $ key , './' ) === 0 || strpos ( $ key , '../' ) === 0 || substr ( $ key , - 2 ) === '/.' || substr ( $ key , - 3 ) === '/..' || substr ( $ key , - 1 ) === '/' ) { return false ; } return preg_match ( "/^[a-z0-9\.\/\-\_]*$/" , $ key ) === 1 ; }
Checks whether the key specified is valid.

@param string $key The key to check.
@return boolean TRUE if the key is valid, FALSE otherwise.
Checks whether the key specified is valid .