Completed
Push — master ( 7381e1...0d723c )
by Korvin
02:16
created

ModernConnection::disconnect()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

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