| Conditions | 4 |
| Paths | 6 |
| Total Lines | 26 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 4 |
| Changes | 0 | ||
| 1 | <?php |
||
| 60 | 2 | public function text() { |
|
| 61 | |||
| 62 | 2 | if ( $this->type == "" ) { |
|
| 63 | 1 | $this->type = "WORK"; |
|
| 64 | } |
||
| 65 | |||
| 66 | 2 | $adr = []; |
|
| 67 | |||
| 68 | // Expected sequence as defined by |
||
| 69 | // https://tools.ietf.org/html/rfc6350#section-6.3.1 |
||
| 70 | $map = [ |
||
| 71 | 2 | 'pobox', |
|
| 72 | 'ext', |
||
| 73 | 'street', |
||
| 74 | 'locality', |
||
| 75 | 'region', |
||
| 76 | 'code', |
||
| 77 | 'country' |
||
| 78 | ]; |
||
| 79 | |||
| 80 | 2 | foreach ( $map as $k ) { |
|
| 81 | 2 | $adr[] = isset( $this->adr[$k] ) ? vCard::escape( $this->adr[$k] ) : ''; |
|
| 82 | } |
||
| 83 | |||
| 84 | 2 | return "ADR;TYPE=$this->type;CHARSET=UTF-8:" . implode( ';', $adr ) . "\r\n"; |
|
| 85 | } |
||
| 86 | |||
| 88 |