NelmioApiDocBundle/DataTypes.php
William Durand 0a1cef77ad
cs
2015-03-06 11:19:08 +01:00

64 lines
1.3 KiB
PHP

<?php
/*
* This file is part of the NelmioApiDocBundle.
*
* (c) Nelmio <hello@nelm.io>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Nelmio\ApiDocBundle;
/**
* All the supported data-types which will be specified in the `actualType` properties in parameters.
*
* @author Bez Hermoso <bez@activelamp.com>
*/
class DataTypes
{
const INTEGER = 'integer';
const FLOAT = 'float';
const STRING = 'string';
const BOOLEAN = 'boolean';
const FILE = 'file';
const ENUM = 'choice';
const COLLECTION = 'collection';
const MODEL = 'model';
const DATE = 'date';
const DATETIME = 'datetime';
const TIME = 'time';
/**
* Returns true if the supplied `actualType` value is considered a primitive type. Returns false, otherwise.
*
* @param string $type
* @return bool
*/
public static function isPrimitive($type)
{
return in_array(strtolower($type), array(
static::INTEGER,
static::FLOAT,
static::STRING,
static::BOOLEAN,
static::FILE,
static::DATE,
static::DATETIME,
static::TIME,
static::ENUM,
));
}
}