1
0
Fork 0
mirror of synced 2024-09-28 07:21:35 +12:00

Merge pull request #1997 from srijit2002/master

fix: Fix PSR issue in database library
This commit is contained in:
Christy Jacob 2021-10-19 10:36:15 +05:30 committed by GitHub
commit 88cfcb9ea8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 22 additions and 23 deletions

View file

@ -569,7 +569,7 @@ class MySQL extends Adapter
//$path = implode('.', $path);
if(array_key_exists($key, $filterTypes) && $filterTypes[$key] === 'numeric') {
if (array_key_exists($key, $filterTypes) && $filterTypes[$key] === 'numeric') {
$value = (float) $value;
} else {
$value = $this->getPDO()->quote($value, PDO::PARAM_STR);
@ -607,7 +607,7 @@ class MySQL extends Adapter
}
// Sorting
if(!empty($options['orderField'])) {
if (!empty($options['orderField'])) {
$orderPath = \explode('.', $options['orderField']);
$len = \count($orderPath);
$orderKey = 'order_b';
@ -634,9 +634,8 @@ class MySQL extends Adapter
$prev = 'd';
}
}
}
}
else {
}
} else {
$orderSelect = 'a.uid AS sort_ff';
}
@ -984,4 +983,4 @@ class MySQL extends Adapter
{
return $this->redis;
}
}
}

View file

@ -297,4 +297,4 @@ class Redis extends Adapter
return parent::setNamespace($namespace);
}
}
}

View file

@ -59,12 +59,12 @@ class Database
/**
* @var array
*/
static protected $filters = [];
protected static $filters = [];
/**
* @var bool
*/
static protected $statusFilters = true;
protected static $statusFilters = true;
/**
* @var array
@ -462,7 +462,7 @@ class Database
*
* @return void
*/
static public function addFilter(string $name, callable $encode, callable $decode): void
public static function addFilter(string $name, callable $encode, callable $decode): void
{
self::$filters[$name] = [
'encode' => $encode,
@ -496,7 +496,7 @@ class Database
return $document;
}
$collection = $this->getDocument($document->getCollection(), true , false);
$collection = $this->getDocument($document->getCollection(), true, false);
$rules = $collection->getAttribute('rules', []);
foreach ($rules as $key => $rule) {
@ -508,7 +508,7 @@ class Database
if (($value !== null)) {
if ($type === self::SYSTEM_VAR_TYPE_DOCUMENT) {
if($array) {
if ($array) {
$list = [];
foreach ($value as $child) {
$list[] = $this->encode($child);
@ -536,7 +536,7 @@ class Database
return $document;
}
$collection = $this->getDocument($document->getCollection(), true , false);
$collection = $this->getDocument($document->getCollection(), true, false);
$rules = $collection->getAttribute('rules', []);
foreach ($rules as $key => $rule) {
@ -548,7 +548,7 @@ class Database
if (($value !== null)) {
if ($type === self::SYSTEM_VAR_TYPE_DOCUMENT) {
if($array) {
if ($array) {
$list = [];
foreach ($value as $child) {
$list[] = $this->decode($child);
@ -572,11 +572,11 @@ class Database
/**
* Encode Attribute
*
*
* @param string $name
* @param mixed $value
*/
static protected function encodeAttribute(string $name, $value)
protected static function encodeAttribute(string $name, $value)
{
if (!isset(self::$filters[$name])) {
return $value;
@ -594,11 +594,11 @@ class Database
/**
* Decode Attribute
*
*
* @param string $name
* @param mixed $value
*/
static protected function decodeAttribute(string $name, $value)
protected static function decodeAttribute(string $name, $value)
{
if (!isset(self::$filters[$name])) {
return $value;

View file

@ -10,7 +10,7 @@ class Authorization extends Validator
/**
* @var array
*/
static $roles = ['*' => true];
public static $roles = ['*' => true];
/**
* @var Document
@ -125,7 +125,7 @@ class Authorization extends Validator
/**
* @param string $role
*
*
* @return bool
*/
public static function isRole(string $role): bool

View file

@ -34,7 +34,7 @@ class Collection extends Structure
* Is valid.
*
* Returns true if valid or false if not.
*
*
* @param mixed $document
*
* @return bool

View file

@ -277,9 +277,9 @@ class Structure extends Validator
/**
* Get Collection
*
*
* Get Collection by unique ID
*
*
* @return Document
*/
protected function getCollection($id): Document