DeliveryRecipientsEndpoint   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 5
c 1
b 0
f 0
dl 0
loc 24
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A block() 0 3 1
A resend() 0 3 1
A __construct() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace DigitalCz\DigiSign\Endpoint;
6
7
use DigitalCz\DigiSign\Endpoint\Traits\CRUDEndpointTrait;
8
use DigitalCz\DigiSign\Resource\Delivery;
9
use DigitalCz\DigiSign\Resource\DeliveryRecipient;
10
use DigitalCz\DigiSign\Resource\ResourceInterface;
11
12
/**
13
 * @extends ResourceEndpoint<DeliveryRecipient>
14
 * @method DeliveryRecipient get(string $id)
15
 * @method DeliveryRecipient create(array $body)
16
 * @method DeliveryRecipient update(string $id, array $body)
17
 */
18
final class DeliveryRecipientsEndpoint extends ResourceEndpoint
19
{
20
    /** @use CRUDEndpointTrait<DeliveryRecipient> */
21
    use CRUDEndpointTrait;
22
23
    /**
24
     * @param Delivery|string $delivery
25
     */
26
    public function __construct(DeliveriesEndpoint $parent, $delivery)
27
    {
28
        parent::__construct($parent, '/{delivery}/recipients', DeliveryRecipient::class, ['delivery' => $delivery]);
29
    }
30
31
    /**
32
     * @param DeliveryRecipient|string $recipient
33
     */
34
    public function block($recipient): RecipientBlockEndpoint
35
    {
36
        return new RecipientBlockEndpoint($this, $recipient);
37
    }
38
39
    public function resend(string $id): ResourceInterface
40
    {
41
        return $this->createResource($this->postRequest('/{id}/resend', ['id' => $id]));
42
    }
43
}
44