Creates and returns a new attachment object specified by the builder.

@return Attachment A new attachment object.
182021
public function create()
    {
        $this->data['mrkdwn_in'] = [];

        if ($this->markdownInText) {
            $this->data['mrkdwn_in'][] = 'text';
        }

        if ($this->markdownInPretext) {
            $this->data['mrkdwn_in'][] = 'pretext';
        }

        if ($this->markdownInFields) {
            $this->data['mrkdwn_in'][] = 'fields';
        }

        return Attachment::fromData($this->data);
    }
1199176
public function create()
    {
        $type = NodeType::getByHandle('file');
        if (!is_object($type)) {
            NodeType::add('file');
        }
        $type = NodeType::getByHandle('file_folder');
        if (!is_object($type)) {
            NodeType::add('file_folder');
        }
        $type = NodeType::getByHandle('search_preset');
        if (!is_object($type)) {
            NodeType::add('search_preset');
        }
        $type = TreeType::getByHandle('file_manager');
        if (!is_object($type)) {
            TreeType::add('file_manager');
        }

        $manager = FileManager::get();
        if (!is_object($manager)) {
            $manager = FileManager::add();
        }

        return $manager;
    }
662897
public static function create()
	{
		switch (func_num_args()) {
			case 0:
				return new ClassWithEmbeddedMessageProperty();
			case 1:
				return new ClassWithEmbeddedMessageProperty(func_get_arg(0));
			case 2:
				return new ClassWithEmbeddedMessageProperty(func_get_arg(0), func_get_arg(1));
			case 3:
				return new ClassWithEmbeddedMessageProperty(func_get_arg(0), func_get_arg(1), func_get_arg(2));
			case 4:
				return new ClassWithEmbeddedMessageProperty(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3));
			case 5:
				return new ClassWithEmbeddedMessageProperty(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3), func_get_arg(4));
			case 6:
				return new ClassWithEmbeddedMessageProperty(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3), func_get_arg(4), func_get_arg(5));
			case 7:
				return new ClassWithEmbeddedMessageProperty(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3), func_get_arg(4), func_get_arg(5), func_get_arg(6));
			case 8:
				return new ClassWithEmbeddedMessageProperty(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3), func_get_arg(4), func_get_arg(5), func_get_arg(6), func_get_arg(7));
			default:
				throw new \InvalidArgumentException('More than 8 arguments supplied, please be reasonable.');
		}
	}
937422
public function build(): GetDocumentRequest
	{
		$instance = new GetDocumentRequest();
		$instance->depth = $this->depth;
		$instance->pierce = $this->pierce;
		return $instance;
	}
586426
public static function createInstance(): self
    {
        return new static(
            [
                new Factory\Argument(new PrettyPrinter()),
                new Factory\Class_(),
                new Factory\Constant(new PrettyPrinter()),
                new Factory\DocBlock(DocBlockFactory::createInstance()),
                new Factory\File(NodesFactory::createInstance()),
                new Factory\Function_(),
                new Factory\Interface_(),
                new Factory\Method(),
                new Factory\Property(new PrettyPrinter()),
                new Factory\Trait_(),
            ]
        );
    }
651761
public function create()
    {
        if (! $this->adapter->fileExists($this->path, true)) {
            // ensure the parent directory exists
            new Directory(dirname($this->path), $this->adapter);

            if ($this->adapter->createFile($this->path) === false) {
                $this->throwUnableToCreate();
            }
        }

        return $this;
    }
1228704
public function build(): CopyToRequest
	{
		$instance = new CopyToRequest();
		if ($this->nodeId === null) {
			throw new BuilderException('Property [nodeId] is required.');
		}
		$instance->nodeId = $this->nodeId;
		if ($this->targetNodeId === null) {
			throw new BuilderException('Property [targetNodeId] is required.');
		}
		$instance->targetNodeId = $this->targetNodeId;
		$instance->insertBeforeNodeId = $this->insertBeforeNodeId;
		return $instance;
	}
347264
public function create()
    {
        $instance = self::createAddress($this);
        $this->setId($instance->getId());
        return $instance;
    }
672685
public static function create()
	{
		$arguments = func_get_args();
		
		$name = array_shift( $arguments );
		
		$class_name = "Core\\CCShipyard_".ucfirst( $name );
		
		if ( !class_exists( $class_name ) )
		{
			throw new CCException( "CCShipyard - invalid builder (".$name.") given." );
		}
		
		$builder = new $class_name;
		
		call_user_func_array( array( $builder, 'create' ), $arguments );
		
		return $builder;
	}
941659
public function build(): ReleaseObjectRequest
	{
		$instance = new ReleaseObjectRequest();
		if ($this->objectId === null) {
			throw new BuilderException('Property [objectId] is required.');
		}
		$instance->objectId = $this->objectId;
		return $instance;
	}
1055123
def attachments(self):
        

        resource = copy(self)
        resource._url_builder = URLBuilder(self._base_url, self._base_path, '/attachment')

        path = self._api_path.strip('/').split('/')

        if path[0] != 'table':
            raise InvalidUsage('The attachment API can only be used with the table API')

        return Attachment(resource, path[1])
933799
public String build()
    {
        this.message_string  = "{";

        if( this.recipient_id != null ){
            this.message_string += "\"recipient\": {\"id\": \"" + this.recipient_id + "\"},";
        }

        if( !this.elements.isEmpty() ){

            this.message_string += "\"message\": {";

                this.message_string += "\"attachment\": {";

                    this.message_string += "\"type\": \"template\",";

                    this.message_string += "\"payload\": {";

                        if( this.element_style.equals("compact") ){
                            this.message_string += "\"top_element_style\":\"" + this.element_style + "\",";
                        }

                        if( !this.elements.isEmpty() ){

                            this.message_string += "\"elements\":[";
                            for ( int j = 0 ; j < this.elements.size(); j++ ) {
                                HashMap<String, Object> element = this.elements.get(j);

                                this.message_string += "{";
                                if( !element.get("title").equals("") ){
                                    this.message_string += "\"title\":\"" + element.get("title") + "\",";
                                }
                                if( !element.get("image_url").equals("") ){
                                    this.message_string += "\"image_url\":\"" + element.get("image_url") + "\",";
                                }
                                if( !element.get("subtitle").equals("") ){
                                    this.message_string += "\"subtitle\":\"" + element.get("subtitle") + "\",";
                                }

                                if( !element.get("default_action_type").equals("") || !element.get("default_action_url").equals("") || !element.get("default_action_messenger_extensions").equals("") || !element.get("default_action_webview_height_ratio").equals("") || !element.get("default_action_fallback_url").equals("") ){
                                    this.message_string += "\"default_action\":{";
                                        if( !element.get("default_action_type").equals("") ){
                                            this.message_string += "\"type\":\"" + element.get("default_action_type") + "\",";
                                        }
                                        if( !element.get("default_action_url").equals("") ){
                                            this.message_string += "\"url\":\"" + element.get("default_action_url") + "\",";
                                        }
                                        if( !element.get("default_action_messenger_extensions").equals("") ){
                                            this.message_string += "\"messenger_extensions\":\"" + element.get("default_action_messenger_extensions") + "\",";
                                        }
                                        if( !element.get("default_action_webview_height_ratio").equals("") ){
                                            this.message_string += "\"webview_height_ratio\":\"" + element.get("default_action_webview_height_ratio") + "\",";
                                        }
                                        if( !element.get("default_action_fallback_url").equals("") ){
                                            this.message_string += "\"fallback_url\":\"" + element.get("default_action_fallback_url") + "\",";
                                        }
                                        this.message_string = this.message_string.replaceAll(",$", "");
                                    this.message_string += "},";
                                }


                                if( element.containsKey("buttons") ){
                                    ArrayList<HashMap<String, String>> buttons = (ArrayList<HashMap<String, String>>) element.get("buttons");
                                    if( !buttons.isEmpty() ){

                                        this.message_string += "\"buttons\": [";

                                            for ( int k = 0 ; k < buttons.size(); k++ ) {
                                                HashMap<String, String> button = buttons.get(k);
                                                this.message_string += "{";
                                                    if( !button.get("title").equals("") ){
                                                        this.message_string += "\"title\":\"" + button.get("title") + "\",";
                                                    }
                                                    if( !button.get("type").equals("") ){
                                                        this.message_string += "\"type\":\"" + button.get("type") + "\",";
                                                    }
                                                    if( !button.get("url").equals("") ){
                                                        this.message_string += "\"url\":\"" + button.get("url") + "\",";
                                                    }
                                                    if( !button.get("messenger_extensions").equals("") ){
                                                        this.message_string += "\"messenger_extensions\":\"" + button.get("messenger_extensions") + "\",";
                                                    }
                                                    if( !button.get("webview_height_ratio").equals("") ){
                                                        this.message_string += "\"webview_height_ratio\":\"" + button.get("webview_height_ratio") + "\",";
                                                    }
                                                    if( !button.get("fallback_url").equals("") ){
                                                        this.message_string += "\"fallback_url\":\"" + button.get("fallback_url") + "\",";
                                                    }
                                                this.message_string = this.message_string.replaceAll(",$", "");
                                                this.message_string += "},";
                                            }

                                            this.message_string = this.message_string.replaceAll(",$", "");
                                        this.message_string += "]";
                                    }
                                }

                                this.message_string = this.message_string.replaceAll(",$", "");
                                this.message_string += "},";
                            }

                            this.message_string = this.message_string.replaceAll(",$", "");
                            this.message_string += "],";
                        }

                        this.message_string += "\"buttons\":[";
                        for ( int j = 0 ; j < this.buttons.size(); j++ ) {
                            HashMap<String, String> button = this.buttons.get(j);

                            this.message_string += "{";
                            if( !button.get("type").equals("") ){
                                this.message_string += "\"type\":\"" + button.get("type") + "\",";
                            }
                            if( !button.get("title").equals("") ){
                                this.message_string += "\"title\":\"" + button.get("title") + "\",";
                            }
                            if( !button.get("url").equals("") ){
                                this.message_string += "\"url\":\"" + button.get("url") + "\",";
                            }
                            if( !button.get("payload").equals("") ){
                                this.message_string += "\"payload\":\"" + button.get("payload") + "\",";
                            }
                            this.message_string = this.message_string.replaceAll(",$", "");
                            this.message_string += "},";
                        }

                        this.message_string = this.message_string.replaceAll(",$", "");
                        this.message_string += "]";

                    this.message_string += "}";

                this.message_string += "}";

            this.message_string += "}";

        }

        this.message_string = this.message_string.replaceAll(",$", "");
        this.message_string += "}";

        return this.message_string;
    }
1131093
public static function create()
	{
		switch (func_num_args()) {
			case 0:
				return new ClassWithFixed64Property();
			case 1:
				return new ClassWithFixed64Property(func_get_arg(0));
			case 2:
				return new ClassWithFixed64Property(func_get_arg(0), func_get_arg(1));
			case 3:
				return new ClassWithFixed64Property(func_get_arg(0), func_get_arg(1), func_get_arg(2));
			case 4:
				return new ClassWithFixed64Property(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3));
			case 5:
				return new ClassWithFixed64Property(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3), func_get_arg(4));
			case 6:
				return new ClassWithFixed64Property(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3), func_get_arg(4), func_get_arg(5));
			case 7:
				return new ClassWithFixed64Property(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3), func_get_arg(4), func_get_arg(5), func_get_arg(6));
			case 8:
				return new ClassWithFixed64Property(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3), func_get_arg(4), func_get_arg(5), func_get_arg(6), func_get_arg(7));
			default:
				throw new \InvalidArgumentException('More than 8 arguments supplied, please be reasonable.');
		}
	}
988411
public function create()
    {
        $this->resource = imagecreatetruecolor($this->width, $this->height);
        imagesavealpha($this->resource, true);

        $color = imagecolorallocatealpha(
            $this->resource,
            $this->red,
            $this->green,
            $this->blue,
            null
        );

        if ($this->figureType == 'rectangle') {
            $this->createRectangle($color);
        }

        if ($this->figureType == 'ellipse') {
            $this->createEllipse($color);
        }

        $this->addOpacityFilter();

        return $this;
    }
693977
public static Attachment create(@NonNull File data, @NonNull String type, @Nullable String folder, @Nullable String name) {
        return new Attachment(ContentData.create(data, type, TextUtils.isEmpty(name) ? data.getName() : name), folder, type);
    }
1138180
public function getAttachment()
    {
        if ($this->relatedObject === null && $this->isRelatedObjectResolved === false) {
            $this->isRelatedObjectResolved = true;

            try {
                $model = $this->modelFactory()->create(Attachment::class)->load($this->attachmentId());
                if ($model->id()) {
                    $this->relatedObject = $model;

                    $type = $model->type();
                    if ($type !== $model->objType()) {
                        $this->relatedObject = $this->modelFactory()->create($type)->setData($model->data());
                    }
                }
            } catch (Exception $e) {
                throw new LogicException(sprintf(
                    'Could not load the related object of the relationship: %s',
                    $e->getMessage()
                ), 0, $e);
            }
        }

        return $this->relatedObject;
    }
1339507
public function create(): Letter
    {
        $multipartElements = [
            [
                'name'     => 'envelope',
                'contents' => \GuzzleHttp\json_encode($this->getEnvelope()),
                'headers'  => ['Content-Type' => $this->getEnvelope()->getMimeType()],
            ],
        ];

        if ($this->getCoverLetter()) {
            $multipartElements[] = [
                'name'     => 'cover_letter',
                'contents' => $this->getCoverLetter(),
                'headers'  => ['Content-Type' => 'text/html'],
            ];
        }

        foreach ($this->getAttachments() as $attachment) {
            $multipartElements[] = [
                'name'     => 'file',
                'contents' => fopen($attachment, 'rb'),
                'headers'  => ['Content-Type' => static::getMimeTypeOfFile($attachment)],
            ];
        }

        $multipart      = new MultipartStream($multipartElements);
        $requestOptions = [
            'headers' => [
                'Content-Type' => 'multipart/mixed; boundary='.$multipart->getBoundary(),
            ],
            'body'    => $multipart,
        ];

        $response = $this->getHttpClientForMailbox()->request('POST', '/letters', $requestOptions);
        $data     = \GuzzleHttp\json_decode($response->getBody()->getContents());

        $this->setLetterId($data->letterId);

        return $this;
    }