ModernConnection::getApplication()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 1
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