diff options
| author | Charles <sircharlesaze@gmail.com> | 2020-01-09 10:55:03 +0100 |
|---|---|---|
| committer | Charles <sircharlesaze@gmail.com> | 2020-01-09 13:09:38 +0100 |
| commit | 04d6d5ca99ebfd1cebb8ce06618fb3811fc1a8aa (patch) | |
| tree | 5c691241355c943a3c68ddb06b8cf8c60aa11319 /srcs/phpmyadmin/vendor/williamdes/mariadb-mysql-kbs/src/KBEntry.php | |
| parent | 7e0d85db834d6351ed85d01e5126ac31dc510b86 (diff) | |
| download | ft_server-04d6d5ca99ebfd1cebb8ce06618fb3811fc1a8aa.tar.gz ft_server-04d6d5ca99ebfd1cebb8ce06618fb3811fc1a8aa.tar.bz2 ft_server-04d6d5ca99ebfd1cebb8ce06618fb3811fc1a8aa.zip | |
phpmyadmin working
Diffstat (limited to 'srcs/phpmyadmin/vendor/williamdes/mariadb-mysql-kbs/src/KBEntry.php')
| -rw-r--r-- | srcs/phpmyadmin/vendor/williamdes/mariadb-mysql-kbs/src/KBEntry.php | 151 |
1 files changed, 151 insertions, 0 deletions
diff --git a/srcs/phpmyadmin/vendor/williamdes/mariadb-mysql-kbs/src/KBEntry.php b/srcs/phpmyadmin/vendor/williamdes/mariadb-mysql-kbs/src/KBEntry.php new file mode 100644 index 0000000..7ff7e9c --- /dev/null +++ b/srcs/phpmyadmin/vendor/williamdes/mariadb-mysql-kbs/src/KBEntry.php @@ -0,0 +1,151 @@ +<?php +declare(strict_types = 1); +namespace Williamdes\MariaDBMySQLKBS; + +use \stdClass; +use \JsonSerializable; + +class KBEntry extends stdClass implements JsonSerializable +{ + + /** + * The name of the variable + * + * @var string + */ + private $name; + + /** + * Type of variable + * + * @var string + */ + private $type = null; + + /** + * Is dynamic ? + * + * @var bool + */ + private $dynamic = null; + + /** + * Documentations + * + * @var KBDocumentation[] + */ + private $docs = null; + + /** + * Create a KBEntry object + * + * @param string $name The name of the variable + * @param string|null $type Type of variable + * @param bool|null $dynamic Is dynamic ? + */ + public function __construct(string $name, ?string $type, ?bool $dynamic) + { + $this->name = $name; + if ($type !== null) { + $this->type = $type; + } + if ($dynamic !== null) { + $this->dynamic = $dynamic; + } + } + + /** + * Get the variable name + * + * @return string + */ + public function getName(): string + { + return $this->name; + } + + /** + * Is the variable dynamic + * + * @return bool|null + */ + public function isDynamic(): ?bool + { + return $this->dynamic; + } + + /** + * Get the variable type + * + * @return string|null + */ + public function getType(): ?string + { + return $this->type; + } + + /** + * Variable has documentations + * + * @return bool + */ + public function hasDocumentations(): bool + { + if ($this->docs === null) { + return false; + } else { + return count($this->docs) > 0; + } + } + + /** + * Get all documentations + * + * @return KBDocumentation[] + */ + public function getDocumentations(): array + { + return $this->docs; + } + + /** + * Add documentation link + * + * @param string $url The URL + * @param string|null $anchor The anchor + * @return KBDocumentation + */ + public function addDocumentation(string $url, ?string $anchor = null ): KBDocumentation + { + $this->url = $url; + if ($this->docs === null) { + $this->docs = array(); + } + $kbd = new KBDocumentation($url, $anchor); + $this->docs[] = $kbd; + return $kbd; + } + + /** + * Used for json_encode function + * This can seem useless, do not remove it. + * + * @return array + */ + public function jsonSerialize(): array + { + $outObj = array(); + $outObj['name'] = $this->name; + if ($this->type !== null) { + $outObj['type'] = $this->type; + } + if ($this->dynamic !== null) { + $outObj['dynamic'] = $this->dynamic; + } + if ($this->docs !== null) { + $outObj['docs'] = $this->docs; + } + return $outObj; + } + +} |
