Changeset View
Changeset View
Standalone View
Standalone View
src/applications/files/transform/PhabricatorFileTransform.php
Show All 9 Lines | abstract class PhabricatorFileTransform extends Phobject { | ||||
public function getDefaultTransform(PhabricatorFile $file) { | public function getDefaultTransform(PhabricatorFile $file) { | ||||
return null; | return null; | ||||
} | } | ||||
public function generateTransforms() { | public function generateTransforms() { | ||||
return array($this); | return array($this); | ||||
} | } | ||||
public function executeTransform(PhabricatorFile $file) { | |||||
if ($this->canApplyTransform($file)) { | |||||
try { | |||||
return $this->applyTransform($file); | |||||
} catch (Exception $ex) { | |||||
// Ignore. | |||||
} | |||||
} | |||||
return $this->getDefaultTransform($file); | |||||
} | |||||
public static function getAllTransforms() { | public static function getAllTransforms() { | ||||
static $map; | static $map; | ||||
if ($map === null) { | if ($map === null) { | ||||
$xforms = id(new PhutilSymbolLoader()) | $xforms = id(new PhutilSymbolLoader()) | ||||
->setAncestorClass(__CLASS__) | ->setAncestorClass(__CLASS__) | ||||
->loadObjects(); | ->loadObjects(); | ||||
Show All 37 Lines |