Completed
Pull Request — master (#364)
by thomas
21:20 queued 30s
created

SignatureFactory::fromHex()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1.064

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 6
ccs 3
cts 5
cp 0.6
crap 1.064
rs 9.4285
1
<?php
2
3
namespace BitWasp\Bitcoin\Signature;
4
5
use BitWasp\Bitcoin\Crypto\EcAdapter\Adapter\EcAdapterInterface;
6
use BitWasp\Bitcoin\Crypto\EcAdapter\Signature\SignatureInterface;
7
use BitWasp\Bitcoin\Crypto\EcAdapter\EcSerializer;
8
use BitWasp\Bitcoin\Crypto\EcAdapter\Serializer\Signature\DerSignatureSerializerInterface;
9
10
class SignatureFactory
11
{
12
13
    /**
14
     * @param \BitWasp\Buffertools\BufferInterface|string $string
15
     * @param EcAdapterInterface $ecAdapter
16
     * @return SignatureInterface
17
     */
18 1
    public static function fromHex($string, EcAdapterInterface $ecAdapter = null)
19
    {
20
        /** @var DerSignatureSerializerInterface $serializer */
21 1
        $serializer = EcSerializer::getSerializer(DerSignatureSerializerInterface::class, true, $ecAdapter);
22 1
        return $serializer->parse($string);
23
    }
24
}
25