Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

add space to if expression

  • Loading branch information...
commit 81644ac873156d79998c14cd5159c910c0e41ec6 1 parent bd5b694
@c9s authored
Showing with 16 additions and 14 deletions.
  1. +5 −5 src/SQLBuilder/Driver.php
  2. +11 −9 src/SQLBuilder/Expression.php
View
10 src/SQLBuilder/Driver.php
@@ -209,7 +209,7 @@ public function getQuoteColumn($name)
*/
public function getQuoteTableName($name)
{
- if( $c = $this->quoteTable ) {
+ if ( $c = $this->quoteTable ) {
if( is_string($c) ) {
return $c . $name . $c;
} elseif( 'pgsql' === $this->type) {
@@ -235,11 +235,13 @@ public function quote($string)
*
* $driver->configure('quote',array($pgconn,'escape_string'));
*/
- if( $this->quoter )
+ if ( $this->quoter ) {
return call_user_func( $this->quoter , $string );
+ }
- if( $this->escaper )
+ if ( $this->escaper ) {
return '\'' . call_user_func( $this->escaper , $string ) . '\'';
+ }
}
/**
@@ -272,7 +274,5 @@ public function convertToNamedParameters($args)
return $new;
}
-
-
}
View
20 src/SQLBuilder/Expression.php
@@ -22,7 +22,7 @@ class Expression
public function setOp($op)
{
- if( $this->op ) {
+ if ( $this->op ) {
return $this->and()->setOp($op);
} elseif( $this->childs ) {
return $this->and()->setOp($op);
@@ -80,8 +80,9 @@ public function ungroup()
// back to Expression Group
$p = $this;
while( $p = $p->parent ) {
- if( $p instanceof \SQLBuilder\ExpressionGroup )
+ if ( $p instanceof \SQLBuilder\ExpressionGroup ) {
return $p->parent;
+ }
}
}
@@ -135,15 +136,16 @@ public function toSql()
{
$sql = '';
- if( $this->parentOp )
+ if ( $this->parentOp ) {
$sql .= $this->parentOp . ' ';
+ }
- if( $this->op ) {
- if( is_array( $this->op ) ) {
+ if ( $this->op ) {
+ if ( is_array( $this->op ) ) {
list($k,$op,$v) = $this->op;
- if( $this->driver->placeholder ) {
+ if ( $this->driver->placeholder ) {
if( is_array($v) ) {
@@ -154,7 +156,7 @@ public function toSql()
}
}
else {
- if( is_array($v) ) {
+ if ( is_array($v) ) {
$sql .= $this->driver->getQuoteColumn($k) . ' ' . $op . ' ' . $v[0];
} else {
$sql .= $this->driver->getQuoteColumn($k) . ' ' . $op . ' '
@@ -167,7 +169,7 @@ public function toSql()
}
}
}
- elseif( is_object( $this->op ) ) {
+ elseif ( is_object( $this->op ) ) {
$sql .= $this->op->toSql();
}
else {
@@ -175,7 +177,7 @@ public function toSql()
}
}
- if( ! empty($this->childs) ) {
+ if ( ! empty($this->childs) ) {
foreach( $this->childs as $child ) {
$sql .= ' '. $child->toSql();
}
Please sign in to comment.
Something went wrong with that request. Please try again.