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

DecrypterFactory::createDecrypter()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 9
rs 9.6667
cc 1
eloc 6
nc 1
nop 4
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\Decrypter;
15
16
final class DecrypterFactory
17
{
18
    /**
19
     * @param string[]                                  $algorithms
20
     * @param \Jose\Payload\PayloadConverterInterface[] $payload_converters
21
     * @param string[]                                  $compression_methods
22
     * @param \Jose\Checker\CheckerInterface[]          $checker_managers
23
     *
24
     * @return \Jose\DecrypterInterface
25
     */
26
    public static function createDecrypter(array $algorithms, array $payload_converters = [], array $compression_methods = ['DEF'], array $checker_managers = [])
27
    {
28
        $algorithm_manager = AlgorithmManagerFactory::createAlgorithmManager($algorithms);
29
        $payload_converter_manager = PayloadConverterFactory::createPayloadConverter($payload_converters);
30
        $compression_manager = CompressionManagerFactory::createCompressionManager($compression_methods);
31
        $checker_manager = CheckerManagerFactory::createCheckerManager($checker_managers);
32
33
        return new Decrypter($algorithm_manager, $payload_converter_manager, $compression_manager, $checker_manager);
34
    }
35
}
36