fixed spacing

simple-pdo
n0nag0n 3 days ago
parent ff17dd591d
commit dd39d4adad

@ -247,6 +247,7 @@ class SimplePdo extends PdoWrapper
* *
* @param string $sql * @param string $sql
* @param array<int|string,mixed> $params * @param array<int|string,mixed> $params
*
* @return array<int,mixed> * @return array<int,mixed>
*/ */
public function fetchColumn(string $sql, array $params = []): array public function fetchColumn(string $sql, array $params = []): array
@ -262,6 +263,7 @@ class SimplePdo extends PdoWrapper
* *
* @param string $sql * @param string $sql
* @param array<int|string,mixed> $params * @param array<int|string,mixed> $params
*
* @return array<string|int,mixed> * @return array<string|int,mixed>
*/ */
public function fetchPairs(string $sql, array $params = []): array public function fetchPairs(string $sql, array $params = []): array
@ -280,7 +282,9 @@ class SimplePdo extends PdoWrapper
* }); * });
* *
* @param callable $callback * @param callable $callback
*
* @return mixed The return value of the callback * @return mixed The return value of the callback
*
* @throws \Throwable * @throws \Throwable
*/ */
public function transaction(callable $callback) public function transaction(callable $callback)
@ -310,6 +314,7 @@ class SimplePdo extends PdoWrapper
* *
* @param string $table * @param string $table
* @param array<string,mixed>|array<int,array<string,mixed>> $data Single row or array of rows * @param array<string,mixed>|array<int,array<string,mixed>> $data Single row or array of rows
*
* @return string Last insert ID (for single insert or last row of bulk insert) * @return string Last insert ID (for single insert or last row of bulk insert)
*/ */
public function insert(string $table, array $data): string public function insert(string $table, array $data): string
@ -386,6 +391,7 @@ class SimplePdo extends PdoWrapper
* @param array<string,mixed> $data * @param array<string,mixed> $data
* @param string $where - e.g., "id = ?" * @param string $where - e.g., "id = ?"
* @param array<int|string,mixed> $whereParams * @param array<int|string,mixed> $whereParams
*
* @return int Number of affected rows (rows where data actually changed) * @return int Number of affected rows (rows where data actually changed)
*/ */
public function update(string $table, array $data, string $where, array $whereParams = []): int 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 $table
* @param string $where - e.g., "id = ?" * @param string $where - e.g., "id = ?"
* @param array<int|string,mixed> $whereParams * @param array<int|string,mixed> $whereParams
*
* @return int Number of deleted rows * @return int Number of deleted rows
*/ */
public function delete(string $table, string $where, array $whereParams = []): int public function delete(string $table, string $where, array $whereParams = []): int
@ -423,5 +430,4 @@ class SimplePdo extends PdoWrapper
$stmt = $this->runQuery($sql, $whereParams); $stmt = $this->runQuery($sql, $whereParams);
return $stmt->rowCount(); return $stmt->rowCount();
} }
}
}

@ -177,24 +177,24 @@ class Request
$base = '/'; // @codeCoverageIgnore $base = '/'; // @codeCoverageIgnore
} }
$config = [ $config = [
'url' => $url, 'url' => $url,
'base' => $base, 'base' => $base,
'method' => $this->getMethod(), 'method' => $this->getMethod(),
'referrer' => $this->getVar('HTTP_REFERER'), 'referrer' => $this->getVar('HTTP_REFERER'),
'ip' => $this->getVar('REMOTE_ADDR'), 'ip' => $this->getVar('REMOTE_ADDR'),
'ajax' => $this->getVar('HTTP_X_REQUESTED_WITH') === 'XMLHttpRequest', 'ajax' => $this->getVar('HTTP_X_REQUESTED_WITH') === 'XMLHttpRequest',
'scheme' => $scheme, 'scheme' => $scheme,
'user_agent' => $this->getVar('HTTP_USER_AGENT'), 'user_agent' => $this->getVar('HTTP_USER_AGENT'),
'type' => $this->getVar('CONTENT_TYPE'), 'type' => $this->getVar('CONTENT_TYPE'),
'length' => intval($this->getVar('CONTENT_LENGTH', 0)), 'length' => intval($this->getVar('CONTENT_LENGTH', 0)),
'query' => new Collection($_GET), 'query' => new Collection($_GET),
'data' => new Collection($_POST), 'data' => new Collection($_POST),
'cookies' => new Collection($_COOKIE), 'cookies' => new Collection($_COOKIE),
'files' => new Collection($_FILES), 'files' => new Collection($_FILES),
'secure' => $scheme === 'https', 'secure' => $scheme === 'https',
'accept' => $this->getVar('HTTP_ACCEPT'), 'accept' => $this->getVar('HTTP_ACCEPT'),
'proxy_ip' => $this->getProxyIpAddress(), 'proxy_ip' => $this->getProxyIpAddress(),
'host' => $this->getVar('HTTP_HOST'), 'host' => $this->getVar('HTTP_HOST'),
'servername' => $this->getVar('SERVER_NAME', ''), 'servername' => $this->getVar('SERVER_NAME', ''),
]; ];
} }
@ -463,7 +463,7 @@ class Request
*/ */
public function negotiateContentType(array $supported): ?string public function negotiateContentType(array $supported): ?string
{ {
$accept = $this->header('Accept') ?? ''; $accept = $this->header('Accept') ?: '';
if ($accept === '') { if ($accept === '') {
return $supported[0]; return $supported[0];
} }

@ -444,5 +444,4 @@ class SimplePdoTest extends TestCase
$id = $this->db->fetchField('SELECT id, name FROM users WHERE id = ?', [1]); $id = $this->db->fetchField('SELECT id, name FROM users WHERE id = ?', [1]);
$this->assertEquals(1, $id); $this->assertEquals(1, $id);
} }
} }

Loading…
Cancel
Save