/usr/share/php/Williamdes/MariaDBMySQLKBS
Edit: /usr/share/php/Williamdes/MariaDBMySQLKBS/Search.php (4557B)
a)) {
foreach ($kbEntries->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;
}
}