Permalink
Browse files

PhpDoc

  • Loading branch information...
1 parent 4fb8f31 commit c245fda6980e36ae01bcc2757ca35361e48658eb @cdujeu cdujeu committed Jun 20, 2016
Showing with 33 additions and 1 deletion.
  1. +33 −1 core/src/core/src/pydio/Core/Http/Response/FileReaderResponse.php
@@ -33,7 +33,13 @@
defined('AJXP_EXEC') or die('Access not allowed');
-
+/**
+ * Class FileReaderResponse
+ * Async class that can be used as a Body for a ResponseInterface. Will read the file or data
+ * when the reponse is emitted.
+ *
+ * @package Pydio\Core\Http\Response
+ */
class FileReaderResponse extends AsyncResponseStream
{
/** @var AJXP_Node */
@@ -82,14 +88,28 @@ public function __construct($nodeOrFile = null, $data = null)
parent::__construct($callable);
}
+ /**
+ * Simple debug instruction
+ * @param $message
+ * @param array $params
+ */
protected function logDebug($message, $params = []){
AJXP_Logger::getInstance()->logDebug("FileReader", $message, $params);
}
+ /**
+ * Set a possible header type "plain", "image" if it's force attachement.
+ * @param $headerType
+ */
public function setHeaderType($headerType){
$this->headerType = $headerType;
}
+ /**
+ * Set the name as it should appear in the download window,
+ * if it's not the file basename
+ * @param $localName
+ */
public function setLocalName($localName){
$this->localName = $localName;
}
@@ -103,14 +123,26 @@ public function setPartial($offset, $length){
$this->length = $length;
}
+ /**
+ * Callback to be triggered just before reading the file
+ * @param callable $pre
+ */
public function setPreReadCallback(callable $pre){
$this->preRead = $pre;
}
+ /**
+ * Callback to be triggered at the end of the file read operation
+ * @param callable $post
+ */
public function setPostReadCallback(callable $post){
$this->postRead = $post;
}
+ /**
+ * Actually read the data to the output
+ * @throws \Exception
+ */
protected function readData(){
if($this->preRead){
call_user_func($this->preRead);

0 comments on commit c245fda

Please sign in to comment.