-
-
Notifications
You must be signed in to change notification settings - Fork 294
/
Type.php
38 lines (33 loc) · 1.06 KB
/
Type.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
<?php
namespace Doctrine\Common\Annotations\Annotation;
final class Type
{
const TYPE_INTEGER = 'integer';
const TYPE_DOUBLE = 'double';
const TYPE_BOOLEAN = 'boolean';
const TYPE_ARRAY = 'array';
const TYPE_UNKNOWN = 'unknown';
public $name;
public $type;
public function __construct(array $values)
{
if (isset($values['value'])) {
$name = $values['value'];
if (false !== $pos = strpos($name, ' ')) {
$name = substr($name, 0, $pos);
}
$this->name = $name;
if ('integer' === $name || 'int' === $name) {
$this->type = self::TYPE_INTEGER;
} else if ('double' === $name || 'float' === $name) {
$this->type = self::TYPE_FLOAT;
} else if ('string' === $name) {
$this->type = self::TYPE_STRING;
} else if ('array' === $name) {
$this->type = self::TYPE_ARRAY;
} else {
$this->type = self::TYPE_UNKNOWN;
}
}
}
}