Completed
Push — master ( 18b606...1191a0 )
by yuuki
04:00
created

ClientSession   A

Complexity

Total Complexity 15

Size/Duplication

Total Lines 150
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 0

Importance

Changes 0
Metric Value
wmc 15
lcom 2
cbo 0
dl 0
loc 150
rs 10
c 0
b 0
f 0

15 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A setSchema() 0 4 1
A setUser() 0 4 1
A setSource() 0 4 1
A setTransactionId() 0 4 1
A setProperty() 0 4 1
A setPreparedStatement() 0 4 1
A getProperty() 0 4 1
A getPreparedStatement() 0 4 1
A getHost() 0 4 1
A getCatalog() 0 4 1
A getSchema() 0 4 1
A getUser() 0 4 1
A getSource() 0 4 1
A getTransactionId() 0 4 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Ytake\PrestoClient;
5
6
use Ramsey\Uuid\UuidInterface;
7
use Ytake\PrestoClient\Session\Property;
8
use Ytake\PrestoClient\Session\PreparedStatement;
9
10
/**
11
 * Class PrestoSession
12
 */
13
class ClientSession
14
{
15
    /** @var string */
16
    protected $host;
17
18
    /** @var string */
19
    protected $catalog;
20
21
    /** @var UuidInterface */
22
    protected $transactionId;
23
24
    /** @var string */
25
    protected $schema = 'default';
26
27
    /** @var string */
28
    protected $user = 'presto';
29
30
    /** @var string */
31
    protected $source = PrestoHeaders::PRESTO_SOURCE_VALUE;
32
33
    /** @var Property[] */
34
    protected $property = [];
35
36
    /** @var PreparedStatement[] */
37
    protected $preparedStatement = [];
38
39
    /**
40
     * PrestoSession constructor.
41
     *
42
     * @param string $host
43
     * @param string $catalog
44
     */
45
    public function __construct(string $host, string $catalog)
46
    {
47
        $this->host = $host;
48
        $this->catalog = $catalog;
49
    }
50
51
    /**
52
     * @param string $schema
53
     */
54
    public function setSchema(string $schema)
55
    {
56
        $this->schema = $schema;
57
    }
58
59
    /**
60
     * @param string $user
61
     */
62
    public function setUser(string $user)
63
    {
64
        $this->user = $user;
65
    }
66
67
    /**
68
     * @param string $source
69
     */
70
    public function setSource(string $source)
71
    {
72
        $this->source = $source;
73
    }
74
75
    /**
76
     * @param UuidInterface $transactionId
77
     */
78
    public function setTransactionId(UuidInterface $transactionId)
79
    {
80
        $this->transactionId = $transactionId;
81
    }
82
83
    /**
84
     * @param Property $property
85
     */
86
    public function setProperty(Property $property)
87
    {
88
        $this->property[] = $property;
89
    }
90
91
    /**
92
     * @param PreparedStatement $preparedStatement
93
     */
94
    public function setPreparedStatement(PreparedStatement $preparedStatement)
95
    {
96
        $this->preparedStatement[] = $preparedStatement;
97
    }
98
99
    /**
100
     * @return Property[]
101
     */
102
    public function getProperty(): array
103
    {
104
        return $this->property;
105
    }
106
107
    /**
108
     * @return PreparedStatement[]
109
     */
110
    public function getPreparedStatement(): array
111
    {
112
        return $this->preparedStatement;
113
    }
114
115
    /**
116
     * @return string
117
     */
118
    public function getHost(): string
119
    {
120
        return $this->host;
121
    }
122
123
    /**
124
     * @return string
125
     */
126
    public function getCatalog(): string
127
    {
128
        return $this->catalog;
129
    }
130
131
    /**
132
     * @return string
133
     */
134
    public function getSchema(): string
135
    {
136
        return $this->schema;
137
    }
138
139
    /**
140
     * @return string
141
     */
142
    public function getUser(): string
143
    {
144
        return $this->user;
145
    }
146
147
    /**
148
     * @return string
149
     */
150
    public function getSource(): string
151
    {
152
        return $this->source;
153
    }
154
155
    /**
156
     * @return UuidInterface|null
157
     */
158
    public function getTransactionId()
159
    {
160
        return $this->transactionId;
161
    }
162
}
163