Attach a PDF to the billogram.

@param $filepath
@return $this
338555
public function attachPdf($filepath)
    {
        $content = file_get_contents($filepath);
        $filename = basename($filepath);

        return $this->performEvent('attach', array('filename' => $filename, 'content' => base64_encode($content)));
    }
953140
public function addFilesToRegistry($filePaths)
    {
        collect((array) $filePaths)->each(function ($filePath) {
            if (file_exists($filePath)) {
                AnnotationRegistry::registerFile($filePath);
            }
        });

        return $this;
    }
373836
public function attachFile(string $filePath, string $name = null)
    {
        $this->attachedFiles[] = [
          'path' => $filePath,
          'name' => $name
        ];

        return $this;
    }
323291
public function registerCss($filePath="",$package_name='')
	{
		if(!empty($filePath))
		{
			if(!empty($package_name))
				$package_name .= ':';
			$this->css[$package_name.basename($filePath)] = $filePath;
		}
		return $this;
	}
234886
public function attach($filePath, $attr = null)
    {
        $attachment = \Swift_Attachment::fromPath($filePath);
        if ($attr instanceof \Closure) {
            call_user_func_array($attr, [& $attachment, $this]);
        } elseif ($attr) {
            $attachment->setFilename($this->cnEncode($attr));
        } else {
            // 修复中文文件名乱码bug
            $tmp = str_replace("\\", '/', $filePath);
            $tmp = explode('/', $tmp);
            $filename = end($tmp);
            $attachment->setFilename($this->cnEncode($filename));
        }
        $this->message->attach($attachment);

        return $this;
    }
1357216
public function addIfExists($file_path)
    {
        $_fp = $this->__template->findAsset($file_path);
        if ($_fp || \AssetsManager\Loader::isUrl($file_path)) {
            return $this->add($file_path);
        }
        return $this;
    }
745032
public static function setupFromFile($filePath) {

        $loggers = null;

        require($filePath);

        if (!isset($loggers)) {
            throw new LoggerManagerException('The configuration file [' . $filePath . '] must define a variable $loggers');
        }

        if (!is_array($loggers)) {
            throw new LoggerManagerException('The configuration file [' . $filePath . '] must define a variable $loggers as an array');
        }

        self::setupFromArray($loggers);
    }
802504
public function registerBindings(string $filePath = null)
    {
        is_file($filePath) || $filePath = App::getBasePath() . $filePath;

        if (is_file($filePath)) {
            /** @noinspection PhpIncludeInspection */
            $bindings = require_once $filePath;

            $bindings = is_array($bindings) ? $bindings : [];

            IOC::addBindings($bindings);

            Event::dispatch('minimal.loaded.bindings', [$filePath, $bindings]);
        }
    }
18654
public static function create($filePath)
    {
        if (!file_exists($filePath)) {
            throw new Exception(["{$filePath} has not been found"]);
        }

        $file = fopen($filePath, 'r');

        $photo = json_decode(
            self::post(
                "photos",
                [
                    'multipart' => [['name' => 'photo', 'contents' => $file]],
                    'headers' => ['Content-Length' => filesize($filePath)]
                ]
            )->getBody(),
            true
        );

        return new self($photo);
    }
94028
public function extract($filePath)
    {
        $directory = $this->directory->getDirectoryPath();
        $zipArchive = new ZipArchive();
        $zipArchive->open($filePath);
        $zipArchive->extractTo($directory);

        return $this->createFinderFromDirectory($directory);
    }
465928
public function setFilepath($filepath)
    {
        $this->_path = pathinfo($filepath);

        if (!isset($this->_path['extension']))
            $this->_path['extension'] = null;

        return $this;
    }
1176067
public function setFile(string $filePath): self
    {
        if (!file_exists($filePath)) {
            throw new MimeDetectorException("File '" . $filePath . "' does not exist.");
        }

        $this->stream = $this->readFile($filePath);
        $this->createByteCache();
        return $this;
    }
1192239
public function attachFile($element, $absolutePath)
    {
        $path = ['value' => [$absolutePath]];

        $this->findByNameOrId($element)->postValue($path);

        return $this;
    }
1043111
public function extract($filePath)
    {
        $directory = $this->directory->getDirectoryPath();
        $pharArchive = new PharData($filePath, null, null, Phar::GZ);
        $pharArchive->extractTo($directory);

        return $this->createFinderFromDirectory($directory);
    }
762772
public function setFilePath($filepath)
    {
        if (!isset($filepath) || empty($filepath)) {
            throw new PageCacheException(__CLASS__ . ' file path not set or empty');
        }

        $this->filepath = $filepath;
    }
1053678
public static function loadContextFromFile(string $filePath): ContextInterface
    {
        if(!file_exists($filePath)){
            throw new Exception\FileNotFoundException('Context file not found: '.$filePath, 404, null, $filePath);
        }

        $contents = file_get_contents($filePath);
        $context_array = json_decode($contents, true);

        if($context_array === null){
            throw new Exception\MalformedJsonException('JSON sintax error.');
        }

        return new self($context_array);
    }
699583
protected function createHandle($filePath)
    {
        if (!$handle = $this->openHandle($filePath)) {
            throw new ResourceNotFoundException("Path '$filePath' cannot be opened");
        }

        $this->applySettings($handle);

        return $handle;
    }