fixed spacing

simple-pdo
n0nag0n 2 days ago
parent ff17dd591d
commit dd39d4adad

@ -247,6 +247,7 @@ class SimplePdo extends PdoWrapper
*
* @param string $sql
* @param array<int|string,mixed> $params
*
* @return array<int,mixed>
*/
public function fetchColumn(string $sql, array $params = []): array
@ -262,6 +263,7 @@ class SimplePdo extends PdoWrapper
*
* @param string $sql
* @param array<int|string,mixed> $params
*
* @return array<string|int,mixed>
*/
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<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)
*/
public function insert(string $table, array $data): string
@ -386,6 +391,7 @@ class SimplePdo extends PdoWrapper
* @param array<string,mixed> $data
* @param string $where - e.g., "id = ?"
* @param array<int|string,mixed> $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<int|string,mixed> $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();
}
}
}

@ -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];
}

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

Loading…
Cancel
Save