Completed
Push — vcard ( 1c7030 )
by mw
05:55 queued 30s
created

Email   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 0
dl 0
loc 34
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A text() 0 8 2
1
<?php
2
3
namespace SRF\vCard;
4
5
/**
6
 * Represents a single email entry in an vCard entry.
7
 *
8
 * @see http://www.semantic-mediawiki.org/wiki/vCard
9
 *
10
 * @license GNU GPL v2+
11
 * @since 1.5
12
 *
13
 * @author Markus Krötzsch
14
 * @author Denny Vrandecic
15
 * @author Frank Dengler
16
 */
17
class Email {
18
19
	/**
20
	 * @var string
21
	 */
22
	private $type;
23
24
	/**
25
	 * @var string
26
	 */
27
	private $emailaddress;
28
29
	/**
30
	 * @param string $type
31
	 * @param string $emailaddress
32
	 */
33
	public function __construct( $type, $emailaddress ) {
34
		$this->type = $type;
35
		$this->emailaddress = $emailaddress; // no escape, normally not needed anyway
36
	}
37
38
	/**
39
	 * Creates the vCard output for a single email item.
40
	 */
41
	public function text() {
42
43
		if ( $this->type == "" ) {
44
			$this->type = "INTERNET";
45
		}
46
47
		return "EMAIL;TYPE=$this->type:$this->emailaddress\r\n";
48
	}
49
50
}