Create::create()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 4
c 1
b 0
f 0
nc 1
nop 3
dl 0
loc 6
ccs 5
cts 5
cp 1
crap 1
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Swis\JsonApi\Client\Actions;
6
7
use Swis\JsonApi\Client\Interfaces\ItemInterface;
8
9
/**
10
 * @template TItem of \Swis\JsonApi\Client\Interfaces\ItemInterface
11
 */
12
trait Create
13
{
14
    /**
15
     * @return \Swis\JsonApi\Client\Interfaces\ItemDocumentInterface<TItem>
16
     */
17 4
    public function create(ItemInterface $item, array $parameters = [], array $headers = [])
18
    {
19 4
        return $this->getClient()->post(
0 ignored issues
show
Bug introduced by
It seems like getClient() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

19
        return $this->/** @scrutinizer ignore-call */ getClient()->post(
Loading history...
20 4
            $this->getEndpoint().'?'.http_build_query($parameters),
0 ignored issues
show
Bug introduced by
It seems like getEndpoint() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

20
            $this->/** @scrutinizer ignore-call */ 
21
                   getEndpoint().'?'.http_build_query($parameters),
Loading history...
21 4
            $this->documentFactory->make($item),
22 2
            $headers,
23 2
        );
24
    }
25
}
26