-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Expand file tree
/
Copy pathFieldHelper.php
More file actions
47 lines (43 loc) · 1.09 KB
/
FieldHelper.php
File metadata and controls
47 lines (43 loc) · 1.09 KB
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
<?php
declare(strict_types=1);
namespace PhpMyAdmin\Tests;
use PhpMyAdmin\FieldMetadata;
class FieldHelper
{
/**
* @param array<string,string|int> $metadata
* @psalm-param array{
* name?: non-empty-string,
* orgname?: string,
* table?: string,
* orgtable?: string,
* max_length?: int,
* length?: int,
* charsetnr?: int,
* flags?: int,
* type: int,
* decimals?: int,
* db?: string,
* def?: string,
* catalog?: string,
* } $metadata
*/
public static function fromArray(array $metadata): FieldMetadata
{
return new FieldMetadata((object) ($metadata + [
'name' => 'c',
'orgname' => '',
'table' => '',
'orgtable' => '',
'max_length' => 0,
'length' => 0,
'charsetnr' => -1,
'flags' => 0,
// 'type' => MYSQLI_TYPE_STRING,
'decimals' => 0,
'catalog' => 'def',
'db' => '',
'def' => '',
]));
}
}