Test Failed
Branch feature/dynamodb (336f9f)
by Csaba
05:26
created

FooSchema   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 2
dl 0
loc 40
c 0
b 0
f 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
1
<?php
2
namespace Fathomminds\Rest\Examples\Clusterpoint\Models\Schema;
3
4
use Fathomminds\Rest\Schema\SchemaValidator;
5
use Fathomminds\Rest\Schema\TypeValidators\StringValidator;
6
use Fathomminds\Rest\Schema\TypeValidators\IntegerValidator;
7
use Fathomminds\Rest\Helpers\Uuid;
8
9
class FooSchema extends SchemaValidator
10
{
11
    protected $fields = [
12
        '_id' => [
13
            'validator' => [
14
                'class' => StringValidator::class,
15
            ]
16
        ],
17
        'title' => [
18
            'unique' => true,
19
            'required' => true,
20
            'validator' => [
21
                'class' => StringValidator::class,
22
                'params' => [
23
                    'maxLength' => 100,
24
                ],
25
            ],
26
        ],
27
        'status' => [
28
            'default' => 0,
29
            'validator' => [
30
                'class' => IntegerValidator::class,
31
                'params' => [
32
                    'min' => 0,
33
                    'max' => 1,
34
                ],
35
            ],
36
        ],
37
        'bar' => [
38
            'type' => BarSchema::class,
39
        ],
40
    ];
41
42
    public function __construct()
43
    {
44
        $this->setDefault('_id', function () {
45
            return (new Uuid)->generate();
46
        });
47
    }
48
}
49