Get/set the boundary

@param  string $boundary The boundary
@return string
351147
public function boundary($boundary = null)
    {
        if (!func_num_args()) {
            if (!$this->isMultipart()) {
                return;
            }
            if ($this->_boundary === null) {
                $this->_boundary = sha1(uniqid('', true));
            }
            return $this->_boundary;
        }
        $this->_boundary = $boundary;
        return $this;
    }
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;
    }
123811
protected function _sendAttachments($attachments, $boundary)
    {
        foreach ($attachments as $attachment) {
            $file = $this->alias->resolve($attachment['file']);
            if (!is_file($file)) {
                throw new InvalidValueException(['`:file` attachment file is not exists', 'file' => $file]);
            }

            $this->_writeLine()
                ->_writeLine("--$boundary")
                ->_writeLine('Content-Type: ' . mime_content_type($file))
                ->_writeLine('Content-Length: ' . filesize($file))
                ->_writeLine('Content-Disposition: attachment; filename="' . $attachment['name'] . '"')
                ->_writeLine('Content-Transfer-Encoding: base64')
                ->_writeLine()
                ->_writeLine(chunk_split(base64_encode(file_get_contents($file)), 983));
        }

        return $this;
    }
434019
public function generateBody()
    {
        $data = $this->noMimeMessage . ezcMailTools::lineBreak();
        foreach ( $this->parts as $part )
        {
            $data .= ezcMailTools::lineBreak() . '--' . $this->boundary . ezcMailTools::lineBreak();
            $data .= $part->generate();
        }
        $data .= ezcMailTools::lineBreak() . '--' . $this->boundary . '--';
        return $data;
    }
939180
public function setBorder( $top = 'none', $right = 'none', $bottom = 'none', $left = 'none' )
    {
        // Set the border styles
        $styles = is_array( $top )
            ? $top
            : [
                'top'    => [
                    'style' => $top,
                ],
                'left'   => [
                    'style' => $left,
                ],
                'right'  => [
                    'style' => $right,
                ],
                'bottom' => [
                    'style' => $bottom,
                ],
            ];

        return $this->setStyle( 'borders', $styles );
    }
694049
function update_boundaryBox(&$boundaryBox, $coords) {
      $width      = $boundaryBox['width'];
      $height     = $boundaryBox['height'];
      $x          = $coords['x'];
      $y          = $coords['y'];
      $reference  = $coords['reference'];
      switch ($reference) {
        case 'top-left':
        case 'left-top':
          $top    = $y;
          $bottom = $y + $height;
          $left   = $x;
          $right  = $x + $width;
          break;
        case 'left-center':
          $top    = $y - ($height / 2);
          $bottom = $y + ($height / 2);
          $left   = $x;
          $right  = $x + $width;
          break;
        case 'left-bottom':
          $top    = $y - $height;
          $bottom = $y;
          $left   = $x;
          $right  = $x + $width;
          break;
        case 'top-center':
          $top    = $y;
          $bottom = $y + $height;
          $left   = $x - ($width / 2);
          $right  = $x + ($width / 2);
          break;
        case 'right-top':
        case 'top-right':
          $top    = $y;
          $bottom = $y + $height;
          $left   = $x - $width;
          $right  = $x;
          break;
        case 'right-center':
          $top    = $y - ($height / 2);
          $bottom = $y + ($height / 2);
          $left   = $x - $width;
          $right  = $x;
          break;
        case 'bottom=right':
        case 'right-bottom':
          $top    = $y - $height;
          $bottom = $y;
          $left   = $x - $width;
          $right  = $x;
          break;
        default:
          $top    = 0;
          $bottom = $height;
          $left   = 0;
          $right  = $width;
          break;
      }

      $boundaryBox = array_merge($boundaryBox, array('top'       => $top,
                                                     'bottom'    => $bottom,
                                                     'left'      => $left,
                                                     'right'     => $right,
                                                     'x'         => $x,
                                                     'y'         => $y,
                                                     'reference' => $reference));
    }
637652
private function defineNewGate($gate): string
    {
        // Define a Gate for inline closures passed as gate
        if (is_callable($gate)) {
            $closure = $gate;
            $gate = str_random(10);
            GateFacade::define($gate, $closure);
        }

        // Define a Gate for "class@method" gates
        if (is_string($gate) && str_contains($gate, '@')) {
            GateFacade::define($gate, $gate);
        }

        return $gate;
    }
794628
public static function getLimitString($limit)
    {
        if (isset($limit) && !empty($limit)) {
            $limitParts = GeneralUtility::trimExplode(',', $limit);
            if (count($limitParts) === 1) {
                return intval($limitParts[0]);
            }
            if (count($limitParts) === 2) {
                return intval($limitParts[0]) . ',' . intval($limitParts[1]);
            }
        }

        return '';
    }
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()));
        }
    }
1312473
protected function _attachInlineFiles($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']);

            $msg[] = '--' . $boundary;
            $part = new FormDataPart(false, $data, 'inline');
            $part->type($fileInfo['mimetype']);
            $part->transferEncoding('base64');
            $part->contentId($fileInfo['contentId']);
            $part->filename($filename);
            $msg[] = (string)$part;
            $msg[] = '';
        }

        return $msg;
    }
808119
private function getHeaders(array $headers)
    {
        $str = '';
        foreach ($headers as $key => $value) {
            $str .= "{$key}: {$value}\r\n";
        }

        return "--{$this->boundary}\r\n" . trim($str) . "\r\n\r\n";
    }
603917
def choose_boundary():
    
    global BOUNDARY_PREFIX
    if BOUNDARY_PREFIX is None:
        BOUNDARY_PREFIX = "urlfetch"
        try:
            uid = repr(os.getuid())
            BOUNDARY_PREFIX += "." + uid
        except AttributeError:
            pass
        try:
            pid = repr(os.getpid())
            BOUNDARY_PREFIX += "." + pid
        except AttributeError:
            pass

    return "%s.%s" % (BOUNDARY_PREFIX, uuid.uuid4().hex)
1069495
public function border($color = '#000000', $thickness = 1)
    {
        // Draw border
        $rgb = $this->hex2rgb($color);

        $color = imagecolorallocate($this->image, $rgb['r'], $rgb['g'], $rgb['b']);

        $x1 = 0;
        $y1 = 0;
        $x2 = ImageSX($this->image) - 1;
        $y2 = ImageSY($this->image) - 1;

        for ($i = 0; $i < $thickness; $i++) {
            ImageRectangle($this->image, $x1++, $y1++, $x2--, $y2--, $color);
        }

        return $this;
    }
921168
@Override
  protected Double stringToBoundary(String boundary, Integer segmentNumber)
      throws IOException {
    if (segmentRegistration.equals(SEGMENT_BOUNDARY_ASC)
        || segmentRegistration.equals(SEGMENT_BOUNDARY_DESC)) {
      if (segmentNumber == null) {
        return Double.valueOf(boundary);
      } else {
        return Double.valueOf(boundary) / segmentNumber;
      }
    } else {
      throw new IOException(
          "not available for segmentRegistration " + segmentRegistration);
    }
  }
647465
private function getBorderXMLContent($style)
    {
        $borderProperty = '<style:table-cell-properties %s />';

        $borders = array_map(function (BorderPart $borderPart) {
            return BorderHelper::serializeBorderPart($borderPart);
        }, $style->getBorder()->getParts());

        return sprintf($borderProperty, implode(' ', $borders));
    }
682498
@Override
  protected Long stringToBoundary(String boundary, Integer segmentNumber)
      throws IOException {
    if (segmentRegistration.equals(SEGMENT_BOUNDARY_ASC)
        || segmentRegistration.equals(SEGMENT_BOUNDARY_DESC)) {
      if (segmentNumber == null) {
        return Long.valueOf(boundary);
      } else {
        return Math.floorDiv(Long.parseLong(boundary), segmentNumber);
      }
    } else {
      throw new IOException(
          "not available for segmentRegistration " + segmentRegistration);
    }
  }
543502
protected function GetBoundary($boundary, $charSet, $contentType, $encoding)
    {
        $result = '';
        if ($charSet == '') {
            $charSet = $this->CharSet;
        }
        if ($contentType == '') {
            $contentType = $this->ContentType;
        }
        if ($encoding == '') {
            $encoding = $this->Encoding;
        }
        $result .= $this->TextLine('--' . $boundary);
        $result .= sprintf("Content-Type: %s; charset=\"%s\"", $contentType, $charSet);
        $result .= $this->LE;
        $result .= $this->HeaderLine('Content-Transfer-Encoding', $encoding);
        $result .= $this->LE;

        return $result;
    }