forked from nelmio/NelmioApiDocBundle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
DataTypes.php
63 lines (49 loc) · 1.33 KB
/
DataTypes.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<?php
/*
* This file is part of the NelmioApiDocBundle.
*
* (c) Nelmio <[email protected]>
*
* 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 <[email protected]>
*/
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,
));
}
}