Changeset View
Changeset View
Standalone View
Standalone View
src/applications/files/document/PhabricatorDocumentRef.php
Show First 20 Lines • Show All 50 Lines • ▼ Show 20 Lines | public function getName() { | ||||
return null; | return null; | ||||
} | } | ||||
public function setByteLength($length) { | public function setByteLength($length) { | ||||
$this->byteLength = $length; | $this->byteLength = $length; | ||||
return $this; | return $this; | ||||
} | } | ||||
public function getLength() { | public function getByteLength() { | ||||
if ($this->byteLength !== null) { | if ($this->byteLength !== null) { | ||||
return $this->byteLength; | return $this->byteLength; | ||||
} | } | ||||
if ($this->file) { | if ($this->file) { | ||||
return (int)$this->file->getByteSize(); | return (int)$this->file->getByteSize(); | ||||
} | } | ||||
return null; | return null; | ||||
} | } | ||||
public function loadData() { | public function loadData($begin = null, $end = null) { | ||||
if ($this->file) { | if ($this->file) { | ||||
return $this->file->loadFileData(); | $iterator = $this->file->getFileDataIterator($begin, $end); | ||||
$result = ''; | |||||
foreach ($iterator as $chunk) { | |||||
$result .= $chunk; | |||||
} | |||||
return $result; | |||||
} | } | ||||
throw new PhutilMethodNotImplementedException(); | throw new PhutilMethodNotImplementedException(); | ||||
} | } | ||||
public function hasAnyMimeType(array $candidate_types) { | public function hasAnyMimeType(array $candidate_types) { | ||||
$mime_full = $this->getMimeType(); | $mime_full = $this->getMimeType(); | ||||
$mime_parts = explode(';', $mime_full); | $mime_parts = explode(';', $mime_full); | ||||
Show All 20 Lines |