2021-08-14 08:57:08 +12:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Appwrite\Utopia\Response\Model;
|
|
|
|
|
|
|
|
use Appwrite\Utopia\Response;
|
|
|
|
use Appwrite\Utopia\Response\Model\Attribute;
|
|
|
|
|
|
|
|
class AttributeFloat extends Attribute
|
|
|
|
{
|
|
|
|
public function __construct()
|
|
|
|
{
|
|
|
|
$this
|
|
|
|
->addRule('min', [
|
|
|
|
'type' => self::TYPE_FLOAT,
|
|
|
|
'description' => 'Minimum value to enforce on new documents.',
|
|
|
|
'default' => null,
|
|
|
|
'example' => 0.5,
|
|
|
|
'array' => false,
|
|
|
|
'required' => false,
|
|
|
|
])
|
|
|
|
->addRule('max', [
|
|
|
|
'type' => self::TYPE_FLOAT,
|
|
|
|
'description' => 'Minimum value to enforce on new documents.',
|
|
|
|
'default' => null,
|
|
|
|
'example' => 2.5,
|
|
|
|
'array' => false,
|
|
|
|
'required' => false,
|
|
|
|
])
|
|
|
|
;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get Name
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function getName():string
|
|
|
|
{
|
2021-08-17 07:59:58 +12:00
|
|
|
return 'AttributeFloat';
|
2021-08-14 08:57:08 +12:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get Collection
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function getType():string
|
|
|
|
{
|
2021-08-17 07:59:58 +12:00
|
|
|
return Response::MODEL_ATTRIBUTE_FLOAT;
|
2021-08-14 08:57:08 +12:00
|
|
|
}
|
|
|
|
}
|