Changeset View
Changeset View
Standalone View
Standalone View
src/config/source/ArcanistFilesystemConfigurationSource.php
<?php | <?php | ||||
abstract class ArcanistFilesystemConfigurationSource | abstract class ArcanistFilesystemConfigurationSource | ||||
extends ArcanistConfigurationSource { | extends ArcanistDictionaryConfigurationSource { | ||||
private $path; | |||||
public function __construct($path) { | |||||
$this->path = $path; | |||||
$values = array(); | |||||
if (Filesystem::pathExists($path)) { | |||||
$contents = Filesystem::readFile($path); | |||||
if (strlen(trim($contents))) { | |||||
$values = phutil_json_decode($contents); | |||||
} | |||||
} | |||||
parent::__construct($values); | |||||
} | |||||
public function getPath() { | |||||
return $this->path; | |||||
} | |||||
public function getSourceDisplayName() { | |||||
return pht('%s (%s)', $this->getFileKindDisplayName(), $this->getPath()); | |||||
} | |||||
abstract public function getFileKindDisplayName(); | |||||
} | } | ||||
No newline at end of file | No newline at end of file |