Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 24
0.00% covered (danger)
0.00%
0 / 1
CRAP
0.00% covered (danger)
0.00%
0 / 1
ToolCloner
0.00% covered (danger)
0.00%
0 / 24
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 1
 cloneReferentForCollectivity
0.00% covered (danger)
0.00%
0 / 24
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3/**
4 * This file is part of the MADIS - RGPD Management application.
5 *
6 * @copyright Copyright (c) 2018-2019 Soluris - Solutions Numériques Territoriales Innovantes
7 *
8 * This program is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU Affero General Public License as published by
10 * the Free Software Foundation, either version 3 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU Affero General Public License for more details.
17 *
18 * You should have received a copy of the GNU Affero General Public License
19 * along with this program. If not, see <https://www.gnu.org/licenses/>.
20 */
21
22declare(strict_types=1);
23
24namespace App\Domain\Admin\Cloner;
25
26use App\Domain\Registry\Model as RegistryModel;
27use App\Domain\User\Model as UserModel;
28
29class ToolCloner extends AbstractCloner
30{
31    /**
32     * @param RegistryModel\Tool $referent
33     *
34     * @throws \Exception
35     */
36    protected function cloneReferentForCollectivity($referent, UserModel\Collectivity $collectivity): RegistryModel\Tool
37    {
38        $tool = new RegistryModel\Tool();
39
40        $tool->setName($referent->getName());
41        $tool->setType($referent->getType());
42        $tool->setEditor($referent->getEditor());
43        $tool->setArchival($referent->getArchival());
44        $tool->setEncrypted($referent->getEncrypted());
45        $tool->setAccessControl($referent->getAccessControl());
46        $tool->setUpdate($referent->getUpdate());
47        $tool->setBackup($referent->getBackup());
48        $tool->setDeletion($referent->getDeletion());
49        $tool->setHasComment($referent->getHasComment());
50        $tool->setOther($referent->getOther());
51        $tool->setTracking($referent->getTracking());
52        $tool->setManager($referent->getManager());
53        $tool->setDescription($referent->getDescription());
54        $tool->setProdDate($referent->getProdDate());
55        $tool->setCountryType($referent->getCountryType());
56        $tool->setCountryName($referent->getCountryName());
57        $tool->setCountryGuarantees($referent->getCountryGuarantees());
58        $tool->setOtherInfo($referent->getOtherInfo());
59        $tool->setOtherInfo($referent->getOtherInfo());
60
61        $tool->setCollectivity($collectivity);
62        $tool->setClonedFrom($referent);
63
64        return $tool;
65    }
66}