@@ -15,9 +15,9 @@ |
||
15 | 15 | use yolk\database\DSN; |
16 | 16 | use yolk\database\exceptions\ConfigurationException; |
17 | 17 | |
18 | -class MySQLConnection extends BaseConnection { |
|
18 | +class MySQLConnection extends BaseConnection { |
|
19 | 19 | |
20 | - public function __construct( DSN $dsn ) { |
|
20 | + public function __construct( DSN $dsn ) { |
|
21 | 21 | |
22 | 22 | if( !$dsn->isMySQL() ) |
23 | 23 | throw new ConfigurationException(sprintf("\\%s expects a DSN of type '%s', '%s' given", __CLASS__, DSN::TYPE_MYSQL, $dsn->type)); |
@@ -15,9 +15,9 @@ |
||
15 | 15 | use yolk\database\DSN; |
16 | 16 | use yolk\database\exceptions\ConfigurationException; |
17 | 17 | |
18 | -class PgSQLConnection extends BaseConnection { |
|
18 | +class PgSQLConnection extends BaseConnection { |
|
19 | 19 | |
20 | - public function __construct( DSN $dsn ) { |
|
20 | + public function __construct( DSN $dsn ) { |
|
21 | 21 | |
22 | 22 | if( !$dsn->isPgSQL() ) |
23 | 23 | throw new ConfigurationException(sprintf("\\%s expects a DSN of type '%s', '%s' given", __CLASS__, DSN::TYPE_PGSQL, $dsn->type)); |
@@ -15,9 +15,9 @@ |
||
15 | 15 | use yolk\database\DSN; |
16 | 16 | use yolk\database\exceptions\ConfigurationException; |
17 | 17 | |
18 | -class SQLiteConnection extends BaseConnection { |
|
18 | +class SQLiteConnection extends BaseConnection { |
|
19 | 19 | |
20 | - public function __construct( DSN $dsn ) { |
|
20 | + public function __construct( DSN $dsn ) { |
|
21 | 21 | |
22 | 22 | if( !$dsn->isSQLite() ) |
23 | 23 | throw new ConfigurationException(sprintf("\\%s expects a DSN of type '%s', '%s' given", __CLASS__, DSN::TYPE_SQLITE, $dsn->type)); |
@@ -14,9 +14,9 @@ |
||
14 | 14 | /** |
15 | 15 | * Thrown if a database configuration is invalid. |
16 | 16 | */ |
17 | -class ConfigurationException extends DatabaseException { |
|
17 | +class ConfigurationException extends DatabaseException { |
|
18 | 18 | |
19 | - public function __construct( $message = 'The specified database configuration is invalid', $code = 0, \Exception $previous = null ) { |
|
19 | + public function __construct( $message = 'The specified database configuration is invalid', $code = 0, \Exception $previous = null ) { |
|
20 | 20 | parent::__construct($message, $code, $previous); |
21 | 21 | } |
22 | 22 |
@@ -14,9 +14,9 @@ |
||
14 | 14 | /** |
15 | 15 | * Thrown if a database connection could not be established. |
16 | 16 | */ |
17 | -class ConnectionException extends DatabaseException { |
|
17 | +class ConnectionException extends DatabaseException { |
|
18 | 18 | |
19 | - public function __construct( $message = 'An error occured attempting to connect to the database', $code = 0, \Exception $previous = null ) { |
|
19 | + public function __construct( $message = 'An error occured attempting to connect to the database', $code = 0, \Exception $previous = null ) { |
|
20 | 20 | parent::__construct($message, $code, $previous); |
21 | 21 | } |
22 | 22 |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | /** |
15 | 15 | * Base database exception. |
16 | 16 | */ |
17 | -class DatabaseException extends \Exception { |
|
17 | +class DatabaseException extends \Exception { |
|
18 | 18 | |
19 | 19 | /** |
20 | 20 | * https://bugs.php.net/bug.php?id=51742 |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | */ |
23 | 23 | protected $code; |
24 | 24 | |
25 | - public function __construct( $message = 'An unknown database error occured', $code = 0, \Exception $previous = null ) { |
|
25 | + public function __construct( $message = 'An unknown database error occured', $code = 0, \Exception $previous = null ) { |
|
26 | 26 | parent::__construct($message, (int) $code, $previous); |
27 | 27 | $this->code = $code; |
28 | 28 | } |
@@ -14,9 +14,9 @@ |
||
14 | 14 | /** |
15 | 15 | * Thrown if a database configuration is invalid. |
16 | 16 | */ |
17 | -class NotConnectedException extends DatabaseException { |
|
17 | +class NotConnectedException extends DatabaseException { |
|
18 | 18 | |
19 | - public function __construct( $message = 'The database is not connected', $code = 0, \Exception $previous = null ) { |
|
19 | + public function __construct( $message = 'The database is not connected', $code = 0, \Exception $previous = null ) { |
|
20 | 20 | parent::__construct($message, $code, $previous); |
21 | 21 | } |
22 | 22 |
@@ -14,9 +14,9 @@ |
||
14 | 14 | /** |
15 | 15 | * Thrown if an error occurs whilst executing a query. |
16 | 16 | */ |
17 | -class QueryException extends DatabaseException { |
|
17 | +class QueryException extends DatabaseException { |
|
18 | 18 | |
19 | - public function __construct( $message = 'An error occured executing a database query', $code = 0, \Exception $previous = null ) { |
|
19 | + public function __construct( $message = 'An error occured executing a database query', $code = 0, \Exception $previous = null ) { |
|
20 | 20 | parent::__construct($message, $code, $previous); |
21 | 21 | } |
22 | 22 |
@@ -108,8 +108,9 @@ |
||
108 | 108 | $child['rgt'] = (int) $child['rgt']; |
109 | 109 | |
110 | 110 | // if current left > right on top of stack we've gone down a level so pop the stack |
111 | - while( $stack && $child['lft'] > $stack[count($stack) - 1] ) |
|
112 | - array_pop($stack); |
|
111 | + while( $stack && $child['lft'] > $stack[count($stack) - 1] ) { |
|
112 | + array_pop($stack); |
|
113 | + } |
|
113 | 114 | |
114 | 115 | $child['depth'] = $offset + count($stack) + 1; |
115 | 116 |