Skip to content

Commit 84cc8d0

Browse files
committed
Fix: Basic coding standards errors
Unable to fix ADODB_FETCH_MODE due to global
1 parent 430653f commit 84cc8d0

File tree

11 files changed

+887
-885
lines changed

11 files changed

+887
-885
lines changed

Model/Datasource/AmazonAssociatesSource.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -120,12 +120,12 @@ public function find($type = null, $query = array()) {
120120

121121
$this->query = array_merge(
122122
array(
123-
'Service' => 'AWSECommerceService',
123+
'Service' => 'AWSECommerceService',
124124
'AWSAccessKeyId' => $this->config['key'],
125-
'Timestamp' => gmdate("Y-m-d\TH:i:s\Z"),
126-
'AccociateTag' => $this->config['tag'],
127-
'Operation' => 'ItemSearch',
128-
'Version' => '2009-03-31',
125+
'Timestamp' => gmdate("Y-m-d\TH:i:s\Z"),
126+
'AccociateTag' => $this->config['tag'],
127+
'Operation' => 'ItemSearch',
128+
'Version' => '2009-03-31',
129129
),
130130
$query
131131
);
@@ -141,12 +141,12 @@ public function find($type = null, $query = array()) {
141141
public function findById($id) {
142142
$this->query = array_merge(
143143
array(
144-
'Service' => 'AWSECommerceService',
144+
'Service' => 'AWSECommerceService',
145145
'AWSAccessKeyId' => $this->config['key'],
146-
'Timestamp' => gmdate("Y-m-d\TH:i:s\Z"),
147-
'AccociateTag' => $this->config['tag'],
148-
'Version' => '2009-03-31',
149-
'Operation' => 'ItemLookup',
146+
'Timestamp' => gmdate("Y-m-d\TH:i:s\Z"),
147+
'AccociateTag' => $this->config['tag'],
148+
'Version' => '2009-03-31',
149+
'Operation' => 'ItemLookup',
150150
),
151151
array('ItemId' => $id)
152152
);
@@ -211,4 +211,4 @@ protected function _signQuery() {
211211
// create request
212212
return sprintf('http://%s%s?%s&Signature=%s', $host, $uri, $canonicalizedQuery, $signature);
213213
}
214-
}
214+
}

Model/Datasource/CouchdbSource.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,13 @@ public function reconnect($config = null) {
6565
*/
6666
public function connect() {
6767
if ($this->connected !== true) {
68-
if (isset($this->config['login']))
68+
if (isset($this->config['login'])) {
6969
$this->config['request']['uri']['user'] = $this->config['login'];
70+
}
7071

71-
if (isset($this->config['password']))
72+
if (isset($this->config['password'])) {
7273
$this->config['request']['uri']['pass'] = $this->config['password'];
74+
}
7375

7476
$this->Socket = new HttpSocket($this->config);
7577
if (strpos($this->Socket->get(), 'couchdb') !== false) {

Model/Datasource/Database/Adodb.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ class Adodb extends DboSource {
7575
'integer' => array('name' => 'I', 'limit' => '11', 'formatter' => 'intval'),
7676
'float' => array('name' => 'N', 'formatter' => 'floatval'),
7777
'timestamp' => array('name' => 'T', 'format' => 'Y-m-d H:i:s', 'formatter' => 'date'),
78-
'time' => array('name' => 'T', 'format' => 'H:i:s', 'formatter' => 'date'),
78+
'time' => array('name' => 'T', 'format' => 'H:i:s', 'formatter' => 'date'),
7979
'datetime' => array('name' => 'T', 'format' => 'Y-m-d H:i:s', 'formatter' => 'date'),
8080
'date' => array('name' => 'D', 'format' => 'Y-m-d', 'formatter' => 'date'),
8181
'binary' => array('name' => 'B'),
@@ -530,7 +530,6 @@ public function buildColumn($column) {
530530
//use concrete instance of DataDict to make the suffixes for us.
531531
$out .= $this->_adodbDataDict->_CreateSuffix($out, $metaType, $_notNull, $_default, $_autoInc, $_constraint, $_unsigned);
532532
return $out;
533-
534533
}
535534

536535
/**

Model/Datasource/Database/Db2.php

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -61,16 +61,16 @@ class DboDb2 extends DboSource {
6161
* @var array
6262
*/
6363
protected $_baseConfig = array(
64-
'persistent' => true,
65-
'login' => 'db2inst1',
66-
'password' => '',
67-
'database' => 'cake',
68-
'schema' => '',
69-
'hostname' => '127.0.0.1',
70-
'port' => '50001',
71-
'encoding' => 'UTF-8',
72-
'cataloged' => true,
73-
'autocommit' => true
64+
'persistent' => true,
65+
'login' => 'db2inst1',
66+
'password' => '',
67+
'database' => 'cake',
68+
'schema' => '',
69+
'hostname' => '127.0.0.1',
70+
'port' => '50001',
71+
'encoding' => true,
72+
'cataloged' => true,
73+
'autocommit' => true
7474
);
7575

7676
/**
@@ -82,17 +82,17 @@ class DboDb2 extends DboSource {
8282
* @var array
8383
*/
8484
public $columns = array(
85-
'primary_key' => array('name' => 'not null generated by default as identity (start with 1, increment by 1)'),
86-
'string' => array('name' => 'varchar', 'limit' => '255'),
87-
'text' => array('name' => 'clob'),
88-
'integer' => array('name' => 'integer', 'limit' => '10', 'formatter' => 'intval'),
89-
'float' => array('name' => 'double', 'formatter' => 'floatval'),
90-
'datetime' => array('name' => 'timestamp', 'format' => 'Y-m-d-H.i.s', 'formatter' => 'date'),
91-
'timestamp' => array('name' => 'timestamp', 'format' => 'Y-m-d-H.i.s', 'formatter' => 'date'),
92-
'time' => array('name' => 'time', 'format' => 'H.i.s', 'formatter' => 'date'),
93-
'date' => array('name' => 'date', 'format' => 'Y-m-d', 'formatter' => 'date'),
94-
'binary' => array('name' => 'blob'),
95-
'boolean' => array('name' => 'smallint', 'limit' => '1')
85+
'primary_key' => array('name' => 'not null generated by default as identity (start with 1, increment by 1)'),
86+
'string' => array('name' => 'varchar', 'limit' => '255'),
87+
'text' => array('name' => 'clob'),
88+
'integer' => array('name' => 'integer', 'limit' => '10', 'formatter' => 'intval'),
89+
'float' => array('name' => 'double', 'formatter' => 'floatval'),
90+
'datetime' => array('name' => 'timestamp', 'format' => 'Y-m-d-H.i.s', 'formatter' => 'date'),
91+
'timestamp' => array('name' => 'timestamp', 'format' => 'Y-m-d-H.i.s', 'formatter' => 'date'),
92+
'time' => array('name' => 'time', 'format' => 'H.i.s', 'formatter' => 'date'),
93+
'date' => array('name' => 'date', 'format' => 'Y-m-d', 'formatter' => 'date'),
94+
'binary' => array('name' => 'blob'),
95+
'boolean' => array('name' => 'smallint', 'limit' => '1')
9696
);
9797

9898
/**
@@ -181,7 +181,7 @@ protected function _execute($sql) {
181181
while ($j < $numFields) {
182182
$columnName = strtolower(db2_field_name($result, $j));
183183
$tmp = strpos($sql, '.' . $columnName, $offset);
184-
$tableName = substr($sql, $offset, ($tmp-$offset));
184+
$tableName = substr($sql, $offset, ($tmp - $offset));
185185
$tableName = substr($tableName, strrpos($tableName, ' ') + 1);
186186
$map[$index++] = array($tableName, $columnName);
187187
$j++;
@@ -275,7 +275,7 @@ public function value($data, $column = null, $safe = false) {
275275
}
276276

277277
if ($data === '') {
278-
return "''";
278+
return "''";
279279
}
280280

281281
switch ($column) {
@@ -502,8 +502,8 @@ public function column($real) {
502502
}
503503
return $col;
504504
}
505-
$col = str_replace(')', '', $real);
506-
$limit = null;
505+
$col = str_replace(')', '', $real);
506+
$limit = null;
507507
if (strpos($col, '(') !== false) {
508508
list($col, $limit) = explode('(', $col);
509509
}

Model/Datasource/Database/Firebird.php

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -96,16 +96,16 @@ class DboFirebird extends DboSource {
9696
*/
9797
public $columns = array(
9898
'primary_key' => array('name' => 'IDENTITY (1, 1) NOT NULL'),
99-
'string' => array('name' => 'varchar', 'limit' => '255'),
100-
'text' => array('name' => 'BLOB SUB_TYPE 1 SEGMENT SIZE 100 CHARACTER SET NONE'),
101-
'integer' => array('name' => 'integer'),
102-
'float' => array('name' => 'float', 'formatter' => 'floatval'),
103-
'datetime' => array('name' => 'timestamp', 'format' => 'd.m.Y H:i:s', 'formatter' => 'date'),
104-
'timestamp' => array('name' => 'timestamp', 'format' => 'd.m.Y H:i:s', 'formatter' => 'date'),
105-
'time' => array('name' => 'time', 'format' => 'H:i:s', 'formatter' => 'date'),
106-
'date' => array('name' => 'date', 'format' => 'd.m.Y', 'formatter' => 'date'),
107-
'binary' => array('name' => 'blob'),
108-
'boolean' => array('name' => 'smallint')
99+
'string' => array('name' => 'varchar', 'limit' => '255'),
100+
'text' => array('name' => 'BLOB SUB_TYPE 1 SEGMENT SIZE 100 CHARACTER SET NONE'),
101+
'integer' => array('name' => 'integer'),
102+
'float' => array('name' => 'float', 'formatter' => 'floatval'),
103+
'datetime' => array('name' => 'timestamp', 'format' => 'd.m.Y H:i:s', 'formatter' => 'date'),
104+
'timestamp' => array('name' => 'timestamp', 'format' => 'd.m.Y H:i:s', 'formatter' => 'date'),
105+
'time' => array('name' => 'time', 'format' => 'H:i:s', 'formatter' => 'date'),
106+
'date' => array('name' => 'date', 'format' => 'd.m.Y', 'formatter' => 'date'),
107+
'binary' => array('name' => 'blob'),
108+
'boolean' => array('name' => 'smallint')
109109
);
110110

111111
/**
@@ -114,8 +114,8 @@ class DboFirebird extends DboSource {
114114
* @var array
115115
*/
116116
protected $_commands = array(
117-
'begin' => 'SET TRANSACTION',
118-
'commit' => 'COMMIT',
117+
'begin' => 'SET TRANSACTION',
118+
'commit' => 'COMMIT',
119119
'rollback' => 'ROLLBACK'
120120
);
121121

@@ -188,12 +188,12 @@ public function listSources() {
188188
return $cache;
189189
}
190190
$sql = "select RDB" . "$" . "RELATION_NAME as name
191-
FROM RDB" ."$" . "RELATIONS
191+
FROM RDB" . "$" . "RELATIONS
192192
Where RDB" . "$" . "SYSTEM_FLAG =0";
193193

194194
$result = @ibase_query($this->connection, $sql);
195195
$tables = array();
196-
while ($row = ibase_fetch_row ($result)) {
196+
while ($row = ibase_fetch_row($result)) {
197197
$tables[] = strtolower(trim($row[0]));
198198
}
199199
parent::listSources($tables);
@@ -354,7 +354,7 @@ public function lastNumRows() {
354354
*/
355355
public function lastInsertId($source = null, $field = 'id') {
356356
$query = "SELECT RDB\$TRIGGER_SOURCE
357-
FROM RDB\$TRIGGERS WHERE RDB\$RELATION_NAME = '". strtoupper($source) . "' AND
357+
FROM RDB\$TRIGGERS WHERE RDB\$RELATION_NAME = '" . strtoupper($source) . "' AND
358358
RDB\$SYSTEM_FLAG IS NULL AND RDB\$TRIGGER_TYPE = 1 ";
359359

360360
$result = @ibase_query($this->connection, $query);
@@ -365,18 +365,18 @@ public function lastInsertId($source = null, $field = 'id') {
365365
$pos = strpos($row[0], "GEN_ID(");
366366

367367
if ($pos > 0) {
368-
$pos2 = strpos($row[0],",", $pos + 7);
368+
$pos2 = strpos($row[0], ",", $pos + 7);
369369

370370
if ($pos2 > 0) {
371-
$generator = substr($row[0], $pos +7, $pos2 - $pos- 7);
371+
$generator = substr($row[0], $pos + 7, $pos2 - $pos - 7);
372372
}
373373
}
374374
break;
375375
}
376376
}
377377

378378
if (!empty($generator)) {
379-
$sql = "SELECT GEN_ID(". $generator . ",0) AS maxi FROM RDB" . "$" . "DATABASE";
379+
$sql = "SELECT GEN_ID(" . $generator . ",0) AS maxi FROM RDB" . "$" . "DATABASE";
380380
$res = $this->rawQuery($sql);
381381
$data = $this->fetchRow($res);
382382
return $data['maxi'];

Model/Datasource/Database/Odbc.php

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ class DboOdbc extends DboSource {
5757
'login' => 'root',
5858
'password' => '',
5959
'database' => 'cake',
60-
'connect' => 'odbc_pconnect'
60+
'connect' => 'odbc_pconnect'
6161
);
6262

6363
/**
@@ -94,7 +94,7 @@ public function connect() {
9494
exit('no odbc?');
9595
}
9696
$this->connected = false;
97-
$this->connection = $connect($config['database'], $config['login'], $config['password'], SQL_CUR_USE_ODBC);
97+
$this->connection = $connect($config['database'], $config['login'], $config['password'], SQL_CUR_USE_ODBC);
9898
if ($this->connection) {
9999
$this->connected = true;
100100
}
@@ -167,7 +167,7 @@ public function listSources() {
167167
* @return array Fields in table. Keys are name and type
168168
*/
169169
public function &describe($model) {
170-
$cache=parent::describe($model);
170+
$cache = parent::describe($model);
171171

172172
if ($cache != null) {
173173
return $cache;
@@ -273,7 +273,7 @@ public function lastInsertId($source = null) {
273273
*/
274274
public function column($real) {
275275
if (is_array($real)) {
276-
$col=$real['name'];
276+
$col = $real['name'];
277277
if (isset($real['limit'])) {
278278
$col .= '(' . $real['limit'] . ')';
279279
}
@@ -283,18 +283,18 @@ public function column($real) {
283283
}
284284

285285
/**
286-
* Enter description here...
287-
*
288-
* @param unknown_type $results
289-
*/
286+
* Enter description here...
287+
*
288+
* @param unknown_type $results
289+
*/
290290
public function resultSet(&$results) {
291291
$this->results = $results;
292292
$numFields = odbc_num_fields($results);
293293
$this->map = array();
294294
$index = 0;
295295
$j = 0;
296296
while ($j < $numFields) {
297-
$column = odbc_field_name($results, $j+1);
297+
$column = odbc_field_name($results, $j + 1);
298298

299299
if (strpos($column, '_dot_') !== false) {
300300
list($table, $column) = explode('_dot_', $column);
@@ -307,13 +307,13 @@ public function resultSet(&$results) {
307307
}
308308

309309
/**
310-
* Generates the fields list of an SQL query.
311-
*
312-
* @param Model $model
313-
* @param string $alias Alias tablename
314-
* @param mixed $fields
315-
* @return array
316-
*/
310+
* Generates the fields list of an SQL query.
311+
*
312+
* @param Model $model
313+
* @param string $alias Alias tablename
314+
* @param mixed $fields
315+
* @return array
316+
*/
317317
public function fields(Model $model, $alias = null, $fields = null, $quote = true) {
318318
if (empty($alias)) {
319319
$alias = $model->name;

0 commit comments

Comments
 (0)