@param array $pks

@return array
513544
private function pks2models($pks): array {
        $pool_keys = array_map(function ($pk) {
            return $this->getPoolKey($pk);
        }, $pks);
        $serialized_models = $this->redis()->mget($pool_keys);
        $length = count($pks);
        $models = [];
        /** @noinspection ForeachInvariantsInspection */
        for ($i = 0; $i < $length; $i++) {
            $pk = $pks[$i];
            $serialized_model = $serialized_models[$i];
            if (false === $serialized_model) {
                $loadedModel = $this->load($pk);
                if ($loadedModel instanceof Model) {
                    $model = clone $loadedModel;
                } else {
                    continue;
                }
            } else {
                /** @noinspection UnserializeExploitsInspection */
                $model = unserialize($serialized_models[$i]);
            }
            $models[] = $model;
        }
        return $models;
    }
38579
public function many(array $keys)
  {
    $results = [];

    foreach ($keys as $key) {
      $results[$key] = $this->get($key);
    }

    return $results;
  }
254130
public function getMongoNextId($pk=''){
        if(empty($pk)) {
            $pk   =  $this->getPk();
        }
        return $this->db->getMongoNextId($pk);
    }
1172288
private static function normalizePrimaryKeys($primary) : array
    {
        $pks = self::getPrimaryKeys();

        if (!is_array($primary) && count($pks) == 1) {
            $primary = [$pks[0] => $primary];
        } elseif (array_diff(array_keys($primary), $pks)) {
            throw new \Exception('Invalid primary key.');
        }

        return $primary;
    }
285635
public function getInstancePoolKeySnippet($pkphp)
    {
        $pkphp = (array) $pkphp; // make it an array if it is not.
        $script = "";
        if (count($pkphp) > 1) {
            $script .= "serialize(array(";
            $i = 0;
            foreach ($pkphp as $pkvar) {
                $script .= ($i++ ? ', ' : '') . "(string) $pkvar";
            }
            $script .= "))";
        } else {
            $script .= "(string) " . $pkphp[0];
        }

        return $script;
    }
424594
public static function extractKeys($array, $keys) {
		$result = [ ];
		foreach ( $keys as $key ) {
			if (isset ( $array [$key] )) {
				$result [$key] = $array [$key];
			}
		}
		return $result;
	}
991449
public static function getListByPackage($pkg)
    {
        $result = [];
        $pkgID = (int) (is_object($pkg) ? $pkg->getPackageID() : $pkg);
        if ($pkgID !== 0) {
            $app = Application::getFacadeApplication();
            $db = $app->make(Connection::class);
            $rs = $db->executeQuery('select btsID from BlockTypeSets where pkgID = ? order by btsID asc', [$pkgID]);
            while (($btsID = $rs->fetchColumn()) !== false) {
                $result[] = static::getByID($btsID);
            }
        }

        return $result;
    }
1064841
public static function findAllByPk($pk, $condition = null, $params = [])
    {
        $class = get_called_class();
        $condition = ModelCondition::getFrom($condition, $class);
        $condition->compareColumn($class::getDb()->getTablePk($class::getTableName()), $pk);
        return self::findAll($condition, $params);
    }
782086
public function many(array $keys)
    {
        $results = [];

        $values = $this->connection()->mget(array_map(function ($key) {
            return $this->prefix.$key;
        }, $keys));

        foreach ($values as $index => $value) {
            $results[$keys[$index]] = ! is_null($value) ? $this->unserialize($value) : null;
        }

        return $results;
    }
1301243
public function mGet(array $keyArray)
    {
        if (empty($keyArray)) return [];

        $keyArray = array_values($keyArray);

        $result     = [];
        $redisServer    = $this->redisServer;
        if (1 == $redisServer->getServerCount()) {
            $dataArray      = $redisServer->getDefaultClient()->getMultiple($keyArray);
            foreach ($dataArray as $k => $v) {
                if (false !== $v) {
                    $result[$keyArray[$k]] = is_numeric($v) ? $v : unserialize($v);
                }
            }
        } else {
            $clientKeyArray = [];
            foreach ($keyArray as $key) {
                $name   = $redisServer->getHashClientName($key);
                // factory key array for redis
                if (isset($clientKeyArray[$name])) {
                    $clientKeyArray[$name][] = $key;
                } else {
                    $clientKeyArray[$name] = [$key];
                }
            }

            foreach ($clientKeyArray as $name => $keyArray) {
                $dataArray = $redisServer->getClient($name)->mget($keyArray);
                foreach ($dataArray as $k => $v) {
                    if (false !== $v) {
                        $result[$keyArray[$k]] = is_numeric($v) ? $v : unserialize($v);
                    }
                }
            }
        }

        return $result;
    }
890986
public function findByPK($pk)
    {
        $this->createQuery();
        $q = $this->getQuery();

        $q .= ' WHERE ' . $this->table() . '.' . $this->getPK()->identifier() . ' = ?';
        $this->setQuery($q);
        $this->setParams($pk);

        GapOrm::getDriver()->query($this->getQuery(), [$pk]);
        $obj = GapOrm::getDriver()->selectOnce();

        if (is_null($obj)) {
            return null;
        }

        $obj = $this->convertFromDB($obj);

        if ($obj) {
            return $obj;
        }

        return null;
    }
554492
public static function getPK()
    {
        $cls = get_called_class();
        return array_key_exists($cls, self::$_pk) ? self::$_pk[$cls] : "id";
    }
1320506
public function getKeys() : array
        {
	        $keys = $this->_redis->hkeys($this->_key);
	        return !empty($keys)?$keys:[];
        }
1077194
public function only(array $keys): array
    {
        $return = [];
        foreach ($keys as $key) {
            $value = $this->get($key);
            if (!is_null($value)) {
                $return[$key] = $value;
            }
        }
        return $return;
    }
1271067
private function loadPKCS8(array $children)
    {
        $binary = hex2bin($children[2]->getContent());
        $asnObject = ASNObject::fromBinary($binary);
        Assertion::isInstanceOf($asnObject, Sequence::class);

        return $asnObject->getChildren();
    }
1304504
public function findByKeys(array $keys)
    {
        $result = [];
        /** @var Cursor $list */
        $list = $this->collection->find(['_id' => ['$in' => $keys]]);

        foreach ($list as $document) {
            $result[] = $this->hydrateEntity($document);
        }

        return $result;
    }
984685
public static function getItems($array, $keys = null)
    {
        if (is_null($keys)) {
            return $array;
        } elseif (is_scalar($keys)) {
            $keys = [$keys => $array[$keys]];
        }
        $res = [];
        foreach ($keys as $k) {
            if (array_key_exists($k, $array)) {
                $res[$k] = $array[$k];
            }
        }
        return $res;
    }