Jarves\Filesystem\Filesystem::read PHP Method

read() public method

public read ( string $path ) : string
$path string
return string
    public function read($path)
    {
        $fs = $this->getAdapter($path);
        return $fs->read($this->normalizePath($path));
    }

Usage Example

Ejemplo n.º 1
0
 /**
  * @ApiDoc(
  *  section="Interface i18n",
  *  description="Prints the language plural form"
  * )
  *
  * @Rest\QueryParam(name="lang", requirements="[a-z]{2,3}", strict=true, description="The language code")
  *
  * @Rest\Get("/admin/ui/language-plural")
  *
  * @param ParamFetcher $paramFetcher
  *
  * @return string javascript
  */
 public function getLanguagePluralFormAction(ParamFetcher $paramFetcher)
 {
     $lang = $paramFetcher->get('lang');
     $lang = preg_replace('/[^a-z]/', '', $lang);
     $file = $this->translator->getPluralJsFunctionFile($lang);
     //just make sure the file has been created
     $response = new Response();
     $response->headers->set('Content-Type', 'text/javascript');
     $response->setContent($this->webFilesystem->read($file));
     return $response;
 }