Initial Version

This commit is contained in:
root
2025-12-21 10:09:54 -05:00
commit 4ae6befc7b
422 changed files with 47225 additions and 0 deletions

View File

@@ -0,0 +1,122 @@
<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace KTXF\Mail\Object;
/**
* Abstract Message Part Base Class
*
* Provides common implementation for message parts (read-only)
*
* @since 2025.05.01
*/
abstract class MessagePartBaseAbstract implements MessagePartInterface {
/**
* Internal data storage
*/
protected array $data = [];
/**
* Sub-parts storage
* @var array<int,MessagePartInterface>
*/
protected array $parts = [];
/**
* Constructor
*
* @param array &$data Reference to data array
*/
public function __construct(array &$data = null) {
if ($data === null) {
$data = [];
}
$this->data = &$data;
}
/**
* @inheritDoc
*/
public function getBlobId(): ?string {
return $this->data['blobId'] ?? null;
}
/**
* @inheritDoc
*/
public function getId(): ?string {
return $this->data['partId'] ?? null;
}
/**
* @inheritDoc
*/
public function getType(): ?string {
return $this->data['type'] ?? null;
}
/**
* @inheritDoc
*/
public function getDisposition(): ?string {
return $this->data['disposition'] ?? null;
}
/**
* @inheritDoc
*/
public function getName(): ?string {
return $this->data['name'] ?? null;
}
/**
* @inheritDoc
*/
public function getCharset(): ?string {
return $this->data['charset'] ?? null;
}
/**
* @inheritDoc
*/
public function getLanguage(): ?string {
return $this->data['language'] ?? null;
}
/**
* @inheritDoc
*/
public function getLocation(): ?string {
return $this->data['location'] ?? null;
}
/**
* @inheritDoc
*/
public function getParts(): array {
return $this->parts;
}
/**
* @inheritDoc
*/
public function jsonSerialize(): array {
$result = $this->data;
if (!empty($this->parts)) {
$result['subParts'] = [];
foreach ($this->parts as $part) {
$result['subParts'][] = $part->jsonSerialize();
}
}
return $result;
}
}