public function readme(ExtensionInterface $extension)
    {
        $file = null;
        foreach (['README.md', 'readme.md'] as $possibleName) {
            $file = $extension->getBaseDirectory()->getFile($possibleName);
            if ($file->exists()) {
                break;
            }
        }
        if ($file === null) {
            throw new NotFoundHttpException('Not Found');
        }

        try {
            $readme = $file->read();
        } catch (Filesystem\Exception\IOException $e) {
            throw new NotFoundHttpException('Not Found');
        }

        // Parse the field as Markdown, return HTML
        $html = $this->app['markdown']->text($readme);

        $response = new Response($html);

        return $response;
    }
public function readme(ExtensionInterface $extension)
    {
        $file = null;
        foreach (['README.md', 'readme.md'] as $possibleName) {
            $file = $extension->getBaseDirectory()->getFile($possibleName);
            if ($file->exists()) {
                break;
            }
        }
        if ($file === null) {
            throw new NotFoundHttpException('Not Found');
        }

        try {
            $readme = $file->read();
        } catch (Filesystem\Exception\IOException $e) {
            throw new NotFoundHttpException('Not Found');
        }

        // Parse the field as Markdown, return HTML
        $html = $this->app['markdown']->text($readme);

        $response = new Response($html);

        return $response;
    }
public function readme ( ExtensionInterface $ extension ) { $ file = null ; foreach ( [ 'README.md' , 'readme.md' ] as $ possibleName ) { $ file = $ extension -> getBaseDirectory ( ) -> getFile ( $ possibleName ) ; if ( $ file -> exists ( ) ) { break ; } } if ( $ file === null ) { throw new NotFoundHttpException ( 'Not Found' ) ; } try { $ readme = $ file -> read ( ) ; } catch ( Filesystem \ Exception \ IOException $ e ) { throw new NotFoundHttpException ( 'Not Found' ) ; } // Parse the field as Markdown, return HTML $ html = $ this -> app [ 'markdown' ] -> text ( $ readme ) ; $ response = new Response ( $ html ) ; return $ response ; }
Render an extension's README.md file.

@param ExtensionInterface $extension

@return Response
Render an extension s README . md file .