Completed
Push — v2.0.x ( 7a58b6 )
by Florent
24:58
created

JWEFactory   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 1 1
A createJWE() 0 11 2
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\Object\JWE;
15
16
final class JWEFactory
17
{
18
    /**
19
     * JWEFactory constructor.
20
     *
21
     * This factory is not supposed to be instantiated
22
     */
23
    private function __construct() {}
24
25
    /**
26
     * @param mixed                                     $payload
27
     * @param null|string                               $aad
28
     *
29
     * @return \Jose\Object\JWEInterface
30
     */
31
    public static function createJWE($payload, $aad = null)
32
    {
33
        $jwe = new JWE();
34
        $jwe = $jwe->withPayload($payload);
35
36
        if (null !== $aad) {
37
            $jwe = $jwe->withAAD($aad);
38
        }
39
40
        return $jwe;
41
    }
42
}
43