Skip to content

Commit

Permalink
move method
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Dec 8, 2016
1 parent 730a2cc commit 6b413d5
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions src/Illuminate/Database/Connectors/Connector.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,31 +106,31 @@ protected function tryAgainIfCausedByLostConnection(Exception $e, $dsn, $usernam
}

/**
* Determine if the connection is persistent or not.
* Create a new PDO connection instance.
*
* @param array $options
* @return bool
* @return \PDO
*/
protected function isPersistentConnection($options)
protected function createPdoConnection($dsn, $username, $password, $options)
{
if (isset($options[PDO::ATTR_PERSISTENT]) && $options[PDO::ATTR_PERISISTENT]) {
return true;
if (class_exists(PDOConnection::class) && ! $this->isPersistentConnection($options)) {
return new PDOConnection($dsn, $username, $password, $options);
}

return false;
return new PDO($dsn, $username, $password, $options);
}

/**
* Create a new PDO connection instance.
* Determine if the connection is persistent.
*
* @return \PDO
* @param array $options
* @return bool
*/
protected function createPdoConnection($dsn, $username, $password, $options)
protected function isPersistentConnection($options)
{
if (class_exists(PDOConnection::class) && ! $this->isPersistentConnection($options)) {
return new PDOConnection($dsn, $username, $password, $options);
if (isset($options[PDO::ATTR_PERSISTENT]) && $options[PDO::ATTR_PERISISTENT]) {
return true;
}

return new PDO($dsn, $username, $password, $options);
return false;
}
}

0 comments on commit 6b413d5

Please sign in to comment.