@param array[] $embeddedFiles
@param string  $boundary

@return static

@throws \ManaPHP\Mailer\Adapter\Exception\TransmitException
776647
protected function _sendEmbeddedFiles($embeddedFiles, $boundary)
    {
        foreach ($embeddedFiles as $embeddedFile) {
            if (!is_file($file = $this->alias->resolve($embeddedFile['file']))) {
                throw new InvalidValueException(['`:file` inline file is not exists', 'file' => $file]);
            }
            $this->_writeLine()
                ->_writeLine("--$boundary")
                ->_writeLine('Content-Type: ' . mime_content_type($file))
                ->_writeLine('Content-Length: ' . filesize($file))
                ->_writeLine('Content-ID: <' . $embeddedFile['cid'] . '>')
                ->_writeLine('Content-Disposition: inline; filename="' . $embeddedFile['name'] . '"')
                ->_writeLine('Content-Transfer-Encoding: base64')
                ->_writeLine()
                ->_writeLine(chunk_split(base64_encode(file_get_contents($file)), 983));
        }

        return $this;
    }
209261
public static function create(array $properties): AddressEmbeddableInterface
    {
        if (array_key_exists(AddressEmbeddableInterface::EMBEDDED_PROP_HOUSE_NUMBER, $properties)) {
            return new self(
                $properties[AddressEmbeddableInterface::EMBEDDED_PROP_HOUSE_NUMBER],
                $properties[AddressEmbeddableInterface::EMBEDDED_PROP_HOUSE_NAME],
                $properties[AddressEmbeddableInterface::EMBEDDED_PROP_STREET],
                $properties[AddressEmbeddableInterface::EMBEDDED_PROP_CITY],
                $properties[AddressEmbeddableInterface::EMBEDDED_PROP_POSTAL_AREA],
                $properties[AddressEmbeddableInterface::EMBEDDED_PROP_POSTAL_CODE],
                $properties[AddressEmbeddableInterface::EMBEDDED_PROP_COUNTRY_CODE]
            );
        }

        return new self(...array_values($properties));
    }
707255
private function renderTextAndHtmlWithEmbededFiles(&$content, $text, $html, $encoding, $boundary)
    {
        $uid = uniqid();
        $boundary2 = "x----_=_NextPart_002_$uid";
        $content .= "\r\n--$boundary\r\n";
        $content .= "Content-Type: multipart/related;\r\n\tboundary=\"$boundary2\";\r\n\ttype=\"multipart/alternative\"\r\n";
        $this->renderTextAndHtml($content, $text, $html, $encoding, $boundary2);
        $this->renderEmbeddedFiles($content, $boundary2);
        $content .= "\r\n--$boundary2--\r\n";
    }
235881
public function registerBundle($files, $destination = null, $extension = null)
    {
        if (!is_array($files)) {
            $files = [$files];
        }

        $firstFile = array_values($files)[0];

        if ($extension === null) {
            $extension = File::extension($firstFile);
        }

        $extension = strtolower(trim($extension));

        if ($destination === null) {
            $file = File::name($firstFile);
            $path = dirname($firstFile);
            $preprocessors = array_diff(self::$cssExtensions, ['css']);

            if (in_array($extension, $preprocessors)) {
                $cssPath = $path.'/../css';
                if (
                    in_array(strtolower(basename($path)), $preprocessors) &&
                    File::isDirectory(File::symbolizePath($cssPath))
                ) {
                    $path = $cssPath;
                }
                $destination = $path.'/'.$file.'.css';
            }
            else {
                $destination = $path.'/'.$file.'-min.'.$extension;
            }
        }

        $this->bundles[$extension][$destination] = $files;

        return $this;
    }
745057
private static function mergeFulfilledObligations(array $obligations, $evaluation, array $obligationsMap): array
    {
        return array_merge($obligations, Encoder::getFulfillObligations($evaluation, $obligationsMap));
    }
38249
public function getEmbeddedMessage(): EmbeddedMessageInterface
    {
        if (!$this->isEmbeddedMessage()) {
            throw new NotEmbeddedMessageException(\sprintf(
                'Attachment "%s" in message "%s" is not embedded message',
                $this->getPartNumber(),
                $this->getNumber()
            ));
        }

        return new EmbeddedMessage($this->resource, $this->getNumber(), $this->getPartNumber(), $this->getStructure()->parts[0]);
    }
1146748
public function record($file, $format, $escapeDigits, $maxRecordTime = -1, $silence = false)
    {
        $cmd = implode(
            ' ',
            array(
                'RECORD', 'FILE',
                '"' . $file . '"', '"' . $format . '"',
                '"' . $escapeDigits . '"', '"' . $maxRecordTime . '"'
            )
        );
        if ($silence !== false) {
            $cmd .= ' "s=' . $silence . '"';
        }
        return new RecordResult($this->send($cmd));
    }
1290953
public static void exportToFile(final String fileName, final Iterable<? extends NodeInterface> nodes, final Iterable<? extends RelationshipInterface> relationships, final Iterable<String> filePaths, final boolean includeFiles) throws FrameworkException {

		try (final Tx tx = StructrApp.getInstance().tx()) {

			try (final FileOutputStream fos = new FileOutputStream(fileName)) {

				exportToStream(fos, nodes, relationships, filePaths, includeFiles);
			}

			tx.success();

		} catch (Throwable t) {

			throw new FrameworkException(500, t.getMessage());
		}
	}
58641
public static function do(ConnectorInterface $connector, $privateActiveWif, $from, $to, $amountWithAsset, $memo)
    {
        $chainName = $connector->getPlatform();
        /** @var CommandQueryData $tx */
        $tx = Transaction::init($connector);
        $tx->setParamByKey(
            '0:operations:0',
            [
                'transfer',
                [
                    'from'   => $from,
                    'to'     => $to,
                    'amount' => $amountWithAsset,
                    'memo'   => $memo
                ]
            ]
        );

        $command = new BroadcastTransactionCommand($connector);
        Transaction::sign($chainName, $tx, ['active' => $privateActiveWif]);

        $answer = $command->execute(
            $tx
        );

        return $answer;
    }
1035047
public function disSoundFiles()
    {
        $properties     = $this->getProperties();
        $acceptedFiles  = $properties['acceptedFiles'];
        $sndsExt        = $this->getSoundExtensionConstant();
        $acceptedFiles  = $this->rmAcceptedFiles($acceptedFiles, $sndsExt);
        $properties['acceptedFiles']    = $acceptedFiles;
        $this->setProperties($properties);
        return $this;
    }
1066996
private function doParseBoundary($boundary)
    {
        $result = array();
        $prefix = "--".$boundary;

        $this->consumeRegexp("/\n*/");
        $this->consumeTo($prefix);
        $this->consume($prefix);

        while ($this->expects("\n")) {
            $content = $this->consumeTo("\n".$prefix);

            $part = new Part();
            $part->loadSource($content);
            if ($part->isMultipart()) {
                $result = array_merge($result, $part->getParts());
            } else {
                $result[] = $part;
            }

            $this->consume("\n".$prefix);
        }

        return $result;
    }
466773
public function sendEmbeddedBulkSendJobWithTemplate(EmbeddedBulkSendJob $request)
    {
        $params = $request->toParams();

        $response = $this->rest->post(
            static::SIGNATURE_REQUEST_EMBEDDED_BULK_SEND_PATH,
            $params
        );

        $this->checkResponse($response);

        return new BulkSendJob($response);
    }
1206718
public function parseBoundary($content, $boundary)
    {
        $content = str_replace("\r", '', $content); // acceptable

        $this->content = $content;
        $this->cursor  = 0;

        try {
            return $this->doParseBoundary($boundary);
        } catch (\Exception $e) {
            $text = substr($this->content, $this->cursor, 10);

            throw new \InvalidArgumentException(sprintf('Error while parsing "%s" (cursor: %d, text: "%s").'."\n%s", $e->getMessage(), $this->cursor, $text, $e->getTraceAsString()));
        }
    }
366173
protected function get_attachment_headers($type, $boundary)
	{
		$return = '';

		$newline = $this->config['newline'];

		foreach ($this->attachments[$type] as $attachment)
		{
			$return .= '--'.$boundary.$newline;
			$return .= 'Content-Type: '.$attachment['mime'].'; name="'.$attachment['file'][1].'"'.$newline;
			$return .= 'Content-Transfer-Encoding: base64'.$newline;
			$type === 'inline' and $return .= 'Content-ID: <'.substr($attachment['cid'], 4).'>'.$newline;
			$return .= 'Content-Disposition: '.$type.'; filename="'.$attachment['file'][1].'"'.$newline.$newline;
			$return .= $attachment['contents'].$newline.$newline;
		}

		return $return;
	}
151543
protected function createObject($mapperClass, $element, $included)
    {
        /** @var Mapper $mapper */
        $mapper = new $mapperClass;

        return $mapper->createObject(array_merge($this->getAttributes($element), $included));
    }
102455
protected function createStream(array $elements)
    {
        $stream = new AppendStream();

        foreach ($elements as $element) {
            $this->addElement($stream, $element);
        }

        // Add the trailing boundary with CRLF
        $stream->addStream(stream_for("--{$this->boundary}--\r\n"));

        return $stream;
    }
462946
protected function _attachFiles($boundary = null)
    {
        if ($boundary === null) {
            $boundary = $this->_boundary;
        }

        $msg = [];
        foreach ($this->_attachments as $filename => $fileInfo) {
            if (!empty($fileInfo['contentId'])) {
                continue;
            }
            $data = isset($fileInfo['data']) ? $fileInfo['data'] : $this->_readFile($fileInfo['file']);
            $hasDisposition = (
                !isset($fileInfo['contentDisposition']) ||
                $fileInfo['contentDisposition']
            );
            $part = new FormDataPart(false, $data, false);

            if ($hasDisposition) {
                $part->disposition('attachment');
                $part->filename($filename);
            }
            $part->transferEncoding('base64');
            $part->type($fileInfo['mimetype']);

            $msg[] = '--' . $boundary;
            $msg[] = (string)$part;
            $msg[] = '';
        }

        return $msg;
    }