1
0
Fork 0
php-language-server/src/ContentRetriever/FileSystemContentRetriever.php

25 lines
616 B
PHP
Raw Normal View History

2016-12-08 00:51:32 +00:00
<?php
declare(strict_types = 1);
namespace LanguageServer\ContentRetriever;
2017-01-30 10:42:17 +00:00
use Rx\Observable;
2016-12-08 00:51:32 +00:00
use function LanguageServer\uriToPath;
/**
* Retrieves document content from the file system
*/
class FileSystemContentRetriever implements ContentRetriever
{
/**
* Retrieves the content of a text document identified by the URI from the file system
*
* @param string $uri The URI of the document
2017-01-30 10:42:17 +00:00
* @return Observable Emits the content as a string
2016-12-08 00:51:32 +00:00
*/
2017-01-30 10:42:17 +00:00
public function retrieve(string $uri): Observable
2016-12-08 00:51:32 +00:00
{
2017-01-30 10:42:17 +00:00
return Observable::just(file_get_contents(uriToPath($uri)));
2016-12-08 00:51:32 +00:00
}
}