PHP Class Phrocco\Pygment
This class simply proxies to two possible handlers, a local install of the Pygmentize gem or a remote webservice.
If the command line option is unavailable then it gets delegated to a web service.
Obviously using the web service will require a net connection and may slow down the processing time.
显示文件
Open project: rossriley/phrocco
Class Usage Examples
Public Methods
Method |
Description |
|
local_pygment ( $language, $code ) : `string` |
### Use Local Gem
If the pygmentize gem is available locally then we use this to parse the code. |
|
pygmentize ( `string` $language, `string` $code ) : `void` |
This is the main method that returns the processed code, and decides whether to use
a local gem or a remote web service. |
|
webservice ( $language, $code ) : `string` |
### Use Web Service
If the pygmentize gem is not available locally then we use a remote web serivce as a fallback. |
|
Method Details
local_pygment()
public method
### Use Local Gem
If the pygmentize gem is available locally then we use this to parse the code.
public local_pygment ( $language, $code ) : `string` |
return |
`string` |
|
pygmentize()
public method
This is the main method that returns the processed code, and decides whether to use
a local gem or a remote web service.
public pygmentize ( `string` $language, `string` $code ) : `void` |
$language |
`string` |
|
$code |
`string` |
|
return |
`void` |
|
webservice()
public method
### Use Web Service
If the pygmentize gem is not available locally then we use a remote web serivce as a fallback.
public webservice ( $language, $code ) : `string` |
return |
`string` |
|