@@ -8,11 +8,11 @@ discard block |
||
8 | 8 | |
9 | 9 | |
10 | 10 | $db = new ClickHouseDB\Client($config); |
11 | -$db->settings()->set('replication_alter_partitions_sync',2); |
|
12 | -$db->settings()->set('experimental_allow_extended_storage_definition_syntax',1); |
|
11 | +$db->settings()->set('replication_alter_partitions_sync', 2); |
|
12 | +$db->settings()->set('experimental_allow_extended_storage_definition_syntax', 1); |
|
13 | 13 | |
14 | 14 | |
15 | -for ( $looop=1;$looop<100;$looop++) |
|
15 | +for ($looop = 1; $looop < 100; $looop++) |
|
16 | 16 | { |
17 | 17 | |
18 | 18 | $db->write("DROP TABLE IF EXISTS testoperation_log"); |
@@ -26,29 +26,29 @@ discard block |
||
26 | 26 | "); |
27 | 27 | |
28 | 28 | echo "INSERT DATA....\n"; |
29 | - for ($z=0;$z<1000;$z++) |
|
29 | + for ($z = 0; $z < 1000; $z++) |
|
30 | 30 | { |
31 | - $dataInsert=['time'=>strtotime('-'.mt_rand(0,4000).' day'),'event'=>strval($z)]; |
|
31 | + $dataInsert = ['time'=>strtotime('-' . mt_rand(0, 4000) . ' day'), 'event'=>strval($z)]; |
|
32 | 32 | try { |
33 | - $db->insertAssocBulk('testoperation_log',$dataInsert); |
|
33 | + $db->insertAssocBulk('testoperation_log', $dataInsert); |
|
34 | 34 | echo "$z\r"; |
35 | 35 | } |
36 | 36 | catch (Exception $exception) |
37 | 37 | { |
38 | - die("Error:".$exception->getMessage()); |
|
38 | + die("Error:" . $exception->getMessage()); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | } |
42 | 42 | echo "INSER OK\n DROP PARTITION...\n"; |
43 | 43 | |
44 | - $partitons=($db->partitions('testoperation_log')); |
|
44 | + $partitons = ($db->partitions('testoperation_log')); |
|
45 | 45 | foreach ($partitons as $part) |
46 | 46 | { |
47 | - echo "$looop\t\t".$part['partition']."\t".$part['name']."\t".$part['active']."\r"; |
|
47 | + echo "$looop\t\t" . $part['partition'] . "\t" . $part['name'] . "\t" . $part['active'] . "\r"; |
|
48 | 48 | |
49 | - $db->dropPartition('default.testoperation_log',$part['partition']); |
|
49 | + $db->dropPartition('default.testoperation_log', $part['partition']); |
|
50 | 50 | } |
51 | - echo "SELECT count() ...".str_repeat(" ",300)."\n"; |
|
51 | + echo "SELECT count() ..." . str_repeat(" ", 300) . "\n"; |
|
52 | 52 | print_r($db->select('SELECT count() FROM default.testoperation_log')->rows()); |
53 | 53 | } |
54 | 54 |
@@ -32,8 +32,7 @@ |
||
32 | 32 | try { |
33 | 33 | $db->insertAssocBulk('testoperation_log',$dataInsert); |
34 | 34 | echo "$z\r"; |
35 | - } |
|
36 | - catch (Exception $exception) |
|
35 | + } catch (Exception $exception) |
|
37 | 36 | { |
38 | 37 | die("Error:".$exception->getMessage()); |
39 | 38 | } |
@@ -11,12 +11,12 @@ |
||
11 | 11 | $cl->setScanTimeOut(2.5); // 2500 ms |
12 | 12 | if (!$cl->isReplicasIsOk()) |
13 | 13 | { |
14 | - throw new Exception('Replica state is bad , error='.$cl->getError()); |
|
14 | + throw new Exception('Replica state is bad , error=' . $cl->getError()); |
|
15 | 15 | } |
16 | 16 | // |
17 | -$cluster_name='sharovara'; |
|
17 | +$cluster_name = 'sharovara'; |
|
18 | 18 | // |
19 | -echo "> $cluster_name , count shard = ".$cl->getClusterCountShard($cluster_name)." ; count replica = ".$cl->getClusterCountReplica($cluster_name)."\n"; |
|
19 | +echo "> $cluster_name , count shard = " . $cl->getClusterCountShard($cluster_name) . " ; count replica = " . $cl->getClusterCountReplica($cluster_name) . "\n"; |
|
20 | 20 | |
21 | 21 | |
22 | 22 |
@@ -10,15 +10,15 @@ |
||
10 | 10 | |
11 | 11 | if (!$cl->isReplicasIsOk()) |
12 | 12 | { |
13 | - throw new Exception('Replica state is bad , error='.$cl->getError()); |
|
13 | + throw new Exception('Replica state is bad , error=' . $cl->getError()); |
|
14 | 14 | } |
15 | -$cluster_name='sharovara'; |
|
15 | +$cluster_name = 'sharovara'; |
|
16 | 16 | |
17 | -echo "> $cluster_name , count shard = ".$cl->getClusterCountShard($cluster_name)." ; count replica = ".$cl->getClusterCountReplica($cluster_name)."\n"; |
|
17 | +echo "> $cluster_name , count shard = " . $cl->getClusterCountShard($cluster_name) . " ; count replica = " . $cl->getClusterCountReplica($cluster_name) . "\n"; |
|
18 | 18 | |
19 | 19 | |
20 | 20 | // ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
21 | -$nodes=$cl->getNodesByTable('shara.adpreview_body_views_sharded'); |
|
21 | +$nodes = $cl->getNodesByTable('shara.adpreview_body_views_sharded'); |
|
22 | 22 | |
23 | 23 | foreach ($nodes as $node) |
24 | 24 | { |
@@ -7,13 +7,13 @@ discard block |
||
7 | 7 | |
8 | 8 | |
9 | 9 | |
10 | -$cl = new ClickHouseDB\Cluster(['host'=>'172.18.0.8','username'=>'default','password'=>'','port'=>8123]); |
|
10 | +$cl = new ClickHouseDB\Cluster(['host'=>'172.18.0.8', 'username'=>'default', 'password'=>'', 'port'=>8123]); |
|
11 | 11 | |
12 | 12 | $cl->setScanTimeOut(2.5); // 2500 ms |
13 | 13 | $cl->setSoftCheck(true); |
14 | 14 | if (!$cl->isReplicasIsOk()) |
15 | 15 | { |
16 | - throw new Exception('Replica state is bad , error='.$cl->getError()); |
|
16 | + throw new Exception('Replica state is bad , error=' . $cl->getError()); |
|
17 | 17 | } |
18 | 18 | |
19 | 19 | print_r($cl->getClusterList()); |
@@ -25,10 +25,10 @@ discard block |
||
25 | 25 | |
26 | 26 | |
27 | 27 | $cl->activeClient()->setTimeout(0.01); |
28 | -for ($z=0;$z<50;$z++) |
|
28 | +for ($z = 0; $z < 50; $z++) |
|
29 | 29 | { |
30 | - try{ |
|
31 | - $x=$cl->activeClient()->write("DROP TABLE IF EXISTS default.asdasdasd ON CLUSTER cluster2"); |
|
30 | + try { |
|
31 | + $x = $cl->activeClient()->write("DROP TABLE IF EXISTS default.asdasdasd ON CLUSTER cluster2"); |
|
32 | 32 | }catch (Exception $exception) |
33 | 33 | { |
34 | 34 | |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | } |
37 | 37 | |
38 | 38 | $cl->activeClient()->setTimeout(22); |
39 | -$x=$cl->activeClient()->write("DROP TABLE IF EXISTS default.asdasdasd ON CLUSTER cluster2"); |
|
39 | +$x = $cl->activeClient()->write("DROP TABLE IF EXISTS default.asdasdasd ON CLUSTER cluster2"); |
|
40 | 40 | $x->dump(); |
41 | 41 | |
42 | 42 |
@@ -29,7 +29,7 @@ |
||
29 | 29 | { |
30 | 30 | try{ |
31 | 31 | $x=$cl->activeClient()->write("DROP TABLE IF EXISTS default.asdasdasd ON CLUSTER cluster2"); |
32 | - }catch (Exception $exception) |
|
32 | + } catch (Exception $exception) |
|
33 | 33 | { |
34 | 34 | |
35 | 35 | } |
@@ -12,16 +12,16 @@ |
||
12 | 12 | $cl->setSoftCheck(true); |
13 | 13 | if (!$cl->isReplicasIsOk()) |
14 | 14 | { |
15 | - throw new Exception('Replica state is bad , error='.$cl->getError()); |
|
15 | + throw new Exception('Replica state is bad , error=' . $cl->getError()); |
|
16 | 16 | } |
17 | 17 | // |
18 | -$cluster_name='sharovara'; |
|
18 | +$cluster_name = 'sharovara'; |
|
19 | 19 | // |
20 | -echo "> $cluster_name , count shard = ".$cl->getClusterCountShard($cluster_name)." ; count replica = ".$cl->getClusterCountReplica($cluster_name)."\n"; |
|
20 | +echo "> $cluster_name , count shard = " . $cl->getClusterCountShard($cluster_name) . " ; count replica = " . $cl->getClusterCountReplica($cluster_name) . "\n"; |
|
21 | 21 | |
22 | 22 | |
23 | 23 | // Выбрать IP содержащий строку ".248" типа 123.123.123.248, разделитель ; - если не найдена первая берется |
24 | -$cli=$cl->clientLike($cluster_name,'.298;.964'); |
|
24 | +$cli = $cl->clientLike($cluster_name, '.298;.964'); |
|
25 | 25 | $cli->ping(); |
26 | 26 | echo "\n----\nEND\n"; |
27 | 27 | // ---------------------------------------------------------------------- |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | $cl->setScanTimeOut(2.5); // 2500 ms |
11 | 11 | if (!$cl->isReplicasIsOk()) |
12 | 12 | { |
13 | - throw new Exception('Replica state is bad , error='.$cl->getError()); |
|
13 | + throw new Exception('Replica state is bad , error=' . $cl->getError()); |
|
14 | 14 | } |
15 | 15 | |
16 | 16 | echo "Ips:\n"; |
@@ -19,13 +19,13 @@ discard block |
||
19 | 19 | print_r($cl->getClusterList()); |
20 | 20 | |
21 | 21 | // |
22 | -foreach (['pulse','repikator','sharovara','repikator3x','sharovara3x'] as $name) |
|
22 | +foreach (['pulse', 'repikator', 'sharovara', 'repikator3x', 'sharovara3x'] as $name) |
|
23 | 23 | { |
24 | 24 | echo "-------------------- $name ---------------------------\n"; |
25 | 25 | print_r($cl->getClusterNodes($name)); |
26 | 26 | |
27 | - echo "> Count Shard = ".$cl->getClusterCountShard($name)."\n"; |
|
28 | - echo "> Count Replica = ".$cl->getClusterCountReplica($name)."\n"; |
|
27 | + echo "> Count Shard = " . $cl->getClusterCountShard($name) . "\n"; |
|
28 | + echo "> Count Replica = " . $cl->getClusterCountReplica($name) . "\n"; |
|
29 | 29 | } |
30 | 30 | // ---------------------------------------------------------------------- |
31 | 31 | echo "\n----\nEND\n"; |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | |
52 | 52 | |
53 | 53 | echo "\ntestRFCCSVWrite>>>>\n"; |
54 | -$fileName='/tmp/testRFCCSVWrite.CSV'; |
|
54 | +$fileName = '/tmp/testRFCCSVWrite.CSV'; |
|
55 | 55 | date_default_timezone_set('Europe/Moscow'); |
56 | 56 | $db->write("DROP TABLE IF EXISTS testRFCCSVWrite"); |
57 | 57 | $db->write('CREATE TABLE testRFCCSVWrite ( |
@@ -66,24 +66,24 @@ discard block |
||
66 | 66 | |
67 | 67 | @unlink($fileName); |
68 | 68 | |
69 | -$data=[ |
|
70 | - ['event_time'=>date('Y-m-d H:i:s'),'strs'=>'SOME STRING','flos'=>1.1,'ints'=>1,'arr1'=>[1,2,3],'arrs'=>["A","B"]], |
|
71 | - ['event_time'=>date('Y-m-d H:i:s'),'strs'=>'SOME STRING','flos'=>2.3,'ints'=>2,'arr1'=>[1,2,3],'arrs'=>["A","B"]], |
|
72 | - ['event_time'=>date('Y-m-d H:i:s'),'strs'=>'SOME\'STRING','flos'=>0,'ints'=>0,'arr1'=>[1,2,3],'arrs'=>["A","B"]], |
|
73 | - ['event_time'=>date('Y-m-d H:i:s'),'strs'=>'SOME\'"TRING','flos'=>0,'ints'=>0,'arr1'=>[1,2,3],'arrs'=>["A","B"]], |
|
74 | - ['event_time'=>date('Y-m-d H:i:s'),'strs'=>"SOMET\nRI\n\"N\"G\\XX_ABCDEFG",'flos'=>0,'ints'=>0,'arr1'=>[1,2,3],'arrs'=>["A","B\nD\nC"]], |
|
75 | - ['event_time'=>date('Y-m-d H:i:s'),'strs'=>"ID_ARRAY",'flos'=>0,'ints'=>0,'arr1'=>[1,2,3],'arrs'=>["A","B\nD\nC"]] |
|
69 | +$data = [ |
|
70 | + ['event_time'=>date('Y-m-d H:i:s'), 'strs'=>'SOME STRING', 'flos'=>1.1, 'ints'=>1, 'arr1'=>[1, 2, 3], 'arrs'=>["A", "B"]], |
|
71 | + ['event_time'=>date('Y-m-d H:i:s'), 'strs'=>'SOME STRING', 'flos'=>2.3, 'ints'=>2, 'arr1'=>[1, 2, 3], 'arrs'=>["A", "B"]], |
|
72 | + ['event_time'=>date('Y-m-d H:i:s'), 'strs'=>'SOME\'STRING', 'flos'=>0, 'ints'=>0, 'arr1'=>[1, 2, 3], 'arrs'=>["A", "B"]], |
|
73 | + ['event_time'=>date('Y-m-d H:i:s'), 'strs'=>'SOME\'"TRING', 'flos'=>0, 'ints'=>0, 'arr1'=>[1, 2, 3], 'arrs'=>["A", "B"]], |
|
74 | + ['event_time'=>date('Y-m-d H:i:s'), 'strs'=>"SOMET\nRI\n\"N\"G\\XX_ABCDEFG", 'flos'=>0, 'ints'=>0, 'arr1'=>[1, 2, 3], 'arrs'=>["A", "B\nD\nC"]], |
|
75 | + ['event_time'=>date('Y-m-d H:i:s'), 'strs'=>"ID_ARRAY", 'flos'=>0, 'ints'=>0, 'arr1'=>[1, 2, 3], 'arrs'=>["A", "B\nD\nC"]] |
|
76 | 76 | ]; |
77 | 77 | |
78 | 78 | //// 1.1 + 2.3 = 3.3999999761581 |
79 | 79 | // |
80 | 80 | foreach ($data as $row) |
81 | 81 | { |
82 | - file_put_contents($fileName,\ClickHouseDB\Quote\FormatLine::CSV($row)."\n",FILE_APPEND); |
|
82 | + file_put_contents($fileName, \ClickHouseDB\Quote\FormatLine::CSV($row) . "\n", FILE_APPEND); |
|
83 | 83 | } |
84 | 84 | // |
85 | 85 | echo "FILE:\n\n"; |
86 | -echo file_get_contents($fileName)."\n\n----\n"; |
|
86 | +echo file_get_contents($fileName) . "\n\n----\n"; |
|
87 | 87 | |
88 | 88 | // |
89 | 89 | $db->insertBatchFiles('testRFCCSVWrite', [$fileName], [ |
@@ -95,13 +95,13 @@ discard block |
||
95 | 95 | 'arrs', |
96 | 96 | ]); |
97 | 97 | |
98 | -$st=$db->select('SELECT * FROM testRFCCSVWrite'); |
|
98 | +$st = $db->select('SELECT * FROM testRFCCSVWrite'); |
|
99 | 99 | print_r($st->rows()); |
100 | 100 | // |
101 | 101 | |
102 | 102 | |
103 | 103 | echo "\n<<<<< TAB >>>>\n"; |
104 | -$fileName='/tmp/testRFCCSVWrite.TAB';@unlink($fileName); |
|
104 | +$fileName = '/tmp/testRFCCSVWrite.TAB'; @unlink($fileName); |
|
105 | 105 | |
106 | 106 | |
107 | 107 | $db->write("DROP TABLE IF EXISTS testTABWrite"); |
@@ -117,22 +117,22 @@ discard block |
||
117 | 117 | |
118 | 118 | |
119 | 119 | |
120 | -$data=[ |
|
121 | - ['event_time'=>date('Y-m-d H:i:s'),'strs'=>"STING\t\tSD!\"\nFCD\tSAD\t\nDSF",'flos'=>-2.3,'ints'=>123,'arr1'=>[1,2,3],'arrs'=>["A","B"]], |
|
122 | - ['event_time'=>date('Y-m-d H:i:s'),'strs'=>'SOME\'STRING','flos'=>0,'ints'=>12123,'arr1'=>[1,2,3],'arrs'=>["A","B"]], |
|
123 | - ['event_time'=>date('Y-m-d H:i:s'),'strs'=>'SOME\'"TR\tING','flos'=>0,'ints'=>0,'arr1'=>[1,2,3],'arrs'=>["A","B"]], |
|
124 | - ['event_time'=>date('Y-m-d H:i:s'),'strs'=>"SOMET\nRI\n\"N\"G\\XX_ABCDEFG",'flos'=>0,'ints'=>1,'arr1'=>[1,2,3],'arrs'=>["A","B\nD\ns\tC"]], |
|
125 | - ['event_time'=>date('Y-m-d H:i:s'),'strs'=>"ID_ARRAY",'flos'=>-2.3,'ints'=>-12123,'arr1'=>[1,2,3],'arrs'=>["A","B\nD\nC\n\t\n\tTABARRAYS"]] |
|
120 | +$data = [ |
|
121 | + ['event_time'=>date('Y-m-d H:i:s'), 'strs'=>"STING\t\tSD!\"\nFCD\tSAD\t\nDSF", 'flos'=>-2.3, 'ints'=>123, 'arr1'=>[1, 2, 3], 'arrs'=>["A", "B"]], |
|
122 | + ['event_time'=>date('Y-m-d H:i:s'), 'strs'=>'SOME\'STRING', 'flos'=>0, 'ints'=>12123, 'arr1'=>[1, 2, 3], 'arrs'=>["A", "B"]], |
|
123 | + ['event_time'=>date('Y-m-d H:i:s'), 'strs'=>'SOME\'"TR\tING', 'flos'=>0, 'ints'=>0, 'arr1'=>[1, 2, 3], 'arrs'=>["A", "B"]], |
|
124 | + ['event_time'=>date('Y-m-d H:i:s'), 'strs'=>"SOMET\nRI\n\"N\"G\\XX_ABCDEFG", 'flos'=>0, 'ints'=>1, 'arr1'=>[1, 2, 3], 'arrs'=>["A", "B\nD\ns\tC"]], |
|
125 | + ['event_time'=>date('Y-m-d H:i:s'), 'strs'=>"ID_ARRAY", 'flos'=>-2.3, 'ints'=>-12123, 'arr1'=>[1, 2, 3], 'arrs'=>["A", "B\nD\nC\n\t\n\tTABARRAYS"]] |
|
126 | 126 | ]; |
127 | 127 | |
128 | 128 | |
129 | 129 | foreach ($data as $row) |
130 | 130 | { |
131 | - file_put_contents($fileName,\ClickHouseDB\Quote\FormatLine::TSV($row)."\n",FILE_APPEND); |
|
131 | + file_put_contents($fileName, \ClickHouseDB\Quote\FormatLine::TSV($row) . "\n", FILE_APPEND); |
|
132 | 132 | } |
133 | 133 | // |
134 | 134 | echo "FILE:\n\n"; |
135 | -echo file_get_contents($fileName)."\n\n----\n"; |
|
135 | +echo file_get_contents($fileName) . "\n\n----\n"; |
|
136 | 136 | |
137 | 137 | // |
138 | 138 | $db->insertBatchTSVFiles('testTABWrite', [$fileName], [ |
@@ -144,9 +144,9 @@ discard block |
||
144 | 144 | 'arrs', |
145 | 145 | ]); |
146 | 146 | |
147 | -$st=$db->select('SELECT * FROM testTABWrite'); |
|
147 | +$st = $db->select('SELECT * FROM testTABWrite'); |
|
148 | 148 | print_r($st->rows()); |
149 | -$st=$db->select('SELECT round(sum(flos),5),sum(ints) FROM testTABWrite'); |
|
149 | +$st = $db->select('SELECT round(sum(flos),5),sum(ints) FROM testTABWrite'); |
|
150 | 150 | print_r($st->rows()); |
151 | 151 | |
152 | 152 | // |
153 | 153 | \ No newline at end of file |
@@ -24,9 +24,9 @@ |
||
24 | 24 | |
25 | 25 | |
26 | 26 | |
27 | -echo 'elapsed :'.$result->statistics('elapsed')."\n"; |
|
28 | -echo 'rows_read :'.$result->statistics('rows_read')."\n"; |
|
29 | -echo 'bytes_read:'.$result->statistics('bytes_read')."\n"; |
|
27 | +echo 'elapsed :' . $result->statistics('elapsed') . "\n"; |
|
28 | +echo 'rows_read :' . $result->statistics('rows_read') . "\n"; |
|
29 | +echo 'bytes_read:' . $result->statistics('bytes_read') . "\n"; |
|
30 | 30 | |
31 | 31 | // |
32 | 32 | $result = $db->select("SELECT 12 as ping"); |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | |
149 | 149 | $body = $this->response()->body(); |
150 | 150 | $error_no = $this->response()->error_no(); |
151 | - $error=$this->response()->error(); |
|
151 | + $error = $this->response()->error(); |
|
152 | 152 | |
153 | 153 | if (!$error_no && !$error) { |
154 | 154 | $parse = $this->parseErrorClickHouse($body); |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | } |
159 | 159 | else { |
160 | 160 | $code = $this->response()->http_code(); |
161 | - $message = "HttpCode:" . $this->response()->http_code() . " ; ".$this->response()->error()." ;" . $body; |
|
161 | + $message = "HttpCode:" . $this->response()->http_code() . " ; " . $this->response()->error() . " ;" . $body; |
|
162 | 162 | } |
163 | 163 | } |
164 | 164 | else { |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | return false; |
213 | 213 | } |
214 | 214 | |
215 | - foreach (['meta', 'data', 'totals', 'extremes', 'rows', 'rows_before_limit_at_least','statistics'] as $key) { |
|
215 | + foreach (['meta', 'data', 'totals', 'extremes', 'rows', 'rows_before_limit_at_least', 'statistics'] as $key) { |
|
216 | 216 | if (isset($this->_rawData[$key])) { |
217 | 217 | $this->{$key} = $this->_rawData[$key]; |
218 | 218 | } |
@@ -325,7 +325,7 @@ discard block |
||
325 | 325 | * @param bool $key |
326 | 326 | * @return array|mixed|null |
327 | 327 | */ |
328 | - public function statistics($key=false) |
|
328 | + public function statistics($key = false) |
|
329 | 329 | { |
330 | 330 | $this->init(); |
331 | 331 | if ($key) |
@@ -155,13 +155,11 @@ discard block |
||
155 | 155 | |
156 | 156 | if ($parse) { |
157 | 157 | throw new DatabaseException($parse['message'] . "\nIN:" . $this->sql(), $parse['code']); |
158 | - } |
|
159 | - else { |
|
158 | + } else { |
|
160 | 159 | $code = $this->response()->http_code(); |
161 | 160 | $message = "HttpCode:" . $this->response()->http_code() . " ; ".$this->response()->error()." ;" . $body; |
162 | 161 | } |
163 | - } |
|
164 | - else { |
|
162 | + } else { |
|
165 | 163 | $code = $error_no; |
166 | 164 | $message = $this->response()->error(); |
167 | 165 | } |
@@ -330,8 +328,12 @@ discard block |
||
330 | 328 | $this->init(); |
331 | 329 | if ($key) |
332 | 330 | { |
333 | - if (!is_array($this->statistics)) return null; |
|
334 | - if (!isset($this->statistics[$key])) return null; |
|
331 | + if (!is_array($this->statistics)) { |
|
332 | + return null; |
|
333 | + } |
|
334 | + if (!isset($this->statistics[$key])) { |
|
335 | + return null; |
|
336 | + } |
|
335 | 337 | return $this->statistics[$key]; |
336 | 338 | } |
337 | 339 | return $this->statistics; |
@@ -373,8 +375,7 @@ discard block |
||
373 | 375 | if ($key) { |
374 | 376 | if (isset($this->array_data[0][$key])) { |
375 | 377 | return $this->array_data[0][$key]; |
376 | - } |
|
377 | - else { |
|
378 | + } else { |
|
378 | 379 | return null; |
379 | 380 | } |
380 | 381 | } |
@@ -464,16 +465,14 @@ discard block |
||
464 | 465 | { |
465 | 466 | if (is_array($path)) { |
466 | 467 | $keys = $path; |
467 | - } |
|
468 | - else { |
|
468 | + } else { |
|
469 | 469 | $args = func_get_args(); |
470 | 470 | array_shift($args); |
471 | 471 | |
472 | 472 | if (sizeof($args) < 2) { |
473 | 473 | $separator = '.'; |
474 | 474 | $keys = explode($separator, $path); |
475 | - } |
|
476 | - else { |
|
475 | + } else { |
|
477 | 476 | $keys = $args; |
478 | 477 | } |
479 | 478 | } |
@@ -485,8 +484,7 @@ discard block |
||
485 | 484 | |
486 | 485 | if (isset($arr[$key])) { |
487 | 486 | $val = $arr[$key]; |
488 | - } |
|
489 | - else { |
|
487 | + } else { |
|
490 | 488 | $val = $key; |
491 | 489 | } |
492 | 490 |