mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-01-11 17:58: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)
|
public function get($columns)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
if (!is_array($columns)) {
|
if (!\is_array($columns)) {
|
||||||
$columns = [$columns];
|
$columns = [$columns];
|
||||||
}
|
}
|
||||||
|
|
||||||
$options = [];
|
$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()) {
|
$sth = $this->connection->con->prepare($sql);
|
||||||
case DatabaseType::MYSQL:
|
$sth->execute();
|
||||||
$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);
|
$options = $sth->fetchAll(\PDO::FETCH_KEY_PAIR);
|
||||||
$sth->execute();
|
|
||||||
|
|
||||||
$options = $sth->fetchAll(\PDO::FETCH_KEY_PAIR);
|
if ($options === false) {
|
||||||
|
return [];
|
||||||
if ($options === false) {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->setOptions($options);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->setOptions($options);
|
||||||
|
|
||||||
return \count($options) > 1 ? $options : \reset($options);
|
return \count($options) > 1 ? $options : \reset($options);
|
||||||
} catch (\PDOException $e) {
|
} catch (\PDOException $e) {
|
||||||
$exception = DatabaseExceptionFactory::createException($e);
|
$exception = DatabaseExceptionFactory::createException($e);
|
||||||
|
|
@ -138,7 +133,13 @@ abstract class SettingsAbstract implements OptionsInterface
|
||||||
$this->setOptions($options);
|
$this->setOptions($options);
|
||||||
|
|
||||||
if ($store) {
|
if ($store) {
|
||||||
|
$this->connection->con->beginTransaction();
|
||||||
|
|
||||||
foreach ($this->options as $key => $option) {
|
foreach ($this->options as $key => $option) {
|
||||||
|
if (\is_string($key)) {
|
||||||
|
$key = (int) \preg_replace('/[^0-9.]/', '', $key);
|
||||||
|
}
|
||||||
|
|
||||||
$query = new Builder($this->connection);
|
$query = new Builder($this->connection);
|
||||||
$sql = $query->update($this->connection->prefix . static::$table)
|
$sql = $query->update($this->connection->prefix . static::$table)
|
||||||
->set([static::$columns[1] => $option])
|
->set([static::$columns[1] => $option])
|
||||||
|
|
@ -148,6 +149,8 @@ abstract class SettingsAbstract implements OptionsInterface
|
||||||
$sth = $this->connection->con->prepare($sql);
|
$sth = $this->connection->con->prepare($sql);
|
||||||
$sth->execute();
|
$sth->execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->connection->con->commit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -104,7 +104,7 @@ final class MonotoneChain
|
||||||
*
|
*
|
||||||
* @since 1.0.0
|
* @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'];
|
return $a['x'] === $b['x'] ? $a['y'] - $b['y'] : $a['x'] - $b['x'];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -772,7 +772,7 @@ class Matrix implements \ArrayAccess, \Iterator
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
public function \rewind()
|
public function rewind()
|
||||||
{
|
{
|
||||||
$this->position = 0;
|
$this->position = 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -167,11 +167,32 @@ abstract class RequestAbstract implements MessageInterface
|
||||||
return $this->data;
|
return $this->data;
|
||||||
}
|
}
|
||||||
|
|
||||||
$key = mb_strtolower($key);
|
$key = \mb_strtolower($key);
|
||||||
|
|
||||||
return $this->data[$key] ?? null;
|
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.
|
* Check if has data.
|
||||||
*
|
*
|
||||||
|
|
@ -200,7 +221,7 @@ abstract class RequestAbstract implements MessageInterface
|
||||||
public function setData($key, $value, bool $overwrite = true) : bool
|
public function setData($key, $value, bool $overwrite = true) : bool
|
||||||
{
|
{
|
||||||
if (!$this->lock) {
|
if (!$this->lock) {
|
||||||
$key = mb_strtolower($key);
|
$key = \mb_strtolower($key);
|
||||||
if ($overwrite || !isset($this->data[$key])) {
|
if ($overwrite || !isset($this->data[$key])) {
|
||||||
$this->data[$key] = $value;
|
$this->data[$key] = $value;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -449,7 +449,7 @@ final class Directory extends FileAbstract implements DirectoryInterface
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
public function \rewind()
|
public function rewind()
|
||||||
{
|
{
|
||||||
\reset($this->nodes);
|
\reset($this->nodes);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user