generate($length, $alphabet)->serialize(); } function parseDateFromQuery(array $query, string $dateName): ?Chronos { return ! isset($query[$dateName]) || empty($query[$dateName]) ? null : Chronos::parse($query[$dateName]); } /** * @param string|DateTimeInterface|Chronos|null $date */ function parseDateField($date): ?Chronos { if ($date === null || $date instanceof Chronos) { return $date; } if ($date instanceof DateTimeInterface) { return Chronos::instance($date); } return Chronos::parse($date); } function determineTableName(string $tableName, array $emConfig = []): string { $schema = $emConfig['connection']['schema'] ?? null; // $tablePrefix = $emConfig['connection']['table_prefix'] ?? null; // TODO if ($schema === null) { return $tableName; } return sprintf('%s.%s', $schema, $tableName); } function getOptionalIntFromInputFilter(InputFilter $inputFilter, string $fieldName): ?int { $value = $inputFilter->getValue($fieldName); return $value !== null ? (int) $value : null; } function getOptionalBoolFromInputFilter(InputFilter $inputFilter, string $fieldName): ?bool { $value = $inputFilter->getValue($fieldName); return $value !== null ? (bool) $value : null; }