appwrite/src/Appwrite/SDK/Parameter.php

80 lines
1.5 KiB
PHP
Raw Normal View History

2025-03-27 08:02:25 +00:00
<?php
namespace Appwrite\SDK;
use Utopia\Validator;
class Parameter
{
/**
* @param string $name
* @param string $description
* @param mixed|null $default
* @param Validator|callable|null $validator
* @param bool $optional
*/
public function __construct(
protected string $name,
protected string $description = '',
protected mixed $default = null,
protected mixed $validator = null,
protected bool $optional = false,
2025-04-17 09:19:12 +00:00
) {
2025-03-27 08:02:25 +00:00
}
public function getName(): string
{
return $this->name;
}
2025-05-05 13:47:35 +00:00
public function setName(string $name): static
2025-03-27 08:02:25 +00:00
{
$this->name = $name;
2025-05-05 13:47:35 +00:00
return $this;
2025-03-27 08:02:25 +00:00
}
public function getDescription(): string
{
return $this->description;
}
2025-05-05 13:47:35 +00:00
public function setDescription(string $description): static
2025-03-27 08:02:25 +00:00
{
$this->description = $description;
2025-05-05 13:47:35 +00:00
return $this;
2025-03-27 08:02:25 +00:00
}
public function getDefault(): mixed
{
return $this->default;
}
2025-05-05 13:47:35 +00:00
public function setDefault(mixed $default): static
2025-03-27 08:02:25 +00:00
{
$this->default = $default;
2025-05-05 13:47:35 +00:00
return $this;
2025-03-27 08:02:25 +00:00
}
public function getValidator(): mixed
{
return $this->validator;
}
2025-05-05 13:47:35 +00:00
public function setValidator(mixed $validator): static
2025-03-27 08:02:25 +00:00
{
$this->validator = $validator;
2025-05-05 13:47:35 +00:00
return $this;
2025-03-27 08:02:25 +00:00
}
public function getOptional(): bool
2025-03-27 08:02:25 +00:00
{
return $this->optional;
}
2025-05-05 13:47:35 +00:00
public function setOptional(bool $optional): static
2025-03-27 08:02:25 +00:00
{
$this->optional = $optional;
2025-05-05 13:47:35 +00:00
return $this;
2025-03-27 08:02:25 +00:00
}
2025-04-17 09:19:12 +00:00
}