returns content for given path but only when it is of given type

@param   string            $path
@param   int               $type
@return  vfsStreamContent
555996
protected function getContentOfType($path, $type)
    {
        $content = $this->getContent($path);
        if (null !== $content && $content->getType() === $type) {
            return $content;
        }

        return null;
    }
298666
protected function filterContentsByType($contents, $type)
	{
		return Collection::make($contents)
			->where('type', $type)
			->fetch('path')
			->values()->all();
	}
677078
public function get_content_type($path){
        if( file_exists($path) ){
            $info = finfo_open(FILEINFO_MIME);
            $type = finfo_file($info, $path) ;
            finfo_close($info);
            return $type ?: '' ;
        }else{
            return '';
        }
    }
879134
public function dumpFile($path)
    {
        $path = $this->resolve($path);

        return $this->dump($this->getFileContents($path), $path);
    }
678942
protected function getFileContent($path)
    {
        if (false === file_exists($path)) {
            throw new \InvalidArgumentException(sprintf('File "%s" does not exist.', $path));
        }
        
        return file_get_contents($path);
    }
693316
protected function getType($path)
    {
        if (Str::endsWith($path, Type::CSV)) {
            return Type::CSV;
        } elseif (Str::endsWith($path, Type::ODS)) {
            return Type::ODS;
        } else {
            return Type::XLSX;
        }
    }
121008
public function getContents($path, $offset = 0, $length = null)
    {
        if ($length === null) {
            return $this->stat($path)->then(function ($stat) use ($path, $offset) {
                return $this->getContents($path, $offset, $stat['size']);
            });
        }

        return $this->open($path, 'r')->then(function ($fd) use ($offset, $length) {
            return $this->read($fd, $length, $offset)->always(function () use ($fd) {
                return $this->close($fd);
            });
        });
    }
367381
private function getStreamByPathScheme($path)
    {
        $scheme = parse_url($path, PHP_URL_SCHEME);

        return $this->streamManager->getStream($scheme);
    }
875648
public function getContent($type = 'default') {

		if(false === is_string($type)) {
			return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($type)), E_USER_ERROR);
		}

		if(false === is_dir($this -> directory -> getPath())) {
			return trigger_error(sprintf('Directory "%s" does not exists', $this -> directory -> getPath()), E_USER_ERROR);	
		}

		$files = array_values(array_diff(scandir($this -> directory -> getPath()), ['.', '..']));

		switch($type) {

			case 'array' : 
				return $files;

			case 'object' :
				return (object) $files;

			case 'json' :
				return json_encode($files);

			default : 

				$content = [];

				foreach($files as $file) {

					if(is_dir($this -> directory -> getPath() . $file)) {
						
						$content[] = new Directory($file);
						continue;
					}

					$content[] = new File($file);
				}

				return $content;
		}
	}
1327627
private function getContent(array $paths, $type)
    {
        $cacheKey = $this->getHashKey($paths);

        if ($this->cacheItemPool->hasItem($cacheKey)) {
            return $this->cacheItemPool->getItem($cacheKey)->get();
        }

        $minifier = 'js' === $type ? new JS() : new CSS();
        $content = '';

        foreach ($paths as $path) {
            foreach ($this->getFiles($path) as $file) {
                $file = $this->fileLocator->locate($file);

                if ($this->isDebug) {
                    $content .= file_get_contents($file);
                } else {
                    $minifier->add($file);
                }
            }
        }

        $content = $this->isDebug ? $content : $minifier->minify();

        $this->cacheItemPool->save($this->cacheItemPool->getItem($cacheKey)->set($content));

        return $content;
    }
233132
public function load($path, $type = null)
    {
        $dir = $this->locator->locate($path);

        $collection = new RouteCollection();
        $collection->addResource(new DirectoryResource($dir, '/\.php$/'));
        foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($dir), \RecursiveIteratorIterator::LEAVES_ONLY) as $file) {
            if (!$file->isFile() || '.php' !== substr($file->getFilename(), -4)) {
                continue;
            }

            if ($class = $this->findClass($file)) {
                $refl = new \ReflectionClass($class);
                if ($refl->isAbstract() || !$refl->implementsInterface('Pablodip\ModuleBundle\Module\ModuleInterface')) {
                    continue;
                }

                $collection->addCollection(parent::load($file->getRealPath(), $type));
            }
        }

        return $collection;
    }
688809
def get_content(path):
    """"""
    with codecs.open(abs_path(path), encoding='utf-8') as f:
        return f.read()
977046
public function get_filecontent($path) {
        $fullpath = $this->tempdir . '/' . $path;
        if (is_file($fullpath) && is_readable($fullpath)) {
            return file_get_contents($fullpath);
        }
        return false;
    }
210893
final public function getFileContents($path)
    {
        return $this->getRepositoryContent()->download(
            $this->settings->getVendor(),
            $this->settings->getPackage(),
            $path,
            $this->settings->getReference()
        );
    }
1361530
public function getFileContent($container, $path, $local_file = '', $content_as_base = true)
    {
        $file = static::addContainerToName($container, $path);
        if (!is_file($file)) {
            throw new NotFoundException("File '$path' does not exist in storage.");
        }
        $data = file_get_contents($file);
        if (false === $data) {
            throw new InternalServerErrorException('Failed to retrieve file content.');
        }
        if (!empty($local_file)) {
            // write to local or temp file
            $result = file_put_contents($local_file, $data);
            if (false === $result) {
                throw new InternalServerErrorException('Failed to put file content as local file.');
            }

            return '';
        } else {
            // get content as raw or encoded as base64 for transport
            if ($content_as_base) {
                $data = base64_encode($data);
            }

            return $data;
        }
    }
384886
private function assetify(string $file, string $type, string $path): string
    {
        if (in_array(substr($file, 0, 1), ["'", '"'], true)) {
            $file = trim($file, "'\"");
        } else {
            return "{{ {$file} }}";
        }

        if (substr($file, 0, 8) === "https://") {
            return $file;
        }

        if (substr($file, 0, 7) === "http://") {
            return $file;
        }

        if (substr($file, 0, 1) !== "/") {
            $path = trim($path, "/");
            if (strlen($path) > 0) {
                $path = "/{$path}/";
            } else {
                $path = "/";
            }
            $file = $path . $file;
        }

        if (substr($file, (strlen($type) + 1) * -1) !== ".{$type}") {
            $file .= ".{$type}";
        }

        return $file;
    }
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));
    }