Changeset View
Changeset View
Standalone View
Standalone View
src/applications/files/document/PhabricatorJSONDocumentEngine.php
<?php | <?php | ||||
final class PhabricatorJSONDocumentEngine | final class PhabricatorJSONDocumentEngine | ||||
extends PhabricatorTextDocumentEngine { | extends PhabricatorTextDocumentEngine { | ||||
const ENGINEKEY = 'json'; | const ENGINEKEY = 'json'; | ||||
public function getViewAsLabel(PhabricatorDocumentRef $ref) { | public function getViewAsLabel(PhabricatorDocumentRef $ref) { | ||||
return pht('View as JSON'); | return pht('View as JSON'); | ||||
} | } | ||||
protected function getDocumentIconIcon(PhabricatorDocumentRef $ref) { | protected function getDocumentIconIcon(PhabricatorDocumentRef $ref) { | ||||
return 'fa-database'; | return 'fa-database'; | ||||
} | } | ||||
protected function getContentScore(PhabricatorDocumentRef $ref) { | protected function getContentScore(PhabricatorDocumentRef $ref) { | ||||
if (preg_match('/\.json\z/', $ref->getName())) { | |||||
$name = $ref->getName(); | |||||
if ($name !== null) { | |||||
if (preg_match('/\.json\z/', $name)) { | |||||
return 2000; | return 2000; | ||||
} | } | ||||
} | |||||
if ($ref->isProbablyJSON()) { | if ($ref->isProbablyJSON()) { | ||||
return 1750; | return 1750; | ||||
} | } | ||||
return 500; | return 500; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 50 Lines • Show Last 20 Lines |