Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F96133805
PhabricatorConfigJSON.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
Mon, Dec 23, 00:07
Size
576 B
Mime Type
text/x-php
Expires
Wed, Dec 25, 00:07 (1 d, 19 h)
Engine
blob
Format
Raw Data
Handle
23129466
Attached To
rPH Phabricator
PhabricatorConfigJSON.php
View Options
<?php
final
class
PhabricatorConfigJSON
{
/**
* Properly format a JSON value.
*
* @param wild Any value, but should be a raw value, not a string of JSON.
* @return string
*/
public
static
function
prettyPrintJSON
(
$value
)
{
// Check not only that it's an array, but that it's an "unnatural" array
// meaning that the keys aren't 0 -> size_of_array.
if
(
is_array
(
$value
)
&&
array_keys
(
$value
)
!=
range
(
0
,
count
(
$value
)
-
1
))
{
return
id
(
new
PhutilJSON
())->
encodeFormatted
(
$value
);
}
else
{
return
json_encode
(
$value
);
}
}
}
Event Timeline
Log In to Comment