Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F106614797
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
Fri, Mar 28, 11:15
Size
648 B
Mime Type
text/x-php
Expires
Sun, Mar 30, 12:15 (2 d)
Engine
blob
Format
Raw Data
Handle
25234291
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