Completed
Push — master ( 2b6d49...c13cc5 )
by Florent
02:37
created

EncrypterFactory   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 1
c 1
b 0
f 1
lcom 0
cbo 4
dl 0
loc 18
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A createEncrypter() 0 8 1
1
<?php
2
3
/*
4
 * The MIT License (MIT)
5
 *
6
 * Copyright (c) 2014-2015 Spomky-Labs
7
 *
8
 * This software may be modified and distributed under the terms
9
 * of the MIT license.  See the LICENSE file for details.
10
 */
11
12
namespace Jose\Factory;
13
14
use Jose\Encrypter;
15
16
final class EncrypterFactory
17
{
18
    /**
19
     * @param string[]                                  $algorithms
20
     * @param \Jose\Payload\PayloadConverterInterface[] $payload_converters
21
     * @param string[]                                  $compression_methods
22
     *
23
     * @return \Jose\EncrypterInterface
24
     */
25
    public static function createEncrypter(array $algorithms, array $payload_converters = [], array $compression_methods = ['DEF'])
26
    {
27
        $algorithm_manager = AlgorithmManagerFactory::createAlgorithmManager($algorithms);
28
        $payload_converter_manager = PayloadConverterFactory::createPayloadConverter($payload_converters);
29
        $compression_manager = CompressionManagerFactory::createCompressionManager($compression_methods);
30
31
        return new Encrypter($algorithm_manager, $payload_converter_manager, $compression_manager);
32
    }
33
}
34