Returns the contents of a file from a URI path

@param string $path

@return \Twig\Markup
555134
public function includeFile(string $path): \Twig\Markup
    {
        return Template::raw(
            Twigpack::$plugin->manifest->getFile($path)
        );
    }
1068140
protected function getContents(/*# string */ $path)/*# string */
    {
        // read in file
        $contents = @file_get_contents($path);

        // failed
        if (false === $contents) {
            throw new NotFoundException(
                Message::get(Message::CONFIG_FILE_NOTFOUND, $path),
                Message::CONFIG_FILE_NOTFOUND
            );
        }
        return $contents;
    }
752423
public function parse(string $path): ?ViewPath
    {
        $this->validatePath($path);

        //Cutting extra symbols (see Twig)
        $filename = preg_replace(
            '#/{2,}#',
            '/',
            str_replace('\\', '/', (string)$path)
        );

        $namespace = $this->defaultNamespace;
        if (strpos($filename, '.') === false) {
            //Force default extension
            $filename .= '.' . $this->extension;
        } elseif (!$this->match($filename)) {
            return null;
        }

        if (strpos($filename, LoaderInterface::NS_SEPARATOR) !== false) {
            list($namespace, $filename) = explode(LoaderInterface::NS_SEPARATOR, $filename);
        }

        //Twig like namespaces
        if (isset($filename[0]) && $filename[0] == '@') {
            $separator = strpos($filename, '/');
            if ($separator === false) {
                throw new PathException(sprintf('Malformed view path"%s" (expecting "@namespace/name").', $path));
            }

            $namespace = substr($filename, 1, $separator - 1);
            $filename = substr($filename, $separator + 1);
        }

        return new ViewPath(
            $namespace,
            $this->fetchName($filename),
            $filename
        );
    }
1226936
public function getMetadata($path)
    {
        $url = self::BASE_URI.$this->getPathUnderRootDrive($path);

        return $this->getResponse('GET', $url);
    }
243011
private function get_folder_contents( $path ) {

		$items = array();
		$uid   = opendir( $path );
		if ( $uid ) {
			return $this->load_folder_items( $uid, $path );
		}

		return $items;
	}
776776
protected function getModuleTemplateContent($path)
    {
        $path = $this->getModuleTemplatePath($path);
        $content = file_get_contents($path);
        return $content;
    }
1349912
public function withPath(string $path): URI
    {
        $result = clone $this;
        $result->path = $this->filterPath($path);

        return $result;
    }
634486
protected function parse($path)
    {
        $output = file_get_contents($path);
        $output = explode("\n", $output);
        $output = array_map('rtrim', $output);

        return $output;
    }
121297
protected function parseFeature($path)
    {
        $filename = $this->findRelativePath($path);
        $content = file_get_contents($path);
        $feature = $this->parser->parse($content, $filename);

        return $feature;
    }
440789
protected function readContent(/*# string */ $path)/*# : string */
    {
        $str = file_get_contents($path);

        if (is_string($str)) {
            return $str;
        } else {
            throw new LogicException(
                Message::get(Message::ENV_READ_FAIL, $path),
                Message::ENV_READ_FAIL
            );
        }
    }
582438
public static function contents($path)
    {
        if (self::exists($path)) {
            return trim(file_get_contents($path));
        }

        throw new FileDoesNotExistException(sprintf('%s is not a valid file', $path));
    }
409441
public function sharedGet($path)
    {
        $contents = '';

        $handle = fopen($path, 'rb');

        if ($handle) {
            try {
                if (flock($handle, LOCK_SH)) {
                    clearstatcache(true, $path);

                    $contents = fread($handle, $this->size($path) ?: 1);

                    flock($handle, LOCK_UN);
                }
            } finally {
                fclose($handle);
            }
        }

        return $contents;
    }
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);
    }
1113625
public function getPhpContents($path)
    {
        $fullPath = $this->concatPaths($path);

        if (file_exists($fullPath) && strtolower(substr($fullPath, -4)) == '.php') {
            $phpContents = include($fullPath);
            return $phpContents;
        }

        return false;
    }
949276
public function get(string $path): SplFileInfo
    {
        $path = ltrim($path, '\\/');
        foreach ($this->assets as $asset) {
            if ($asset->getRelativePathname() === $path) {
                return $asset;
            }
        }
        throw new NotFoundHttpException(sprintf('Unknown asset: %s', $path));
    }
507601
public static function getFolder($path)
    {
        if (!is_dir($path)) return null;

        $path = rtrim($path, '/') . '/';

        $array = array('file' => array(), 'folder' => array());
        $dir_obj = opendir($path);

        while ($dir = readdir($dir_obj)) {
            if ($dir != '.' && $dir != '..') {
                $file = $path . $dir;
                if (is_dir($file)) {
                    $array['folder'][] = $dir;
                } elseif (is_file($file)) {
                    $array['file'][] = $dir;
                }

            }
        }
        closedir($dir_obj);
        return $array;

    }
962814
public function svg( $path = null )
	{
		if( file_exists( $this->imagePath( $path ))) {
			return file_get_contents( $this->imagePath( $path ));
		}
	}