Completed
Push — master ( 771e5d...491b8d )
by Jeff
02:21
created

Manager   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A refresh() 0 7 1
1
<?php
2
3
declare(strict_types=1);
4
/**
5
 * This file is part of the mailserver-admin package.
6
 * (c) Jeffrey Boehm <https://github.com/jeboehm/mailserver-admin>
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace App\Service\Config;
12
13
use App\Entity\Domain;
14
use Doctrine\ORM\EntityManagerInterface;
15
16
class Manager
17
{
18
    private $cleaner;
19
    private $generator;
20
    private $manager;
21
22
    public function __construct(LeftoverFileCleaner $cleaner, MapGenerator $generator, EntityManagerInterface $manager)
23
    {
24
        $this->cleaner = $cleaner;
25
        $this->generator = $generator;
26
        $this->manager = $manager;
27
    }
28
29
    public function refresh(): void
30
    {
31
        /** @var Domain $domains */
32
        $domains = $this->manager->getRepository(Domain::class)->findAll();
33
34
        $this->cleaner->clean(...$domains);
35
        $this->generator->generate(...$domains);
36
    }
37
}
38