ModernConnection::disconnect()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 9
c 0
b 0
f 0
ccs 5
cts 5
cp 1
rs 9.6666
cc 2
eloc 5
nc 2
nop 0
crap 2
1
<?php
2
3
namespace Buttress\ConcreteClient\Connection;
4
5
use Concrete\Core\Application\Application;
6
7
class ModernConnection implements Connection
8
{
9
    protected $application;
10
11
    /**
12
     * Connect to modern concrete5
13
     * @param \Concrete\Core\Application\Application $application
14
     */
15 12
    public function connect(Application $application)
16
    {
17 12
        $this->application = $application;
18 12
    }
19
20
    /**
21
     * Determine if this connection is connected
22
     * @return mixed
23
     */
24 4
    public function isConnected()
25
    {
26 4
        return $this->application !== null;
27
    }
28
29
    /**
30
     * Disconnect a connection
31
     * @return bool Success or failure
32
     */
33 4
    public function disconnect()
34
    {
35 4
        if (!$this->isConnected()) {
36 4
            return false;
37
        }
38
39 4
        $this->application = null;
40 4
        return true;
41
    }
42
43
    /**
44
     * @return Application
45
     */
46 12
    public function getApplication()
47
    {
48 12
        return $this->application;
49
    }
50
}
51