Fix invalid global namespace

This commit is contained in:
Dennis Eichhorn 2018-08-24 21:09:40 +02:00
parent e28353a86b
commit 11c78afbbe
5 changed files with 47 additions and 23 deletions

View File

@ -87,14 +87,11 @@ abstract class SettingsAbstract implements OptionsInterface
public function get($columns)
{
try {
if (!is_array($columns)) {
if (!\is_array($columns)) {
$columns = [$columns];
}
$options = [];
switch ($this->connection->getType()) {
case DatabaseType::MYSQL:
$query = new Builder($this->connection);
$sql = $query->select(...static::$columns)
->from($this->connection->prefix . static::$table)
@ -111,8 +108,6 @@ abstract class SettingsAbstract implements OptionsInterface
}
$this->setOptions($options);
break;
}
return \count($options) > 1 ? $options : \reset($options);
} catch (\PDOException $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();
}
}
}

View File

@ -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'];
}

View File

@ -772,7 +772,7 @@ class Matrix implements \ArrayAccess, \Iterator
/**
* {@inheritdoc}
*/
public function \rewind()
public function rewind()
{
$this->position = 0;
}

View File

@ -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;

View File

@ -449,7 +449,7 @@ final class Directory extends FileAbstract implements DirectoryInterface
/**
* {@inheritdoc}
*/
public function \rewind()
public function rewind()
{
\reset($this->nodes);
}