modifs.mineures sans commentaires
This commit is contained in:
parent
6feb54dc22
commit
d0b8be8132
|
@ -33,7 +33,9 @@ class cl {
|
||||||
*/
|
*/
|
||||||
static final function first(?iterable $iterable, $default=null) {
|
static final function first(?iterable $iterable, $default=null) {
|
||||||
if (is_array($iterable)) {
|
if (is_array($iterable)) {
|
||||||
return $iterable[array_key_first($iterable)];
|
$key = array_key_first($iterable);
|
||||||
|
if ($key === null) return $default;
|
||||||
|
return $iterable[$key];
|
||||||
}
|
}
|
||||||
if (is_iterable($iterable)) {
|
if (is_iterable($iterable)) {
|
||||||
foreach ($iterable as $value) {
|
foreach ($iterable as $value) {
|
||||||
|
@ -49,7 +51,9 @@ class cl {
|
||||||
*/
|
*/
|
||||||
static final function last(?iterable $iterable, $default=null) {
|
static final function last(?iterable $iterable, $default=null) {
|
||||||
if (is_array($iterable)) {
|
if (is_array($iterable)) {
|
||||||
return $iterable[array_key_last($iterable)];
|
$key = array_key_last($iterable);
|
||||||
|
if ($key === null) return $default;
|
||||||
|
return $iterable[$key];
|
||||||
}
|
}
|
||||||
$value = $default;
|
$value = $default;
|
||||||
if (is_iterable($iterable)) {
|
if (is_iterable($iterable)) {
|
||||||
|
|
|
@ -151,6 +151,7 @@ class CapacitorChannel {
|
||||||
return $serial !== null? unserialize($serial): null;
|
return $serial !== null? unserialize($serial): null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const SERIAL_DEFINITION = "mediumtext";
|
||||||
const SUM_DEFINITION = "varchar(40)";
|
const SUM_DEFINITION = "varchar(40)";
|
||||||
|
|
||||||
final function sum(?string $serial, $value=null): ?string {
|
final function sum(?string $serial, $value=null): ?string {
|
||||||
|
|
|
@ -30,7 +30,7 @@ abstract class CapacitorStorage {
|
||||||
const PRIMARY_KEY_DEFINITION = null;
|
const PRIMARY_KEY_DEFINITION = null;
|
||||||
|
|
||||||
const COLUMN_DEFINITIONS = [
|
const COLUMN_DEFINITIONS = [
|
||||||
"item__" => "text",
|
"item__" => CapacitorChannel::SERIAL_DEFINITION,
|
||||||
"item__sum_" => CapacitorChannel::SUM_DEFINITION,
|
"item__sum_" => CapacitorChannel::SUM_DEFINITION,
|
||||||
"created_" => "datetime",
|
"created_" => "datetime",
|
||||||
"modified_" => "datetime",
|
"modified_" => "datetime",
|
||||||
|
|
Loading…
Reference in New Issue