Completed
Pull Request — master (#9)
by
unknown
10:39
created

Encoder::encode()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
namespace Omnipay\Paysera\Common;
4
5
class Encoder
6
{
7
    /**
8
     * Encode the input.
9
     *
10
     * @param  string  $input
11
     * @return string
12
     */
13 9
    public static function encode($input)
14
    {
15 9
        return strtr(base64_encode($input), ['+' => '-', '/' => '_']);
16
    }
17
18
    /**
19
     * Decode the input.
20
     *
21
     * @param  string  $input
22
     * @return string
23
     */
24 6
    public static function decode($input)
25
    {
26 6
        return base64_decode(strtr($input, ['-' => '+', '_' => '/']));
27
    }
28
}
29