%PDF- %PDF-
| Direktori : /home/bitrix/www/bitrix/modules/main/lib/engine/response/ |
| Current File : //home/bitrix/www/bitrix/modules/main/lib/engine/response/bfile.php |
<?php
namespace Bitrix\Main\Engine\Response;
use Bitrix\Main;
class BFile extends File
{
protected $file;
public function __construct(array $file, $name = null)
{
$this->file = $file;
if ($name === null)
{
$name = $this->file['ORIGINAL_NAME'];
}
parent::__construct(null, $name, $this->file['CONTENT_TYPE']);
}
public static function createByFileData(array $file, $name = null)
{
return new self($file, $name);
}
public static function createByFileId($fileId, $name = null)
{
$file = \CFile::getFileArray($fileId);
if (!$file)
{
throw new Main\ObjectNotFoundException("Could not find file");
}
return new self($file, $name);
}
/**
* @return array
*/
public function getFile()
{
return $this->file;
}
/**
* @return array|bool|null
*/
protected function prepareFile()
{
return $this->getFile();
}
}