👁 查看:DestinationBuilder.php
路径:/home/forge/woocommerce-square/vendor/square/square/src/Models/Builders/DestinationBuilder.php
大小:1.1 KB · 修改:2025-12-23 20:26:26 · 权限:0644 · 可写
<?php

declare(strict_types=1);

namespace Square\Models\Builders;

use Core\Utils\CoreHelper;
use Square\Models\Destination;

/**
 * Builder for model Destination
 *
 * @see Destination
 */
class DestinationBuilder
{
    /**
     * @var Destination
     */
    private $instance;

    private function __construct(Destination $instance)
    {
        $this->instance = $instance;
    }

    /**
     * Initializes a new Destination Builder object.
     */
    public static function init(): self
    {
        return new self(new Destination());
    }

    /**
     * Sets type field.
     *
     * @param string|null $value
     */
    public function type(?string $value): self
    {
        $this->instance->setType($value);
        return $this;
    }

    /**
     * Sets id field.
     *
     * @param string|null $value
     */
    public function id(?string $value): self
    {
        $this->instance->setId($value);
        return $this;
    }

    /**
     * Initializes a new Destination object.
     */
    public function build(): Destination
    {
        return CoreHelper::clone($this->instance);
    }
}