Passed
Push — master ( ae3156...6fb22a )
by Esteban De La Fuente
03:24
created

PrimePackage   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 73
Duplicated Lines 0 %

Test Coverage

Coverage 57.14%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 13
c 1
b 0
f 0
dl 0
loc 73
ccs 12
cts 21
cp 0.5714
rs 10
wmc 7

7 Methods

Rating   Name   Duplication   Size   Complexity  
A getComponents() 0 8 1
A getLogComponent() 0 5 1
A getCertificateComponent() 0 3 1
A getEntityComponent() 0 3 1
A getSignatureComponent() 0 3 1
A getXmlComponent() 0 3 1
A __construct() 0 7 1
1
<?php
2
3
declare(strict_types=1);
4
5
/**
6
 * Derafu: Biblioteca PHP (Núcleo).
7
 * Copyright (C) Derafu <https://www.derafu.org>
8
 *
9
 * Este programa es software libre: usted puede redistribuirlo y/o modificarlo
10
 * bajo los términos de la Licencia Pública General Affero de GNU publicada por
11
 * la Fundación para el Software Libre, ya sea la versión 3 de la Licencia, o
12
 * (a su elección) cualquier versión posterior de la misma.
13
 *
14
 * Este programa se distribuye con la esperanza de que sea útil, pero SIN
15
 * GARANTÍA ALGUNA; ni siquiera la garantía implícita MERCANTIL o de APTITUD
16
 * PARA UN PROPÓSITO DETERMINADO. Consulte los detalles de la Licencia Pública
17
 * General Affero de GNU para obtener una información más detallada.
18
 *
19
 * Debería haber recibido una copia de la Licencia Pública General Affero de GNU
20
 * junto a este programa.
21
 *
22
 * En caso contrario, consulte <http://www.gnu.org/licenses/agpl.html>.
23
 */
24
25
namespace Derafu\Lib\Core\Package\Prime;
26
27
use Derafu\Lib\Core\Foundation\Abstract\AbstractPackage;
28
use Derafu\Lib\Core\Package\Prime\Component\Certificate\Contract\CertificateComponentInterface;
29
use Derafu\Lib\Core\Package\Prime\Component\Entity\Contract\EntityComponentInterface;
30
use Derafu\Lib\Core\Package\Prime\Component\Log\Contract\LogComponentInterface;
31
use Derafu\Lib\Core\Package\Prime\Component\Signature\Contract\SignatureComponentInterface;
32
use Derafu\Lib\Core\Package\Prime\Component\Xml\Contract\XmlComponentInterface;
33
use Derafu\Lib\Core\Package\Prime\Contract\PrimePackageInterface;
34
35
/**
36
 * Clase del paquete Prime.
37
 */
38
class PrimePackage extends AbstractPackage implements PrimePackageInterface
39
{
40
    /**
41
     * Constructor del paquete.
42
     *
43
     * @param CertificateComponentInterface $certificate
44
     * @param LogComponentInterface $log
45
     * @param SignatureComponentInterface $signature
46
     * @param XmlComponentInterface $xml
47
     */
48 6
    public function __construct(
49
        private CertificateComponentInterface $certificate,
50
        private EntityComponentInterface $entity,
51
        private LogComponentInterface $log,
52
        private SignatureComponentInterface $signature,
53
        private XmlComponentInterface $xml,
54
    ) {
55 6
    }
56
57
    /**
58
     * {@inheritdoc}
59
     */
60 1
    public function getComponents(): array
61
    {
62 1
        return [
63 1
            'certificate' => $this->certificate,
64 1
            'entity' => $this->entity,
65 1
            'log' => $this->log,
66 1
            'signature' => $this->signature,
67 1
            'xml' => $this->xml,
68 1
        ];
69
    }
70
71
    /**
72
     * {@inheritdoc}
73
     */
74
    public function getCertificateComponent(): CertificateComponentInterface
75
    {
76
        return $this->certificate;
77
    }
78
79
    /**
80
     * {@inheritdoc}
81
     */
82
    public function getEntityComponent(): EntityComponentInterface
83
    {
84
        return $this->entity;
85
    }
86
87
    /**
88
     * {@inheritdoc}
89
     */
90
    public function getLogComponent(): LogComponentInterface
91
    {
92
        $config = $this->getComponentConfiguration('log');
93
94
        return $this->log->setConfiguration($config);
95
    }
96
97
    /**
98
     * {@inheritdoc}
99
     */
100
    public function getSignatureComponent(): SignatureComponentInterface
101
    {
102
        return $this->signature;
103
    }
104
105
    /**
106
     * {@inheritdoc}
107
     */
108 3
    public function getXmlComponent(): XmlComponentInterface
109
    {
110 3
        return $this->xml;
111
    }
112
}
113