Skip to content

Commit 78c0550

Browse files
committed
Use WordPress coding styles
1 parent b7775c7 commit 78c0550

File tree

3 files changed

+883
-872
lines changed

3 files changed

+883
-872
lines changed

packages/mysq-server-php/src/handler-sqlite-translation.php

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -23,38 +23,38 @@ class SQLiteTranslationHandler implements MySQLQueryHandler {
2323
/** @var WP_SQLite_Driver */
2424
private $sqlite_driver;
2525

26-
public function __construct($sqlite_database_path) {
27-
define('FQDB', $sqlite_database_path);
28-
define('FQDBDIR', dirname(FQDB) . '/');
26+
public function __construct( $sqlite_database_path ) {
27+
define( 'FQDB', $sqlite_database_path );
28+
define( 'FQDBDIR', dirname( FQDB ) . '/' );
2929

3030
$this->sqlite_driver = new WP_SQLite_Driver(
3131
new WP_SQLite_Connection( array( 'path' => $sqlite_database_path ) ),
32-
'wordpress'
32+
'sqlite_database'
3333
);
3434
}
3535

36-
public function handleQuery(string $query): MySQLServerQueryResult {
36+
public function handle_query( string $query ): MySQLServerQueryResult {
3737
try {
38-
$rows = $this->sqlite_driver->query($query);
38+
$rows = $this->sqlite_driver->query( $query );
3939
if ( $this->sqlite_driver->get_last_column_count() > 0 ) {
4040
$columns = $this->computeColumnInfo();
41-
return new SelectQueryResult($columns, $rows);
41+
return new SelectQueryResult( $columns, $rows );
4242
}
4343
return new OkayPacketResult(
4444
$this->sqlite_driver->get_last_return_value() ?? 0,
4545
$this->sqlite_driver->get_insert_id() ?? 0
4646
);
47-
} catch (Throwable $e) {
48-
return new ErrorQueryResult($e->getMessage());
47+
} catch ( Throwable $e ) {
48+
return new ErrorQueryResult( $e->getMessage() );
4949
}
5050
}
5151

5252
public function computeColumnInfo() {
53-
$columns = [];
53+
$columns = array();
5454

5555
$column_meta = $this->sqlite_driver->get_last_column_meta();
5656

57-
$types = [
57+
$types = array(
5858
'DECIMAL' => MySQLProtocol::FIELD_TYPE_DECIMAL,
5959
'TINY' => MySQLProtocol::FIELD_TYPE_TINY,
6060
'SHORT' => MySQLProtocol::FIELD_TYPE_SHORT,
@@ -82,20 +82,20 @@ public function computeColumnInfo() {
8282
'VAR_STRING' => MySQLProtocol::FIELD_TYPE_VAR_STRING,
8383
'STRING' => MySQLProtocol::FIELD_TYPE_STRING,
8484
'GEOMETRY' => MySQLProtocol::FIELD_TYPE_GEOMETRY,
85-
];
85+
);
8686

87-
foreach ($column_meta as $column) {
88-
$type = $types[$column['native_type']] ?? null;
87+
foreach ( $column_meta as $column ) {
88+
$type = $types[ $column['native_type'] ] ?? null;
8989
if ( null === $type ) {
90-
throw new Exception('Unknown column type: ' . $column['native_type']);
90+
throw new Exception( 'Unknown column type: ' . $column['native_type'] );
9191
}
92-
$columns[] = [
92+
$columns[] = array(
9393
'name' => $column['name'],
9494
'length' => $column['len'],
9595
'type' => $type,
9696
'flags' => 129,
97-
'decimals' => $column['precision']
98-
];
97+
'decimals' => $column['precision'],
98+
);
9999
}
100100
return $columns;
101101
}

0 commit comments

Comments
 (0)