mirror of
https://github.com/appwrite/appwrite
synced 2026-05-24 09:28:40 +00:00
48 lines
No EOL
818 B
PHP
48 lines
No EOL
818 B
PHP
<?php
|
|
|
|
namespace Appwrite\Utopia\Response;
|
|
|
|
abstract class Model
|
|
{
|
|
protected $rules = [];
|
|
|
|
/**
|
|
* Get Name
|
|
*
|
|
* @return string
|
|
*/
|
|
abstract public function getName():string;
|
|
|
|
/**
|
|
* Get Collection
|
|
*
|
|
* @return string
|
|
*/
|
|
abstract public function getType():string;
|
|
|
|
/**
|
|
* Get Rules
|
|
*
|
|
* @return string
|
|
*/
|
|
public function getRules(): array
|
|
{
|
|
return $this->rules;
|
|
}
|
|
|
|
/**
|
|
* Add a New Rule
|
|
*/
|
|
protected function addRule(string $key, array $options): self
|
|
{
|
|
$this->rules[$key] = array_merge([
|
|
'type' => '',
|
|
'description' => '',
|
|
'default' => null,
|
|
'example' => '',
|
|
'array' => false,
|
|
], $options);
|
|
|
|
return $this;
|
|
}
|
|
} |