Passed
Push — master ( f03bc5...7bdbd5 )
by Adam
42s queued 11s
created

TableRequest::createRecords()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 8
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 8
c 0
b 0
f 0
dl 0
loc 14
ccs 8
cts 8
cp 1
rs 10
cc 1
nc 1
nop 2
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Beachcasts\Airtable\Request;
6
7
use Assert\Assert;
8
use GuzzleHttp\Psr7\Request;
9
10
class TableRequest extends Request
11
{
12 1
    public static function createRecords(string $tableName, array $records): Request
13
    {
14 1
        Assert::thatAll($records)
15 1
            ->keyExists('fields');
16
17 1
        return new self(
18 1
            'POST',
19
            $tableName,
20
            [
21 1
                'Content-Type' => 'application/json',
22
            ],
23 1
            json_encode(
24
                [
25 1
                    'records' => $records
26
                ]
27
            )
28
        );
29
    }
30
}
31