appwrite/src/Appwrite/Utopia/Response/Model/Currency.php

78 lines
2.1 KiB
PHP
Raw Normal View History

<?php
namespace Appwrite\Utopia\Response\Model;
use Appwrite\Utopia\Response;
use Appwrite\Utopia\Response\Model;
class Currency extends Model
{
public function __construct()
{
$this
->addRule('symbol', [
2020-11-07 22:14:48 +00:00
'type' => self::TYPE_STRING,
'description' => 'Currency symbol.',
2021-01-13 15:06:36 +00:00
'default' => '',
'example' => '$',
])
->addRule('name', [
2020-11-07 22:14:48 +00:00
'type' => self::TYPE_STRING,
'description' => 'Currency name.',
2021-01-13 15:06:36 +00:00
'default' => '',
'example' => 'US dollar',
])
->addRule('symbolNative', [
2020-11-07 22:14:48 +00:00
'type' => self::TYPE_STRING,
'description' => 'Currency native symbol.',
2021-01-13 15:06:36 +00:00
'default' => '',
'example' => '$',
])
->addRule('decimalDigits', [
2020-11-07 22:14:48 +00:00
'type' => self::TYPE_INTEGER,
'description' => 'Number of decimal digits.',
2021-01-13 15:06:36 +00:00
'default' => 0,
'example' => 2,
])
->addRule('rounding', [
2020-11-07 22:14:48 +00:00
'type' => self::TYPE_FLOAT,
'description' => 'Currency digit rounding.',
2021-01-13 15:06:36 +00:00
'default' => 0,
'example' => 0,
])
->addRule('code', [
2020-11-07 22:14:48 +00:00
'type' => self::TYPE_STRING,
'description' => 'Currency code in [ISO 4217-1](http://en.wikipedia.org/wiki/ISO_4217) three-character format.',
2021-01-13 15:06:36 +00:00
'default' => '',
'example' => 'USD',
])
->addRule('namePlural', [
2020-11-07 22:14:48 +00:00
'type' => self::TYPE_STRING,
'description' => 'Currency plural name',
2021-01-13 15:06:36 +00:00
'default' => '',
'example' => 'US dollars',
])
;
}
/**
* Get Name
*
* @return string
*/
2022-05-23 14:54:50 +00:00
public function getName(): string
{
return 'Currency';
}
/**
2021-12-15 10:19:29 +00:00
* Get Type
*
* @return string
*/
2022-05-23 14:54:50 +00:00
public function getType(): string
{
return Response::MODEL_CURRENCY;
}
}