diff --git a/flight/database/SimplePdo.php b/flight/database/SimplePdo.php index fe1bb0e..6e5cb57 100644 --- a/flight/database/SimplePdo.php +++ b/flight/database/SimplePdo.php @@ -247,6 +247,7 @@ class SimplePdo extends PdoWrapper * * @param string $sql * @param array $params + * * @return array */ public function fetchColumn(string $sql, array $params = []): array @@ -262,6 +263,7 @@ class SimplePdo extends PdoWrapper * * @param string $sql * @param array $params + * * @return array */ public function fetchPairs(string $sql, array $params = []): array @@ -280,7 +282,9 @@ class SimplePdo extends PdoWrapper * }); * * @param callable $callback + * * @return mixed The return value of the callback + * * @throws \Throwable */ public function transaction(callable $callback) @@ -310,6 +314,7 @@ class SimplePdo extends PdoWrapper * * @param string $table * @param array|array> $data Single row or array of rows + * * @return string Last insert ID (for single insert or last row of bulk insert) */ public function insert(string $table, array $data): string @@ -386,6 +391,7 @@ class SimplePdo extends PdoWrapper * @param array $data * @param string $where - e.g., "id = ?" * @param array $whereParams + * * @return int Number of affected rows (rows where data actually changed) */ public function update(string $table, array $data, string $where, array $whereParams = []): int @@ -415,6 +421,7 @@ class SimplePdo extends PdoWrapper * @param string $table * @param string $where - e.g., "id = ?" * @param array $whereParams + * * @return int Number of deleted rows */ public function delete(string $table, string $where, array $whereParams = []): int @@ -423,5 +430,4 @@ class SimplePdo extends PdoWrapper $stmt = $this->runQuery($sql, $whereParams); return $stmt->rowCount(); } - -} \ No newline at end of file +} diff --git a/flight/net/Request.php b/flight/net/Request.php index 31ff1b9..845b55c 100644 --- a/flight/net/Request.php +++ b/flight/net/Request.php @@ -177,24 +177,24 @@ class Request $base = '/'; // @codeCoverageIgnore } $config = [ - 'url' => $url, - 'base' => $base, - 'method' => $this->getMethod(), - 'referrer' => $this->getVar('HTTP_REFERER'), - 'ip' => $this->getVar('REMOTE_ADDR'), - 'ajax' => $this->getVar('HTTP_X_REQUESTED_WITH') === 'XMLHttpRequest', - 'scheme' => $scheme, + 'url' => $url, + 'base' => $base, + 'method' => $this->getMethod(), + 'referrer' => $this->getVar('HTTP_REFERER'), + 'ip' => $this->getVar('REMOTE_ADDR'), + 'ajax' => $this->getVar('HTTP_X_REQUESTED_WITH') === 'XMLHttpRequest', + 'scheme' => $scheme, 'user_agent' => $this->getVar('HTTP_USER_AGENT'), - 'type' => $this->getVar('CONTENT_TYPE'), - 'length' => intval($this->getVar('CONTENT_LENGTH', 0)), - 'query' => new Collection($_GET), - 'data' => new Collection($_POST), - 'cookies' => new Collection($_COOKIE), - 'files' => new Collection($_FILES), - 'secure' => $scheme === 'https', - 'accept' => $this->getVar('HTTP_ACCEPT'), - 'proxy_ip' => $this->getProxyIpAddress(), - 'host' => $this->getVar('HTTP_HOST'), + 'type' => $this->getVar('CONTENT_TYPE'), + 'length' => intval($this->getVar('CONTENT_LENGTH', 0)), + 'query' => new Collection($_GET), + 'data' => new Collection($_POST), + 'cookies' => new Collection($_COOKIE), + 'files' => new Collection($_FILES), + 'secure' => $scheme === 'https', + 'accept' => $this->getVar('HTTP_ACCEPT'), + 'proxy_ip' => $this->getProxyIpAddress(), + 'host' => $this->getVar('HTTP_HOST'), 'servername' => $this->getVar('SERVER_NAME', ''), ]; } @@ -463,7 +463,7 @@ class Request */ public function negotiateContentType(array $supported): ?string { - $accept = $this->header('Accept') ?? ''; + $accept = $this->header('Accept') ?: ''; if ($accept === '') { return $supported[0]; } diff --git a/tests/SimplePdoTest.php b/tests/SimplePdoTest.php index 8d678d7..de10378 100644 --- a/tests/SimplePdoTest.php +++ b/tests/SimplePdoTest.php @@ -444,5 +444,4 @@ class SimplePdoTest extends TestCase $id = $this->db->fetchField('SELECT id, name FROM users WHERE id = ?', [1]); $this->assertEquals(1, $id); } - }