StartTls   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 17
rs 10
c 0
b 0
f 0
wmc 2
lcom 0
cbo 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getRequired() 0 4 1
1
<?php
2
/**
3
 * Nucleus - XMPP Library for PHP
4
 *
5
 * Copyright (C) 2016, Some rights reserved.
6
 *
7
 * @author Kacper "Kadet" Donat <[email protected]>
8
 *
9
 * Contact with author:
10
 * Xmpp: [email protected]
11
 * E-mail: [email protected]
12
 *
13
 * From Kadet with love.
14
 */
15
16
namespace Kadet\Xmpp\Stream\Features;
17
18
use Kadet\Xmpp\Xml\XmlElement;
19
use Kadet\Xmpp\Utils\filter;
20
21
/**
22
 * Class StartTls
23
 * @package Kadet\Xmpp\Stream\Features
24
 *
25
 * @property-read bool       $required   True if encryption is required by server.
26
 * @property-read XmlElement $mechanisms All available mechanisms
27
 */
28
class StartTls extends XmlElement
29
{
30
    const XMLNS = 'urn:ietf:params:xml:ns:xmpp-tls';
31
32
    /**
33
     * StartTls constructor.
34
     */
35
    public function __construct()
36
    {
37
        parent::__construct('starttls', self::XMLNS);
38
    }
39
40
    public function getRequired()
41
    {
42
        return $this->get(filter\element\name('required')) !== null;
43
    }
44
}
45