Passed
Push — master ( 57c539...d81008 )
by Esteban De La Fuente
14:52
created

PrimePackage   A

Complexity

Total Complexity 9

Size/Duplication

Total Lines 96
Duplicated Lines 0 %

Test Coverage

Coverage 59.26%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 17
c 1
b 0
f 0
dl 0
loc 96
ccs 16
cts 27
cp 0.5926
rs 10
wmc 9

9 Methods

Rating   Name   Duplication   Size   Complexity  
A getComponents() 0 10 1
A getLogComponent() 0 5 1
A getCertificateComponent() 0 3 1
A getEntityComponent() 0 3 1
A getSignatureComponent() 0 3 1
A getTemplateComponent() 0 3 1
A getMailComponent() 0 3 1
A getXmlComponent() 0 3 1
A __construct() 0 9 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\Mail\Contract\MailComponentInterface;
32
use Derafu\Lib\Core\Package\Prime\Component\Signature\Contract\SignatureComponentInterface;
33
use Derafu\Lib\Core\Package\Prime\Component\Template\Contract\TemplateComponentInterface;
34
use Derafu\Lib\Core\Package\Prime\Component\Xml\Contract\XmlComponentInterface;
35
use Derafu\Lib\Core\Package\Prime\Contract\PrimePackageInterface;
36
37
/**
38
 * Clase del paquete Prime.
39
 */
40
class PrimePackage extends AbstractPackage implements PrimePackageInterface
41
{
42
    /**
43
     * Constructor del paquete.
44
     *
45
     * @param CertificateComponentInterface $certificate
46
     * @param EntityComponentInterface $entity
47
     * @param LogComponentInterface $log
48
     * @param MailComponentInterface $mail
49
     * @param SignatureComponentInterface $signature
50
     * @param TemplateComponentInterface $template
51
     * @param XmlComponentInterface $xml
52
     */
53 8
    public function __construct(
54
        private CertificateComponentInterface $certificate,
55
        private EntityComponentInterface $entity,
56
        private LogComponentInterface $log,
57
        private MailComponentInterface $mail,
58
        private SignatureComponentInterface $signature,
59
        private TemplateComponentInterface $template,
60
        private XmlComponentInterface $xml,
61
    ) {
62 8
    }
63
64
    /**
65
     * {@inheritDoc}
66
     */
67 1
    public function getComponents(): array
68
    {
69 1
        return [
70 1
            'certificate' => $this->certificate,
71 1
            'entity' => $this->entity,
72 1
            'log' => $this->log,
73 1
            'mail' => $this->mail,
74 1
            'signature' => $this->signature,
75 1
            'template' => $this->template,
76 1
            'xml' => $this->xml,
77 1
        ];
78
    }
79
80
    /**
81
     * {@inheritDoc}
82
     */
83
    public function getCertificateComponent(): CertificateComponentInterface
84
    {
85
        return $this->certificate;
86
    }
87
88
    /**
89
     * {@inheritDoc}
90
     */
91
    public function getEntityComponent(): EntityComponentInterface
92
    {
93
        return $this->entity;
94
    }
95
96
    /**
97
     * {@inheritDoc}
98
     */
99
    public function getLogComponent(): LogComponentInterface
100
    {
101
        $config = $this->getComponentConfiguration('log');
102
103
        return $this->log->setConfiguration($config);
104
    }
105
106
    /**
107
     * {@inheritDoc}
108
     */
109
    public function getMailComponent(): MailComponentInterface
110
    {
111
        return $this->mail;
112
    }
113
114
    /**
115
     * {@inheritDoc}
116
     */
117
    public function getSignatureComponent(): SignatureComponentInterface
118
    {
119
        return $this->signature;
120
    }
121
122
    /**
123
     * {@inheritDoc}
124
     */
125 2
    public function getTemplateComponent(): TemplateComponentInterface
126
    {
127 2
        return $this->template;
128
    }
129
130
    /**
131
     * {@inheritDoc}
132
     */
133 3
    public function getXmlComponent(): XmlComponentInterface
134
    {
135 3
        return $this->xml;
136
    }
137
}
138