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/test/RefProvider.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/test/RefProvider.php')
| -rw-r--r-- | srcs/phpmyadmin/vendor/williamdes/mariadb-mysql-kbs/test/RefProvider.php | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/srcs/phpmyadmin/vendor/williamdes/mariadb-mysql-kbs/test/RefProvider.php b/srcs/phpmyadmin/vendor/williamdes/mariadb-mysql-kbs/test/RefProvider.php new file mode 100644 index 0000000..50b25cc --- /dev/null +++ b/srcs/phpmyadmin/vendor/williamdes/mariadb-mysql-kbs/test/RefProvider.php @@ -0,0 +1,50 @@ +<?php +declare(strict_types = 1); +namespace Williamdes\MariaDBMySQLKBS\Test; + +use \Swaggest\JsonSchema\RemoteRefProvider; + +class RefProvider implements RemoteRefProvider +{ + + /** + * Preloaded urn schemas + * + * @var \stdClass[] + */ + private $urnSchemas = []; + + /** + * Create a new RefProvider instance + */ + public function __construct() + { + $files = glob(__DIR__ . "/../schemas/*.json"); + if ($files === false) { + return; + } else { + foreach ($files as $filename) { + $schema = json_decode((string) file_get_contents($filename)); + if (isset($schema) && isset($schema->{'$id'}) && $schema !== null) { + $this->urnSchemas[$schema->{'$id'}] = $schema; + } + } + } + } + + /** + * @param string $url The file url + * @return \stdClass|false json_decode of $url resource content + */ + public function getSchemaData($url) + { + if (isset($this->urnSchemas[$url])) {// Handle urn: urls + return $this->urnSchemas[$url]; + } elseif (is_file($url)) {// Handle file + return json_decode((string) file_get_contents($url)); + } else {// Handle URL + return json_decode((string) file_get_contents(rawurldecode($url))); + } + } + +} |
