mirror of
https://github.com/dg/dibi.git
synced 2025-08-05 05:37:39 +02:00
coding style: removed space after reference &
This commit is contained in:
@@ -97,7 +97,7 @@ class Connection
|
||||
$this->config = $config;
|
||||
|
||||
// profiler
|
||||
$profilerCfg = & $config['profiler'];
|
||||
$profilerCfg = &$config['profiler'];
|
||||
if (is_scalar($profilerCfg)) {
|
||||
$profilerCfg = ['run' => (bool) $profilerCfg];
|
||||
}
|
||||
@@ -204,7 +204,7 @@ class Connection
|
||||
|
||||
|
||||
/** @deprecated */
|
||||
public static function alias(& $config, $key, $alias)
|
||||
public static function alias(&$config, $key, $alias)
|
||||
{
|
||||
trigger_error(__METHOD__ . '() is deprecated, use Helpers::alias().', E_USER_DEPRECATED);
|
||||
Helpers::alias($config, $key, $alias);
|
||||
|
@@ -60,7 +60,7 @@ class FirebirdDriver implements Dibi\Driver, Dibi\ResultDriver, Dibi\Reflector
|
||||
* @return void
|
||||
* @throws Dibi\Exception
|
||||
*/
|
||||
public function connect(array & $config)
|
||||
public function connect(array &$config)
|
||||
{
|
||||
Dibi\Helpers::alias($config, 'database', 'db');
|
||||
|
||||
@@ -331,7 +331,7 @@ class FirebirdDriver implements Dibi\Driver, Dibi\ResultDriver, Dibi\Reflector
|
||||
* Injects LIMIT/OFFSET to the SQL query.
|
||||
* @return void
|
||||
*/
|
||||
public function applyLimit(& $sql, $limit, $offset)
|
||||
public function applyLimit(&$sql, $limit, $offset)
|
||||
{
|
||||
if ($limit > 0 || $offset > 0) {
|
||||
// http://www.firebirdsql.org/refdocs/langrefupd20-select.html
|
||||
|
@@ -52,7 +52,7 @@ class MsSqlDriver implements Dibi\Driver, Dibi\ResultDriver
|
||||
* @return void
|
||||
* @throws Dibi\Exception
|
||||
*/
|
||||
public function connect(array & $config)
|
||||
public function connect(array &$config)
|
||||
{
|
||||
if (isset($config['resource'])) {
|
||||
$this->connection = $config['resource'];
|
||||
@@ -282,7 +282,7 @@ class MsSqlDriver implements Dibi\Driver, Dibi\ResultDriver
|
||||
* Injects LIMIT/OFFSET to the SQL query.
|
||||
* @return void
|
||||
*/
|
||||
public function applyLimit(& $sql, $limit, $offset)
|
||||
public function applyLimit(&$sql, $limit, $offset)
|
||||
{
|
||||
if ($offset) {
|
||||
throw new Dibi\NotSupportedException('Offset is not supported by this database.');
|
||||
|
@@ -65,7 +65,7 @@ class MySqlDriver implements Dibi\Driver, Dibi\ResultDriver
|
||||
* @return void
|
||||
* @throws Dibi\Exception
|
||||
*/
|
||||
public function connect(array & $config)
|
||||
public function connect(array &$config)
|
||||
{
|
||||
if (isset($config['resource'])) {
|
||||
$this->connection = $config['resource'];
|
||||
@@ -367,7 +367,7 @@ class MySqlDriver implements Dibi\Driver, Dibi\ResultDriver
|
||||
* Injects LIMIT/OFFSET to the SQL query.
|
||||
* @return void
|
||||
*/
|
||||
public function applyLimit(& $sql, $limit, $offset)
|
||||
public function applyLimit(&$sql, $limit, $offset)
|
||||
{
|
||||
if ($limit < 0 || $offset < 0) {
|
||||
throw new Dibi\NotSupportedException('Negative offset or limit.');
|
||||
|
@@ -66,7 +66,7 @@ class MySqliDriver implements Dibi\Driver, Dibi\ResultDriver
|
||||
* @return void
|
||||
* @throws Dibi\Exception
|
||||
*/
|
||||
public function connect(array & $config)
|
||||
public function connect(array &$config)
|
||||
{
|
||||
mysqli_report(MYSQLI_REPORT_OFF);
|
||||
if (isset($config['resource'])) {
|
||||
@@ -93,8 +93,8 @@ class MySqliDriver implements Dibi\Driver, Dibi\ResultDriver
|
||||
}
|
||||
}
|
||||
|
||||
$foo = & $config['flags'];
|
||||
$foo = & $config['database'];
|
||||
$foo = &$config['flags'];
|
||||
$foo = &$config['database'];
|
||||
|
||||
$this->connection = mysqli_init();
|
||||
if (isset($config['options'])) {
|
||||
@@ -375,7 +375,7 @@ class MySqliDriver implements Dibi\Driver, Dibi\ResultDriver
|
||||
* Injects LIMIT/OFFSET to the SQL query.
|
||||
* @return void
|
||||
*/
|
||||
public function applyLimit(& $sql, $limit, $offset)
|
||||
public function applyLimit(&$sql, $limit, $offset)
|
||||
{
|
||||
if ($limit < 0 || $offset < 0) {
|
||||
throw new Dibi\NotSupportedException('Negative offset or limit.');
|
||||
|
@@ -57,7 +57,7 @@ class OdbcDriver implements Dibi\Driver, Dibi\ResultDriver, Dibi\Reflector
|
||||
* @return void
|
||||
* @throws Dibi\Exception
|
||||
*/
|
||||
public function connect(array & $config)
|
||||
public function connect(array &$config)
|
||||
{
|
||||
if (isset($config['resource'])) {
|
||||
$this->connection = $config['resource'];
|
||||
@@ -306,7 +306,7 @@ class OdbcDriver implements Dibi\Driver, Dibi\ResultDriver, Dibi\Reflector
|
||||
* Injects LIMIT/OFFSET to the SQL query.
|
||||
* @return void
|
||||
*/
|
||||
public function applyLimit(& $sql, $limit, $offset)
|
||||
public function applyLimit(&$sql, $limit, $offset)
|
||||
{
|
||||
if ($offset) {
|
||||
throw new Dibi\NotSupportedException('Offset is not supported by this database.');
|
||||
|
@@ -64,9 +64,9 @@ class OracleDriver implements Dibi\Driver, Dibi\ResultDriver, Dibi\Reflector
|
||||
* @return void
|
||||
* @throws Dibi\Exception
|
||||
*/
|
||||
public function connect(array & $config)
|
||||
public function connect(array &$config)
|
||||
{
|
||||
$foo = & $config['charset'];
|
||||
$foo = &$config['charset'];
|
||||
$this->fmtDate = isset($config['formatDate']) ? $config['formatDate'] : 'U';
|
||||
$this->fmtDateTime = isset($config['formatDateTime']) ? $config['formatDateTime'] : 'U';
|
||||
|
||||
@@ -331,7 +331,7 @@ class OracleDriver implements Dibi\Driver, Dibi\ResultDriver, Dibi\Reflector
|
||||
* Injects LIMIT/OFFSET to the SQL query.
|
||||
* @return void
|
||||
*/
|
||||
public function applyLimit(& $sql, $limit, $offset)
|
||||
public function applyLimit(&$sql, $limit, $offset)
|
||||
{
|
||||
if ($limit < 0 || $offset < 0) {
|
||||
throw new Dibi\NotSupportedException('Negative offset or limit.');
|
||||
|
@@ -59,10 +59,10 @@ class PdoDriver implements Dibi\Driver, Dibi\ResultDriver
|
||||
* @return void
|
||||
* @throws Dibi\Exception
|
||||
*/
|
||||
public function connect(array & $config)
|
||||
public function connect(array &$config)
|
||||
{
|
||||
$foo = & $config['dsn'];
|
||||
$foo = & $config['options'];
|
||||
$foo = &$config['dsn'];
|
||||
$foo = &$config['options'];
|
||||
Dibi\Helpers::alias($config, 'resource', 'pdo');
|
||||
|
||||
if ($config['resource'] instanceof PDO) {
|
||||
@@ -396,7 +396,7 @@ class PdoDriver implements Dibi\Driver, Dibi\ResultDriver
|
||||
* Injects LIMIT/OFFSET to the SQL query.
|
||||
* @return void
|
||||
*/
|
||||
public function applyLimit(& $sql, $limit, $offset)
|
||||
public function applyLimit(&$sql, $limit, $offset)
|
||||
{
|
||||
if ($limit < 0 || $offset < 0) {
|
||||
throw new Dibi\NotSupportedException('Negative offset or limit.');
|
||||
|
@@ -55,7 +55,7 @@ class PostgreDriver implements Dibi\Driver, Dibi\ResultDriver, Dibi\Reflector
|
||||
* @return void
|
||||
* @throws Dibi\Exception
|
||||
*/
|
||||
public function connect(array & $config)
|
||||
public function connect(array &$config)
|
||||
{
|
||||
$error = NULL;
|
||||
if (isset($config['resource'])) {
|
||||
@@ -78,7 +78,7 @@ class PostgreDriver implements Dibi\Driver, Dibi\ResultDriver, Dibi\Reflector
|
||||
}
|
||||
}
|
||||
|
||||
set_error_handler(function($severity, $message) use (& $error) {
|
||||
set_error_handler(function($severity, $message) use (&$error) {
|
||||
$error = $message;
|
||||
});
|
||||
if (empty($config['persistent'])) {
|
||||
@@ -382,7 +382,7 @@ class PostgreDriver implements Dibi\Driver, Dibi\ResultDriver, Dibi\Reflector
|
||||
* Injects LIMIT/OFFSET to the SQL query.
|
||||
* @return void
|
||||
*/
|
||||
public function applyLimit(& $sql, $limit, $offset)
|
||||
public function applyLimit(&$sql, $limit, $offset)
|
||||
{
|
||||
if ($limit < 0 || $offset < 0) {
|
||||
throw new Dibi\NotSupportedException('Negative offset or limit.');
|
||||
|
@@ -59,7 +59,7 @@ class Sqlite3Driver implements Dibi\Driver, Dibi\ResultDriver
|
||||
* @return void
|
||||
* @throws Dibi\Exception
|
||||
*/
|
||||
public function connect(array & $config)
|
||||
public function connect(array &$config)
|
||||
{
|
||||
Dibi\Helpers::alias($config, 'database', 'file');
|
||||
$this->fmtDate = isset($config['formatDate']) ? $config['formatDate'] : 'U';
|
||||
@@ -326,7 +326,7 @@ class Sqlite3Driver implements Dibi\Driver, Dibi\ResultDriver
|
||||
* Injects LIMIT/OFFSET to the SQL query.
|
||||
* @return void
|
||||
*/
|
||||
public function applyLimit(& $sql, $limit, $offset)
|
||||
public function applyLimit(&$sql, $limit, $offset)
|
||||
{
|
||||
if ($limit < 0 || $offset < 0) {
|
||||
throw new Dibi\NotSupportedException('Negative offset or limit.');
|
||||
|
@@ -61,7 +61,7 @@ class SqlsrvDriver implements Dibi\Driver, Dibi\ResultDriver
|
||||
* @return void
|
||||
* @throws Dibi\Exception
|
||||
*/
|
||||
public function connect(array & $config)
|
||||
public function connect(array &$config)
|
||||
{
|
||||
Helpers::alias($config, 'options|UID', 'username');
|
||||
Helpers::alias($config, 'options|PWD', 'password');
|
||||
@@ -306,7 +306,7 @@ class SqlsrvDriver implements Dibi\Driver, Dibi\ResultDriver
|
||||
* Injects LIMIT/OFFSET to the SQL query.
|
||||
* @return void
|
||||
*/
|
||||
public function applyLimit(& $sql, $limit, $offset)
|
||||
public function applyLimit(&$sql, $limit, $offset)
|
||||
{
|
||||
if ($limit < 0 || $offset < 0) {
|
||||
throw new Dibi\NotSupportedException('Negative offset or limit.');
|
||||
|
@@ -130,19 +130,19 @@ class Fluent implements IDataSource
|
||||
if (isset(self::$masks[$clause])) {
|
||||
$this->clauses = array_fill_keys(self::$masks[$clause], NULL);
|
||||
}
|
||||
$this->cursor = & $this->clauses[$clause];
|
||||
$this->cursor = &$this->clauses[$clause];
|
||||
$this->cursor = [];
|
||||
$this->command = $clause;
|
||||
}
|
||||
|
||||
// auto-switch to a clause
|
||||
if (isset(self::$clauseSwitches[$clause])) {
|
||||
$this->cursor = & $this->clauses[self::$clauseSwitches[$clause]];
|
||||
$this->cursor = &$this->clauses[self::$clauseSwitches[$clause]];
|
||||
}
|
||||
|
||||
if (array_key_exists($clause, $this->clauses)) {
|
||||
// append to clause
|
||||
$this->cursor = & $this->clauses[$clause];
|
||||
$this->cursor = &$this->clauses[$clause];
|
||||
|
||||
// TODO: really delete?
|
||||
if ($args === [self::REMOVE]) {
|
||||
@@ -211,7 +211,7 @@ class Fluent implements IDataSource
|
||||
*/
|
||||
public function clause($clause)
|
||||
{
|
||||
$this->cursor = & $this->clauses[self::$normalizer->$clause];
|
||||
$this->cursor = &$this->clauses[self::$normalizer->$clause];
|
||||
if ($this->cursor === NULL) {
|
||||
$this->cursor = [];
|
||||
}
|
||||
@@ -512,10 +512,10 @@ class Fluent implements IDataSource
|
||||
{
|
||||
// remove references
|
||||
foreach ($this->clauses as $clause => $val) {
|
||||
$this->clauses[$clause] = & $val;
|
||||
$this->clauses[$clause] = &$val;
|
||||
unset($val);
|
||||
}
|
||||
$this->cursor = & $foo;
|
||||
$this->cursor = &$foo;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -220,11 +220,11 @@ class Helpers
|
||||
* @param string alias key
|
||||
* @return void
|
||||
*/
|
||||
public static function alias(& $config, $key, $alias)
|
||||
public static function alias(&$config, $key, $alias)
|
||||
{
|
||||
$foo = & $config;
|
||||
$foo = &$config;
|
||||
foreach (explode('|', $key) as $key) {
|
||||
$foo = & $foo[$key];
|
||||
$foo = &$foo[$key];
|
||||
}
|
||||
|
||||
if (!isset($foo) && isset($config[$alias])) {
|
||||
|
@@ -291,12 +291,12 @@ class Result implements IDataSource
|
||||
|
||||
// make associative tree
|
||||
do {
|
||||
$x = & $data;
|
||||
$x = &$data;
|
||||
|
||||
// iterative deepening
|
||||
foreach ($assoc as $i => $as) {
|
||||
if ($as === '[]') { // indexed-array node
|
||||
$x = & $x[];
|
||||
$x = &$x[];
|
||||
|
||||
} elseif ($as === '=') { // "value" node
|
||||
$x = $row->{$assoc[$i + 1]};
|
||||
@@ -305,14 +305,14 @@ class Result implements IDataSource
|
||||
} elseif ($as === '->') { // "object" node
|
||||
if ($x === NULL) {
|
||||
$x = clone $row;
|
||||
$x = & $x->{$assoc[$i + 1]};
|
||||
$x = &$x->{$assoc[$i + 1]};
|
||||
$x = NULL; // prepare child node
|
||||
} else {
|
||||
$x = & $x->{$assoc[$i + 1]};
|
||||
$x = &$x->{$assoc[$i + 1]};
|
||||
}
|
||||
|
||||
} elseif ($as !== '|') { // associative-array node
|
||||
$x = & $x[$row->$as];
|
||||
$x = &$x[$row->$as];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -356,32 +356,32 @@ class Result implements IDataSource
|
||||
}
|
||||
|
||||
do {
|
||||
$x = & $data;
|
||||
$x = &$data;
|
||||
|
||||
foreach ($assoc as $i => $as) {
|
||||
if ($as === '#') { // indexed-array node
|
||||
$x = & $x[];
|
||||
$x = &$x[];
|
||||
|
||||
} elseif ($as === '=') { // "record" node
|
||||
if ($x === NULL) {
|
||||
$x = $row->toArray();
|
||||
$x = & $x[ $assoc[$i + 1] ];
|
||||
$x = &$x[ $assoc[$i + 1] ];
|
||||
$x = NULL; // prepare child node
|
||||
} else {
|
||||
$x = & $x[ $assoc[$i + 1] ];
|
||||
$x = &$x[ $assoc[$i + 1] ];
|
||||
}
|
||||
|
||||
} elseif ($as === '@') { // "object" node
|
||||
if ($x === NULL) {
|
||||
$x = clone $row;
|
||||
$x = & $x->{$assoc[$i + 1]};
|
||||
$x = &$x->{$assoc[$i + 1]};
|
||||
$x = NULL; // prepare child node
|
||||
} else {
|
||||
$x = & $x->{$assoc[$i + 1]};
|
||||
$x = &$x->{$assoc[$i + 1]};
|
||||
}
|
||||
|
||||
} else { // associative-array node
|
||||
$x = & $x[$row->$as];
|
||||
$x = &$x[$row->$as];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -483,7 +483,7 @@ class Result implements IDataSource
|
||||
* @param array
|
||||
* @return void
|
||||
*/
|
||||
private function normalize(array & $row)
|
||||
private function normalize(array &$row)
|
||||
{
|
||||
foreach ($this->types as $key => $type) {
|
||||
if (!isset($row[$key])) { // NULL
|
||||
|
@@ -131,7 +131,7 @@ trait Strict
|
||||
|
||||
$list = & self::$extMethods[strtolower($name)];
|
||||
if ($callback === NULL) { // getter
|
||||
$cache = & $list[''][$class];
|
||||
$cache = &$list[''][$class];
|
||||
if (isset($cache)) {
|
||||
return $cache;
|
||||
}
|
||||
|
@@ -73,8 +73,8 @@ final class Translator
|
||||
|
||||
$commandIns = NULL;
|
||||
$lastArr = NULL;
|
||||
$cursor = & $this->cursor;
|
||||
$comment = & $this->comment;
|
||||
$cursor = &$this->cursor;
|
||||
$comment = &$this->comment;
|
||||
|
||||
// iterate
|
||||
$sql = [];
|
||||
@@ -480,7 +480,7 @@ final class Translator
|
||||
|
||||
|
||||
if (!empty($matches[11])) { // placeholder
|
||||
$cursor = & $this->cursor;
|
||||
$cursor = &$this->cursor;
|
||||
|
||||
if ($cursor >= count($this->args)) {
|
||||
return $this->errors[] = '**Extra placeholder**';
|
||||
@@ -492,7 +492,7 @@ final class Translator
|
||||
|
||||
if (!empty($matches[10])) { // modifier
|
||||
$mod = $matches[10];
|
||||
$cursor = & $this->cursor;
|
||||
$cursor = &$this->cursor;
|
||||
|
||||
if ($cursor >= count($this->args) && $mod !== 'else' && $mod !== 'end') {
|
||||
return $this->errors[] = "**Extra modifier %$mod**";
|
||||
@@ -600,7 +600,7 @@ final class Translator
|
||||
{
|
||||
$value = $this->connection->substitute($value);
|
||||
$parts = explode('.', $value);
|
||||
foreach ($parts as & $v) {
|
||||
foreach ($parts as &$v) {
|
||||
if ($v !== '*') {
|
||||
$v = $this->driver->escapeIdentifier($v);
|
||||
}
|
||||
|
@@ -30,7 +30,7 @@ interface Driver
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
function connect(array & $config);
|
||||
function connect(array &$config);
|
||||
|
||||
/**
|
||||
* Disconnects from a database.
|
||||
@@ -124,7 +124,7 @@ interface Driver
|
||||
* Injects LIMIT/OFFSET to the SQL query.
|
||||
* @return void
|
||||
*/
|
||||
function applyLimit(& $sql, $limit, $offset);
|
||||
function applyLimit(&$sql, $limit, $offset);
|
||||
|
||||
}
|
||||
|
||||
|
@@ -10,7 +10,7 @@ class MockDriver extends Dibi\Drivers\SqlsrvDriver
|
||||
function __construct()
|
||||
{}
|
||||
|
||||
function connect(array & $config)
|
||||
function connect(array &$config)
|
||||
{}
|
||||
|
||||
function query($sql)
|
||||
|
@@ -15,7 +15,7 @@ class MockResult extends Dibi\Result
|
||||
{
|
||||
$normalize = new ReflectionMethod('Dibi\Result', 'normalize');
|
||||
$normalize->setAccessible(TRUE);
|
||||
$normalize->invokeArgs($this, [& $row]);
|
||||
$normalize->invokeArgs($this, [&$row]);
|
||||
return $row;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user