Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F102220542
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
Tue, Feb 18, 10:08
Size
648 B
Mime Type
text/x-php
Expires
Thu, Feb 20, 10:08 (2 d)
Engine
blob
Format
Raw Data
Handle
24309587
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