ASS::assigning()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 12
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 12
c 0
b 0
f 0
rs 10
cc 2
nc 2
nop 3
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