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

ModernConnection   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 45
c 0
b 0
f 0
wmc 5
lcom 1
cbo 0
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A connect() 0 4 1
A isConnected() 0 4 1
A disconnect() 0 9 2
A getApplication() 0 4 1
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