Inherit   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 16
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A sync() 0 9 2
1
<?php
2
/**
3
 * Valid inherit
4
 * User: moyo
5
 * Date: 2018/6/4
6
 * Time: 2:22 PM
7
 */
8
9
namespace Carno\Validator\Valid;
10
11
class Inherit
12
{
13
    /**
14
     * @param string $group
15
     * @param Group $source
16
     * @param Executor $linker
17
     */
18
    public function sync(string $group, Group $source, Executor $linker) : void
19
    {
20
        $fn = static function () use ($group, $source, $linker) {
21
            $source->traversing($group, function (Executor $origin, string $field) use ($linker) {
22
                $linker->import($origin->export($field));
23
            });
24
        };
25
26
        $source->has($group) ? $fn() : $source->wait($group, $fn);
27
    }
28
}
29