Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2889578
PhutilBinaryAnalyzer.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Advanced/Developer...
View Handle
View Hovercard
Size
1 KB
Referenced Files
None
Subscribers
None
PhutilBinaryAnalyzer.php
View Options
<?php
abstract
class
PhutilBinaryAnalyzer
extends
Phobject
{
public
function
getBinaryName
(
)
{
return
$this
->
getBinaryKey
(
)
;
}
public
function
getBinaryKey
(
)
{
return
$this
->
getPhobjectClassConstant
(
'BINARY'
)
;
}
public
function
isBinaryAvailable
(
)
{
return
Filesystem
::
binaryExists
(
$this
->
getBinaryName
(
)
)
;
}
abstract
protected
function
newBinaryVersion
(
)
;
protected
function
newBinaryPath
(
)
{
return
Filesystem
::
resolveBinary
(
$this
->
getBinaryName
(
)
)
;
}
final
public
function
getBinaryVersion
(
)
{
return
$this
->
newBinaryVersion
(
)
;
}
final
public
function
requireBinaryVersion
(
)
{
$version
=
$this
->
getBinaryVersion
(
)
;
$binary
=
$this
->
getBinaryName
(
)
;
if
(
$version
===
null
)
{
throw
new
Exception
(
pht
(
'Unable to determine the installed version of binary "%s". This '
.
'version is required.'
,
$binary
)
)
;
}
return
$version
;
}
final
public
function
getBinaryPath
(
)
{
return
$this
->
newBinaryPath
(
)
;
}
final
public
static
function
getAllBinaries
(
)
{
return
id
(
new
PhutilClassMapQuery
(
)
)
->
setAncestorClass
(
__CLASS__
)
->
setUniqueMethod
(
'getBinaryKey'
)
->
setSortMethod
(
'getBinaryName'
)
->
execute
(
)
;
}
final
public
static
function
getForBinary
(
$binary
)
{
$map
=
self
::
getAllBinaries
(
)
;
$analyzer
=
idx
(
$map
,
$binary
)
;
if
(
!
$analyzer
)
{
throw
new
Exception
(
pht
(
'No analyzer is available for binary "%s".'
,
$binary
)
)
;
}
return
$analyzer
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sun, Jan 19, 12:22 (3 w, 4 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1116661
Default Alt Text
PhutilBinaryAnalyzer.php (1 KB)
Attached To
Mode
rARC Arcanist
Attached
Detach File
Event Timeline
Log In to Comment