Skip to content

Commit 0bfa91a

Browse files
committed
Refactor
1 parent d88adc2 commit 0bfa91a

File tree

1 file changed

+8
-14
lines changed

1 file changed

+8
-14
lines changed

src/libraries/Server.php

+8-14
Original file line numberDiff line numberDiff line change
@@ -364,20 +364,14 @@ public function save() {
364364
$stmt->bindParam( ':port', $this->port, PDO::PARAM_INT );
365365
$stmt->bindParam( ':status', $this->status_bitmask, PDO::PARAM_INT );
366366
$stmt->bindParam( ':type_id', $this->type_id, PDO::PARAM_INT );
367-
if ( is_null( $this->updated_datetime )) {
368-
$stmt->bindParam(
369-
':updated_dt', $this->updated_datetime, PDO::PARAM_NULL
370-
);
371-
} else {
372-
$stmt->bindParam(
373-
':updated_dt', $this->updated_datetime, PDO::PARAM_STR
374-
);
375-
}
376-
if ( is_null( $this->user_id )) {
377-
$stmt->bindParam( ':user_id', $this->user_id, PDO::PARAM_NULL );
378-
} else {
379-
$stmt->bindParam( ':user_id', $this->user_id, PDO::PARAM_INT );
380-
}
367+
368+
$stmt->bindParam( ':updated_dt', $this->updated_datetime, (
369+
is_null( $this->updated_datetime ) ? PDO::PARAM_NULL : PDO::PARAM_STR
370+
));
371+
372+
$stmt->bindParam( ':user_dt', $this->user_id, (
373+
is_null( $this->user_id ) ? PDO::PARAM_NULL : PDO::PARAM_INT
374+
));
381375

382376
if (!$stmt->execute()) {
383377
throw new QueryException( 'Cannot save server' );

0 commit comments

Comments
 (0)