2013-09-30 21:21:33 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Callback provider for loading @{class@arcanist:ArcanistBundle} file data
|
|
|
|
* stored in the Files application.
|
|
|
|
*/
|
2015-06-15 10:02:26 +02:00
|
|
|
final class PhabricatorFileBundleLoader extends Phobject {
|
2013-09-30 21:21:33 +02:00
|
|
|
|
|
|
|
private $viewer;
|
|
|
|
|
|
|
|
public function setViewer(PhabricatorUser $viewer) {
|
|
|
|
$this->viewer = $viewer;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function loadFileData($phid) {
|
|
|
|
$file = id(new PhabricatorFileQuery())
|
|
|
|
->setViewer($this->viewer)
|
|
|
|
->withPHIDs(array($phid))
|
|
|
|
->executeOne();
|
|
|
|
if (!$file) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
return $file->loadFileData();
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|