Cake\Network\Response::getFile PHP Метод

getFile() публичный Метод

Get the current file if one exists.
public getFile ( ) : Cake\Filesystem\File | null
Результат Cake\Filesystem\File | null The file to use in the response or null
    public function getFile()
    {
        return $this->_file;
    }

Usage Example

Пример #1
0
 /**
  * Get the stream for the new response.
  *
  * @param \Cake\Network\Response $response The cake response to extract the body from.
  * @return \Psr\Http\Message\StreamInterface|string The stream.
  */
 protected static function getStream($response)
 {
     $stream = 'php://memory';
     $body = $response->body();
     if (is_string($body) && strlen($body)) {
         $stream = new Stream('php://memory', 'wb');
         $stream->write($body);
         return $stream;
     }
     if (is_callable($body)) {
         $stream = new CallbackStream($body);
         return $stream;
     }
     $file = $response->getFile();
     if ($file) {
         $stream = new Stream($file->path, 'rb');
         return $stream;
     }
     return $stream;
 }
All Usage Examples Of Cake\Network\Response::getFile