TransactionFactory   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 53
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 53
rs 10
c 0
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getIdentity() 0 3 1
A __construct() 0 5 1
A getPublicKey() 0 3 1
A create() 0 3 1
1
<?php
2
3
/**
4
 * This file is part of the Mediapart LaPresseLibre Bundle.
5
 *
6
 * CC BY-NC-SA <https://github.com/mediapart/lapresselibre-bundle>
7
 *
8
 * For the full license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Mediapart\Bundle\LaPresseLibreBundle\Factory;
13
14
use Psr\Http\Message\RequestInterface as Request;
15
use Mediapart\LaPresseLibre\Transaction;
16
use Mediapart\LaPresseLibre\Security\Identity;
17
use Mediapart\LaPresseLibre\Security\Encryption;
18
19
class TransactionFactory
20
{
21
    /**
22
     * @var int
23
     */
24
    private $publicKey;
25
26
    /**
27
     * @var Identity
28
     */
29
    private $identity;
30
31
    /**
32
     * @var Encryption
33
     */
34
    private $encryption;
35
36
    /**
37
     * @param int $publicKey
38
     * @param Identity $identity
39
     * @param Encryption $encryption
40
     */
41
    public function __construct($publicKey, Identity $identity, Encryption $encryption)
42
    {
43
        $this->publicKey = $publicKey;
44
        $this->identity = $identity;
45
        $this->encryption = $encryption;
46
    }
47
48
    /**
49
     * @param Request
50
     *
51
     * @return Transaction
52
     */
53
    public function create(Request $request)
54
    {
55
        return new Transaction($this->identity, $this->encryption, $request);
56
    }
57
58
    /**
59
     * @return integer
60
     */
61
    public function getPublicKey()
62
    {
63
        return $this->publicKey;
64
    }
65
66
    /**
67
     * @return Identity
68
     */
69
    public function getIdentity()
70
    {
71
        return $this->identity;
72
    }
73
}
74