From 04d6d5ca99ebfd1cebb8ce06618fb3811fc1a8aa Mon Sep 17 00:00:00 2001 From: Charles Date: Thu, 9 Jan 2020 10:55:03 +0100 Subject: phpmyadmin working --- .../williamdes/mariadb-mysql-kbs/src/Search.php | 167 +++++++++++++++++++++ 1 file changed, 167 insertions(+) create mode 100644 srcs/phpmyadmin/vendor/williamdes/mariadb-mysql-kbs/src/Search.php (limited to 'srcs/phpmyadmin/vendor/williamdes/mariadb-mysql-kbs/src/Search.php') diff --git a/srcs/phpmyadmin/vendor/williamdes/mariadb-mysql-kbs/src/Search.php b/srcs/phpmyadmin/vendor/williamdes/mariadb-mysql-kbs/src/Search.php new file mode 100644 index 0000000..12f8ded --- /dev/null +++ b/srcs/phpmyadmin/vendor/williamdes/mariadb-mysql-kbs/src/Search.php @@ -0,0 +1,167 @@ +a)) { + foreach ($kbEntrys->a as $kbEntry) { + if ($type === Search::ANY) { + return Search::$data->urls[$kbEntry->u]."#".$kbEntry->a; + } elseif ($type === Search::MYSQL) { + if ($kbEntry->t === Search::MYSQL) { + return Search::$data->urls[$kbEntry->u]."#".$kbEntry->a; + } + } elseif ($type === Search::MARIADB) { + if ($kbEntry->t === Search::MARIADB) { + return Search::$data->urls[$kbEntry->u]."#".$kbEntry->a; + } + } + } + } + + throw new KBException("$name does not exist for this type of documentation !"); + } + + /** + * Get a variable + * + * @param string $name Name of variable + * @return stdClass + * @throws KBException + */ + public static function getVariable(string $name): stdClass + { + self::loadData(); + if (isset(Search::$data->vars->{$name})) { + return Search::$data->vars->{$name}; + } else { + throw new KBException("$name does not exist !"); + } + } + + /** + * get the type of the variable + * + * @param string $name Name of variable + * @return string + * @throws KBException + */ + public static function getVariableType(string $name): string + { + self::loadData(); + $kbEntry = self::getVariable($name); + if (isset($kbEntry->t)) { + return Search::$data->varTypes->{$kbEntry->t}; + } else { + throw new KBException("$name does have a known type !"); + } + } + + /** + * Return the list of static variables + * + * @return array + */ + public static function getStaticVariables(): array + { + return self::getVariablesWithDynamic(false); + } + + /** + * Return the list of dynamic variables + * + * @return array + */ + public static function getDynamicVariables(): array + { + return self::getVariablesWithDynamic(true); + } + + /** + * Return the list of variables having dynamic = $dynamic + * + * @param bool $dynamic dynamic=true/dynamic=false + * @return array + */ + public static function getVariablesWithDynamic(bool $dynamic): array + { + self::loadData(); + $staticVars = array(); + foreach (Search::$data->vars as $name => $var) { + if (isset($var->d)) { + if ($var->d === $dynamic) { + $staticVars[] = $name; + } + } + } + return $staticVars; + } + +} -- cgit