Skip to content
This repository was archived by the owner on Apr 24, 2021. It is now read-only.

Commit bf89011

Browse files
committed
update: add new class
1 parent 3172d73 commit bf89011

File tree

1 file changed

+64
-0
lines changed

1 file changed

+64
-0
lines changed

src/Type.php

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
<?php
2+
/**
3+
* Created by PhpStorm.
4+
* User: Inhere
5+
* Date: 2018/5/1 0001
6+
* Time: 19:53
7+
*/
8+
9+
namespace Toolkit\PhpUtil;
10+
11+
/**
12+
* Class Type
13+
* @package Toolkit\PhpUtil
14+
*/
15+
final class Type
16+
{
17+
// php data type
18+
const INT = 'int';
19+
const INTEGER = 'integer';
20+
const FLOAT = 'float';
21+
const DOUBLE = 'double';
22+
const BOOL = 'bool';
23+
const BOOLEAN = 'boolean';
24+
const STRING = 'string';
25+
26+
const ARRAY = 'array';
27+
const OBJECT = 'object';
28+
const RESOURCE = 'resource';
29+
30+
/**
31+
* @return array
32+
*/
33+
public static function all(): array
34+
{
35+
return [
36+
self::ARRAY,
37+
self::BOOL,
38+
self::BOOLEAN,
39+
self::DOUBLE,
40+
self::FLOAT,
41+
self::INT,
42+
self::INTEGER,
43+
self::OBJECT,
44+
self::STRING,
45+
self::RESOURCE
46+
];
47+
}
48+
49+
/**
50+
* @return array
51+
*/
52+
public static function scalars(): array
53+
{
54+
return [
55+
self::BOOL,
56+
self::BOOLEAN,
57+
self::DOUBLE,
58+
self::FLOAT,
59+
self::INT,
60+
self::INTEGER,
61+
self::STRING
62+
];
63+
}
64+
}

0 commit comments

Comments
 (0)