Create   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 11
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
eloc 5
c 1
b 0
f 0
dl 0
loc 11
ccs 5
cts 5
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A create() 0 6 1
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