GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( a7fcfa...a41913 )
by Joni
04:13
created

DirectoryName::fromChosenASN1()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 3
Ratio 100 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 1 Features 0
Metric Value
dl 3
loc 3
ccs 2
cts 2
cp 1
rs 10
c 1
b 1
f 0
cc 1
eloc 2
nc 1
nop 1
crap 1
1
<?php
2
3
namespace X509\GeneralName;
4
5
use ASN1\Type\Tagged\ExplicitlyTaggedType;
6
use ASN1\Type\UnspecifiedType;
7
use X501\ASN1\Name;
8
9
10
/**
11
 * Implements <i>directoryName</i> CHOICE type of <i>GeneralName</i>.
12
 *
13
 * @link https://tools.ietf.org/html/rfc5280#section-4.2.1.6
14
 */
15 View Code Duplication
class DirectoryName extends GeneralName
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
16
{
17
	/**
18
	 * Directory name.
19
	 *
20
	 * @var Name $_dn
21
	 */
22
	protected $_dn;
23
	
24
	/**
25
	 * Constructor
26
	 *
27
	 * @param Name $dn
28
	 */
29 45
	public function __construct(Name $dn) {
30 45
		$this->_tag = self::TAG_DIRECTORY_NAME;
31 45
		$this->_dn = $dn;
32 45
	}
33
	
34
	/**
35
	 *
36
	 * @param UnspecifiedType $el
37
	 * @return self
38
	 */
39 29
	public static function fromChosenASN1(UnspecifiedType $el) {
40 29
		return new self(Name::fromASN1($el->asSequence()));
41
	}
42
	
43
	/**
44
	 * Initialize from distinguished name string.
45
	 *
46
	 * @param string $str
47
	 * @return self
48
	 */
49 15
	public static function fromDNString($str) {
50 15
		return new self(Name::fromString($str));
51
	}
52
	
53 3
	public function string() {
54 3
		return $this->_dn->toString();
55
	}
56
	
57
	/**
58
	 * Get directory name.
59
	 *
60
	 * @return Name
61
	 */
62 16
	public function dn() {
63 16
		return $this->_dn;
64
	}
65
	
66 42
	protected function _choiceASN1() {
67
		// Name type is itself a CHOICE, so explicit tagging must be
68
		// employed to avoid ambiguities
69 42
		return new ExplicitlyTaggedType($this->_tag, $this->_dn->toASN1());
70
	}
71
}
72