mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-01-11 01:38:41 +00:00
Fix invalid global namespace
This commit is contained in:
parent
e28353a86b
commit
11c78afbbe
|
|
@ -87,33 +87,28 @@ abstract class SettingsAbstract implements OptionsInterface
|
|||
public function get($columns)
|
||||
{
|
||||
try {
|
||||
if (!is_array($columns)) {
|
||||
if (!\is_array($columns)) {
|
||||
$columns = [$columns];
|
||||
}
|
||||
|
||||
$options = [];
|
||||
$query = new Builder($this->connection);
|
||||
$sql = $query->select(...static::$columns)
|
||||
->from($this->connection->prefix . static::$table)
|
||||
->where(static::$columns[0], 'in', $columns)
|
||||
->toSql();
|
||||
|
||||
switch ($this->connection->getType()) {
|
||||
case DatabaseType::MYSQL:
|
||||
$query = new Builder($this->connection);
|
||||
$sql = $query->select(...static::$columns)
|
||||
->from($this->connection->prefix . static::$table)
|
||||
->where(static::$columns[0], 'in', $columns)
|
||||
->toSql();
|
||||
$sth = $this->connection->con->prepare($sql);
|
||||
$sth->execute();
|
||||
|
||||
$sth = $this->connection->con->prepare($sql);
|
||||
$sth->execute();
|
||||
$options = $sth->fetchAll(\PDO::FETCH_KEY_PAIR);
|
||||
|
||||
$options = $sth->fetchAll(\PDO::FETCH_KEY_PAIR);
|
||||
|
||||
if ($options === false) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$this->setOptions($options);
|
||||
break;
|
||||
if ($options === false) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$this->setOptions($options);
|
||||
|
||||
return \count($options) > 1 ? $options : \reset($options);
|
||||
} catch (\PDOException $e) {
|
||||
$exception = DatabaseExceptionFactory::createException($e);
|
||||
|
|
@ -138,7 +133,13 @@ abstract class SettingsAbstract implements OptionsInterface
|
|||
$this->setOptions($options);
|
||||
|
||||
if ($store) {
|
||||
$this->connection->con->beginTransaction();
|
||||
|
||||
foreach ($this->options as $key => $option) {
|
||||
if (\is_string($key)) {
|
||||
$key = (int) \preg_replace('/[^0-9.]/', '', $key);
|
||||
}
|
||||
|
||||
$query = new Builder($this->connection);
|
||||
$sql = $query->update($this->connection->prefix . static::$table)
|
||||
->set([static::$columns[1] => $option])
|
||||
|
|
@ -148,6 +149,8 @@ abstract class SettingsAbstract implements OptionsInterface
|
|||
$sth = $this->connection->con->prepare($sql);
|
||||
$sth->execute();
|
||||
}
|
||||
|
||||
$this->connection->con->commit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ final class MonotoneChain
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private static function \sort(array $a, array $b) : float
|
||||
private static function sort(array $a, array $b) : float
|
||||
{
|
||||
return $a['x'] === $b['x'] ? $a['y'] - $b['y'] : $a['x'] - $b['x'];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -772,7 +772,7 @@ class Matrix implements \ArrayAccess, \Iterator
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function \rewind()
|
||||
public function rewind()
|
||||
{
|
||||
$this->position = 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -167,11 +167,32 @@ abstract class RequestAbstract implements MessageInterface
|
|||
return $this->data;
|
||||
}
|
||||
|
||||
$key = mb_strtolower($key);
|
||||
$key = \mb_strtolower($key);
|
||||
|
||||
return $this->data[$key] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get data based on wildcard.
|
||||
*
|
||||
* @param string $regex Regex data key
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getLike(string $regex) : array
|
||||
{
|
||||
$data = [];
|
||||
foreach ($this->data as $key => $value) {
|
||||
if (\preg_match('/' . $regex . '/', $key) === 1) {
|
||||
$data[$key] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if has data.
|
||||
*
|
||||
|
|
@ -200,7 +221,7 @@ abstract class RequestAbstract implements MessageInterface
|
|||
public function setData($key, $value, bool $overwrite = true) : bool
|
||||
{
|
||||
if (!$this->lock) {
|
||||
$key = mb_strtolower($key);
|
||||
$key = \mb_strtolower($key);
|
||||
if ($overwrite || !isset($this->data[$key])) {
|
||||
$this->data[$key] = $value;
|
||||
|
||||
|
|
|
|||
|
|
@ -449,7 +449,7 @@ final class Directory extends FileAbstract implements DirectoryInterface
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function \rewind()
|
||||
public function rewind()
|
||||
{
|
||||
\reset($this->nodes);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user