Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Nov 22, 2017
1 parent bba3eae commit 9a3d71d
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 16 deletions.
24 changes: 12 additions & 12 deletions src/Illuminate/Database/Grammar.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,29 +138,29 @@ public function parameterize(array $values)
}

/**
* Quote string literals.
* Get the appropriate query parameter place-holder for a value.
*
* @param string|array $value
* @param mixed $value
* @return string
*/
public function quote($value)
public function parameter($value)
{
if (is_array($value)) {
return implode(', ', array_map([$this, 'quote'], $value));
}

return "'$value'";
return $this->isExpression($value) ? $this->getValue($value) : '?';
}

/**
* Get the appropriate query parameter place-holder for a value.
* Quote the given string literal.
*
* @param mixed $value
* @param string|array $value
* @return string
*/
public function parameter($value)
public function quoteString($value)
{
return $this->isExpression($value) ? $this->getValue($value) : '?';
if (is_array($value)) {
return implode(', ', array_map([$this, __FUNCTION__], $value));
}

return "'$value'";
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Database/Schema/Grammars/MySqlGrammar.php
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ protected function typeBoolean(Fluent $column)
*/
protected function typeEnum(Fluent $column)
{
return sprintf('enum(%s)', $this->quote($column->allowed));
return sprintf('enum(%s)', $this->quoteString($column->allowed));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ protected function typeEnum(Fluent $column)
return sprintf(
'varchar(255) check ("%s" in (%s))',
$column->name,
$this->quote($column->allowed)
$this->quoteString($column->allowed)
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Database/Schema/Grammars/SQLiteGrammar.php
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ protected function typeEnum(Fluent $column)
return sprintf(
'varchar check ("%s" in (%s))',
$column->name,
$this->quote($column->allowed)
$this->quoteString($column->allowed)
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ protected function typeEnum(Fluent $column)
return sprintf(
'nvarchar(255) check ("%s" in (%s))',
$column->name,
$this->quote($column->allowed)
$this->quoteString($column->allowed)
);
}

Expand Down

0 comments on commit 9a3d71d

Please sign in to comment.