Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F116711141
PhutilPygmentizeBinaryAnalyzer.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sun, Jun 8, 18:09
Size
648 B
Mime Type
text/x-php
Expires
Tue, Jun 10, 18:09 (2 d)
Engine
blob
Format
Raw Data
Handle
26607683
Attached To
rPHU libphutil
PhutilPygmentizeBinaryAnalyzer.php
View Options
<?php
final
class
PhutilPygmentizeBinaryAnalyzer
extends
PhutilBinaryAnalyzer
{
const
BINARY
=
'pygmentize'
;
protected
function
newBinaryVersion
()
{
list
(
$err
,
$stdout
)
=
exec_manual
(
'pygmentize -V'
);
if
(
$err
)
{
return
null
;
}
return
self
::
parsePygmentizeBinaryVersion
(
$stdout
);
}
public
static
function
parsePygmentizeBinaryVersion
(
$stdout
)
{
// These look like:
// Pygments version 2.0.1, (c) 2006-2014 by Georg Brandl.
$pattern
=
'(^Pygments version ([^,]+),)'
;
$matches
=
null
;
if
(
preg_match
(
$pattern
,
$stdout
,
$matches
))
{
return
$matches
[
1
];
}
return
null
;
}
}
Event Timeline
Log In to Comment