1
0
Fork 0
mirror of synced 2024-06-03 03:14:50 +12:00
appwrite/src/Appwrite/Utopia/Response/Model/BaseList.php
2020-10-30 00:44:01 +02:00

59 lines
1.1 KiB
PHP

<?php
namespace Appwrite\Utopia\Response\Model;
use Appwrite\Utopia\Response;
use Appwrite\Utopia\Response\Model;
class BaseList extends Model
{
/**
* @var string
*/
protected $name = '';
/**
* @var string
*/
protected $type = '';
public function __construct(string $name, string $type, string $key, string $model, bool $paging = true)
{
$this->name = $name;
$this->type = $type;
if ($paging) {
$this->addRule('sum', [
'type' => 'integer',
'description' => 'Total sum of items in the list.',
'example' => '5',
]);
}
$this->addRule($key, [
'type' => $model,
'description' => 'List of '.$key.'.',
'example' => [],
'array' => true,
]);
}
/**
* Get Name
*
* @return string
*/
public function getName():string
{
return $this->name;
}
/**
* Get Collection
*
* @return string
*/
public function getType():string
{
return $this->type;
}
}