Completed
Push — master ( df309f...9e12f0 )
by Rafael
08:32
created

Base64IDEncoder   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
eloc 3
dl 0
loc 16
c 0
b 0
f 0
ccs 4
cts 4
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A decode() 0 3 1
A encode() 0 3 1
1
<?php
2
/*******************************************************************************
3
 *  This file is part of the GraphQL Bundle package.
4
 *
5
 *  (c) YnloUltratech <[email protected]>
6
 *
7
 *  For the full copyright and license information, please view the LICENSE
8
 *  file that was distributed with this source code.
9
 ******************************************************************************/
10
11
namespace Ynlo\GraphQLBundle\Encoder;
12
13
use Ynlo\GraphQLBundle\Model\NodeInterface;
14
15
class Base64IDEncoder extends SimpleIDEncoder
16
{
17
    /**
18
     * {@inheritDoc}
19
     */
20 1
    public function encode(NodeInterface $node): ?string
21
    {
22 1
        return base64_encode(parent::encode($node));
23
    }
24
25
    /**
26
     * {@inheritDoc}
27
     */
28 1
    public function decode($globalId): ?NodeInterface
29
    {
30 1
        return parent::decode(base64_decode($globalId));
31
    }
32
}
33