Completed
Push — master ( 01d609...f0430d )
by Mathieu
11s
created

typedStructure()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 9
rs 9.6666
c 0
b 0
f 0
cc 1
eloc 6
nc 1
nop 0
1
<?php
2
3
namespace LaravelFr\ApiTesting\Tests\Stubs;
4
5
use JsonSerializable;
6
7
class JsonSerializableMixedResourcesStub implements JsonSerializable
8
{
9
    public function jsonSerialize()
10
    {
11
        return [
12
            'foo' => 134,
13
            'foobar' => [
14
                'foobar_foo' => 'foo',
15
                'foobar_bar' => 212,
16
            ],
17
            'bars'   => [
18
                ['bar' => true, 'foo' => 134.212],
19
                ['bar' => false, 'foo' => 134.212],
20
                ['bar' => false, 'foo' => 134.212],
21
            ],
22
            'baz'    => [
23
                ['foo' => 'bar 0', 'bar' => ['foo' => true, 'bar' => 134]],
24
                ['foo' => 'bar 1', 'bar' => ['foo' => false, 'bar' => 212]],
25
            ],
26
        ];
27
    }
28
29
    public function structure()
30
    {
31
        return [
32
            'foo',
33
            'baz' => ['*' => ['bar' => ['*'], 'foo']],
34
            'bars' => ['*' => ['bar', 'foo']],
35
            'foobar' => ['foobar_foo', 'foobar_bar'],
36
        ];
37
    }
38
39
    public function typedStructure()
40
    {
41
        return [
42
            'foo' => 'integer',
43
            'baz' => ['*' => ['bar' => 'array', 'foo' => 'string']],
44
            'bars' => ['*' => ['bar' => 'boolean', 'foo' => 'float']],
45
            'foobar' => ['foobar_foo' => 'string', 'foobar_bar' => 'int'],
46
        ];
47
    }
48
}
49