Skip to content

Commit e6d9510

Browse files
committed
update
2 parents eea6ac5 + 3e10fdb commit e6d9510

File tree

4 files changed

+27
-7
lines changed

4 files changed

+27
-7
lines changed

src/Curl.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class Curl
1616
* @param array<string,mixed> $options
1717
* @return array<string,mixed>
1818
*/
19-
public static function navigateCached(int $expire, string $method, string $url, string|array $data, array $headers = [], array $options = []): array
19+
public static function navigateCached(int $expire, string $method, string $url, mixed $data, array $headers = [], array $options = []): array
2020
{
2121
return self::callCached($expire, $method, $url, $data, $headers, array_merge($options, ['CURLOPT_FOLLOWLOCATION' => true]));
2222
}
@@ -27,7 +27,7 @@ public static function navigateCached(int $expire, string $method, string $url,
2727
* @param array<string,mixed> $options
2828
* @return array<string,mixed>
2929
*/
30-
public static function callCached(int $expire, string $method, string $url, string|array $data, array $headers = [], array $options = []): array
30+
public static function callCached(int $expire, string $method, string $url, mixed $data, array $headers = [], array $options = []): array
3131
{
3232
$key = $method . '_' . $url . '_' . json_encode($data) . '_' . json_encode($headers) . '_' . json_encode($options);
3333
$result = Cache::get($key);
@@ -47,7 +47,7 @@ public static function callCached(int $expire, string $method, string $url, stri
4747
* @param array<string,mixed> $options
4848
* @return array<string,mixed>
4949
*/
50-
public static function navigate(string $method, string $url, string|array $data = '', array $headers = [], array $options = []): array
50+
public static function navigate(string $method, string $url, $data = '', array $headers = [], array $options = []): array
5151
{
5252
return self::call($method, $url, $data, $headers, array_merge($options, array('CURLOPT_FOLLOWLOCATION' => true)));
5353
}
@@ -58,7 +58,7 @@ public static function navigate(string $method, string $url, string|array $data
5858
* @param array<string,mixed> $options
5959
* @return array<string,mixed>
6060
*/
61-
public static function call(string $method, string $url, string|array $data = '', array $headers = [], array $options = []): array
61+
public static function call(string $method, string $url, $data = '', array $headers = [], array $options = []): array
6262
{
6363
if (Debugger::$enabled) {
6464
$time = microtime(true);
@@ -145,7 +145,7 @@ public static function call(string $method, string $url, string|array $data = ''
145145
* @param array<string,string> $headers
146146
* @param array<string,mixed> $options
147147
*/
148-
protected static function setOptions(\CurlHandle $ch, string $method, string &$url, string|array &$data, array $headers, array $options): void
148+
protected static function setOptions(\CurlHandle $ch, string $method, string &$url, mixed &$data, array $headers, array $options): void
149149
{
150150
// Set default options
151151
foreach ($options as $option => $value) {

src/DB.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,9 @@ private static function queryTyped($query): mixed
8080
}
8181
}
8282
$stmt = self::$mysqli->prepare($query);
83-
$stmt->bind_param(...$nargs);
83+
if ($nargs[0]) {
84+
$stmt->bind_param(...$nargs);
85+
}
8486
} else {
8587
$stmt = self::$mysqli->prepare($query);
8688
}

src/Debugger.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class Debugger
88
public static bool $enabled = false;
99
public static string $sessionKey = 'debugger';
1010

11-
protected static mixed $request = null;
11+
protected static $request = null;
1212

1313
protected static bool $initialized = false;
1414

src/Orm.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,15 @@
55
class Orm
66
{
77
/**
8+
<<<<<<< HEAD
89
* Inserts a new record into the specified table.
910
*
1011
* @param string $tableName The name of the table to insert into.
1112
* @param array<string, ?string> $object An associative array representing the record to insert, where keys are column names and values are the corresponding values.
1213
* @return int The ID of the newly inserted record. If no fields are provided, returns 0.
14+
=======
15+
* @param array<string, string|float|int|null> $object
16+
>>>>>>> 3e10fdba060fae137fb789bbd64b8ab69aee0c41
1317
*/
1418
public static function insert(string $tableName, array $object): int
1519
{
@@ -31,13 +35,17 @@ public static function insert(string $tableName, array $object): int
3135
}
3236

3337
/**
38+
<<<<<<< HEAD
3439
* Updates an existing record in the specified table by its ID.
3540
*
3641
* @param string $tableName The name of the table to update.
3742
* @param array<string, ?string> $object An associative array representing the record to insert, where keys are column names and values are the corresponding values.
3843
* @param string|int $id The ID of the record to update.
3944
* @param string $idField The name of the ID field (default is 'id').
4045
* @return bool Returns true if the update was successful, false otherwise.
46+
=======
47+
* @param array<string, string|float|int|null> $object
48+
>>>>>>> 3e10fdba060fae137fb789bbd64b8ab69aee0c41
4149
*/
4250
public static function update(string $tableName, array $object, string|int $id, string $idField = 'id'): bool
4351
{
@@ -65,12 +73,16 @@ public static function update(string $tableName, array $object, string|int $id,
6573
}
6674

6775
/**
76+
<<<<<<< HEAD
6877
* Selects a record from the specified table by its ID.
6978
*
7079
* @param string $tableName The name of the table to select from.
7180
* @param string|int $id The ID of the record to select.
7281
* @param string $idField The name of the ID field (default is 'id').
7382
* @return array<string, ?string> $object An associative array representing the selected record, where keys are column names and values are the corresponding values. If no record is found, an empty array is returned.
83+
=======
84+
* @return array<string, string|float|int|null>
85+
>>>>>>> 3e10fdba060fae137fb789bbd64b8ab69aee0c41
7486
*/
7587
public static function select(string $tableName, string|int $id, string $idField = 'id'): array
7688
{
@@ -91,4 +103,10 @@ public static function delete(string $tableName, string|int $id, string $idField
91103
$sql = "DELETE FROM `$tableName` WHERE `$idField` = ?";
92104
return DB::delete($sql, $id) ? true : false;
93105
}
106+
107+
public static function delete(string $tableName, string|int $id, string $idField = 'id'): int
108+
{
109+
$sql = "DELETE FROM `$tableName` WHERE `$idField` = ?";
110+
return DB::delete($sql, [$id]);
111+
}
94112
}

0 commit comments

Comments
 (0)