@@ -3,20 +3,20 @@ |
||
3 | 3 | |
4 | 4 | class Relation |
5 | 5 | { |
6 | - /** @var \Ivory\Connection\IConnection */ |
|
7 | - private $connection = null; |
|
6 | + /** @var \Ivory\Connection\IConnection */ |
|
7 | + private $connection = null; |
|
8 | 8 | |
9 | - public function setConnection(\Ivory\Connection\IConnection $connection) |
|
10 | - { |
|
11 | - $this->connection = $connection; |
|
12 | - } |
|
9 | + public function setConnection(\Ivory\Connection\IConnection $connection) |
|
10 | + { |
|
11 | + $this->connection = $connection; |
|
12 | + } |
|
13 | 13 | |
14 | - public function getConnection() |
|
15 | - { |
|
16 | - if ($this->connection === null) { |
|
17 | - $this->connection = \Ivory\Ivory::getConnection(); |
|
18 | - } |
|
14 | + public function getConnection() |
|
15 | + { |
|
16 | + if ($this->connection === null) { |
|
17 | + $this->connection = \Ivory\Ivory::getConnection(); |
|
18 | + } |
|
19 | 19 | |
20 | - return $this->connection; |
|
21 | - } |
|
20 | + return $this->connection; |
|
21 | + } |
|
22 | 22 | } |
@@ -60,7 +60,7 @@ |
||
60 | 60 | ]; |
61 | 61 | |
62 | 62 | $validators = [ |
63 | - function ($xml) { |
|
63 | + function($xml) { |
|
64 | 64 | $reader = new XMLReader(); |
65 | 65 | $reader->xml($xml); |
66 | 66 | if (!@$reader->read()) { |
@@ -1,8 +1,8 @@ |
||
1 | 1 | <?php |
2 | 2 | function foo($lead1, $lead2, ...$varArgs) // non-variable trailing arguments would lead to a parse error |
3 | 3 | { |
4 | - var_export($varArgs); |
|
5 | - echo "\n"; |
|
4 | + var_export($varArgs); |
|
5 | + echo "\n"; |
|
6 | 6 | } |
7 | 7 | |
8 | 8 | foo(...range(1, 5)); // prints [3, 4, 5] |
@@ -45,7 +45,7 @@ |
||
45 | 45 | exit(1); |
46 | 46 | } |
47 | 47 | |
48 | -$streamReadable = function ($stream) { |
|
48 | +$streamReadable = function($stream) { |
|
49 | 49 | $r = [$stream]; |
50 | 50 | $w = []; |
51 | 51 | $ex = []; |
@@ -27,14 +27,11 @@ discard block |
||
27 | 27 | if ($status === PGSQL_CONNECTION_BAD) { |
28 | 28 | fprintf(STDERR, "The connection is bad\n"); |
29 | 29 | exit(1); |
30 | -} |
|
31 | -elseif ($status === PGSQL_CONNECTION_OK) { |
|
30 | +} elseif ($status === PGSQL_CONNECTION_OK) { |
|
32 | 31 | echo "The connection is OK\n"; |
33 | -} |
|
34 | -elseif ($status === PGSQL_CONNECTION_STARTED) { |
|
32 | +} elseif ($status === PGSQL_CONNECTION_STARTED) { |
|
35 | 33 | echo "The connection is not OK yet, but started\n"; |
36 | -} |
|
37 | -else { |
|
34 | +} else { |
|
38 | 35 | echo 'The connection is in status: '; |
39 | 36 | var_dump($status); |
40 | 37 | } |
@@ -110,8 +107,7 @@ discard block |
||
110 | 107 | echo "$desc: " . pg_result_error_field($res, $field) . "\n"; |
111 | 108 | } |
112 | 109 | echo "\n"; |
113 | - } |
|
114 | - else { |
|
110 | + } else { |
|
115 | 111 | $numRows = pg_num_rows($res); |
116 | 112 | $numFields = pg_num_fields($res); |
117 | 113 | echo "The result was fetched, having $numRows rows, each having $numFields fields\n"; |
@@ -95,8 +95,7 @@ |
||
95 | 95 | echo "$desc: " . pg_result_error_field($res, $field) . "\n"; |
96 | 96 | } |
97 | 97 | echo "\n"; |
98 | - } |
|
99 | - else { |
|
98 | + } else { |
|
100 | 99 | $numRows = pg_num_rows($res); |
101 | 100 | $numFields = pg_num_fields($res); |
102 | 101 | echo "The result was fetched, having $numRows rows, each having $numFields fields\n"; |
@@ -20,7 +20,7 @@ |
||
20 | 20 | |
21 | 21 | |
22 | 22 | class Bar { |
23 | - const ARR = [1,2,3]; |
|
23 | + const ARR = [1, 2, 3]; |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | //var_dump(isset(Bar::ARR[1])); // isset() cannot be used on expressions |
@@ -64,7 +64,7 @@ |
||
64 | 64 | $statStr = pg_result_status($res, PGSQL_STATUS_STRING); |
65 | 65 | echo "Result status: $statCode ({$statCodes[$statCode]}); $statStr\n"; |
66 | 66 | |
67 | - switch ($statCode){ |
|
67 | + switch ($statCode) { |
|
68 | 68 | case PGSQL_TUPLES_OK: |
69 | 69 | $numRows = pg_num_rows($res); |
70 | 70 | $numFields = pg_num_fields($res); |
@@ -12,10 +12,10 @@ discard block |
||
12 | 12 | echo "Types: "; |
13 | 13 | $fieldCnt = pg_num_fields($result); |
14 | 14 | for ($i = 0; $i < $fieldCnt; $i++) { |
15 | - if ($i != 0) { |
|
16 | - echo ", "; |
|
17 | - } |
|
18 | - echo pg_field_name($result, $i) . ':' . pg_field_type($result, $i); |
|
15 | + if ($i != 0) { |
|
16 | + echo ", "; |
|
17 | + } |
|
18 | + echo pg_field_name($result, $i) . ':' . pg_field_type($result, $i); |
|
19 | 19 | } |
20 | 20 | echo "\n"; |
21 | 21 | echo "Errors:\n"; |
@@ -28,23 +28,23 @@ discard block |
||
28 | 28 | echo "Fully-qualified types: "; // NOTE: necessary even for the PostgreSQL standard types - pg_catalog may be placed after a user schema in the search path - see http://www.postgresql.org/docs/9.4/static/ddl-schemas.html#DDL-SCHEMAS-CATALOG |
29 | 29 | $typeOids = []; |
30 | 30 | for ($i = 0; $i < $fieldCnt; $i++) { |
31 | - $typeOids[] = pg_field_type_oid($result, $i); |
|
31 | + $typeOids[] = pg_field_type_oid($result, $i); |
|
32 | 32 | } |
33 | 33 | $metaRes = pg_query($conn, |
34 | - 'SELECT pg_type.oid, typname, nspname |
|
34 | + 'SELECT pg_type.oid, typname, nspname |
|
35 | 35 | FROM pg_catalog.pg_type |
36 | 36 | JOIN pg_catalog.pg_namespace ON pg_namespace.oid = pg_type.typnamespace |
37 | 37 | WHERE pg_type.oid IN (' . implode(',', $typeOids) . ')' |
38 | 38 | ); |
39 | 39 | $types = []; |
40 | 40 | while (($row = pg_fetch_assoc($metaRes))) { |
41 | - $types[$row['oid']] = $row['nspname'] . '.' . $row['typname']; |
|
41 | + $types[$row['oid']] = $row['nspname'] . '.' . $row['typname']; |
|
42 | 42 | } |
43 | 43 | for ($i = 0; $i < $fieldCnt; $i++) { |
44 | - if ($i != 0) { |
|
45 | - echo ", "; |
|
46 | - } |
|
47 | - echo $types[pg_field_type_oid($result, $i)]; |
|
44 | + if ($i != 0) { |
|
45 | + echo ", "; |
|
46 | + } |
|
47 | + echo $types[pg_field_type_oid($result, $i)]; |
|
48 | 48 | } |
49 | 49 | echo "\n"; |
50 | 50 | echo "Errors:\n"; |
@@ -55,8 +55,8 @@ discard block |
||
55 | 55 | echo "Data:\n"; |
56 | 56 | $rowCnt = pg_num_rows($result); |
57 | 57 | for ($i = 0; $i < $rowCnt; $i++) { |
58 | - $row = pg_fetch_row($result, $i); |
|
59 | - var_dump($row); |
|
58 | + $row = pg_fetch_row($result, $i); |
|
59 | + var_dump($row); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | |
@@ -68,26 +68,26 @@ discard block |
||
68 | 68 | $fieldCnt = pg_num_fields($result); |
69 | 69 | $typeOids = []; |
70 | 70 | for ($i = 0; $i < $fieldCnt; $i++) { |
71 | - $typeOids[] = pg_field_type_oid($result, $i); |
|
71 | + $typeOids[] = pg_field_type_oid($result, $i); |
|
72 | 72 | } |
73 | 73 | $metaRes = pg_query($conn, |
74 | - 'SELECT pg_type.oid, typname, nspname |
|
74 | + 'SELECT pg_type.oid, typname, nspname |
|
75 | 75 | FROM pg_catalog.pg_type |
76 | 76 | JOIN pg_catalog.pg_namespace ON pg_namespace.oid = pg_type.typnamespace |
77 | 77 | WHERE pg_type.oid IN (' . implode(',', $typeOids) . ')' |
78 | 78 | ); |
79 | 79 | $types = []; |
80 | 80 | while (($row = pg_fetch_assoc($metaRes))) { |
81 | - $types[$row['oid']] = $row['nspname'] . '.' . $row['typname']; |
|
81 | + $types[$row['oid']] = $row['nspname'] . '.' . $row['typname']; |
|
82 | 82 | } |
83 | 83 | $fieldCnt = pg_num_fields($result); |
84 | 84 | for ($i = 0; $i < $fieldCnt; $i++) { |
85 | - if ($i != 0) { |
|
86 | - echo ", "; |
|
87 | - } |
|
88 | - echo pg_field_name($result, $i) . ":#{$typeOids[$i]}:{$types[pg_field_type_oid($result, $i)]}"; |
|
85 | + if ($i != 0) { |
|
86 | + echo ", "; |
|
87 | + } |
|
88 | + echo pg_field_name($result, $i) . ":#{$typeOids[$i]}:{$types[pg_field_type_oid($result, $i)]}"; |
|
89 | 89 | } |
90 | 90 | echo "\n"; |
91 | 91 | while (($row = pg_fetch_assoc($result))) { |
92 | - print_r($row); |
|
92 | + print_r($row); |
|
93 | 93 | } |