ASS   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 8
dl 0
loc 20
c 0
b 0
f 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A assigning() 0 12 2
1
<?php
2
/**
3
 * Service serving assigner
4
 * User: moyo
5
 * Date: 24/02/2018
6
 * Time: 6:16 PM
7
 */
8
9
namespace Carno\RPC\Service\SDetectors;
10
11
use Carno\RPC\Service\Router;
12
13
trait ASS
14
{
15
    /**
16
     * @param Router $router
17
     * @param string $contracts
18
     * @param array $namespaces
19
     * @return bool
20
     */
21
    protected function assigning(Router $router, string $contracts, array $namespaces) : bool
22
    {
23
        $nss = array_map(static function ($p) {
24
            return lcfirst($p);
25
        }, $namespaces);
26
27
        if (array_pop($nss) === $contracts) {
28
            $router->serving(implode('.', $nss));
29
            return true;
30
        }
31
32
        return false;
33
    }
34
}
35