Udp   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A call() 0 15 2
1
<?php
2
namespace Health\Checks\Network;
3
4
use Health\Checks\HealthCheckInterface;
5
use Health\Checks\BaseCheck;
6
use Health\Checks\Traits\SocketTrait;
7
8
class Udp extends BaseCheck implements HealthCheckInterface
9
{
10
    use SocketTrait;
11
12
    /**
13
     *
14
     * {@inheritdoc}
15
     * @see \Health\Checks\HealthCheckInterface::call()
16
     */
17
    public function call()
18
    {
19
        $builder = $this->getBuilder();
20
21
        $address = $this->getParam('address', '');
22
23
        $this->create(AF_INET, SOCK_DGRAM, SOL_UDP);
24
25
        if (! $this->connect($address)) {
26
            $builder->down()->withData('error', $this->getError());
27
        }
28
29
        $this->close();
30
31
        return $builder->build();
32
    }
33
}
34