042660b15c
* Added static code analysis * Updated code to solve psalm issue
51 lines
854 B
PHP
51 lines
854 B
PHP
<?php
|
|
|
|
namespace Appwrite\Utopia\Response;
|
|
|
|
abstract class Model
|
|
{
|
|
/**
|
|
* @return array
|
|
*/
|
|
protected $rules = [];
|
|
|
|
/**
|
|
* Get Name
|
|
*
|
|
* @return string
|
|
*/
|
|
abstract public function getName():string;
|
|
|
|
/**
|
|
* Get Collection
|
|
*
|
|
* @return string
|
|
*/
|
|
abstract public function getType():string;
|
|
|
|
/**
|
|
* Get Rules
|
|
*
|
|
* @return array
|
|
*/
|
|
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;
|
|
}
|
|
} |