Completed
Push — master ( d732f2...827150 )
by smiley
01:50
created

CryptoKeypair::__construct()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
cc 3
eloc 3
nc 2
nop 1
1
<?php
2
/**
3
 * Class CryptoKeypair
4
 *
5
 * @filesource   CryptoKeypair.php
6
 * @created      24.01.2018
7
 * @package      chillerlan\Traits\Crypto
8
 * @author       Smiley <[email protected]>
9
 * @copyright    2018 Smiley
10
 * @license      MIT
11
 */
12
13
namespace chillerlan\Traits\Crypto;
14
15
use chillerlan\Traits\{Container, ContainerInterface};
16
17
/**
18
 * @link https://paragonie.com/book/pecl-libsodium/read/00-intro.md
19
 * @link https://paragonie.com/book/pecl-libsodium/read/01-quick-start.md
20
 */
21
abstract class CryptoKeypair implements CryptoKeyInterface, ContainerInterface{
22
	use MemzeroDestructorTrait, Container{
23
		__construct as containerConstruct;
24
	}
25
26
	/**
27
	 * @var string
28
	 */
29
	protected $keypair;
30
31
	/**
32
	 * @var string
33
	 */
34
	protected $secret;
35
36
	/**
37
	 * @var string
38
	 */
39
	protected $public;
40
41
	/** @noinspection PhpMissingParentConstructorInspection */
42
	/**
43
	 * CryptoKeypair constructor.
44
	 *
45
	 * @param array|null $properties
46
	 *
47
	 * @throws \chillerlan\Traits\Crypto\CryptoException
48
	 */
49
	public function __construct(array $properties = null){
50
51
		if(!extension_loaded('sodium') || !function_exists('sodium_memzero')){
52
			throw new CryptoException('sodium extension (PHP 7.2+) required!'); // @codeCoverageIgnore
53
		}
54
55
		$this->containerConstruct($properties);
0 ignored issues
show
Bug introduced by
The method containerConstruct() does not exist on chillerlan\Traits\Crypto\CryptoKeypair. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

55
		$this->/** @scrutinizer ignore-call */ 
56
         containerConstruct($properties);

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
56
	}
57
58
}
59