Open stream from a source
A source can be anything: for instance a db, a file, or a socket

@param String $path
@return void
@throws \Palmabit\Library\Exceptions\CannotOpenFileException
767338
public function open($path)
  {
    $this->convertToLF($path);
    $this->spl_file_object = new SplFileObject($path);
    $this->spl_file_object->setCsvControl($this->delimiter);
    $this->columns_name = $this->spl_file_object->fgetcsv();
  }
1182070
public function stream_open($path, $mode, $options, &$opened_path)
	{
		$this->currentString = &StringController::getRef(str_replace('string://', '', $path));

		if ($this->currentString)
		{
			$this->len = strlen($this->currentString);
			$this->pos = 0;
			$this->stat = $this->url_stat($path, 0);

			return true;
		}
		else
		{
			return false;
		}
	}
766166
public function mkdir( $path )
	{
		try {
			$this->fs->makeDirectory( $path );
		} catch( \Exception $e ) {
			throw new Exception( $e->getMessage(), 0, $e );
		}
	}
1191293
public function fromPath($path)
    {
        $mimetype = null;

        if (static::isSupported())
        {
            if (!is_file($path)) {
                throw new \RuntimeException('File not found at '.$path);
            }

            if (!is_readable($path)) {
                throw new \RuntimeException('File not readable at '.$path);
            }

            if ($finfo = new \finfo(FILEINFO_MIME_TYPE, $this->getConfig()->magic_file)) {
                $mimetype = $finfo->file($path);
            }
        }

        return $mimetype;
    }
647868
public function stream_open($path, $mode, $options, &$opened_path)
    {
        $contents = self::cache()->get($path);
        $fileExists = (false !== $contents);

        switch ($mode) {
            case 'r':
            case 'rb':
            case 'r+':
            case 'rb+':
                if (! $fileExists) {
                    return false;
                }

                $this->fd = fopen('php://memory', "wb+");
                fwrite($this->fd, $contents);
                fseek($this->fd, 0, SEEK_SET);
                break;

            case 'w':
            case 'wb':
            case 'w+':
            case 'wb+':
                $this->fd = fopen('php://memory', "wb+");
                break;

            case 'a':
            case 'ab':
            case 'a+':
            case 'ab+':
                $this->fd = fopen('php://memory', "wb+");

                if ($fileExists) {
                    fwrite($this->fd, $contents);
                    fseek($this->fd, 0, SEEK_END);
                }
                break;

            default:
                return false;
        }

        $this->path = $path;
        $this->mode = $mode;

        return true;
    }
736624
private function loadFile(string $path)
    {
        if (!file_exists($path)) {
            throw new Exception('Configuration file "' . $path . '" is not found');
        }

        if (!is_readable($path)) {
            throw new Exception('Configuration file "' . $path . '" is not readable');
        }

        // Include file
        $content = include $path;

        if (!\is_array($content)) {
            throw new Exception("Passed file \"$path\" is not array");
        }

        return $content;
    }
1073731
private function openPath($path)
    {
        $url = (array) parse_url($path) + [
            'scheme' => '',
            'path' => '',
            'host' => ''
        ];
        $this->protocol = $url['scheme'];
        $this->file = ltrim($url['path'], '/');
        $client = self::getClient($this->protocol);
        $this->bucket = $client->bucket($url['host']);
        return $client;
    }
624233
public function unlink($path)
    {
        $stream = $this->createStream($path);

        try {
            $stream->open($this->createStreamMode('w+'));
        } catch (\RuntimeException $e) {
            return false;
        }

        return $stream->unlink();
    }
578599
private function loadFromFile($path)
    {
        if ( ! is_file($path)) {
            return;
        }
        
        $config = require_once $path;
        
        if (is_array($config)) {
            $this->config = $config;
        }
    }
1044459
protected function loadFile($path)
    {
        if (pathinfo($path, PATHINFO_EXTENSION) !== 'php') {
            throw new \InvalidArgumentException('Can only parse files with ".php" extensions');
        }
        if (!file_exists($path)) {
            throw new \InvalidArgumentException(sprintf('Failed to find \'%s\' file.', $path));
        }

        return file_get_contents($path);
    }
864628
private static function detectStream($path)
    {
        $stream = 'file';

        if (false !== strpos($path, '://')) {
            $parts  = explode('://', $path);
            $stream = $parts[0];
        }

        return $stream;
    }
402245
public function readStream($path)
    {
        if ( ! $data = $this->read($path)) {
            return false;
        }

        $stream = \fopen('php://temp', 'w+b');
        \fwrite($stream, $data['contents']);
        \rewind($stream);
        $data['stream'] = $stream;
        unset($data['contents']);

        return $data;
    }
499678
public function stream_open( $path, $mode, $options, &$opened_path )
    {
        $this->string   = substr( $path, strpos( $path, '//' ) + 2 );
        $this->position = 0;
        $this->length   = strlen( $this->string );

        return true;
    }
623474
protected function setSourcePath($path)
    {
        if ($this->sourcePath === self::DUMMY_PATH) {
            $this->sourcePath = $path;
        } elseif ($this->sourcePath === self::EMPTY_PATH) {
            $this->sourcePath = null;
        }
    }
464111
public function loadFeedFile($path){
        if (file_exists($path)){
            if (strpos($path, '/') == 0){
                $this->feedContent = file_get_contents($path);
            } else {
                $url = __DIR__.'/../../'.$path; //todo: change to current install dir
                $this->feedContent = file_get_contents($url);
            }
            $this->feedMD5 = base64_encode(md5($this->feedContent,true));
        }
    }
86005
private function load_file( $path ) {
		if ( $path && is_readable( $path ) ) {
			include_once( $path );
			$success = true;
		}

		return ! ( empty( $success ) ) ? true : false;
	}
153768
@Override
	public final void open(String path) throws Exception {
	    // ZAP: Added log statement.
		logger.debug("open " + path);
	    setDatabaseServer(createDatabaseServer(path));
	    notifyListenersDatabaseOpen(internalDatabaseListeners, getDatabaseServer());
	    notifyListenersDatabaseOpen(getDatabaseServer());
	}