27 lines
508 B
PHP
27 lines
508 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace HaikuAtelier\Data;
|
|
|
|
use WP_Term;
|
|
|
|
final readonly class AttributeOption {
|
|
public function __construct(
|
|
public int $id,
|
|
public string $name,
|
|
public string $slug,
|
|
) {}
|
|
|
|
public static function new(WP_Term $term): self {
|
|
$id = $term->term_taxonomy_id;
|
|
$name = $term->name;
|
|
$slug = $term->slug;
|
|
|
|
return new self(
|
|
id: $id,
|
|
name: $name,
|
|
slug: $slug,
|
|
);
|
|
}
|
|
}
|