public function authorized($prefix, $path)
    {
        // Check blocked resources
        foreach ($this->blocked as $rule) {
            if (preg_match($rule, $path)) {
                return false;
            }
        }

        // Check allowed filesystems
        foreach ($this->allowedPrefixes as $allowedPrefix) {
            if ($allowedPrefix === $prefix) {
                return true;
            }
        }

        // Check allowed resources
        foreach ($this->allowed as $rule) {
            if (preg_match($rule, $path)) {
                return true;
            }
        }

        return false;
    }
public function authorized($prefix, $path)
    {
        // Check blocked resources
        foreach ($this->blocked as $rule) {
            if (preg_match($rule, $path)) {
                return false;
            }
        }

        // Check allowed filesystems
        foreach ($this->allowedPrefixes as $allowedPrefix) {
            if ($allowedPrefix === $prefix) {
                return true;
            }
        }

        // Check allowed resources
        foreach ($this->allowed as $rule) {
            if (preg_match($rule, $path)) {
                return true;
            }
        }

        return false;
    }
public function authorized ( $ prefix , $ path ) { // Check blocked resources foreach ( $ this -> blocked as $ rule ) { if ( preg_match ( $ rule , $ path ) ) { return false ; } } // Check allowed filesystems foreach ( $ this -> allowedPrefixes as $ allowedPrefix ) { if ( $ allowedPrefix === $ prefix ) { return true ; } } // Check allowed resources foreach ( $ this -> allowed as $ rule ) { if ( preg_match ( $ rule , $ path ) ) { return true ; } } return false ; }
Check if you can do something with the given file or directory.

@param string $prefix
@param string $path

@return bool
Check if you can do something with the given file or directory .