diff --git a/.htaccess b/.htaccess index d1d49bb33..6aefce681 100644 --- a/.htaccess +++ b/.htaccess @@ -1,17 +1,14 @@ -RewriteEngine On -RewriteCond %{REQUEST_FILENAME} !-f -RewriteCond %{REQUEST_FILENAME} !-d -RewriteRule ^(.*)$ index.php/$0 [L] +RewriteEngine on # TODO: specific for main instance of OpenML site. Should do something better -#RewriteCond %{HTTP_HOST} ^api_new.openml.org -#RewriteRule ^(.*)$ http://www.openml.org/api_new/$1 [L,P] +RewriteCond %{HTTP_HOST} ^api_new.openml.org +RewriteRule ^(.*)$ http://www.openml.org/api_new/$1 [L,P] -#RewriteCond %{HTTPS_HOST} ^api_new.openml.org -#RewriteRule ^(.*)$ https://www.openml.org/api_new/$1 [L,P] +RewriteCond %{HTTPS_HOST} ^api_new.openml.org +RewriteRule ^(.*)$ https://www.openml.org/api_new/$1 [L,P] -#RewriteCond $1 !^(questions|SWF|img|docs|downloads|GFX|favicon\.ico|tiny_mce|index\.php|js|css|robots\.txt) -#RewriteRule ^(.*)$ index.php/$1 [L] +RewriteCond $1 !^(questions|SWF|img|docs|downloads|GFX|favicon\.ico|tiny_mce|index\.php|js|css|robots\.txt) +RewriteRule ^(.*)$ index.php/$1 [L] RedirectMatch 301 ^/?$ http://api.openml.org/home diff --git a/index.php b/index.php index e1ce3f65f..f75c7a81a 100755 --- a/index.php +++ b/index.php @@ -53,7 +53,7 @@ * * NOTE: If you change these, also change the error_reporting() code below */ - define('ENVIRONMENT', 'development'); + define('ENVIRONMENT', 'production'); /* *--------------------------------------------------------------- diff --git a/openml_OS/composer.json b/openml_OS/composer.json index 1c09a9b76..3d08a919e 100644 --- a/openml_OS/composer.json +++ b/openml_OS/composer.json @@ -12,12 +12,12 @@ }, "require": { "php": ">=5.2.4", - "elasticsearch/elasticsearch": "~6.7" + "elasticsearch/elasticsearch": "~6.0" }, "suggest": { "paragonie/random_compat": "Provides better randomness in PHP 5.x" }, "require-dev": { - "mikey179/vfsstream": "1.1.*" + "mikey179/vfsStream": "1.1.*" } } diff --git a/openml_OS/composer.lock b/openml_OS/composer.lock index 22d9c414b..8d5f8f9ee 100644 --- a/openml_OS/composer.lock +++ b/openml_OS/composer.lock @@ -1,40 +1,40 @@ { "_readme": [ "This file locks the dependencies of your project to a known state", - "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "ccf350840f6caf4785ff785afa461173", + "content-hash": "11e4e4538ebc21675994064c7ac86a35", "packages": [ { "name": "elasticsearch/elasticsearch", - "version": "v6.8.2", + "version": "v6.0.1", "source": { "type": "git", "url": "https://github.com/elastic/elasticsearch-php.git", - "reference": "619c78266999c6e431df9ca0f844e8f656ac145b" + "reference": "b8e3bc9d1fc54d6a18692df0b74956efe7fe241a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/elastic/elasticsearch-php/zipball/619c78266999c6e431df9ca0f844e8f656ac145b", - "reference": "619c78266999c6e431df9ca0f844e8f656ac145b", + "url": "https://api.github.com/repos/elastic/elasticsearch-php/zipball/b8e3bc9d1fc54d6a18692df0b74956efe7fe241a", + "reference": "b8e3bc9d1fc54d6a18692df0b74956efe7fe241a", "shasum": "" }, "require": { "ext-json": ">=1.3.7", - "ezimuel/ringphp": "^1.1.2", - "php": "^7.3 || ^8.0", + "guzzlehttp/ringphp": "~1.0", + "php": "^7.0", "psr/log": "~1.0" }, "require-dev": { - "doctrine/inflector": "^1.3", - "mockery/mockery": "^1.2", - "phpstan/phpstan": "^0.12", - "phpunit/phpunit": "^9.3", - "squizlabs/php_codesniffer": "^3.4", - "symfony/finder": "~4.0", - "symfony/yaml": "~4.0", - "symplify/git-wrapper": ">=9.0 <9.3.27" + "cpliakas/git-wrapper": "~1.0", + "doctrine/inflector": "^1.1", + "mockery/mockery": "0.9.4", + "phpstan/phpstan-shim": "0.8.3", + "phpunit/phpunit": "6.3.0", + "squizlabs/php_codesniffer": "3.0.2", + "symfony/finder": "^2.8", + "symfony/yaml": "^2.8" }, "suggest": { "ext-curl": "*", @@ -42,9 +42,6 @@ }, "type": "library", "autoload": { - "files": [ - "src/autoload.php" - ], "psr-4": { "Elasticsearch\\": "src/Elasticsearch/" } @@ -56,9 +53,6 @@ "authors": [ { "name": "Zachary Tong" - }, - { - "name": "Enrico Zimuel" } ], "description": "PHP Client for Elasticsearch", @@ -67,41 +61,43 @@ "elasticsearch", "search" ], - "support": { - "issues": "https://github.com/elastic/elasticsearch-php/issues", - "source": "https://github.com/elastic/elasticsearch-php/tree/v6.8.2" - }, - "time": "2021-07-14T14:41:55+00:00" + "time": "2017-12-05T14:15:58+00:00" }, { - "name": "ezimuel/guzzlestreams", - "version": "3.0.1", + "name": "guzzlehttp/ringphp", + "version": "1.1.1", "source": { "type": "git", - "url": "https://github.com/ezimuel/guzzlestreams.git", - "reference": "abe3791d231167f14eb80d413420d1eab91163a8" + "url": "https://github.com/guzzle/RingPHP.git", + "reference": "5e2a174052995663dd68e6b5ad838afd47dd615b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/ezimuel/guzzlestreams/zipball/abe3791d231167f14eb80d413420d1eab91163a8", - "reference": "abe3791d231167f14eb80d413420d1eab91163a8", + "url": "https://api.github.com/repos/guzzle/RingPHP/zipball/5e2a174052995663dd68e6b5ad838afd47dd615b", + "reference": "5e2a174052995663dd68e6b5ad838afd47dd615b", "shasum": "" }, "require": { - "php": ">=5.4.0" + "guzzlehttp/streams": "~3.0", + "php": ">=5.4.0", + "react/promise": "~2.0" }, "require-dev": { + "ext-curl": "*", "phpunit/phpunit": "~4.0" }, + "suggest": { + "ext-curl": "Guzzle will use specific adapters if cURL is present" + }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-master": "1.1-dev" } }, "autoload": { "psr-4": { - "GuzzleHttp\\Stream\\": "src/" + "GuzzleHttp\\Ring\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -115,55 +111,38 @@ "homepage": "https://github.com/mtdowling" } ], - "description": "Fork of guzzle/streams (abandoned) to be used with elasticsearch-php", - "homepage": "http://guzzlephp.org/", - "keywords": [ - "Guzzle", - "stream" - ], - "support": { - "source": "https://github.com/ezimuel/guzzlestreams/tree/3.0.1" - }, - "time": "2020-02-14T23:11:50+00:00" + "description": "Provides a simple API and specification that abstracts away the details of HTTP into a single PHP function.", + "time": "2018-07-31T13:22:33+00:00" }, { - "name": "ezimuel/ringphp", - "version": "1.2.0", + "name": "guzzlehttp/streams", + "version": "3.0.0", "source": { "type": "git", - "url": "https://github.com/ezimuel/ringphp.git", - "reference": "92b8161404ab1ad84059ebed41d9f757e897ce74" + "url": "https://github.com/guzzle/streams.git", + "reference": "47aaa48e27dae43d39fc1cea0ccf0d84ac1a2ba5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/ezimuel/ringphp/zipball/92b8161404ab1ad84059ebed41d9f757e897ce74", - "reference": "92b8161404ab1ad84059ebed41d9f757e897ce74", + "url": "https://api.github.com/repos/guzzle/streams/zipball/47aaa48e27dae43d39fc1cea0ccf0d84ac1a2ba5", + "reference": "47aaa48e27dae43d39fc1cea0ccf0d84ac1a2ba5", "shasum": "" }, "require": { - "ezimuel/guzzlestreams": "^3.0.1", - "php": ">=5.4.0", - "react/promise": "~2.0" - }, - "replace": { - "guzzlehttp/ringphp": "self.version" + "php": ">=5.4.0" }, "require-dev": { - "ext-curl": "*", - "phpunit/phpunit": "~9.0" - }, - "suggest": { - "ext-curl": "Guzzle will use specific adapters if cURL is present" + "phpunit/phpunit": "~4.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1-dev" + "dev-master": "3.0-dev" } }, "autoload": { "psr-4": { - "GuzzleHttp\\Ring\\": "src/" + "GuzzleHttp\\Stream\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -177,24 +156,26 @@ "homepage": "https://github.com/mtdowling" } ], - "description": "Fork of guzzle/RingPHP (abandoned) to be used with elasticsearch-php", - "support": { - "source": "https://github.com/ezimuel/ringphp/tree/1.2.0" - }, - "time": "2021-11-16T11:51:30+00:00" + "description": "Provides a simple abstraction over streams of data", + "homepage": "http://guzzlephp.org/", + "keywords": [ + "Guzzle", + "stream" + ], + "time": "2014-10-12T19:18:40+00:00" }, { "name": "psr/log", - "version": "1.1.4", + "version": "1.0.2", "source": { "type": "git", "url": "https://github.com/php-fig/log.git", - "reference": "d49695b909c3b7628b6289db5479a1c204601f11" + "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11", - "reference": "d49695b909c3b7628b6289db5479a1c204601f11", + "url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", + "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", "shasum": "" }, "require": { @@ -203,7 +184,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1.x-dev" + "dev-master": "1.0.x-dev" } }, "autoload": { @@ -218,7 +199,7 @@ "authors": [ { "name": "PHP-FIG", - "homepage": "https://www.php-fig.org/" + "homepage": "http://www.php-fig.org/" } ], "description": "Common interface for logging libraries", @@ -228,39 +209,36 @@ "psr", "psr-3" ], - "support": { - "source": "https://github.com/php-fig/log/tree/1.1.4" - }, - "time": "2021-05-03T11:20:27+00:00" + "time": "2016-10-10T12:19:37+00:00" }, { "name": "react/promise", - "version": "v2.9.0", + "version": "v2.7.0", "source": { "type": "git", "url": "https://github.com/reactphp/promise.git", - "reference": "234f8fd1023c9158e2314fa9d7d0e6a83db42910" + "reference": "f4edc2581617431aea50430749db55cc3fc031b3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/reactphp/promise/zipball/234f8fd1023c9158e2314fa9d7d0e6a83db42910", - "reference": "234f8fd1023c9158e2314fa9d7d0e6a83db42910", + "url": "https://api.github.com/repos/reactphp/promise/zipball/f4edc2581617431aea50430749db55cc3fc031b3", + "reference": "f4edc2581617431aea50430749db55cc3fc031b3", "shasum": "" }, "require": { "php": ">=5.4.0" }, "require-dev": { - "phpunit/phpunit": "^9.3 || ^5.7 || ^4.8.36" + "phpunit/phpunit": "~4.8" }, "type": "library", "autoload": { - "files": [ - "src/functions_include.php" - ], "psr-4": { "React\\Promise\\": "src/" - } + }, + "files": [ + "src/functions_include.php" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -269,23 +247,7 @@ "authors": [ { "name": "Jan Sorgalla", - "email": "jsorgalla@gmail.com", - "homepage": "https://sorgalla.com/" - }, - { - "name": "Christian Lück", - "email": "christian@clue.engineering", - "homepage": "https://clue.engineering/" - }, - { - "name": "Cees-Jan Kiewiet", - "email": "reactphp@ceesjankiewiet.nl", - "homepage": "https://wyrihaximus.net/" - }, - { - "name": "Chris Boden", - "email": "cboden@gmail.com", - "homepage": "https://cboden.dev/" + "email": "jsorgalla@gmail.com" } ], "description": "A lightweight implementation of CommonJS Promises/A for PHP", @@ -293,35 +255,21 @@ "promise", "promises" ], - "support": { - "issues": "https://github.com/reactphp/promise/issues", - "source": "https://github.com/reactphp/promise/tree/v2.9.0" - }, - "funding": [ - { - "url": "https://github.com/WyriHaximus", - "type": "github" - }, - { - "url": "https://github.com/clue", - "type": "github" - } - ], - "time": "2022-02-11T10:27:51+00:00" + "time": "2018-06-13T15:59:06+00:00" } ], "packages-dev": [ { - "name": "mikey179/vfsstream", + "name": "mikey179/vfsStream", "version": "v1.1.0", "source": { "type": "git", - "url": "https://github.com/bovigo/vfsStream.git", + "url": "https://github.com/mikey179/vfsStream.git", "reference": "fc0fe8f4d0b527254a2dc45f0c265567c881d07e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/bovigo/vfsStream/zipball/fc0fe8f4d0b527254a2dc45f0c265567c881d07e", + "url": "https://api.github.com/repos/mikey179/vfsStream/zipball/fc0fe8f4d0b527254a2dc45f0c265567c881d07e", "reference": "fc0fe8f4d0b527254a2dc45f0c265567c881d07e", "shasum": "" }, @@ -339,10 +287,6 @@ "BSD" ], "homepage": "http://vfs.bovigo.org/", - "support": { - "issues": "https://github.com/bovigo/vfsStream/issues", - "source": "https://github.com/bovigo/vfsStream/tree/v1.1.0" - }, "time": "2012-08-25T12:49:29+00:00" } ], @@ -354,6 +298,5 @@ "platform": { "php": ">=5.2.4" }, - "platform-dev": [], - "plugin-api-version": "2.3.0" + "platform-dev": [] } diff --git a/openml_OS/libraries/ElasticSearch.php b/openml_OS/libraries/ElasticSearch.php index 880c236f6..a0f5854a5 100644 --- a/openml_OS/libraries/ElasticSearch.php +++ b/openml_OS/libraries/ElasticSearch.php @@ -1919,9 +1919,9 @@ public function index_data($id, $start_id = 0, $altmetrics=True, $verbosity=0) { private function build_data($d, $altmetrics=True) { $description_record = $this->CI->Dataset_description->getWhereSingle('did =' . $d->did, 'version DESC'); - if(!$description_record){ - return 'Could not find description of dataset ' . $d->did; - } + if(!$description_record){ + return 'Could not find description of dataset ' . $d->did; + } $headless_description = trim(preg_replace('/\s+/', ' ', preg_replace('/^\*{2,}.*/m', '', $description_record->description))); $new_data = array( 'data_id' => $d->did, diff --git a/openml_OS/models/api/v1/Api_data.php b/openml_OS/models/api/v1/Api_data.php index cf98866bc..4f4f2b052 100644 --- a/openml_OS/models/api/v1/Api_data.php +++ b/openml_OS/models/api/v1/Api_data.php @@ -514,12 +514,6 @@ private function data_fork() { $description_record->version = "1"; $this->Dataset_description->insert($description_record); - // create a copy of the latest description - $description_record = $this->Dataset_description->getWhereSingle('did =' . $data_id, 'version DESC'); - $description_record->did = $new_data_id; - $description_record->version = "1"; - $this->Dataset_description->insert($description_record); - // update elastic search index. try { $this->elasticsearch->index('data', $new_data_id); @@ -1181,7 +1175,7 @@ private function data_upload() { // handle tags $tags = array(); - if (isset($dataset['tag'])) { + if (array_key_exists('tag', $dataset)) { $tags = str_getcsv($dataset['tag']); unset($dataset['tag']); } @@ -1236,7 +1230,7 @@ private function data_upload() { } // create initial wiki page - //$this->wiki->export_to_wiki($id); + $this->wiki->export_to_wiki($id); // create $this->xmlContents('data-upload', $this->version, array('id' => $id)); @@ -1452,7 +1446,7 @@ private function data_features($data_id) { $index_values = array(); if ($dataset->features_values) { foreach($dataset->features_values as $val) { - if (!isset($index_values[$val->index])) { + if (!array_key_exists($val->index, $index_values)) { $index_values[$val->index] = array(); } $index_values[$val->index][] = $val->value; @@ -1633,7 +1627,7 @@ private function data_features_upload() { } //actual insert of the feature - if (isset($feature['nominal_value'])) { + if (array_key_exists('nominal_value', $feature)) { $nominal_values = $feature['nominal_value']; unset($feature['nominal_value']); } else { diff --git a/openml_OS/models/api/v1/Api_flow.php b/openml_OS/models/api/v1/Api_flow.php index e75441fdb..af2f5d416 100644 --- a/openml_OS/models/api/v1/Api_flow.php +++ b/openml_OS/models/api/v1/Api_flow.php @@ -819,17 +819,17 @@ private function insertImplementationFromXML( $xml, $configuration, $implementat $implementation['fullName'] = $implementation['name'] . '(' . $version . ')'; $implementation['version'] = $version; - if( isset( $implementation['source_md5'] ) ) { - if( isset( $implementation['external_version'] ) === false ) { + if( array_key_exists( 'source_md5', $implementation ) ) { + if( array_key_exists( 'external_version', $implementation ) === false ) { $implementation['external_version'] = $implementation['source_md5']; } - } elseif( isset( $implementation['binary_md5'] ) ) { - if( isset( $implementation['external_version'] ) === false ) { + } elseif( array_key_exists( 'binary_md5', $implementation ) ) { + if( array_key_exists( 'external_version', $implementation ) === false ) { $implementation['external_version'] = $implementation['binary_md5']; } } - if( isset( $implementation['implements'] ) ) { + if( array_key_exists( 'implements', $implementation ) ) { if( in_array( $implementation['implements'], $this->supportedMetrics ) == false && in_array( $implementation['implements'], $this->supportedAlgorithms == false ) ) { return false; @@ -842,7 +842,7 @@ private function insertImplementationFromXML( $xml, $configuration, $implementat // tags also not insertable. but handled differently. $tags = array(); - if( isset( $implementation['tag'] ) ) { + if( array_key_exists( 'tag', $implementation ) ) { $tags = str_getcsv( $implementation['tag'] ); unset( $implementation['tag'] ); } diff --git a/openml_OS/models/api/v1/Api_run.php b/openml_OS/models/api/v1/Api_run.php index 755a928d3..d33160a5a 100644 --- a/openml_OS/models/api/v1/Api_run.php +++ b/openml_OS/models/api/v1/Api_run.php @@ -504,12 +504,7 @@ private function run($run_id) { $user = $this->Author->getById($run->uploader); $run->user_name = $user->first_name . ' ' . $user->last_name; $run->flow_name = $this->Implementation->getById($run->setup->implementation_id)->fullName; - $task_evaluations = $this->Task_inputs->getWhere("task_id = " . $run->task_id . " and input = 'evaluation_measures'"); - if( $task_evaluations ) { - $run->task_evaluation = $task_evaluations[0]; - } else { - $run->task_evaluation = ""; - } + $run->task_evaluation = $this->Task_inputs->getWhere("task_id = " . $run->task_id . " and input = 'evaluation_measures'")[0]; $this->xmlContents( 'run-get', $this->version, array( 'source' => $run ) ); } @@ -794,12 +789,12 @@ private function run_upload() { $task_id = $run_xml['task_id']; $implementation_id = $run_xml['flow_id']; - $setup_string = isset($run_xml['setup_string']) ? $run_xml['setup_string'] : null; - $error_message = isset($run_xml['error_message']) ? $run_xml['error_message'] : false; - $run_details = isset($run_xml['run_details']) ? $run_xml['run_details'] : null; - $parameter_objects = isset($run_xml['parameter_setting']) ? $run_xml['parameter_setting'] : array(); - $output_data = isset($run_xml['output_data']) ? $run_xml['output_data'] : array(); - $tags = isset($run_xml['tag']) ? str_getcsv ($run_xml['tag']) : array(); + $setup_string = array_key_exists('setup_string', $run_xml) ? $run_xml['setup_string'] : null; + $error_message = array_key_exists('error_message', $run_xml) ? $run_xml['error_message'] : false; + $run_details = array_key_exists('run_details', $run_xml) ? $run_xml['run_details'] : null; + $parameter_objects = array_key_exists('parameter_setting', $run_xml) ? $run_xml['parameter_setting'] : array(); + $output_data = array_key_exists('output_data', $run_xml) ? $run_xml['output_data'] : array(); + $tags = array_key_exists('tag', $run_xml) ? str_getcsv ($run_xml['tag']) : array(); $predictionsUrl = false; @@ -887,11 +882,11 @@ private function run_upload() { } $task = $this->Task_inputs->getTaskValuesAssoc($task_id); - if (!isset($task['source_data'])) { + if (!array_key_exists('source_data', $task)) { $this->returnError(219, $this->version); return; } - if (!isset($task['estimation_procedure'])) { + if (!array_key_exists('estimation_procedure', $task)) { $this->returnError(220, $this->version); return; } @@ -916,7 +911,7 @@ private function run_upload() { $supported_evaluation_measures = $this->Math_function->getColumnWhere('name', '`functionType` = "EvaluationFunction"'); // the user can specify his own metrics. here we check whether these exists in the database. - if($output_data != false && isset($output_data['evaluation'])) { + if($output_data != false && array_key_exists('evaluation', $output_data)) { // php does not have a set data structure, use hashmap instead $used_evaluation_measures = array(); $illegal_measures = array(); @@ -926,9 +921,9 @@ private function run_upload() { $used_evaluation_measures[$eval['name']] = true; // check whether it was a legal measure w.r.t. the estimation procedure // first add null values, in case a propoerty doesn't exist - $repeat_nr = isset($eval['repeat']) ? $eval['repeat'] : null; - $fold_nr = isset($eval['fold']) ? $eval['fold'] : null; - $sample_nr = isset($eval['sample']) ? $eval['sample'] : null; + $repeat_nr = array_key_exists('repeat', $eval) ? $eval['repeat'] : null; + $fold_nr = array_key_exists('fold', $eval) ? $eval['fold'] : null; + $sample_nr = array_key_exists('sample', $eval) ? $eval['sample'] : null; $num_inst = $num_instances_record->value; if (!$this->Estimation_procedure->check_legal($ep_record, $num_inst, $repeat_nr, $fold_nr, $sample_nr)) { $illegal_measures[] = $this->Estimation_procedure->eval_measure_to_string($eval['name'], $repeat_nr, $fold_nr, $sample_nr); @@ -1343,7 +1338,7 @@ private function run_evaluate() { } $task = $this->Task_inputs->getTaskValuesAssoc($runRecord->task_id); - if (!isset($task['source_data'])) { + if (!array_key_exists('source_data', $task)) { // also add error in database $error_code = 429; $data['error'] = $this->load->apiErrors[$error_code]; @@ -1351,7 +1346,7 @@ private function run_evaluate() { $this->returnError($error_code, $this->version); return; } - if (!isset($task['estimation_procedure'])) { + if (!array_key_exists('estimation_procedure', $task)) { // also add error in database $error_code = 430; $data['error'] = $this->load->apiErrors[$error_code]; @@ -1413,9 +1408,9 @@ private function run_evaluate() { $illegal_measures = array(); foreach($xml->children('oml', true)->{'evaluation'} as $e) { $eval = xml2assoc($e, true); - $repeat_nr = isset($eval['repeat']) ? $eval['repeat'] : null; - $fold_nr = isset($eval['fold']) ? $eval['fold'] : null; - $sample_nr = isset($eval['sample']) ? $eval['sample'] : null; + $repeat_nr = array_key_exists('repeat', $eval) ? $eval['repeat'] : null; + $fold_nr = array_key_exists('fold', $eval) ? $eval['fold'] : null; + $sample_nr = array_key_exists('sample', $eval) ? $eval['sample'] : null; $num_inst = $num_instances_record->value; if (!$this->Estimation_procedure->check_legal($ep_record, $num_inst, $repeat_nr, $fold_nr, $sample_nr)) { $illegal_measures[] = $this->Estimation_procedure->eval_measure_to_string($eval['name'], $repeat_nr, $fold_nr, $sample_nr); @@ -1438,7 +1433,7 @@ private function run_evaluate() { $evaluation['evaluation_engine_id'] = $eval_engine_id; // TODO: this responsibility should be shifted to the evaluation engine - if (isset($math_functions[$evaluation['name']])) { + if (array_key_exists($evaluation['name'], $math_functions)) { $evaluation['function_id'] = $math_functions[$evaluation['name']]; } else { // there will be a DB error due to the absence of 'function_id' @@ -1446,10 +1441,10 @@ private function run_evaluate() { // unset function field unset($evaluation['name']); - if(isset($evaluation['fold']) && isset($evaluation['repeat']) && isset($evaluation['sample'])) { + if(array_key_exists('fold', $evaluation) && array_key_exists('repeat', $evaluation) && array_key_exists('sample', $evaluation)) { // evaluation_sample $this->Evaluation_sample->insert($evaluation); - } elseif(isset($evaluation['fold']) && isset($evaluation['repeat'])) { + } elseif(array_key_exists('fold', $evaluation) && array_key_exists('repeat', $evaluation)) { // evaluation_fold $this->Evaluation_fold->insert($evaluation); } else { diff --git a/openml_OS/models/api/v1/Api_setup.php b/openml_OS/models/api/v1/Api_setup.php index 113b229cd..fff2dd4bd 100644 --- a/openml_OS/models/api/v1/Api_setup.php +++ b/openml_OS/models/api/v1/Api_setup.php @@ -463,7 +463,7 @@ private function setup_exists($partial) { $this->xml_fields_run); $implementation_id = $run_xml['flow_id']; - $parameter_objects = isset($run_xml['parameter_setting']) ? $run_xml['parameter_setting'] : array(); + $parameter_objects = array_key_exists('parameter_setting', $run_xml) ? $run_xml['parameter_setting'] : array(); // fetch implementation $implementation = $this->Implementation->getById($implementation_id); diff --git a/openml_OS/models/api/v1/Api_study.php b/openml_OS/models/api/v1/Api_study.php index 63fd9b53e..d4edd56c3 100644 --- a/openml_OS/models/api/v1/Api_study.php +++ b/openml_OS/models/api/v1/Api_study.php @@ -145,7 +145,7 @@ private function study_create() { return; } - if (isset($study['benchmark_suite'])) { + if (array_key_exists('benchmark_suite', $study)) { if ($study['main_entity_type'] != 'run') { $this->returnError(1035, $this->version); return; @@ -163,7 +163,7 @@ private function study_create() { } } - if (isset($study['alias'])) { + if (array_key_exists('alias', $study)) { $res = $this->Study->getWhereSingle('alias = "' . $study['alias'] . '"'); if ($res) { $this->returnError(1038, $this->version); @@ -174,11 +174,11 @@ private function study_create() { $this->db->trans_start(); $schedule_data = array( - 'alias' => isset($study['alias']) ? $study['alias'] : null, + 'alias' => array_key_exists('alias', $study) ? $study['alias'] : null, 'main_entity_type' => $study['main_entity_type'], - 'benchmark_suite' => isset($study['benchmark_suite']) ? $study['benchmark_suite'] : null, + 'benchmark_suite' => array_key_exists('benchmark_suite', $study) ? $study['benchmark_suite'] : null, 'name' => $study['name'], - 'description' => isset($study['description']) ? $study['description'] : null, + 'description' => array_key_exists('description', $study) ? $study['description'] : null, 'visibility' => 'public', 'creation_date' => now(), 'creator' => $this->user_id, @@ -804,11 +804,11 @@ private function _study_get($study, $entity_type) { return; } - $data = isset($res['data']) ? $res['data'] : null; - $tasks = isset($res['tasks']) ? $res['tasks'] : null; - $flows = isset($res['flows']) ? $res['flows'] : null; - $setups = isset($res['setups']) ? $res['setups'] : null; - $runs = isset($res['runs']) ? $res['runs'] : null; + $data = array_key_exists('data', $res) ? $res['data'] : null; + $tasks = array_key_exists('tasks', $res) ? $res['tasks'] : null; + $flows = array_key_exists('flows', $res) ? $res['flows'] : null; + $setups = array_key_exists('setups', $res) ? $res['setups'] : null; + $runs = array_key_exists('runs', $res) ? $res['runs'] : null; $template_values = array( 'study' => $study, @@ -845,8 +845,7 @@ private function _link_entities($study_id, $uploader_id, $link_entities) { $model = ucfirst($study->main_entity_type) . '_study'; $id_name = $study->main_entity_type . '_id'; - if(array_key_exists($study->main_entity_type, $link_entities)){ - foreach ($link_entities[$study->main_entity_type] as $id) { + foreach ($link_entities[$study->main_entity_type] as $id) { $data = array( 'study_id' => $study_id, $id_name => $id, @@ -857,7 +856,6 @@ private function _link_entities($study_id, $uploader_id, $link_entities) { if (!$result) { return false; } - } } return true; } diff --git a/openml_OS/models/api/v1/Api_task.php b/openml_OS/models/api/v1/Api_task.php index 5c52b6aa0..bfe502d0c 100644 --- a/openml_OS/models/api/v1/Api_task.php +++ b/openml_OS/models/api/v1/Api_task.php @@ -523,7 +523,7 @@ private function task($task_id) { $inputs = $this->Task_inputs->getAssociativeArray('input', 'value', 'task_id = ' . $task_id); - if (isset($inputs['custom_testset'])) { + if (array_key_exists('custom_testset', $inputs)) { $this->returnError(153, $this->version); return; } @@ -533,7 +533,7 @@ private function task($task_id) { $name = 'Task ' . $task_id . ' (' . $task_type->name . ')'; - if (isset($inputs['source_data'])) { + if (array_key_exists('source_data', $inputs)) { $dataset = $this->Dataset->getById($inputs['source_data']); $name = 'Task ' . $task_id . ': ' . $dataset->name . ' (' . $task_type->name . ')'; } @@ -737,7 +737,7 @@ public function task_upload() { $name = $input->attributes() . ''; // check if input is no duplicate - if (isset($inputs[$name])) { + if (array_key_exists($name, $inputs)) { $this->returnError(617, $this->version, $this->openmlGeneralErrorCode, 'problematic input: ' . $name); @@ -759,7 +759,7 @@ public function task_upload() { foreach($inputs as $name => $input_value) { // check if input is legal - if (isset($legal_inputs[$name]) == false) { + if (array_key_exists($name, $legal_inputs) == false) { $this->returnError(616, $this->version, $this->openmlGeneralErrorCode, 'problematic input: ' . $name); return; } @@ -772,7 +772,7 @@ public function task_upload() { // is_json lives in text_helper $type_check_mappings = array('numeric' => 'is_numeric', 'json' => 'is_json', 'string' => 'is_string'); - if (!property_exists($constraints, 'data_type') || !isset($type_check_mappings[$constraints->data_type])) { + if (!property_exists($constraints, 'data_type') || !array_key_exists($constraints->data_type, $type_check_mappings)) { $this->returnError(620, $this->version, $this->openmlGeneralErrorCode, 'problematic input: ' . $name); return; } diff --git a/openml_OS/vendor/autoload.php b/openml_OS/vendor/autoload.php index cb3ca373f..abe50a2fb 100755 --- a/openml_OS/vendor/autoload.php +++ b/openml_OS/vendor/autoload.php @@ -2,11 +2,6 @@ // autoload.php @generated by Composer -if (PHP_VERSION_ID < 50600) { - echo 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL; - exit(1); -} - require_once __DIR__ . '/composer/autoload_real.php'; return ComposerAutoloaderInit42a8ed1e61513be5513aa0cb72c34677::getLoader(); diff --git a/openml_OS/vendor/composer/ClassLoader.php b/openml_OS/vendor/composer/ClassLoader.php index afef3fa2a..4626994fd 100644 --- a/openml_OS/vendor/composer/ClassLoader.php +++ b/openml_OS/vendor/composer/ClassLoader.php @@ -37,130 +37,57 @@ * * @author Fabien Potencier * @author Jordi Boggiano - * @see https://www.php-fig.org/psr/psr-0/ - * @see https://www.php-fig.org/psr/psr-4/ + * @see http://www.php-fig.org/psr/psr-0/ + * @see http://www.php-fig.org/psr/psr-4/ */ class ClassLoader { - /** @var ?string */ - private $vendorDir; - // PSR-4 - /** - * @var array[] - * @psalm-var array> - */ private $prefixLengthsPsr4 = array(); - /** - * @var array[] - * @psalm-var array> - */ private $prefixDirsPsr4 = array(); - /** - * @var array[] - * @psalm-var array - */ private $fallbackDirsPsr4 = array(); // PSR-0 - /** - * @var array[] - * @psalm-var array> - */ private $prefixesPsr0 = array(); - /** - * @var array[] - * @psalm-var array - */ private $fallbackDirsPsr0 = array(); - /** @var bool */ private $useIncludePath = false; - - /** - * @var string[] - * @psalm-var array - */ private $classMap = array(); - - /** @var bool */ private $classMapAuthoritative = false; - - /** - * @var bool[] - * @psalm-var array - */ private $missingClasses = array(); - - /** @var ?string */ private $apcuPrefix; - /** - * @var self[] - */ - private static $registeredLoaders = array(); - - /** - * @param ?string $vendorDir - */ - public function __construct($vendorDir = null) - { - $this->vendorDir = $vendorDir; - } - - /** - * @return string[] - */ public function getPrefixes() { if (!empty($this->prefixesPsr0)) { - return call_user_func_array('array_merge', array_values($this->prefixesPsr0)); + return call_user_func_array('array_merge', $this->prefixesPsr0); } return array(); } - /** - * @return array[] - * @psalm-return array> - */ public function getPrefixesPsr4() { return $this->prefixDirsPsr4; } - /** - * @return array[] - * @psalm-return array - */ public function getFallbackDirs() { return $this->fallbackDirsPsr0; } - /** - * @return array[] - * @psalm-return array - */ public function getFallbackDirsPsr4() { return $this->fallbackDirsPsr4; } - /** - * @return string[] Array of classname => path - * @psalm-return array - */ public function getClassMap() { return $this->classMap; } /** - * @param string[] $classMap Class to filename map - * @psalm-param array $classMap - * - * @return void + * @param array $classMap Class to filename map */ public function addClassMap(array $classMap) { @@ -175,11 +102,9 @@ public function addClassMap(array $classMap) * Registers a set of PSR-0 directories for a given prefix, either * appending or prepending to the ones previously set for this prefix. * - * @param string $prefix The prefix - * @param string[]|string $paths The PSR-0 root directories - * @param bool $prepend Whether to prepend the directories - * - * @return void + * @param string $prefix The prefix + * @param array|string $paths The PSR-0 root directories + * @param bool $prepend Whether to prepend the directories */ public function add($prefix, $paths, $prepend = false) { @@ -222,13 +147,11 @@ public function add($prefix, $paths, $prepend = false) * Registers a set of PSR-4 directories for a given namespace, either * appending or prepending to the ones previously set for this namespace. * - * @param string $prefix The prefix/namespace, with trailing '\\' - * @param string[]|string $paths The PSR-4 base directories - * @param bool $prepend Whether to prepend the directories + * @param string $prefix The prefix/namespace, with trailing '\\' + * @param array|string $paths The PSR-4 base directories + * @param bool $prepend Whether to prepend the directories * * @throws \InvalidArgumentException - * - * @return void */ public function addPsr4($prefix, $paths, $prepend = false) { @@ -272,10 +195,8 @@ public function addPsr4($prefix, $paths, $prepend = false) * Registers a set of PSR-0 directories for a given prefix, * replacing any others previously set for this prefix. * - * @param string $prefix The prefix - * @param string[]|string $paths The PSR-0 base directories - * - * @return void + * @param string $prefix The prefix + * @param array|string $paths The PSR-0 base directories */ public function set($prefix, $paths) { @@ -290,12 +211,10 @@ public function set($prefix, $paths) * Registers a set of PSR-4 directories for a given namespace, * replacing any others previously set for this namespace. * - * @param string $prefix The prefix/namespace, with trailing '\\' - * @param string[]|string $paths The PSR-4 base directories + * @param string $prefix The prefix/namespace, with trailing '\\' + * @param array|string $paths The PSR-4 base directories * * @throws \InvalidArgumentException - * - * @return void */ public function setPsr4($prefix, $paths) { @@ -315,8 +234,6 @@ public function setPsr4($prefix, $paths) * Turns on searching the include path for class files. * * @param bool $useIncludePath - * - * @return void */ public function setUseIncludePath($useIncludePath) { @@ -339,8 +256,6 @@ public function getUseIncludePath() * that have not been registered with the class map. * * @param bool $classMapAuthoritative - * - * @return void */ public function setClassMapAuthoritative($classMapAuthoritative) { @@ -361,12 +276,10 @@ public function isClassMapAuthoritative() * APCu prefix to use to cache found/not-found classes, if the extension is enabled. * * @param string|null $apcuPrefix - * - * @return void */ public function setApcuPrefix($apcuPrefix) { - $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null; + $this->apcuPrefix = function_exists('apcu_fetch') && ini_get('apc.enabled') ? $apcuPrefix : null; } /** @@ -383,44 +296,25 @@ public function getApcuPrefix() * Registers this instance as an autoloader. * * @param bool $prepend Whether to prepend the autoloader or not - * - * @return void */ public function register($prepend = false) { spl_autoload_register(array($this, 'loadClass'), true, $prepend); - - if (null === $this->vendorDir) { - return; - } - - if ($prepend) { - self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders; - } else { - unset(self::$registeredLoaders[$this->vendorDir]); - self::$registeredLoaders[$this->vendorDir] = $this; - } } /** * Unregisters this instance as an autoloader. - * - * @return void */ public function unregister() { spl_autoload_unregister(array($this, 'loadClass')); - - if (null !== $this->vendorDir) { - unset(self::$registeredLoaders[$this->vendorDir]); - } } /** * Loads the given class or interface. * * @param string $class The name of the class - * @return true|null True if loaded, null otherwise + * @return bool|null True if loaded, null otherwise */ public function loadClass($class) { @@ -429,8 +323,6 @@ public function loadClass($class) return true; } - - return null; } /** @@ -475,21 +367,6 @@ public function findFile($class) return $file; } - /** - * Returns the currently registered loaders indexed by their corresponding vendor directories. - * - * @return self[] - */ - public static function getRegisteredLoaders() - { - return self::$registeredLoaders; - } - - /** - * @param string $class - * @param string $ext - * @return string|false - */ private function findFileWithExtension($class, $ext) { // PSR-4 lookup @@ -497,14 +374,10 @@ private function findFileWithExtension($class, $ext) $first = $class[0]; if (isset($this->prefixLengthsPsr4[$first])) { - $subPath = $class; - while (false !== $lastPos = strrpos($subPath, '\\')) { - $subPath = substr($subPath, 0, $lastPos); - $search = $subPath . '\\'; - if (isset($this->prefixDirsPsr4[$search])) { - $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1); - foreach ($this->prefixDirsPsr4[$search] as $dir) { - if (file_exists($file = $dir . $pathEnd)) { + foreach ($this->prefixLengthsPsr4[$first] as $prefix => $length) { + if (0 === strpos($class, $prefix)) { + foreach ($this->prefixDirsPsr4[$prefix] as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) { return $file; } } @@ -561,10 +434,6 @@ private function findFileWithExtension($class, $ext) * Scope isolated include. * * Prevents access to $this/self from included files. - * - * @param string $file - * @return void - * @private */ function includeFile($file) { diff --git a/openml_OS/vendor/composer/LICENSE b/openml_OS/vendor/composer/LICENSE index f27399a04..1a2812488 100644 --- a/openml_OS/vendor/composer/LICENSE +++ b/openml_OS/vendor/composer/LICENSE @@ -1,5 +1,5 @@ -Copyright (c) Nils Adermann, Jordi Boggiano +Copyright (c) 2016 Nils Adermann, Jordi Boggiano Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/openml_OS/vendor/composer/autoload_classmap.php b/openml_OS/vendor/composer/autoload_classmap.php index 0fb0a2c19..7a91153b0 100644 --- a/openml_OS/vendor/composer/autoload_classmap.php +++ b/openml_OS/vendor/composer/autoload_classmap.php @@ -2,9 +2,8 @@ // autoload_classmap.php @generated by Composer -$vendorDir = dirname(__DIR__); +$vendorDir = dirname(dirname(__FILE__)); $baseDir = dirname($vendorDir); return array( - 'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php', ); diff --git a/openml_OS/vendor/composer/autoload_files.php b/openml_OS/vendor/composer/autoload_files.php index 3addebf7f..80babd7e9 100644 --- a/openml_OS/vendor/composer/autoload_files.php +++ b/openml_OS/vendor/composer/autoload_files.php @@ -2,10 +2,9 @@ // autoload_files.php @generated by Composer -$vendorDir = dirname(__DIR__); +$vendorDir = dirname(dirname(__FILE__)); $baseDir = dirname($vendorDir); return array( 'ad155f8f1cf0d418fe49e248db8c661b' => $vendorDir . '/react/promise/src/functions_include.php', - '8592c7b0947d8a0965a9e8c3d16f9c24' => $vendorDir . '/elasticsearch/elasticsearch/src/autoload.php', ); diff --git a/openml_OS/vendor/composer/autoload_namespaces.php b/openml_OS/vendor/composer/autoload_namespaces.php index 74a4ed5e9..b7fc0125d 100644 --- a/openml_OS/vendor/composer/autoload_namespaces.php +++ b/openml_OS/vendor/composer/autoload_namespaces.php @@ -2,9 +2,8 @@ // autoload_namespaces.php @generated by Composer -$vendorDir = dirname(__DIR__); +$vendorDir = dirname(dirname(__FILE__)); $baseDir = dirname($vendorDir); return array( - 'org\\bovigo\\vfs' => array($vendorDir . '/mikey179/vfsstream/src/main/php'), ); diff --git a/openml_OS/vendor/composer/autoload_psr4.php b/openml_OS/vendor/composer/autoload_psr4.php index 8c8c6102a..682ca7a74 100644 --- a/openml_OS/vendor/composer/autoload_psr4.php +++ b/openml_OS/vendor/composer/autoload_psr4.php @@ -2,13 +2,13 @@ // autoload_psr4.php @generated by Composer -$vendorDir = dirname(__DIR__); +$vendorDir = dirname(dirname(__FILE__)); $baseDir = dirname($vendorDir); return array( 'React\\Promise\\' => array($vendorDir . '/react/promise/src'), 'Psr\\Log\\' => array($vendorDir . '/psr/log/Psr/Log'), - 'GuzzleHttp\\Stream\\' => array($vendorDir . '/ezimuel/guzzlestreams/src'), - 'GuzzleHttp\\Ring\\' => array($vendorDir . '/ezimuel/ringphp/src'), + 'GuzzleHttp\\Stream\\' => array($vendorDir . '/guzzlehttp/streams/src'), + 'GuzzleHttp\\Ring\\' => array($vendorDir . '/guzzlehttp/ringphp/src'), 'Elasticsearch\\' => array($vendorDir . '/elasticsearch/elasticsearch/src/Elasticsearch'), ); diff --git a/openml_OS/vendor/composer/autoload_real.php b/openml_OS/vendor/composer/autoload_real.php index 5e0149833..323e357ac 100644 --- a/openml_OS/vendor/composer/autoload_real.php +++ b/openml_OS/vendor/composer/autoload_real.php @@ -13,27 +13,45 @@ public static function loadClassLoader($class) } } - /** - * @return \Composer\Autoload\ClassLoader - */ public static function getLoader() { if (null !== self::$loader) { return self::$loader; } - require __DIR__ . '/platform_check.php'; - spl_autoload_register(array('ComposerAutoloaderInit42a8ed1e61513be5513aa0cb72c34677', 'loadClassLoader'), true, true); - self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__)); + self::$loader = $loader = new \Composer\Autoload\ClassLoader(); spl_autoload_unregister(array('ComposerAutoloaderInit42a8ed1e61513be5513aa0cb72c34677', 'loadClassLoader')); - require __DIR__ . '/autoload_static.php'; - call_user_func(\Composer\Autoload\ComposerStaticInit42a8ed1e61513be5513aa0cb72c34677::getInitializer($loader)); + $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); + if ($useStaticLoader) { + require_once __DIR__ . '/autoload_static.php'; + + call_user_func(\Composer\Autoload\ComposerStaticInit42a8ed1e61513be5513aa0cb72c34677::getInitializer($loader)); + } else { + $map = require __DIR__ . '/autoload_namespaces.php'; + foreach ($map as $namespace => $path) { + $loader->set($namespace, $path); + } + + $map = require __DIR__ . '/autoload_psr4.php'; + foreach ($map as $namespace => $path) { + $loader->setPsr4($namespace, $path); + } + + $classMap = require __DIR__ . '/autoload_classmap.php'; + if ($classMap) { + $loader->addClassMap($classMap); + } + } $loader->register(true); - $includeFiles = \Composer\Autoload\ComposerStaticInit42a8ed1e61513be5513aa0cb72c34677::$files; + if ($useStaticLoader) { + $includeFiles = Composer\Autoload\ComposerStaticInit42a8ed1e61513be5513aa0cb72c34677::$files; + } else { + $includeFiles = require __DIR__ . '/autoload_files.php'; + } foreach ($includeFiles as $fileIdentifier => $file) { composerRequire42a8ed1e61513be5513aa0cb72c34677($fileIdentifier, $file); } @@ -42,16 +60,11 @@ public static function getLoader() } } -/** - * @param string $fileIdentifier - * @param string $file - * @return void - */ function composerRequire42a8ed1e61513be5513aa0cb72c34677($fileIdentifier, $file) { if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { - $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true; - require $file; + + $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true; } } diff --git a/openml_OS/vendor/composer/autoload_static.php b/openml_OS/vendor/composer/autoload_static.php index e3c343283..c28f0cc7d 100644 --- a/openml_OS/vendor/composer/autoload_static.php +++ b/openml_OS/vendor/composer/autoload_static.php @@ -8,7 +8,6 @@ class ComposerStaticInit42a8ed1e61513be5513aa0cb72c34677 { public static $files = array ( 'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php', - '8592c7b0947d8a0965a9e8c3d16f9c24' => __DIR__ . '/..' . '/elasticsearch/elasticsearch/src/autoload.php', ); public static $prefixLengthsPsr4 = array ( @@ -42,11 +41,11 @@ class ComposerStaticInit42a8ed1e61513be5513aa0cb72c34677 ), 'GuzzleHttp\\Stream\\' => array ( - 0 => __DIR__ . '/..' . '/ezimuel/guzzlestreams/src', + 0 => __DIR__ . '/..' . '/guzzlehttp/streams/src', ), 'GuzzleHttp\\Ring\\' => array ( - 0 => __DIR__ . '/..' . '/ezimuel/ringphp/src', + 0 => __DIR__ . '/..' . '/guzzlehttp/ringphp/src', ), 'Elasticsearch\\' => array ( @@ -54,27 +53,11 @@ class ComposerStaticInit42a8ed1e61513be5513aa0cb72c34677 ), ); - public static $prefixesPsr0 = array ( - 'o' => - array ( - 'org\\bovigo\\vfs' => - array ( - 0 => __DIR__ . '/..' . '/mikey179/vfsstream/src/main/php', - ), - ), - ); - - public static $classMap = array ( - 'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php', - ); - public static function getInitializer(ClassLoader $loader) { return \Closure::bind(function () use ($loader) { $loader->prefixLengthsPsr4 = ComposerStaticInit42a8ed1e61513be5513aa0cb72c34677::$prefixLengthsPsr4; $loader->prefixDirsPsr4 = ComposerStaticInit42a8ed1e61513be5513aa0cb72c34677::$prefixDirsPsr4; - $loader->prefixesPsr0 = ComposerStaticInit42a8ed1e61513be5513aa0cb72c34677::$prefixesPsr0; - $loader->classMap = ComposerStaticInit42a8ed1e61513be5513aa0cb72c34677::$classMap; }, null, ClassLoader::class); } diff --git a/openml_OS/vendor/composer/installed.json b/openml_OS/vendor/composer/installed.json index b7037cfb8..a9e87aa68 100644 --- a/openml_OS/vendor/composer/installed.json +++ b/openml_OS/vendor/composer/installed.json @@ -1,363 +1,263 @@ -{ - "packages": [ - { - "name": "elasticsearch/elasticsearch", - "version": "v6.8.2", - "version_normalized": "6.8.2.0", - "source": { - "type": "git", - "url": "https://github.com/elastic/elasticsearch-php.git", - "reference": "619c78266999c6e431df9ca0f844e8f656ac145b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/elastic/elasticsearch-php/zipball/619c78266999c6e431df9ca0f844e8f656ac145b", - "reference": "619c78266999c6e431df9ca0f844e8f656ac145b", - "shasum": "" - }, - "require": { - "ext-json": ">=1.3.7", - "ezimuel/ringphp": "^1.1.2", - "php": "^7.3 || ^8.0", - "psr/log": "~1.0" - }, - "require-dev": { - "doctrine/inflector": "^1.3", - "mockery/mockery": "^1.2", - "phpstan/phpstan": "^0.12", - "phpunit/phpunit": "^9.3", - "squizlabs/php_codesniffer": "^3.4", - "symfony/finder": "~4.0", - "symfony/yaml": "~4.0", - "symplify/git-wrapper": ">=9.0 <9.3.27" - }, - "suggest": { - "ext-curl": "*", - "monolog/monolog": "Allows for client-level logging and tracing" - }, - "time": "2021-07-14T14:41:55+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "files": [ - "src/autoload.php" - ], - "psr-4": { - "Elasticsearch\\": "src/Elasticsearch/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "Apache-2.0" - ], - "authors": [ - { - "name": "Zachary Tong" - }, - { - "name": "Enrico Zimuel" - } - ], - "description": "PHP Client for Elasticsearch", - "keywords": [ - "client", - "elasticsearch", - "search" - ], - "support": { - "issues": "https://github.com/elastic/elasticsearch-php/issues", - "source": "https://github.com/elastic/elasticsearch-php/tree/v6.8.2" - }, - "install-path": "../elasticsearch/elasticsearch" +[ + { + "name": "guzzlehttp/streams", + "version": "3.0.0", + "version_normalized": "3.0.0.0", + "source": { + "type": "git", + "url": "https://github.com/guzzle/streams.git", + "reference": "47aaa48e27dae43d39fc1cea0ccf0d84ac1a2ba5" }, - { - "name": "ezimuel/guzzlestreams", - "version": "3.0.1", - "version_normalized": "3.0.1.0", - "source": { - "type": "git", - "url": "https://github.com/ezimuel/guzzlestreams.git", - "reference": "abe3791d231167f14eb80d413420d1eab91163a8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/ezimuel/guzzlestreams/zipball/abe3791d231167f14eb80d413420d1eab91163a8", - "reference": "abe3791d231167f14eb80d413420d1eab91163a8", - "shasum": "" - }, - "require": { - "php": ">=5.4.0" - }, - "require-dev": { - "phpunit/phpunit": "~4.0" - }, - "time": "2020-02-14T23:11:50+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "GuzzleHttp\\Stream\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - } - ], - "description": "Fork of guzzle/streams (abandoned) to be used with elasticsearch-php", - "homepage": "http://guzzlephp.org/", - "keywords": [ - "Guzzle", - "stream" - ], - "support": { - "source": "https://github.com/ezimuel/guzzlestreams/tree/3.0.1" - }, - "install-path": "../ezimuel/guzzlestreams" + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/streams/zipball/47aaa48e27dae43d39fc1cea0ccf0d84ac1a2ba5", + "reference": "47aaa48e27dae43d39fc1cea0ccf0d84ac1a2ba5", + "shasum": "" }, - { - "name": "ezimuel/ringphp", - "version": "1.2.0", - "version_normalized": "1.2.0.0", - "source": { - "type": "git", - "url": "https://github.com/ezimuel/ringphp.git", - "reference": "92b8161404ab1ad84059ebed41d9f757e897ce74" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/ezimuel/ringphp/zipball/92b8161404ab1ad84059ebed41d9f757e897ce74", - "reference": "92b8161404ab1ad84059ebed41d9f757e897ce74", - "shasum": "" - }, - "require": { - "ezimuel/guzzlestreams": "^3.0.1", - "php": ">=5.4.0", - "react/promise": "~2.0" - }, - "replace": { - "guzzlehttp/ringphp": "self.version" - }, - "require-dev": { - "ext-curl": "*", - "phpunit/phpunit": "~9.0" - }, - "suggest": { - "ext-curl": "Guzzle will use specific adapters if cURL is present" - }, - "time": "2021-11-16T11:51:30+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.1-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "GuzzleHttp\\Ring\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - } - ], - "description": "Fork of guzzle/RingPHP (abandoned) to be used with elasticsearch-php", - "support": { - "source": "https://github.com/ezimuel/ringphp/tree/1.2.0" - }, - "install-path": "../ezimuel/ringphp" + "require": { + "php": ">=5.4.0" }, - { - "name": "mikey179/vfsstream", - "version": "v1.1.0", - "version_normalized": "1.1.0.0", - "source": { - "type": "git", - "url": "https://github.com/bovigo/vfsStream.git", - "reference": "fc0fe8f4d0b527254a2dc45f0c265567c881d07e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/bovigo/vfsStream/zipball/fc0fe8f4d0b527254a2dc45f0c265567c881d07e", - "reference": "fc0fe8f4d0b527254a2dc45f0c265567c881d07e", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "time": "2012-08-25T12:49:29+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "psr-0": { - "org\\bovigo\\vfs": "src/main/php" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD" - ], - "homepage": "http://vfs.bovigo.org/", - "support": { - "issues": "https://github.com/bovigo/vfsStream/issues", - "source": "https://github.com/bovigo/vfsStream/tree/v1.1.0" - }, - "install-path": "../mikey179/vfsstream" + "require-dev": { + "phpunit/phpunit": "~4.0" }, - { - "name": "psr/log", - "version": "1.1.4", - "version_normalized": "1.1.4.0", - "source": { - "type": "git", - "url": "https://github.com/php-fig/log.git", - "reference": "d49695b909c3b7628b6289db5479a1c204601f11" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11", - "reference": "d49695b909c3b7628b6289db5479a1c204601f11", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "time": "2021-05-03T11:20:27+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.1.x-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "Psr\\Log\\": "Psr/Log/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "https://www.php-fig.org/" - } - ], - "description": "Common interface for logging libraries", - "homepage": "https://github.com/php-fig/log", - "keywords": [ - "log", - "psr", - "psr-3" - ], - "support": { - "source": "https://github.com/php-fig/log/tree/1.1.4" - }, - "install-path": "../psr/log" + "time": "2014-10-12T19:18:40+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } }, - { - "name": "react/promise", - "version": "v2.9.0", - "version_normalized": "2.9.0.0", - "source": { - "type": "git", - "url": "https://github.com/reactphp/promise.git", - "reference": "234f8fd1023c9158e2314fa9d7d0e6a83db42910" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/reactphp/promise/zipball/234f8fd1023c9158e2314fa9d7d0e6a83db42910", - "reference": "234f8fd1023c9158e2314fa9d7d0e6a83db42910", - "shasum": "" - }, - "require": { - "php": ">=5.4.0" - }, - "require-dev": { - "phpunit/phpunit": "^9.3 || ^5.7 || ^4.8.36" - }, - "time": "2022-02-11T10:27:51+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "files": [ - "src/functions_include.php" - ], - "psr-4": { - "React\\Promise\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jan Sorgalla", - "email": "jsorgalla@gmail.com", - "homepage": "https://sorgalla.com/" - }, - { - "name": "Christian Lück", - "email": "christian@clue.engineering", - "homepage": "https://clue.engineering/" - }, - { - "name": "Cees-Jan Kiewiet", - "email": "reactphp@ceesjankiewiet.nl", - "homepage": "https://wyrihaximus.net/" - }, - { - "name": "Chris Boden", - "email": "cboden@gmail.com", - "homepage": "https://cboden.dev/" - } - ], - "description": "A lightweight implementation of CommonJS Promises/A for PHP", - "keywords": [ - "promise", - "promises" - ], - "support": { - "issues": "https://github.com/reactphp/promise/issues", - "source": "https://github.com/reactphp/promise/tree/v2.9.0" - }, - "funding": [ - { - "url": "https://github.com/WyriHaximus", - "type": "github" - }, - { - "url": "https://github.com/clue", - "type": "github" - } - ], - "install-path": "../react/promise" - } - ], - "dev": true, - "dev-package-names": [ - "mikey179/vfsstream" - ] -} + "installation-source": "dist", + "autoload": { + "psr-4": { + "GuzzleHttp\\Stream\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "Provides a simple abstraction over streams of data", + "homepage": "http://guzzlephp.org/", + "keywords": [ + "Guzzle", + "stream" + ] + }, + { + "name": "psr/log", + "version": "1.0.2", + "version_normalized": "1.0.2.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", + "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "time": "2016-10-10T12:19:37+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Psr\\Log\\": "Psr/Log/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ] + }, + { + "name": "react/promise", + "version": "v2.7.0", + "version_normalized": "2.7.0.0", + "source": { + "type": "git", + "url": "https://github.com/reactphp/promise.git", + "reference": "f4edc2581617431aea50430749db55cc3fc031b3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/promise/zipball/f4edc2581617431aea50430749db55cc3fc031b3", + "reference": "f4edc2581617431aea50430749db55cc3fc031b3", + "shasum": "" + }, + "require": { + "php": ">=5.4.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.8" + }, + "time": "2018-06-13T15:59:06+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "React\\Promise\\": "src/" + }, + "files": [ + "src/functions_include.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com" + } + ], + "description": "A lightweight implementation of CommonJS Promises/A for PHP", + "keywords": [ + "promise", + "promises" + ] + }, + { + "name": "guzzlehttp/ringphp", + "version": "1.1.1", + "version_normalized": "1.1.1.0", + "source": { + "type": "git", + "url": "https://github.com/guzzle/RingPHP.git", + "reference": "5e2a174052995663dd68e6b5ad838afd47dd615b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/RingPHP/zipball/5e2a174052995663dd68e6b5ad838afd47dd615b", + "reference": "5e2a174052995663dd68e6b5ad838afd47dd615b", + "shasum": "" + }, + "require": { + "guzzlehttp/streams": "~3.0", + "php": ">=5.4.0", + "react/promise": "~2.0" + }, + "require-dev": { + "ext-curl": "*", + "phpunit/phpunit": "~4.0" + }, + "suggest": { + "ext-curl": "Guzzle will use specific adapters if cURL is present" + }, + "time": "2018-07-31T13:22:33+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "GuzzleHttp\\Ring\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "Provides a simple API and specification that abstracts away the details of HTTP into a single PHP function." + }, + { + "name": "elasticsearch/elasticsearch", + "version": "v6.0.1", + "version_normalized": "6.0.1.0", + "source": { + "type": "git", + "url": "https://github.com/elastic/elasticsearch-php.git", + "reference": "b8e3bc9d1fc54d6a18692df0b74956efe7fe241a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/elastic/elasticsearch-php/zipball/b8e3bc9d1fc54d6a18692df0b74956efe7fe241a", + "reference": "b8e3bc9d1fc54d6a18692df0b74956efe7fe241a", + "shasum": "" + }, + "require": { + "ext-json": ">=1.3.7", + "guzzlehttp/ringphp": "~1.0", + "php": "^7.0", + "psr/log": "~1.0" + }, + "require-dev": { + "cpliakas/git-wrapper": "~1.0", + "doctrine/inflector": "^1.1", + "mockery/mockery": "0.9.4", + "phpstan/phpstan-shim": "0.8.3", + "phpunit/phpunit": "6.3.0", + "squizlabs/php_codesniffer": "3.0.2", + "symfony/finder": "^2.8", + "symfony/yaml": "^2.8" + }, + "suggest": { + "ext-curl": "*", + "monolog/monolog": "Allows for client-level logging and tracing" + }, + "time": "2017-12-05T14:15:58+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Elasticsearch\\": "src/Elasticsearch/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "Zachary Tong" + } + ], + "description": "PHP Client for Elasticsearch", + "keywords": [ + "client", + "elasticsearch", + "search" + ] + } +] diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/.github/CONTRIBUTING.md b/openml_OS/vendor/elasticsearch/elasticsearch/.github/CONTRIBUTING.md new file mode 100644 index 000000000..30f80eb82 --- /dev/null +++ b/openml_OS/vendor/elasticsearch/elasticsearch/.github/CONTRIBUTING.md @@ -0,0 +1,47 @@ +If you have a bugfix or new feature that you would like to contribute to elasticsearch-php, please find or open an issue about it first. Talk about what you would like to do. It may be that somebody is already working on it, or that there are particular issues that you should know about before implementing the change. + +We enjoy working with contributors to get their code accepted. There are many approaches to fixing a problem and it is important to find the best approach before writing too much code. + +The process for contributing to any of the Elasticsearch repositories is similar. + +1. Sign the contributor license agreement + + Please make sure you have signed the [Contributor License Agreement](http://www.elasticsearch.org/contributor-agreement/). We are not asking you to assign copyright to us, but to give us the right to distribute your code without restriction. We ask this of all contributors in order to assure our users of the origin and continuing existence of the code. You only need to sign the CLA once. + +2. Set up your fork for development + + $> git clone https://github.com/elasticsearch/elasticsearch-php.git + $> cd elasticsearch-php + $> git submodule update --init --recursive + $> curl -s http://getcomposer.org/installer | php + $> php composer.phar install --dev + +3. Ensure a version of Elasticsearch is running on your machine. Recommended "test" configuration is: + + $> bin/elasticsearch -Des.gateway.type=none -Des.http.port=9200 \ + -Des.index.store.type=memory -Des.discovery.zen.ping.multicast.enabled=false \ + -Des.node.bench=true -Des.script.disable_dynamic=false + +4. Run the unit and yaml integration tests to ensure your changes do not break existing code. The `util/RestSpecRunner.php` script will automatically checkout the tests for the exact same build as is the Elasticsearch you are running on your machine (since tests are specific to the server version): + + $> export ES_TEST_HOST='http://localhost:9200' + + Then proceed to initialize the REST yaml tests and run the package. **WARNING: the unit tests will clear your cluster + and data..._do not_ run the tests on a production cluster!** + + $> php util/RestSpecRunner.php + $> php vendor/bin/phpunit + +5. Ensure your changes follow the [PSR-2 Coding Style Guide](http://www.php-fig.org/psr/psr-2/). You can run tools such as [PHP-CS-Fixer](http://cs.sensiolabs.org/) or [PHP_CodeSniffer](http://pear.php.net/package/PHP_CodeSniffer) to enforce PSR-2 automatically. + +6. Rebase your changes + + Update your local repository with the most recent code from the main elasticsearch-php repository, and rebase your branch on top of the latest master branch. We prefer your changes to be squashed into a single commit. + +7. Submit a pull request + + Push your local changes to your forked copy of the repository and submit a pull request. In the pull request, describe what your changes do and mention the number of the issue where discussion has taken place, eg “Closes #123″. Please consider adding or modifying tests related to your changes. + + +Then sit back and wait. There will probably be discussion about the pull request and, if any changes are needed, we would love to work with you to get your pull request merged into elasticsearch-php. + diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/.github/ISSUE_TEMPLATE.md b/openml_OS/vendor/elasticsearch/elasticsearch/.github/ISSUE_TEMPLATE.md new file mode 100644 index 000000000..40380c153 --- /dev/null +++ b/openml_OS/vendor/elasticsearch/elasticsearch/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,31 @@ + +### Summary of problem or feature request + + + + +### Code snippet of problem + + + +### System details + + + +- Operating System +- PHP Version +- ES-PHP client version +- Elasticsearch version \ No newline at end of file diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/.github/PULL_REQUEST_TEMPLATE.md b/openml_OS/vendor/elasticsearch/elasticsearch/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 000000000..0aa96c9e2 --- /dev/null +++ b/openml_OS/vendor/elasticsearch/elasticsearch/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,14 @@ + \ No newline at end of file diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/.gitignore b/openml_OS/vendor/elasticsearch/elasticsearch/.gitignore new file mode 100755 index 000000000..7ed6ab2ec --- /dev/null +++ b/openml_OS/vendor/elasticsearch/elasticsearch/.gitignore @@ -0,0 +1,29 @@ +#composer related +composer.lock +vendor/ +composer.phar +.php_cs.cache + +#editor related +.idea + +# OS generated files +.DS_Store +.DS_Store? +._* +.Spotlight-V100 +.Trashes +Icon? +ehthumbs.db +Thumbs.db + +#generator related +generator/* + +# Elasticsearch related +util/elasticsearch/ +util/cache/ +util/output + +# Sami docs generator +/sami.phar diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/.gitmodules b/openml_OS/vendor/elasticsearch/elasticsearch/.gitmodules new file mode 100644 index 000000000..e03c4467a --- /dev/null +++ b/openml_OS/vendor/elasticsearch/elasticsearch/.gitmodules @@ -0,0 +1,3 @@ +[submodule "util/elasticsearch"] + path = util/elasticsearch + url = https://github.com/elasticsearch/elasticsearch.git diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/.php_cs b/openml_OS/vendor/elasticsearch/elasticsearch/.php_cs new file mode 100644 index 000000000..e01869ce0 --- /dev/null +++ b/openml_OS/vendor/elasticsearch/elasticsearch/.php_cs @@ -0,0 +1,22 @@ +exclude('benchmarks') + ->exclude('docs') + ->exclude('util') + ->exclude('.github') + ->exclude('util') + ->exclude('travis') + ->exclude('util/cache') + ->exclude('util/elasticsearch') + ->exclude('vendor') + ->in(__DIR__); + + return Symfony\CS\Config\Config::create() + ->setUsingCache(true) + ->level(Symfony\CS\FixerInterface::PSR2_LEVEL) + ->finder($finder); +} + +return php_cs(); diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/.travis.yml b/openml_OS/vendor/elasticsearch/elasticsearch/.travis.yml new file mode 100644 index 000000000..6eab7e69b --- /dev/null +++ b/openml_OS/vendor/elasticsearch/elasticsearch/.travis.yml @@ -0,0 +1,60 @@ +language: php + +jdk: + - oraclejdk8 + +addons: + apt: + packages: + - oracle-java8-installer + +branches: + except: + - 0.4 + +sudo: true + +matrix: + fast_finish: true + include: + - php: 7.0 + env: ES_VERSION="6.0" + - php: 7.0 + env: ES_VERSION="6.x" + + - php: 7.1 + env: ES_VERSION="6.0" + - php: 7.1 + env: ES_VERSION="6.x" + + - php: 7.2 + env: ES_VERSION="6.0" + + allow_failures: + - env: ES_VERSION="6.x" + +env: + global: + - ES_TEST_HOST=http://localhost:9200 + - JAVA_HOME="/usr/lib/jvm/java-8-oracle/jre" + +before_install: + - sudo update-java-alternatives -s java-8-oracle + - ./travis/download_and_run_es.sh + +install: + - composer install --prefer-source + +before_script: + - if [ $TRAVIS_PHP_VERSION = '7.0' ]; then PHPUNIT_FLAGS="--coverage-clover ./build/logs/clover.xml"; fi + - php util/RestSpecRunner.php + - php util/EnsureClusterAlive.php + +script: + - composer run-script phpcs + - composer run-script phpstan + - vendor/bin/phpunit $PHPUNIT_FLAGS + - vendor/bin/phpunit -c phpunit-integration.xml --group sync $PHPUNIT_FLAGS + +after_script: + - if [ $TRAVIS_PHP_VERSION = '7.0' ]; then php vendor/bin/coveralls; fi diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/BREAKING_CHANGES.md b/openml_OS/vendor/elasticsearch/elasticsearch/BREAKING_CHANGES.md index 3b69c66fc..fbba874a0 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/BREAKING_CHANGES.md +++ b/openml_OS/vendor/elasticsearch/elasticsearch/BREAKING_CHANGES.md @@ -1,10 +1,4 @@ -# 6.7 - -- `{type}` part in `indices.put_mapping` API is not required anymore, see new specification [here](https://github.com/elastic/elasticsearch/blob/v6.7.0/rest-api-spec/src/main/resources/rest-api-spec/api/indices.put_mapping.json) - # 6.0 - [Search Templates]: PutTemplate endpoint has been removed (see [Elasticsearch Breaking Changes](https://www.elastic.co/guide/en/elasticsearch/reference/current/breaking_60_scripting_changes.html#_stored_search_template_apis_removed)), -use PutScript instead. - -- [#674](https://github.com/elastic/elasticsearch-php/pull/674) `ClientBuilder::defaultLogger()` method was removed. It is recommended to [create the logger object manually](https://github.com/elastic/elasticsearch-php/blob/master/docs/configuration.asciidoc#enabling-the-logger). +use PutScript instead. \ No newline at end of file diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/CHANGELOG.md b/openml_OS/vendor/elasticsearch/elasticsearch/CHANGELOG.md index b1f1e3553..6f4f12cd1 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/CHANGELOG.md +++ b/openml_OS/vendor/elasticsearch/elasticsearch/CHANGELOG.md @@ -1,101 +1,3 @@ -## Release 6.8.2 - -- Fix #1131 class naming for some endpoints used in `elasticsearch-php` < 6.8. - These endpoints are: `NodeAttrs`, `ForceMerge`, `MTermVectors`, `TermVectors` - (https://github.com/elastic/elasticsearch-php/pull/1151) -## Release 6.8.1 - -- Fix missing class aliases in 6.8.0 (https://github.com/elastic/elasticsearch-php/pull/1114) -- Backported fix #1066 (https://github.com/elastic/elasticsearch-php/pull/1109) - -## Release 6.8.0 - -- Added XPack endpoints -- Added X-Opaque-Id header (https://github.com/elastic/elasticsearch-php/pull/952) -- Added X-Elastic-Client-Meta header (https://github.com/elastic/elasticsearch-php/pull/1089) -- Added the license header (https://github.com/elastic/elasticsearch-php/commit/0ff5fb98745a511118df5b1a68ca54d892b08ee3) -- Support of PHP 8 (https://github.com/elastic/elasticsearch-php/pull/1095 and https://github.com/elastic/elasticsearch-php/pull/1063) -- Replace `array_walk` with `array_map` in `Connection::getURI` (https://github.com/elastic/elasticsearch-php/pull/1075) -- Fix for #1064 reset custom headers (https://github.com/elastic/elasticsearch-php/pull/1065) -- Replace `guzzlehttp/ringphp` with `ezimuel/ringphp` (https://github.com/elastic/elasticsearch-php/pull/1102) - -## Release 6.7.2 - -- Fix #846 choosing `GET` and `POST` in endpoints based on body [[acbc76d0]](https://github.com/elastic/elasticsearch-php/commit/acbc76d0) -- Fix #843 adding `wait_for_active_shards` and `pipeline` in `UpdateByQuery` [[acbc76d0]](https://github.com/elastic/elasticsearch-php/commit/acbc76d0) -- Fixed missing `ScriptsPainlessExecute` endpoint, since ES 6.3 [[acbc76d0]](https://github.com/elastic/elasticsearch-php/commit/acbc76d0) -- Fixed missing `RankEval` endpoint, since ES 6.2 [[acbc76d0]](https://github.com/elastic/elasticsearch-php/commit/acbc76d0) -- Added User-Agent header equal to `elasticsearch-php/6.7.1 (metadata-values)` [[acbc76d0]](https://github.com/elastic/elasticsearch-php/commit/acbc76d0) - -## Release 6.7.1 - -- Added `track_total_hits` in `search` endpoint [0c9ff47](https://github.com/elastic/elasticsearch-php/commit/9f4f0dfa331c4f50d2c88c0068afd3062e6ea353) - -## Release 6.7.0 - -- Removed requirement of `{type}` part in `indices.put_mapping`, see new API specification [here](https://github.com/elastic/elasticsearch/blob/v6.7.0/rest-api-spec/src/main/resources/rest-api-spec/api/indices.put_mapping.json) -- Added `seq_no_primary_term` parameter in `bulk` endpoint [#884](https://github.com/elastic/elasticsearch-php/pull/884) -- Added `include_type_name`, `if_primary_term`, `if_seq_no` in `delete` endpoint [#884](https://github.com/elastic/elasticsearch-php/pull/884) -- Added `include_type_name` in `get`, `index`, `indices.create`, `indices.field.get`, `indices.get`, `indices.mapping.get`, `indices.mapping.getfield`, `indices.mapping.put`, `indices.rollover`, `indices.template.get`, `indices.template.put` endpoints [#884](https://github.com/elastic/elasticsearch-php/pull/884) -- Added `seq_no_primary_term` in `search` endpoint [#884](https://github.com/elastic/elasticsearch-php/pull/884) -- Added `if_primary_term', 'if_seq_no`in `update` endpoint [#884](https://github.com/elastic/elasticsearch-php/pull/884) - -### Testing - -- Fix tests for PHP 7 with ES 6.7 [[5401479](https://github.com/elastic/elasticsearch-php/pull/884/commits/5401479) - -### Docs - -- [DOCS] Fix doc links in README [[5a1782d]](https://github.com/elastic/elasticsearch-php/pull/884/commits/5a1782d) - -## Release 6.5.0 - -- Remove `_suggest` endpoint, which has disappeared from ES6 [#763](https://github.com/elastic/elasticsearch-php/pull/763) -- Fix `SearchHitIterator` key duplicates [#872](https://github.com/elastic/elasticsearch-php/pull/872) -- Fixing script get and delete by removing `lang` from endpoint url [#814](https://github.com/elastic/elasticsearch-php/pull/814) -- Fix `SearchResponseIterator` is scrolling the first page twice [#871](https://github.com/elastic/elasticsearch-php/pull/871), issue [#595](https://github.com/elastic/elasticsearch-php/issues/595) - -### Docs - -- [DOCS] Add reference to `parse_url()` for Extended Host Configuration [#778](https://github.com/elastic/elasticsearch-php/pull/778) -- [DOCS] Update php version requirement [#757](https://github.com/elastic/elasticsearch-php/pull/757) -- [DOCS] Update `community.asciidoc`, added `ElasticSearchQueryDSL` project [#749](https://github.com/elastic/elasticsearch-php/pull/749) -- [DOCS] Proper return type array for get method for `IndicesNamespace` [#651](https://github.com/elastic/elasticsearch-php/pull/651) -- [DOCS] Fix full docs link [#862](https://github.com/elastic/elasticsearch-php/pull/862) -- [DOCS] Update breaking-changes.asciidoc, removal of ClientBuilder::defaultLogger() [#879](https://github.com/elastic/elasticsearch-php/pull/879) - -### Testing - -- Fix integration tests using docker [#867](https://github.com/elastic/elasticsearch-php/pull/867) - -## Release 6.1.0 - -- Add 'wait_for_no_initializing_shards' to Cluster\Health whitelist [[98a372c]](http://github.com/elasticsearch/elasticsearch-php/commit/98a372c) -- Add 'wait_for_active_shards' to Indices\Open whitelist [[0275fe5]](http://github.com/elasticsearch/elasticsearch-php/commit/0275fe5) -- Add 'max_concurrent_searches' to msearch whitelist [[5624123]](http://github.com/elasticsearch/elasticsearch-php/commit/5624123) -- Add 'max_concurrent_shard_requests' param to MSearch endpoint [[00800c1]](http://github.com/elasticsearch/elasticsearch-php/commit/00800c1) -- Add ReloadSecureSettings endpoint [[75b32b2]](http://github.com/elasticsearch/elasticsearch-php/commit/75b32b2) -- Remove obsolete Shutdown API [[c75d690]](http://github.com/elasticsearch/elasticsearch-php/commit/c75d690) -- Fix: Restore::setBody() does not throw exceptions (#828) [[a96bb9c]](http://github.com/elasticsearch/elasticsearch-php/commit/a96bb9c) -- Fixed php 7.3 compatibility for elasticsearch 6 (#827) [[77916b2]](http://github.com/elasticsearch/elasticsearch-php/commit/77916b2) -- Fix issue with getting status of respository and snapshots. (#719) [[2d11682]](http://github.com/elasticsearch/elasticsearch-php/commit/2d11682) -- fix DeleteByQuery param white list (#748) [[8d963c6]](http://github.com/elasticsearch/elasticsearch-php/commit/8d963c6) - -### Docs -- [Docs] Update elasticsearch version (#743) [[043ad4f]](http://github.com/elasticsearch/elasticsearch-php/commit/043ad4f) -- [DOCS] reuqest → request typo fix (#728) [[68db9f0]](http://github.com/elasticsearch/elasticsearch-php/commit/68db9f0) -- [DOCS] Fix documentation example of upsert (#730) [[805329b]](http://github.com/elasticsearch/elasticsearch-php/commit/805329b) -- [DOCS] Replace deprecated string type with keyword type for index operations (#736) [[a550507]](http://github.com/elasticsearch/elasticsearch-php/commit/a550507) - -### Testing - -- [TEST] Fix travis untarring [[0106351]](http://github.com/elasticsearch/elasticsearch-php/commit/0106351) -- [TEST] Download artifacts directly, migrate off esvm [[1e9f06c]](http://github.com/elasticsearch/elasticsearch-php/commit/1e9f06c) -- Update Travis Matrix [[aa32b12]](http://github.com/elasticsearch/elasticsearch-php/commit/aa32b12) -- [TEST] Fix teardown in yaml runner [[098030e]](http://github.com/elasticsearch/elasticsearch-php/commit/098030e) -- Add Indices/Split endpoint [[46d5a7a]](http://github.com/elasticsearch/elasticsearch-php/commit/46d5a7a) -- [TEST] Blacklist some bad yml tests [[d5edab7]](http://github.com/elasticsearch/elasticsearch-php/commit/d5edab7) - ## Release 6.0.1 - Fix imports [[0106351]](http://github.com/elasticsearch/elasticsearch-php/commit/0106351) diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/README.md b/openml_OS/vendor/elasticsearch/elasticsearch/README.md index eedaf2efd..7dfc4df51 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/README.md +++ b/openml_OS/vendor/elasticsearch/elasticsearch/README.md @@ -1,14 +1,13 @@ elasticsearch-php ================= -[![Build status](https://github.com/elastic/elasticsearch-php/workflows/PHP%20test/badge.svg?branch=6.8.x)](https://github.com/elastic/elasticsearch-php/actions) [![Latest Stable Version](https://poser.pugx.org/elasticsearch/elasticsearch/v/stable)](https://packagist.org/packages/elasticsearch/elasticsearch) [![Total Downloads](https://poser.pugx.org/elasticsearch/elasticsearch/downloads)](https://packagist.org/packages/elasticsearch/elasticsearch) +[![Build Status](https://img.shields.io/travis/elastic/elasticsearch-php.svg?style=flat-square)](https://travis-ci.org/elastic/elasticsearch-php) Official low-level client for Elasticsearch. Its goal is to provide common ground for all Elasticsearch-related code in PHP; because of this it tries to be opinion-free and very extendable. To maintain consistency across all the low-level clients (Ruby, Python, etc.), clients accept simple associative arrays as parameters. All parameters, from the URI to the document body, are defined in the associative array. -**NOTE**: starting from `elasticsearch-php` 6.8.0 we supports also [XPack](https://www.elastic.co/guide/en/elasticsearch/reference/6.8/setup-xpack.html) endpoints of Elasticsearch. Features -------- @@ -20,6 +19,9 @@ Features - Pluggable connection pools to offer different connection strategies - Generalized, pluggable architecture - most components can be replaced with your own custom class if specialized behavior is required - Option to use asynchronous future, which enables parallel execution of curl requests to multiple nodes + + +**Note:** If you want to use X-Pack API, you need to install an optional extension [elasticsearch/xpack](https://github.com/elastic/elasticsearch-x-pack-php). Version Matrix @@ -27,36 +29,32 @@ Version Matrix | Elasticsearch Version | Elasticsearch-PHP Branch | | --------------------- | ------------------------ | -| >= 6.8, < 7.0 | 6.8.x | -| >= 6.6, < 7.0 | 6.7.x | -| >= 6.0, < 6.6 | 6.5.x | +| >= 6.0 | 6.0 | | >= 5.0, < 6.0 | 5.0 | | >= 2.0, < 5.0 | 1.0 or 2.0 | | >= 1.0, < 2.0 | 1.0 or 2.0 | | <= 0.90.x | 0.4 | - - If you are using Elasticsearch 6.8+, use Elasticsearch-PHP 6.8.x branch. - - If you are using Elasticsearch 6.6 to 6.7, use Elasticsearch-PHP 6.7.x branch. - - If you are using Elasticsearch 6.0 to 6.5, use Elasticsearch-PHP 6.5.x branch. - - If you are using Elasticsearch 5.x, use Elasticsearch-PHP 5.0 branch. + - If you are using Elasticsearch 6.0+ , use Elasticsearch-PHP 6.0 branch. + - If you are using Elasticsearch 5.x , use Elasticsearch-PHP 5.0 branch. - If you are using Elasticsearch 1.x or 2.x, prefer using the Elasticsearch-PHP 2.0 branch. The 1.0 branch is compatible however. - If you are using a version older than 1.0, you must install the `0.4` Elasticsearch-PHP branch. Since ES 0.90.x and below is now EOL, the corresponding `0.4` branch will not receive any more development or bugfixes. Please upgrade. - You should never use Elasticsearch-PHP Master branch, as it tracks Elasticsearch master and may contain incomplete features or breaks in backwards compatibility. Only use ES-PHP master if you are developing against ES master for some reason. Documentation -------------- -[Full documentation can be found here.](https://www.elastic.co/guide/en/elasticsearch/client/php-api/current/index.html) Docs are stored within the repo under /docs/, so if you see a typo or problem, please submit a PR to fix it! +[Full documentation can be found here.](http://www.elasticsearch.org/guide/en/elasticsearch/client/php-api/5.0/index.html) Docs are stored within the repo under /docs/, so if you see a typo or problem, please submit a PR to fix it! Installation via Composer ------------------------- The recommended method to install _Elasticsearch-PHP_ is through [Composer](http://getcomposer.org). -1. Add `elasticsearch/elasticsearch` as a dependency in your project's `composer.json` file (change version to suit your version of Elasticsearch, for instance for ES 6.8): +1. Add `elasticsearch/elasticsearch` as a dependency in your project's `composer.json` file (change version to suit your version of Elasticsearch): ```json { "require": { - "elasticsearch/elasticsearch": "^6.8" + "elasticsearch/elasticsearch": "~6.0" } } ``` @@ -93,16 +91,12 @@ PHP Version Requirement Version 6.0 of this library requires at least PHP version 7.0.0 to function. In addition, it requires the native JSON extension to be version 1.3.7 or higher. -**NOTE**: starting from `elasticsearch-php` **6.8.0** we supports only PHP 7.3+ (including PHP 8.0). - - | Elasticsearch-PHP Branch | PHP Version | | ----------- | ------------------------ | -| 6.8 | >= 7.3.0, < 9.0.0 | -| 6.0 | >= 7.0.0, < 8.0.0 | -| 5.0 | >= 5.6.6, < 8.0.0 | -| 2.0 | >= 5.4.0, < 7.0.0 | -| 0.4, 1.0 | >= 5.3.9, < 7.0.0 | +| 6.0 | >= 7.0.0 | +| 5.0 | >= 5.6.6 | +| 2.0 | >= 5.4.0 | +| 0.4, 1.0 | >= 5.3.9 | Quickstart @@ -359,7 +353,7 @@ That was just a crash-course overview of the client and its syntax. If you are You'll also notice that the client is configured in a manner that facilitates easy discovery via the IDE. All core actions are available under the `$client` object (indexing, searching, getting, etc.). Index and cluster management are located under the `$client->indices()` and `$client->cluster()` objects, respectively. -Check out the rest of the [Documentation](https://www.elastic.co/guide/en/elasticsearch/client/php-api/current/index.html) to see how the entire client works. +Check out the rest of the [Documentation](http://www.elasticsearch.org/guide/en/elasticsearch/client/php-api/current/index.html) to see how the entire client works. Available Licenses diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/composer.json b/openml_OS/vendor/elasticsearch/elasticsearch/composer.json index 2fbb0f6c7..7b966a0dd 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/composer.json +++ b/openml_OS/vendor/elasticsearch/elasticsearch/composer.json @@ -6,45 +6,37 @@ "license": "Apache-2.0", "authors": [ { - "name": "Zachary Tong" - }, - { - "name": "Enrico Zimuel" + "name": "Zachary Tong" } ], "require": { - "php": "^7.3 || ^8.0", + "php": "^7.0", "ext-json": ">=1.3.7", - "ezimuel/ringphp": "^1.1.2", + "guzzlehttp/ringphp": "~1.0", "psr/log": "~1.0" }, "require-dev": { - "symplify/git-wrapper": ">=9.0 <9.3.27", - "doctrine/inflector": "^1.3", - "mockery/mockery": "^1.2", - "phpstan/phpstan": "^0.12", - "phpunit/phpunit": "^9.3", - "squizlabs/php_codesniffer": "^3.4", - "symfony/finder": "~4.0", - "symfony/yaml": "~4.0" + "cpliakas/git-wrapper": "~1.0", + "doctrine/inflector": "^1.1", + "mockery/mockery": "0.9.4", + "phpstan/phpstan-shim": "0.8.3", + "phpunit/phpunit": "6.3.0", + "squizlabs/php_codesniffer": "3.0.2", + "symfony/finder": "^2.8", + "symfony/yaml": "^2.8" }, "suggest": { "ext-curl": "*", "monolog/monolog": "Allows for client-level logging and tracing" }, "autoload": { - "files": [ - "src/autoload.php" - ], "psr-4": { "Elasticsearch\\": "src/Elasticsearch/" } }, "autoload-dev": { "psr-4": { - "Elasticsearch\\Tests\\": "tests/Elasticsearch/Tests/", - "Elasticsearch\\IntegrationTests\\": "tests/Elasticsearch/IntegrationTests/", - "Elasticsearch\\Util\\": "util/" + "Elasticsearch\\Tests\\": "tests/Elasticsearch/Tests/" } }, "config": { @@ -52,11 +44,11 @@ }, "scripts": { "phpcs": [ - "phpcs --standard=ruleset.xml --extensions=php --encoding=utf-8 --tab-width=4 -sp src --ignore=src/Elasticsearch/Endpoints", - "phpcs --standard=ruleset.xml --extensions=php --encoding=utf-8 --tab-width=4 -sp tests --ignore=tests/Elasticsearch/Tests/Yaml" + "phpcs --standard=ruleset.xml --extensions=php --encoding=utf-8 --tab-width=4 -sp src", + "phpcs --standard=ruleset.xml --extensions=php --encoding=utf-8 --tab-width=4 -sp tests" ], "phpstan": [ - "phpstan analyse src --level 2 --no-progress" + "@php vendor/phpstan/phpstan-shim/phpstan.phar analyse -c phpstan.neon tests --level 7 --no-progress" ] } } diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/docs/breaking-changes.asciidoc b/openml_OS/vendor/elasticsearch/elasticsearch/docs/breaking-changes.asciidoc index 94a6ee69e..23ee4a291 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/docs/breaking-changes.asciidoc +++ b/openml_OS/vendor/elasticsearch/elasticsearch/docs/breaking-changes.asciidoc @@ -1,17 +1,3 @@ -[[breaking_changes]] == Breaking changes from 5.x -### Removal of ClientBuilder::defaultLogger() - -In 5.x there is the ability to create a default Logger object, which has been removed. It is now required to explicitly make a Logger object. - -5.x -``` -$logger = ClientBuilder::defaultLogger('path_to_log_file'); -``` - -6.5 -``` -$logger = new Logger('name'); -$logger->pushHandler(new StreamHandler('path_to_log_file', Logger::WARNING); -``` +None! :) \ No newline at end of file diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/docs/build/Elasticsearch/Client.asciidoc b/openml_OS/vendor/elasticsearch/elasticsearch/docs/build/Elasticsearch/Client.asciidoc index 587902c1a..ec49e7197 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/docs/build/Elasticsearch/Client.asciidoc +++ b/openml_OS/vendor/elasticsearch/elasticsearch/docs/build/Elasticsearch/Client.asciidoc @@ -46,6 +46,7 @@ The class defines the following methods: * <> * <> * <> +* <> * <> * <> * <> @@ -931,6 +932,7 @@ $response = $client->updateByQuery($params); ---- /* $params['id'] = (string) The script ID (Required) + ['lang'] = (string) The script language (Required) ['body'] = (array) Request body */ @@ -952,6 +954,7 @@ $response = $client->getScript($params); ---- /* $params['id'] = (string) The script ID (Required) + ['lang'] = (string) The script language (Required) ['body'] = (array) Request body */ @@ -973,6 +976,7 @@ $response = $client->deleteScript($params); ---- /* $params['id'] = (string) The script ID (Required) + ['lang'] = (string) The script language (Required) ['body'] = (array) Request body */ @@ -1029,6 +1033,27 @@ $response = $client->deleteTemplate($params); +[[Elasticsearch_ClientputTemplate_putTemplate]] +.`putTemplate()` +**** +[source,php] +---- +/* +$params['id'] = (string) The search template ID (Required) + ['body'] = (array) Request body +*/ + +$params = [ + // ... +]; + +$client = ClientBuilder::create()->build(); +$response = $client->putTemplate($params); +---- +**** + + + [[Elasticsearch_ClientfieldStats_fieldStats]] .`fieldStats()` **** diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/docs/build/Elasticsearch/ClientBuilder.asciidoc b/openml_OS/vendor/elasticsearch/elasticsearch/docs/build/Elasticsearch/ClientBuilder.asciidoc index 9f815e7e4..d8304cbe9 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/docs/build/Elasticsearch/ClientBuilder.asciidoc +++ b/openml_OS/vendor/elasticsearch/elasticsearch/docs/build/Elasticsearch/ClientBuilder.asciidoc @@ -20,6 +20,7 @@ The class defines the following methods: * <> * <> * <> +* <> * <> * <> * <> @@ -156,6 +157,19 @@ corresponds to setConnectionPool(). +[[Elasticsearch_ClientBuilderdefaultLogger_defaultLogger]] +.`defaultLogger()` +**** +[source,php] +---- +/* +*/ + +---- +**** + + + [[Elasticsearch_ClientBuildersetConnectionFactory_setConnectionFactory]] .`setConnectionFactory()` **** diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/docs/build/renderer.index b/openml_OS/vendor/elasticsearch/elasticsearch/docs/build/renderer.index index f2bb86557..64af672be 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/docs/build/renderer.index +++ b/openml_OS/vendor/elasticsearch/elasticsearch/docs/build/renderer.index @@ -1 +1 @@ -C:19:"Sami\Renderer\Index":1041:{a:3:{i:0;a:10:{s:20:"Elasticsearch\Client";s:40:"1815e70d1a9613e61fbe3bf14e3c77e4321c3b31";s:27:"Elasticsearch\ClientBuilder";s:40:"824023c8ff5d33cd7085f75ff88b436b5dde0482";s:37:"Elasticsearch\Namespaces\CatNamespace";s:40:"a9d466909dc08564e9c1516162c3a6bb91dbecbe";s:41:"Elasticsearch\Namespaces\ClusterNamespace";s:40:"577bab662735319b93ed7b555cd2b12b73e40680";s:41:"Elasticsearch\Namespaces\IndicesNamespace";s:40:"66391991c19f28764c86e9604e231b9ce004c82e";s:40:"Elasticsearch\Namespaces\IngestNamespace";s:40:"9bd2962d80e3c0cdcaedda4f23b722b3a8cfa013";s:39:"Elasticsearch\Namespaces\NodesNamespace";s:40:"da4e71f9d953d00600920c26fe585b6884e45f94";s:40:"Elasticsearch\Namespaces\RemoteNamespace";s:40:"a503f6ea82452e1ea0275a044aeb527bc946616d";s:42:"Elasticsearch\Namespaces\SnapshotNamespace";s:40:"e28a1807789b0fcca3fd6b9712ed713650cf7ac2";s:39:"Elasticsearch\Namespaces\TasksNamespace";s:40:"2de86d7ab409a629320725f6444c76d2a9313c72";}i:1;a:1:{i:0;s:6:"master";}i:2;a:2:{i:0;s:13:"Elasticsearch";i:1;s:24:"Elasticsearch\Namespaces";}}} \ No newline at end of file +C:19:"Sami\Renderer\Index":1041:{a:3:{i:0;a:10:{s:20:"Elasticsearch\Client";s:40:"6ac4061ad03df8cddeaec31a8bfb556fc7a33e71";s:27:"Elasticsearch\ClientBuilder";s:40:"30fa910e5653bf5f7096369ef1529a47da7e3e92";s:37:"Elasticsearch\Namespaces\CatNamespace";s:40:"a9d466909dc08564e9c1516162c3a6bb91dbecbe";s:41:"Elasticsearch\Namespaces\ClusterNamespace";s:40:"577bab662735319b93ed7b555cd2b12b73e40680";s:41:"Elasticsearch\Namespaces\IndicesNamespace";s:40:"66391991c19f28764c86e9604e231b9ce004c82e";s:40:"Elasticsearch\Namespaces\IngestNamespace";s:40:"9bd2962d80e3c0cdcaedda4f23b722b3a8cfa013";s:39:"Elasticsearch\Namespaces\NodesNamespace";s:40:"da4e71f9d953d00600920c26fe585b6884e45f94";s:40:"Elasticsearch\Namespaces\RemoteNamespace";s:40:"a503f6ea82452e1ea0275a044aeb527bc946616d";s:42:"Elasticsearch\Namespaces\SnapshotNamespace";s:40:"e28a1807789b0fcca3fd6b9712ed713650cf7ac2";s:39:"Elasticsearch\Namespaces\TasksNamespace";s:40:"2de86d7ab409a629320725f6444c76d2a9313c72";}i:1;a:1:{i:0;s:6:"master";}i:2;a:2:{i:0;s:13:"Elasticsearch";i:1;s:24:"Elasticsearch\Namespaces";}}} \ No newline at end of file diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/docs/community.asciidoc b/openml_OS/vendor/elasticsearch/elasticsearch/docs/community.asciidoc index efe5aa08a..9f286c746 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/docs/community.asciidoc +++ b/openml_OS/vendor/elasticsearch/elasticsearch/docs/community.asciidoc @@ -1,4 +1,4 @@ -[[community_dsls]] + == Community DSLs === ElasticsearchDSL @@ -18,15 +18,6 @@ __________________________ This agnostic package is a lightweight wrapper on top of the Elasticsearch PHP client. Its main goal is to allow for easier structuring of queries and indices in your application. It does not want to hide or replace functionality of the Elasticsearch PHP client. __________________________ -=== ElasticSearchQueryDSL - -https://github.com/gskema/elasticsearch-query-dsl-php[Link: ElasticSearchQueryDSL] - -[quote, ElasticSearchQueryDSL] -__________________________ -Feature complete, object oriented, composable, extendable ElasticSearch query DSL builder for PHP. Deliberately built to be as simple as possible, easily usable and with explicit naming. -__________________________ - == Community Integrations === Symfony @@ -121,4 +112,4 @@ _____________________ This helper is a light library which wrap the official client elasticsearch-php. It will help you to manage your ES Indices with no downtime. This helper implements the philosophy described in the https://www.elastic.co/guide/en/elasticsearch/guide/master/index-aliases.html[official documentation] which can be summarized in a few words : *use alias instead of index directly* -_____________________ +_____________________ \ No newline at end of file diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/docs/configuration.asciidoc b/openml_OS/vendor/elasticsearch/elasticsearch/docs/configuration.asciidoc index 79c266a3d..e159eee67 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/docs/configuration.asciidoc +++ b/openml_OS/vendor/elasticsearch/elasticsearch/docs/configuration.asciidoc @@ -1,4 +1,4 @@ -[[configuration]] + == Configuration Almost every aspect of the client is configurable. Most users will only need to configure a few parameters to suit @@ -60,17 +60,16 @@ Basic Auth's password contains special characters such as a pound sign (`#`) or For this reason, the client supports an extended host syntax which provides greater control over host initialization. None of the components are validated, so edge-cases like underscores domain names will not cause problems. -The extended syntax is an array of parameters for each host. The structure of the parameter list is identical to the return values of a http://php.net/manual/en/function.parse-url.php#refsect1-function.parse-url-returnvalues[`parse_url()`] call: +The extended syntax is an array of parameters for each host: [source,php] ---- $hosts = [ - // This is effectively equal to: "https://username:password!#$?*abc@foo.com:9200/elastic" + // This is effectively equal to: "https://username:password!#$?*abc@foo.com:9200/" [ 'host' => 'foo.com', 'port' => '9200', 'scheme' => 'https', - 'path' => '/elastic', 'user' => 'username', 'pass' => 'password!#$?*abc' ], @@ -90,8 +89,7 @@ scheme is `http`. === Authorization and Encryption -For details about HTTP Authorization and SSL encryption, see -<>. +For details about HTTP Authorization and SSL encryption, please see link:_security.html[Authorization and SSL]. === Set retries @@ -182,7 +180,34 @@ And then update your composer installation: php composer.phar update ---------------------------- -Once Monolog (or another logger) is installed, you need to create a log object and inject it into the client: +Once Monolog (or another logger) is installed, you need to create a log object and inject it into the client. The +`ClientBuilder` object has a helper static function that will generate a common Monolog-based logger for you. All you need +to do is provide the path to your desired logging location: + +[source,php] +---- +$logger = ClientBuilder::defaultLogger('path/to/your.log'); + +$client = ClientBuilder::create() // Instantiate a new ClientBuilder + ->setLogger($logger) // Set the logger with a default logger + ->build(); // Build the client object +---- + +You can also specify the severity of log messages that you wish to log: + +[source,php] +---- +// set severity with second parameter +$logger = ClientBuilder::defaultLogger('/path/to/logs/', Logger::INFO); + +$client = ClientBuilder::create() // Instantiate a new ClientBuilder + ->setLogger($logger) // Set the logger with a default logger + ->build(); // Build the client object +---- + +The `defaultLogger()` method is just a helper, you are not required to use it. You can create your own logger and inject +that instead: + [source,php] ---- @@ -244,8 +269,7 @@ $client = ClientBuilder::create() ->build(); ---- -For more details, please see the dedicated page on -<>. +For more details, please see the dedicated page on link:_connection_pool.html[configuring connection pools]. === Setting the Connection Selector @@ -261,8 +285,7 @@ $client = ClientBuilder::create() ->build(); ---- -For more details, please see the dedicated page on -<>. +For more details, please see the dedicated page on link:_selectors.html[configuring selectors]. === Setting the Serializer @@ -282,8 +305,7 @@ $client = ClientBuilder::create() ->build(); ---- -For more details, please see the dedicated page on -<>. +For more details, please see the dedicated page on link:_serializers.html[configuring serializers]. === Setting a custom ConnectionFactory diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/docs/connection-pool.asciidoc b/openml_OS/vendor/elasticsearch/elasticsearch/docs/connection-pool.asciidoc index 3cb22a726..192fb3dbd 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/docs/connection-pool.asciidoc +++ b/openml_OS/vendor/elasticsearch/elasticsearch/docs/connection-pool.asciidoc @@ -1,4 +1,4 @@ -[[connection_pool]] + == Connection Pool The connection pool is an object inside the client that is responsible for maintaining the current list of nodes. diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/docs/crud.asciidoc b/openml_OS/vendor/elasticsearch/elasticsearch/docs/crud.asciidoc index ec4b245e1..d778746a8 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/docs/crud.asciidoc +++ b/openml_OS/vendor/elasticsearch/elasticsearch/docs/crud.asciidoc @@ -1,4 +1,4 @@ -[[indexing_documents]] + == Indexing Documents When you add documents to Elasticsearch, you index JSON documents. This maps naturally to PHP associative arrays, since @@ -129,7 +129,6 @@ if (!empty($params['body'])) { } ---- -[[getting_documents]] == Getting Documents Elasticsearch provides realtime GETs of documents. This means that as soon as the document has been indexed and your @@ -149,7 +148,6 @@ $response = $client->get($params); ---- {zwsp} + -[[updating_documents]] == Updating Documents Updating a document allows you to either completely replace the contents of the existing document, or perform a partial @@ -214,15 +212,13 @@ $params = [ 'type' => 'my_type', 'id' => 'my_id', 'body' => [ - 'script' => [ - 'source' => 'ctx._source.counter += params.count', - 'params' => [ - 'count' => 4 - ], + 'script' => 'ctx._source.counter += count', + 'params' => [ + 'count' => 4 ], 'upsert' => [ 'counter' => 1 - ], + ] ] ]; @@ -230,7 +226,7 @@ $response = $client->update($params); ---- {zwsp} + -[[deleting_documents]] + == Deleting documents Finally, you can delete documents by specifying their full `/index/type/id` path: diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/docs/futures.asciidoc b/openml_OS/vendor/elasticsearch/elasticsearch/docs/futures.asciidoc index 4edd05a01..ceee52016 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/docs/futures.asciidoc +++ b/openml_OS/vendor/elasticsearch/elasticsearch/docs/futures.asciidoc @@ -1,4 +1,4 @@ -[[future_mode]] + == Future Mode The client offers a mode called "future" or "async" mode. This allows batch processing of requests (sent in parallel diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/docs/index-operations.asciidoc b/openml_OS/vendor/elasticsearch/elasticsearch/docs/index-operations.asciidoc index 448be4b9d..80f08d549 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/docs/index-operations.asciidoc +++ b/openml_OS/vendor/elasticsearch/elasticsearch/docs/index-operations.asciidoc @@ -1,4 +1,4 @@ -[[index_management]] + == Index Management Operations Index management operations allow you to manage the indices in your Elasticsearch cluster, such as creating, deleting and @@ -41,7 +41,7 @@ $params = [ ], 'properties' => [ 'first_name' => [ - 'type' => 'keyword', + 'type' => 'string', 'analyzer' => 'standard' ], 'age' => [ @@ -104,28 +104,28 @@ $params = [ '_default_' => [ <4> 'properties' => [ 'title' => [ - 'type' => 'keyword', + 'type' => 'string', 'analyzer' => 'reuters', 'term_vector' => 'yes', 'copy_to' => 'combined' ], 'body' => [ - 'type' => 'keyword', + 'type' => 'string', 'analyzer' => 'reuters', 'term_vector' => 'yes', 'copy_to' => 'combined' ], 'combined' => [ - 'type' => 'keyword', + 'type' => 'string', 'analyzer' => 'reuters', 'term_vector' => 'yes' ], 'topics' => [ - 'type' => 'keyword', + 'type' => 'string', 'index' => 'not_analyzed' ], 'places' => [ - 'type' => 'keyword', + 'type' => 'string', 'index' => 'not_analyzed' ] ] @@ -133,7 +133,7 @@ $params = [ 'my_type' => [ <5> 'properties' => [ 'my_field' => [ - 'type' => 'keyword' + 'type' => 'string' ] ] ] @@ -214,7 +214,7 @@ $params = [ ], 'properties' => [ 'first_name' => [ - 'type' => 'keyword', + 'type' => 'string', 'analyzer' => 'standard' ], 'age' => [ diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/docs/installation.asciidoc b/openml_OS/vendor/elasticsearch/elasticsearch/docs/installation.asciidoc index 96d9a88bb..a7547e0dc 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/docs/installation.asciidoc +++ b/openml_OS/vendor/elasticsearch/elasticsearch/docs/installation.asciidoc @@ -1,4 +1,3 @@ -[[installation]] == Installation Elasticsearch-php only has a three requirements that you need to worry about: @@ -27,8 +26,7 @@ The master branch will always track Elasticsearch master, but it is not recommen [width="40%",options="header",frame="topbot"] |============================ |Elasticsearch Version | Elasticsearch-PHP Branch -| >= 6.6, <= 6.7 | `6.7` -| >= 6.0, <= 6.5 | `6.5` +| >= 6.0 | `6.0` | >= 5.0, <= 6.0 | `5.0` | >= 1.0, <= 5.0 | `1.0`, `2.0` | <= 0.90.* | `0.4` @@ -42,7 +40,7 @@ The master branch will always track Elasticsearch master, but it is not recommen -------------------------- { "require": { - "elasticsearch/elasticsearch": "~6.7.0" + "elasticsearch/elasticsearch": "~6.0" } } -------------------------- diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/docs/namespaces.asciidoc b/openml_OS/vendor/elasticsearch/elasticsearch/docs/namespaces.asciidoc index 67feba150..05a18d1fe 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/docs/namespaces.asciidoc +++ b/openml_OS/vendor/elasticsearch/elasticsearch/docs/namespaces.asciidoc @@ -1,4 +1,4 @@ -[[namespaces]] + == Namespaces The client has a number of "namespaces", which generally expose administrative diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/docs/overview.asciidoc b/openml_OS/vendor/elasticsearch/elasticsearch/docs/overview.asciidoc index 55eef39b0..f2dda5aee 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/docs/overview.asciidoc +++ b/openml_OS/vendor/elasticsearch/elasticsearch/docs/overview.asciidoc @@ -1,4 +1,3 @@ -[[overview]] == Overview This is the official PHP client for Elasticsearch. It is designed to be a very low-level client that does not stray from the REST API. diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/docs/per-request-configuration.asciidoc b/openml_OS/vendor/elasticsearch/elasticsearch/docs/per-request-configuration.asciidoc index 0b250e621..ad33ca98d 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/docs/per-request-configuration.asciidoc +++ b/openml_OS/vendor/elasticsearch/elasticsearch/docs/per-request-configuration.asciidoc @@ -1,4 +1,4 @@ -[[per_request_configuration]] + == Per-request configuration There are several configurations that can be set on a per-request basis, rather than at a connection- or client-level. @@ -13,7 +13,7 @@ conflicts, etc. But sometimes you want to deal with the response body rather th in test suites). If you need that behavior, you can configure an `ignore` parameter. This should be configured in the `client` parameter -of the request array. For example, this example will ignore the `MissingDocument404Exception` +of the reuqest array. For example, this example will ignore the `MissingDocument404Exception` exception and instead return the JSON provided by Elasticsearch. @@ -214,28 +214,6 @@ Array ) ---- -=== Request Identification - -You can enrich your requests against Elasticsearch with an identifier string, that allows you to discover this identifier -in https://www.elastic.co/guide/en/elasticsearch/reference/6.8/logging.html#deprecation-logging[deprecation logs], to support you with -https://www.elastic.co/guide/en/elasticsearch/reference/6.8/index-modules-slowlog.html[identifying search slow log origin] -or to help with https://www.elastic.co/guide/en/elasticsearch/reference/6.8/tasks.html#_identifying_running_tasks[identifying running tasks]. - - -[source,php] ----- -$client = ClientBuilder::create()->build(); -$params = [ - 'index' => 'test', - 'id' => 1, - 'client' => [ - 'opaqueId' => 'app17@dc06.eu_user1234', <1> - ] -]; -$response = $client->get($params); ----- -<1> This will populate the `X-Opaque-Id` header with the value `app17@dc06.eu_user1234` - === Curl Timeouts It is possible to configure per-request curl timeouts via the `timeout` and `connect_timeout` parameters. These @@ -291,12 +269,11 @@ $results = $future->wait(); // resolve the future ---- Future mode supports two options: `true` or `'lazy'`. For more details about how asynchronous execution functions, and -how to work with the results, see the dedicated page on <>. +how to work with the results, see the dedicated page on <<_future_mode>>. === SSL Encryption -Normally, you will specify SSL configurations when you create the client (see -<> for more details), since encryption typically +Normally, you will specify SSL configurations when you create the client (see <<_security>> for more details), since encryption typically applies to all requests. However, it is possible to configure on a per-request basis too if you need that functionality. For example, if you need to use a self-signed cert on a specific request, you can specify it via the `verify` parameter in the client options: diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/docs/php-version-requirement.asciidoc b/openml_OS/vendor/elasticsearch/elasticsearch/docs/php-version-requirement.asciidoc index bc3cd9b5c..b45fb5aaf 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/docs/php-version-requirement.asciidoc +++ b/openml_OS/vendor/elasticsearch/elasticsearch/docs/php-version-requirement.asciidoc @@ -1,5 +1,4 @@ -[[php_version_requirement]] == PHP Version Requirement -Version 6.0 of Elasticsearch-PHP requires PHP version 7.0.0 or higher. In addition, it requires the native JSON +Version 5.0 of Elasticsearch-PHP requires PHP version 5.6.6 or higher. In addition, it requires the native JSON extension to be version 1.3.7 or higher. diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/docs/quickstart.asciidoc b/openml_OS/vendor/elasticsearch/elasticsearch/docs/quickstart.asciidoc index bd391429f..61aa73c01 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/docs/quickstart.asciidoc +++ b/openml_OS/vendor/elasticsearch/elasticsearch/docs/quickstart.asciidoc @@ -1,4 +1,4 @@ -[[quickstart]] + == Quickstart This section will give you a quick overview of the client and how the major functions work. @@ -11,7 +11,7 @@ This section will give you a quick overview of the client and how the major func ---------------------------- { "require": { - "elasticsearch/elasticsearch": "~6.7.0" + "elasticsearch/elasticsearch": "~5.0" } } ---------------------------- @@ -266,3 +266,4 @@ actions are available under the `$client` object (indexing, searching, getting, are located under the `$client->indices()` and `$client->cluster()` objects, respectively. Check out the rest of the Documentation to see how the entire client works. + diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/docs/search-operations.asciidoc b/openml_OS/vendor/elasticsearch/elasticsearch/docs/search-operations.asciidoc index 99bfaf40a..9b95393d1 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/docs/search-operations.asciidoc +++ b/openml_OS/vendor/elasticsearch/elasticsearch/docs/search-operations.asciidoc @@ -1,4 +1,3 @@ -[[search_operations]] == Search Operations Well...it isn't called elasticsearch for nothing! Let's talk about search operations in the client. @@ -231,7 +230,7 @@ This window allows consistent paging even if there is background indexing/updati request with `scroll` enabled. This returns a "page" of documents, and a scroll_id which is used to continue paginating through the hits. -More details about scrolling can be found in the https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-body.html#request-body-search-scroll[Link: reference documentation]. +More details about scrolling can be found in the https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-scroll.html[Link: reference documentation]. This is an example which can be used as a template for more advanced operations: diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/docs/security.asciidoc b/openml_OS/vendor/elasticsearch/elasticsearch/docs/security.asciidoc index 7f5dda43f..f0e632acd 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/docs/security.asciidoc +++ b/openml_OS/vendor/elasticsearch/elasticsearch/docs/security.asciidoc @@ -1,4 +1,4 @@ -[[security]] + == Security The Elasticsearch-PHP client supports two security features: HTTP Authentication and SSL encryption. diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/docs/selectors.asciidoc b/openml_OS/vendor/elasticsearch/elasticsearch/docs/selectors.asciidoc index 5da5bd7e6..f091c1f60 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/docs/selectors.asciidoc +++ b/openml_OS/vendor/elasticsearch/elasticsearch/docs/selectors.asciidoc @@ -1,4 +1,4 @@ -[[selectors]] + == Selectors The connection pool maintains the list of connections, and decides when nodes should transition from alive to dead (and @@ -37,7 +37,7 @@ better to "stick" to a single connection for the duration of the script. By default, this selector will randomize the hosts upon initialization, which will still guarantee an even distribution of load across the cluster. It changes the round-robin dynamics from per-request to per-script. -If you are using <>, the "sticky" behavior of this selector will be non-ideal, since all parallel requests +If you are using <<_future_mode>>, the "sticky" behavior of this selector will be non-ideal, since all parallel requests will go to the same node instead of multiple nodes in your cluster. When using future mode, the default `RoundRobinSelector` should be preferred. diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/docs/serializers.asciidoc b/openml_OS/vendor/elasticsearch/elasticsearch/docs/serializers.asciidoc index e367eaf77..4b90fd530 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/docs/serializers.asciidoc +++ b/openml_OS/vendor/elasticsearch/elasticsearch/docs/serializers.asciidoc @@ -1,4 +1,4 @@ -[[serializers]] + == Serializers The client has three serializers available. You will most likely never need diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/phpstan.neon b/openml_OS/vendor/elasticsearch/elasticsearch/phpstan.neon index 19a19a64c..82066adfd 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/phpstan.neon +++ b/openml_OS/vendor/elasticsearch/elasticsearch/phpstan.neon @@ -1,9 +1,12 @@ parameters: - reportUnmatchedIgnoredErrors: - false ignoreErrors: - - '#Unsafe usage of new static\(\)#' - - '#Call to static method performRequest\(\) on trait#' - - '#Constant JSON_THROW_ON_ERROR not found#' - - '#Caught class JsonException not found#' - - '#Call to method getCode\(\) on an unknown class JsonException#' \ No newline at end of file + - '#Mockery\\MockInterface::shouldReceive\(\)#' + - '#Mockery\\MockInterface given#' + - '#Mockery\\MockInterface\[\] given#' + + # because of \Elasticsearch\Tests\RegisteredNamespaceTest + - '#Call to an undefined method Elasticsearch\\Client::foo\(\)#' + - '#Call to an undefined method Elasticsearch\\Client::bar\(\)#' + + # because of \Elasticsearch\Tests\ClientBuilderTest + - '#expects Psr\\Log\\LoggerInterface, Elasticsearch\\Tests\\ClientBuilder\\DummyLogger given.$#' diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/phpunit-integration.xml b/openml_OS/vendor/elasticsearch/elasticsearch/phpunit-integration.xml new file mode 100644 index 000000000..e7cd6ddf3 --- /dev/null +++ b/openml_OS/vendor/elasticsearch/elasticsearch/phpunit-integration.xml @@ -0,0 +1,23 @@ + + + + + + + tests/Elasticsearch/Tests/YamlRunnerTest.php + + + + + src + + + diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/phpunit.xml b/openml_OS/vendor/elasticsearch/elasticsearch/phpunit.xml new file mode 100644 index 000000000..841f48eb3 --- /dev/null +++ b/openml_OS/vendor/elasticsearch/elasticsearch/phpunit.xml @@ -0,0 +1,24 @@ + + + + + + + tests + tests/Elasticsearch/Tests/YamlRunnerTest.php + + + + + src + + + diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/ruleset.xml b/openml_OS/vendor/elasticsearch/elasticsearch/ruleset.xml new file mode 100644 index 000000000..b62736b6c --- /dev/null +++ b/openml_OS/vendor/elasticsearch/elasticsearch/ruleset.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Client.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Client.php index dba53c2e4..e5648e745 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Client.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Client.php @@ -1,18 +1,4 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class Client { - const VERSION = '6.8.2'; - /** * @var Transport */ @@ -68,297 +43,206 @@ class Client protected $params; /** - * @var callable - */ - protected $endpoints; - - /** - * @var NamespaceBuilderInterface[] + * @var IndicesNamespace */ - protected $registeredNamespaces = []; + protected $indices; - /** - * @var CatNamespace - */ - protected $cat; - /** * @var ClusterNamespace */ protected $cluster; - - /** - * @var IndicesNamespace - */ - protected $indices; - - /** - * @var IngestNamespace - */ - protected $ingest; - + /** * @var NodesNamespace */ protected $nodes; - + /** * @var SnapshotNamespace */ protected $snapshot; - - /** - * @var TasksNamespace - */ - protected $tasks; - - /** - * @var CcrNamespace - */ - protected $ccr; - - /** - * @var IlmNamespace - */ - protected $ilm; - - /** - * @var SecurityNamespace - */ - protected $security; - - /** - * @var GraphNamespace - */ - protected $graph; - - /** - * @var XpackNamespace - */ - protected $xpack; - - /** - * @var LicenseNamespace - */ - protected $license; - - /** - * @var MigrationNamespace - */ - protected $migration; - - /** - * @var MlNamespace - */ - protected $ml; - - /** - * @var MonitoringNamespace - */ - protected $monitoring; - + /** - * @var RollupNamespace + * @var CatNamespace */ - protected $rollup; - + protected $cat; + /** - * @var SqlNamespace + * @var IngestNamespace */ - protected $sql; - + protected $ingest; + /** - * @var SslNamespace + * @var TasksNamespace */ - protected $ssl; - + protected $tasks; + /** - * @var WatcherNamespace + * @var RemoteNamespace */ - protected $watcher; - + protected $remote; + + /** @var callback */ + protected $endpoints; + + /** @var NamespaceBuilderInterface[] */ + protected $registeredNamespaces = []; /** * Client constructor * - * @param Transport $transport - * @param callable $endpoint + * @param Transport $transport + * @param callable $endpoint * @param AbstractNamespace[] $registeredNamespaces */ public function __construct(Transport $transport, callable $endpoint, array $registeredNamespaces) { $this->transport = $transport; $this->endpoints = $endpoint; - $this->cat = new CatNamespace($transport, $endpoint); - $this->cluster = new ClusterNamespace($transport, $endpoint); - $this->indices = new IndicesNamespace($transport, $endpoint); - $this->ingest = new IngestNamespace($transport, $endpoint); - $this->nodes = new NodesNamespace($transport, $endpoint); - $this->snapshot = new SnapshotNamespace($transport, $endpoint); - $this->tasks = new TasksNamespace($transport, $endpoint); - $this->ccr = new CcrNamespace($transport, $endpoint); - $this->ilm = new IlmNamespace($transport, $endpoint); - $this->security = new SecurityNamespace($transport, $endpoint); - $this->graph = new GraphNamespace($transport, $endpoint); - $this->xpack = new XpackNamespace($transport, $endpoint); - $this->license = new LicenseNamespace($transport, $endpoint); - $this->migration = new MigrationNamespace($transport, $endpoint); - $this->ml = new MlNamespace($transport, $endpoint); - $this->monitoring = new MonitoringNamespace($transport, $endpoint); - $this->rollup = new RollupNamespace($transport, $endpoint); - $this->sql = new SqlNamespace($transport, $endpoint); - $this->ssl = new SslNamespace($transport, $endpoint); - $this->watcher = new WatcherNamespace($transport, $endpoint); - + $this->indices = new IndicesNamespace($transport, $endpoint); + $this->cluster = new ClusterNamespace($transport, $endpoint); + $this->nodes = new NodesNamespace($transport, $endpoint); + $this->snapshot = new SnapshotNamespace($transport, $endpoint); + $this->cat = new CatNamespace($transport, $endpoint); + $this->ingest = new IngestNamespace($transport, $endpoint); + $this->tasks = new TasksNamespace($transport, $endpoint); + $this->remote = new RemoteNamespace($transport, $endpoint); $this->registeredNamespaces = $registeredNamespaces; } /** - * $params['index'] = (string) Default index for items which don't provide one - * $params['type'] = (string) Default document type for items which don't provide one - * $params['wait_for_active_shards'] = (string) Sets the number of shard copies that must be active before proceeding with the bulk operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1) - * $params['refresh'] = (enum) If `true` then refresh the effected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` (the default) then do nothing with refreshes. (Options = true,false,wait_for) - * $params['routing'] = (string) Specific routing value - * $params['timeout'] = (time) Explicit operation timeout - * $params['fields'] = (list) Default comma-separated list of fields to return in the response for updates, can be overridden on each sub-request - * $params['_source'] = (list) True or false to return the _source field or not, or default list of fields to return, can be overridden on each sub-request - * $params['_source_excludes'] = (list) Default list of fields to exclude from the returned _source field, can be overridden on each sub-request - * $params['_source_includes'] = (list) Default list of fields to extract and return from the _source field, can be overridden on each sub-request - * $params['pipeline'] = (string) The pipeline id to preprocess incoming documents with - * $params['body'] = (array) The operation definition and data (action-data pairs), separated by newlines (Required) - * - * @param array $params Associative array of parameters + * @param $params * @return array - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-bulk.html */ - public function bulk(array $params = []) + public function info($params = []) { - $index = $this->extractArgument($params, 'index'); - $type = $this->extractArgument($params, 'type'); - $body = $this->extractArgument($params, 'body'); - + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Bulk'); + + /** @var \Elasticsearch\Endpoints\Info $endpoint */ + $endpoint = $endpointBuilder('Info'); $endpoint->setParams($params); - $endpoint->setIndex($index); - $endpoint->setType($type); - $endpoint->setBody($body); return $this->performRequest($endpoint); } + /** - * $params['scroll_id'] = (list) A comma-separated list of scroll IDs to clear - * $params['body'] = (array) A comma-separated list of scroll IDs to clear if none was specified via the scroll_id parameter + * @param $params array Associative array of parameters * - * @param array $params Associative array of parameters - * @return array - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/search-request-scroll.html + * @return bool */ - public function clearScroll(array $params = []) + public function ping($params = []) { - $scroll_id = $this->extractArgument($params, 'scroll_id'); - $body = $this->extractArgument($params, 'body'); - + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('ClearScroll'); + + /** @var \Elasticsearch\Endpoints\Ping $endpoint */ + $endpoint = $endpointBuilder('Ping'); $endpoint->setParams($params); - $endpoint->setScrollId($scroll_id); - $endpoint->setBody($body); - return $this->performRequest($endpoint); + try { + $this->performRequest($endpoint); + } catch (Missing404Exception $exception) { + return false; + } catch (TransportException $exception) { + return false; + } catch (NoNodesAvailableException $exception) { + return false; + } + + return true; } + /** - * $params['index'] = (list) A comma-separated list of indices to restrict the results - * $params['type'] = (list) A comma-separated list of types to restrict the results - * $params['ignore_unavailable'] = (boolean) Whether specified concrete indices should be ignored when unavailable (missing or closed) - * $params['ignore_throttled'] = (boolean) Whether specified concrete, expanded or aliased indices should be ignored when throttled - * $params['allow_no_indices'] = (boolean) Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) - * $params['expand_wildcards'] = (enum) Whether to expand wildcard expression to concrete indices that are open, closed or both. (Options = open,closed,none,all) (Default = open) - * $params['min_score'] = (number) Include only documents with a specific `_score` value in the result - * $params['preference'] = (string) Specify the node or shard the operation should be performed on (default: random) - * $params['routing'] = (list) A comma-separated list of specific routing values - * $params['q'] = (string) Query in the Lucene query string syntax - * $params['analyzer'] = (string) The analyzer to use for the query string - * $params['analyze_wildcard'] = (boolean) Specify whether wildcard and prefix queries should be analyzed (default: false) - * $params['default_operator'] = (enum) The default operator for query string query (AND or OR) (Options = AND,OR) (Default = OR) - * $params['df'] = (string) The field to use as default where no field prefix is given in the query string - * $params['lenient'] = (boolean) Specify whether format-based query failures (such as providing text to a numeric field) should be ignored - * $params['terminate_after'] = (number) The maximum count for each shard, upon reaching which the query execution will terminate early - * $params['body'] = (array) A query to restrict the results specified with the Query DSL (optional) - * - * @param array $params Associative array of parameters + * $params['id'] = (string) The document ID (Required) + * ['index'] = (string) The name of the index (Required) + * ['type'] = (string) The type of the document (use `_all` to fetch the first document matching the ID across all types) (Required) + * ['ignore_missing'] = ?? + * ['fields'] = (list) A comma-separated list of fields to return in the response + * ['parent'] = (string) The ID of the parent document + * ['preference'] = (string) Specify the node or shard the operation should be performed on (default: random) + * ['realtime'] = (boolean) Specify whether to perform the operation in realtime or search mode + * ['refresh'] = (boolean) Refresh the shard containing the document before performing the operation + * ['routing'] = (string) Specific routing value + * ['_source'] = (list) True or false to return the _source field or not, or a list of fields to return + * ['_source_exclude'] = (list) A list of fields to exclude from the returned _source field + * ['_source_include'] = (list) A list of fields to extract and return from the _source field + * + * @param $params array Associative array of parameters + * * @return array - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/search-count.html */ - public function count(array $params = []) + public function get($params) { + $id = $this->extractArgument($params, 'id'); $index = $this->extractArgument($params, 'index'); $type = $this->extractArgument($params, 'type'); - $body = $this->extractArgument($params, 'body'); + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Count'); + + /** @var \Elasticsearch\Endpoints\Get $endpoint */ + $endpoint = $endpointBuilder('Get'); + $endpoint->setID($id) + ->setIndex($index) + ->setType($type); $endpoint->setParams($params); - $endpoint->setIndex($index); - $endpoint->setType($type); - $endpoint->setBody($body); return $this->performRequest($endpoint); } + /** - * $params['id'] = (string) Document ID (Required) - * $params['index'] = (string) The name of the index (Required) - * $params['type'] = (string) The type of the document (Required) - * $params['wait_for_active_shards'] = (string) Sets the number of shard copies that must be active before proceeding with the index operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1) - * $params['parent'] = (string) ID of the parent document - * $params['refresh'] = (enum) If `true` then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` (the default) then do nothing with refreshes. (Options = true,false,wait_for) - * $params['routing'] = (string) Specific routing value - * $params['timeout'] = (time) Explicit operation timeout - * $params['version'] = (number) Explicit version number for concurrency control - * $params['version_type'] = (enum) Specific version type (Options = internal,external,external_gte,force) - * $params['pipeline'] = (string) The pipeline id to preprocess incoming documents with - * $params['body'] = (array) The document (Required) - * - * @param array $params Associative array of parameters + * $params['id'] = (string) The document ID (Required) + * ['index'] = (string) The name of the index (Required) + * ['type'] = (string) The type of the document (use `_all` to fetch the first document matching the ID across all types) (Required) + * ['ignore_missing'] = ?? + * ['parent'] = (string) The ID of the parent document + * ['preference'] = (string) Specify the node or shard the operation should be performed on (default: random) + * ['realtime'] = (boolean) Specify whether to perform the operation in realtime or search mode + * ['refresh'] = (boolean) Refresh the shard containing the document before performing the operation + * ['routing'] = (string) Specific routing value + * + * @param $params array Associative array of parameters + * * @return array - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-index_.html */ - public function create(array $params = []) + public function getSource($params) { $id = $this->extractArgument($params, 'id'); $index = $this->extractArgument($params, 'index'); $type = $this->extractArgument($params, 'type'); - $body = $this->extractArgument($params, 'body'); + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Create'); + + /** @var \Elasticsearch\Endpoints\Get $endpoint */ + $endpoint = $endpointBuilder('Get'); + $endpoint->setID($id) + ->setIndex($index) + ->setType($type) + ->returnOnlySource(); $endpoint->setParams($params); - $endpoint->setId($id); - $endpoint->setIndex($index); - $endpoint->setType($type); - $endpoint->setBody($body); return $this->performRequest($endpoint); } + /** - * $params['id'] = (string) The document ID (Required) - * $params['index'] = (string) The name of the index (Required) - * $params['type'] = (string) The type of the document (Required) - * $params['wait_for_active_shards'] = (string) Sets the number of shard copies that must be active before proceeding with the delete operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1) - * $params['parent'] = (string) ID of parent document - * $params['refresh'] = (enum) If `true` then refresh the effected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` (the default) then do nothing with refreshes. (Options = true,false,wait_for) - * $params['routing'] = (string) Specific routing value - * $params['timeout'] = (time) Explicit operation timeout - * $params['if_seq_no'] = (number) only perform the delete operation if the last operation that has changed the document has the specified sequence number - * $params['if_primary_term'] = (number) only perform the delete operation if the last operation that has changed the document has the specified primary term - * $params['version'] = (number) Explicit version number for concurrency control - * $params['version_type'] = (enum) Specific version type (Options = internal,external,external_gte,force) - * - * @param array $params Associative array of parameters + * $params['id'] = (string) The document ID (Required) + * ['index'] = (string) The name of the index (Required) + * ['type'] = (string) The type of the document (Required) + * ['consistency'] = (enum) Specific write consistency setting for the operation + * ['parent'] = (string) ID of parent document + * ['refresh'] = (boolean) Refresh the index after performing the operation + * ['replication'] = (enum) Specific replication type + * ['routing'] = (string) Specific routing value + * ['timeout'] = (time) Explicit operation timeout + * ['version_type'] = (enum) Specific version type + * + * @param $params array Associative array of parameters + * * @return array - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-delete.html */ - public function delete(array $params = []) + public function delete($params) { $id = $this->extractArgument($params, 'id'); $index = $this->extractArgument($params, 'index'); @@ -367,1065 +251,1244 @@ public function delete(array $params = []) $this->verifyNotNullOrEmpty("id", $id); $this->verifyNotNullOrEmpty("type", $type); $this->verifyNotNullOrEmpty("index", $index); - + + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; + + /** @var \Elasticsearch\Endpoints\Delete $endpoint */ $endpoint = $endpointBuilder('Delete'); + $endpoint->setID($id) + ->setIndex($index) + ->setType($type); $endpoint->setParams($params); - $endpoint->setId($id); - $endpoint->setIndex($index); - $endpoint->setType($type); return $this->performRequest($endpoint); } + /** - * $params['index'] = (list) A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices (Required) - * $params['type'] = (list) A comma-separated list of document types to search; leave empty to perform the operation on all types - * $params['analyzer'] = (string) The analyzer to use for the query string - * $params['analyze_wildcard'] = (boolean) Specify whether wildcard and prefix queries should be analyzed (default: false) - * $params['default_operator'] = (enum) The default operator for query string query (AND or OR) (Options = AND,OR) (Default = OR) - * $params['df'] = (string) The field to use as default where no field prefix is given in the query string - * $params['from'] = (number) Starting offset (default: 0) - * $params['ignore_unavailable'] = (boolean) Whether specified concrete indices should be ignored when unavailable (missing or closed) - * $params['allow_no_indices'] = (boolean) Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) - * $params['conflicts'] = (enum) What to do when the delete by query hits version conflicts? (Options = abort,proceed) (Default = abort) - * $params['expand_wildcards'] = (enum) Whether to expand wildcard expression to concrete indices that are open, closed or both. (Options = open,closed,none,all) (Default = open) - * $params['lenient'] = (boolean) Specify whether format-based query failures (such as providing text to a numeric field) should be ignored - * $params['preference'] = (string) Specify the node or shard the operation should be performed on (default: random) - * $params['q'] = (string) Query in the Lucene query string syntax - * $params['routing'] = (list) A comma-separated list of specific routing values - * $params['scroll'] = (time) Specify how long a consistent view of the index should be maintained for scrolled search - * $params['search_type'] = (enum) Search operation type (Options = query_then_fetch,dfs_query_then_fetch) - * $params['search_timeout'] = (time) Explicit timeout for each search request. Defaults to no timeout. - * $params['size'] = (number) Number of hits to return (default: 10) - * $params['sort'] = (list) A comma-separated list of : pairs - * $params['_source'] = (list) True or false to return the _source field or not, or a list of fields to return - * $params['_source_excludes'] = (list) A list of fields to exclude from the returned _source field - * $params['_source_includes'] = (list) A list of fields to extract and return from the _source field - * $params['terminate_after'] = (number) The maximum number of documents to collect for each shard, upon reaching which the query execution will terminate early. - * $params['stats'] = (list) Specific 'tag' of the request for logging and statistical purposes - * $params['version'] = (boolean) Specify whether to return document version as part of a hit - * $params['request_cache'] = (boolean) Specify if request cache should be used for this request or not, defaults to index level setting - * $params['refresh'] = (boolean) Should the effected indexes be refreshed? - * $params['timeout'] = (time) Time each individual bulk request should wait for shards that are unavailable. (Default = 1m) - * $params['wait_for_active_shards'] = (string) Sets the number of shard copies that must be active before proceeding with the delete by query operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1) - * $params['scroll_size'] = (number) Size on the scroll request powering the delete by query - * $params['wait_for_completion'] = (boolean) Should the request should block until the delete by query is complete. (Default = true) - * $params['requests_per_second'] = (number) The throttle for this request in sub-requests per second. -1 means no throttle. (Default = 0) - * $params['slices'] = (number) The number of slices this task should be divided into. Defaults to 1 meaning the task isn't sliced into subtasks. (Default = 1) - * $params['body'] = (array) The search definition using the Query DSL (Required) - * - * @param array $params Associative array of parameters + * + * $params['_source'] = (list) True or false to return the _source field or not, or a list of fields to return + * ['_source_exclude'] = (array) A list of fields to exclude from the returned _source field + * ['_source_include'] = (array) A list of fields to extract and return from the _source field + * ['allow_no_indices'] = (bool) Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) + * ['analyze_wildcard'] = (bool) Specify whether wildcard and prefix queries should be analyzed (default: false) + * ['analyzer'] = (string) The analyzer to use for the query string + * ['conflicts'] = (enum) What to do when the delete-by-query hits version conflicts? + * ['default_operator'] = (enum) The default operator for query string query (AND or OR) + * ['df'] = (string) The field to use as default where no field prefix is given in the query string + * ['expand_wildcards'] = (enum) Whether to expand wildcard expression to concrete indices that are open, closed or both. + * ['from'] = (number) Starting offset (default: 0) + * ['ignore_unavailable'] = (bool) Whether specified concrete indices should be ignored when unavailable (missing or closed) + * ['lenient'] = (bool) Specify whether format-based query failures (such as providing text to a numeric field) should be ignored + * ['preference'] = (string) Specify the node or shard the operation should be performed on (default: random) + * ['q'] = (string) Query in the Lucene query string syntax + * ['refresh'] = (bool) Should the effected indexes be refreshed? + * ['request_cache'] = (bool) Specify if request cache should be used for this request or not, defaults to index level setting + * ['requests_per_second'] = (number) The throttle for this request in sub-requests per second. -1 means no throttle. + * ['routing'] = (array) A comma-separated list of specific routing values + * ['scroll'] = (number) Specify how long a consistent view of the index should be maintained for scrolled search + * ['scroll_size'] = (number) Size on the scroll request powering the update_by_query + * ['search_timeout'] = (number) Explicit timeout for each search request. Defaults to no timeout. + * ['search_type'] = (enum) Search operation type + * ['size'] = (number) Number of hits to return (default: 10) + * ['slices'] = (integer) The number of slices this task should be divided into. Defaults to 1 meaning the task isn't sliced into subtasks. + * ['sort'] = (array) A comma-separated list of : pairs + * ['stats'] = (array) Specific 'tag' of the request for logging and statistical purposes + * ['terminate_after'] = (number) The maximum number of documents to collect for each shard, upon reaching which the query execution will terminate early. + * ['timeout'] = (number) Time each individual bulk request should wait for shards that are unavailable. + * ['version'] = (bool) Specify whether to return document version as part of a hit + * ['wait_for_active_shards'] = (string) Sets the number of shard copies that must be active before proceeding with the delete by query operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1) + * ['wait_for_completion'] = (bool) Should the request should block until the delete-by-query is complete. + * + * @param array $params + * * @return array - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-delete-by-query.html */ - public function deleteByQuery(array $params = []) + public function deleteByQuery($params = array()) { $index = $this->extractArgument($params, 'index'); + $type = $this->extractArgument($params, 'type'); + $body = $this->extractArgument($params, 'body'); + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; + + /** @var \Elasticsearch\Endpoints\DeleteByQuery $endpoint */ $endpoint = $endpointBuilder('DeleteByQuery'); + $endpoint->setIndex($index) + ->setType($type) + ->setBody($body); $endpoint->setParams($params); - $endpoint->setIndex($index); - $endpoint->setType($type); - $endpoint->setBody($body); return $this->performRequest($endpoint); } + /** - * $params['task_id'] = (string) The task id to rethrottle (Required) - * $params['requests_per_second'] = (number) The throttle to set on this request in floating sub-requests per second. -1 means set no throttle. (Required) + * $params['index'] = (list) A comma-separated list of indices to restrict the results + * ['type'] = (list) A comma-separated list of types to restrict the results + * ['min_score'] = (number) Include only documents with a specific `_score` value in the result + * ['preference'] = (string) Specify the node or shard the operation should be performed on (default: random) + * ['routing'] = (string) Specific routing value + * ['source'] = (string) The URL-encoded query definition (instead of using the request body) + * ['body'] = (array) A query to restrict the results (optional) + * ['ignore_unavailable'] = (bool) Whether specified concrete indices should be ignored when unavailable (missing or closed) + * ['allow_no_indices'] = (bool) Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) + * ['expand_wildcards'] = (enum) Whether to expand wildcard expression to concrete indices that are open, closed or both. + * + * @param $params array Associative array of parameters * - * @param array $params Associative array of parameters * @return array - * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete-by-query.html */ - public function deleteByQueryRethrottle(array $params = []) + public function count($params = array()) { - $task_id = $this->extractArgument($params, 'task_id'); + $index = $this->extractArgument($params, 'index'); + $type = $this->extractArgument($params, 'type'); + $body = $this->extractArgument($params, 'body'); + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('DeleteByQueryRethrottle'); + + /** @var \Elasticsearch\Endpoints\Count $endpoint */ + $endpoint = $endpointBuilder('Count'); + $endpoint->setIndex($index) + ->setType($type) + ->setBody($body); $endpoint->setParams($params); - $endpoint->setTaskId($task_id); return $this->performRequest($endpoint); } + /** - * $params['id'] = (string) Script ID (Required) - * $params['timeout'] = (time) Explicit operation timeout - * $params['master_timeout'] = (time) Specify timeout for connection to master + * $params['index'] = (list) A comma-separated list of indices to restrict the results + * ['type'] = (list) A comma-separated list of types to restrict the results + * ['id'] = (string) ID of document + * ['ignore_unavailable'] = (boolean) Whether specified concrete indices should be ignored when unavailable (missing or closed) + * ['preference'] = (string) Specify the node or shard the operation should be performed on (default: random) + * ['routing'] = (string) Specific routing value + * ['allow_no_indices'] = (boolean) Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) + * ['body'] = (array) A query to restrict the results (optional) + * ['ignore_unavailable'] = (bool) Whether specified concrete indices should be ignored when unavailable (missing or closed) + * ['percolate_index'] = (string) The index to count percolate the document into. Defaults to index. + * ['expand_wildcards'] = (enum) Whether to expand wildcard expression to concrete indices that are open, closed or both. + * ['version'] = (number) Explicit version number for concurrency control + * ['version_type'] = (enum) Specific version type + * + * @param $params array Associative array of parameters * - * @param array $params Associative array of parameters * @return array - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-scripting.html + * + * @deprecated */ - public function deleteScript(array $params = []) + public function countPercolate($params = array()) { - $id = $this->extractArgument($params, 'id'); + $index = $this->extractArgument($params, 'index'); + $type = $this->extractArgument($params, 'type'); + $id = $this->extractArgument($params, 'id'); + $body = $this->extractArgument($params, 'body'); + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('DeleteScript'); + + /** @var \Elasticsearch\Endpoints\CountPercolate $endpoint */ + $endpoint = $endpointBuilder('CountPercolate'); + $endpoint->setIndex($index) + ->setType($type) + ->setID($id) + ->setBody($body); $endpoint->setParams($params); - $endpoint->setId($id); return $this->performRequest($endpoint); } + /** - * $params['id'] = (string) The document ID (Required) - * $params['index'] = (string) The name of the index (Required) - * $params['type'] = (string) The type of the document (use `_all` to fetch the first document matching the ID across all types) (Required) - * $params['stored_fields'] = (list) A comma-separated list of stored fields to return in the response - * $params['parent'] = (string) The ID of the parent document - * $params['preference'] = (string) Specify the node or shard the operation should be performed on (default: random) - * $params['realtime'] = (boolean) Specify whether to perform the operation in realtime or search mode - * $params['refresh'] = (boolean) Refresh the shard containing the document before performing the operation - * $params['routing'] = (string) Specific routing value - * $params['_source'] = (list) True or false to return the _source field or not, or a list of fields to return - * $params['_source_excludes'] = (list) A list of fields to exclude from the returned _source field - * $params['_source_includes'] = (list) A list of fields to extract and return from the _source field - * $params['version'] = (number) Explicit version number for concurrency control - * $params['version_type'] = (enum) Specific version type (Options = internal,external,external_gte,force) - * - * @param array $params Associative array of parameters - * @return bool - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-get.html + * $params['index'] = (string) The name of the index with a registered percolator query (Required) + * ['type'] = (string) The document type (Required) + * ['prefer_local'] = (boolean) With `true`, specify that a local shard should be used if available, with `false`, use a random shard (default: true) + * ['body'] = (array) The document (`doc`) to percolate against registered queries; optionally also a `query` to limit the percolation to specific registered queries + * + * @param $params array Associative array of parameters + * + * @return array + * + * @deprecated */ - public function exists(array $params = []): bool + public function percolate($params) { - $id = $this->extractArgument($params, 'id'); $index = $this->extractArgument($params, 'index'); - $type = $this->extractArgument($params, 'type'); - - // manually make this verbose so we can check status code - $params['client']['verbose'] = true; + $type = $this->extractArgument($params, 'type'); + $id = $this->extractArgument($params, 'id'); + $body = $this->extractArgument($params, 'body'); + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Exists'); + + /** @var \Elasticsearch\Endpoints\Percolate $endpoint */ + $endpoint = $endpointBuilder('Percolate'); + $endpoint->setIndex($index) + ->setType($type) + ->setID($id) + ->setBody($body); $endpoint->setParams($params); - $endpoint->setId($id); - $endpoint->setIndex($index); - $endpoint->setType($type); - return BooleanRequestWrapper::performRequest($endpoint, $this->transport); + return $this->performRequest($endpoint); } + /** - * $params['id'] = (string) The document ID (Required) - * $params['index'] = (string) The name of the index (Required) - * $params['type'] = (string) The type of the document; use `_all` to fetch the first document matching the ID across all types (Required) - * $params['parent'] = (string) The ID of the parent document - * $params['preference'] = (string) Specify the node or shard the operation should be performed on (default: random) - * $params['realtime'] = (boolean) Specify whether to perform the operation in realtime or search mode - * $params['refresh'] = (boolean) Refresh the shard containing the document before performing the operation - * $params['routing'] = (string) Specific routing value - * $params['_source'] = (list) True or false to return the _source field or not, or a list of fields to return - * $params['_source_excludes'] = (list) A list of fields to exclude from the returned _source field - * $params['_source_includes'] = (list) A list of fields to extract and return from the _source field - * $params['version'] = (number) Explicit version number for concurrency control - * $params['version_type'] = (enum) Specific version type (Options = internal,external,external_gte,force) - * - * @param array $params Associative array of parameters - * @return bool - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-get.html + * $params['index'] = (string) Default index for items which don't provide one + * ['type'] = (string) Default document type for items which don't provide one + * ['ignore_unavailable'] = (boolean) Whether specified concrete indices should be ignored when unavailable (missing or closed) + * ['allow_no_indices'] = (boolean) Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) + * ['expand_wildcards'] = (enum) Whether to expand wildcard expression to concrete indices that are open, closed or both. + * + * @param $params array Associative array of parameters + * + * @return array + * + * @deprecated */ - public function existsSource(array $params = []): bool + public function mpercolate($params = array()) { - $id = $this->extractArgument($params, 'id'); $index = $this->extractArgument($params, 'index'); $type = $this->extractArgument($params, 'type'); + $body = $this->extractArgument($params, 'body'); - // manually make this verbose so we can check status code - $params['client']['verbose'] = true; - + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('ExistsSource'); + + /** @var \Elasticsearch\Endpoints\MPercolate $endpoint */ + $endpoint = $endpointBuilder('MPercolate'); + $endpoint->setIndex($index) + ->setType($type) + ->setBody($body); $endpoint->setParams($params); - $endpoint->setId($id); - $endpoint->setIndex($index); - $endpoint->setType($type); - return BooleanRequestWrapper::performRequest($endpoint, $this->transport); + return $this->performRequest($endpoint); } + /** - * $params['id'] = (string) The document ID (Required) - * $params['index'] = (string) The name of the index (Required) - * $params['type'] = (string) The type of the document (Required) - * $params['analyze_wildcard'] = (boolean) Specify whether wildcards and prefix queries in the query string query should be analyzed (default: false) - * $params['analyzer'] = (string) The analyzer for the query string query - * $params['default_operator'] = (enum) The default operator for query string query (AND or OR) (Options = AND,OR) (Default = OR) - * $params['df'] = (string) The default field for query string query (default: _all) - * $params['stored_fields'] = (list) A comma-separated list of stored fields to return in the response - * $params['lenient'] = (boolean) Specify whether format-based query failures (such as providing text to a numeric field) should be ignored - * $params['parent'] = (string) The ID of the parent document - * $params['preference'] = (string) Specify the node or shard the operation should be performed on (default: random) - * $params['q'] = (string) Query in the Lucene query string syntax - * $params['routing'] = (string) Specific routing value - * $params['_source'] = (list) True or false to return the _source field or not, or a list of fields to return - * $params['_source_excludes'] = (list) A list of fields to exclude from the returned _source field - * $params['_source_includes'] = (list) A list of fields to extract and return from the _source field - * $params['body'] = (array) The query definition using the Query DSL - * - * @param array $params Associative array of parameters + * $params['index'] = (string) Default index for items which don't provide one + * ['type'] = (string) Default document type for items which don't provide one + * ['term_statistics'] = (boolean) Specifies if total term frequency and document frequency should be returned. Applies to all returned documents unless otherwise specified in body \"params\" or \"docs\"." + * ['field_statistics'] = (boolean) Specifies if document count, sum of document frequencies and sum of total term frequencies should be returned. Applies to all returned documents unless otherwise specified in body \"params\" or \"docs\"." + * ['fields'] = (list) A comma-separated list of fields to return. Applies to all returned documents unless otherwise specified in body \"params\" or \"docs\"." + * ['offsets'] = (boolean) Specifies if term offsets should be returned. Applies to all returned documents unless otherwise specified in body \"params\" or \"docs\"." + * ['positions'] = (boolean) Specifies if term positions should be returned. Applies to all returned documents unless otherwise specified in body \"params\" or \"docs\"." + * ['payloads'] = (boolean) Specifies if term payloads should be returned. Applies to all returned documents unless otherwise specified in body \"params\" or \"docs\". + * ['preference'] = (string) Specify the node or shard the operation should be performed on (default: random) .Applies to all returned documents unless otherwise specified in body \"params\" or \"docs\". + * ['routing'] = (string) Specific routing value. Applies to all returned documents unless otherwise specified in body \"params\" or \"docs\". + * ['parent'] = (string) Parent id of documents. Applies to all returned documents unless otherwise specified in body \"params\" or \"docs\". + * ['realtime'] = (boolean) Specifies if request is real-time as opposed to near-real-time (default: true). + * + * @param $params array Associative array of parameters + * * @return array - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/search-explain.html */ - public function explain(array $params = []) + public function termvectors($params = array()) { - $id = $this->extractArgument($params, 'id'); $index = $this->extractArgument($params, 'index'); - $type = $this->extractArgument($params, 'type'); - $body = $this->extractArgument($params, 'body'); + $type = $this->extractArgument($params, 'type'); + $id = $this->extractArgument($params, 'id'); + $body = $this->extractArgument($params, 'body'); + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Explain'); + + /** @var \Elasticsearch\Endpoints\TermVectors $endpoint */ + $endpoint = $endpointBuilder('TermVectors'); + $endpoint->setIndex($index) + ->setType($type) + ->setID($id) + ->setBody($body); $endpoint->setParams($params); - $endpoint->setId($id); - $endpoint->setIndex($index); - $endpoint->setType($type); - $endpoint->setBody($body); return $this->performRequest($endpoint); } + /** - * $params['index'] = (list) A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices - * $params['fields'] = (list) A comma-separated list of field names - * $params['ignore_unavailable'] = (boolean) Whether specified concrete indices should be ignored when unavailable (missing or closed) - * $params['allow_no_indices'] = (boolean) Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) - * $params['expand_wildcards'] = (enum) Whether to expand wildcard expression to concrete indices that are open, closed or both. (Options = open,closed,none,all) (Default = open) - * $params['body'] = (array) Field json objects containing an array of field names - * - * @param array $params Associative array of parameters + * $params['index'] = (string) Default index for items which don't provide one + * ['type'] = (string) Default document type for items which don't provide one + * ['ids'] = (list) A comma-separated list of documents ids. You must define ids as parameter or set \"ids\" or \"docs\" in the request body + * ['term_statistics'] = (boolean) Specifies if total term frequency and document frequency should be returned. Applies to all returned documents unless otherwise specified in body \"params\" or \"docs\"." + * ['field_statistics'] = (boolean) Specifies if document count, sum of document frequencies and sum of total term frequencies should be returned. Applies to all returned documents unless otherwise specified in body \"params\" or \"docs\"." + * ['fields'] = (list) A comma-separated list of fields to return. Applies to all returned documents unless otherwise specified in body \"params\" or \"docs\"." + * ['offsets'] = (boolean) Specifies if term offsets should be returned. Applies to all returned documents unless otherwise specified in body \"params\" or \"docs\"." + * ['positions'] = (boolean) Specifies if term positions should be returned. Applies to all returned documents unless otherwise specified in body \"params\" or \"docs\"." + * ['payloads'] = (boolean) Specifies if term payloads should be returned. Applies to all returned documents unless otherwise specified in body \"params\" or \"docs\". + * ['preference'] = (string) Specify the node or shard the operation should be performed on (default: random) .Applies to all returned documents unless otherwise specified in body \"params\" or \"docs\". + * ['routing'] = (string) Specific routing value. Applies to all returned documents unless otherwise specified in body \"params\" or \"docs\". + * ['parent'] = (string) Parent id of documents. Applies to all returned documents unless otherwise specified in body \"params\" or \"docs\". + * ['realtime'] = (boolean) Specifies if request is real-time as opposed to near-real-time (default: true). + * + * @param $params array Associative array of parameters + * * @return array - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/search-field-caps.html */ - public function fieldCaps(array $params = []) + public function mtermvectors($params = array()) { $index = $this->extractArgument($params, 'index'); - $body = $this->extractArgument($params, 'body'); + $type = $this->extractArgument($params, 'type'); + $body = $this->extractArgument($params, 'body'); + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('FieldCaps'); + + /** @var \Elasticsearch\Endpoints\MTermVectors $endpoint */ + $endpoint = $endpointBuilder('MTermVectors'); + $endpoint->setIndex($index) + ->setType($type) + ->setBody($body); $endpoint->setParams($params); - $endpoint->setIndex($index); - $endpoint->setBody($body); return $this->performRequest($endpoint); } + /** - * $params['id'] = (string) The document ID (Required) - * $params['index'] = (string) The name of the index (Required) - * $params['type'] = (string) The type of the document (use `_all` to fetch the first document matching the ID across all types) (Required) - * $params['stored_fields'] = (list) A comma-separated list of stored fields to return in the response - * $params['parent'] = (string) The ID of the parent document - * $params['preference'] = (string) Specify the node or shard the operation should be performed on (default: random) - * $params['realtime'] = (boolean) Specify whether to perform the operation in realtime or search mode - * $params['refresh'] = (boolean) Refresh the shard containing the document before performing the operation - * $params['routing'] = (string) Specific routing value - * $params['_source'] = (list) True or false to return the _source field or not, or a list of fields to return - * $params['_source_excludes'] = (list) A list of fields to exclude from the returned _source field - * $params['_source_includes'] = (list) A list of fields to extract and return from the _source field - * $params['_source_exclude'] = (list) A list of fields to exclude from the returned _source field - * $params['_source_include'] = (list) A list of fields to extract and return from the _source field - * $params['version'] = (number) Explicit version number for concurrency control - * $params['version_type'] = (enum) Specific version type (Options = internal,external,external_gte,force) - * - * @param array $params Associative array of parameters - * @return array - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-get.html + * $params['id'] = (string) The document ID (Required) + * ['index'] = (string) The name of the index (Required) + * ['type'] = (string) The type of the document (use `_all` to fetch the first document matching the ID across all types) (Required) + * ['parent'] = (string) The ID of the parent document + * ['preference'] = (string) Specify the node or shard the operation should be performed on (default: random) + * ['realtime'] = (boolean) Specify whether to perform the operation in realtime or search mode + * ['refresh'] = (boolean) Refresh the shard containing the document before performing the operation + * ['routing'] = (string) Specific routing value + * + * @param $params array Associative array of parameters + * + * @return array | boolean */ - public function get(array $params = []) + public function exists($params) { $id = $this->extractArgument($params, 'id'); $index = $this->extractArgument($params, 'index'); $type = $this->extractArgument($params, 'type'); + //manually make this verbose so we can check status code + $params['client']['verbose'] = true; + + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Get'); + + /** @var \Elasticsearch\Endpoints\Exists $endpoint */ + $endpoint = $endpointBuilder('Exists'); + $endpoint->setID($id) + ->setIndex($index) + ->setType($type); $endpoint->setParams($params); - $endpoint->setId($id); - $endpoint->setIndex($index); - $endpoint->setType($type); - return $this->performRequest($endpoint); + return BooleanRequestWrapper::performRequest($endpoint, $this->transport); } + /** - * $params['id'] = (string) Script ID (Required) - * $params['master_timeout'] = (time) Specify timeout for connection to master + * $params['index'] = (string) The name of the index + * ['type'] = (string) The type of the document + * ['fields'] = (list) A comma-separated list of fields to return in the response + * ['parent'] = (string) The ID of the parent document + * ['preference'] = (string) Specify the node or shard the operation should be performed on (default: random) + * ['realtime'] = (boolean) Specify whether to perform the operation in realtime or search mode + * ['refresh'] = (boolean) Refresh the shard containing the document before performing the operation + * ['routing'] = (string) Specific routing value + * ['body'] = (array) Document identifiers; can be either `docs` (containing full document information) or `ids` (when index and type is provided in the URL. + * ['_source'] = (list) True or false to return the _source field or not, or a list of fields to return + * ['_source_exclude'] = (list) A list of fields to exclude from the returned _source field + * ['_source_include'] = (list) A list of fields to extract and return from the _source field + * + * @param $params array Associative array of parameters * - * @param array $params Associative array of parameters * @return array - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-scripting.html */ - public function getScript(array $params = []) + public function mget($params = array()) { - $id = $this->extractArgument($params, 'id'); + $index = $this->extractArgument($params, 'index'); + $type = $this->extractArgument($params, 'type'); + $body = $this->extractArgument($params, 'body'); + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('GetScript'); + + /** @var \Elasticsearch\Endpoints\Mget $endpoint */ + $endpoint = $endpointBuilder('Mget'); + $endpoint->setIndex($index) + ->setType($type) + ->setBody($body); $endpoint->setParams($params); - $endpoint->setId($id); return $this->performRequest($endpoint); } + /** - * $params['id'] = (string) The document ID (Required) - * $params['index'] = (string) The name of the index (Required) - * $params['type'] = (string) The type of the document; use `_all` to fetch the first document matching the ID across all types (Required) - * $params['parent'] = (string) The ID of the parent document - * $params['preference'] = (string) Specify the node or shard the operation should be performed on (default: random) - * $params['realtime'] = (boolean) Specify whether to perform the operation in realtime or search mode - * $params['refresh'] = (boolean) Refresh the shard containing the document before performing the operation - * $params['routing'] = (string) Specific routing value - * $params['_source'] = (list) True or false to return the _source field or not, or a list of fields to return - * $params['_source_excludes'] = (list) A list of fields to exclude from the returned _source field - * $params['_source_includes'] = (list) A list of fields to extract and return from the _source field - * $params['version'] = (number) Explicit version number for concurrency control - * $params['version_type'] = (enum) Specific version type (Options = internal,external,external_gte,force) - * - * @param array $params Associative array of parameters + * $params['index'] = (list) A comma-separated list of index names to use as default + * ['type'] = (list) A comma-separated list of document types to use as default + * ['search_type'] = (enum) Search operation type + * ['body'] = (array|string) The request definitions (metadata-search request definition pairs), separated by newlines + * + * @param $params array Associative array of parameters + * * @return array - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-get.html */ - public function getSource(array $params = []) + public function msearch($params = array()) { - $id = $this->extractArgument($params, 'id'); $index = $this->extractArgument($params, 'index'); $type = $this->extractArgument($params, 'type'); + $body = $this->extractArgument($params, 'body'); + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('GetSource'); + + /** @var \Elasticsearch\Endpoints\Msearch $endpoint */ + $endpoint = $endpointBuilder('Msearch'); + $endpoint->setIndex($index) + ->setType($type) + ->setBody($body); $endpoint->setParams($params); - $endpoint->setId($id); - $endpoint->setIndex($index); - $endpoint->setType($type); return $this->performRequest($endpoint); } + /** - * $params['id'] = (string) Document ID - * $params['index'] = (string) The name of the index (Required) - * $params['type'] = (string) The type of the document (Required) - * $params['wait_for_active_shards'] = (string) Sets the number of shard copies that must be active before proceeding with the index operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1) - * $params['op_type'] = (enum) Explicit operation type (Options = index,create) (Default = index) - * $params['parent'] = (string) ID of the parent document - * $params['refresh'] = (enum) If `true` then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` (the default) then do nothing with refreshes. (Options = true,false,wait_for) - * $params['routing'] = (string) Specific routing value - * $params['timeout'] = (time) Explicit operation timeout - * $params['version'] = (number) Explicit version number for concurrency control - * $params['version_type'] = (enum) Specific version type (Options = internal,external,external_gte,force) - * $params['if_seq_no'] = (number) only perform the index operation if the last operation that has changed the document has the specified sequence number - * $params['if_primary_term'] = (number) only perform the index operation if the last operation that has changed the document has the specified primary term - * $params['pipeline'] = (string) The pipeline id to preprocess incoming documents with - * $params['body'] = (array) The document (Required) - * - * @param array $params Associative array of parameters + * $params['index'] = (list) A comma-separated list of index names to use as default + * ['type'] = (list) A comma-separated list of document types to use as default + * ['search_type'] = (enum) Search operation type + * ['body'] = (array|string) The request definitions (metadata-search request definition pairs), separated by newlines + * ['max_concurrent_searches'] = (number) Controls the maximum number of concurrent searches the multi search api will execute + * + * @param $params array Associative array of parameters + * * @return array - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-index_.html */ - public function index(array $params = []) + public function msearchTemplate($params = array()) { - $id = $this->extractArgument($params, 'id'); $index = $this->extractArgument($params, 'index'); $type = $this->extractArgument($params, 'type'); $body = $this->extractArgument($params, 'body'); + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Index'); + + /** @var \Elasticsearch\Endpoints\MsearchTemplate $endpoint */ + $endpoint = $endpointBuilder('MsearchTemplate'); + $endpoint->setIndex($index) + ->setType($type) + ->setBody($body); $endpoint->setParams($params); - $endpoint->setId($id); - $endpoint->setIndex($index); - $endpoint->setType($type); - $endpoint->setBody($body); return $this->performRequest($endpoint); } + /** + * $params['index'] = (string) The name of the index (Required) + * ['type'] = (string) The type of the document (Required) + * ['id'] = (string) Specific document ID (when the POST method is used) + * ['consistency'] = (enum) Explicit write consistency setting for the operation + * ['parent'] = (string) ID of the parent document + * ['refresh'] = (boolean) Refresh the index after performing the operation + * ['replication'] = (enum) Specific replication type + * ['routing'] = (string) Specific routing value + * ['timeout'] = (time) Explicit operation timeout + * ['timestamp'] = (time) Explicit timestamp for the document + * ['ttl'] = (duration) Expiration time for the document + * ['version'] = (number) Explicit version number for concurrency control + * ['version_type'] = (enum) Specific version type + * ['body'] = (array) The document + * + * @param $params array Associative array of parameters * - * @param array $params Associative array of parameters * @return array - * @see http://www.elastic.co/guide/ */ - public function info(array $params = []) + public function create($params) { + $id = $this->extractArgument($params, 'id'); + $index = $this->extractArgument($params, 'index'); + $type = $this->extractArgument($params, 'type'); + $body = $this->extractArgument($params, 'body'); + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Info'); + + /** @var \Elasticsearch\Endpoints\Create $endpoint */ + $endpoint = $endpointBuilder('Create'); + $endpoint->setID($id) + ->setIndex($index) + ->setType($type) + ->setBody($body); $endpoint->setParams($params); return $this->performRequest($endpoint); } + /** - * $params['index'] = (string) The name of the index - * $params['type'] = (string) The type of the document - * $params['stored_fields'] = (list) A comma-separated list of stored fields to return in the response - * $params['preference'] = (string) Specify the node or shard the operation should be performed on (default: random) - * $params['realtime'] = (boolean) Specify whether to perform the operation in realtime or search mode - * $params['refresh'] = (boolean) Refresh the shard containing the document before performing the operation - * $params['routing'] = (string) Specific routing value - * $params['_source'] = (list) True or false to return the _source field or not, or a list of fields to return - * $params['_source_excludes'] = (list) A list of fields to exclude from the returned _source field - * $params['_source_includes'] = (list) A list of fields to extract and return from the _source field - * $params['body'] = (array) Document identifiers; can be either `docs` (containing full document information) or `ids` (when index and type is provided in the URL. (Required) - * - * @param array $params Associative array of parameters + * $params['index'] = (string) Default index for items which don't provide one + * ['type'] = (string) Default document type for items which don't provide one + * ['consistency'] = (enum) Explicit write consistency setting for the operation + * ['refresh'] = (boolean) Refresh the index after performing the operation + * ['replication'] = (enum) Explicitly set the replication type + * ['fields'] = (list) Default comma-separated list of fields to return in the response for updates + * ['body'] = (array) The document + * + * @param $params array Associative array of parameters + * * @return array - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-multi-get.html */ - public function mget(array $params = []) + public function bulk($params = array()) { $index = $this->extractArgument($params, 'index'); $type = $this->extractArgument($params, 'type'); $body = $this->extractArgument($params, 'body'); + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Mget'); + + /** @var \Elasticsearch\Endpoints\Bulk $endpoint */ + $endpoint = $endpointBuilder('Bulk'); + $endpoint->setIndex($index) + ->setType($type) + ->setBody($body); $endpoint->setParams($params); - $endpoint->setIndex($index); - $endpoint->setType($type); - $endpoint->setBody($body); return $this->performRequest($endpoint); } + /** - * $params['index'] = (list) A comma-separated list of index names to use as default - * $params['type'] = (list) A comma-separated list of document types to use as default - * $params['search_type'] = (enum) Search operation type (Options = query_then_fetch,query_and_fetch,dfs_query_then_fetch,dfs_query_and_fetch) - * $params['max_concurrent_searches'] = (number) Controls the maximum number of concurrent searches the multi search api will execute - * $params['typed_keys'] = (boolean) Specify whether aggregation and suggester names should be prefixed by their respective types in the response - * $params['pre_filter_shard_size'] = (number) A threshold that enforces a pre-filter roundtrip to prefilter search shards based on query rewriting if the number of shards the search request expands to exceeds the threshold. This filter roundtrip can limit the number of shards significantly if for instance a shard can not match any documents based on it's rewrite method ie. if date filters are mandatory to match but the shard bounds and the query are disjoint. (Default = 128) - * $params['max_concurrent_shard_requests'] = (number) The number of concurrent shard requests each sub search executes concurrently. This value should be used to limit the impact of the search on the cluster in order to limit the number of concurrent shard requests (Default = The default grows with the number of nodes in the cluster but is at most 256.) - * $params['rest_total_hits_as_int'] = (boolean) This parameter is ignored in this version. It is used in the next major version to control whether the rest response should render the total.hits as an object or a number (Default = false) - * $params['body'] = (array) The request definitions (metadata-search request definition pairs), separated by newlines (Required) - * - * @param array $params Associative array of parameters + * $params['index'] = (string) The name of the index (Required) + * ['type'] = (string) The type of the document (Required) + * ['id'] = (string) Specific document ID (when the POST method is used) + * ['consistency'] = (enum) Explicit write consistency setting for the operation + * ['op_type'] = (enum) Explicit operation type + * ['parent'] = (string) ID of the parent document + * ['refresh'] = (boolean) Refresh the index after performing the operation + * ['replication'] = (enum) Specific replication type + * ['routing'] = (string) Specific routing value + * ['timeout'] = (time) Explicit operation timeout + * ['timestamp'] = (time) Explicit timestamp for the document + * ['ttl'] = (duration) Expiration time for the document + * ['version'] = (number) Explicit version number for concurrency control + * ['version_type'] = (enum) Specific version type + * ['body'] = (array) The document + * + * @param $params array Associative array of parameters + * * @return array - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/search-multi-search.html */ - public function msearch(array $params = []) + public function index($params) { + $id = $this->extractArgument($params, 'id'); $index = $this->extractArgument($params, 'index'); $type = $this->extractArgument($params, 'type'); $body = $this->extractArgument($params, 'body'); + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Msearch'); + + /** @var \Elasticsearch\Endpoints\Index $endpoint */ + $endpoint = $endpointBuilder('Index'); + $endpoint->setID($id) + ->setIndex($index) + ->setType($type) + ->setBody($body); $endpoint->setParams($params); - $endpoint->setIndex($index); - $endpoint->setType($type); - $endpoint->setBody($body); return $this->performRequest($endpoint); } + /** - * $params['index'] = (list) A comma-separated list of index names to use as default - * $params['type'] = (list) A comma-separated list of document types to use as default - * $params['search_type'] = (enum) Search operation type (Options = query_then_fetch,query_and_fetch,dfs_query_then_fetch,dfs_query_and_fetch) - * $params['typed_keys'] = (boolean) Specify whether aggregation and suggester names should be prefixed by their respective types in the response - * $params['max_concurrent_searches'] = (number) Controls the maximum number of concurrent searches the multi search api will execute - * $params['rest_total_hits_as_int'] = (boolean) This parameter is ignored in this version. It is used in the next major version to control whether the rest response should render the total.hits as an object or a number (Default = false) - * $params['body'] = (array) The request definitions (metadata-search request definition pairs), separated by newlines (Required) - * - * @param array $params Associative array of parameters + * $params['refresh'] = (boolean) Should the effected indexes be refreshed? + * ['timeout'] = (time) Time each individual bulk request should wait for shards that are unavailable + * ['consistency'] = (enum) Explicit write consistency setting for the operation + * ['wait_for_completion'] = (boolean) Should the request should block until the reindex is complete + * ['requests_per_second'] = (float) The throttle for this request in sub-requests per second. 0 means set no throttle + * ['body'] = (array) The search definition using the Query DSL and the prototype for the index request (Required) + * + * @param $params array Associative array of parameters + * * @return array - * @see http://www.elastic.co/guide/en/elasticsearch/reference/current/search-multi-search.html */ - public function msearchTemplate(array $params = []) + public function reindex($params) { - $index = $this->extractArgument($params, 'index'); - $type = $this->extractArgument($params, 'type'); $body = $this->extractArgument($params, 'body'); + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('MsearchTemplate'); - $endpoint->setParams($params); - $endpoint->setIndex($index); - $endpoint->setType($type); + /** @var \Elasticsearch\Endpoints\Reindex $endpoint */ + $endpoint = $endpointBuilder('Reindex'); $endpoint->setBody($body); + $endpoint->setParams($params); return $this->performRequest($endpoint); } + /** - * $params['index'] = (string) The index in which the document resides. - * $params['type'] = (string) The type of the document. - * $params['ids'] = (list) A comma-separated list of documents ids. You must define ids as parameter or set "ids" or "docs" in the request body - * $params['term_statistics'] = (boolean) Specifies if total term frequency and document frequency should be returned. Applies to all returned documents unless otherwise specified in body "params" or "docs". (Default = false) - * $params['field_statistics'] = (boolean) Specifies if document count, sum of document frequencies and sum of total term frequencies should be returned. Applies to all returned documents unless otherwise specified in body "params" or "docs". (Default = true) - * $params['fields'] = (list) A comma-separated list of fields to return. Applies to all returned documents unless otherwise specified in body "params" or "docs". - * $params['offsets'] = (boolean) Specifies if term offsets should be returned. Applies to all returned documents unless otherwise specified in body "params" or "docs". (Default = true) - * $params['positions'] = (boolean) Specifies if term positions should be returned. Applies to all returned documents unless otherwise specified in body "params" or "docs". (Default = true) - * $params['payloads'] = (boolean) Specifies if term payloads should be returned. Applies to all returned documents unless otherwise specified in body "params" or "docs". (Default = true) - * $params['preference'] = (string) Specify the node or shard the operation should be performed on (default: random) .Applies to all returned documents unless otherwise specified in body "params" or "docs". - * $params['routing'] = (string) Specific routing value. Applies to all returned documents unless otherwise specified in body "params" or "docs". - * $params['parent'] = (string) Parent id of documents. Applies to all returned documents unless otherwise specified in body "params" or "docs". - * $params['realtime'] = (boolean) Specifies if requests are real-time as opposed to near-real-time (default: true). - * $params['version'] = (number) Explicit version number for concurrency control - * $params['version_type'] = (enum) Specific version type (Options = internal,external,external_gte,force) - * $params['body'] = (array) Define ids, documents, parameters or a list of parameters per document here. You must at least provide a list of document ids. See documentation. - * - * @param array $params Associative array of parameters + * $params['index'] = (list) A comma-separated list of index names to restrict the operation; use `_all` or empty string to perform the operation on all indices + * ['ignore_indices'] = (enum) When performed on multiple indices, allows to ignore `missing` ones + * ['preference'] = (string) Specify the node or shard the operation should be performed on (default: random) + * ['routing'] = (string) Specific routing value + * ['source'] = (string) The URL-encoded request definition (instead of using request body) + * ['body'] = (array) The request definition + * + * @param $params array Associative array of parameters + * * @return array - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-multi-termvectors.html */ - public function mtermvectors(array $params = []) + public function suggest($params = array()) { $index = $this->extractArgument($params, 'index'); - $type = $this->extractArgument($params, 'type'); $body = $this->extractArgument($params, 'body'); + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('MTermVectors'); + + /** @var \Elasticsearch\Endpoints\Suggest $endpoint */ + $endpoint = $endpointBuilder('Suggest'); + $endpoint->setIndex($index) + ->setBody($body); $endpoint->setParams($params); - $endpoint->setIndex($index); - $endpoint->setType($type); - $endpoint->setBody($body); return $this->performRequest($endpoint); } + /** + * $params['id'] = (string) The document ID (Required) + * ['index'] = (string) The name of the index (Required) + * ['type'] = (string) The type of the document (Required) + * ['analyze_wildcard'] = (boolean) Specify whether wildcards and prefix queries in the query string query should be analyzed (default: false) + * ['analyzer'] = (string) The analyzer for the query string query + * ['default_operator'] = (enum) The default operator for query string query (AND or OR) + * ['df'] = (string) The default field for query string query (default: _all) + * ['fields'] = (list) A comma-separated list of fields to return in the response + * ['lenient'] = (boolean) Specify whether format-based query failures (such as providing text to a numeric field) should be ignored + * ['lowercase_expanded_terms'] = (boolean) Specify whether query terms should be lowercased + * ['parent'] = (string) The ID of the parent document + * ['preference'] = (string) Specify the node or shard the operation should be performed on (default: random) + * ['q'] = (string) Query in the Lucene query string syntax + * ['routing'] = (string) Specific routing value + * ['source'] = (string) The URL-encoded query definition (instead of using the request body) + * ['_source'] = (list) True or false to return the _source field or not, or a list of fields to return + * ['_source_exclude'] = (list) A list of fields to exclude from the returned _source field + * ['_source_include'] = (list) A list of fields to extract and return from the _source field + * ['body'] = (string) The URL-encoded query definition (instead of using the request body) * - * @param array $params Associative array of parameters - * @return bool - * @see http://www.elastic.co/guide/ + * @param $params array Associative array of parameters + * + * @return array */ - public function ping(array $params = []): bool + public function explain($params) { + $id = $this->extractArgument($params, 'id'); + $index = $this->extractArgument($params, 'index'); + $type = $this->extractArgument($params, 'type'); + $body = $this->extractArgument($params, 'body'); - // manually make this verbose so we can check status code - $params['client']['verbose'] = true; - + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Ping'); + + /** @var \Elasticsearch\Endpoints\Explain $endpoint */ + $endpoint = $endpointBuilder('Explain'); + $endpoint->setID($id) + ->setIndex($index) + ->setType($type) + ->setBody($body); $endpoint->setParams($params); - return BooleanRequestWrapper::performRequest($endpoint, $this->transport); + return $this->performRequest($endpoint); } + /** - * $params['id'] = (string) Script ID (Required) - * $params['context'] = (string) Script context - * $params['timeout'] = (time) Explicit operation timeout - * $params['master_timeout'] = (time) Specify timeout for connection to master - * $params['body'] = (array) The document (Required) + * $params['index'] = (list) A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices + * ['type'] = (list) A comma-separated list of document types to search; leave empty to perform the operation on all types + * ['analyzer'] = (string) The analyzer to use for the query string + * ['analyze_wildcard'] = (boolean) Specify whether wildcard and prefix queries should be analyzed (default: false) + * ['default_operator'] = (enum) The default operator for query string query (AND or OR) + * ['df'] = (string) The field to use as default where no field prefix is given in the query string + * ['explain'] = (boolean) Specify whether to return detailed information about score computation as part of a hit + * ['fields'] = (list) A comma-separated list of fields to return as part of a hit + * ['from'] = (number) Starting offset (default: 0) + * ['ignore_indices'] = (enum) When performed on multiple indices, allows to ignore `missing` ones + * ['indices_boost'] = (list) Comma-separated list of index boosts + * ['lenient'] = (boolean) Specify whether format-based query failures (such as providing text to a numeric field) should be ignored + * ['lowercase_expanded_terms'] = (boolean) Specify whether query terms should be lowercased + * ['preference'] = (string) Specify the node or shard the operation should be performed on (default: random) + * ['q'] = (string) Query in the Lucene query string syntax + * ['query_cache'] = (boolean) Enable query cache for this request + * ['request_cache'] = (boolean) Enable request cache for this request + * ['routing'] = (list) A comma-separated list of specific routing values + * ['scroll'] = (duration) Specify how long a consistent view of the index should be maintained for scrolled search + * ['search_type'] = (enum) Search operation type + * ['size'] = (number) Number of hits to return (default: 10) + * ['sort'] = (list) A comma-separated list of : pairs + * ['source'] = (string) The URL-encoded request definition using the Query DSL (instead of using request body) + * ['_source'] = (list) True or false to return the _source field or not, or a list of fields to return + * ['_source_exclude'] = (list) A list of fields to exclude from the returned _source field + * ['_source_include'] = (list) A list of fields to extract and return from the _source field + * ['stats'] = (list) Specific 'tag' of the request for logging and statistical purposes + * ['suggest_field'] = (string) Specify which field to use for suggestions + * ['suggest_mode'] = (enum) Specify suggest mode + * ['suggest_size'] = (number) How many suggestions to return in response + * ['suggest_text'] = (text) The source text for which the suggestions should be returned + * ['timeout'] = (time) Explicit operation timeout + * ['terminate_after'] = (number) The maximum number of documents to collect for each shard, upon reaching which the query execution will terminate early. + * ['version'] = (boolean) Specify whether to return document version as part of a hit + * ['body'] = (array|string) The search definition using the Query DSL + * + * @param $params array Associative array of parameters * - * @param array $params Associative array of parameters * @return array - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-scripting.html */ - public function putScript(array $params = []) + public function search($params = array()) { - $id = $this->extractArgument($params, 'id'); - $context = $this->extractArgument($params, 'context'); + $index = $this->extractArgument($params, 'index'); + $type = $this->extractArgument($params, 'type'); $body = $this->extractArgument($params, 'body'); + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('PutScript'); + + /** @var \Elasticsearch\Endpoints\Search $endpoint */ + $endpoint = $endpointBuilder('Search'); + $endpoint->setIndex($index) + ->setType($type) + ->setBody($body); $endpoint->setParams($params); - $endpoint->setId($id); - $endpoint->setContext($context); - $endpoint->setBody($body); return $this->performRequest($endpoint); } + /** * $params['index'] = (list) A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices - * $params['ignore_unavailable'] = (boolean) Whether specified concrete indices should be ignored when unavailable (missing or closed) - * $params['allow_no_indices'] = (boolean) Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) - * $params['expand_wildcards'] = (enum) Whether to expand wildcard expression to concrete indices that are open, closed or both. (Options = open,closed,none,all) (Default = open) - * $params['body'] = (array) The ranking evaluation search definition, including search requests, document ratings and ranking metric definition. (Required) + * ['type'] = (list) A comma-separated list of document types to search; leave empty to perform the operation on all types + * ['preference'] = (string) Specify the node or shard the operation should be performed on (default: random) + * ['routing'] = (string) Specific routing value + * ['local'] = (bool) Return local information, do not retrieve the state from master node (default: false) + * ['ignore_unavailable'] = (bool) Whether specified concrete indices should be ignored when unavailable (missing or closed) + * ['allow_no_indices'] = (bool) Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) + * ['expand_wildcards'] = (enum) Whether to expand wildcard expression to concrete indices that are open, closed or both. + * + * @param $params array Associative array of parameters * - * @param array $params Associative array of parameters * @return array - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/search-rank-eval.html */ - public function rankEval(array $params = []) + public function searchShards($params = array()) { $index = $this->extractArgument($params, 'index'); - $body = $this->extractArgument($params, 'body'); + $type = $this->extractArgument($params, 'type'); + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('RankEval'); + + /** @var \Elasticsearch\Endpoints\SearchShards $endpoint */ + $endpoint = $endpointBuilder('SearchShards'); + $endpoint->setIndex($index) + ->setType($type); $endpoint->setParams($params); - $endpoint->setIndex($index); - $endpoint->setBody($body); return $this->performRequest($endpoint); } + /** - * $params['refresh'] = (boolean) Should the effected indexes be refreshed? - * $params['timeout'] = (time) Time each individual bulk request should wait for shards that are unavailable. (Default = 1m) - * $params['wait_for_active_shards'] = (string) Sets the number of shard copies that must be active before proceeding with the reindex operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1) - * $params['wait_for_completion'] = (boolean) Should the request should block until the reindex is complete. (Default = true) - * $params['requests_per_second'] = (number) The throttle to set on this request in sub-requests per second. -1 means no throttle. (Default = 0) - * $params['slices'] = (number) The number of slices this task should be divided into. Defaults to 1 meaning the task isn't sliced into subtasks. (Default = 1) - * $params['body'] = (array) The search definition using the Query DSL and the prototype for the index request. (Required) - * - * @param array $params Associative array of parameters + * $params['index'] = (list) A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices + * ['type'] = (list) A comma-separated list of document types to search; leave empty to perform the operation on all types + * + * @param $params array Associative array of parameters + * * @return array - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-reindex.html */ - public function reindex(array $params = []) + public function searchTemplate($params = array()) { + $index = $this->extractArgument($params, 'index'); + $type = $this->extractArgument($params, 'type'); $body = $this->extractArgument($params, 'body'); + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Reindex'); + + /** @var \Elasticsearch\Endpoints\Search $endpoint */ + $endpoint = $endpointBuilder('SearchTemplate'); + $endpoint->setIndex($index) + ->setType($type) + ->setBody($body); $endpoint->setParams($params); - $endpoint->setBody($body); return $this->performRequest($endpoint); } + /** - * $params['task_id'] = (string) The task id to rethrottle (Required) - * $params['requests_per_second'] = (number) The throttle to set on this request in floating sub-requests per second. -1 means set no throttle. (Required) + * $params['scroll_id'] = (string) The scroll ID for scrolled search + * ['scroll'] = (duration) Specify how long a consistent view of the index should be maintained for scrolled search + * ['body'] = (string) The scroll ID for scrolled search + * + * @param $params array Associative array of parameters * - * @param array $params Associative array of parameters * @return array - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-reindex.html */ - public function reindexRethrottle(array $params = []) + public function scroll($params = array()) { - $task_id = $this->extractArgument($params, 'task_id'); + $scrollID = $this->extractArgument($params, 'scroll_id'); + $body = $this->extractArgument($params, 'body'); + $scroll = $this->extractArgument($params, 'scroll'); + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('ReindexRethrottle'); + + /** @var \Elasticsearch\Endpoints\Scroll $endpoint */ + $endpoint = $endpointBuilder('Scroll'); + $endpoint->setScrollID($scrollID) + ->setScroll($scroll) + ->setBody($body); $endpoint->setParams($params); - $endpoint->setTaskId($task_id); return $this->performRequest($endpoint); } + /** - * $params['id'] = (string) The id of the stored search template - * $params['body'] = (array) The search definition template and its params + * $params['scroll_id'] = (string) The scroll ID for scrolled search + * ['scroll'] = (duration) Specify how long a consistent view of the index should be maintained for scrolled search + * ['body'] = (string) The scroll ID for scrolled search + * + * @param $params array Associative array of parameters * - * @param array $params Associative array of parameters * @return array - * @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/search-template.html */ - public function renderSearchTemplate(array $params = []) + public function clearScroll($params = array()) { - $id = $this->extractArgument($params, 'id'); + $scrollID = $this->extractArgument($params, 'scroll_id'); $body = $this->extractArgument($params, 'body'); + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('RenderSearchTemplate'); + + /** @var \Elasticsearch\Endpoints\ClearScroll $endpoint */ + $endpoint = $endpointBuilder('ClearScroll'); + $endpoint->setScrollID($scrollID) + ->setBody($body); $endpoint->setParams($params); - $endpoint->setId($id); - $endpoint->setBody($body); return $this->performRequest($endpoint); } + /** - * $params['body'] = (array) The script to execute + * $params['id'] = (string) Document ID (Required) + * ['index'] = (string) The name of the index (Required) + * ['type'] = (string) The type of the document (Required) + * ['consistency'] = (enum) Explicit write consistency setting for the operation + * ['fields'] = (list) A comma-separated list of fields to return in the response + * ['lang'] = (string) The script language (default: mvel) + * ['parent'] = (string) ID of the parent document + * ['refresh'] = (boolean) Refresh the index after performing the operation + * ['replication'] = (enum) Specific replication type + * ['retry_on_conflict'] = (number) Specify how many times should the operation be retried when a conflict occurs (default: 0) + * ['routing'] = (string) Specific routing value + * ['script'] = () The URL-encoded script definition (instead of using request body) + * ['timeout'] = (time) Explicit operation timeout + * ['timestamp'] = (time) Explicit timestamp for the document + * ['ttl'] = (duration) Expiration time for the document + * ['version_type'] = (number) Explicit version number for concurrency control + * ['body'] = (array) The request definition using either `script` or partial `doc` + * + * @param $params array Associative array of parameters * - * @param array $params Associative array of parameters * @return array - * @see https://www.elastic.co/guide/en/elasticsearch/painless/master/painless-execute-api.html */ - public function scriptsPainlessExecute(array $params = []) + public function update($params) { + $id = $this->extractArgument($params, 'id'); + $index = $this->extractArgument($params, 'index'); + $type = $this->extractArgument($params, 'type'); $body = $this->extractArgument($params, 'body'); + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('ScriptsPainlessExecute'); + + /** @var \Elasticsearch\Endpoints\Update $endpoint */ + $endpoint = $endpointBuilder('Update'); + $endpoint->setID($id) + ->setIndex($index) + ->setType($type) + ->setBody($body); $endpoint->setParams($params); - $endpoint->setBody($body); return $this->performRequest($endpoint); } + /** - * $params['scroll_id'] = (string) The scroll ID - * $params['scroll'] = (time) Specify how long a consistent view of the index should be maintained for scrolled search - * $params['rest_total_hits_as_int'] = (boolean) This parameter is ignored in this version. It is used in the next major version to control whether the rest response should render the total.hits as an object or a number (Default = false) - * $params['body'] = (array) The scroll ID if not passed by URL or query parameter. + * $params['index'] = (list) A comma-separated list of index names to search; use `_all` or + * empty string to perform the operation on all indices (Required) + * ['type'] = (list) A comma-separated list of document types to search; leave empty to + * perform the operation on all types + * ['analyzer'] = (string) The analyzer to use for the query string + * ['analyze_wildcard'] = (boolean) Specify whether wildcard and prefix queries should be analyzed + * (default: false) + * ['default_operator'] = (enum) The default operator for query string query (AND or OR) (AND,OR) + * (default: OR) + * ['df'] = (string) The field to use as default where no field prefix is given in the + * query string + * ['explain'] = (boolean) Specify whether to return detailed information about score + * computation as part of a hit + * ['fields'] = (list) A comma-separated list of fields to return as part of a hit + * ['fielddata_fields'] = (list) A comma-separated list of fields to return as the field data + * representation of a field for each hit + * ['from'] = (number) Starting offset (default: 0) + * ['ignore_unavailable'] = (boolean) Whether specified concrete indices should be ignored when + * unavailable (missing or closed) + * ['allow_no_indices'] = (boolean) Whether to ignore if a wildcard indices expression resolves into + * no concrete indices. (This includes `_all` string or when no indices have been specified) + * ['conflicts'] = (enum) What to do when the reindex hits version conflicts? (abort,proceed) + * (default: abort) + * ['expand_wildcards'] = (enum) Whether to expand wildcard expression to concrete indices that are + * open, closed or both. (open,closed,none,all) (default: open) + * ['lenient'] = (boolean) Specify whether format-based query failures (such as providing + * text to a numeric field) should be ignored + * ['lowercase_expanded_terms'] = (boolean) Specify whether query terms should be lowercased + * ['preference'] = (string) Specify the node or shard the operation should be performed on + * (default: random) + * ['q'] = (string) Query in the Lucene query string syntax + * ['routing'] = (list) A comma-separated list of specific routing values + * ['scroll'] = (duration) Specify how long a consistent view of the index should be + * maintained for scrolled search + * ['search_type'] = (enum) Search operation type (query_then_fetch,dfs_query_then_fetch) + * ['search_timeout'] = (time) Explicit timeout for each search request. Defaults to no timeout. + * ['size'] = (number) Number of hits to return (default: 10) + * ['sort'] = (list) A comma-separated list of : pairs + * ['_source'] = (list) True or false to return the _source field or not, or a list of + * fields to return + * ['_source_exclude'] = (list) A list of fields to exclude from the returned _source field + * ['_source_include'] = (list) A list of fields to extract and return from the _source field + * ['terminate_after'] = (number) The maximum number of documents to collect for each shard, upon + * reaching which the query execution will terminate early. + * ['stats'] = (list) Specific 'tag' of the request for logging and statistical purposes + * ['suggest_field'] = (string) Specify which field to use for suggestions + * ['suggest_mode'] = (enum) Specify suggest mode (missing,popular,always) (default: missing) + * ['suggest_size'] = (number) How many suggestions to return in response + * ['suggest_text'] = (text) The source text for which the suggestions should be returned + * ['timeout'] = (time) Time each individual bulk request should wait for shards that are + * unavailable. (default: 1m) + * ['track_scores'] = (boolean) Whether to calculate and return scores even if they are not used + * for sorting + * ['version'] = (boolean) Specify whether to return document version as part of a hit + * ['version_type'] = (boolean) Should the document increment the version number (internal) on + * hit or not (reindex) + * ['request_cache'] = (boolean) Specify if request cache should be used for this request or not, + * defaults to index level setting + * ['refresh'] = (boolean) Should the effected indexes be refreshed? + * ['consistency'] = (enum) Explicit write consistency setting for the operation + * (one,quorum,all) + * ['scroll_size'] = (integer) Size on the scroll request powering the update_by_query + * ['wait_for_completion'] = (boolean) Should the request should block until the reindex is complete. + * (default: false) + * ['body'] = The search definition using the Query DSL + * + * @param array $params * - * @param array $params Associative array of parameters * @return array - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/search-request-scroll.html */ - public function scroll(array $params = []) + public function updateByQuery($params = array()) { - $scroll_id = $this->extractArgument($params, 'scroll_id'); + $index = $this->extractArgument($params, 'index'); + $body = $this->extractArgument($params, 'body'); + $type = $this->extractArgument($params, 'type'); + + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Scroll'); + + /** @var \Elasticsearch\Endpoints\UpdateByQuery $endpoint */ + $endpoint = $endpointBuilder('UpdateByQuery'); + $endpoint->setIndex($index) + ->setType($type) + ->setBody($body); $endpoint->setParams($params); - $endpoint->setScrollId($scroll_id); - $endpoint->setBody($body); return $this->performRequest($endpoint); } + /** - * $params['index'] = (list) A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices - * $params['type'] = (list) A comma-separated list of document types to search; leave empty to perform the operation on all types - * $params['analyzer'] = (string) The analyzer to use for the query string - * $params['analyze_wildcard'] = (boolean) Specify whether wildcard and prefix queries should be analyzed (default: false) - * $params['default_operator'] = (enum) The default operator for query string query (AND or OR) (Options = AND,OR) (Default = OR) - * $params['df'] = (string) The field to use as default where no field prefix is given in the query string - * $params['explain'] = (boolean) Specify whether to return detailed information about score computation as part of a hit - * $params['stored_fields'] = (list) A comma-separated list of stored fields to return as part of a hit - * $params['docvalue_fields'] = (list) A comma-separated list of fields to return as the docvalue representation of a field for each hit - * $params['from'] = (number) Starting offset (default: 0) - * $params['ignore_unavailable'] = (boolean) Whether specified concrete indices should be ignored when unavailable (missing or closed) - * $params['ignore_throttled'] = (boolean) Whether specified concrete, expanded or aliased indices should be ignored when throttled - * $params['allow_no_indices'] = (boolean) Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) - * $params['expand_wildcards'] = (enum) Whether to expand wildcard expression to concrete indices that are open, closed or both. (Options = open,closed,none,all) (Default = open) - * $params['lenient'] = (boolean) Specify whether format-based query failures (such as providing text to a numeric field) should be ignored - * $params['preference'] = (string) Specify the node or shard the operation should be performed on (default: random) - * $params['q'] = (string) Query in the Lucene query string syntax - * $params['routing'] = (list) A comma-separated list of specific routing values - * $params['scroll'] = (time) Specify how long a consistent view of the index should be maintained for scrolled search - * $params['search_type'] = (enum) Search operation type (Options = query_then_fetch,dfs_query_then_fetch) - * $params['size'] = (number) Number of hits to return (default: 10) - * $params['sort'] = (list) A comma-separated list of : pairs - * $params['_source'] = (list) True or false to return the _source field or not, or a list of fields to return - * $params['_source_excludes'] = (list) A list of fields to exclude from the returned _source field - * $params['_source_includes'] = (list) A list of fields to extract and return from the _source field - * $params['terminate_after'] = (number) The maximum number of documents to collect for each shard, upon reaching which the query execution will terminate early. - * $params['stats'] = (list) Specific 'tag' of the request for logging and statistical purposes - * $params['suggest_field'] = (string) Specify which field to use for suggestions - * $params['suggest_mode'] = (enum) Specify suggest mode (Options = missing,popular,always) (Default = missing) - * $params['suggest_size'] = (number) How many suggestions to return in response - * $params['suggest_text'] = (string) The source text for which the suggestions should be returned - * $params['timeout'] = (time) Explicit operation timeout - * $params['track_scores'] = (boolean) Whether to calculate and return scores even if they are not used for sorting - * $params['track_total_hits'] = (boolean) Indicate if the number of documents that match the query should be tracked - * $params['allow_partial_search_results'] = (boolean) Indicate if an error should be returned if there is a partial search failure or timeout (Default = true) - * $params['typed_keys'] = (boolean) Specify whether aggregation and suggester names should be prefixed by their respective types in the response - * $params['version'] = (boolean) Specify whether to return document version as part of a hit - * $params['seq_no_primary_term'] = (boolean) Specify whether to return sequence number and primary term of the last modification of each hit - * $params['request_cache'] = (boolean) Specify if request cache should be used for this request or not, defaults to index level setting - * $params['batched_reduce_size'] = (number) The number of shard results that should be reduced at once on the coordinating node. This value should be used as a protection mechanism to reduce the memory overhead per search request if the potential number of shards in the request can be large. (Default = 512) - * $params['max_concurrent_shard_requests'] = (number) The number of concurrent shard requests this search executes concurrently. This value should be used to limit the impact of the search on the cluster in order to limit the number of concurrent shard requests (Default = The default grows with the number of nodes in the cluster but is at most 256.) - * $params['pre_filter_shard_size'] = (number) A threshold that enforces a pre-filter roundtrip to prefilter search shards based on query rewriting if the number of shards the search request expands to exceeds the threshold. This filter roundtrip can limit the number of shards significantly if for instance a shard can not match any documents based on it's rewrite method ie. if date filters are mandatory to match but the shard bounds and the query are disjoint. (Default = 128) - * $params['rest_total_hits_as_int'] = (boolean) This parameter is ignored in this version. It is used in the next major version to control whether the rest response should render the total.hits as an object or a number (Default = false) - * $params['body'] = (array) The search definition using the Query DSL - * - * @param array $params Associative array of parameters + * $params['id'] = (string) The script ID (Required) + * ['lang'] = (string) The script language (Required) + * + * @param $params array Associative array of parameters + * * @return array - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/search-search.html */ - public function search(array $params = []) + public function getScript($params) { - $index = $this->extractArgument($params, 'index'); - $type = $this->extractArgument($params, 'type'); - $body = $this->extractArgument($params, 'body'); + $id = $this->extractArgument($params, 'id'); + $lang = $this->extractArgument($params, 'lang'); + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Search'); + + /** @var \Elasticsearch\Endpoints\Script\Get $endpoint */ + $endpoint = $endpointBuilder('Script\Get'); + $endpoint->setID($id) + ->setLang($lang); $endpoint->setParams($params); - $endpoint->setIndex($index); - $endpoint->setType($type); - $endpoint->setBody($body); return $this->performRequest($endpoint); } + /** - * $params['index'] = (list) A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices - * $params['preference'] = (string) Specify the node or shard the operation should be performed on (default: random) - * $params['routing'] = (string) Specific routing value - * $params['local'] = (boolean) Return local information, do not retrieve the state from master node (default: false) - * $params['ignore_unavailable'] = (boolean) Whether specified concrete indices should be ignored when unavailable (missing or closed) - * $params['allow_no_indices'] = (boolean) Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) - * $params['expand_wildcards'] = (enum) Whether to expand wildcard expression to concrete indices that are open, closed or both. (Options = open,closed,none,all) (Default = open) - * - * @param array $params Associative array of parameters + * $params['id'] = (string) The script ID (Required) + * ['lang'] = (string) The script language (Required) + * + * @param $params array Associative array of parameters + * * @return array - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/search-shards.html */ - public function searchShards(array $params = []) + public function deleteScript($params) { - $index = $this->extractArgument($params, 'index'); + $id = $this->extractArgument($params, 'id'); + $lang = $this->extractArgument($params, 'lang'); + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('SearchShards'); + + /** @var \Elasticsearch\Endpoints\Script\Delete $endpoint */ + $endpoint = $endpointBuilder('Script\Delete'); + $endpoint->setID($id) + ->setLang($lang); $endpoint->setParams($params); - $endpoint->setIndex($index); return $this->performRequest($endpoint); } + /** - * $params['index'] = (list) A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices - * $params['type'] = (list) A comma-separated list of document types to search; leave empty to perform the operation on all types - * $params['ignore_unavailable'] = (boolean) Whether specified concrete indices should be ignored when unavailable (missing or closed) - * $params['ignore_throttled'] = (boolean) Whether specified concrete, expanded or aliased indices should be ignored when throttled - * $params['allow_no_indices'] = (boolean) Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) - * $params['expand_wildcards'] = (enum) Whether to expand wildcard expression to concrete indices that are open, closed or both. (Options = open,closed,none,all) (Default = open) - * $params['preference'] = (string) Specify the node or shard the operation should be performed on (default: random) - * $params['routing'] = (list) A comma-separated list of specific routing values - * $params['scroll'] = (time) Specify how long a consistent view of the index should be maintained for scrolled search - * $params['search_type'] = (enum) Search operation type (Options = query_then_fetch,query_and_fetch,dfs_query_then_fetch,dfs_query_and_fetch) - * $params['explain'] = (boolean) Specify whether to return detailed information about score computation as part of a hit - * $params['profile'] = (boolean) Specify whether to profile the query execution - * $params['typed_keys'] = (boolean) Specify whether aggregation and suggester names should be prefixed by their respective types in the response - * $params['rest_total_hits_as_int'] = (boolean) This parameter is ignored in this version. It is used in the next major version to control whether the rest response should render the total.hits as an object or a number (Default = false) - * $params['body'] = (array) The search definition template and its params (Required) - * - * @param array $params Associative array of parameters + * $params['id'] = (string) The script ID (Required) + * ['lang'] = (string) The script language (Required) + * + * @param $params array Associative array of parameters + * * @return array - * @see http://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html */ - public function searchTemplate(array $params = []) + public function putScript($params) { - $index = $this->extractArgument($params, 'index'); - $type = $this->extractArgument($params, 'type'); + $id = $this->extractArgument($params, 'id'); + $lang = $this->extractArgument($params, 'lang'); $body = $this->extractArgument($params, 'body'); + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('SearchTemplate'); + + /** @var \Elasticsearch\Endpoints\Script\Put $endpoint */ + $endpoint = $endpointBuilder('Script\Put'); + $endpoint->setID($id) + ->setBody($body); $endpoint->setParams($params); - $endpoint->setIndex($index); - $endpoint->setType($type); - $endpoint->setBody($body); return $this->performRequest($endpoint); } + /** - * $params['index'] = (string) The index in which the document resides. (Required) - * $params['type'] = (string) The type of the document. (Required) - * $params['id'] = (string) The id of the document, when not specified a doc param should be supplied. - * $params['term_statistics'] = (boolean) Specifies if total term frequency and document frequency should be returned. (Default = false) - * $params['field_statistics'] = (boolean) Specifies if document count, sum of document frequencies and sum of total term frequencies should be returned. (Default = true) - * $params['fields'] = (list) A comma-separated list of fields to return. - * $params['offsets'] = (boolean) Specifies if term offsets should be returned. (Default = true) - * $params['positions'] = (boolean) Specifies if term positions should be returned. (Default = true) - * $params['payloads'] = (boolean) Specifies if term payloads should be returned. (Default = true) - * $params['preference'] = (string) Specify the node or shard the operation should be performed on (default: random). - * $params['routing'] = (string) Specific routing value. - * $params['parent'] = (string) Parent id of documents. - * $params['realtime'] = (boolean) Specifies if request is real-time as opposed to near-real-time (default: true). - * $params['version'] = (number) Explicit version number for concurrency control - * $params['version_type'] = (enum) Specific version type (Options = internal,external,external_gte,force) - * $params['body'] = (array) Define parameters and or supply a document to get termvectors for. See documentation. - * - * @param array $params Associative array of parameters + * $params['id'] = (string) The search template ID (Required) + * + * @param $params array Associative array of parameters + * * @return array - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-termvectors.html */ - public function termvectors(array $params = []) + public function getTemplate($params) { - $index = $this->extractArgument($params, 'index'); - $type = $this->extractArgument($params, 'type'); $id = $this->extractArgument($params, 'id'); - $body = $this->extractArgument($params, 'body'); + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('TermVectors'); + + /** @var \Elasticsearch\Endpoints\Template\Get $endpoint */ + $endpoint = $endpointBuilder('Template\Get'); + $endpoint->setID($id); $endpoint->setParams($params); - $endpoint->setIndex($index); - $endpoint->setType($type); - $endpoint->setId($id); - $endpoint->setBody($body); return $this->performRequest($endpoint); } + /** - * $params['id'] = (string) Document ID (Required) - * $params['index'] = (string) The name of the index (Required) - * $params['type'] = (string) The type of the document (Required) - * $params['wait_for_active_shards'] = (string) Sets the number of shard copies that must be active before proceeding with the update operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1) - * $params['fields'] = (list) A comma-separated list of fields to return in the response - * $params['_source'] = (list) True or false to return the _source field or not, or a list of fields to return - * $params['_source_excludes'] = (list) A list of fields to exclude from the returned _source field - * $params['_source_includes'] = (list) A list of fields to extract and return from the _source field - * $params['lang'] = (string) The script language (default: painless) - * $params['parent'] = (string) ID of the parent document. Is is only used for routing and when for the upsert request - * $params['refresh'] = (enum) If `true` then refresh the effected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` (the default) then do nothing with refreshes. (Options = true,false,wait_for) - * $params['retry_on_conflict'] = (number) Specify how many times should the operation be retried when a conflict occurs (default: 0) - * $params['routing'] = (string) Specific routing value - * $params['timeout'] = (time) Explicit operation timeout - * $params['if_seq_no'] = (number) only perform the update operation if the last operation that has changed the document has the specified sequence number - * $params['if_primary_term'] = (number) only perform the update operation if the last operation that has changed the document has the specified primary term - * $params['version'] = (number) Explicit version number for concurrency control - * $params['version_type'] = (enum) Specific version type (Options = internal,force) - * $params['body'] = (array) The request definition requires either `script` or partial `doc` (Required) - * - * @param array $params Associative array of parameters + * $params['id'] = (string) The search template ID (Required) + * + * @param $params array Associative array of parameters + * * @return array - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/docs-update.html */ - public function update(array $params = []) + public function deleteTemplate($params) { $id = $this->extractArgument($params, 'id'); - $index = $this->extractArgument($params, 'index'); - $type = $this->extractArgument($params, 'type'); - $body = $this->extractArgument($params, 'body'); + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Update'); + + /** @var \Elasticsearch\Endpoints\Template\Delete $endpoint */ + $endpoint = $endpointBuilder('Template\Delete'); + $endpoint->setID($id); $endpoint->setParams($params); - $endpoint->setId($id); - $endpoint->setIndex($index); - $endpoint->setType($type); - $endpoint->setBody($body); return $this->performRequest($endpoint); } + /** - * $params['index'] = (list) A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices (Required) - * $params['type'] = (list) A comma-separated list of document types to search; leave empty to perform the operation on all types - * $params['analyzer'] = (string) The analyzer to use for the query string - * $params['analyze_wildcard'] = (boolean) Specify whether wildcard and prefix queries should be analyzed (default: false) - * $params['default_operator'] = (enum) The default operator for query string query (AND or OR) (Options = AND,OR) (Default = OR) - * $params['df'] = (string) The field to use as default where no field prefix is given in the query string - * $params['from'] = (number) Starting offset (default: 0) - * $params['ignore_unavailable'] = (boolean) Whether specified concrete indices should be ignored when unavailable (missing or closed) - * $params['allow_no_indices'] = (boolean) Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) - * $params['conflicts'] = (enum) What to do when the update by query hits version conflicts? (Options = abort,proceed) (Default = abort) - * $params['expand_wildcards'] = (enum) Whether to expand wildcard expression to concrete indices that are open, closed or both. (Options = open,closed,none,all) (Default = open) - * $params['lenient'] = (boolean) Specify whether format-based query failures (such as providing text to a numeric field) should be ignored - * $params['pipeline'] = (string) Ingest pipeline to set on index requests made by this action. (default: none) - * $params['preference'] = (string) Specify the node or shard the operation should be performed on (default: random) - * $params['q'] = (string) Query in the Lucene query string syntax - * $params['routing'] = (list) A comma-separated list of specific routing values - * $params['scroll'] = (time) Specify how long a consistent view of the index should be maintained for scrolled search - * $params['search_type'] = (enum) Search operation type (Options = query_then_fetch,dfs_query_then_fetch) - * $params['search_timeout'] = (time) Explicit timeout for each search request. Defaults to no timeout. - * $params['size'] = (number) Number of hits to return (default: 10) - * $params['sort'] = (list) A comma-separated list of : pairs - * $params['_source'] = (list) True or false to return the _source field or not, or a list of fields to return - * $params['_source_excludes'] = (list) A list of fields to exclude from the returned _source field - * $params['_source_includes'] = (list) A list of fields to extract and return from the _source field - * $params['terminate_after'] = (number) The maximum number of documents to collect for each shard, upon reaching which the query execution will terminate early. - * $params['stats'] = (list) Specific 'tag' of the request for logging and statistical purposes - * $params['version'] = (boolean) Specify whether to return document version as part of a hit - * $params['version_type'] = (boolean) Should the document increment the version number (internal) on hit or not (reindex) - * $params['request_cache'] = (boolean) Specify if request cache should be used for this request or not, defaults to index level setting - * $params['refresh'] = (boolean) Should the effected indexes be refreshed? - * $params['timeout'] = (time) Time each individual bulk request should wait for shards that are unavailable. (Default = 1m) - * $params['wait_for_active_shards'] = (string) Sets the number of shard copies that must be active before proceeding with the update by query operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1) - * $params['scroll_size'] = (number) Size on the scroll request powering the update by query - * $params['wait_for_completion'] = (boolean) Should the request should block until the update by query operation is complete. (Default = true) - * $params['requests_per_second'] = (number) The throttle to set on this request in sub-requests per second. -1 means no throttle. (Default = 0) - * $params['slices'] = (number) The number of slices this task should be divided into. Defaults to 1 meaning the task isn't sliced into subtasks. (Default = 1) - * $params['body'] = (array) The search definition using the Query DSL - * - * @param array $params Associative array of parameters + * $params['index'] = (list) A comma-separated list of indices to restrict the results + * ['fields'] = (list) A comma-separated list of fields for to get field statistics for (min value, max value, and more) + * ['level'] = (enum) Defines if field stats should be returned on a per index level or on a cluster wide level + * ['ignore_unavailable'] = (bool) Whether specified concrete indices should be ignored when unavailable (missing or closed) + * ['allow_no_indices'] = (bool) Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) + * ['expand_wildcards'] = (enum) Whether to expand wildcard expression to concrete indices that are open, closed or both. + * + * @param $params array Associative array of parameters + * * @return array - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-update-by-query.html */ - public function updateByQuery(array $params = []) + public function fieldStats($params = array()) { $index = $this->extractArgument($params, 'index'); - $type = $this->extractArgument($params, 'type'); $body = $this->extractArgument($params, 'body'); + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('UpdateByQuery'); - $endpoint->setParams($params); - $endpoint->setIndex($index); - $endpoint->setType($type); - $endpoint->setBody($body); + + /** @var \Elasticsearch\Endpoints\FieldStats $endpoint */ + $endpoint = $endpointBuilder('FieldStats'); + $endpoint->setIndex($index) + ->setBody($body) + ->setParams($params); return $this->performRequest($endpoint); } + /** - * $params['task_id'] = (string) The task id to rethrottle (Required) - * $params['requests_per_second'] = (number) The throttle to set on this request in floating sub-requests per second. -1 means set no throttle. (Required) + * $params['index'] = (list) A comma-separated list of indices to restrict the results + * ['ignore_unavailable'] = (bool) Whether specified concrete indices should be ignored when unavailable (missing or closed) + * ['allow_no_indices'] = (bool) Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) + * ['expand_wildcards'] = (enum) Whether to expand wildcard expression to concrete indices that are open, closed or both. + * + * @param $params array Associative array of parameters * - * @param array $params Associative array of parameters * @return array - * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-update-by-query.html */ - public function updateByQueryRethrottle(array $params = []) + public function fieldCaps($params = array()) { - $task_id = $this->extractArgument($params, 'task_id'); + $index = $this->extractArgument($params, 'index'); + $body = $this->extractArgument($params, 'body'); + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('UpdateByQueryRethrottle'); - $endpoint->setParams($params); - $endpoint->setTaskId($task_id); + + /** @var \Elasticsearch\Endpoints\FieldCaps $endpoint */ + $endpoint = $endpointBuilder('FieldCaps'); + $endpoint->setIndex($index) + ->setBody($body) + ->setParams($params); return $this->performRequest($endpoint); } - public function cat(): CatNamespace - { - return $this->cat; - } - public function cluster(): ClusterNamespace + + /** + * $params['id'] = (string) ID of the template to render + * + * @param $params array Associative array of parameters + * + * @return array + */ + public function renderSearchTemplate($params = array()) { - return $this->cluster; + $body = $this->extractArgument($params, 'body'); + $id = $this->extractArgument($params, 'id'); + + /** @var callback $endpointBuilder */ + $endpointBuilder = $this->endpoints; + + /** @var \Elasticsearch\Endpoints\RenderSearchTemplate $endpoint */ + $endpoint = $endpointBuilder('RenderSearchTemplate'); + $endpoint->setBody($body) + ->setID($id); + $endpoint->setParams($params); + + return $this->performRequest($endpoint); } - public function indices(): IndicesNamespace + + /** + * Operate on the Indices Namespace of commands + * + * @return IndicesNamespace + */ + public function indices() { return $this->indices; } - public function ingest(): IngestNamespace + + /** + * Operate on the Cluster namespace of commands + * + * @return ClusterNamespace + */ + public function cluster() { - return $this->ingest; + return $this->cluster; } - public function nodes(): NodesNamespace + + /** + * Operate on the Nodes namespace of commands + * + * @return NodesNamespace + */ + public function nodes() { return $this->nodes; } - public function snapshot(): SnapshotNamespace + + /** + * Operate on the Snapshot namespace of commands + * + * @return SnapshotNamespace + */ + public function snapshot() { return $this->snapshot; } - public function tasks(): TasksNamespace - { - return $this->tasks; - } - public function ccr(): CcrNamespace - { - return $this->ccr; - } - public function ilm(): IlmNamespace - { - return $this->ilm; - } - public function security(): SecurityNamespace - { - return $this->security; - } - public function graph(): GraphNamespace - { - return $this->graph; - } - public function xpack(): XpackNamespace - { - return $this->xpack; - } - public function license(): LicenseNamespace - { - return $this->license; - } - public function migration(): MigrationNamespace - { - return $this->migration; - } - public function ml(): MlNamespace - { - return $this->ml; - } - public function monitoring(): MonitoringNamespace - { - return $this->monitoring; - } - public function rollup(): RollupNamespace + + /** + * Operate on the Cat namespace of commands + * + * @return CatNamespace + */ + public function cat() { - return $this->rollup; + return $this->cat; } - public function sql(): SqlNamespace + + /** + * Operate on the Ingest namespace of commands + * + * @return IngestNamespace + */ + public function ingest() { - return $this->sql; + return $this->ingest; } - public function ssl(): SslNamespace + + /** + * Operate on the Tasks namespace of commands + * + * @return TasksNamespace + */ + public function tasks() { - return $this->ssl; + return $this->tasks; } - public function watcher(): WatcherNamespace + + /** + * Operate on the Remote namespace of commands + * + * @return RemoteNamespace + */ + public function remote() { - return $this->watcher; + return $this->remote; } /** * Catchall for registered namespaces * - * @return object + * @param $name + * @param $arguments + * @return Object * @throws BadMethodCallException if the namespace cannot be found */ - public function __call(string $name, array $arguments) + public function __call($name, $arguments) { if (isset($this->registeredNamespaces[$name])) { return $this->registeredNamespaces[$name]; @@ -1434,17 +1497,22 @@ public function __call(string $name, array $arguments) } /** + * @param array $params + * @param string $arg + * * @return null|mixed */ - public function extractArgument(array &$params, string $arg) + public function extractArgument(&$params, $arg) { + if (is_object($params) === true) { + $params = (array) $params; + } + if (array_key_exists($arg, $params) === true) { - $value = $params[$arg]; - $value = (is_object($value) && !is_iterable($value)) ? - (array) $value : - $value; + $val = $params[$arg]; unset($params[$arg]); - return $value; + + return $val; } else { return null; } @@ -1468,9 +1536,12 @@ private function verifyNotNullOrEmpty($name, $var) } } } - + /** - * @return callable|array + * @param $endpoint AbstractEndpoint + * + * @throws \Exception + * @return array */ private function performRequest(AbstractEndpoint $endpoint) { diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/ClientBuilder.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/ClientBuilder.php index 368675168..41029a09e 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/ClientBuilder.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/ClientBuilder.php @@ -1,29 +1,17 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class ClientBuilder { /** @var Transport */ private $transport; - /** @var callable */ + /** @var callback */ private $endpoint; /** @var NamespaceBuilderInterface[] */ @@ -96,45 +89,40 @@ class ClientBuilder /** @var null|bool|string */ private $sslVerification = null; - /** - * @var bool - */ - private $elasticMetaHeader = true; - /** * @return ClientBuilder */ - public static function create(): ClientBuilder + public static function create() { return new static(); } /** * Can supply first parm to Client::__construct() when invoking manually or with dependency injection - * @return Transport + * @return this->ransport * */ - public function getTransport(): Transport + public function getTransport() { return $this->transport; } /** * Can supply second parm to Client::__construct() when invoking manually or with dependency injection - * @return callable + * @return this->endpoint * */ - public function getEndpoint(): callable + public function getEndpoint() { return $this->endpoint; } /** * Can supply third parm to Client::__construct() when invoking manually or with dependency injection - * @return NamespaceBuilderInterface[] + * @return this->registeredNamespacesBuilders * */ - public function getRegisteredNamespacesBuilders(): array + public function getRegisteredNamespacesBuilders() { return $this->registeredNamespacesBuilders; } @@ -155,7 +143,7 @@ public function getRegisteredNamespacesBuilders(): array * @throws Common\Exceptions\RuntimeException * @return \Elasticsearch\Client */ - public static function fromConfig(array $config, bool $quiet = false): Client + public static function fromConfig($config, $quiet = false) { $builder = new self; foreach ($config as $key => $value) { @@ -179,7 +167,7 @@ public static function fromConfig(array $config, bool $quiet = false): Client * @throws \RuntimeException * @return callable */ - public static function defaultHandler(array $multiParams = [], array $singleParams = []): callable + public static function defaultHandler($multiParams = [], $singleParams = []) { $future = null; if (extension_loaded('curl')) { @@ -202,7 +190,7 @@ public static function defaultHandler(array $multiParams = [], array $singlePara * @throws \RuntimeException * @return CurlMultiHandler */ - public static function multiHandler(array $params = []): CurlMultiHandler + public static function multiHandler($params = []) { if (function_exists('curl_multi_init')) { return new CurlMultiHandler(array_merge([ 'mh' => curl_multi_init() ], $params)); @@ -215,7 +203,7 @@ public static function multiHandler(array $params = []): CurlMultiHandler * @return CurlHandler * @throws \RuntimeException */ - public static function singleHandler(): CurlHandler + public static function singleHandler() { if (function_exists('curl_reset')) { return new CurlHandler(); @@ -224,11 +212,25 @@ public static function singleHandler(): CurlHandler } } + /** + * @param $path string + * @param int $level + * @return \Monolog\Logger\Logger + */ + public static function defaultLogger($path, $level = Logger::WARNING) + { + $log = new Logger('log'); + $handler = new StreamHandler($path, $level); + $log->pushHandler($handler); + + return $log; + } + /** * @param \Elasticsearch\Connections\ConnectionFactoryInterface $connectionFactory * @return $this */ - public function setConnectionFactory(ConnectionFactoryInterface $connectionFactory): ClientBuilder + public function setConnectionFactory(ConnectionFactoryInterface $connectionFactory) { $this->connectionFactory = $connectionFactory; @@ -241,7 +243,7 @@ public function setConnectionFactory(ConnectionFactoryInterface $connectionFacto * @throws \InvalidArgumentException * @return $this */ - public function setConnectionPool($connectionPool, array $args = []): ClientBuilder + public function setConnectionPool($connectionPool, array $args = []) { if (is_string($connectionPool)) { $this->connectionPool = $connectionPool; @@ -259,7 +261,7 @@ public function setConnectionPool($connectionPool, array $args = []): ClientBuil * @param callable $endpoint * @return $this */ - public function setEndpoint(callable $endpoint): ClientBuilder + public function setEndpoint($endpoint) { $this->endpoint = $endpoint; @@ -270,7 +272,7 @@ public function setEndpoint(callable $endpoint): ClientBuilder * @param NamespaceBuilderInterface $namespaceBuilder * @return $this */ - public function registerNamespace(NamespaceBuilderInterface $namespaceBuilder): ClientBuilder + public function registerNamespace(NamespaceBuilderInterface $namespaceBuilder) { $this->registeredNamespacesBuilders[] = $namespaceBuilder; @@ -281,7 +283,7 @@ public function registerNamespace(NamespaceBuilderInterface $namespaceBuilder): * @param \Elasticsearch\Transport $transport * @return $this */ - public function setTransport(Transport $transport): ClientBuilder + public function setTransport($transport) { $this->transport = $transport; @@ -292,7 +294,7 @@ public function setTransport(Transport $transport): ClientBuilder * @param mixed $handler * @return $this */ - public function setHandler($handler): ClientBuilder + public function setHandler($handler) { $this->handler = $handler; @@ -303,8 +305,12 @@ public function setHandler($handler): ClientBuilder * @param \Psr\Log\LoggerInterface $logger * @return $this */ - public function setLogger(LoggerInterface $logger): ClientBuilder + public function setLogger($logger) { + if (!$logger instanceof LoggerInterface) { + throw new InvalidArgumentException('$logger must implement \Psr\Log\LoggerInterface!'); + } + $this->logger = $logger; return $this; @@ -314,8 +320,12 @@ public function setLogger(LoggerInterface $logger): ClientBuilder * @param \Psr\Log\LoggerInterface $tracer * @return $this */ - public function setTracer(LoggerInterface $tracer): ClientBuilder + public function setTracer($tracer) { + if (!$tracer instanceof LoggerInterface) { + throw new InvalidArgumentException('$tracer must implement \Psr\Log\LoggerInterface!'); + } + $this->tracer = $tracer; return $this; @@ -326,7 +336,7 @@ public function setTracer(LoggerInterface $tracer): ClientBuilder * @throws \InvalidArgumentException * @return $this */ - public function setSerializer($serializer): ClientBuilder + public function setSerializer($serializer) { $this->parseStringOrObject($serializer, $this->serializer, 'SerializerInterface'); @@ -348,7 +358,7 @@ public function setHosts($hosts) * @param array $params * @return $this */ - public function setConnectionParams(array $params): ClientBuilder + public function setConnectionParams(array $params) { $this->connectionParams = $params; @@ -359,7 +369,7 @@ public function setConnectionParams(array $params): ClientBuilder * @param int $retries * @return $this */ - public function setRetries($retries): ClientBuilder + public function setRetries($retries) { $this->retries = $retries; @@ -371,7 +381,7 @@ public function setRetries($retries): ClientBuilder * @throws \InvalidArgumentException * @return $this */ - public function setSelector($selector): ClientBuilder + public function setSelector($selector) { $this->parseStringOrObject($selector, $this->selector, 'SelectorInterface'); @@ -382,7 +392,7 @@ public function setSelector($selector): ClientBuilder * @param boolean $sniffOnStart * @return $this */ - public function setSniffOnStart(bool $sniffOnStart): ClientBuilder + public function setSniffOnStart($sniffOnStart) { $this->sniffOnStart = $sniffOnStart; @@ -390,11 +400,11 @@ public function setSniffOnStart(bool $sniffOnStart): ClientBuilder } /** - * @param string $cert The name of a file containing a PEM formatted certificate. + * @param $cert * @param null|string $password * @return $this */ - public function setSSLCert(string $cert, string $password = null): ClientBuilder + public function setSSLCert($cert, $password = null) { $this->sslCert = [$cert, $password]; @@ -402,11 +412,11 @@ public function setSSLCert(string $cert, string $password = null): ClientBuilder } /** - * @param string $key The name of a file containing a private SSL key. + * @param $key * @param null|string $password * @return $this */ - public function setSSLKey(string $key, string $password = null): ClientBuilder + public function setSSLKey($key, $password = null) { $this->sslKey = [$key, $password]; @@ -417,27 +427,17 @@ public function setSSLKey(string $key, string $password = null): ClientBuilder * @param bool|string $value * @return $this */ - public function setSSLVerification($value = true): ClientBuilder + public function setSSLVerification($value = true) { $this->sslVerification = $value; return $this; } - /** - * Set or disable the x-elastic-client-meta header - */ - public function setElasticMetaHeader($value = true): ClientBuilder - { - $this->elasticMetaHeader = $value; - - return $this; - } - /** * @return Client */ - public function build(): Client + public function build() { $this->buildLoggers(); @@ -477,8 +477,6 @@ public function build(): Client $this->serializer = new $this->serializer; } - $this->connectionParams['client']['x-elastic-client-meta'] = $this->elasticMetaHeader; - if (is_null($this->connectionFactory)) { if (is_null($this->connectionParams)) { $this->connectionParams = []; @@ -520,11 +518,7 @@ public function build(): Client $this->endpoint = function ($class) use ($serializer) { $fullPath = '\\Elasticsearch\\Endpoints\\' . $class; - - $reflection = new ReflectionClass($fullPath); - $constructor = $reflection->getConstructor(); - - if ($constructor && $constructor->getParameters()) { + if ($class === 'Bulk' || $class === 'Msearch' || $class === 'MsearchTemplate' || $class === 'MPercolate') { return new $fullPath($serializer); } else { return new $fullPath(); @@ -534,7 +528,7 @@ public function build(): Client $registeredNamespaces = []; foreach ($this->registeredNamespacesBuilders as $builder) { - /** @var NamespaceBuilderInterface $builder */ + /** @var $builder NamespaceBuilderInterface */ $registeredNamespaces[$builder->getName()] = $builder->getObject($this->transport, $this->serializer); } @@ -547,12 +541,12 @@ public function build(): Client * @param Object[] $registeredNamespaces * @return Client */ - protected function instantiate(Transport $transport, callable $endpoint, array $registeredNamespaces): Client + protected function instantiate(Transport $transport, callable $endpoint, array $registeredNamespaces) { return new Client($transport, $endpoint, $registeredNamespaces); } - private function buildLoggers(): void + private function buildLoggers() { if (is_null($this->logger)) { $this->logger = new NullLogger(); @@ -563,7 +557,7 @@ private function buildLoggers(): void } } - private function buildTransport(): void + private function buildTransport() { $connections = $this->buildConnectionsFromHosts($this->hosts); @@ -588,11 +582,11 @@ private function buildTransport(): void } if (is_null($this->transport)) { - $this->transport = new Transport($this->retries, $this->connectionPool, $this->logger, $this->sniffOnStart); + $this->transport = new Transport($this->retries, $this->sniffOnStart, $this->connectionPool, $this->logger); } } - private function parseStringOrObject($arg, &$destination, $interface): void + private function parseStringOrObject($arg, &$destination, $interface) { if (is_string($arg)) { $destination = new $arg; @@ -606,7 +600,7 @@ private function parseStringOrObject($arg, &$destination, $interface): void /** * @return array */ - private function getDefaultHost(): array + private function getDefaultHost() { return ['localhost:9200']; } @@ -617,7 +611,7 @@ private function getDefaultHost(): array * @throws \InvalidArgumentException * @return \Elasticsearch\Connections\Connection[] */ - private function buildConnectionsFromHosts(array $hosts): array + private function buildConnectionsFromHosts($hosts) { if (is_array($hosts) === false) { $this->logger->error("Hosts parameter must be an array of strings, or an array of Connection hashes."); @@ -642,10 +636,10 @@ private function buildConnectionsFromHosts(array $hosts): array } /** - * @param array $host + * @param $host * @return array */ - private function normalizeExtendedHost(array $host): array + private function normalizeExtendedHost($host) { if (isset($host['host']) === false) { $this->logger->error("Required 'host' was not defined in extended format: ".print_r($host, true)); @@ -662,17 +656,17 @@ private function normalizeExtendedHost(array $host): array } /** - * @param string $host + * @param array $host * * @throws \InvalidArgumentException * @return array */ - private function extractURIParts(string $host): array + private function extractURIParts($host) { $parts = parse_url($host); if ($parts === false) { - throw new InvalidArgumentException(sprintf('Could not parse URI: "%s"', $host)); + throw new InvalidArgumentException("Could not parse URI"); } if (isset($parts['port']) !== true) { @@ -687,9 +681,9 @@ private function extractURIParts(string $host): array * * @return string */ - private function prependMissingScheme(string $host): string + private function prependMissingScheme($host) { - if (!filter_var($host, FILTER_VALIDATE_URL)) { + if (!filter_var($host, FILTER_VALIDATE_URL, FILTER_FLAG_SCHEME_REQUIRED)) { $host = 'http://' . $host; } diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/EmptyLogger.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/EmptyLogger.php index 19a62a310..89ced833d 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/EmptyLogger.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/EmptyLogger.php @@ -1,20 +1,4 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class EmptyLogger extends AbstractLogger implements LoggerInterface { diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/Exceptions/AlreadyExpiredException.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/Exceptions/AlreadyExpiredException.php index cd557956a..411c70abb 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/Exceptions/AlreadyExpiredException.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/Exceptions/AlreadyExpiredException.php @@ -1,26 +1,15 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class AlreadyExpiredException extends \Exception implements ElasticsearchException { diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/Exceptions/BadMethodCallException.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/Exceptions/BadMethodCallException.php index 468b93012..d8dea6c66 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/Exceptions/BadMethodCallException.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/Exceptions/BadMethodCallException.php @@ -1,20 +1,4 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class BadMethodCallException extends \BadMethodCallException implements ElasticsearchException { diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/Exceptions/BadRequest400Exception.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/Exceptions/BadRequest400Exception.php index ac9ddc5e9..1c652d78b 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/Exceptions/BadRequest400Exception.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/Exceptions/BadRequest400Exception.php @@ -1,26 +1,15 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class BadRequest400Exception extends \Exception implements ElasticsearchException { diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/Exceptions/ClientErrorResponseException.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/Exceptions/ClientErrorResponseException.php index 4547a34c9..844bbccaa 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/Exceptions/ClientErrorResponseException.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/Exceptions/ClientErrorResponseException.php @@ -1,26 +1,15 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class ClientErrorResponseException extends TransportException implements ElasticsearchException { diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/Exceptions/Conflict409Exception.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/Exceptions/Conflict409Exception.php index 1e0aae4a6..d7f10a47a 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/Exceptions/Conflict409Exception.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/Exceptions/Conflict409Exception.php @@ -1,26 +1,15 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class Conflict409Exception extends \Exception implements ElasticsearchException { diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/Exceptions/Curl/CouldNotConnectToHost.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/Exceptions/Curl/CouldNotConnectToHost.php index 3ff017b01..b1ccc22c9 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/Exceptions/Curl/CouldNotConnectToHost.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/Exceptions/Curl/CouldNotConnectToHost.php @@ -1,20 +1,4 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class CouldNotConnectToHost extends TransportException implements ElasticsearchException { diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/Exceptions/Curl/CouldNotResolveHostException.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/Exceptions/Curl/CouldNotResolveHostException.php index 0a064335d..283afdf9d 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/Exceptions/Curl/CouldNotResolveHostException.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/Exceptions/Curl/CouldNotResolveHostException.php @@ -1,20 +1,4 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class CouldNotResolveHostException extends TransportException implements ElasticsearchException { diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/Exceptions/Curl/OperationTimeoutException.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/Exceptions/Curl/OperationTimeoutException.php index b1d75cc27..12c1722f1 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/Exceptions/Curl/OperationTimeoutException.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/Exceptions/Curl/OperationTimeoutException.php @@ -1,20 +1,4 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class OperationTimeoutException extends TransportException implements ElasticsearchException { diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/Exceptions/ElasticsearchException.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/Exceptions/ElasticsearchException.php index c16a4d340..a5cab88c5 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/Exceptions/ElasticsearchException.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/Exceptions/ElasticsearchException.php @@ -1,26 +1,15 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ interface ElasticsearchException { diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/Exceptions/Forbidden403Exception.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/Exceptions/Forbidden403Exception.php index 718ab1206..2b84c64bc 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/Exceptions/Forbidden403Exception.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/Exceptions/Forbidden403Exception.php @@ -1,26 +1,15 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class Forbidden403Exception extends \Exception implements ElasticsearchException { diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/Exceptions/InvalidArgumentException.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/Exceptions/InvalidArgumentException.php index 09cb12b99..65e932baf 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/Exceptions/InvalidArgumentException.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/Exceptions/InvalidArgumentException.php @@ -1,20 +1,4 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class InvalidArgumentException extends \InvalidArgumentException implements ElasticsearchException { diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/Exceptions/MaxRetriesException.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/Exceptions/MaxRetriesException.php index 274cea31d..15b28337d 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/Exceptions/MaxRetriesException.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/Exceptions/MaxRetriesException.php @@ -1,26 +1,15 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class MaxRetriesException extends TransportException implements ElasticsearchException { diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/Exceptions/Missing404Exception.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/Exceptions/Missing404Exception.php index d0562599c..76bc87a8d 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/Exceptions/Missing404Exception.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/Exceptions/Missing404Exception.php @@ -1,26 +1,15 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class Missing404Exception extends \Exception implements ElasticsearchException { diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/Exceptions/NoDocumentsToGetException.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/Exceptions/NoDocumentsToGetException.php index a92cd0349..75beb9f59 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/Exceptions/NoDocumentsToGetException.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/Exceptions/NoDocumentsToGetException.php @@ -1,26 +1,15 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class NoDocumentsToGetException extends ServerErrorResponseException implements ElasticsearchException { diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/Exceptions/NoNodesAvailableException.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/Exceptions/NoNodesAvailableException.php index e9d550c72..63a179327 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/Exceptions/NoNodesAvailableException.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/Exceptions/NoNodesAvailableException.php @@ -1,26 +1,15 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class NoNodesAvailableException extends \Exception implements ElasticsearchException { diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/Exceptions/NoShardAvailableException.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/Exceptions/NoShardAvailableException.php index 2d17804ed..71b9a4ade 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/Exceptions/NoShardAvailableException.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/Exceptions/NoShardAvailableException.php @@ -1,26 +1,15 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class NoShardAvailableException extends ServerErrorResponseException implements ElasticsearchException { diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/Exceptions/RequestTimeout408Exception.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/Exceptions/RequestTimeout408Exception.php index 6dd61257b..8b668a88d 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/Exceptions/RequestTimeout408Exception.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/Exceptions/RequestTimeout408Exception.php @@ -1,26 +1,15 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class RequestTimeout408Exception extends BadRequest400Exception implements ElasticsearchException { diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/Exceptions/RoutingMissingException.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/Exceptions/RoutingMissingException.php index c9929ccd4..efa3cbd90 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/Exceptions/RoutingMissingException.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/Exceptions/RoutingMissingException.php @@ -1,20 +1,4 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class RoutingMissingException extends ServerErrorResponseException implements ElasticsearchException { diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/Exceptions/RuntimeException.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/Exceptions/RuntimeException.php index 2bfe289f3..2fc381a5f 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/Exceptions/RuntimeException.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/Exceptions/RuntimeException.php @@ -1,26 +1,15 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class RuntimeException extends \RuntimeException implements ElasticsearchException { diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/Exceptions/ScriptLangNotSupportedException.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/Exceptions/ScriptLangNotSupportedException.php index 40acee522..255c3a55a 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/Exceptions/ScriptLangNotSupportedException.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/Exceptions/ScriptLangNotSupportedException.php @@ -1,26 +1,15 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class ScriptLangNotSupportedException extends BadRequest400Exception implements ElasticsearchException { diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/Exceptions/Serializer/JsonErrorException.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/Exceptions/Serializer/JsonErrorException.php index f8619c671..626d4ae47 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/Exceptions/Serializer/JsonErrorException.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/Exceptions/Serializer/JsonErrorException.php @@ -1,20 +1,4 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class JsonErrorException extends \Exception implements ElasticsearchException { diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/Exceptions/ServerErrorResponseException.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/Exceptions/ServerErrorResponseException.php index 6d9836c11..9841254e1 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/Exceptions/ServerErrorResponseException.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/Exceptions/ServerErrorResponseException.php @@ -1,26 +1,15 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class ServerErrorResponseException extends TransportException implements ElasticsearchException { diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/Exceptions/TransportException.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/Exceptions/TransportException.php index 962b556f5..6dce5b482 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/Exceptions/TransportException.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/Exceptions/TransportException.php @@ -1,26 +1,15 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class TransportException extends \Exception implements ElasticsearchException { diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/Exceptions/Unauthorized401Exception.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/Exceptions/Unauthorized401Exception.php index 7d87d3f9a..eaf695d44 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/Exceptions/Unauthorized401Exception.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/Exceptions/Unauthorized401Exception.php @@ -1,26 +1,15 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class Unauthorized401Exception extends \Exception implements ElasticsearchException { diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/Exceptions/UnexpectedValueException.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/Exceptions/UnexpectedValueException.php index 588cfe01d..2a63e8088 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/Exceptions/UnexpectedValueException.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Common/Exceptions/UnexpectedValueException.php @@ -1,20 +1,4 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class UnexpectedValueException extends \UnexpectedValueException implements ElasticsearchException { diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/ConnectionPool/AbstractConnectionPool.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/ConnectionPool/AbstractConnectionPool.php index e820a9af8..625eaa4a0 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/ConnectionPool/AbstractConnectionPool.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/ConnectionPool/AbstractConnectionPool.php @@ -1,20 +1,4 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ abstract class AbstractConnectionPool implements ConnectionPoolInterface { diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/ConnectionPool/ConnectionPoolInterface.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/ConnectionPool/ConnectionPoolInterface.php index a87c89126..d10fc3542 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/ConnectionPool/ConnectionPoolInterface.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/ConnectionPool/ConnectionPoolInterface.php @@ -1,20 +1,4 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ interface ConnectionPoolInterface { diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/ConnectionPool/Selectors/RandomSelector.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/ConnectionPool/Selectors/RandomSelector.php index 56b8773a7..b544292e3 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/ConnectionPool/Selectors/RandomSelector.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/ConnectionPool/Selectors/RandomSelector.php @@ -1,20 +1,4 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class RandomSelector implements SelectorInterface { diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/ConnectionPool/Selectors/RoundRobinSelector.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/ConnectionPool/Selectors/RoundRobinSelector.php index 91c09f84d..d725d0d20 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/ConnectionPool/Selectors/RoundRobinSelector.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/ConnectionPool/Selectors/RoundRobinSelector.php @@ -1,20 +1,4 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class RoundRobinSelector implements SelectorInterface { diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/ConnectionPool/Selectors/SelectorInterface.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/ConnectionPool/Selectors/SelectorInterface.php index 361af6891..d29953942 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/ConnectionPool/Selectors/SelectorInterface.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/ConnectionPool/Selectors/SelectorInterface.php @@ -1,33 +1,22 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ interface SelectorInterface { /** * Perform logic to select a single ConnectionInterface instance from the array provided * - * @param \Elasticsearch\Connections\ConnectionInterface[] $connections an array of ConnectionInterface instances to choose from + * @param \Elasticsearch\Connections\ConnectionInterface[] $connections an array of ConnectionInterface instances to choose from * * @return \Elasticsearch\Connections\ConnectionInterface */ diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/ConnectionPool/Selectors/StickyRoundRobinSelector.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/ConnectionPool/Selectors/StickyRoundRobinSelector.php index 28d75de0a..f44a68ca4 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/ConnectionPool/Selectors/StickyRoundRobinSelector.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/ConnectionPool/Selectors/StickyRoundRobinSelector.php @@ -1,20 +1,4 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class StickyRoundRobinSelector implements SelectorInterface { diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/ConnectionPool/SimpleConnectionPool.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/ConnectionPool/SimpleConnectionPool.php index 505be4274..f77e8d766 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/ConnectionPool/SimpleConnectionPool.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/ConnectionPool/SimpleConnectionPool.php @@ -1,20 +1,4 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class Connection implements ConnectionInterface { @@ -65,7 +53,7 @@ class Connection implements ConnectionInterface protected $host; /** - * @var string|null + * @var string || null */ protected $path; @@ -102,7 +90,9 @@ class Connection implements ConnectionInterface private $lastRequest = array(); /** - * @param callable $handler + * Constructor + * + * @param $handler * @param array $hostDetails * @param array $connectionParams Array of connection-specific parameters * @param \Elasticsearch\Serializers\SerializerInterface $serializer @@ -117,7 +107,7 @@ public function __construct( LoggerInterface $log, LoggerInterface $trace ) { - + if (isset($hostDetails['port']) !== true) { $hostDetails['port'] = 9200; } @@ -136,20 +126,6 @@ public function __construct( unset($connectionParams['client']['headers']); } - // Add the User-Agent using the format: / (metadata-values) - $this->headers['User-Agent'] = [sprintf( - "elasticsearch-php/%s (%s %s, PHP %s)", - Client::VERSION, - php_uname("s"), - php_uname("r"), - phpversion() - )]; - - // Add x-elastic-client-meta header, if enabled - if (isset($connectionParams['client']['x-elastic-client-meta']) && $connectionParams['client']['x-elastic-client-meta']) { - $this->headers['x-elastic-client-meta'] = [$this->getElasticMetaHeader($connectionParams)]; - } - $host = $hostDetails['host'].':'.$hostDetails['port']; $path = null; if (isset($hostDetails['path']) === true) { @@ -162,13 +138,13 @@ public function __construct( $this->connectionParams = $connectionParams; $this->serializer = $serializer; - $this->handler = $this->wrapHandler($handler); + $this->handler = $this->wrapHandler($handler, $log, $trace); } /** - * @param string $method - * @param string $uri - * @param array $params + * @param $method + * @param $uri + * @param null $params * @param null $body * @param array $options * @param \Elasticsearch\Transport $transport @@ -176,21 +152,18 @@ public function __construct( */ public function performRequest($method, $uri, $params = null, $body = null, $options = [], Transport $transport = null) { - if ($body !== null) { + if (isset($body) === true) { $body = $this->serializer->serialize($body); } - $headers = $this->headers; - if (isset($options['client']['headers']) && is_array($options['client']['headers'])) { - $headers = array_merge($this->headers, $options['client']['headers']); - } - $request = [ 'http_method' => $method, 'scheme' => $this->transportSchema, 'uri' => $this->getURI($uri, $params), 'body' => $body, - 'headers' => array_merge(['Host' => [$this->host]], $headers) + 'headers' => array_merge([ + 'Host' => [$this->host] + ], $this->headers) ]; $request = array_replace_recursive($request, $this->connectionParams, $options); @@ -206,12 +179,6 @@ public function performRequest($method, $uri, $params = null, $body = null, $opt return $future; } - /** @return array */ - public function getHeaders() - { - return $this->headers; - } - /** @return string */ public function getTransportSchema() { @@ -224,15 +191,15 @@ public function getLastRequestInfo() return $this->lastRequest; } - private function wrapHandler(callable $handler) + private function wrapHandler(callable $handler, LoggerInterface $logger, LoggerInterface $tracer) { - return function (array $request, Connection $connection, Transport $transport = null, $options) use ($handler) { + return function (array $request, Connection $connection, Transport $transport = null, $options) use ($handler, $logger, $tracer) { $this->lastRequest = []; $this->lastRequest['request'] = $request; // Send the request using the wrapped handler. - $response = Core::proxy($handler($request), function ($response) use ($connection, $transport, $request, $options) { + $response = Core::proxy($handler($request), function ($response) use ($connection, $transport, $logger, $tracer, $request, $options) { $this->lastRequest['response'] = $response; @@ -341,20 +308,16 @@ private function wrapHandler(callable $handler) * * @return string */ - private function getURI(string $uri, ?array $params): string + private function getURI($uri, $params) { if (isset($params) === true && !empty($params)) { - $params = array_map( - function ($value) { - if ($value === true) { - return 'true'; - } elseif ($value === false) { - return 'false'; - } - return $value; - }, - $params - ); + array_walk($params, function (&$value, &$key) { + if ($value === true) { + $value = 'true'; + } elseif ($value === false) { + $value = 'false'; + } + }); $uri .= '?' . http_build_query($params); } @@ -363,7 +326,7 @@ function ($value) { $uri = $this->path . $uri; } - return $uri ?? ''; + return $uri; } /** @@ -419,7 +382,7 @@ public function logRequestSuccess($method, $fullURI, $body, $headers, $statusCod * @param null|string $statusCode * @param null|string $response * @param string $duration - * @param \Exception $exception + * @param \Exception|null $exception * * @return void */ @@ -567,8 +530,8 @@ public function getPath() } /** - * @param array $request - * @param array $response + * @param $request + * @param $response * @return \Elasticsearch\Common\Exceptions\Curl\CouldNotConnectToHost|\Elasticsearch\Common\Exceptions\Curl\CouldNotResolveHostException|\Elasticsearch\Common\Exceptions\Curl\OperationTimeoutException|\Elasticsearch\Common\Exceptions\MaxRetriesException */ protected function getCurlRetryException($request, $response) @@ -578,13 +541,13 @@ protected function getCurlRetryException($request, $response) $exception = new MaxRetriesException($message); switch ($response['curl']['errno']) { case 6: - $exception = new CouldNotResolveHostException($message, 0, $exception); + $exception = new CouldNotResolveHostException($message, null, $exception); break; case 7: - $exception = new CouldNotConnectToHost($message, 0, $exception); + $exception = new CouldNotConnectToHost($message, null, $exception); break; case 28: - $exception = new OperationTimeoutException($message, 0, $exception); + $exception = new OperationTimeoutException($message, null, $exception); break; } @@ -600,7 +563,7 @@ protected function getCurlRetryException($request, $response) * * @return string */ - private function buildCurlCommand(string $method, string $uri, ?string $body): string + private function buildCurlCommand($method, $uri, $body) { if (strpos($uri, '?') === false) { $uri .= '?pretty=true'; @@ -619,10 +582,10 @@ private function buildCurlCommand(string $method, string $uri, ?string $body): s } /** - * @param array $request - * @param array $response - * @param array $ignore - * @throws \Elasticsearch\Common\Exceptions\AlreadyExpiredException|\Elasticsearch\Common\Exceptions\BadRequest400Exception|\Elasticsearch\Common\Exceptions\Conflict409Exception|\Elasticsearch\Common\Exceptions\Forbidden403Exception|\Elasticsearch\Common\Exceptions\Missing404Exception|\Elasticsearch\Common\Exceptions\ScriptLangNotSupportedException + * @param $request + * @param $response + * @param $ignore + * @throws \Elasticsearch\Common\Exceptions\AlreadyExpiredException|\Elasticsearch\Common\Exceptions\BadRequest400Exception|\Elasticsearch\Common\Exceptions\Conflict409Exception|\Elasticsearch\Common\Exceptions\Forbidden403Exception|\Elasticsearch\Common\Exceptions\Missing404Exception|\Elasticsearch\Common\Exceptions\ScriptLangNotSupportedException|null */ private function process4xxError($request, $response, $ignore) { @@ -636,11 +599,6 @@ private function process4xxError($request, $response, $ignore) return; } - // if responseBody is not string, we convert it so it can be used as Exception message - if (!is_string($responseBody)) { - $responseBody = json_encode($responseBody); - } - if ($statusCode === 400 && strpos($responseBody, "AlreadyExpiredException") !== false) { $exception = new AlreadyExpiredException($responseBody, $statusCode); } elseif ($statusCode === 403) { @@ -672,9 +630,9 @@ private function process4xxError($request, $response, $ignore) } /** - * @param array $request - * @param array $response - * @param array $ignore + * @param $request + * @param $response + * @param $ignore * @throws \Elasticsearch\Common\Exceptions\NoDocumentsToGetException|\Elasticsearch\Common\Exceptions\NoShardAvailableException|\Elasticsearch\Common\Exceptions\RoutingMissingException|\Elasticsearch\Common\Exceptions\ServerErrorResponseException */ private function process5xxError($request, $response, $ignore) @@ -758,37 +716,7 @@ private function tryDeserializeError($response, $errorClass) return new $errorClass($response['body'], $response['status']); } - // if responseBody is not string, we convert it so it can be used as Exception message - $responseBody = $response['body']; - if (!is_string($responseBody)) { - $responseBody = json_encode($responseBody); - } - // <2.0 "i just blew up" nonstructured exception - return new $errorClass($responseBody); - } - - /** - * Get the x-elastic-client-meta header - */ - private function getElasticMetaHeader(array $connectionParams): string - { - $phpSemVersion = sprintf("%d.%d.%d", PHP_MAJOR_VERSION, PHP_MINOR_VERSION, PHP_RELEASE_VERSION); - // Reduce the size in case of '-snapshot' version (using 'p' as pre-release) - $clientVersion = str_replace('-snapshot', '-p', strtolower(Client::VERSION)); - $clientMeta = sprintf( - "es=%s,php=%s,t=%s,a=%d", - $clientVersion, - $phpSemVersion, - $clientVersion, - isset($connectionParams['client']['future']) && $connectionParams['client']['future'] === 'lazy' ? 1 : 0 - ); - if (function_exists('curl_version')) { - $curlVersion = curl_version(); - if (isset($curlVersion['version'])) { - $clientMeta .= sprintf(",cu=%s", $curlVersion['version']); // cu = curl library - } - } - return $clientMeta; + return new $errorClass($response['body']); } } diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/ConnectionFactory.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/ConnectionFactory.php index 851be17e7..88d6dc938 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/ConnectionFactory.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/ConnectionFactory.php @@ -1,20 +1,4 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class ConnectionFactory implements ConnectionFactoryInterface { @@ -60,7 +49,7 @@ public function __construct(callable $handler, array $connectionParams, Serializ $this->serializer = $serializer; } /** - * @param array $hostDetails + * @param $hostDetails * * @return ConnectionInterface */ diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/ConnectionFactoryInterface.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/ConnectionFactoryInterface.php index e8ffa3eff..94b628a71 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/ConnectionFactoryInterface.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/ConnectionFactoryInterface.php @@ -1,20 +1,4 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ interface ConnectionFactoryInterface { /** - * @param callable $handler + * @param $handler * @param array $connectionParams * @param SerializerInterface $serializer * @param LoggerInterface $logger @@ -43,7 +32,7 @@ public function __construct( ); /** - * @param array $hostDetails + * @param $hostDetails * * @return ConnectionInterface */ diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/ConnectionInterface.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/ConnectionInterface.php index a54de1e5f..8f675b246 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/ConnectionInterface.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/ConnectionInterface.php @@ -1,20 +1,4 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ interface ConnectionInterface { /** - * @param callable $handler + * Constructor + * + * @param $handler * @param array $hostDetails * @param array $connectionParams connection-specific parameters * @param \Elasticsearch\Serializers\SerializerInterface $serializer @@ -102,9 +93,9 @@ public function markDead(); public function getLastRequestInfo(); /** - * @param string $method - * @param string $uri - * @param array $params + * @param $method + * @param $uri + * @param null $params * @param null $body * @param array $options * @param \Elasticsearch\Transport $transport @@ -112,6 +103,6 @@ public function getLastRequestInfo(); */ // @codingStandardsIgnoreStart // "Arguments with default values must be at the end of the argument list" - cannot change the interface - public function performRequest(string $method, string $uri, ?array $params = [], $body = null, array $options = [], Transport $transport = null); + public function performRequest($method, $uri, $params = null, $body = null, $options = [], Transport $transport); // @codingStandardsIgnoreEnd } diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/AbstractEndpoint.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/AbstractEndpoint.php index a97788efe..3330705bd 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/AbstractEndpoint.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/AbstractEndpoint.php @@ -1,23 +1,12 @@ extractOptions($params); $this->checkUserParams($params); $params = $this->convertCustom($params); + $this->extractOptions($params); $this->params = $this->convertArraysToStrings($params); return $this; @@ -175,10 +164,6 @@ public function setID($docID) return $this; } - if (is_int($docID)) { - $docID = (string) $docID; - } - $this->id = urlencode($docID); return $this; @@ -237,13 +222,13 @@ private function getOptionalType() * * @throws \Elasticsearch\Common\Exceptions\UnexpectedValueException */ - private function checkUserParams(array $params) + private function checkUserParams($params) { - if (empty($params)) { + if (isset($params) !== true) { return; //no params, just return. } - $whitelist = array_merge($this->getParamWhitelist(), array('client', 'custom', 'filter_path', 'human', 'opaqueId')); + $whitelist = array_merge($this->getParamWhitelist(), array('client', 'custom', 'filter_path', 'human')); $invalid = array_diff(array_keys($params), $whitelist); if (count($invalid) > 0) { @@ -258,21 +243,12 @@ private function checkUserParams(array $params) } /** - * @param array $params Note: this is passed by-reference! + * @param $params Note: this is passed by-reference! */ private function extractOptions(&$params) { // Extract out client options, then start transforming if (isset($params['client']) === true) { - // Check if the opaqueId is populated and add the header - if (isset($params['client']['opaqueId']) === true) { - if (isset($params['client']['headers']) === false) { - $params['client']['headers'] = []; - } - $params['client']['headers']['x-opaque-id'] = [trim($params['client']['opaqueId'])]; - unset($params['client']['opaqueId']); - } - $this->options['client'] = $params['client']; unset($params['client']); } diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Bulk.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Bulk.php index 935eb0c50..3bc15bc4e 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Bulk.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Bulk.php @@ -1,95 +1,83 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class Bulk extends AbstractEndpoint implements BulkEndpointInterface { - + /** + * @param SerializerInterface $serializer + */ public function __construct(SerializerInterface $serializer) { $this->serializer = $serializer; } - public function getURI(): string + /** + * @param string|array|\Traversable $body + * + * @return $this + */ + public function setBody($body) { - $index = $this->index ?? null; - $type = $this->type ?? null; - - if (isset($index) && isset($type)) { - return "/$index/$type/_bulk"; + if (empty($body)) { + return $this; } - if (isset($index)) { - return "/$index/_bulk"; + + if (is_array($body) === true || $body instanceof \Traversable) { + foreach ($body as $item) { + $this->body .= $this->serializer->serialize($item) . "\n"; + } + } else { + $this->body = $body; } - return "/_bulk"; + + return $this; + } + + /** + * @return string + */ + public function getURI() + { + return $this->getOptionalURI('_bulk'); } - public function getParamWhitelist(): array + /** + * @return string[] + */ + public function getParamWhitelist() { - return [ - 'wait_for_active_shards', + return array( + 'consistency', 'refresh', - 'routing', - 'timeout', + 'replication', 'type', 'fields', + 'pipeline', '_source', - '_source_excludes', - '_source_includes', + '_source_include', + '_source_exclude', 'pipeline' - ]; + ); } - public function getMethod(): string + /** + * @return string + */ + public function getMethod() { return 'POST'; } - - public function setBody($body): Bulk - { - if (isset($body) !== true) { - return $this; - } - if (is_array($body) === true || $body instanceof Traversable) { - foreach ($body as $item) { - $this->body .= $this->serializer->serialize($item) . "\n"; - } - } elseif (is_string($body)) { - $this->body = $body; - if (substr($body, -1) != "\n") { - $this->body .= "\n"; - } - } else { - throw new InvalidArgumentException("Body must be an array, traversable object or string"); - } - return $this; - } - } diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/BulkEndpointInterface.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/BulkEndpointInterface.php index f59eb9fa9..c7da25451 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/BulkEndpointInterface.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/BulkEndpointInterface.php @@ -1,20 +1,4 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ interface BulkEndpointInterface { diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cat/Aliases.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cat/Aliases.php index 53bfb0df2..4fbebccdd 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cat/Aliases.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cat/Aliases.php @@ -1,18 +1,4 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class Aliases extends AbstractEndpoint { - protected $name; + // A comma-separated list of alias names to return + private $name; + + /** + * @param $name + * + * @return $this + */ + public function setName($name) + { + if (isset($name) !== true) { + return $this; + } + + $this->name = $name; - public function getURI(): string + return $this; + } + + /** + * @return string + */ + public function getURI() { - $name = $this->name ?? null; + $name = $this->name; + $uri = "/_cat/aliases"; - if (isset($name)) { - return "/_cat/aliases/$name"; + if (isset($name) === true) { + $uri = "/_cat/aliases/$name"; } - return "/_cat/aliases"; + + return $uri; } - public function getParamWhitelist(): array + /** + * @return string[] + */ + public function getParamWhitelist() { - return [ - 'format', + return array( 'local', 'master_timeout', 'h', 'help', + 'v', + 'format', 's', - 'v' - ]; + 'format', + ); } - public function getMethod(): string + /** + * @return string + */ + public function getMethod() { return 'GET'; } - - public function setName($name): Aliases - { - if (isset($name) !== true) { - return $this; - } - if (is_array($name) === true) { - $name = implode(",", $name); - } - $this->name = $name; - - return $this; - } } diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cat/Allocation.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cat/Allocation.php index a8a24fd5f..3084385d9 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cat/Allocation.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cat/Allocation.php @@ -1,18 +1,4 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class Allocation extends AbstractEndpoint { - protected $node_id; + // A comma-separated list of node IDs or names to limit the returned information + private $node_id; + + /** + * @param $node_id + * + * @return $this + */ + public function setNodeId($node_id) + { + if (isset($node_id) !== true) { + return $this; + } + + $this->node_id = $node_id; + + return $this; + } - public function getURI(): string + /** + * @return string + */ + public function getURI() { - $node_id = $this->node_id ?? null; + $node_id = $this->node_id; + $uri = "/_cat/allocation"; - if (isset($node_id)) { - return "/_cat/allocation/$node_id"; + if (isset($node_id) === true) { + $uri = "/_cat/allocation/$node_id"; } - return "/_cat/allocation"; + + return $uri; } - public function getParamWhitelist(): array + /** + * @return string[] + */ + public function getParamWhitelist() { - return [ - 'format', + return array( 'bytes', 'local', 'master_timeout', 'h', 'help', + 'v', 's', - 'v' - ]; + 'format', + ); } - public function getMethod(): string + /** + * @return string + */ + public function getMethod() { return 'GET'; } - - public function setNodeId($node_id): Allocation - { - if (isset($node_id) !== true) { - return $this; - } - if (is_array($node_id) === true) { - $node_id = implode(",", $node_id); - } - $this->node_id = $node_id; - - return $this; - } } diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cat/Count.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cat/Count.php index 658ad28a0..de64d3f02 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cat/Count.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cat/Count.php @@ -1,18 +1,4 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class Count extends AbstractEndpoint { - - public function getURI(): string + /** + * @return string + */ + public function getURI() { - $index = $this->index ?? null; + $index = $this->index; + $uri = "/_cat/count"; - if (isset($index)) { - return "/_cat/count/$index"; + if (isset($index) === true) { + $uri = "/_cat/count/$index"; } - return "/_cat/count"; + + return $uri; } - public function getParamWhitelist(): array + /** + * @return string[] + */ + public function getParamWhitelist() { - return [ - 'format', + return array( 'local', 'master_timeout', 'h', 'help', + 'v', 's', - 'v' - ]; + 'format', + ); } - public function getMethod(): string + /** + * @return string + */ + public function getMethod() { return 'GET'; } diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cat/Fielddata.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cat/Fielddata.php index b626bbb4a..61a2303e8 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cat/Fielddata.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cat/Fielddata.php @@ -1,18 +1,4 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class Fielddata extends AbstractEndpoint { - protected $fields; + private $fields; + + /** + * @param $fields + * + * @return $this + */ + public function setFields($fields) + { + if (isset($fields) !== true) { + return $this; + } + + $this->fields = $fields; - public function getURI(): string + return $this; + } + + /** + * @return string + */ + public function getURI() { - $fields = $this->fields ?? null; + $fields = $this->fields; + $uri = "/_cat/fielddata"; - if (isset($fields)) { - return "/_cat/fielddata/$fields"; + if (isset($fields) === true) { + $uri = "/_cat/fielddata/$fields"; } - return "/_cat/fielddata"; + + return $uri; } - public function getParamWhitelist(): array + /** + * @return string[] + */ + public function getParamWhitelist() { - return [ - 'format', - 'bytes', + return array( 'local', 'master_timeout', 'h', 'help', - 's', 'v', - 'fields' - ]; + 's', + 'format', + ); } - public function getMethod(): string + /** + * @return string + */ + public function getMethod() { return 'GET'; } - - public function setFields($fields): Fielddata - { - if (isset($fields) !== true) { - return $this; - } - if (is_array($fields) === true) { - $fields = implode(",", $fields); - } - $this->fields = $fields; - - return $this; - } } diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cat/Health.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cat/Health.php index d9e3e8604..1dbb5192a 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cat/Health.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cat/Health.php @@ -1,18 +1,4 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class Health extends AbstractEndpoint { - - public function getURI(): string + /** + * @return string + */ + public function getURI() { + $uri = "/_cat/health"; - return "/_cat/health"; + return $uri; } - public function getParamWhitelist(): array + /** + * @return string[] + */ + public function getParamWhitelist() { - return [ - 'format', + return array( 'local', 'master_timeout', 'h', 'help', - 's', 'ts', - 'v' - ]; + 'v', + 's', + 'format', + ); } - public function getMethod(): string + /** + * @return string + */ + public function getMethod() { return 'GET'; } diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cat/Help.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cat/Help.php index 11a1309c9..945db52a4 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cat/Help.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cat/Help.php @@ -1,18 +1,4 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class Help extends AbstractEndpoint { - - public function getURI(): string + /** + * @return string + */ + public function getURI() { + $uri = "/_cat"; - return "/_cat"; + return $uri; } - public function getParamWhitelist(): array + /** + * @return string[] + */ + public function getParamWhitelist() { - return [ + return array( 'help', - 's' - ]; + 's', + 'format', + ); } - public function getMethod(): string + /** + * @return string + */ + public function getMethod() { return 'GET'; } diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cat/Indices.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cat/Indices.php index f57fd3abc..595f5aa31 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cat/Indices.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cat/Indices.php @@ -1,18 +1,4 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ + class Indices extends AbstractEndpoint { - - public function getURI(): string + /** + * @return string + */ + public function getURI() { - $index = $this->index ?? null; + $index = $this->index; + $uri = "/_cat/indices"; - if (isset($index)) { - return "/_cat/indices/$index"; + if (isset($index) === true) { + $uri = "/_cat/indices/$index"; } - return "/_cat/indices"; + + return $uri; } - public function getParamWhitelist(): array + /** + * @return string[] + */ + public function getParamWhitelist() { - return [ - 'format', + return array( 'bytes', 'local', 'master_timeout', 'h', - 'health', 'help', 'pri', + 'v', + 'health', 's', - 'v' - ]; + 'format', + ); } - public function getMethod(): string + /** + * @return string + */ + public function getMethod() { return 'GET'; } diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cat/Master.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cat/Master.php index c4c0e36d1..4fdec3d23 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cat/Master.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cat/Master.php @@ -1,18 +1,4 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class Master extends AbstractEndpoint { - - public function getURI(): string + /** + * @return string + */ + public function getURI() { + $uri = "/_cat/master"; - return "/_cat/master"; + return $uri; } - public function getParamWhitelist(): array + /** + * @return string[] + */ + public function getParamWhitelist() { - return [ - 'format', + return array( 'local', 'master_timeout', 'h', 'help', + 'v', 's', - 'v' - ]; + 'format', + ); } - public function getMethod(): string + /** + * @return string + */ + public function getMethod() { return 'GET'; } diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cat/NodeAttrs.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cat/NodeAttrs.php index 22d569813..e8e773c33 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cat/NodeAttrs.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cat/NodeAttrs.php @@ -1,18 +1,4 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class NodeAttrs extends AbstractEndpoint { - - public function getURI(): string + /** + * @return string + */ + public function getURI() { + $uri = "/_cat/nodeattrs"; - return "/_cat/nodeattrs"; + return $uri; } - public function getParamWhitelist(): array + /** + * @return string[] + */ + public function getParamWhitelist() { - return [ - 'format', + return array( 'local', 'master_timeout', 'h', 'help', + 'v', 's', - 'v' - ]; + 'format', + ); } - public function getMethod(): string + /** + * @return string + */ + public function getMethod() { return 'GET'; } diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cat/Nodes.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cat/Nodes.php index 9eaa515cb..4c2b565c5 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cat/Nodes.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cat/Nodes.php @@ -1,18 +1,4 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class Nodes extends AbstractEndpoint { - - public function getURI(): string + /** + * @return string + */ + public function getURI() { + $uri = "/_cat/nodes"; - return "/_cat/nodes"; + return $uri; } - public function getParamWhitelist(): array + /** + * @return string[] + */ + public function getParamWhitelist() { - return [ - 'format', - 'full_id', + return array( 'local', 'master_timeout', 'h', 'help', + 'v', 's', - 'v' - ]; + 'full_id', + 'format', + ); } - public function getMethod(): string + /** + * @return string + */ + public function getMethod() { return 'GET'; } diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cat/PendingTasks.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cat/PendingTasks.php index 0bbac1aba..0cc9519d1 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cat/PendingTasks.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cat/PendingTasks.php @@ -1,53 +1,50 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class PendingTasks extends AbstractEndpoint { - - public function getURI(): string + /** + * @return string + */ + public function getURI() { + $uri = "/_cat/pending_tasks"; - return "/_cat/pending_tasks"; + return $uri; } - public function getParamWhitelist(): array + /** + * @return string[] + */ + public function getParamWhitelist() { - return [ - 'format', + return array( 'local', 'master_timeout', 'h', 'help', + 'v', 's', - 'v' - ]; + 'format', + ); } - public function getMethod(): string + /** + * @return string + */ + public function getMethod() { return 'GET'; } diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cat/Plugins.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cat/Plugins.php index 1096c167f..39b9b7e5a 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cat/Plugins.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cat/Plugins.php @@ -1,53 +1,50 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class Plugins extends AbstractEndpoint { - - public function getURI(): string + /** + * @return string + */ + public function getURI() { + $uri = "/_cat/plugins"; - return "/_cat/plugins"; + return $uri; } - public function getParamWhitelist(): array + /** + * @return string[] + */ + public function getParamWhitelist() { - return [ - 'format', + return array( 'local', 'master_timeout', 'h', 'help', + 'v', 's', - 'v' - ]; + 'format', + ); } - public function getMethod(): string + /** + * @return string + */ + public function getMethod() { return 'GET'; } diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cat/Recovery.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cat/Recovery.php index d17d74550..1acf6c5d4 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cat/Recovery.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cat/Recovery.php @@ -1,18 +1,4 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class Recovery extends AbstractEndpoint { - - public function getURI(): string + /** + * @return string + */ + public function getURI() { - $index = $this->index ?? null; + $index = $this->index; + $uri = "/_cat/recovery"; - if (isset($index)) { - return "/_cat/recovery/$index"; + if (isset($index) === true) { + $uri = "/_cat/recovery/$index"; } - return "/_cat/recovery"; + + return $uri; } - public function getParamWhitelist(): array + /** + * @return string[] + */ + public function getParamWhitelist() { - return [ - 'format', + return array( 'bytes', + 'local', 'master_timeout', 'h', 'help', + 'v', 's', - 'v' - ]; + 'format', + ); } - public function getMethod(): string + /** + * @return string + */ + public function getMethod() { return 'GET'; } diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cat/Repositories.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cat/Repositories.php index c2887cbf3..43cc12108 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cat/Repositories.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cat/Repositories.php @@ -1,18 +1,4 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class Repositories extends AbstractEndpoint { - - public function getURI(): string + /** + * @return string + */ + public function getURI() { + $uri = "/_cat/repositories"; - return "/_cat/repositories"; + return $uri; } - public function getParamWhitelist(): array + /** + * @return string[] + */ + public function getParamWhitelist() { - return [ - 'format', + return array( 'local', 'master_timeout', 'h', 'help', + 'v', 's', - 'v' - ]; + 'format', + ); } - public function getMethod(): string + /** + * @return string + */ + public function getMethod() { return 'GET'; } diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cat/Segments.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cat/Segments.php index e9b3415be..ef969fb5c 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cat/Segments.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cat/Segments.php @@ -1,56 +1,62 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ + class Segments extends AbstractEndpoint { - - public function getURI(): string + /** + * @return string + */ + public function getURI() { - $index = $this->index ?? null; + $index = $this->index; + $uri = "/_cat/segments"; - if (isset($index)) { - return "/_cat/segments/$index"; + if (isset($index) === true) { + $uri = "/_cat/segments/$index"; } - return "/_cat/segments"; + + return $uri; } - public function getParamWhitelist(): array + + /** + * @return string[] + */ + public function getParamWhitelist() { - return [ - 'format', - 'bytes', + return array( 'h', 'help', + 'v', 's', - 'v' - ]; + 'format', + ); } - public function getMethod(): string + + /** + * @return string + */ + public function getMethod() { return 'GET'; } diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cat/Shards.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cat/Shards.php index bdd936da0..78d8f3343 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cat/Shards.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cat/Shards.php @@ -1,18 +1,4 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class Shards extends AbstractEndpoint { - - public function getURI(): string + /** + * @return string + */ + public function getURI() { - $index = $this->index ?? null; + $index = $this->index; + $uri = "/_cat/shards"; - if (isset($index)) { - return "/_cat/shards/$index"; + if (isset($index) === true) { + $uri = "/_cat/shards/$index"; } - return "/_cat/shards"; + + return $uri; } - public function getParamWhitelist(): array + /** + * @return string[] + */ + public function getParamWhitelist() { - return [ - 'format', + return array( 'bytes', 'local', 'master_timeout', 'h', 'help', + 'v', 's', - 'v' - ]; + 'format', + ); } - public function getMethod(): string + /** + * @return string + */ + public function getMethod() { return 'GET'; } diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cat/Snapshots.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cat/Snapshots.php index da2472b86..75de7725f 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cat/Snapshots.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cat/Snapshots.php @@ -1,72 +1,73 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class Snapshots extends AbstractEndpoint { - protected $repository; + private $repository; - public function getURI(): string + /** + * @param $fields + * + * @return $this + */ + public function setRepository($repository) { - $repository = $this->repository ?? null; + if (isset($repository) !== true) { + return $this; + } - if (isset($repository)) { - return "/_cat/snapshots/$repository"; + $this->repository = $repository; + + return $this; + } + + /** + * @return string + */ + public function getURI() + { + $repository = $this->repository; + if (isset($this->repository) === true) { + return "/_cat/snapshots/$repository/"; } - return "/_cat/snapshots"; + + return "/_cat/snapshots/"; } - public function getParamWhitelist(): array + /** + * @return string[] + */ + public function getParamWhitelist() { - return [ - 'format', - 'ignore_unavailable', + return array( + 'local', 'master_timeout', 'h', 'help', + 'v', 's', - 'v' - ]; + 'format', + ); } - public function getMethod(): string + /** + * @return string + */ + public function getMethod() { return 'GET'; } - - public function setRepository($repository): Snapshots - { - if (isset($repository) !== true) { - return $this; - } - if (is_array($repository) === true) { - $repository = implode(",", $repository); - } - $this->repository = $repository; - - return $this; - } } diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cat/Tasks.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cat/Tasks.php index 76d0a1634..92cc03353 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cat/Tasks.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cat/Tasks.php @@ -1,18 +1,4 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class Tasks extends AbstractEndpoint { - - public function getURI(): string + /** + * @return string + */ + public function getURI() { - return "/_cat/tasks"; } - public function getParamWhitelist(): array + /** + * @return string[] + */ + public function getParamWhitelist() { - return [ + return array( 'format', 'node_id', 'actions', 'detailed', + 'parent_node', 'parent_task', 'h', 'help', - 's', - 'v' - ]; + 'v', + 's' + ); } - public function getMethod(): string + /** + * @return string + */ + public function getMethod() { return 'GET'; } diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cat/Templates.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cat/Templates.php index f8c057dfe..aee9e61fb 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cat/Templates.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cat/Templates.php @@ -1,18 +1,4 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class Templates extends AbstractEndpoint { - protected $name; + private $name; - public function getURI(): string + /** + * @param string $name + * @return Templates + */ + public function setName($name) { - $name = $this->name ?? null; + $this->name = $name; + return $this; + } - if (isset($name)) { - return "/_cat/templates/$name"; + /** + * @return string + */ + public function getURI() + { + if (isset($this->name)) { + return "/_cat/templates/{$this->name}"; + } else { + return "/_cat/templates"; } - return "/_cat/templates"; } - public function getParamWhitelist(): array + /** + * @return string[] + */ + public function getParamWhitelist() { - return [ + return array( 'format', - 'local', - 'master_timeout', + 'node_id', + 'actions', + 'detailed', + 'parent_node', + 'parent_task', 'h', 'help', + 'v', 's', - 'v' - ]; + 'local', + 'master_timeout', + ); } - public function getMethod(): string + /** + * @return string + */ + public function getMethod() { return 'GET'; } - - public function setName($name): Templates - { - if (isset($name) !== true) { - return $this; - } - $this->name = $name; - - return $this; - } } diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cat/ThreadPool.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cat/ThreadPool.php index 87a28372c..e0f0e8d77 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cat/ThreadPool.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cat/ThreadPool.php @@ -1,18 +1,4 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ + class ThreadPool extends AbstractEndpoint { - protected $thread_pool_patterns; - - public function getURI(): string + /** + * @return string + */ + public function getURI() { - $thread_pool_patterns = $this->thread_pool_patterns ?? null; + $uri = "/_cat/thread_pool"; - if (isset($thread_pool_patterns)) { - return "/_cat/thread_pool/$thread_pool_patterns"; - } - return "/_cat/thread_pool"; + return $uri; } - public function getParamWhitelist(): array + /** + * @return string[] + */ + public function getParamWhitelist() { - return [ - 'format', - 'size', + return array( 'local', 'master_timeout', 'h', 'help', + 'v', + 'full_id', + 'size', + 'thread_pool_patterns', 's', - 'v' - ]; + 'format', + ); } - public function getMethod(): string + /** + * @return string + */ + public function getMethod() { return 'GET'; } - - public function setThreadPoolPatterns($thread_pool_patterns): ThreadPool - { - if (isset($thread_pool_patterns) !== true) { - return $this; - } - if (is_array($thread_pool_patterns) === true) { - $thread_pool_patterns = implode(",", $thread_pool_patterns); - } - $this->thread_pool_patterns = $thread_pool_patterns; - - return $this; - } } diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/ClearScroll.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/ClearScroll.php index 13cafdb83..68466a7f3 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/ClearScroll.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/ClearScroll.php @@ -1,76 +1,93 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class ClearScroll extends AbstractEndpoint { - protected $scroll_id; + // A comma-separated list of scroll IDs to clear + private $scrollId; - public function getURI(): string + /** + * @param $scroll_id + * + * @return $this + */ + public function setScrollId($scrollId) { - $scroll_id = $this->scroll_id ?? null; - - if (isset($scroll_id)) { - return "/_search/scroll/$scroll_id"; + if (isset($scrollId) !== true) { + return $this; } - return "/_search/scroll"; - } - public function getParamWhitelist(): array - { - return [ - - ]; + $this->scrollId = $scrollId; + + return $this; } - public function getMethod(): string + /** + * @throws \Elasticsearch\Common\Exceptions\RuntimeException + * @return string + */ + public function getURI() { - return 'DELETE'; + return "/_search/scroll/"; } - public function setBody($body): ClearScroll + /** + * @param array $body + * + * @throws \Elasticsearch\Common\Exceptions\InvalidArgumentException + * @return $this + */ + public function setBody($body) { if (isset($body) !== true) { return $this; } + $this->body = $body; return $this; } - public function setScrollId($scroll_id): ClearScroll + /** + * @return array + */ + public function getBody() { - if (isset($scroll_id) !== true) { - return $this; + if (isset($this->body)) { + return $this->body; } - if (is_array($scroll_id) === true) { - $scroll_id = implode(",", $scroll_id); + if (is_array($this->scrollId)) { + return ['scroll_id' => $this->scrollId]; } - $this->scroll_id = $scroll_id; + return ['scroll_id' => [$this->scrollId]]; + } - return $this; + /** + * @return string[] + */ + public function getParamWhitelist() + { + return array( + ); + } + + /** + * @return string + */ + public function getMethod() + { + return 'DELETE'; } } diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cluster/AllocationExplain.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cluster/AllocationExplain.php index 90950d693..25014bf02 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cluster/AllocationExplain.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cluster/AllocationExplain.php @@ -1,18 +1,4 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class AllocationExplain extends AbstractEndpoint { - public function getURI(): string + /** + * @param array $body + * + * @throws \Elasticsearch\Common\Exceptions\InvalidArgumentException + * @return $this + */ + public function setBody($body) { + if (isset($body) !== true) { + return $this; + } - return "/_cluster/allocation/explain"; + $this->body = $body; + + return $this; } - public function getParamWhitelist(): array + /** + * @return string + */ + public function getURI() { - return [ - 'include_yes_decisions', - 'include_disk_info' - ]; + return "/_cluster/allocation/explain"; } - public function getMethod(): string + /** + * @return string[] + */ + public function getParamWhitelist() { - return isset($this->body) ? 'POST' : 'GET'; + return array( + 'include_yes_decisions', + 'include_disk_info', + ); } - public function setBody($body): AllocationExplain + /** + * @return string + */ + public function getMethod() { - if (isset($body) !== true) { - return $this; - } - $this->body = $body; - - return $this; + return 'GET'; } } diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cluster/Health.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cluster/Health.php index 688eb6bda..10e8a7c20 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cluster/Health.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cluster/Health.php @@ -1,18 +1,4 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class Health extends AbstractEndpoint { - - public function getURI(): string + /** + * @return string + */ + public function getURI() { - $index = $this->index ?? null; + $index = $this->index; + $uri = "/_cluster/health"; - if (isset($index)) { - return "/_cluster/health/$index"; + if (isset($index) === true) { + $uri = "/_cluster/health/$index"; } - return "/_cluster/health"; + + return $uri; } - public function getParamWhitelist(): array + /** + * @return string[] + */ + public function getParamWhitelist() { - return [ + return array( 'level', 'local', 'master_timeout', 'timeout', 'wait_for_active_shards', 'wait_for_nodes', + 'wait_for_relocating_shards', + 'wait_for_status', 'wait_for_events', - 'wait_for_no_relocating_shards', - 'wait_for_no_initializing_shards', - 'wait_for_status' - ]; + 'wait_for_no_relocating_shards' + ); } - public function getMethod(): string + /** + * @return string + */ + public function getMethod() { return 'GET'; } diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cluster/Nodes/AbstractNodesEndpoint.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cluster/Nodes/AbstractNodesEndpoint.php new file mode 100644 index 000000000..3b817b1a3 --- /dev/null +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cluster/Nodes/AbstractNodesEndpoint.php @@ -0,0 +1,47 @@ + + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co + */ +abstract class AbstractNodesEndpoint extends AbstractEndpoint +{ + /** @var string A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes */ + protected $nodeID; + + /** + * @param $nodeID + * + * @throws \Elasticsearch\Common\Exceptions\InvalidArgumentException + * + * @return $this + */ + public function setNodeID($nodeID) + { + if (isset($nodeID) !== true) { + return $this; + } + + if (!(is_array($nodeID) === true || is_string($nodeID) === true)) { + throw new InvalidArgumentException("invalid node_id"); + } + + if (is_array($nodeID) === true) { + $nodeID = implode(',', $nodeID); + } + + $this->nodeID = $nodeID; + + return $this; + } +} diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cluster/Nodes/HotThreads.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cluster/Nodes/HotThreads.php new file mode 100644 index 000000000..eeb4a96ac --- /dev/null +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cluster/Nodes/HotThreads.php @@ -0,0 +1,51 @@ + + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co + */ +class HotThreads extends AbstractNodesEndpoint +{ + /** + * @return string + */ + public function getURI() + { + $node_id = $this->nodeID; + $uri = "/_cluster/nodes/hotthreads"; + + if (isset($node_id) === true) { + $uri = "/_cluster/nodes/$node_id/hotthreads"; + } + + return $uri; + } + + /** + * @return string[] + */ + public function getParamWhitelist() + { + return array( + 'interval', + 'snapshots', + 'threads', + 'type', + ); + } + + /** + * @return string + */ + public function getMethod() + { + return 'GET'; + } +} diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cluster/Nodes/Info.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cluster/Nodes/Info.php new file mode 100644 index 000000000..bde5305b4 --- /dev/null +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cluster/Nodes/Info.php @@ -0,0 +1,77 @@ + + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co + */ +class Info extends AbstractNodesEndpoint +{ + // A comma-separated list of metrics you wish returned. Leave empty to return all. + private $metric; + + /** + * @param $metric + * + * @return $this + */ + public function setMetric($metric) + { + if (isset($metric) !== true) { + return $this; + } + + if (is_array($metric) === true) { + $metric = implode(",", $metric); + } + + $this->metric = $metric; + + return $this; + } + + /** + * @return string + */ + public function getURI() + { + $node_id = $this->nodeID; + $metric = $this->metric; + $uri = "/_nodes"; + + if (isset($node_id) === true && isset($metric) === true) { + $uri = "/_nodes/$node_id/$metric"; + } elseif (isset($metric) === true) { + $uri = "/_nodes/$metric"; + } elseif (isset($node_id) === true) { + $uri = "/_nodes/$node_id"; + } + + return $uri; + } + + /** + * @return string[] + */ + public function getParamWhitelist() + { + return array( + 'flat_settings', + 'human', + ); + } + + /** + * @return string + */ + public function getMethod() + { + return 'GET'; + } +} diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cluster/Nodes/Shutdown.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cluster/Nodes/Shutdown.php new file mode 100644 index 000000000..6b7a6f2c8 --- /dev/null +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cluster/Nodes/Shutdown.php @@ -0,0 +1,49 @@ + + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co + */ +class Shutdown extends AbstractNodesEndpoint +{ + /** + * @return string + */ + public function getURI() + { + $node_id = $this->nodeID; + $uri = "/_shutdown"; + + if (isset($node_id) === true) { + $uri = "/_cluster/nodes/$node_id/_shutdown"; + } + + return $uri; + } + + /** + * @return string[] + */ + public function getParamWhitelist() + { + return array( + 'delay', + 'exit', + ); + } + + /** + * @return string + */ + public function getMethod() + { + return 'POST'; + } +} diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cluster/Nodes/Stats.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cluster/Nodes/Stats.php new file mode 100644 index 000000000..94dd6cf34 --- /dev/null +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cluster/Nodes/Stats.php @@ -0,0 +1,111 @@ + + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co + */ +class Stats extends AbstractNodesEndpoint +{ + // Limit the information returned to the specified metrics + private $metric; + + // Limit the information returned for `indices` metric to the specific index metrics. Isn't used if `indices` (or `all`) metric isn't specified. + private $indexMetric; + + /** + * @param $metric + * + * @return $this + */ + public function setMetric($metric) + { + if (isset($metric) !== true) { + return $this; + } + + if (is_array($metric) === true) { + $metric = implode(",", $metric); + } + + $this->metric = $metric; + + return $this; + } + + /** + * @param $indexMetric + * + * @return $this + */ + public function setIndexMetric($indexMetric) + { + if (isset($indexMetric) !== true) { + return $this; + } + + if (is_array($indexMetric) === true) { + $indexMetric = implode(",", $indexMetric); + } + + $this->indexMetric = $indexMetric; + + return $this; + } + + /** + * @return string + */ + public function getURI() + { + $metric = $this->metric; + $index_metric = $this->indexMetric; + $node_id = $this->nodeID; + $uri = "/_nodes/stats"; + + if (isset($node_id) === true && isset($metric) === true && isset($index_metric) === true) { + $uri = "/_nodes/$node_id/stats/$metric/$index_metric"; + } elseif (isset($metric) === true && isset($index_metric) === true) { + $uri = "/_nodes/stats/$metric/$index_metric"; + } elseif (isset($node_id) === true && isset($metric) === true) { + $uri = "/_nodes/$node_id/stats/$metric"; + } elseif (isset($metric) === true) { + $uri = "/_nodes/stats/$metric"; + } elseif (isset($node_id) === true) { + $uri = "/_nodes/$node_id/stats"; + } + + return $uri; + } + + /** + * @return string[] + */ + public function getParamWhitelist() + { + return array( + 'completion_fields', + 'fielddata_fields', + 'fields', + 'groups', + 'human', + 'level', + 'types', + 'include_segment_file_sizes', + ); + } + + /** + * @return string + */ + public function getMethod() + { + return 'GET'; + } +} diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cluster/PendingTasks.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cluster/PendingTasks.php index 52d285a9e..3ceac3a07 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cluster/PendingTasks.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cluster/PendingTasks.php @@ -1,48 +1,45 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class PendingTasks extends AbstractEndpoint { - - public function getURI(): string + /** + * @return string + */ + public function getURI() { + $uri = "/_cluster/pending_tasks"; - return "/_cluster/pending_tasks"; + return $uri; } - public function getParamWhitelist(): array + /** + * @return string[] + */ + public function getParamWhitelist() { - return [ + return array( 'local', - 'master_timeout' - ]; + 'master_timeout', + ); } - public function getMethod(): string + /** + * @return string + */ + public function getMethod() { return 'GET'; } diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cluster/RemoteInfo.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cluster/RemoteInfo.php index e36850cb6..bd2632e19 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cluster/RemoteInfo.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cluster/RemoteInfo.php @@ -1,47 +1,40 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class RemoteInfo extends AbstractEndpoint { - - public function getURI(): string + /** + * @return string + */ + public function getURI() { - return "/_remote/info"; } - public function getParamWhitelist(): array + /** + * @return string[] + */ + public function getParamWhitelist() { - return [ - - ]; + return []; } - public function getMethod(): string + /** + * @return string + */ + public function getMethod() { return 'GET'; } diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cluster/Reroute.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cluster/Reroute.php index f14c91164..411305399 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cluster/Reroute.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cluster/Reroute.php @@ -1,63 +1,68 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class Reroute extends AbstractEndpoint { + /** + * @param array $body + * + * @throws \Elasticsearch\Common\Exceptions\InvalidArgumentException + * @return $this + */ + public function setBody($body) + { + if (isset($body) !== true) { + return $this; + } + + $this->body = $body; + + return $this; + } - public function getURI(): string + /** + * @return string + */ + public function getURI() { + $uri = "/_cluster/reroute"; - return "/_cluster/reroute"; + return $uri; } - public function getParamWhitelist(): array + /** + * @return string[] + */ + public function getParamWhitelist() { - return [ + return array( 'dry_run', - 'explain', - 'retry_failed', - 'metric', + 'filter_metadata', 'master_timeout', - 'timeout' - ]; + 'timeout', + 'explain', + 'metric' + ); } - public function getMethod(): string + /** + * @return string + */ + public function getMethod() { return 'POST'; } - - public function setBody($body): Reroute - { - if (isset($body) !== true) { - return $this; - } - $this->body = $body; - - return $this; - } } diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cluster/Settings/Get.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cluster/Settings/Get.php new file mode 100644 index 000000000..fda615eb5 --- /dev/null +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cluster/Settings/Get.php @@ -0,0 +1,49 @@ + + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co + */ + +class Get extends AbstractEndpoint +{ + /** + * @return string + */ + public function getURI() + { + $uri = "/_cluster/settings"; + + return $uri; + } + + /** + * @return string[] + */ + public function getParamWhitelist() + { + return array( + 'flat_settings', + 'master_timeout', + 'timeout', + 'include_defaults' + ); + } + + /** + * @return string + */ + public function getMethod() + { + return 'GET'; + } +} diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cluster/Settings/Put.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cluster/Settings/Put.php new file mode 100644 index 000000000..522e7b1d9 --- /dev/null +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cluster/Settings/Put.php @@ -0,0 +1,63 @@ + + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co + */ +class Put extends AbstractEndpoint +{ + /** + * @param array $body + * + * @throws \Elasticsearch\Common\Exceptions\InvalidArgumentException + * @return $this + */ + public function setBody($body) + { + if (isset($body) !== true) { + return $this; + } + + $this->body = $body; + + return $this; + } + + /** + * @return string + */ + public function getURI() + { + $uri = "/_cluster/settings"; + + return $uri; + } + + /** + * @return string[] + */ + public function getParamWhitelist() + { + return array( + 'flat_settings', + ); + } + + /** + * @return string + */ + public function getMethod() + { + return 'PUT'; + } +} diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cluster/State.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cluster/State.php index ee513fa49..94af3b19d 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cluster/State.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cluster/State.php @@ -1,18 +1,4 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class State extends AbstractEndpoint { - protected $metric; + // Limit the information returned to the specified metrics + private $metric; - public function getURI(): string + /** + * @param $metric + * + * @return $this + */ + public function setMetric($metric) { - $index = $this->index ?? null; - $metric = $this->metric ?? null; + if (isset($metric) !== true) { + return $this; + } - if (isset($metric) && isset($index)) { - return "/_cluster/state/$metric/$index"; + if (is_array($metric) === true) { + $metric = implode(",", $metric); } - if (isset($metric)) { - return "/_cluster/state/$metric"; + + $this->metric = $metric; + + return $this; + } + + /** + * @return string + */ + public function getURI() + { + $index = $this->index; + $metric = $this->metric; + $uri = "/_cluster/state"; + + if (isset($metric) === true && isset($index) === true) { + $uri = "/_cluster/state/$metric/$index"; + } elseif (isset($metric) === true) { + $uri = "/_cluster/state/$metric"; } - return "/_cluster/state"; + + return $uri; } - public function getParamWhitelist(): array + /** + * @return string[] + */ + public function getParamWhitelist() { - return [ + return array( 'local', 'master_timeout', 'flat_settings', - 'wait_for_metadata_version', - 'wait_for_timeout', + 'index_templates', + 'expand_wildcards', 'ignore_unavailable', - 'allow_no_indices', - 'expand_wildcards' - ]; + 'allow_no_indices' + ); } - public function getMethod(): string + /** + * @return string + */ + public function getMethod() { return 'GET'; } - - public function setMetric($metric): State - { - if (isset($metric) !== true) { - return $this; - } - if (is_array($metric) === true) { - $metric = implode(",", $metric); - } - $this->metric = $metric; - - return $this; - } } diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cluster/Stats.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cluster/Stats.php index 7f8abd765..729b611f3 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cluster/Stats.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Cluster/Stats.php @@ -1,18 +1,4 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class Stats extends AbstractEndpoint { - protected $node_id; + // A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes + private $nodeID; - public function getURI(): string + /** + * @param $node_id + * + * @return $this + */ + public function setNodeID($node_id) { - $node_id = $this->node_id ?? null; - - if (isset($node_id)) { - return "/_cluster/stats/nodes/$node_id"; + if (isset($node_id) !== true) { + return $this; } - return "/_cluster/stats"; + + $this->nodeID = $node_id; + + return $this; } - public function getParamWhitelist(): array + /** + * @return string + */ + public function getURI() { - return [ - 'flat_settings', - 'timeout' - ]; + $node_id = $this->nodeID; + $uri = "/_cluster/stats"; + + if (isset($node_id) === true) { + $uri = "/_cluster/stats/nodes/$node_id"; + } + + return $uri; } - public function getMethod(): string + /** + * @return string[] + */ + public function getParamWhitelist() { - return 'GET'; + return array( + 'flat_settings', + 'human', + ); } - public function setNodeId($node_id): Stats + /** + * @return string + */ + public function getMethod() { - if (isset($node_id) !== true) { - return $this; - } - if (is_array($node_id) === true) { - $node_id = implode(",", $node_id); - } - $this->node_id = $node_id; - - return $this; + return 'GET'; } } diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Count.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Count.php index e220d9752..67db3f199 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Count.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Count.php @@ -1,79 +1,87 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class Count extends AbstractEndpoint { + /** + * @param array $body + * + * @throws \Elasticsearch\Common\Exceptions\InvalidArgumentException + * @return $this + */ + public function setBody($body) + { + if (isset($body) !== true) { + return $this; + } - public function getURI(): string + $this->body = $body; + + return $this; + } + + /** + * @return string + */ + public function getURI() { - $index = $this->index ?? null; - $type = $this->type ?? null; + $index = $this->index; + $type = $this->type; + $uri = "/_count"; - if (isset($index) && isset($type)) { - return "/$index/$type/_count"; - } - if (isset($index)) { - return "/$index/_count"; + if (isset($index) === true && isset($type) === true) { + $uri = "/$index/$type/_count"; + } elseif (isset($type) === true) { + $uri = "/_all/$type/_count"; + } elseif (isset($index) === true) { + $uri = "/$index/_count"; } - return "/_count"; + + return $uri; } - public function getParamWhitelist(): array + /** + * @return string[] + */ + public function getParamWhitelist() { - return [ + return array( 'ignore_unavailable', - 'ignore_throttled', 'allow_no_indices', 'expand_wildcards', 'min_score', 'preference', 'routing', + 'source', 'q', + 'df', + 'default_operator', 'analyzer', + 'lowercase_expanded_terms', 'analyze_wildcard', - 'default_operator', - 'df', 'lenient', + 'lowercase_expanded_terms', 'terminate_after' - ]; - } - - public function getMethod(): string - { - return isset($this->body) ? 'POST' : 'GET'; + ); } - public function setBody($body): Count + /** + * @return string + */ + public function getMethod() { - if (isset($body) !== true) { - return $this; - } - $this->body = $body; - - return $this; + return 'GET'; } } diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/CountPercolate.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/CountPercolate.php new file mode 100644 index 000000000..f87d6b5e5 --- /dev/null +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/CountPercolate.php @@ -0,0 +1,90 @@ + + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co + */ +class CountPercolate extends AbstractEndpoint +{ + /** + * @param array $body + * + * @throws \Elasticsearch\Common\Exceptions\InvalidArgumentException + * @return $this + */ + public function setBody($body) + { + if (isset($body) !== true) { + return $this; + } + + $this->body = $body; + + return $this; + } + + /** + * @throws \Elasticsearch\Common\Exceptions\RuntimeException + * @return string + */ + public function getURI() + { + if (isset($this->index) !== true) { + throw new Exceptions\RuntimeException( + 'index is required for CountPercolate' + ); + } + + if (isset($this->type) !== true) { + throw new Exceptions\RuntimeException( + 'type is required for CountPercolate' + ); + } + + $index = $this->index; + $type = $this->type; + $id = $this->id; + $uri = "/$index/$type/_percolate/count"; + + if (isset($id) === true) { + $uri = "/$index/$type/$id/_percolate/count"; + } + + return $uri; + } + + /** + * @return string[] + */ + public function getParamWhitelist() + { + return array( + 'routing', + 'preference', + 'ignore_unavailable', + 'allow_no_indices', + 'expand_wildcards', + 'percolate_index', + 'percolate_type', + 'version', + 'version_type' + ); + } + + /** + * @return string + */ + public function getMethod() + { + return 'GET'; + } +} diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Create.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Create.php index 409453d59..bbecabeb5 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Create.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Create.php @@ -1,84 +1,107 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class Create extends AbstractEndpoint { - - public function getURI(): string + /** + * @param array $body + * + * @throws \Elasticsearch\Common\Exceptions\InvalidArgumentException + * @return $this + */ + public function setBody($body) { - if (isset($this->id) !== true) { - throw new RuntimeException( - 'id is required for Create' - ); + if (isset($body) !== true) { + return $this; } - $id = $this->id; + + $this->body = $body; + + return $this; + } + + /** + * @throws \Elasticsearch\Common\Exceptions\RuntimeException + * @return string + */ + public function getURI() + { if (isset($this->index) !== true) { - throw new RuntimeException( + throw new Exceptions\RuntimeException( 'index is required for Create' ); } - $index = $this->index; + if (isset($this->type) !== true) { - throw new RuntimeException( + throw new Exceptions\RuntimeException( 'type is required for Create' ); } - $type = $this->type; + if (isset($this->id) !== true) { + throw new Exceptions\RuntimeException( + 'id is required for Create' + ); + } + + $id = $this->id; + $index = $this->index; + $type = $this->type; return "/$index/$type/$id/_create"; } - public function getParamWhitelist(): array + /** + * @return string[] + */ + public function getParamWhitelist() { - return [ - 'wait_for_active_shards', + return array( + 'consistency', + 'op_type', 'parent', + 'percolate', 'refresh', + 'replication', 'routing', 'timeout', + 'timestamp', + 'ttl', 'version', 'version_type', 'pipeline' - ]; + ); } - public function getMethod(): string + /** + * @return string + */ + public function getMethod() { return 'PUT'; } - public function setBody($body): Create + /** + * @return array + * @throws \Elasticsearch\Common\Exceptions\RuntimeException + */ + public function getBody() { - if (isset($body) !== true) { - return $this; + if (isset($this->body) !== true) { + throw new Exceptions\RuntimeException('Document body must be set for create request'); + } else { + return $this->body; } - $this->body = $body; - - return $this; } } diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Delete.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Delete.php index 026b176f6..3f51baead 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Delete.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Delete.php @@ -1,74 +1,74 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class Delete extends AbstractEndpoint { - - public function getURI(): string + /** + * @throws \Elasticsearch\Common\Exceptions\RuntimeException + * @return string + */ + public function getURI() { if (isset($this->id) !== true) { - throw new RuntimeException( + throw new Exceptions\RuntimeException( 'id is required for Delete' ); } - $id = $this->id; if (isset($this->index) !== true) { - throw new RuntimeException( + throw new Exceptions\RuntimeException( 'index is required for Delete' ); } - $index = $this->index; if (isset($this->type) !== true) { - throw new RuntimeException( + throw new Exceptions\RuntimeException( 'type is required for Delete' ); } + $id = $this->id; + $index = $this->index; $type = $this->type; + $uri = "/$index/$type/$id"; + + if (isset($index) === true && isset($type) === true && isset($id) === true) { + $uri = "/$index/$type/$id"; + } - return "/$index/$type/$id"; + return $uri; } - public function getParamWhitelist(): array + /** + * @return string[] + */ + public function getParamWhitelist() { - return [ - 'wait_for_active_shards', + return array( + 'consistency', 'parent', 'refresh', + 'replication', 'routing', 'timeout', - 'if_seq_no', - 'if_primary_term', 'version', - 'version_type' - ]; + 'version_type', + ); } - public function getMethod(): string + /** + * @return string + */ + public function getMethod() { return 'DELETE'; } diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/DeleteByQuery.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/DeleteByQuery.php index 66f94c9aa..182658951 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/DeleteByQuery.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/DeleteByQuery.php @@ -1,100 +1,103 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class DeleteByQuery extends AbstractEndpoint { + /** + * @param array $body + * + * @throws \Elasticsearch\Common\Exceptions\InvalidArgumentException + * @return $this + */ + public function setBody($body) + { + if (isset($body) !== true) { + return $this; + } + + $this->body = $body; + + return $this; + } - public function getURI(): string + /** + * @throws \Elasticsearch\Common\Exceptions\RuntimeException + * @return string + */ + public function getURI() { - if (isset($this->index) !== true) { - throw new RuntimeException( - 'index is required for Delete_by_query' + if (!$this->index) { + throw new Exceptions\RuntimeException( + 'index is required for Deletebyquery' ); } - $index = $this->index; - $type = $this->type ?? null; - if (isset($type)) { - return "/$index/$type/_delete_by_query"; + $uri = "/{$this->index}/_delete_by_query"; + if ($this->type) { + $uri = "/{$this->index}/{$this->type}/_delete_by_query"; } - return "/$index/_delete_by_query"; + + return $uri; } - public function getParamWhitelist(): array + /** + * @return string[] + */ + public function getParamWhitelist() { - return [ - 'analyzer', + return array( + '_source', + '_source_exclude', + '_source_include', + 'allow_no_indices', 'analyze_wildcard', + 'analyzer', + 'conflicts', 'default_operator', 'df', + 'expand_wildcards', 'from', 'ignore_unavailable', - 'allow_no_indices', - 'conflicts', - 'expand_wildcards', 'lenient', 'preference', - 'q', + 'query', + 'refresh', + 'request_cache', + 'requests_per_second', 'routing', 'scroll', - 'search_type', + 'scroll_size', 'search_timeout', + 'search_type', 'size', + 'slices', 'sort', - '_source', - '_source_excludes', - '_source_includes', - 'terminate_after', 'stats', - 'version', - 'request_cache', - 'refresh', + 'terminate_after', 'timeout', + 'version', 'wait_for_active_shards', - 'scroll_size', 'wait_for_completion', - 'requests_per_second', - 'slices' - ]; + ); } - public function getMethod(): string + /** + * @return string + */ + public function getMethod() { return 'POST'; } - - public function setBody($body): DeleteByQuery - { - if (isset($body) !== true) { - return $this; - } - $this->body = $body; - - return $this; - } } diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Exists.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Exists.php index fe574c661..a9333d5dc 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Exists.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Exists.php @@ -1,76 +1,73 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class Exists extends AbstractEndpoint { - - public function getURI(): string + /** + * @throws \Elasticsearch\Common\Exceptions\RuntimeException + * @return string + */ + public function getURI() { if (isset($this->id) !== true) { - throw new RuntimeException( + throw new Exceptions\RuntimeException( 'id is required for Exists' ); } - $id = $this->id; if (isset($this->index) !== true) { - throw new RuntimeException( + throw new Exceptions\RuntimeException( 'index is required for Exists' ); } - $index = $this->index; if (isset($this->type) !== true) { - throw new RuntimeException( + throw new Exceptions\RuntimeException( 'type is required for Exists' ); } + $id = $this->id; + $index = $this->index; $type = $this->type; + $uri = "/$index/$type/$id"; + + if (isset($index) === true && isset($type) === true && isset($id) === true) { + $uri = "/$index/$type/$id"; + } - return "/$index/$type/$id"; + return $uri; } - public function getParamWhitelist(): array + /** + * @return string[] + */ + public function getParamWhitelist() { - return [ - 'stored_fields', + return array( 'parent', 'preference', 'realtime', 'refresh', 'routing', - '_source', - '_source_excludes', - '_source_includes', 'version', - 'version_type' - ]; + 'stored_fields' + ); } - public function getMethod(): string + /** + * @return string + */ + public function getMethod() { return 'HEAD'; } diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Explain.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Explain.php index 98144d8f7..0858f8866 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Explain.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Explain.php @@ -1,89 +1,100 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class Explain extends AbstractEndpoint { + /** + * @param array $body + * + * @throws \Elasticsearch\Common\Exceptions\InvalidArgumentException + * @return $this + */ + public function setBody($body) + { + if (isset($body) !== true) { + return $this; + } - public function getURI(): string + $this->body = $body; + + return $this; + } + + /** + * @throws \Elasticsearch\Common\Exceptions\RuntimeException + * @return string + */ + public function getURI() { if (isset($this->id) !== true) { - throw new RuntimeException( + throw new Exceptions\RuntimeException( 'id is required for Explain' ); } - $id = $this->id; if (isset($this->index) !== true) { - throw new RuntimeException( + throw new Exceptions\RuntimeException( 'index is required for Explain' ); } - $index = $this->index; if (isset($this->type) !== true) { - throw new RuntimeException( + throw new Exceptions\RuntimeException( 'type is required for Explain' ); } + $id = $this->id; + $index = $this->index; $type = $this->type; + $uri = "/$index/$type/$id/_explain"; + + if (isset($index) === true && isset($type) === true && isset($id) === true) { + $uri = "/$index/$type/$id/_explain"; + } - return "/$index/$type/$id/_explain"; + return $uri; } - public function getParamWhitelist(): array + /** + * @return string[] + */ + public function getParamWhitelist() { - return [ + return array( 'analyze_wildcard', 'analyzer', 'default_operator', 'df', - 'stored_fields', + 'fields', 'lenient', + 'lowercase_expanded_terms', 'parent', 'preference', 'q', 'routing', + 'source', '_source', - '_source_excludes', - '_source_includes' - ]; - } - - public function getMethod(): string - { - return isset($this->body) ? 'POST' : 'GET'; + '_source_exclude', + '_source_include', + 'stored_fields' + ); } - public function setBody($body): Explain + /** + * @return string + */ + public function getMethod() { - if (isset($body) !== true) { - return $this; - } - $this->body = $body; - - return $this; + return 'GET'; } } diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/FieldCaps.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/FieldCaps.php index 858fdab67..7e821283c 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/FieldCaps.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/FieldCaps.php @@ -1,65 +1,69 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class FieldCaps extends AbstractEndpoint { + /** + * @param array $body + * + * @throws \Elasticsearch\Common\Exceptions\InvalidArgumentException + * @return $this + */ + public function setBody($body) + { + if (isset($body) !== true) { + return $this; + } + + $this->body = $body; + return $this; + } - public function getURI(): string + /** + * @return string + */ + public function getURI() { - $index = $this->index ?? null; + $index = $this->index; - if (isset($index)) { + if (isset($index) === true) { return "/$index/_field_caps"; + } else { + return "/_field_caps"; } - return "/_field_caps"; } - public function getParamWhitelist(): array + /** + * @return string[] + */ + public function getParamWhitelist() { - return [ + return array( 'fields', 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards' - ]; + ); } - public function getMethod(): string + /** + * @return string + */ + public function getMethod() { - return isset($this->body) ? 'POST' : 'GET'; - } - - public function setBody($body): FieldCaps - { - if (isset($body) !== true) { - return $this; - } - $this->body = $body; - - return $this; + return 'GET'; } } diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/FieldStats.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/FieldStats.php new file mode 100644 index 000000000..1ca80d83e --- /dev/null +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/FieldStats.php @@ -0,0 +1,73 @@ + + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co + */ +class FieldStats extends AbstractEndpoint +{ + + /** + * @param array $body + * + * @throws \Elasticsearch\Common\Exceptions\InvalidArgumentException + * @return $this + */ + public function setBody($body) + { + if (isset($body) !== true) { + return $this; + } + + $this->body = $body; + + return $this; + } + + /** + * @return string + */ + public function getURI() + { + $index = $this->index; + $uri = "/_field_stats"; + + if (isset($index) === true) { + $uri = "/$index/_field_stats"; + } + + return $uri; + } + + /** + * @return string[] + */ + public function getParamWhitelist() + { + return array( + 'fields', + 'level', + 'ignore_unavailable', + 'allow_no_indices', + 'expand_wildcards', + 'fields' + ); + } + + /** + * @return string + */ + public function getMethod() + { + return 'GET'; + } +} diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Get.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Get.php index 10e6ef481..34fa6669e 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Get.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Get.php @@ -1,79 +1,113 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class Get extends AbstractEndpoint { + /** @var bool */ + private $returnOnlySource = false; - public function getURI(): string + /** @var bool */ + private $checkOnlyExistance = false; + + /** + * @return $this + */ + public function returnOnlySource() + { + $this->returnOnlySource = true; + + return $this; + } + + /** + * @return $this + */ + public function checkOnlyExistance() + { + $this->checkOnlyExistance = true; + + return $this; + } + + /** + * @throws \Elasticsearch\Common\Exceptions\RuntimeException + * @return string + */ + public function getURI() { if (isset($this->id) !== true) { - throw new RuntimeException( + throw new Exceptions\RuntimeException( 'id is required for Get' ); } - $id = $this->id; if (isset($this->index) !== true) { - throw new RuntimeException( + throw new Exceptions\RuntimeException( 'index is required for Get' ); } - $index = $this->index; if (isset($this->type) !== true) { - throw new RuntimeException( + throw new Exceptions\RuntimeException( 'type is required for Get' ); } + $id = $this->id; + $index = $this->index; $type = $this->type; + $uri = "/$index/$type/$id"; - return "/$index/$type/$id"; + if (isset($index) === true && isset($type) === true && isset($id) === true) { + $uri = "/$index/$type/$id"; + } + + if ($this->returnOnlySource === true) { + $uri .= '/_source'; + } + + return $uri; } - public function getParamWhitelist(): array + /** + * @return string[] + */ + public function getParamWhitelist() { - return [ - 'stored_fields', + return array( + 'fields', 'parent', 'preference', 'realtime', 'refresh', 'routing', '_source', - '_source_excludes', - '_source_includes', '_source_exclude', '_source_include', 'version', - 'version_type' - ]; + 'version_type', + 'stored_fields' + ); } - public function getMethod(): string + /** + * @return string + */ + public function getMethod() { - return 'GET'; + if ($this->checkOnlyExistance === true) { + return 'HEAD'; + } else { + return 'GET'; + } } } diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Index.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Index.php index 2e21b8660..ba3c82a0b 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Index.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Index.php @@ -1,85 +1,123 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class Index extends AbstractEndpoint { + /** @var bool */ + private $createIfAbsent = false; + + /** + * @param array $body + * + * @throws \Elasticsearch\Common\Exceptions\InvalidArgumentException + * @return $this + */ + public function setBody($body) + { + if (isset($body) !== true) { + return $this; + } + + $this->body = $body; + + return $this; + } + + /** + * @return $this + */ + public function createIfAbsent() + { + $this->createIfAbsent = true; + + return $this; + } - public function getURI(): string + /** + * @throws \Elasticsearch\Common\Exceptions\RuntimeException + * @return string + */ + public function getURI() { if (isset($this->index) !== true) { - throw new RuntimeException( + throw new Exceptions\RuntimeException( 'index is required for Index' ); } - $index = $this->index; + if (isset($this->type) !== true) { - throw new RuntimeException( + throw new Exceptions\RuntimeException( 'type is required for Index' ); } - $type = $this->type; - $id = $this->id ?? null; - if (isset($id)) { - return "/$index/$type/$id"; + $id = $this->id; + $index = $this->index; + $type = $this->type; + $uri = "/$index/$type"; + + if (isset($id) === true) { + $uri = "/$index/$type/$id"; } - return "/$index/$type"; + return $uri; } - public function getParamWhitelist(): array + /** + * @return string[] + */ + public function getParamWhitelist() { - return [ - 'wait_for_active_shards', + return array( + 'consistency', 'op_type', 'parent', + 'percolate', 'refresh', + 'replication', 'routing', 'timeout', + 'timestamp', + 'ttl', 'version', 'version_type', - 'if_seq_no', - 'if_primary_term', 'pipeline' - ]; + ); } - public function getMethod(): string + /** + * @return string + */ + public function getMethod() { - return 'POST'; + if (isset($this->id) === true) { + return 'PUT'; + } else { + return 'POST'; + } } - public function setBody($body): Index + /** + * @return array + * @throws \Elasticsearch\Common\Exceptions\RuntimeException + */ + public function getBody() { - if (isset($body) !== true) { - return $this; + if (isset($this->body) !== true) { + throw new Exceptions\RuntimeException('Document body must be set for index request'); + } else { + return $this->body; } - $this->body = $body; - - return $this; } } diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Alias/AbstractAliasEndpoint.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Alias/AbstractAliasEndpoint.php new file mode 100644 index 000000000..c3ebf8485 --- /dev/null +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Alias/AbstractAliasEndpoint.php @@ -0,0 +1,38 @@ + + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co + */ +abstract class AbstractAliasEndpoint extends AbstractEndpoint +{ + /** @var null|string */ + protected $name = null; + + /** + * @param $name + * + * @throws \Elasticsearch\Common\Exceptions\InvalidArgumentException + * + * @return $this + */ + public function setName($name) + { + if (is_string($name) !== true) { + throw new InvalidArgumentException('Name must be a string'); + } + $this->name = urlencode($name); + + return $this; + } +} diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Alias/Delete.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Alias/Delete.php new file mode 100644 index 000000000..2ed46816d --- /dev/null +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Alias/Delete.php @@ -0,0 +1,83 @@ + + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co + */ +class Delete extends AbstractEndpoint +{ + // A comma-separated list of aliases to delete (supports wildcards); use `_all` to delete all aliases for the specified indices. + private $name; + + /** + * @param $name + * + * @return $this + */ + public function setName($name) + { + if (isset($name) !== true) { + return $this; + } + + $this->name = $name; + + return $this; + } + + /** + * @throws \Elasticsearch\Common\Exceptions\RuntimeException + * @return string + */ + public function getURI() + { + if (isset($this->index) !== true) { + throw new Exceptions\RuntimeException( + 'index is required for Delete' + ); + } + if (isset($this->name) !== true) { + throw new Exceptions\RuntimeException( + 'name is required for Delete' + ); + } + $index = $this->index; + $name = $this->name; + $uri = "/$index/_alias/$name"; + + if (isset($index) === true && isset($name) === true) { + $uri = "/$index/_alias/$name"; + } + + return $uri; + } + + /** + * @return string[] + */ + public function getParamWhitelist() + { + return array( + 'timeout', + 'master_timeout', + ); + } + + /** + * @return string + */ + public function getMethod() + { + return 'DELETE'; + } +} diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Alias/Exists.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Alias/Exists.php new file mode 100644 index 000000000..abc978a19 --- /dev/null +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Alias/Exists.php @@ -0,0 +1,77 @@ + + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co + */ +class Exists extends AbstractEndpoint +{ + // A comma-separated list of alias names to return + private $name; + + /** + * @param $name + * + * @return $this + */ + public function setName($name) + { + if (isset($name) !== true) { + return $this; + } + + $this->name = $name; + + return $this; + } + + /** + * @return string + */ + public function getURI() + { + $index = $this->index; + $name = $this->name; + $uri = "/_alias/$name"; + + if (isset($index) === true && isset($name) === true) { + $uri = "/$index/_alias/$name"; + } elseif (isset($index) === true) { + $uri = "/$index/_alias"; + } elseif (isset($name) === true) { + $uri = "/_alias/$name"; + } + + return $uri; + } + + /** + * @return string[] + */ + public function getParamWhitelist() + { + return array( + 'ignore_unavailable', + 'allow_no_indices', + 'expand_wildcards', + 'local', + ); + } + + /** + * @return string + */ + public function getMethod() + { + return 'HEAD'; + } +} diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Alias/Get.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Alias/Get.php new file mode 100644 index 000000000..8b2ae03a7 --- /dev/null +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Alias/Get.php @@ -0,0 +1,77 @@ + + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co + */ +class Get extends AbstractEndpoint +{ + // A comma-separated list of alias names to return + private $name; + + /** + * @param $name + * + * @return $this + */ + public function setName($name) + { + if (isset($name) !== true) { + return $this; + } + + $this->name = $name; + + return $this; + } + + /** + * @return string + */ + public function getURI() + { + $index = $this->index; + $name = $this->name; + $uri = "/_alias"; + + if (isset($index) === true && isset($name) === true) { + $uri = "/$index/_alias/$name"; + } elseif (isset($index) === true) { + $uri = "/$index/_alias"; + } elseif (isset($name) === true) { + $uri = "/_alias/$name"; + } + + return $uri; + } + + /** + * @return string[] + */ + public function getParamWhitelist() + { + return array( + 'ignore_unavailable', + 'allow_no_indices', + 'expand_wildcards', + 'local', + ); + } + + /** + * @return string + */ + public function getMethod() + { + return 'GET'; + } +} diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Alias/Put.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Alias/Put.php new file mode 100644 index 000000000..a91d6254f --- /dev/null +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Alias/Put.php @@ -0,0 +1,97 @@ + + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co + */ +class Put extends AbstractEndpoint +{ + // The name of the alias to be created or updated + private $name; + + /** + * @param array $body + * + * @throws \Elasticsearch\Common\Exceptions\InvalidArgumentException + * @return $this + */ + public function setBody($body) + { + if (isset($body) !== true) { + return $this; + } + + $this->body = $body; + + return $this; + } + + /** + * @param $name + * + * @return $this + */ + public function setName($name) + { + if (isset($name) !== true) { + return $this; + } + + $this->name = $name; + + return $this; + } + + /** + * @throws \Elasticsearch\Common\Exceptions\RuntimeException + * @return string + */ + public function getURI() + { + if (isset($this->name) !== true) { + throw new Exceptions\RuntimeException( + 'name is required for Put' + ); + } + + if (isset($this->index) !== true) { + throw new Exceptions\RuntimeException( + 'index is required for Put' + ); + } + $index = $this->index; + $name = $this->name; + $uri = "/$index/_alias/$name"; + + return $uri; + } + + /** + * @return string[] + */ + public function getParamWhitelist() + { + return array( + 'timeout', + 'master_timeout', + ); + } + + /** + * @return string + */ + public function getMethod() + { + return 'PUT'; + } +} diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Aliases/Update.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Aliases/Update.php new file mode 100644 index 000000000..a715b0f98 --- /dev/null +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Aliases/Update.php @@ -0,0 +1,77 @@ + + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co + */ +class Update extends AbstractEndpoint +{ + /** + * @param array $body + * + * @throws \Elasticsearch\Common\Exceptions\InvalidArgumentException + * @return $this + */ + public function setBody($body) + { + if (isset($body) !== true) { + return $this; + } + + $this->body = $body; + + return $this; + } + + /** + * @return string + */ + public function getURI() + { + $uri = "/_aliases"; + + return $uri; + } + + /** + * @return string[] + */ + public function getParamWhitelist() + { + return array( + 'timeout', + 'master_timeout', + ); + } + + /** + * @return array + * @throws \Elasticsearch\Common\Exceptions\RuntimeException + */ + public function getBody() + { + if (isset($this->body) !== true) { + throw new Exceptions\RuntimeException('Body is required for Update Aliases'); + } + + return $this->body; + } + + /** + * @return string + */ + public function getMethod() + { + return 'POST'; + } +} diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Analyze.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Analyze.php index 8a27daf9b..ac7787948 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Analyze.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Analyze.php @@ -1,62 +1,79 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class Analyze extends AbstractEndpoint { - - public function getURI(): string + /** + * @param array $body + * + * @throws \Elasticsearch\Common\Exceptions\InvalidArgumentException + * @return $this + */ + public function setBody($body) { - $index = $this->index ?? null; - - if (isset($index)) { - return "/$index/_analyze"; + if (isset($body) !== true) { + return $this; } - return "/_analyze"; + + $this->body = $body; + + return $this; } - public function getParamWhitelist(): array + /** + * @return string + */ + public function getURI() { - return [ - 'index' - ]; + $index = $this->index; + $uri = "/_analyze"; + + if (isset($index) === true) { + $uri = "/$index/_analyze"; + } + + return $uri; } - public function getMethod(): string + /** + * @return string[] + */ + public function getParamWhitelist() { - return isset($this->body) ? 'POST' : 'GET'; + return array( + 'analyzer', + 'field', + 'filter', + 'index', + 'prefer_local', + 'text', + 'tokenizer', + 'format', + 'char_filter', + 'explain', + 'attributes', + 'format' + ); } - public function setBody($body): Analyze + /** + * @return string + */ + public function getMethod() { - if (isset($body) !== true) { - return $this; - } - $this->body = $body; - - return $this; + return 'GET'; } } diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Cache/Clear.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Cache/Clear.php new file mode 100644 index 000000000..6789d3e91 --- /dev/null +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Cache/Clear.php @@ -0,0 +1,64 @@ + + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co + */ +class Clear extends AbstractEndpoint +{ + /** + * @return string + */ + public function getURI() + { + $index = $this->index; + $uri = "/_cache/clear"; + + if (isset($index) === true) { + $uri = "/$index/_cache/clear"; + } + + return $uri; + } + + /** + * @return string[] + */ + public function getParamWhitelist() + { + return array( + 'field_data', + 'fielddata', + 'fields', + 'filter', + 'filter_cache', + 'filter_keys', + 'id', + 'id_cache', + 'index', + 'recycler', + 'ignore_unavailable', + 'allow_no_indices', + 'expand_wildcards', + 'request_cache', + 'request' + ); + } + + /** + * @return string + */ + public function getMethod() + { + return 'POST'; + } +} diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/ClearCache.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/ClearCache.php index 95cb42f9d..4b502ba5a 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/ClearCache.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/ClearCache.php @@ -1,18 +1,4 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class ClearCache extends AbstractEndpoint { - - public function getURI(): string + /** + * @return string + */ + public function getURI() { - $index = $this->index ?? null; + $index = $this->index; + $uri = "/_cache/clear"; - if (isset($index)) { - return "/$index/_cache/clear"; + if (isset($index) === true) { + $uri = "/$index/_cache/clear"; } - return "/_cache/clear"; + + return $uri; } - public function getParamWhitelist(): array + /** + * @return string[] + */ + public function getParamWhitelist() { - return [ + return array( 'field_data', 'fielddata', 'fields', - 'query', + 'filter', + 'filter_cache', + 'filter_keys', + 'id', + 'id_cache', 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'index', - 'request_cache', - 'request' - ]; + 'recycler', + ); } - public function getMethod(): string + /** + * @return string + */ + public function getMethod() { - return 'POST'; + return 'GET'; } } diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Close.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Close.php index 5ec8635a4..3d5bf7e6f 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Close.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Close.php @@ -1,58 +1,60 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class Close extends AbstractEndpoint { - - public function getURI(): string + /** + * @throws \Elasticsearch\Common\Exceptions\RuntimeException + * @return string + */ + public function getURI() { if (isset($this->index) !== true) { - throw new RuntimeException( + throw new Exceptions\RuntimeException( 'index is required for Close' ); } $index = $this->index; + $uri = "/$index/_close"; + + if (isset($index) === true) { + $uri = "/$index/_close"; + } - return "/$index/_close"; + return $uri; } - public function getParamWhitelist(): array + /** + * @return string[] + */ + public function getParamWhitelist() { - return [ + return array( 'timeout', 'master_timeout', 'ignore_unavailable', 'allow_no_indices', - 'expand_wildcards' - ]; + 'expand_wildcards', + ); } - public function getMethod(): string + /** + * @return string + */ + public function getMethod() { return 'POST'; } diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Create.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Create.php index 5ea32497a..505d252d6 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Create.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Create.php @@ -1,69 +1,77 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class Create extends AbstractEndpoint { + /** + * @param array|object $body + * + * @throws \Elasticsearch\Common\Exceptions\InvalidArgumentException + * @return $this + */ + public function setBody($body) + { + if (isset($body) !== true) { + return $this; + } + + $this->body = $body; + + return $this; + } - public function getURI(): string + /** + * @throws \Elasticsearch\Common\Exceptions\RuntimeException + * @return string + */ + public function getURI() { if (isset($this->index) !== true) { - throw new RuntimeException( + throw new Exceptions\RuntimeException( 'index is required for Create' ); } $index = $this->index; + $uri = "/$index"; - return "/$index"; + if (isset($index) === true) { + $uri = "/$index"; + } + + return $uri; } - public function getParamWhitelist(): array + /** + * @return string[] + */ + public function getParamWhitelist() { - return [ - 'include_type_name', - 'wait_for_active_shards', + return array( 'timeout', 'master_timeout', - 'update_all_types' - ]; + 'update_all_types', + 'wait_for_active_shards' + ); } - public function getMethod(): string + /** + * @return string + */ + public function getMethod() { return 'PUT'; } - - public function setBody($body): Create - { - if (isset($body) !== true) { - return $this; - } - $this->body = $body; - - return $this; - } } diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Delete.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Delete.php index 3dd31fc05..9826cbce9 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Delete.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Delete.php @@ -1,58 +1,52 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class Delete extends AbstractEndpoint { - - public function getURI(): string + /** + * @return string + */ + public function getURI() { - if (isset($this->index) !== true) { - throw new RuntimeException( - 'index is required for Delete' - ); - } $index = $this->index; + $uri = "/$index"; + + if (isset($index) === true) { + $uri = "/$index"; + } - return "/$index"; + return $uri; } - public function getParamWhitelist(): array + /** + * @return string[] + */ + public function getParamWhitelist() { - return [ + return array( 'timeout', 'master_timeout', 'ignore_unavailable', - 'allow_no_indices', - 'expand_wildcards' - ]; + 'allow_no_indices' + ); } - public function getMethod(): string + /** + * @return string + */ + public function getMethod() { return 'DELETE'; } diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Exists.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Exists.php index 249c359ed..ac45e3f74 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Exists.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Exists.php @@ -1,59 +1,59 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class Exists extends AbstractEndpoint { - - public function getURI(): string + /** + * @throws \Elasticsearch\Common\Exceptions\RuntimeException + * @return string + */ + public function getURI() { if (isset($this->index) !== true) { - throw new RuntimeException( + throw new Exceptions\RuntimeException( 'index is required for Exists' ); } $index = $this->index; + $uri = "/$index"; - return "/$index"; + if (isset($index) === true) { + $uri = "/$index"; + } + + return $uri; } - public function getParamWhitelist(): array + /** + * @return string[] + */ + public function getParamWhitelist() { - return [ - 'local', + return array( 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', - 'flat_settings', - 'include_defaults' - ]; + 'local', + ); } - public function getMethod(): string + /** + * @return string + */ + public function getMethod() { return 'HEAD'; } diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Exists/Types.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Exists/Types.php new file mode 100644 index 000000000..a5b4b67a6 --- /dev/null +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Exists/Types.php @@ -0,0 +1,63 @@ + + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co + */ +class Types extends AbstractEndpoint +{ + /** + * @throws \Elasticsearch\Common\Exceptions\RuntimeException + * @return string + */ + public function getURI() + { + if (isset($this->index) !== true) { + throw new Exceptions\RuntimeException( + 'index is required for Types Exists' + ); + } + + if (isset($this->type) !== true) { + throw new Exceptions\RuntimeException( + 'type is required for Types Exists' + ); + } + + $index = $this->index; + $type = $this->type; + $uri = "/$index/$type"; + + return $uri; + } + + /** + * @return string[] + */ + public function getParamWhitelist() + { + return array( + 'ignore_unavailable', + 'allow_no_indices', + 'expand_wildcards' + ); + } + + /** + * @return string + */ + public function getMethod() + { + return 'HEAD'; + } +} diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Field/Get.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Field/Get.php new file mode 100644 index 000000000..c99123462 --- /dev/null +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Field/Get.php @@ -0,0 +1,88 @@ + + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co + */ +class Get extends AbstractEndpoint +{ + // A comma-separated list of fields + private $field; + + /** + * @param $field + * + * @return $this + */ + public function setField($field) + { + if (isset($field) !== true) { + return $this; + } + + $this->field = $field; + + return $this; + } + + /** + * @throws \Elasticsearch\Common\Exceptions\RuntimeException + * @return string + */ + public function getURI() + { + if (isset($this->field) !== true) { + throw new Exceptions\RuntimeException( + 'field is required for Get' + ); + } + $index = $this->index; + $type = $this->type; + $field = $this->field; + $uri = "/_mapping/field/$field"; + + if (isset($index) === true && isset($type) === true && isset($field) === true) { + $uri = "/$index/_mapping/$type/field/$field"; + } elseif (isset($type) === true && isset($field) === true) { + $uri = "/_mapping/$type/field/$field"; + } elseif (isset($index) === true && isset($field) === true) { + $uri = "/$index/_mapping/field/$field"; + } elseif (isset($field) === true) { + $uri = "/_mapping/field/$field"; + } + + return $uri; + } + + /** + * @return string[] + */ + public function getParamWhitelist() + { + return array( + 'include_defaults', + 'ignore_unavailable', + 'allow_no_indices', + 'expand_wildcards', + 'local', + ); + } + + /** + * @return string + */ + public function getMethod() + { + return 'GET'; + } +} diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Flush.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Flush.php index d51c5648c..f8d7c4b34 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Flush.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Flush.php @@ -1,18 +1,4 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class Flush extends AbstractEndpoint { + protected $synced = false; - public function getURI(): string + public function setSynced($synced) { - $index = $this->index ?? null; + $this->synced = $synced; + } - if (isset($index)) { - return "/$index/_flush"; + /** + * @return string + */ + public function getURI() + { + $index = $this->index; + $uri = "/_flush"; + + if (isset($index) === true) { + $uri = "/$index/_flush"; + } + + if ($this->synced === true) { + $uri .= "/synced"; } - return "/_flush"; + + return $uri; } - public function getParamWhitelist(): array + /** + * @return string[] + */ + public function getParamWhitelist() { - return [ + return array( 'force', - 'wait_if_ongoing', + 'full', 'ignore_unavailable', 'allow_no_indices', - 'expand_wildcards' - ]; + 'expand_wildcards', + 'wait_if_ongoing' + ); } - public function getMethod(): string + /** + * @return string + */ + public function getMethod() { - return 'POST'; + return 'GET'; } } diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/ForceMerge.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/ForceMerge.php index dc81b4ad2..3e6e0b465 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/ForceMerge.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/ForceMerge.php @@ -1,18 +1,4 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class ForceMerge extends AbstractEndpoint { - - public function getURI(): string + /** + * @return string + */ + public function getURI() { - $index = $this->index ?? null; + $index = $this->index; + $uri = "/_forcemerge"; - if (isset($index)) { - return "/$index/_forcemerge"; + if (isset($index) === true) { + $uri = "/$index/_forcemerge"; } - return "/_forcemerge"; + + return $uri; } - public function getParamWhitelist(): array + /** + * @return string[] + */ + public function getParamWhitelist() { - return [ + return array( 'flush', 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'max_num_segments', - 'only_expunge_deletes' - ]; + 'only_expunge_deletes', + 'operation_threading', + 'wait_for_merge', + ); } - public function getMethod(): string + /** + * @return string + */ + public function getMethod() { return 'POST'; } diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Gateway/Snapshot.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Gateway/Snapshot.php new file mode 100644 index 000000000..b492ceae9 --- /dev/null +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Gateway/Snapshot.php @@ -0,0 +1,52 @@ + + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co + */ +class Snapshot extends AbstractEndpoint +{ + /** + * @return string + */ + public function getURI() + { + $index = $this->index; + $uri = "/_gateway/snapshot"; + + if (isset($index) === true) { + $uri = "/$index/_gateway/snapshot"; + } + + return $uri; + } + + /** + * @return string[] + */ + public function getParamWhitelist() + { + return array( + 'ignore_unavailable', + 'allow_no_indices', + 'expand_wildcards' + ); + } + + /** + * @return string + */ + public function getMethod() + { + return 'POST'; + } +} diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Get.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Get.php index c32762b47..58a7de7b0 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Get.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Get.php @@ -1,61 +1,78 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class Get extends AbstractEndpoint { + private $feature; - public function getURI(): string + /** + * @throws \Elasticsearch\Common\Exceptions\RuntimeException + * @return string + */ + public function getURI() { if (isset($this->index) !== true) { - throw new RuntimeException( + throw new Exceptions\RuntimeException( 'index is required for Get' ); } - $index = $this->index; + $index = $this->index; + $feature = $this->feature; + $uri = "/$index"; + + if (isset($feature) === true) { + $uri = "/$index/$feature"; + } + + return $uri; + } + + public function setFeature($feature) + { + if (isset($feature) !== true) { + return $this; + } + + if (is_array($feature) === true) { + $feature = implode(",", $feature); + } + + $this->feature = $feature; - return "/$index"; + return $this; } - public function getParamWhitelist(): array + /** + * @return string[] + */ + public function getParamWhitelist() { - return [ - 'include_type_name', + return array( 'local', 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', - 'flat_settings', - 'include_defaults', - 'master_timeout' - ]; + 'human' + ); } - public function getMethod(): string + /** + * @return string + */ + public function getMethod() { return 'GET'; } diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Mapping/Delete.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Mapping/Delete.php new file mode 100644 index 000000000..87ac13d98 --- /dev/null +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Mapping/Delete.php @@ -0,0 +1,63 @@ + + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co + */ +class Delete extends AbstractEndpoint +{ + /** + * @throws \Elasticsearch\Common\Exceptions\RuntimeException + * @return string + */ + public function getURI() + { + if (isset($this->index) !== true) { + throw new Exceptions\RuntimeException( + 'index is required for Delete' + ); + } + if (isset($this->type) !== true) { + throw new Exceptions\RuntimeException( + 'type is required for Delete' + ); + } + $index = $this->index; + $type = $this->type; + $uri = "/$index/$type/_mapping"; + + if (isset($index) === true && isset($type) === true) { + $uri = "/$index/$type/_mapping"; + } + + return $uri; + } + + /** + * @return string[] + */ + public function getParamWhitelist() + { + return array( + 'master_timeout', + ); + } + + /** + * @return string + */ + public function getMethod() + { + return 'DELETE'; + } +} diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Mapping/Get.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Mapping/Get.php new file mode 100644 index 000000000..88568e6dc --- /dev/null +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Mapping/Get.php @@ -0,0 +1,59 @@ + + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co + */ +class Get extends AbstractEndpoint +{ + /** + * @return string + */ + public function getURI() + { + $index = $this->index; + $type = $this->type; + $uri = "/_mapping"; + + if (isset($index) === true && isset($type) === true) { + $uri = "/$index/_mapping/$type"; + } elseif (isset($type) === true) { + $uri = "/_mapping/$type"; + } elseif (isset($index) === true) { + $uri = "/$index/_mapping"; + } + + return $uri; + } + + /** + * @return string[] + */ + public function getParamWhitelist() + { + return array( + 'ignore_unavailable', + 'allow_no_indices', + 'expand_wildcards', + 'wildcard_expansion', + 'local', + ); + } + + /** + * @return string + */ + public function getMethod() + { + return 'GET'; + } +} diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Mapping/GetField.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Mapping/GetField.php new file mode 100644 index 000000000..068be334d --- /dev/null +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Mapping/GetField.php @@ -0,0 +1,79 @@ + + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co + */ +class GetField extends AbstractEndpoint +{ + /** @var string */ + private $fields; + + /** + * @param string|array $fields + * + * @return $this + */ + public function setFields($fields) + { + if (isset($fields) !== true) { + return $this; + } + + if (is_array($fields) === true) { + $fields = implode(",", $fields); + } + + $this->fields = $fields; + + return $this; + } + + /** + * @throws \Elasticsearch\Common\Exceptions\RuntimeException + * @return string + */ + public function getURI() + { + if (isset($this->fields) !== true) { + throw new Exceptions\RuntimeException( + 'fields is required for Get Field Mapping' + ); + } + $uri = $this->getOptionalURI('_mapping/field'); + + return $uri.'/'.$this->fields; + } + + /** + * @return string[] + */ + public function getParamWhitelist() + { + return array( + 'include_defaults', + 'ignore_unavailable', + 'allow_no_indices', + 'expand_wildcards', + 'local' + ); + } + + /** + * @return string + */ + public function getMethod() + { + return 'GET'; + } +} diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Mapping/Put.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Mapping/Put.php new file mode 100644 index 000000000..1639ca72b --- /dev/null +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Mapping/Put.php @@ -0,0 +1,96 @@ + + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co + */ +class Put extends AbstractEndpoint +{ + /** + * @param array $body + * + * @throws \Elasticsearch\Common\Exceptions\InvalidArgumentException + * @return $this + */ + public function setBody($body) + { + if (isset($body) !== true) { + return $this; + } + + $this->body = $body; + + return $this; + } + + /** + * @throws \Elasticsearch\Common\Exceptions\RuntimeException + * @return string + */ + public function getURI() + { + if (isset($this->type) !== true) { + throw new Exceptions\RuntimeException( + 'type is required for Put' + ); + } + $index = $this->index; + $type = $this->type; + $uri = "/_mapping/$type"; + + if (isset($index) === true && isset($type) === true) { + $uri = "/$index/$type/_mapping"; + } elseif (isset($type) === true) { + $uri = "/_mapping/$type"; + } + + return $uri; + } + + /** + * @return string[] + */ + public function getParamWhitelist() + { + return array( + 'ignore_conflicts', + 'timeout', + 'master_timeout', + 'ignore_unavailable', + 'allow_no_indices', + 'expand_wildcards', + 'update_all_types' + ); + } + + /** + * @return array + * @throws \Elasticsearch\Common\Exceptions\RuntimeException + */ + public function getBody() + { + if (isset($this->body) !== true) { + throw new Exceptions\RuntimeException('Body is required for Put Mapping'); + } + + return $this->body; + } + + /** + * @return string + */ + public function getMethod() + { + return 'PUT'; + } +} diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Open.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Open.php index bd506232e..6808659b5 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Open.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Open.php @@ -1,59 +1,60 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class Open extends AbstractEndpoint { - - public function getURI(): string + /** + * @throws \Elasticsearch\Common\Exceptions\RuntimeException + * @return string + */ + public function getURI() { if (isset($this->index) !== true) { - throw new RuntimeException( + throw new Exceptions\RuntimeException( 'index is required for Open' ); } $index = $this->index; + $uri = "/$index/_open"; + + if (isset($index) === true) { + $uri = "/$index/_open"; + } - return "/$index/_open"; + return $uri; } - public function getParamWhitelist(): array + /** + * @return string[] + */ + public function getParamWhitelist() { - return [ + return array( 'timeout', 'master_timeout', 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', - 'wait_for_active_shards' - ]; + ); } - public function getMethod(): string + /** + * @return string + */ + public function getMethod() { return 'POST'; } diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Recovery.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Recovery.php index 29fcb3f92..11e11cf69 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Recovery.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Recovery.php @@ -1,18 +1,4 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class Recovery extends AbstractEndpoint { - - public function getURI(): string + /** + * @return string + */ + public function getURI() { - $index = $this->index ?? null; + $index = $this->index; + $uri = "/_recovery"; - if (isset($index)) { - return "/$index/_recovery"; + if (isset($index) === true) { + $uri = "/$index/_recovery"; } - return "/_recovery"; + + return $uri; } - public function getParamWhitelist(): array + /** + * @return string[] + */ + public function getParamWhitelist() { - return [ + return array( 'detailed', - 'active_only' - ]; + 'active_only', + 'human' + ); } - public function getMethod(): string + /** + * @return string + */ + public function getMethod() { return 'GET'; } diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Refresh.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Refresh.php index 895dfef2c..e7938d151 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Refresh.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Refresh.php @@ -1,18 +1,4 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class Refresh extends AbstractEndpoint { - - public function getURI(): string + /** + * @return string + */ + public function getURI() { - $index = $this->index ?? null; + $index = $this->index; + $uri = "/_refresh"; - if (isset($index)) { - return "/$index/_refresh"; + if (isset($index) === true) { + $uri = "/$index/_refresh"; } - return "/_refresh"; + + return $uri; } - public function getParamWhitelist(): array + /** + * @return string[] + */ + public function getParamWhitelist() { - return [ + return array( 'ignore_unavailable', 'allow_no_indices', - 'expand_wildcards' - ]; + 'expand_wildcards', + 'force', + 'operation_threading', + ); } - public function getMethod(): string + /** + * @return string + */ + public function getMethod() { - return 'POST'; + return 'GET'; } } diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Rollover.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Rollover.php index 52485dd26..bc188eadf 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Rollover.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Rollover.php @@ -1,95 +1,109 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class Rollover extends AbstractEndpoint { - protected $alias; - protected $new_index; + private $alias; + private $newIndex; - public function getURI(): string + /** + * @param string $alias + * + * @return $this + */ + public function setAlias($alias) { - if (isset($this->alias) !== true) { - throw new RuntimeException( - 'alias is required for Rollover' - ); + if ($alias === null) { + return $this; } - $alias = $this->alias; - $new_index = $this->new_index ?? null; - if (isset($new_index)) { - return "/$alias/_rollover/$new_index"; - } - return "/$alias/_rollover"; + $this->alias = urlencode($alias); + return $this; } - public function getParamWhitelist(): array + /** + * @param string $newIndex + * + * @return $this + */ + public function setNewIndex($newIndex) { - return [ - 'include_type_name', - 'timeout', - 'dry_run', - 'master_timeout', - 'wait_for_active_shards' - ]; - } + if ($newIndex === null) { + return $this; + } - public function getMethod(): string - { - return 'POST'; + $this->newIndex = urlencode($newIndex); + return $this; } - public function setBody($body): Rollover + /** + * @param array $body + * + * @throws \Elasticsearch\Common\Exceptions\InvalidArgumentException + * @return $this + */ + public function setBody($body) { if (isset($body) !== true) { return $this; } + $this->body = $body; return $this; } - public function setAlias($alias): Rollover + /** + * @throws \Elasticsearch\Common\Exceptions\RuntimeException + * @return string + */ + public function getURI() { - if (isset($alias) !== true) { - return $this; + if (isset($this->alias) !== true) { + throw new Exceptions\RuntimeException( + 'alias name is required for Rollover' + ); } - $this->alias = $alias; - return $this; + $uri = "/{$this->alias}/_rollover"; + + if (isset($this->newIndex) === true) { + $uri .= "/{$this->newIndex}"; + } + + return $uri; } - public function setNewIndex($new_index): Rollover + /** + * @return string[] + */ + public function getParamWhitelist() { - if (isset($new_index) !== true) { - return $this; - } - $this->new_index = $new_index; + return array( + 'timeout', + 'master_timeout', + 'wait_for_active_shards', + ); + } - return $this; + /** + * @return string + */ + public function getMethod() + { + return 'POST'; } } diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Seal.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Seal.php new file mode 100644 index 000000000..c6f513829 --- /dev/null +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Seal.php @@ -0,0 +1,50 @@ + + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co + */ +class Seal extends AbstractEndpoint +{ + /** + * @throws \Elasticsearch\Common\Exceptions\RuntimeException + * @return string + */ + public function getURI() + { + $index = $this->index; + $uri = "/_seal"; + + if (isset($index) === true) { + $uri = "/$index/_seal"; + } + + return $uri; + } + + /** + * @return string[] + */ + public function getParamWhitelist() + { + return array(); + } + + /** + * @return string + */ + public function getMethod() + { + return 'POST'; + } +} diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Segments.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Segments.php index 2e2d011ee..8ade2912e 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Segments.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Segments.php @@ -1,18 +1,4 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class Segments extends AbstractEndpoint { - - public function getURI(): string + /** + * @return string + */ + public function getURI() { - $index = $this->index ?? null; + $index = $this->index; + $uri = "/_segments"; - if (isset($index)) { - return "/$index/_segments"; + if (isset($index) === true) { + $uri = "/$index/_segments"; } - return "/_segments"; + + return $uri; } - public function getParamWhitelist(): array + /** + * @return string[] + */ + public function getParamWhitelist() { - return [ + return array( 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', - 'verbose' - ]; + 'human', + 'operation_threading', + ); } - public function getMethod(): string + /** + * @return string + */ + public function getMethod() { return 'GET'; } diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Settings/Get.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Settings/Get.php new file mode 100644 index 000000000..943bfd983 --- /dev/null +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Settings/Get.php @@ -0,0 +1,79 @@ + + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co + */ +class Get extends AbstractEndpoint +{ + // The name of the settings that should be included + private $name; + + /** + * @param $name + * + * @return $this + */ + public function setName($name) + { + if (isset($name) !== true) { + return $this; + } + + $this->name = $name; + + return $this; + } + + /** + * @return string + */ + public function getURI() + { + $index = $this->index; + $name = $this->name; + $uri = "/_settings"; + + if (isset($index) === true && isset($name) === true) { + $uri = "/$index/_settings/$name"; + } elseif (isset($name) === true) { + $uri = "/_settings/$name"; + } elseif (isset($index) === true) { + $uri = "/$index/_settings"; + } + + return $uri; + } + + /** + * @return string[] + */ + public function getParamWhitelist() + { + return array( + 'ignore_unavailable', + 'allow_no_indices', + 'expand_wildcards', + 'flat_settings', + 'local', + 'include_defaults' + ); + } + + /** + * @return string + */ + public function getMethod() + { + return 'GET'; + } +} diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Settings/Put.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Settings/Put.php new file mode 100644 index 000000000..57f211a31 --- /dev/null +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Settings/Put.php @@ -0,0 +1,86 @@ + + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co + */ +class Put extends AbstractEndpoint +{ + /** + * @param array $body + * + * @throws \Elasticsearch\Common\Exceptions\InvalidArgumentException + * @return $this + */ + public function setBody($body) + { + if (isset($body) !== true) { + return $this; + } + + $this->body = $body; + + return $this; + } + + /** + * @return string + */ + public function getURI() + { + $index = $this->index; + $uri = "/_settings"; + + if (isset($index) === true) { + $uri = "/$index/_settings"; + } + + return $uri; + } + + /** + * @return string[] + */ + public function getParamWhitelist() + { + return array( + 'master_timeout', + 'ignore_unavailable', + 'allow_no_indices', + 'expand_wildcards', + 'flat_settings', + 'preserve_existing' + ); + } + + /** + * @return array + * @throws \Elasticsearch\Common\Exceptions\RuntimeException + */ + public function getBody() + { + if (isset($this->body) !== true) { + throw new Exceptions\RuntimeException('Body is required for Put Settings'); + } + + return $this->body; + } + + /** + * @return string + */ + public function getMethod() + { + return 'PUT'; + } +} diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/ShardStores.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/ShardStores.php index 8601899ae..10dc44726 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/ShardStores.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/ShardStores.php @@ -1,54 +1,58 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ + class ShardStores extends AbstractEndpoint { - - public function getURI(): string + /** + * @throws \Elasticsearch\Common\Exceptions\RuntimeException + * @return string + */ + public function getURI() { - $index = $this->index ?? null; + $index = $this->index; + $uri = "/_shard_stores"; - if (isset($index)) { - return "/$index/_shard_stores"; + if (isset($index) === true) { + $uri = "/$index/_shard_stores"; } - return "/_shard_stores"; + + return $uri; } - public function getParamWhitelist(): array + + /** + * @return string[] + */ + public function getParamWhitelist() { - return [ + return array( 'status', 'ignore_unavailable', 'allow_no_indices', - 'expand_wildcards' - ]; + 'expand_wildcards', + 'operation_threading' + ); } - public function getMethod(): string + + /** + * @return string + */ + public function getMethod() { return 'GET'; } diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Shrink.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Shrink.php index 2520925af..b4e7832b7 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Shrink.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Shrink.php @@ -1,85 +1,101 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * + * @link http://elastic.co */ class Shrink extends AbstractEndpoint { - protected $target; + // The name of the target index to shrink into + private $target; + /** + * @param array $body + * + * @throws \Elasticsearch\Common\Exceptions\InvalidArgumentException + * + * @return $this + */ + public function setBody($body) + { + if (isset($body) !== true) { + return $this; + } + + $this->body = $body; + + return $this; + } + + /** + * @param $target + * + * @return $this + */ + public function setTarget($target) + { + if (isset($target) !== true) { + return $this; + } + $this->target = $target; + + return $this; + } - public function getURI(): string + /** + * @throws \Elasticsearch\Common\Exceptions\BadMethodCallException + * + * @return string + */ + public function getURI() { if (isset($this->index) !== true) { - throw new RuntimeException( + throw new Exceptions\RuntimeException( 'index is required for Shrink' ); } - $index = $this->index; if (isset($this->target) !== true) { - throw new RuntimeException( + throw new Exceptions\RuntimeException( 'target is required for Shrink' ); } + $index = $this->index; $target = $this->target; + $uri = "/$index/_shrink/$target"; + if (isset($index) === true && isset($target) === true) { + $uri = "/$index/_shrink/$target"; + } - return "/$index/_shrink/$target"; + return $uri; } - public function getParamWhitelist(): array + /** + * @return string[] + */ + public function getParamWhitelist() { - return [ - 'copy_settings', + return array( 'timeout', 'master_timeout', - 'wait_for_active_shards' - ]; + ); } - public function getMethod(): string + /** + * @return string + */ + public function getMethod() { + //TODO Fix Me! return 'PUT'; } - - public function setBody($body): Shrink - { - if (isset($body) !== true) { - return $this; - } - $this->body = $body; - - return $this; - } - - public function setTarget($target): Shrink - { - if (isset($target) !== true) { - return $this; - } - $this->target = $target; - - return $this; - } } diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Snapshotindex.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Snapshotindex.php new file mode 100644 index 000000000..e30530b1d --- /dev/null +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Snapshotindex.php @@ -0,0 +1,52 @@ + + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co + */ +class Snapshotindex extends AbstractEndpoint +{ + /** + * @return string + */ + public function getURI() + { + $index = $this->index; + $uri = "/_gateway/snapshot"; + + if (isset($index) === true) { + $uri = "/$index/_gateway/snapshot"; + } + + return $uri; + } + + /** + * @return string[] + */ + public function getParamWhitelist() + { + return array( + 'ignore_unavailable', + 'allow_no_indices', + 'expand_wildcards', + ); + } + + /** + * @return string + */ + public function getMethod() + { + return 'POST'; + } +} diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Stats.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Stats.php index e97d868a2..bbdc1d2fc 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Stats.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Stats.php @@ -1,18 +1,4 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class Stats extends AbstractEndpoint { - protected $metric; + // Limit the information returned the specific metrics. + private $metric; - public function getURI(): string + /** + * @param $metric + * + * @return $this + */ + public function setMetric($metric) { - $index = $this->index ?? null; - $metric = $this->metric ?? null; - - if (isset($index) && isset($metric)) { - return "/$index/_stats/$metric"; + if (isset($metric) !== true) { + return $this; } - if (isset($metric)) { - return "/_stats/$metric"; + + if (is_array($metric)) { + $metric = implode(",", $metric); } - if (isset($index)) { - return "/$index/_stats"; + + $this->metric = $metric; + + return $this; + } + + /** + * @return string + */ + public function getURI() + { + $index = $this->index; + $metric = $this->metric; + $uri = "/_stats"; + + if (isset($index) === true && isset($metric) === true) { + $uri = "/$index/_stats/$metric"; + } elseif (isset($index) === true) { + $uri = "/$index/_stats"; + } elseif (isset($metric) === true) { + $uri = "/_stats/$metric"; } - return "/_stats"; + + return $uri; } - public function getParamWhitelist(): array + /** + * @return string[] + */ + public function getParamWhitelist() { - return [ + return array( 'completion_fields', 'fielddata_fields', 'fields', 'groups', + 'human', 'level', 'types', + 'metric', 'include_segment_file_sizes' - ]; + ); } - public function getMethod(): string + /** + * @return string + */ + public function getMethod() { return 'GET'; } - - public function setMetric($metric): Stats - { - if (isset($metric) !== true) { - return $this; - } - if (is_array($metric) === true) { - $metric = implode(",", $metric); - } - $this->metric = $metric; - - return $this; - } } diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Status.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Status.php new file mode 100644 index 000000000..fc52f84e5 --- /dev/null +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Status.php @@ -0,0 +1,56 @@ + + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co + */ +class Status extends AbstractEndpoint +{ + /** + * @return string + */ + public function getURI() + { + $index = $this->index; + $uri = "/_status"; + + if (isset($index) === true) { + $uri = "/$index/_status"; + } + + return $uri; + } + + /** + * @return string[] + */ + public function getParamWhitelist() + { + return array( + 'ignore_unavailable', + 'allow_no_indices', + 'expand_wildcards', + 'human', + 'operation_threading', + 'recovery', + 'snapshot', + ); + } + + /** + * @return string + */ + public function getMethod() + { + return 'GET'; + } +} diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Template/AbstractTemplateEndpoint.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Template/AbstractTemplateEndpoint.php new file mode 100644 index 000000000..cde022581 --- /dev/null +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Template/AbstractTemplateEndpoint.php @@ -0,0 +1,32 @@ + + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co + */ +abstract class AbstractTemplateEndpoint extends AbstractEndpoint +{ + /** @var string */ + protected $name; + + /** + * @param $name + * + * @return $this + */ + public function setName($name) + { + $this->name = $name; + + return $this; + } +} diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Template/Delete.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Template/Delete.php new file mode 100644 index 000000000..044dce6f1 --- /dev/null +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Template/Delete.php @@ -0,0 +1,78 @@ + + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co + */ + +class Delete extends AbstractEndpoint +{ + // The name of the template + private $name; + + /** + * @param $name + * + * @return $this + */ + public function setName($name) + { + if (isset($name) !== true) { + return $this; + } + + $this->name = $name; + + return $this; + } + + /** + * @throws \Elasticsearch\Common\Exceptions\RuntimeException + * @return string + */ + public function getURI() + { + if (isset($this->name) !== true) { + throw new Exceptions\RuntimeException( + 'name is required for Delete' + ); + } + $name = $this->name; + $uri = "/_template/$name"; + + if (isset($name) === true) { + $uri = "/_template/$name"; + } + + return $uri; + } + + /** + * @return string[] + */ + public function getParamWhitelist() + { + return array( + 'timeout', + 'master_timeout', + ); + } + + /** + * @return string + */ + public function getMethod() + { + return 'DELETE'; + } +} diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Template/Exists.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Template/Exists.php new file mode 100644 index 000000000..ebf6fdfe3 --- /dev/null +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Template/Exists.php @@ -0,0 +1,77 @@ + + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co + */ +class Exists extends AbstractEndpoint +{ + // The name of the template + private $name; + + /** + * @param $name + * + * @return $this + */ + public function setName($name) + { + if (isset($name) !== true) { + return $this; + } + + $this->name = $name; + + return $this; + } + + /** + * @throws \Elasticsearch\Common\Exceptions\RuntimeException + * @return string + */ + public function getURI() + { + if (isset($this->name) !== true) { + throw new Exceptions\RuntimeException( + 'name is required for Exists' + ); + } + $name = $this->name; + $uri = "/_template/$name"; + + if (isset($name) === true) { + $uri = "/_template/$name"; + } + + return $uri; + } + + /** + * @return string[] + */ + public function getParamWhitelist() + { + return array( + 'local', + 'master_timeout' + ); + } + + /** + * @return string + */ + public function getMethod() + { + return 'HEAD'; + } +} diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Template/Get.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Template/Get.php new file mode 100644 index 000000000..77472063d --- /dev/null +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Template/Get.php @@ -0,0 +1,73 @@ + + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co + */ +class Get extends AbstractEndpoint +{ + // The name of the template + private $name; + + /** + * @param $name + * + * @return $this + */ + public function setName($name) + { + if (isset($name) !== true) { + return $this; + } + + $this->name = $name; + + return $this; + } + + /** + * @throws \Elasticsearch\Common\Exceptions\RuntimeException + * @return string + */ + public function getURI() + { + $name = $this->name; + $uri = "/_template"; + + if (isset($name) === true) { + $uri = "/_template/$name"; + } + + return $uri; + } + + /** + * @return string[] + */ + public function getParamWhitelist() + { + return array( + 'flat_settings', + 'local', + 'master_timeout' + ); + } + + /** + * @return string + */ + public function getMethod() + { + return 'GET'; + } +} diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Template/Put.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Template/Put.php new file mode 100644 index 000000000..3aca04607 --- /dev/null +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Template/Put.php @@ -0,0 +1,110 @@ + + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co + */ +class Put extends AbstractEndpoint +{ + // The name of the template + private $name; + + /** + * @param array $body + * + * @throws \Elasticsearch\Common\Exceptions\InvalidArgumentException + * @return $this + */ + public function setBody($body) + { + if (isset($body) !== true) { + return $this; + } + + $this->body = $body; + + return $this; + } + + /** + * @param $name + * + * @return $this + */ + public function setName($name) + { + if (isset($name) !== true) { + return $this; + } + + $this->name = $name; + + return $this; + } + + /** + * @throws \Elasticsearch\Common\Exceptions\RuntimeException + * @return string + */ + public function getURI() + { + if (isset($this->name) !== true) { + throw new Exceptions\RuntimeException( + 'name is required for Put' + ); + } + $name = $this->name; + $uri = "/_template/$name"; + + if (isset($name) === true) { + $uri = "/_template/$name"; + } + + return $uri; + } + + /** + * @return string[] + */ + public function getParamWhitelist() + { + return array( + 'order', + 'timeout', + 'master_timeout', + 'flat_settings', + 'create' + ); + } + + /** + * @return array + * @throws \Elasticsearch\Common\Exceptions\RuntimeException + */ + public function getBody() + { + if (isset($this->body) !== true) { + throw new Exceptions\RuntimeException('Body is required for Put Template'); + } + + return $this->body; + } + + /** + * @return string + */ + public function getMethod() + { + return 'PUT'; + } +} diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Type/Exists.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Type/Exists.php new file mode 100644 index 000000000..b29518929 --- /dev/null +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Type/Exists.php @@ -0,0 +1,60 @@ + + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co + */ +class Exists extends AbstractEndpoint +{ + /** + * @throws \Elasticsearch\Common\Exceptions\RuntimeException + * @return string + */ + public function getURI() + { + if (isset($this->index) !== true) { + throw new Exceptions\RuntimeException( + 'index is required for Exists' + ); + } + if (isset($this->type) !== true) { + throw new Exceptions\RuntimeException( + 'type is required for Exists' + ); + } + $uri = "/{$this->index}/_mapping/{$this->type}"; + + return $uri; + } + + /** + * @return string[] + */ + public function getParamWhitelist() + { + return array( + 'ignore_unavailable', + 'allow_no_indices', + 'expand_wildcards', + 'local', + ); + } + + /** + * @return string + */ + public function getMethod() + { + return 'HEAD'; + } +} diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Upgrade/Get.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Upgrade/Get.php new file mode 100644 index 000000000..d9cb7bea2 --- /dev/null +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Upgrade/Get.php @@ -0,0 +1,65 @@ + + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co + */ + +class Get extends AbstractEndpoint +{ + + /** + * @return string + */ + public function getURI() + { + $index = $this->index; + $uri = "/_upgrade"; + + if (isset($index) === true) { + $uri = "/$index/_upgrade"; + } + + + return $uri; + } + + + /** + * @return string[] + */ + public function getParamWhitelist() + { + return array( + 'wait_for_completion', + 'only_ancient_segments', + 'ignore_unavailable', + 'allow_no_indices', + 'expand_wildcards', + ); + } + + + /** + * @return string + */ + public function getMethod() + { + return 'GET'; + } +} diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Upgrade/Post.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Upgrade/Post.php new file mode 100644 index 000000000..5b00f68b6 --- /dev/null +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Upgrade/Post.php @@ -0,0 +1,65 @@ + + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co + */ + +class Post extends AbstractEndpoint +{ + + /** + * @return string + */ + public function getURI() + { + $index = $this->index; + $uri = "/_upgrade"; + + if (isset($index) === true) { + $uri = "/$index/_upgrade"; + } + + + return $uri; + } + + + /** + * @return string[] + */ + public function getParamWhitelist() + { + return array( + 'wait_for_completion', + 'only_ancient_segments', + 'ignore_unavailable', + 'allow_no_indices', + 'expand_wildcards', + ); + } + + + /** + * @return string + */ + public function getMethod() + { + return 'POST'; + } +} diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Validate/Query.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Validate/Query.php new file mode 100644 index 000000000..a96303803 --- /dev/null +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/Validate/Query.php @@ -0,0 +1,71 @@ + + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co + */ +class Query extends AbstractEndpoint +{ + /** + * @param array $body + * + * @throws \Elasticsearch\Common\Exceptions\InvalidArgumentException + * @return $this + */ + public function setBody($body) + { + if (isset($body) !== true) { + return $this; + } + + $this->body = $body; + + return $this; + } + + /** + * @return string + */ + public function getURI() + { + return $this->getOptionalURI('_validate/query'); + } + + /** + * @return string[] + */ + public function getParamWhitelist() + { + return array( + 'explain', + 'ignore_indices', + 'operation_threading', + 'source', + 'q', + 'df', + 'default_operator', + 'analyzer', + 'analyze_wildcard', + 'lenient', + 'lowercase_expanded_terms' + ); + } + + /** + * @return string + */ + public function getMethod() + { + return 'GET'; + } +} diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/ValidateQuery.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/ValidateQuery.php index b949f11fd..df94c02a9 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/ValidateQuery.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Indices/ValidateQuery.php @@ -1,77 +1,77 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class ValidateQuery extends AbstractEndpoint { + /** + * @param array $body + * + * @throws \Elasticsearch\Common\Exceptions\InvalidArgumentException + * @return $this + */ + public function setBody($body) + { + if (isset($body) !== true) { + return $this; + } + + $this->body = $body; + + return $this; + } - public function getURI(): string + /** + * @return string + */ + public function getURI() { - $index = $this->index ?? null; - $type = $this->type ?? null; + $index = $this->index; + $type = $this->type; + $uri = "/_validate/query"; - if (isset($index) && isset($type)) { - return "/$index/$type/_validate/query"; + if (isset($index) === true && isset($type) === true) { + $uri = "/$index/$type/_validate/query"; + } elseif (isset($index) === true) { + $uri = "/$index/_validate/query"; } - if (isset($index)) { - return "/$index/_validate/query"; - } - return "/_validate/query"; + + return $uri; } - public function getParamWhitelist(): array + /** + * @return string[] + */ + public function getParamWhitelist() { - return [ + return array( 'explain', 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', + 'operation_threading', + 'source', 'q', - 'analyzer', - 'analyze_wildcard', - 'default_operator', - 'df', - 'lenient', - 'rewrite', - 'all_shards' - ]; - } - - public function getMethod(): string - { - return isset($this->body) ? 'POST' : 'GET'; + ); } - public function setBody($body): ValidateQuery + /** + * @return string + */ + public function getMethod() { - if (isset($body) !== true) { - return $this; - } - $this->body = $body; - - return $this; + return 'GET'; } } diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Info.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Info.php index bff9c375b..dc157d7bc 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Info.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Info.php @@ -1,47 +1,41 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class Info extends AbstractEndpoint { - - public function getURI(): string + /** + * @return string + */ + public function getURI() { + $uri = "/"; - return "/"; + return $uri; } - public function getParamWhitelist(): array + /** + * @return string[] + */ + public function getParamWhitelist() { - return [ - - ]; + return array( + ); } - public function getMethod(): string + /** + * @return string + */ + public function getMethod() { return 'GET'; } diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Ingest/Pipeline/Delete.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Ingest/Pipeline/Delete.php new file mode 100644 index 000000000..b61e9e813 --- /dev/null +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Ingest/Pipeline/Delete.php @@ -0,0 +1,54 @@ + + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co + */ +class Delete extends AbstractEndpoint +{ + /** + * @throws \Elasticsearch\Common\Exceptions\RuntimeException + * @return string + */ + public function getURI() + { + if (isset($this->id) !== true) { + throw new Exceptions\RuntimeException( + 'id is required for DeletePipeline' + ); + } + $id = $this->id; + $uri = "/_ingest/pipeline/$id"; + + return $uri; + } + + /** + * @return string[] + */ + public function getParamWhitelist() + { + return array( + 'master_timeout', + 'timeout' + ); + } + + /** + * @return string + */ + public function getMethod() + { + return 'DELETE'; + } +} diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Ingest/Pipeline/Get.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Ingest/Pipeline/Get.php new file mode 100644 index 000000000..d5cf38fca --- /dev/null +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Ingest/Pipeline/Get.php @@ -0,0 +1,51 @@ + + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co + */ +class Get extends AbstractEndpoint +{ + /** + * @throws \Elasticsearch\Common\Exceptions\RuntimeException + * @return string + */ + public function getURI() + { + if (isset($this->id) !== true) { + return '/_ingest/pipeline/*'; + } + + $id = $this->id; + + return "/_ingest/pipeline/$id"; + } + + /** + * @return string[] + */ + public function getParamWhitelist() + { + return array( + 'master_timeout' + ); + } + + /** + * @return string + */ + public function getMethod() + { + return 'GET'; + } +} diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Ingest/Pipeline/Put.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Ingest/Pipeline/Put.php new file mode 100644 index 000000000..d8707b3cb --- /dev/null +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Ingest/Pipeline/Put.php @@ -0,0 +1,71 @@ + + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co + */ +class Put extends AbstractEndpoint +{ + /** + * @param array $body + * + * @throws \Elasticsearch\Common\Exceptions\InvalidArgumentException + * @return $this + */ + public function setBody($body) + { + if (isset($body) !== true) { + return $this; + } + + $this->body = $body; + + return $this; + } + + /** + * @throws \Elasticsearch\Common\Exceptions\RuntimeException + * @return string + */ + public function getURI() + { + if (isset($this->id) !== true) { + throw new Exceptions\RuntimeException( + 'id is required for PutPipeline' + ); + } + $id = $this->id; + $uri = "/_ingest/pipeline/$id"; + + return $uri; + } + + /** + * @return string[] + */ + public function getParamWhitelist() + { + return array( + 'master_timeout', + 'timeout' + ); + } + + /** + * @return string + */ + public function getMethod() + { + return 'PUT'; + } +} diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Ingest/ProcessorGrok.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Ingest/ProcessorGrok.php index 8b6ba78e7..431b56057 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Ingest/ProcessorGrok.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Ingest/ProcessorGrok.php @@ -1,47 +1,42 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class ProcessorGrok extends AbstractEndpoint { - - public function getURI(): string + /** + * @throws \Elasticsearch\Common\Exceptions\RuntimeException + * @return string + */ + public function getURI() { - return "/_ingest/processor/grok"; } - public function getParamWhitelist(): array + /** + * @return string[] + */ + public function getParamWhitelist() { - return [ - - ]; + return []; } - public function getMethod(): string + /** + * @return string + */ + public function getMethod() { return 'GET'; } diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Ingest/Simulate.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Ingest/Simulate.php index 370c1141d..f4570bbdf 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Ingest/Simulate.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Ingest/Simulate.php @@ -1,62 +1,65 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class Simulate extends AbstractEndpoint { - - public function getURI(): string + /** + * @param array $body + * + * @throws \Elasticsearch\Common\Exceptions\InvalidArgumentException + * @return $this + */ + public function setBody($body) { - $id = $this->id ?? null; - - if (isset($id)) { - return "/_ingest/pipeline/$id/_simulate"; + if (isset($body) !== true) { + return $this; } - return "/_ingest/pipeline/_simulate"; + + $this->body = $body; + + return $this; } - public function getParamWhitelist(): array + /** + * @throws \Elasticsearch\Common\Exceptions\RuntimeException + * @return string + */ + public function getURI() { - return [ - 'verbose' - ]; + if (isset($this->id) === true) { + return "/_ingest/pipeline/{$this->id}/_simulate"; + } + return "/_ingest/pipeline/_simulate"; } - public function getMethod(): string + /** + * @return string[] + */ + public function getParamWhitelist() { - return isset($this->body) ? 'POST' : 'GET'; + return array( + 'verbose', + ); } - public function setBody($body): Simulate + /** + * @return string + */ + public function getMethod() { - if (isset($body) !== true) { - return $this; - } - $this->body = $body; - - return $this; + return 'GET'; } } diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/MPercolate.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/MPercolate.php new file mode 100644 index 000000000..47d20a88f --- /dev/null +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/MPercolate.php @@ -0,0 +1,78 @@ + + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co + */ +class MPercolate extends AbstractEndpoint implements BulkEndpointInterface +{ + /** + * @param SerializerInterface $serializer + */ + public function __construct(SerializerInterface $serializer) + { + $this->serializer = $serializer; + } + + /** + * @param string|array $body + * + * @return $this + */ + public function setBody($body) + { + if (isset($body) !== true) { + return $this; + } + + if (is_array($body) === true) { + $bulkBody = ""; + foreach ($body as $item) { + $bulkBody .= $this->serializer->serialize($item)."\n"; + } + $body = $bulkBody; + } + + $this->body = $body; + + return $this; + } + + /** + * @return string + */ + public function getURI() + { + return $this->getOptionalURI('_mpercolate'); + } + + /** + * @return string[] + */ + public function getParamWhitelist() + { + return array( + 'ignore_unavailable', + 'allow_no_indices', + 'expand_wildcards', + ); + } + + /** + * @return string + */ + public function getMethod() + { + return 'POST'; + } +} diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/MTermVectors.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/MTermVectors.php index 3b0584b76..e723920d9 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/MTermVectors.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/MTermVectors.php @@ -1,50 +1,51 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class MTermVectors extends AbstractEndpoint { - - public function getURI(): string + /** + * @param array $body + * + * @throws \Elasticsearch\Common\Exceptions\InvalidArgumentException + * @return $this + */ + public function setBody($body) { - $index = $this->index ?? null; - $type = $this->type ?? null; - - if (isset($index) && isset($type)) { - return "/$index/$type/_mtermvectors"; - } - if (isset($index)) { - return "/$index/_mtermvectors"; + if (isset($body) !== true) { + return $this; } - return "/_mtermvectors"; + + $this->body = $body; + + return $this; } - public function getParamWhitelist(): array + /** + * @return string + */ + public function getURI() { - return [ + return $this->getOptionalURI('_mtermvectors'); + } + + /** + * @return string[] + */ + public function getParamWhitelist() + { + return array( 'ids', 'term_statistics', 'field_statistics', @@ -55,24 +56,15 @@ public function getParamWhitelist(): array 'preference', 'routing', 'parent', - 'realtime', - 'version', - 'version_type' - ]; - } - - public function getMethod(): string - { - return isset($this->body) ? 'POST' : 'GET'; + 'realtime' + ); } - public function setBody($body): MTermVectors + /** + * @return string + */ + public function getMethod() { - if (isset($body) !== true) { - return $this; - } - $this->body = $body; - - return $this; + return 'POST'; } } diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Mget.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Mget.php index fefb3a7a0..2d7dd562c 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Mget.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Mget.php @@ -1,73 +1,93 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class Mget extends AbstractEndpoint { + /** + * @param array $body + * + * @throws \Elasticsearch\Common\Exceptions\InvalidArgumentException + * @return $this + */ + public function setBody($body) + { + if (isset($body) !== true) { + return $this; + } + + $this->body = $body; + + return $this; + } - public function getURI(): string + /** + * @return string + */ + public function getURI() { - $index = $this->index ?? null; - $type = $this->type ?? null; + $index = $this->index; + $type = $this->type; + $uri = "/_mget"; - if (isset($index) && isset($type)) { - return "/$index/$type/_mget"; + if (isset($index) === true && isset($type) === true) { + $uri = "/$index/$type/_mget"; + } elseif (isset($index) === true) { + $uri = "/$index/_mget"; + } elseif (isset($type) === true) { + $uri = "/_all/$type/_mget"; } - if (isset($index)) { - return "/$index/_mget"; - } - return "/_mget"; + + return $uri; } - public function getParamWhitelist(): array + /** + * @return string[] + */ + public function getParamWhitelist() { - return [ - 'stored_fields', + return array( + 'fields', 'preference', 'realtime', 'refresh', - 'routing', '_source', - '_source_excludes', - '_source_includes' - ]; + '_source_exclude', + '_source_include', + 'routing', + 'stored_fields' + ); } - public function getMethod(): string + /** + * @return array + * @throws \Elasticsearch\Common\Exceptions\RuntimeException + */ + public function getBody() { - return isset($this->body) ? 'POST' : 'GET'; + if (isset($this->body) !== true) { + throw new Exceptions\RuntimeException('Body is required for MGet'); + } + + return $this->body; } - public function setBody($body): Mget + /** + * @return string + */ + public function getMethod() { - if (isset($body) !== true) { - return $this; - } - $this->body = $body; - - return $this; + return 'POST'; } } diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Msearch.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Msearch.php index 7abe02b6c..13e515f0a 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Msearch.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Msearch.php @@ -1,91 +1,104 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ -class Msearch extends AbstractEndpoint implements BulkEndpointInterface +class Msearch extends AbstractEndpoint { - + /** + * @param SerializerInterface $serializer + */ public function __construct(SerializerInterface $serializer) { $this->serializer = $serializer; } - public function getURI(): string + /** + * @param array|string $body + * + * @throws \Elasticsearch\Common\Exceptions\InvalidArgumentException + * @return $this + */ + public function setBody($body) { - $index = $this->index ?? null; - $type = $this->type ?? null; + if (isset($body) !== true) { + return $this; + } - if (isset($index) && isset($type)) { - return "/$index/$type/_msearch"; + if (is_array($body) === true) { + $bulkBody = ""; + foreach ($body as $item) { + $bulkBody .= $this->serializer->serialize($item)."\n"; + } + $body = $bulkBody; } - if (isset($index)) { - return "/$index/_msearch"; + + $this->body = $body; + + return $this; + } + + /** + * @return string + */ + public function getURI() + { + $index = $this->index; + $type = $this->type; + $uri = "/_msearch"; + + if (isset($index) === true && isset($type) === true) { + $uri = "/$index/$type/_msearch"; + } elseif (isset($index) === true) { + $uri = "/$index/_msearch"; + } elseif (isset($type) === true) { + $uri = "/_all/$type/_msearch"; } - return "/_msearch"; + + return $uri; } - public function getParamWhitelist(): array + /** + * @return string[] + */ + public function getParamWhitelist() { - return [ + return array( 'search_type', - 'max_concurrent_searches', 'typed_keys', - 'pre_filter_shard_size', - 'max_concurrent_shard_requests', - 'rest_total_hits_as_int' - ]; + ); } - public function getMethod(): string - { - return isset($this->body) ? 'POST' : 'GET'; - } - - public function setBody($body): Msearch + /** + * @return array + * @throws \Elasticsearch\Common\Exceptions\RuntimeException + */ + public function getBody() { - if (isset($body) !== true) { - return $this; - } - if (is_array($body) === true || $body instanceof Traversable) { - foreach ($body as $item) { - $this->body .= $this->serializer->serialize($item) . "\n"; - } - } elseif (is_string($body)) { - $this->body = $body; - if (substr($body, -1) != "\n") { - $this->body .= "\n"; - } - } else { - throw new InvalidArgumentException("Body must be an array, traversable object or string"); + if (isset($this->body) !== true) { + throw new Exceptions\RuntimeException('Body is required for MSearch'); } - return $this; + + return $this->body; } + /** + * @return string + */ + public function getMethod() + { + return 'GET'; + } } diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/MsearchTemplate.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/MsearchTemplate.php index 88a5a8da7..43171741b 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/MsearchTemplate.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/MsearchTemplate.php @@ -1,89 +1,105 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ -class MsearchTemplate extends AbstractEndpoint implements BulkEndpointInterface +class MsearchTemplate extends AbstractEndpoint { - + /** + * @param SerializerInterface $serializer + */ public function __construct(SerializerInterface $serializer) { $this->serializer = $serializer; } - public function getURI(): string + /** + * @param array|string $body + * + * @throws \Elasticsearch\Common\Exceptions\InvalidArgumentException + * @return $this + */ + public function setBody($body) { - $index = $this->index ?? null; - $type = $this->type ?? null; + if (isset($body) !== true) { + return $this; + } - if (isset($index) && isset($type)) { - return "/$index/$type/_msearch/template"; + if (is_array($body) === true) { + $bulkBody = ""; + foreach ($body as $item) { + $bulkBody .= $this->serializer->serialize($item)."\n"; + } + $body = $bulkBody; } - if (isset($index)) { - return "/$index/_msearch/template"; + + $this->body = $body; + + return $this; + } + + /** + * @return string + */ + public function getURI() + { + $index = $this->index; + $type = $this->type; + $uri = "/_msearch/template"; + + if (isset($index) === true && isset($type) === true) { + $uri = "/$index/$type/_msearch/template"; + } elseif (isset($index) === true) { + $uri = "/$index/_msearch/template"; + } elseif (isset($type) === true) { + $uri = "/_all/$type/_msearch/template"; } - return "/_msearch/template"; + + return $uri; } - public function getParamWhitelist(): array + /** + * @return string[] + */ + public function getParamWhitelist() { - return [ + return array( 'search_type', 'typed_keys', - 'max_concurrent_searches', - 'rest_total_hits_as_int' - ]; + 'max_concurrent_searches' + ); } - public function getMethod(): string - { - return isset($this->body) ? 'POST' : 'GET'; - } - - public function setBody($body): MsearchTemplate + /** + * @return array + * @throws \Elasticsearch\Common\Exceptions\RuntimeException + */ + public function getBody() { - if (isset($body) !== true) { - return $this; - } - if (is_array($body) === true || $body instanceof Traversable) { - foreach ($body as $item) { - $this->body .= $this->serializer->serialize($item) . "\n"; - } - } elseif (is_string($body)) { - $this->body = $body; - if (substr($body, -1) != "\n") { - $this->body .= "\n"; - } - } else { - throw new InvalidArgumentException("Body must be an array, traversable object or string"); + if (isset($this->body) !== true) { + throw new Exceptions\RuntimeException('Body is required for MSearch'); } - return $this; + + return $this->body; } + /** + * @return string + */ + public function getMethod() + { + return 'GET'; + } } diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Percolate.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Percolate.php new file mode 100644 index 000000000..4418d7dc4 --- /dev/null +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Percolate.php @@ -0,0 +1,98 @@ + + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co + */ +class Percolate extends AbstractEndpoint +{ + /** + * @param array $body + * + * @throws \Elasticsearch\Common\Exceptions\InvalidArgumentException + * @return $this + */ + public function setBody($body) + { + if (isset($body) !== true) { + return $this; + } + + $this->body = $body; + + return $this; + } + + /** + * @throws \Elasticsearch\Common\Exceptions\RuntimeException + * @return string + */ + public function getURI() + { + if (isset($this->index) !== true) { + throw new Exceptions\RuntimeException( + 'index is required for Percolate' + ); + } + if (isset($this->type) !== true) { + throw new Exceptions\RuntimeException( + 'type is required for Percolate' + ); + } + $index = $this->index; + $type = $this->type; + $id = $this->id; + $uri = "/$index/$type/_percolate"; + + if (isset($id) === true) { + $uri = "/$index/$type/$id/_percolate"; + } + + return $uri; + } + + /** + * @return string[] + */ + public function getParamWhitelist() + { + return array( + 'routing', + 'preference', + 'ignore_unavailable', + 'allow_no_indices', + 'expand_wildcards', + 'percolate_index', + 'percolate_type', + 'version', + 'version_type', + 'percolate_format' + ); + } + + /** + * @return array + * @throws \Elasticsearch\Common\Exceptions\RuntimeException + */ + public function getBody() + { + return $this->body; + } + + /** + * @return string + */ + public function getMethod() + { + return 'GET'; + } +} diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Ping.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Ping.php index 0127c8d57..a11d90287 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Ping.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Ping.php @@ -1,47 +1,41 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class Ping extends AbstractEndpoint { - - public function getURI(): string + /** + * @return string + */ + public function getURI() { + $uri = "/"; - return "/"; + return $uri; } - public function getParamWhitelist(): array + /** + * @return string[] + */ + public function getParamWhitelist() { - return [ - - ]; + return array( + ); } - public function getMethod(): string + /** + * @return string + */ + public function getMethod() { return 'HEAD'; } diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Reindex.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Reindex.php index f35c9182d..532889beb 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Reindex.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Reindex.php @@ -1,61 +1,62 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class Reindex extends AbstractEndpoint { - public function getURI(): string - { - - return "/_reindex"; - } - - public function getParamWhitelist(): array + /** + * @return string[] + */ + public function getParamWhitelist() { - return [ + return array( + 'slices', 'refresh', 'timeout', - 'wait_for_active_shards', + 'consistency', 'wait_for_completion', 'requests_per_second', - 'slices' - ]; + ); + } + + /** + * @return string + */ + public function getURI() + { + return '/_reindex'; } - public function getMethod(): string + /** + * @return string + */ + public function getMethod() { return 'POST'; } - public function setBody($body): Reindex + /** + * @param array $body + * + * @throws \Elasticsearch\Common\Exceptions\InvalidArgumentException + * @return $this + */ + public function setBody($body) { if (isset($body) !== true) { return $this; } + $this->body = $body; return $this; diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Remote/Info.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Remote/Info.php new file mode 100644 index 000000000..154c2de28 --- /dev/null +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Remote/Info.php @@ -0,0 +1,41 @@ + + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co + */ +class Info extends AbstractEndpoint +{ + /** + * @return string + */ + public function getURI() + { + return "/_remote/info"; + } + + /** + * @return string[] + */ + public function getParamWhitelist() + { + return array(); + } + + /** + * @return string + */ + public function getMethod() + { + return 'GET'; + } +} diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/RenderSearchTemplate.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/RenderSearchTemplate.php index e40b26f6d..c31eb7238 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/RenderSearchTemplate.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/RenderSearchTemplate.php @@ -1,60 +1,77 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ + class RenderSearchTemplate extends AbstractEndpoint { + /** + * @param array $body + * + * @throws \Elasticsearch\Common\Exceptions\InvalidArgumentException + * @return $this + */ + public function setBody($body) + { + if (isset($body) !== true) { + return $this; + } + + $this->body = $body; + return $this; + } - public function getURI(): string + /** + * @throws \Elasticsearch\Common\Exceptions\RuntimeException + * @return string + */ + public function getURI() { - $id = $this->id ?? null; + $id = $this->id; + + $uri = "/_render/template"; - if (isset($id)) { - return "/_render/template/$id"; + if (isset($id) === true) { + $uri = "/_render/template/$id"; } - return "/_render/template"; + + return $uri; } - public function getParamWhitelist(): array + /** + * @return string[] + */ + public function getParamWhitelist() { - return []; + return array(); } - public function getMethod(): string + /** + * @return array + * @throws \Elasticsearch\Common\Exceptions\RuntimeException + */ + public function getBody() { - return isset($this->body) ? 'POST' : 'GET'; + return $this->body; } - public function setBody($body): RenderSearchTemplate + /** + * @return string + */ + public function getMethod() { - if (isset($body) !== true) { - return $this; - } - $this->body = $body; - - return $this; + return 'GET'; } } diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Script/Delete.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Script/Delete.php new file mode 100644 index 000000000..887c9f8b9 --- /dev/null +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Script/Delete.php @@ -0,0 +1,79 @@ + + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co + */ +class Delete extends AbstractEndpoint +{ + /** @var String */ + private $lang; + + /** + * @param $lang + * + * @return $this + */ + public function setLang($lang) + { + if (isset($lang) !== true) { + return $this; + } + + $this->lang = $lang; + + return $this; + } + + /** + * @throws \Elasticsearch\Common\Exceptions\RuntimeException + * @return string + */ + public function getURI() + { + if (isset($this->lang) !== true) { + throw new Exceptions\RuntimeException( + 'lang is required for Put' + ); + } + if (isset($this->id) !== true) { + throw new Exceptions\RuntimeException( + 'id is required for put' + ); + } + $id = $this->id; + $lang = $this->lang; + $uri = "/_scripts/$lang/$id"; + + return $uri; + } + + /** + * @return string[] + */ + public function getParamWhitelist() + { + return array( + 'version', + 'version_type' + ); + } + + /** + * @return string + */ + public function getMethod() + { + return 'DELETE'; + } +} diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Script/Get.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Script/Get.php new file mode 100644 index 000000000..78c01c8c5 --- /dev/null +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Script/Get.php @@ -0,0 +1,79 @@ + + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co + */ +class Get extends AbstractEndpoint +{ + /** @var String */ + private $lang; + + /** + * @param $lang + * + * @return $this + */ + public function setLang($lang) + { + if (isset($lang) !== true) { + return $this; + } + + $this->lang = $lang; + + return $this; + } + + /** + * @throws \Elasticsearch\Common\Exceptions\RuntimeException + * @return string + */ + public function getURI() + { + if (isset($this->lang) !== true) { + throw new Exceptions\RuntimeException( + 'lang is required for Put' + ); + } + if (isset($this->id) !== true) { + throw new Exceptions\RuntimeException( + 'id is required for put' + ); + } + $id = $this->id; + $lang = $this->lang; + $uri = "/_scripts/$lang/$id"; + + return $uri; + } + + /** + * @return string[] + */ + public function getParamWhitelist() + { + return array( + 'version_type', + 'version' + ); + } + + /** + * @return string + */ + public function getMethod() + { + return 'GET'; + } +} diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Script/Put.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Script/Put.php new file mode 100644 index 000000000..18037744e --- /dev/null +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Script/Put.php @@ -0,0 +1,71 @@ + + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co + */ +class Put extends AbstractEndpoint +{ + /** + * @param array $body + * + * @return $this + */ + public function setBody($body) + { + if (isset($body) !== true) { + return $this; + } + + $this->body = $body; + + return $this; + } + + /** + * @throws \Elasticsearch\Common\Exceptions\RuntimeException + * @return string + */ + public function getURI() + { + if (isset($this->id) !== true) { + throw new Exceptions\RuntimeException( + 'id is required for put' + ); + } + $id = $this->id; + $uri = "/_scripts/$id"; + + return $uri; + } + + /** + * @return string[] + */ + public function getParamWhitelist() + { + return array( + 'version_type', + 'version', + 'op_type' + ); + } + + /** + * @return string + */ + public function getMethod() + { + return 'PUT'; + } +} diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Scroll.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Scroll.php index 0a13ad724..eb46fe31e 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Scroll.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Scroll.php @@ -1,75 +1,102 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class Scroll extends AbstractEndpoint { - protected $scroll_id; - public function getURI(): string + /** + * @param array $body + * + * @throws \Elasticsearch\Common\Exceptions\InvalidArgumentException + * @return $this + */ + public function setBody($body) { - $scroll_id = $this->scroll_id ?? null; - - if (isset($scroll_id)) { - return "/_search/scroll/$scroll_id"; + if (isset($body) !== true) { + return $this; } - return "/_search/scroll"; - } - public function getParamWhitelist(): array - { - return [ - 'scroll', - 'scroll_id', - 'rest_total_hits_as_int' - ]; + $this->body = $body; + + return $this; } - public function getMethod(): string + /** + * @return array + */ + public function getBody() { - return isset($this->body) ? 'POST' : 'GET'; + return $this->body; } - public function setBody($body): Scroll + /** + * @param $scroll + * + * @return $this + */ + public function setScroll($scroll) { - if (isset($body) !== true) { + if (isset($scroll) !== true) { return $this; } - $this->body = $body; + + $this->body['scroll'] = $scroll; return $this; } - public function setScrollId($scroll_id): Scroll + /** + * @param $scroll_id + * + * @return $this + */ + public function setScrollId($scroll_id) { if (isset($scroll_id) !== true) { return $this; } - $this->scroll_id = $scroll_id; + + $this->body['scroll_id'] = $scroll_id; return $this; } + + /** + * @return string + */ + public function getURI() + { + $uri = "/_search/scroll"; + return $uri; + } + + /** + * @return string[] + */ + public function getParamWhitelist() + { + return array( + 'scroll', + ); + } + + /** + * @return string + */ + public function getMethod() + { + return 'GET'; + } } diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Search.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Search.php index 0b05eb2a3..c8f9c7c0a 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Search.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Search.php @@ -1,106 +1,113 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class Search extends AbstractEndpoint { + /** + * @param array $body + * + * @throws \Elasticsearch\Common\Exceptions\InvalidArgumentException + * @return $this + */ + public function setBody($body) + { + if (isset($body) !== true) { + return $this; + } + + $this->body = $body; - public function getURI(): string + return $this; + } + + /** + * @return string + */ + public function getURI() { - $index = $this->index ?? null; - $type = $this->type ?? null; + $index = $this->index; + $type = $this->type; + $uri = "/_search"; - if (isset($index) && isset($type)) { - return "/$index/$type/_search"; - } - if (isset($index)) { - return "/$index/_search"; + if (isset($index) === true && isset($type) === true) { + $uri = "/$index/$type/_search"; + } elseif (isset($index) === true) { + $uri = "/$index/_search"; + } elseif (isset($type) === true) { + $uri = "/_all/$type/_search"; } - return "/_search"; + + return $uri; } - public function getParamWhitelist(): array + /** + * @return string[] + */ + public function getParamWhitelist() { - return [ + return array( 'analyzer', 'analyze_wildcard', 'default_operator', 'df', 'explain', - 'stored_fields', - 'docvalue_fields', 'from', 'ignore_unavailable', - 'ignore_throttled', 'allow_no_indices', 'expand_wildcards', + 'indices_boost', 'lenient', + 'lowercase_expanded_terms', 'preference', 'q', + 'query_cache', + 'request_cache', 'routing', 'scroll', 'search_type', 'size', + 'slice', 'sort', + 'source', '_source', - '_source_excludes', - '_source_includes', - 'terminate_after', + '_source_exclude', + '_source_include', 'stats', 'suggest_field', 'suggest_mode', 'suggest_size', 'suggest_text', 'timeout', - 'track_scores', - 'track_total_hits', - 'allow_partial_search_results', - 'typed_keys', 'version', - 'seq_no_primary_term', - 'request_cache', + 'fielddata_fields', + 'docvalue_fields', + 'filter_path', + 'terminate_after', + 'stored_fields', 'batched_reduce_size', - 'max_concurrent_shard_requests', - 'pre_filter_shard_size', - 'rest_total_hits_as_int' - ]; - } - - public function getMethod(): string - { - return isset($this->body) ? 'POST' : 'GET'; + 'typed_keys', + 'pre_filter_shard_size' + ); } - public function setBody($body): Search + /** + * @return string + */ + public function getMethod() { - if (isset($body) !== true) { - return $this; - } - $this->body = $body; - - return $this; + return 'GET'; } } diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/SearchShards.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/SearchShards.php index e43de122a..85c564adb 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/SearchShards.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/SearchShards.php @@ -1,56 +1,57 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class SearchShards extends AbstractEndpoint { - - public function getURI(): string + /** + * @return string + */ + public function getURI() { - $index = $this->index ?? null; + $index = $this->index; + $type = $this->type; + $uri = "/_search_shards"; - if (isset($index)) { - return "/$index/_search_shards"; + if (isset($index) === true && isset($type) === true) { + $uri = "/$index/$type/_search_shards"; + } elseif (isset($index) === true) { + $uri = "/$index/_search_shards"; + } elseif (isset($type) === true) { + $uri = "/_all/$type/_search_shards"; } - return "/_search_shards"; + + return $uri; } - public function getParamWhitelist(): array + /** + * @return string[] + */ + public function getParamWhitelist() { - return [ + return array( 'preference', 'routing', 'local', 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards' - ]; + ); } - public function getMethod(): string + /** + * @return string + */ + public function getMethod() { return 'GET'; } diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/SearchTemplate.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/SearchTemplate.php index 8c516b11a..7b5c83048 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/SearchTemplate.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/SearchTemplate.php @@ -1,77 +1,79 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class SearchTemplate extends AbstractEndpoint { + /** + * @param array $body + * + * @throws \Elasticsearch\Common\Exceptions\InvalidArgumentException + * @return $this + */ + public function setBody($body) + { + if (isset($body) !== true) { + return $this; + } + + $this->body = $body; + + return $this; + } - public function getURI(): string + /** + * @return string + */ + public function getURI() { - $index = $this->index ?? null; - $type = $this->type ?? null; + $index = $this->index; + $type = $this->type; + $uri = "/_search/template"; - if (isset($index) && isset($type)) { - return "/$index/$type/_search/template"; + if (isset($index) === true && isset($type) === true) { + $uri = "/$index/$type/_search/template"; + } elseif (isset($index) === true) { + $uri = "/$index/_search/template"; + } elseif (isset($type) === true) { + $uri = "/_all/$type/_search/template"; } - if (isset($index)) { - return "/$index/_search/template"; - } - return "/_search/template"; + + return $uri; } - public function getParamWhitelist(): array + /** + * @return string[] + */ + public function getParamWhitelist() { - return [ + return array( 'ignore_unavailable', - 'ignore_throttled', 'allow_no_indices', 'expand_wildcards', 'preference', 'routing', 'scroll', - 'search_type', - 'explain', - 'profile', - 'typed_keys', - 'rest_total_hits_as_int' - ]; - } - - public function getMethod(): string - { - return isset($this->body) ? 'POST' : 'GET'; + 'search_type' + ); } - public function setBody($body): SearchTemplate + /** + * @return string + */ + public function getMethod() { - if (isset($body) !== true) { - return $this; - } - $this->body = $body; - - return $this; + return 'GET'; } } diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Snapshot/Create.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Snapshot/Create.php index 94e7e2ca8..a00a1cead 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Snapshot/Create.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Snapshot/Create.php @@ -1,94 +1,119 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class Create extends AbstractEndpoint { - protected $repository; - protected $snapshot; - - public function getURI(): string - { - if (isset($this->repository) !== true) { - throw new RuntimeException( - 'repository is required for Create' - ); - } - $repository = $this->repository; - if (isset($this->snapshot) !== true) { - throw new RuntimeException( - 'snapshot is required for Create' - ); - } - $snapshot = $this->snapshot; - - return "/_snapshot/$repository/$snapshot"; - } + // A repository name + private $repository; - public function getParamWhitelist(): array - { - return [ - 'master_timeout', - 'wait_for_completion' - ]; - } + // A snapshot name + private $snapshot; - public function getMethod(): string - { - return 'PUT'; - } - - public function setBody($body): Create + /** + * @param array $body + * + * @throws \Elasticsearch\Common\Exceptions\InvalidArgumentException + * @return $this + */ + public function setBody($body) { if (isset($body) !== true) { return $this; } + $this->body = $body; return $this; } - public function setRepository($repository): Create + /** + * @param $repository + * + * @return $this + */ + public function setRepository($repository) { if (isset($repository) !== true) { return $this; } + $this->repository = $repository; return $this; } - public function setSnapshot($snapshot): Create + /** + * @param $snapshot + * + * @return $this + */ + public function setSnapshot($snapshot) { if (isset($snapshot) !== true) { return $this; } + $this->snapshot = $snapshot; return $this; } + + /** + * @throws \Elasticsearch\Common\Exceptions\RuntimeException + * @return string + */ + public function getURI() + { + if (isset($this->repository) !== true) { + throw new Exceptions\RuntimeException( + 'repository is required for Create' + ); + } + if (isset($this->snapshot) !== true) { + throw new Exceptions\RuntimeException( + 'snapshot is required for Create' + ); + } + $repository = $this->repository; + $snapshot = $this->snapshot; + $uri = "/_snapshot/$repository/$snapshot"; + + if (isset($repository) === true && isset($snapshot) === true) { + $uri = "/_snapshot/$repository/$snapshot"; + } + + return $uri; + } + + /** + * @return string[] + */ + public function getParamWhitelist() + { + return array( + 'master_timeout', + 'wait_for_completion', + ); + } + + /** + * @return string + */ + public function getMethod() + { + return 'PUT'; + } } diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Snapshot/Delete.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Snapshot/Delete.php index 6044e8f23..ca28cfc10 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Snapshot/Delete.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Snapshot/Delete.php @@ -1,83 +1,101 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class Delete extends AbstractEndpoint { - protected $repository; - protected $snapshot; + // A repository name + private $repository; + + // A snapshot name + private $snapshot; + + /** + * @param $repository + * + * @return $this + */ + public function setRepository($repository) + { + if (isset($repository) !== true) { + return $this; + } + + $this->repository = $repository; + + return $this; + } + + /** + * @param $snapshot + * + * @return $this + */ + public function setSnapshot($snapshot) + { + if (isset($snapshot) !== true) { + return $this; + } + + $this->snapshot = $snapshot; + + return $this; + } - public function getURI(): string + /** + * @throws \Elasticsearch\Common\Exceptions\RuntimeException + * @return string + */ + public function getURI() { if (isset($this->repository) !== true) { - throw new RuntimeException( + throw new Exceptions\RuntimeException( 'repository is required for Delete' ); } - $repository = $this->repository; if (isset($this->snapshot) !== true) { - throw new RuntimeException( + throw new Exceptions\RuntimeException( 'snapshot is required for Delete' ); } + $repository = $this->repository; $snapshot = $this->snapshot; + $uri = "/_snapshot/$repository/$snapshot"; - return "/_snapshot/$repository/$snapshot"; - } + if (isset($repository) === true && isset($snapshot) === true) { + $uri = "/_snapshot/$repository/$snapshot"; + } - public function getParamWhitelist(): array - { - return [ - 'master_timeout' - ]; + return $uri; } - public function getMethod(): string + /** + * @return string[] + */ + public function getParamWhitelist() { - return 'DELETE'; + return array( + 'master_timeout', + ); } - public function setRepository($repository): Delete + /** + * @return string + */ + public function getMethod() { - if (isset($repository) !== true) { - return $this; - } - $this->repository = $repository; - - return $this; - } - - public function setSnapshot($snapshot): Delete - { - if (isset($snapshot) !== true) { - return $this; - } - $this->snapshot = $snapshot; - - return $this; + return 'DELETE'; } } diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Snapshot/Get.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Snapshot/Get.php index 8f19ae664..44d171f23 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Snapshot/Get.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Snapshot/Get.php @@ -1,88 +1,103 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class Get extends AbstractEndpoint { - protected $repository; - protected $snapshot; + // A comma-separated list of repository names + private $repository; + + // A comma-separated list of snapshot names + private $snapshot; + + /** + * @param $repository + * + * @return $this + */ + public function setRepository($repository) + { + if (isset($repository) !== true) { + return $this; + } + + $this->repository = $repository; + + return $this; + } + + /** + * @param $snapshot + * + * @return $this + */ + public function setSnapshot($snapshot) + { + if (isset($snapshot) !== true) { + return $this; + } + + $this->snapshot = $snapshot; + + return $this; + } - public function getURI(): string + /** + * @throws \Elasticsearch\Common\Exceptions\RuntimeException + * @return string + */ + public function getURI() { if (isset($this->repository) !== true) { - throw new RuntimeException( + throw new Exceptions\RuntimeException( 'repository is required for Get' ); } - $repository = $this->repository; if (isset($this->snapshot) !== true) { - throw new RuntimeException( + throw new Exceptions\RuntimeException( 'snapshot is required for Get' ); } + $repository = $this->repository; $snapshot = $this->snapshot; + $uri = "/_snapshot/$repository/$snapshot"; + + if (isset($repository) === true && isset($snapshot) === true) { + $uri = "/_snapshot/$repository/$snapshot"; + } - return "/_snapshot/$repository/$snapshot"; + return $uri; } - public function getParamWhitelist(): array + /** + * @return string[] + */ + public function getParamWhitelist() { - return [ + return array( 'master_timeout', 'ignore_unavailable', 'verbose' - ]; + ); } - public function getMethod(): string + /** + * @return string + */ + public function getMethod() { return 'GET'; } - - public function setRepository($repository): Get - { - if (isset($repository) !== true) { - return $this; - } - $this->repository = $repository; - - return $this; - } - - public function setSnapshot($snapshot): Get - { - if (isset($snapshot) !== true) { - return $this; - } - if (is_array($snapshot) === true) { - $snapshot = implode(",", $snapshot); - } - $this->snapshot = $snapshot; - - return $this; - } } diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Snapshot/Repository/Create.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Snapshot/Repository/Create.php new file mode 100644 index 000000000..cfdc6306c --- /dev/null +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Snapshot/Repository/Create.php @@ -0,0 +1,108 @@ + + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co + */ +class Create extends AbstractEndpoint +{ + // A repository name + private $repository; + + /** + * @param array $body + * + * @throws \Elasticsearch\Common\Exceptions\InvalidArgumentException + * @return $this + */ + public function setBody($body) + { + if (isset($body) !== true) { + return $this; + } + + $this->body = $body; + + return $this; + } + + /** + * @param $repository + * + * @return $this + */ + public function setRepository($repository) + { + if (isset($repository) !== true) { + return $this; + } + + $this->repository = $repository; + + return $this; + } + + /** + * @throws \Elasticsearch\Common\Exceptions\RuntimeException + * @return string + */ + public function getURI() + { + if (isset($this->repository) !== true) { + throw new Exceptions\RuntimeException( + 'repository is required for Create' + ); + } + $repository = $this->repository; + $uri = "/_snapshot/$repository"; + + if (isset($repository) === true) { + $uri = "/_snapshot/$repository"; + } + + return $uri; + } + + /** + * @return string[] + */ + public function getParamWhitelist() + { + return array( + 'master_timeout', + 'timeout', + 'verify' + ); + } + + /** + * @return array + * @throws \Elasticsearch\Common\Exceptions\RuntimeException + */ + public function getBody() + { + if (isset($this->body) !== true) { + throw new Exceptions\RuntimeException('Body is required for Create Repository'); + } + + return $this->body; + } + + /** + * @return string + */ + public function getMethod() + { + return 'PUT'; + } +} diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Snapshot/Repository/Delete.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Snapshot/Repository/Delete.php new file mode 100644 index 000000000..4e0109f96 --- /dev/null +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Snapshot/Repository/Delete.php @@ -0,0 +1,77 @@ + + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co + */ +class Delete extends AbstractEndpoint +{ + // A comma-separated list of repository names + private $repository; + + /** + * @param $repository + * + * @return $this + */ + public function setRepository($repository) + { + if (isset($repository) !== true) { + return $this; + } + + $this->repository = $repository; + + return $this; + } + + /** + * @throws \Elasticsearch\Common\Exceptions\RuntimeException + * @return string + */ + public function getURI() + { + if (isset($this->repository) !== true) { + throw new Exceptions\RuntimeException( + 'repository is required for Delete' + ); + } + $repository = $this->repository; + $uri = "/_snapshot/$repository"; + + if (isset($repository) === true) { + $uri = "/_snapshot/$repository"; + } + + return $uri; + } + + /** + * @return string[] + */ + public function getParamWhitelist() + { + return array( + 'master_timeout', + 'timeout', + ); + } + + /** + * @return string + */ + public function getMethod() + { + return 'DELETE'; + } +} diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Snapshot/Repository/Get.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Snapshot/Repository/Get.php new file mode 100644 index 000000000..57af42b36 --- /dev/null +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Snapshot/Repository/Get.php @@ -0,0 +1,70 @@ + + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co + */ +class Get extends AbstractEndpoint +{ + // A comma-separated list of repository names + private $repository; + + /** + * @param $repository + * + * @return $this + */ + public function setRepository($repository) + { + if (isset($repository) !== true) { + return $this; + } + + $this->repository = $repository; + + return $this; + } + + /** + * @return string + */ + public function getURI() + { + $repository = $this->repository; + $uri = "/_snapshot"; + + if (isset($repository) === true) { + $uri = "/_snapshot/$repository"; + } + + return $uri; + } + + /** + * @return string[] + */ + public function getParamWhitelist() + { + return array( + 'master_timeout', + 'local', + ); + } + + /** + * @return string + */ + public function getMethod() + { + return 'GET'; + } +} diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Snapshot/Repository/Verify.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Snapshot/Repository/Verify.php new file mode 100644 index 000000000..ebd8fa3ee --- /dev/null +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Snapshot/Repository/Verify.php @@ -0,0 +1,74 @@ + + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co + */ +class Verify extends AbstractEndpoint +{ + // A comma-separated list of repository names + private $repository; + + /** + * @param $repository + * + * @return $this + */ + public function setRepository($repository) + { + if (isset($repository) !== true) { + return $this; + } + + $this->repository = $repository; + + return $this; + } + + /** + * @throws \Elasticsearch\Common\Exceptions\RuntimeException + * @return string + */ + public function getURI() + { + $repository = $this->repository; + if (isset($this->repository) !== true) { + throw new Exceptions\RuntimeException( + 'repository is required for Verify' + ); + } + + $uri = "/_snapshot/$repository/_verify"; + + return $uri; + } + + /** + * @return string[] + */ + public function getParamWhitelist() + { + return array( + 'master_timeout', + 'local', + ); + } + + /** + * @return string + */ + public function getMethod() + { + return 'POST'; + } +} diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Snapshot/Restore.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Snapshot/Restore.php index 78808b6f8..193d2031e 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Snapshot/Restore.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Snapshot/Restore.php @@ -1,94 +1,119 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class Restore extends AbstractEndpoint { - protected $repository; - protected $snapshot; - - public function getURI(): string - { - if (isset($this->repository) !== true) { - throw new RuntimeException( - 'repository is required for Restore' - ); - } - $repository = $this->repository; - if (isset($this->snapshot) !== true) { - throw new RuntimeException( - 'snapshot is required for Restore' - ); - } - $snapshot = $this->snapshot; - - return "/_snapshot/$repository/$snapshot/_restore"; - } + // A repository name + private $repository; - public function getParamWhitelist(): array - { - return [ - 'master_timeout', - 'wait_for_completion' - ]; - } + // A snapshot name + private $snapshot; - public function getMethod(): string - { - return 'POST'; - } - - public function setBody($body): Restore + /** + * @param array $body + * + * @throws \Elasticsearch\Common\Exceptions\InvalidArgumentException + * @return $this + */ + public function setBody($body) { if (isset($body) !== true) { return $this; } + $this->body = $body; return $this; } - public function setRepository($repository): Restore + /** + * @param $repository + * + * @return $this + */ + public function setRepository($repository) { if (isset($repository) !== true) { return $this; } + $this->repository = $repository; return $this; } - public function setSnapshot($snapshot): Restore + /** + * @param $snapshot + * + * @return $this + */ + public function setSnapshot($snapshot) { if (isset($snapshot) !== true) { return $this; } + $this->snapshot = $snapshot; return $this; } + + /** + * @throws \Elasticsearch\Common\Exceptions\RuntimeException + * @return string + */ + public function getURI() + { + if (isset($this->repository) !== true) { + throw new Exceptions\RuntimeException( + 'repository is required for Restore' + ); + } + if (isset($this->snapshot) !== true) { + throw new Exceptions\RuntimeException( + 'snapshot is required for Restore' + ); + } + $repository = $this->repository; + $snapshot = $this->snapshot; + $uri = "/_snapshot/$repository/$snapshot/_restore"; + + if (isset($repository) === true && isset($snapshot) === true) { + $uri = "/_snapshot/$repository/$snapshot/_restore"; + } + + return $uri; + } + + /** + * @return string[] + */ + public function getParamWhitelist() + { + return array( + 'master_timeout', + 'wait_for_completion', + ); + } + + /** + * @return string + */ + public function getMethod() + { + return 'POST'; + } } diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Snapshot/Status.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Snapshot/Status.php index 96ed3499b..b8e6aba83 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Snapshot/Status.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Snapshot/Status.php @@ -1,87 +1,100 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class Status extends AbstractEndpoint { - protected $repository; - protected $snapshot; - - public function getURI(): string - { - if (isset($this->snapshot) === true && isset($this->repository) !== true) { - throw new \Elasticsearch\Common\Exceptions\RuntimeException( - 'Repository param must be provided if snapshot param is set' - ); - } - $repository = $this->repository ?? null; - $snapshot = $this->snapshot ?? null; - - if (isset($repository) && isset($snapshot)) { - return "/_snapshot/$repository/$snapshot/_status"; - } - if (isset($repository)) { - return "/_snapshot/$repository/_status"; - } - return "/_snapshot/_status"; - } + // A comma-separated list of repository names + private $repository; - public function getParamWhitelist(): array - { - return [ - 'master_timeout', - 'ignore_unavailable' - ]; - } + // A comma-separated list of snapshot names + private $snapshot; - public function getMethod(): string - { - return 'GET'; - } - - public function setRepository($repository): Status + /** + * @param $repository + * + * @return $this + */ + public function setRepository($repository) { if (isset($repository) !== true) { return $this; } + $this->repository = $repository; return $this; } - public function setSnapshot($snapshot): Status + /** + * @param $snapshot + * + * @return $this + */ + public function setSnapshot($snapshot) { if (isset($snapshot) !== true) { return $this; } - if (is_array($snapshot) === true) { - $snapshot = implode(",", $snapshot); - } + $this->snapshot = $snapshot; return $this; } + + /** + * @throws \Elasticsearch\Common\Exceptions\RuntimeException + * @return string + */ + public function getURI() + { + if (isset($this->snapshot) === true && isset($this->repository) !== true) { + throw new Exceptions\RuntimeException( + 'Repository param must be provided if snapshot param is set' + ); + } + + $repository = $this->repository; + $snapshot = $this->snapshot; + $uri = "/_snapshot/_status"; + + if (isset($repository) === true) { + $uri = "/_snapshot/$repository/_status"; + } elseif (isset($repository) === true && isset($snapshot) === true) { + $uri = "/_snapshot/$repository/$snapshot/_status"; + } + + return $uri; + } + + /** + * @return string[] + */ + public function getParamWhitelist() + { + return array( + 'master_timeout', + 'ignore_unavailable' + ); + } + + /** + * @return string + */ + public function getMethod() + { + return 'GET'; + } } diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Source/Get.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Source/Get.php new file mode 100644 index 000000000..0e8ac26b5 --- /dev/null +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Source/Get.php @@ -0,0 +1,78 @@ + + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co + */ +class Get extends AbstractEndpoint +{ + /** + * @throws \Elasticsearch\Common\Exceptions\RuntimeException + * @return string + */ + public function getURI() + { + if (isset($this->id) !== true) { + throw new Exceptions\RuntimeException( + 'id is required for Get' + ); + } + if (isset($this->index) !== true) { + throw new Exceptions\RuntimeException( + 'index is required for Get' + ); + } + if (isset($this->type) !== true) { + throw new Exceptions\RuntimeException( + 'type is required for Get' + ); + } + $id = $this->id; + $index = $this->index; + $type = $this->type; + $uri = "/$index/$type/$id/_source"; + + if (isset($index) === true && isset($type) === true && isset($id) === true) { + $uri = "/$index/$type/$id/_source"; + } + + return $uri; + } + + /** + * @return string[] + */ + public function getParamWhitelist() + { + return array( + 'parent', + 'preference', + 'realtime', + 'refresh', + 'routing', + '_source', + '_source_exclude', + '_source_include', + 'version', + 'version_type', + ); + } + + /** + * @return string + */ + public function getMethod() + { + return 'GET'; + } +} diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Suggest.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Suggest.php new file mode 100644 index 000000000..1afb1f274 --- /dev/null +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Suggest.php @@ -0,0 +1,85 @@ + + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co + */ +class Suggest extends AbstractEndpoint +{ + /** + * @param array $body + * + * @throws \Elasticsearch\Common\Exceptions\InvalidArgumentException + * @return $this + */ + public function setBody($body) + { + if (isset($body) !== true) { + return $this; + } + + $this->body = $body; + + return $this; + } + + /** + * @return string + */ + public function getURI() + { + $index = $this->index; + $uri = "/_suggest"; + + if (isset($index) === true) { + $uri = "/$index/_suggest"; + } + + return $uri; + } + + /** + * @return string[] + */ + public function getParamWhitelist() + { + return array( + 'ignore_unavailable', + 'allow_no_indices', + 'expand_wildcards', + 'preference', + 'routing', + 'source', + ); + } + + /** + * @return array + * @throws \Elasticsearch\Common\Exceptions\RuntimeException + */ + public function getBody() + { + if (isset($this->body) !== true) { + throw new Exceptions\RuntimeException('Body is required for Suggest'); + } + + return $this->body; + } + + /** + * @return string + */ + public function getMethod() + { + return 'POST'; + } +} diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Tasks/Cancel.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Tasks/Cancel.php index ff92e992f..ff2405b2d 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Tasks/Cancel.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Tasks/Cancel.php @@ -1,65 +1,71 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class Cancel extends AbstractEndpoint { - protected $task_id; + private $taskId; - public function getURI(): string + /** + * @param string $taskId + * + * @throws \Elasticsearch\Common\Exceptions\InvalidArgumentException + * @return $this + */ + public function setTaskId($taskId) { - $task_id = $this->task_id ?? null; + if (isset($taskId) !== true) { + return $this; + } + + $this->taskId = $taskId; + + return $this; + } - if (isset($task_id)) { - return "/_tasks/$task_id/_cancel"; + /** + * @throws \Elasticsearch\Common\Exceptions\RuntimeException + * @return string + */ + public function getURI() + { + if (isset($this->id) === true) { + return "/_tasks/{$this->taskId}/_cancel"; } + return "/_tasks/_cancel"; } - public function getParamWhitelist(): array + /** + * @return string[] + */ + public function getParamWhitelist() { - return [ - 'nodes', + return array( + 'node_id', 'actions', - 'parent_task_id' - ]; + 'parent_node', + 'parent_task', + ); } - public function getMethod(): string + /** + * @return string + */ + public function getMethod() { return 'POST'; } - - public function setTaskId($task_id): Cancel - { - if (isset($task_id) !== true) { - return $this; - } - $this->task_id = $task_id; - - return $this; - } } diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Tasks/Get.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Tasks/Get.php index c71866a95..4e7318d06 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Tasks/Get.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Tasks/Get.php @@ -1,67 +1,68 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class Get extends AbstractEndpoint { - protected $task_id; + private $taskId; - public function getURI(): string + /** + * @param string $taskId + * + * @throws \Elasticsearch\Common\Exceptions\InvalidArgumentException + * @return $this + */ + public function setTaskId($taskId) { - if (isset($this->task_id) !== true) { - throw new RuntimeException( - 'task_id is required for Get' - ); + if (isset($taskId) !== true) { + return $this; } - $task_id = $this->task_id; - return "/_tasks/$task_id"; + $this->taskId = $taskId; + + return $this; } - public function getParamWhitelist(): array + /** + * @throws \Elasticsearch\Common\Exceptions\RuntimeException + * @return string + */ + public function getURI() { - return [ - 'wait_for_completion', - 'timeout' - ]; + if (isset($this->taskId) === true) { + return "/_tasks/{$this->taskId}"; + } + + return "/_tasks"; } - public function getMethod(): string + /** + * @return string[] + */ + public function getParamWhitelist() { - return 'GET'; + return array( + 'wait_for_completion' + ); } - public function setTaskId($task_id): Get + /** + * @return string + */ + public function getMethod() { - if (isset($task_id) !== true) { - return $this; - } - $this->task_id = $task_id; - - return $this; + return 'GET'; } } diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Tasks/TasksList.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Tasks/TasksList.php new file mode 100644 index 000000000..b45f20628 --- /dev/null +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Tasks/TasksList.php @@ -0,0 +1,53 @@ + + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co + */ +class TasksList extends AbstractEndpoint +{ + + /** + * @throws \Elasticsearch\Common\Exceptions\RuntimeException + * @return string + */ + public function getURI() + { + return "/_tasks"; + } + + /** + * @return string[] + */ + public function getParamWhitelist() + { + return array( + 'node_id', + 'actions', + 'detailed', + 'parent_node', + 'parent_task', + 'wait_for_completion', + 'group_by', + 'task_id' + ); + } + + /** + * @return string + */ + public function getMethod() + { + return 'GET'; + } +} diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Template/Delete.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Template/Delete.php new file mode 100644 index 000000000..b3593ba27 --- /dev/null +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Template/Delete.php @@ -0,0 +1,51 @@ + + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co + */ +class Delete extends AbstractEndpoint +{ + /** + * @throws \Elasticsearch\Common\Exceptions\RuntimeException + * @return string + */ + public function getURI() + { + if (isset($this->id) !== true) { + throw new Exceptions\RuntimeException( + 'id is required for Delete' + ); + } + $templateId = $this->id; + $uri = "/_search/template/$templateId"; + + return $uri; + } + + /** + * @return string[] + */ + public function getParamWhitelist() + { + return array(); + } + + /** + * @return string + */ + public function getMethod() + { + return 'DELETE'; + } +} diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Template/Get.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Template/Get.php new file mode 100644 index 000000000..954ecdda1 --- /dev/null +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Template/Get.php @@ -0,0 +1,51 @@ + + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co + */ +class Get extends AbstractEndpoint +{ + /** + * @throws \Elasticsearch\Common\Exceptions\RuntimeException + * @return string + */ + public function getURI() + { + if (isset($this->id) !== true) { + throw new Exceptions\RuntimeException( + 'id is required for Get' + ); + } + $templateId = $this->id; + $uri = "/_search/template/$templateId"; + + return $uri; + } + + /** + * @return string[] + */ + public function getParamWhitelist() + { + return array(); + } + + /** + * @return string + */ + public function getMethod() + { + return 'GET'; + } +} diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/TermVectors.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/TermVectors.php index cc65890b1..20077b121 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/TermVectors.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/TermVectors.php @@ -1,59 +1,77 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class TermVectors extends AbstractEndpoint { + /** + * @param array $body + * + * @throws \Elasticsearch\Common\Exceptions\InvalidArgumentException + * @return $this + */ + public function setBody($body) + { + if (isset($body) !== true) { + return $this; + } - public function getURI(): string + $this->body = $body; + + return $this; + } + + /** + * @throws \Elasticsearch\Common\Exceptions\RuntimeException + * @return string + */ + public function getURI() { if (isset($this->index) !== true) { - throw new RuntimeException( - 'index is required for Termvectors' + throw new Exceptions\RuntimeException( + 'index is required for TermVectors' ); } - $index = $this->index; if (isset($this->type) !== true) { - throw new RuntimeException( - 'type is required for Termvectors' + throw new Exceptions\RuntimeException( + 'type is required for TermVectors' ); } - $type = $this->type; - $id = $this->id ?? null; + if (isset($this->id) !== true && isset($this->body['doc']) !== true) { + throw new Exceptions\RuntimeException( + 'id or doc is required for TermVectors' + ); + } + + $index = $this->index; + $type = $this->type; + $id = $this->id; + $uri = "/$index/$type/_termvectors"; - if (isset($id)) { - return "/$index/$type/$id/_termvectors"; + if ($id !== null) { + $uri = "/$index/$type/$id/_termvectors"; } - return "/$index/$type/_termvectors"; + + return $uri; } - public function getParamWhitelist(): array + /** + * @return string[] + */ + public function getParamWhitelist() { - return [ + return array( 'term_statistics', 'field_statistics', 'fields', @@ -63,24 +81,15 @@ public function getParamWhitelist(): array 'preference', 'routing', 'parent', - 'realtime', - 'version', - 'version_type' - ]; - } - - public function getMethod(): string - { - return isset($this->body) ? 'POST' : 'GET'; + 'realtime' + ); } - public function setBody($body): TermVectors + /** + * @return string + */ + public function getMethod() { - if (isset($body) !== true) { - return $this; - } - $this->body = $body; - - return $this; + return 'POST'; } } diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Update.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Update.php index 28cc1b170..9627feead 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Update.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/Update.php @@ -1,91 +1,99 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class Update extends AbstractEndpoint { + /** + * @param array $body + * + * @throws \Elasticsearch\Common\Exceptions\InvalidArgumentException + * @return $this + */ + public function setBody($body) + { + if (isset($body) !== true) { + return $this; + } - public function getURI(): string + $this->body = $body; + + return $this; + } + + /** + * @throws \Elasticsearch\Common\Exceptions\RuntimeException + * @return string + */ + public function getURI() { if (isset($this->id) !== true) { - throw new RuntimeException( + throw new Exceptions\RuntimeException( 'id is required for Update' ); } - $id = $this->id; if (isset($this->index) !== true) { - throw new RuntimeException( + throw new Exceptions\RuntimeException( 'index is required for Update' ); } - $index = $this->index; if (isset($this->type) !== true) { - throw new RuntimeException( + throw new Exceptions\RuntimeException( 'type is required for Update' ); } + $id = $this->id; + $index = $this->index; $type = $this->type; + $uri = "/$index/$type/$id/_update"; + + if (isset($index) === true && isset($type) === true && isset($id) === true) { + $uri = "/$index/$type/$id/_update"; + } - return "/$index/$type/$id/_update"; + return $uri; } - public function getParamWhitelist(): array + /** + * @return string[] + */ + public function getParamWhitelist() { - return [ - 'wait_for_active_shards', + return array( + 'consistency', 'fields', - '_source', - '_source_excludes', - '_source_includes', 'lang', 'parent', 'refresh', + 'replication', 'retry_on_conflict', 'routing', + 'script', 'timeout', - 'if_seq_no', - 'if_primary_term', + 'timestamp', + 'ttl', 'version', - 'version_type' - ]; + 'version_type', + '_source' + ); } - public function getMethod(): string + /** + * @return string + */ + public function getMethod() { return 'POST'; } - - public function setBody($body): Update - { - if (isset($body) !== true) { - return $this; - } - $this->body = $body; - - return $this; - } } diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/UpdateByQuery.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/UpdateByQuery.php index 0615b0677..79a19e7ee 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/UpdateByQuery.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/UpdateByQuery.php @@ -1,64 +1,84 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elasticsearch.org */ class UpdateByQuery extends AbstractEndpoint { + /** + * @param array $body + * + * @throws \Elasticsearch\Common\Exceptions\InvalidArgumentException + * @return $this + */ + public function setBody($body) + { + if (isset($body) !== true) { + return $this; + } + + if (is_array($body) !== true) { + throw new Exceptions\InvalidArgumentException( + 'Body must be an array' + ); + } + $this->body = $body; + + return $this; + } + - public function getURI(): string + /** + * @throws \Elasticsearch\Common\Exceptions\BadMethodCallException + * @return string + */ + public function getURI() { - if (isset($this->index) !== true) { - throw new RuntimeException( - 'index is required for Update_by_query' + if (!$this->index) { + throw new Exceptions\RuntimeException( + 'index is required for UpdateByQuery' ); } - $index = $this->index; - $type = $this->type ?? null; - if (isset($type)) { - return "/$index/$type/_update_by_query"; + $uri = "/{$this->index}/_update_by_query"; + if ($this->type) { + $uri = "/{$this->index}/{$this->type}/_update_by_query"; } - return "/$index/_update_by_query"; + + return $uri; } - public function getParamWhitelist(): array + + /** + * @return string[] + */ + public function getParamWhitelist() { return [ 'analyzer', 'analyze_wildcard', 'default_operator', 'df', + 'explain', + 'fields', + 'fielddata_fields', 'from', 'ignore_unavailable', 'allow_no_indices', 'conflicts', 'expand_wildcards', 'lenient', - 'pipeline', + 'lowercase_expanded_terms', 'preference', 'q', 'routing', @@ -68,35 +88,32 @@ public function getParamWhitelist(): array 'size', 'sort', '_source', - '_source_excludes', - '_source_includes', + '_source_exclude', + '_source_include', 'terminate_after', 'stats', + 'suggest_field', + 'suggest_mode', + 'suggest_size', + 'suggest_text', + 'timeout', + 'track_scores', 'version', 'version_type', 'request_cache', 'refresh', - 'timeout', - 'wait_for_active_shards', + 'consistency', 'scroll_size', 'wait_for_completion', - 'requests_per_second', - 'slices' ]; } - public function getMethod(): string - { - return 'POST'; - } - public function setBody($body): UpdateByQuery + /** + * @return string + */ + public function getMethod() { - if (isset($body) !== true) { - return $this; - } - $this->body = $body; - - return $this; + return 'POST'; } } diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Helper/Iterators/SearchHitIterator.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Helper/Iterators/SearchHitIterator.php index 85c645e4c..38695c337 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Helper/Iterators/SearchHitIterator.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Helper/Iterators/SearchHitIterator.php @@ -1,20 +1,4 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co * @see Iterator */ class SearchHitIterator implements Iterator, \Countable @@ -139,7 +128,7 @@ public function current() */ public function key() { - return $this->current_key; + return $this->current_hit_index; } /** diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Helper/Iterators/SearchResponseIterator.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Helper/Iterators/SearchResponseIterator.php index 0f6d5ac87..f8644229d 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Helper/Iterators/SearchResponseIterator.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Helper/Iterators/SearchResponseIterator.php @@ -1,29 +1,18 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co * @see Iterator */ class SearchResponseIterator implements Iterator @@ -55,7 +44,7 @@ class SearchResponseIterator implements Iterator private $scroll_id; /** - * @var string duration + * @var duration */ private $scroll_ttl; @@ -63,7 +52,7 @@ class SearchResponseIterator implements Iterator * Constructor * * @param Client $client - * @param array $search_params Associative array of parameters + * @param array $params Associative array of parameters * @see Client::search() */ public function __construct(Client $client, array $search_params) @@ -139,11 +128,15 @@ public function rewind() */ public function next() { - $this->current_scrolled_response = $this->client->scroll([ - 'scroll_id' => $this->scroll_id, - 'scroll' => $this->scroll_ttl - ]); - $this->scroll_id = $this->current_scrolled_response['_scroll_id']; + if ($this->current_key !== 0) { + $this->current_scrolled_response = $this->client->scroll( + array( + 'scroll_id' => $this->scroll_id, + 'scroll' => $this->scroll_ttl + ) + ); + $this->scroll_id = $this->current_scrolled_response['_scroll_id']; + } $this->current_key++; } diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Namespaces/AbstractNamespace.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Namespaces/AbstractNamespace.php index 95318f489..13b2e02f6 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Namespaces/AbstractNamespace.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Namespaces/AbstractNamespace.php @@ -1,20 +1,4 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ abstract class AbstractNamespace { /** @var \Elasticsearch\Transport */ protected $transport; - /** @var callable */ + /** @var callback */ protected $endpoints; /** * Abstract constructor * * @param Transport $transport Transport object - * @param callable $endpoints + * @param $endpoints */ public function __construct($transport, $endpoints) { @@ -68,7 +57,7 @@ public function extractArgument(&$params, $arg) } /** - * @param AbstractEndpoint $endpoint + * @param $endpoint AbstractEndpoint * * @throws \Exception * @return array diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Namespaces/BooleanRequestWrapper.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Namespaces/BooleanRequestWrapper.php index 00cde59e0..eb9c4cd57 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Namespaces/BooleanRequestWrapper.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Namespaces/BooleanRequestWrapper.php @@ -1,20 +1,4 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ trait BooleanRequestWrapper { diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Namespaces/CatNamespace.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Namespaces/CatNamespace.php index 65a35028b..942983813 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Namespaces/CatNamespace.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Namespaces/CatNamespace.php @@ -1,507 +1,519 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class CatNamespace extends AbstractNamespace { - /** - * $params['name'] = (list) A comma-separated list of alias names to return - * $params['format'] = (string) a short version of the Accept header, e.g. json, yaml - * $params['local'] = (boolean) Return local information, do not retrieve the state from master node (default: false) - * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node - * $params['h'] = (list) Comma-separated list of column names to display - * $params['help'] = (boolean) Return help information (Default = false) - * $params['s'] = (list) Comma-separated list of column names or column aliases to sort by - * $params['v'] = (boolean) Verbose mode. Display column headers (Default = false) + * $params['local'] = (bool) Return local information, do not retrieve the state from master node (default: false) + * ['master_timeout'] = (time) Explicit operation timeout for connection to master node + * ['h'] = (list) Comma-separated list of column names to display + * ['help'] = (bool) Return help information + * ['v'] = (bool) Verbose mode. Display column headers + * + * @param $params array Associative array of parameters * - * @param array $params Associative array of parameters * @return array - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-alias.html */ - public function aliases(array $params = []) + public function aliases($params = array()) { $name = $this->extractArgument($params, 'name'); + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; + + /** @var \Elasticsearch\Endpoints\Cat\Aliases $endpoint */ $endpoint = $endpointBuilder('Cat\Aliases'); - $endpoint->setParams($params); $endpoint->setName($name); + $endpoint->setParams($params); return $this->performRequest($endpoint); } + /** - * $params['node_id'] = (list) A comma-separated list of node IDs or names to limit the returned information - * $params['format'] = (string) a short version of the Accept header, e.g. json, yaml - * $params['bytes'] = (enum) The unit in which to display byte values (Options = b,k,kb,m,mb,g,gb,t,tb,p,pb) - * $params['local'] = (boolean) Return local information, do not retrieve the state from master node (default: false) - * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node - * $params['h'] = (list) Comma-separated list of column names to display - * $params['help'] = (boolean) Return help information (Default = false) - * $params['s'] = (list) Comma-separated list of column names or column aliases to sort by - * $params['v'] = (boolean) Verbose mode. Display column headers (Default = false) + * $params['local'] = (bool) Return local information, do not retrieve the state from master node (default: false) + * ['master_timeout'] = (time) Explicit operation timeout for connection to master node + * ['h'] = (list) Comma-separated list of column names to display + * ['help'] = (bool) Return help information + * ['v'] = (bool) Verbose mode. Display column headers + * ['bytes'] = (enum) The unit in which to display byte values + * + * @param $params array Associative array of parameters * - * @param array $params Associative array of parameters * @return array - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-allocation.html */ - public function allocation(array $params = []) + public function allocation($params = array()) { - $node_id = $this->extractArgument($params, 'node_id'); + $nodeID = $this->extractArgument($params, 'node_id'); + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; + + /** @var \Elasticsearch\Endpoints\Cat\Allocation $endpoint */ $endpoint = $endpointBuilder('Cat\Allocation'); + $endpoint->setNodeID($nodeID); $endpoint->setParams($params); - $endpoint->setNodeId($node_id); return $this->performRequest($endpoint); } + /** - * $params['index'] = (list) A comma-separated list of index names to limit the returned information - * $params['format'] = (string) a short version of the Accept header, e.g. json, yaml - * $params['local'] = (boolean) Return local information, do not retrieve the state from master node (default: false) - * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node - * $params['h'] = (list) Comma-separated list of column names to display - * $params['help'] = (boolean) Return help information (Default = false) - * $params['s'] = (list) Comma-separated list of column names or column aliases to sort by - * $params['v'] = (boolean) Verbose mode. Display column headers (Default = false) + * $params['local'] = (bool) Return local information, do not retrieve the state from master node (default: false) + * ['master_timeout'] = (time) Explicit operation timeout for connection to master node + * ['h'] = (list) Comma-separated list of column names to display + * ['help'] = (bool) Return help information + * ['v'] = (bool) Verbose mode. Display column headers + * + * @param $params array Associative array of parameters * - * @param array $params Associative array of parameters * @return array - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-count.html */ - public function count(array $params = []) + public function count($params = array()) { $index = $this->extractArgument($params, 'index'); + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; + + /** @var \Elasticsearch\Endpoints\Cat\Count $endpoint */ $endpoint = $endpointBuilder('Cat\Count'); - $endpoint->setParams($params); $endpoint->setIndex($index); + $endpoint->setParams($params); return $this->performRequest($endpoint); } + /** - * $params['fields'] = (list) A comma-separated list of fields to return the fielddata size - * $params['format'] = (string) a short version of the Accept header, e.g. json, yaml - * $params['bytes'] = (enum) The unit in which to display byte values (Options = b,k,kb,m,mb,g,gb,t,tb,p,pb) - * $params['local'] = (boolean) Return local information, do not retrieve the state from master node (default: false) - * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node - * $params['h'] = (list) Comma-separated list of column names to display - * $params['help'] = (boolean) Return help information (Default = false) - * $params['s'] = (list) Comma-separated list of column names or column aliases to sort by - * $params['v'] = (boolean) Verbose mode. Display column headers (Default = false) + * $params['local'] = (bool) Return local information, do not retrieve the state from master node (default: false) + * ['master_timeout'] = (time) Explicit operation timeout for connection to master node + * ['h'] = (list) Comma-separated list of column names to display + * ['help'] = (bool) Return help information + * ['v'] = (bool) Verbose mode. Display column headers + * ['ts'] = (bool) Set to false to disable timestamping + * + * @param $params array Associative array of parameters * - * @param array $params Associative array of parameters * @return array - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-fielddata.html */ - public function fielddata(array $params = []) + public function health($params = array()) { - $fields = $this->extractArgument($params, 'fields'); - + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Cat\Fielddata'); + + /** @var \Elasticsearch\Endpoints\Cat\Health $endpoint */ + $endpoint = $endpointBuilder('Cat\Health'); $endpoint->setParams($params); - $endpoint->setFields($fields); return $this->performRequest($endpoint); } + /** - * $params['format'] = (string) a short version of the Accept header, e.g. json, yaml - * $params['local'] = (boolean) Return local information, do not retrieve the state from master node (default: false) - * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node - * $params['h'] = (list) Comma-separated list of column names to display - * $params['help'] = (boolean) Return help information (Default = false) - * $params['s'] = (list) Comma-separated list of column names or column aliases to sort by - * $params['ts'] = (boolean) Set to false to disable timestamping (Default = true) - * $params['v'] = (boolean) Verbose mode. Display column headers (Default = false) + * $params['help'] = (bool) Return help information + * + * @param $params array Associative array of parameters * - * @param array $params Associative array of parameters * @return array - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-health.html */ - public function health(array $params = []) + public function help($params = array()) { - + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Cat\Health'); + + /** @var \Elasticsearch\Endpoints\Cat\Help $endpoint */ + $endpoint = $endpointBuilder('Cat\Help'); $endpoint->setParams($params); return $this->performRequest($endpoint); } + /** - * $params['help'] = (boolean) Return help information (Default = false) - * $params['s'] = (list) Comma-separated list of column names or column aliases to sort by + * $params['local'] = (bool) Return local information, do not retrieve the state from master node (default: false) + * ['master_timeout'] = (time) Explicit operation timeout for connection to master node + * ['h'] = (list) Comma-separated list of column names to display + * ['help'] = (bool) Return help information + * ['v'] = (bool) Verbose mode. Display column headers + * ['bytes'] = (enum) The unit in which to display byte values + * ['pri'] = (bool) Set to true to return stats only for primary shards + * + * @param $params array Associative array of parameters * - * @param array $params Associative array of parameters * @return array - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/cat.html */ - public function help(array $params = []) + public function indices($params = array()) { + $index = $this->extractArgument($params, 'index'); + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Cat\Help'); + + /** @var \Elasticsearch\Endpoints\Cat\Indices $endpoint */ + $endpoint = $endpointBuilder('Cat\Indices'); + $endpoint->setIndex($index); $endpoint->setParams($params); return $this->performRequest($endpoint); } + /** - * $params['index'] = (list) A comma-separated list of index names to limit the returned information - * $params['format'] = (string) a short version of the Accept header, e.g. json, yaml - * $params['bytes'] = (enum) The unit in which to display byte values (Options = b,k,m,g) - * $params['local'] = (boolean) Return local information, do not retrieve the state from master node (default: false) - * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node - * $params['h'] = (list) Comma-separated list of column names to display - * $params['health'] = (enum) A health status ("green", "yellow", or "red" to filter only indices matching the specified health status (Options = green,yellow,red) - * $params['help'] = (boolean) Return help information (Default = false) - * $params['pri'] = (boolean) Set to true to return stats only for primary shards (Default = false) - * $params['s'] = (list) Comma-separated list of column names or column aliases to sort by - * $params['v'] = (boolean) Verbose mode. Display column headers (Default = false) + * $params['local'] = (bool) Return local information, do not retrieve the state from master node (default: false) + * ['master_timeout'] = (time) Explicit operation timeout for connection to master node + * ['h'] = (list) Comma-separated list of column names to display + * ['help'] = (bool) Return help information + * ['v'] = (bool) Verbose mode. Display column headers + * + * @param $params array Associative array of parameters * - * @param array $params Associative array of parameters * @return array - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-indices.html */ - public function indices(array $params = []) + public function master($params = array()) { - $index = $this->extractArgument($params, 'index'); - + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Cat\Indices'); + + /** @var \Elasticsearch\Endpoints\Cat\Master $endpoint */ + $endpoint = $endpointBuilder('Cat\Master'); $endpoint->setParams($params); - $endpoint->setIndex($index); return $this->performRequest($endpoint); } + /** - * $params['format'] = (string) a short version of the Accept header, e.g. json, yaml - * $params['local'] = (boolean) Return local information, do not retrieve the state from master node (default: false) - * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node - * $params['h'] = (list) Comma-separated list of column names to display - * $params['help'] = (boolean) Return help information (Default = false) - * $params['s'] = (list) Comma-separated list of column names or column aliases to sort by - * $params['v'] = (boolean) Verbose mode. Display column headers (Default = false) + * $params['local'] = (bool) Return local information, do not retrieve the state from master node (default: false) + * ['master_timeout'] = (time) Explicit operation timeout for connection to master node + * ['h'] = (list) Comma-separated list of column names to display + * ['help'] = (bool) Return help information + * ['v'] = (bool) Verbose mode. Display column headers + * + * @param $params array Associative array of parameters * - * @param array $params Associative array of parameters * @return array - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-master.html */ - public function master(array $params = []) + public function nodes($params = array()) { - + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Cat\Master'); + + /** @var \Elasticsearch\Endpoints\Cat\Nodes $endpoint */ + $endpoint = $endpointBuilder('Cat\Nodes'); $endpoint->setParams($params); return $this->performRequest($endpoint); } + /** - * $params['format'] = (string) a short version of the Accept header, e.g. json, yaml - * $params['local'] = (boolean) Return local information, do not retrieve the state from master node (default: false) - * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node - * $params['h'] = (list) Comma-separated list of column names to display - * $params['help'] = (boolean) Return help information (Default = false) - * $params['s'] = (list) Comma-separated list of column names or column aliases to sort by - * $params['v'] = (boolean) Verbose mode. Display column headers (Default = false) + * $params['local'] = (bool) Return local information, do not retrieve the state from master node (default: false) + * ['master_timeout'] = (time) Explicit operation timeout for connection to master node + * ['h'] = (list) Comma-separated list of column names to display + * ['help'] = (bool) Return help information + * ['v'] = (bool) Verbose mode. Display column headers + * + * @param $params array Associative array of parameters * - * @param array $params Associative array of parameters * @return array - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-nodeattrs.html */ - public function nodeattrs(array $params = []) + public function nodeAttrs($params = array()) { - + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; + + /** @var \Elasticsearch\Endpoints\Cat\NodeAttrs $endpoint */ $endpoint = $endpointBuilder('Cat\NodeAttrs'); $endpoint->setParams($params); return $this->performRequest($endpoint); } + /** - * $params['format'] = (string) a short version of the Accept header, e.g. json, yaml - * $params['full_id'] = (boolean) Return the full node ID instead of the shortened version (default: false) - * $params['local'] = (boolean) Return local information, do not retrieve the state from master node (default: false) - * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node - * $params['h'] = (list) Comma-separated list of column names to display - * $params['help'] = (boolean) Return help information (Default = false) - * $params['s'] = (list) Comma-separated list of column names or column aliases to sort by - * $params['v'] = (boolean) Verbose mode. Display column headers (Default = false) + * $params['local'] = (bool) Return local information, do not retrieve the state from master node (default: false) + * ['master_timeout'] = (time) Explicit operation timeout for connection to master node + * ['h'] = (list) Comma-separated list of column names to display + * ['help'] = (bool) Return help information + * ['v'] = (bool) Verbose mode. Display column headers + * + * @param $params array Associative array of parameters * - * @param array $params Associative array of parameters * @return array - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-nodes.html */ - public function nodes(array $params = []) + public function pendingTasks($params = array()) { - + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Cat\Nodes'); + + /** @var \Elasticsearch\Endpoints\Cat\PendingTasks $endpoint */ + $endpoint = $endpointBuilder('Cat\PendingTasks'); $endpoint->setParams($params); return $this->performRequest($endpoint); } + /** - * $params['format'] = (string) a short version of the Accept header, e.g. json, yaml - * $params['local'] = (boolean) Return local information, do not retrieve the state from master node (default: false) - * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node - * $params['h'] = (list) Comma-separated list of column names to display - * $params['help'] = (boolean) Return help information (Default = false) - * $params['s'] = (list) Comma-separated list of column names or column aliases to sort by - * $params['v'] = (boolean) Verbose mode. Display column headers (Default = false) + * $params['local'] = (bool) Return local information, do not retrieve the state from master node (default: false) + * ['master_timeout'] = (time) Explicit operation timeout for connection to master node + * ['h'] = (list) Comma-separated list of column names to display + * ['help'] = (bool) Return help information + * ['v'] = (bool) Verbose mode. Display column headers + * ['bytes'] = (enum) The unit in which to display byte values + * + * @param $params array Associative array of parameters * - * @param array $params Associative array of parameters * @return array - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-pending-tasks.html */ - public function pendingTasks(array $params = []) + public function recovery($params = array()) { + $index = $this->extractArgument($params, 'index'); + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Cat\PendingTasks'); + + /** @var \Elasticsearch\Endpoints\Cat\Recovery $endpoint */ + $endpoint = $endpointBuilder('Cat\Recovery'); + $endpoint->setIndex($index); $endpoint->setParams($params); return $this->performRequest($endpoint); } + /** - * $params['format'] = (string) a short version of the Accept header, e.g. json, yaml - * $params['local'] = (boolean) Return local information, do not retrieve the state from master node (default: false) - * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node - * $params['h'] = (list) Comma-separated list of column names to display - * $params['help'] = (boolean) Return help information (Default = false) - * $params['s'] = (list) Comma-separated list of column names or column aliases to sort by - * $params['v'] = (boolean) Verbose mode. Display column headers (Default = false) + * $params['local'] = (bool) Return local information, do not retrieve the state from master node (default: false) + * ['master_timeout'] = (time) Explicit operation timeout for connection to master node + * ['h'] = (list) Comma-separated list of column names to display + * ['help'] = (bool) Return help information + * ['v'] = (bool) Verbose mode. Display column headers + * + * @param $params array Associative array of parameters * - * @param array $params Associative array of parameters * @return array - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-plugins.html */ - public function plugins(array $params = []) + public function repositories($params = array()) { - + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Cat\Plugins'); + + /** @var \Elasticsearch\Endpoints\Cat\Repositories $endpoint */ + $endpoint = $endpointBuilder('Cat\Repositories'); $endpoint->setParams($params); return $this->performRequest($endpoint); } + /** - * $params['index'] = (list) A comma-separated list of index names to limit the returned information - * $params['format'] = (string) a short version of the Accept header, e.g. json, yaml - * $params['bytes'] = (enum) The unit in which to display byte values (Options = b,k,kb,m,mb,g,gb,t,tb,p,pb) - * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node - * $params['h'] = (list) Comma-separated list of column names to display - * $params['help'] = (boolean) Return help information (Default = false) - * $params['s'] = (list) Comma-separated list of column names or column aliases to sort by - * $params['v'] = (boolean) Verbose mode. Display column headers (Default = false) + * $params['local'] = (bool) Return local information, do not retrieve the state from master node (default: false) + * ['master_timeout'] = (time) Explicit operation timeout for connection to master node + * ['h'] = (list) Comma-separated list of column names to display + * ['help'] = (bool) Return help information + * ['v'] = (bool) Verbose mode. Display column headers + * ['bytes'] = (enum) The unit in which to display byte values + * + * @param $params array Associative array of parameters * - * @param array $params Associative array of parameters * @return array - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-recovery.html */ - public function recovery(array $params = []) + public function shards($params = array()) { $index = $this->extractArgument($params, 'index'); + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Cat\Recovery'); - $endpoint->setParams($params); + + /** @var \Elasticsearch\Endpoints\Cat\Shards $endpoint */ + $endpoint = $endpointBuilder('Cat\Shards'); $endpoint->setIndex($index); + $endpoint->setParams($params); return $this->performRequest($endpoint); } + /** - * $params['format'] = (string) a short version of the Accept header, e.g. json, yaml - * $params['local'] = (boolean) Return local information, do not retrieve the state from master node (Default = false) - * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node - * $params['h'] = (list) Comma-separated list of column names to display - * $params['help'] = (boolean) Return help information (Default = false) - * $params['s'] = (list) Comma-separated list of column names or column aliases to sort by - * $params['v'] = (boolean) Verbose mode. Display column headers (Default = false) + * $params['local'] = (bool) Return local information, do not retrieve the state from master node (default: false) + * ['master_timeout'] = (time) Explicit operation timeout for connection to master node + * ['h'] = (list) Comma-separated list of column names to display + * ['help'] = (bool) Return help information + * ['v'] = (bool) Verbose mode. Display column headers + * ['bytes'] = (enum) The unit in which to display byte values + * ['repository'] = (string) Name of repository from which to fetch the snapshot information + * + * @param $params array Associative array of parameters * - * @param array $params Associative array of parameters * @return array - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-repositories.html */ - public function repositories(array $params = []) + public function snapshots($params = array()) { + $repository = $this->extractArgument($params, 'repository'); + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Cat\Repositories'); + + /** @var \Elasticsearch\Endpoints\Cat\Snapshots $endpoint */ + $endpoint = $endpointBuilder('Cat\Snapshots'); + $endpoint->setRepository($repository); $endpoint->setParams($params); return $this->performRequest($endpoint); } + /** - * $params['index'] = (list) A comma-separated list of index names to limit the returned information - * $params['format'] = (string) a short version of the Accept header, e.g. json, yaml - * $params['bytes'] = (enum) The unit in which to display byte values (Options = b,k,kb,m,mb,g,gb,t,tb,p,pb) - * $params['h'] = (list) Comma-separated list of column names to display - * $params['help'] = (boolean) Return help information (Default = false) - * $params['s'] = (list) Comma-separated list of column names or column aliases to sort by - * $params['v'] = (boolean) Verbose mode. Display column headers (Default = false) - * - * @param array $params Associative array of parameters + * $params['local'] = (bool) Return local information, do not retrieve the state from master node (default: false) + * ['master_timeout'] = (time) Explicit operation timeout for connection to master node + * ['h'] = (list) Comma-separated list of column names to display + * ['help'] = (bool) Return help information + * ['v'] = (bool) Verbose mode. Display column headers + * ['full_id'] = (bool) Enables displaying the complete node ids + * ['size'] = (enum) The multiplier in which to display values ([ "", "k", "m", "g", "t", "p" ]) + * + * @param $params array Associative array of parameters + * * @return array - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-segments.html */ - public function segments(array $params = []) + public function threadPool($params = array()) { $index = $this->extractArgument($params, 'index'); + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Cat\Segments'); - $endpoint->setParams($params); + + /** @var \Elasticsearch\Endpoints\Cat\ThreadPool $endpoint */ + $endpoint = $endpointBuilder('Cat\ThreadPool'); $endpoint->setIndex($index); + $endpoint->setParams($params); return $this->performRequest($endpoint); } + /** - * $params['index'] = (list) A comma-separated list of index names to limit the returned information - * $params['format'] = (string) a short version of the Accept header, e.g. json, yaml - * $params['bytes'] = (enum) The unit in which to display byte values (Options = b,k,kb,m,mb,g,gb,t,tb,p,pb) - * $params['local'] = (boolean) Return local information, do not retrieve the state from master node (default: false) - * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node - * $params['h'] = (list) Comma-separated list of column names to display - * $params['help'] = (boolean) Return help information (Default = false) - * $params['s'] = (list) Comma-separated list of column names or column aliases to sort by - * $params['v'] = (boolean) Verbose mode. Display column headers (Default = false) + * $params['local'] = (bool) Return local information, do not retrieve the state from master node (default: false) + * ['master_timeout'] = (time) Explicit operation timeout for connection to master node + * ['h'] = (list) Comma-separated list of column names to display + * ['help'] = (bool) Return help information + * ['v'] = (bool) Verbose mode. Display column headers + * ['bytes'] = (enum) The unit in which to display byte values + * ['fields'] = (list) A comma-separated list of fields to return the fielddata size + * + * @param $params array Associative array of parameters * - * @param array $params Associative array of parameters * @return array - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-shards.html */ - public function shards(array $params = []) + public function fielddata($params = array()) { - $index = $this->extractArgument($params, 'index'); + $fields = $this->extractArgument($params, 'fields'); + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Cat\Shards'); + + /** @var \Elasticsearch\Endpoints\Cat\Fielddata $endpoint */ + $endpoint = $endpointBuilder('Cat\Fielddata'); + $endpoint->setFields($fields); $endpoint->setParams($params); - $endpoint->setIndex($index); return $this->performRequest($endpoint); } + /** - * $params['repository'] = (list) Name of repository from which to fetch the snapshot information - * $params['format'] = (string) a short version of the Accept header, e.g. json, yaml - * $params['ignore_unavailable'] = (boolean) Set to true to ignore unavailable snapshots (Default = false) - * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node - * $params['h'] = (list) Comma-separated list of column names to display - * $params['help'] = (boolean) Return help information (Default = false) - * $params['s'] = (list) Comma-separated list of column names or column aliases to sort by - * $params['v'] = (boolean) Verbose mode. Display column headers (Default = false) - * - * @param array $params Associative array of parameters + * $params['local'] = (bool) Return local information, do not retrieve the state from master node (default: false) + * ['master_timeout'] = (time) Explicit operation timeout for connection to master node + * ['h'] = (list) Comma-separated list of column names to display + * ['help'] = (bool) Return help information + * ['v'] = (bool) Verbose mode. Display column headers + * + * @param $params array Associative array of parameters + * * @return array - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-snapshots.html */ - public function snapshots(array $params = []) + public function plugins($params = array()) { - $repository = $this->extractArgument($params, 'repository'); - + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Cat\Snapshots'); + + /** @var \Elasticsearch\Endpoints\Cat\Plugins $endpoint */ + $endpoint = $endpointBuilder('Cat\Plugins'); $endpoint->setParams($params); - $endpoint->setRepository($repository); return $this->performRequest($endpoint); } + /** - * $params['format'] = (string) a short version of the Accept header, e.g. json, yaml - * $params['node_id'] = (list) A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes - * $params['actions'] = (list) A comma-separated list of actions that should be returned. Leave empty to return all. - * $params['detailed'] = (boolean) Return detailed task information (default: false) - * $params['parent_task'] = (number) Return tasks with specified parent task id. Set to -1 to return all. - * $params['h'] = (list) Comma-separated list of column names to display - * $params['help'] = (boolean) Return help information (Default = false) - * $params['s'] = (list) Comma-separated list of column names or column aliases to sort by - * $params['v'] = (boolean) Verbose mode. Display column headers (Default = false) - * - * @param array $params Associative array of parameters + * $params['h'] = (list) Comma-separated list of column names to display + * ['help'] = (bool) Return help information + * ['v'] = (bool) Verbose mode. Display column headers + * + * @param $params array Associative array of parameters + * * @return array - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/tasks.html */ - public function tasks(array $params = []) + public function segments($params = array()) { + $index = $this->extractArgument($params, 'index'); + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Cat\Tasks'); + + /** @var \Elasticsearch\Endpoints\Cat\Segments $endpoint */ + $endpoint = $endpointBuilder('Cat\Segments'); + $endpoint->setIndex($index); $endpoint->setParams($params); return $this->performRequest($endpoint); } + /** - * $params['name'] = (string) A pattern that returned template names must match * $params['format'] = (string) a short version of the Accept header, e.g. json, yaml - * $params['local'] = (boolean) Return local information, do not retrieve the state from master node (default: false) - * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node - * $params['h'] = (list) Comma-separated list of column names to display - * $params['help'] = (boolean) Return help information (Default = false) - * $params['s'] = (list) Comma-separated list of column names or column aliases to sort by - * $params['v'] = (boolean) Verbose mode. Display column headers (Default = false) + * ['node_id'] = (list) A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes + * ['format'] = (string) a short version of the Accept header, e.g. json, yaml + * ['actions'] = (list) A comma-separated list of actions that should be returned. Leave empty to return all. + * ['detailed'] = (boolean) Return detailed task information (default: false) + * ['parent_node'] = (string) Return tasks with specified parent node. + * ['parent_task'] = (number) Return tasks with specified parent task id. Set to -1 to return all. + * ['h'] = (list) Comma-separated list of column names to display + * ['help'] = (bool) Return help information + * ['v'] = (bool) Verbose mode. Display column headers + * + * @param $params array Associative array of parameters * - * @param array $params Associative array of parameters * @return array - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-templates.html */ - public function templates(array $params = []) + public function tasks($params = array()) { - $name = $this->extractArgument($params, 'name'); - + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Cat\Templates'); + + /** @var \Elasticsearch\Endpoints\Cat\Tasks $endpoint */ + $endpoint = $endpointBuilder('Cat\Tasks'); $endpoint->setParams($params); - $endpoint->setName($name); return $this->performRequest($endpoint); } + /** - * $params['thread_pool_patterns'] = (list) A comma-separated list of regular-expressions to filter the thread pools in the output - * $params['format'] = (string) a short version of the Accept header, e.g. json, yaml - * $params['size'] = (enum) The multiplier in which to display values (Options = ,k,m,g,t,p) - * $params['local'] = (boolean) Return local information, do not retrieve the state from master node (default: false) - * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node - * $params['h'] = (list) Comma-separated list of column names to display - * $params['help'] = (boolean) Return help information (Default = false) - * $params['s'] = (list) Comma-separated list of column names or column aliases to sort by - * $params['v'] = (boolean) Verbose mode. Display column headers (Default = false) - * - * @param array $params Associative array of parameters + * $params['local'] = (bool) Return local information, do not retrieve the state from master node (default: false) + * ['master_timeout'] = (time) Explicit operation timeout for connection to master node + * ['h'] = (list) Comma-separated list of column names to display + * ['help'] = (bool) Return help information + * ['v'] = (bool) Verbose mode. Display column headers + * ['bytes'] = (enum) The unit in which to display byte values + * + * @param $params array Associative array of parameters + * * @return array - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/cat-thread-pool.html */ - public function threadPool(array $params = []) + public function templates($params = array()) { - $thread_pool_patterns = $this->extractArgument($params, 'thread_pool_patterns'); + $name = $this->extractArgument($params, 'name'); + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Cat\ThreadPool'); - $endpoint->setParams($params); - $endpoint->setThreadPoolPatterns($thread_pool_patterns); + + /** @var \Elasticsearch\Endpoints\Cat\Templates $endpoint */ + $endpoint = $endpointBuilder('Cat\Templates'); + $endpoint->setName($name) + ->setParams($params); return $this->performRequest($endpoint); } diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Namespaces/ClusterNamespace.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Namespaces/ClusterNamespace.php index cb9f5d2ea..ac9af6d4e 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Namespaces/ClusterNamespace.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Namespaces/ClusterNamespace.php @@ -1,222 +1,222 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class ClusterNamespace extends AbstractNamespace { - /** - * $params['include_yes_decisions'] = (boolean) Return 'YES' decisions in explanation (default: false) - * $params['include_disk_info'] = (boolean) Return information about disk usage and shard sizes (default: false) - * $params['body'] = (array) The index, shard, and primary flag to explain. Empty means 'explain the first unassigned shard' + * $params['index'] = (string) Limit the information returned to a specific index + * ['level'] = (enum) Specify the level of detail for returned information + * ['local'] = (boolean) Return local information, do not retrieve the state from master node (default: false) + * ['master_timeout'] = (time) Explicit operation timeout for connection to master node + * ['timeout'] = (time) Explicit operation timeout + * ['wait_for_active_shards'] = (number) Wait until the specified number of shards is active + * ['wait_for_nodes'] = (number) Wait until the specified number of nodes is available + * ['wait_for_relocating_shards'] = (number) Wait until the specified number of relocating shards is finished + * ['wait_for_status'] = (enum) Wait until cluster is in a specific state + * + * @param $params array Associative array of parameters * - * @param array $params Associative array of parameters * @return array - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-allocation-explain.html */ - public function allocationExplain(array $params = []) + public function health($params = array()) { - $body = $this->extractArgument($params, 'body'); + $index = $this->extractArgument($params, 'index'); + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Cluster\AllocationExplain'); + + /** @var \Elasticsearch\Endpoints\Cluster\Health $endpoint */ + $endpoint = $endpointBuilder('Cluster\Health'); + $endpoint->setIndex($index); $endpoint->setParams($params); - $endpoint->setBody($body); return $this->performRequest($endpoint); } + /** - * $params['flat_settings'] = (boolean) Return settings in flat format (default: false) - * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node - * $params['timeout'] = (time) Explicit operation timeout - * $params['include_defaults'] = (boolean) Whether to return all default clusters setting. (Default = false) + * $params['dry_run'] = (boolean) Simulate the operation only and return the resulting state + * ['filter_metadata'] = (boolean) Don't return cluster state metadata (default: false) + * ['body'] = (boolean) Don't return cluster state metadata (default: false) + * ['explain'] = (boolean) Return an explanation of why the commands can or cannot be executed + * + * @param $params array Associative array of parameters * - * @param array $params Associative array of parameters * @return array - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-update-settings.html */ - public function getSettings(array $params = []) + public function reroute($params = array()) { + $body = $this->extractArgument($params, 'body'); + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Cluster\GetSettings'); + + /** @var \Elasticsearch\Endpoints\Cluster\Reroute $endpoint */ + $endpoint = $endpointBuilder('Cluster\Reroute'); + $endpoint->setBody($body); $endpoint->setParams($params); return $this->performRequest($endpoint); } + /** - * $params['index'] = (list) Limit the information returned to a specific index - * $params['level'] = (enum) Specify the level of detail for returned information (Options = cluster,indices,shards) (Default = cluster) - * $params['local'] = (boolean) Return local information, do not retrieve the state from master node (default: false) - * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node - * $params['timeout'] = (time) Explicit operation timeout - * $params['wait_for_active_shards'] = (string) Wait until the specified number of shards is active - * $params['wait_for_nodes'] = (string) Wait until the specified number of nodes is available - * $params['wait_for_events'] = (enum) Wait until all currently queued events with the given priority are processed (Options = immediate,urgent,high,normal,low,languid) - * $params['wait_for_no_relocating_shards'] = (boolean) Whether to wait until there are no relocating shards in the cluster - * $params['wait_for_no_initializing_shards'] = (boolean) Whether to wait until there are no initializing shards in the cluster - * $params['wait_for_status'] = (enum) Wait until cluster is in a specific state (Options = green,yellow,red) - * - * @param array $params Associative array of parameters + * $params['filter_blocks'] = (boolean) Do not return information about blocks + * ['filter_index_templates'] = (boolean) Do not return information about index templates + * ['filter_indices'] = (list) Limit returned metadata information to specific indices + * ['filter_metadata'] = (boolean) Do not return information about indices metadata + * ['filter_nodes'] = (boolean) Do not return information about nodes + * ['filter_routing_table'] = (boolean) Do not return information about shard allocation (`routing_table` and `routing_nodes`) + * ['local'] = (boolean) Return local information, do not retrieve the state from master node (default: false) + * ['master_timeout'] = (time) Specify timeout for connection to master + * + * @param $params array Associative array of parameters + * * @return array - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-health.html */ - public function health(array $params = []) + public function state($params = array()) { $index = $this->extractArgument($params, 'index'); + $metric = $this->extractArgument($params, 'metric'); + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Cluster\Health'); - $endpoint->setParams($params); - $endpoint->setIndex($index); + + /** @var \Elasticsearch\Endpoints\Cluster\State $endpoint */ + $endpoint = $endpointBuilder('Cluster\State'); + $endpoint->setParams($params) + ->setIndex($index) + ->setMetric($metric); return $this->performRequest($endpoint); } + /** - * $params['local'] = (boolean) Return local information, do not retrieve the state from master node (default: false) - * $params['master_timeout'] = (time) Specify timeout for connection to master + * $params['flat_settings'] = (boolean) Return settings in flat format (default: false) + * ['human'] = (boolean) Whether to return time and byte values in human-readable format. + * + * @param $params array Associative array of parameters * - * @param array $params Associative array of parameters * @return array - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-pending.html */ - public function pendingTasks(array $params = []) + public function stats($params = array()) { + $nodeID = $this->extractArgument($params, 'node_id'); + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Cluster\PendingTasks'); - $endpoint->setParams($params); + + /** @var \Elasticsearch\Endpoints\Cluster\Stats $endpoint */ + $endpoint = $endpointBuilder('Cluster\Stats'); + $endpoint->setNodeID($nodeID) + ->setParams($params); return $this->performRequest($endpoint); } + /** - * $params['flat_settings'] = (boolean) Return settings in flat format (default: false) - * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node - * $params['timeout'] = (time) Explicit operation timeout - * $params['body'] = (array) The settings to be updated. Can be either `transient` or `persistent` (survives cluster restart). (Required) + * $params['body'] = () + * + * @param $params array Associative array of parameters * - * @param array $params Associative array of parameters * @return array - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-update-settings.html */ - public function putSettings(array $params = []) + public function putSettings($params = array()) { $body = $this->extractArgument($params, 'body'); + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Cluster\PutSettings'); - $endpoint->setParams($params); + + /** @var \Elasticsearch\Endpoints\Cluster\Settings\Put $endpoint */ + $endpoint = $endpointBuilder('Cluster\Settings\Put'); $endpoint->setBody($body); + $endpoint->setParams($params); return $this->performRequest($endpoint); } + /** + * @param array $params * - * @param array $params Associative array of parameters * @return array - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-remote-info.html */ - public function remoteInfo(array $params = []) + public function getSettings($params = array()) { - + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Cluster\RemoteInfo'); + + /** @var \Elasticsearch\Endpoints\Cluster\Settings\Put $endpoint */ + $endpoint = $endpointBuilder('Cluster\Settings\Get'); $endpoint->setParams($params); return $this->performRequest($endpoint); } + /** - * $params['dry_run'] = (boolean) Simulate the operation only and return the resulting state - * $params['explain'] = (boolean) Return an explanation of why the commands can or cannot be executed - * $params['retry_failed'] = (boolean) Retries allocation of shards that are blocked due to too many subsequent allocation failures - * $params['metric'] = (list) Limit the information returned to the specified metrics. Defaults to all but metadata (Options = _all,blocks,metadata,nodes,routing_table,master_node,version) - * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node - * $params['timeout'] = (time) Explicit operation timeout - * $params['body'] = (array) The definition of `commands` to perform (`move`, `cancel`, `allocate`) - * - * @param array $params Associative array of parameters + * $params['local'] = (bool) Return local information, do not retrieve the state from master node (default: false) + * ['master_timeout'] = (time) Specify timeout for connection to master + * + * @param $params array Associative array of parameters + * * @return array - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-reroute.html */ - public function reroute(array $params = []) + public function pendingTasks($params = array()) { - $body = $this->extractArgument($params, 'body'); - + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Cluster\Reroute'); + + /** @var \Elasticsearch\Endpoints\Cluster\PendingTasks $endpoint */ + $endpoint = $endpointBuilder('Cluster\PendingTasks'); $endpoint->setParams($params); - $endpoint->setBody($body); return $this->performRequest($endpoint); } + /** - * $params['index'] = (list) A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices - * $params['metric'] = (list) Limit the information returned to the specified metrics - * $params['local'] = (boolean) Return local information, do not retrieve the state from master node (default: false) - * $params['master_timeout'] = (time) Specify timeout for connection to master - * $params['flat_settings'] = (boolean) Return settings in flat format (default: false) - * $params['wait_for_metadata_version'] = (number) Wait for the metadata version to be equal or greater than the specified metadata version - * $params['wait_for_timeout'] = (time) The maximum time to wait for wait_for_metadata_version before timing out - * $params['ignore_unavailable'] = (boolean) Whether specified concrete indices should be ignored when unavailable (missing or closed) - * $params['allow_no_indices'] = (boolean) Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) - * $params['expand_wildcards'] = (enum) Whether to expand wildcard expression to concrete indices that are open, closed or both. (Options = open,closed,none,all) (Default = open) - * - * @param array $params Associative array of parameters + * $params['include_yes_decisions'] = (bool) Return 'YES' decisions in explanation (default: false) + * + * @param $params array Associative array of parameters + * * @return array - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-state.html */ - public function state(array $params = []) + public function allocationExplain($params = array()) { - $index = $this->extractArgument($params, 'index'); - $metric = $this->extractArgument($params, 'metric'); + $body = $this->extractArgument($params, 'body'); + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Cluster\State'); - $endpoint->setParams($params); - $endpoint->setIndex($index); - $endpoint->setMetric($metric); + + /** @var \Elasticsearch\Endpoints\Cluster\AllocationExplain $endpoint */ + $endpoint = $endpointBuilder('Cluster\AllocationExplain'); + $endpoint->setBody($body) + ->setParams($params); return $this->performRequest($endpoint); } + /** - * $params['node_id'] = (list) A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes - * $params['flat_settings'] = (boolean) Return settings in flat format (default: false) - * $params['timeout'] = (time) Explicit operation timeout + * $params[] + * + * @param $params array Associative array of parameters * - * @param array $params Associative array of parameters * @return array - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-stats.html */ - public function stats(array $params = []) + public function remoteInfo($params = array()) { - $node_id = $this->extractArgument($params, 'node_id'); - + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Cluster\Stats'); - $endpoint->setParams($params); - $endpoint->setNodeId($node_id); + + /** @var \Elasticsearch\Endpoints\Cluster\RemoteInfo $endpoint */ + $endpoint = $endpointBuilder('Cluster\RemoteInfo'); return $this->performRequest($endpoint); } diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Namespaces/IndicesNamespace.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Namespaces/IndicesNamespace.php index e74debc84..44d469056 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Namespaces/IndicesNamespace.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Namespaces/IndicesNamespace.php @@ -1,1018 +1,1165 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class IndicesNamespace extends AbstractNamespace { - /** - * $params['index'] = (string) The name of the index to scope the operation - * $params['body'] = (array) Define analyzer/tokenizer parameters and the text on which the analysis should be performed + * $params['index'] = (list) A comma-separated list of indices to check (Required) * - * @param array $params Associative array of parameters - * @return array - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-analyze.html + * @param $params array Associative array of parameters + * + * @return boolean */ - public function analyze(array $params = []) + public function exists($params) { $index = $this->extractArgument($params, 'index'); - $body = $this->extractArgument($params, 'body'); + //manually make this verbose so we can check status code + $params['client']['verbose'] = true; + + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Indices\Analyze'); - $endpoint->setParams($params); + + /** @var \Elasticsearch\Endpoints\Indices\Exists $endpoint */ + $endpoint = $endpointBuilder('Indices\Exists'); $endpoint->setIndex($index); - $endpoint->setBody($body); + $endpoint->setParams($params); - return $this->performRequest($endpoint); + return BooleanRequestWrapper::performRequest($endpoint, $this->transport); } + /** - * $params['index'] = (list) A comma-separated list of index name to limit the operation - * $params['field_data'] = (boolean) Clear field data. This is deprecated. Prefer `fielddata`. - * $params['fielddata'] = (boolean) Clear field data - * $params['fields'] = (list) A comma-separated list of fields to clear when using the `fielddata` parameter (default: all) - * $params['query'] = (boolean) Clear query caches - * $params['ignore_unavailable'] = (boolean) Whether specified concrete indices should be ignored when unavailable (missing or closed) - * $params['allow_no_indices'] = (boolean) Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) - * $params['expand_wildcards'] = (enum) Whether to expand wildcard expression to concrete indices that are open, closed or both. (Options = open,closed,none,all) (Default = open) - * $params['request_cache'] = (boolean) Clear request cache - * $params['request'] = (boolean) Clear request cache + * $params['index'] = (list) A comma-separated list of indices to check (Required) + * ['feature'] = (list) A comma-separated list of features to return + * ['ignore_unavailable'] = (bool) Whether specified concrete indices should be ignored when unavailable (missing or closed) + * ['allow_no_indices'] = (bool) Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) + * ['expand_wildcards'] = (enum) Whether to expand wildcard expression to concrete indices that are open, closed or both. + * ['local'] = (bool) Return local information, do not retrieve the state from master node (default: false) * - * @param array $params Associative array of parameters - * @return array - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-clearcache.html + * @param $params array Associative array of parameters + * + * @return bool */ - public function clearCache(array $params = []) + public function get($params) { $index = $this->extractArgument($params, 'index'); + $feature = $this->extractArgument($params, 'feature'); + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Indices\ClearCache'); - $endpoint->setParams($params); - $endpoint->setIndex($index); + + /** @var \Elasticsearch\Endpoints\Indices\Get $endpoint */ + $endpoint = $endpointBuilder('Indices\Get'); + $endpoint->setIndex($index) + ->setFeature($feature) + ->setParams($params); return $this->performRequest($endpoint); } + /** - * $params['index'] = (list) A comma separated list of indices to close (Required) - * $params['timeout'] = (time) Explicit operation timeout - * $params['master_timeout'] = (time) Specify timeout for connection to master - * $params['ignore_unavailable'] = (boolean) Whether specified concrete indices should be ignored when unavailable (missing or closed) - * $params['allow_no_indices'] = (boolean) Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) - * $params['expand_wildcards'] = (enum) Whether to expand wildcard expression to concrete indices that are open, closed or both. (Options = open,closed,none,all) (Default = open) + * $params['index'] = (list) A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices + * ['operation_threading'] = () TODO: ? + * ['ignore_unavailable'] = (bool) Whether specified concrete indices should be ignored when unavailable (missing or closed) + * ['allow_no_indices'] = (bool) Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) + * ['expand_wildcards'] = (enum) Whether to expand wildcard expression to concrete indices that are open, closed or both. + * + * @param $params array Associative array of parameters * - * @param array $params Associative array of parameters * @return array - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-open-close.html */ - public function close(array $params = []) + public function segments($params = array()) { $index = $this->extractArgument($params, 'index'); + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Indices\Close'); - $endpoint->setParams($params); + + /** @var \Elasticsearch\Endpoints\Indices\Segments $endpoint */ + $endpoint = $endpointBuilder('Indices\Segments'); $endpoint->setIndex($index); + $endpoint->setParams($params); return $this->performRequest($endpoint); } + /** - * $params['index'] = (string) The name of the index (Required) - * $params['include_type_name'] = (boolean) Whether a type should be expected in the body of the mappings. - * $params['wait_for_active_shards'] = (string) Set the number of active shards to wait for before the operation returns. - * $params['timeout'] = (time) Explicit operation timeout - * $params['master_timeout'] = (time) Specify timeout for connection to master - * $params['update_all_types'] = (boolean) Whether to update the mapping for all fields with the same name across all types or not - * $params['body'] = (array) The configuration for the index (`settings` and `mappings`) + * $params['name'] = (string) The name of the template (Required) + * ['timeout'] = (time) Explicit operation timeout + * + * @param $params array Associative array of parameters * - * @param array $params Associative array of parameters * @return array - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-create-index.html */ - public function create(array $params = []) + public function deleteTemplate($params) { - $index = $this->extractArgument($params, 'index'); - $body = $this->extractArgument($params, 'body'); + $name = $this->extractArgument($params, 'name'); + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Indices\Create'); + + /** @var \Elasticsearch\Endpoints\Indices\Template\Delete $endpoint */ + $endpoint = $endpointBuilder('Indices\Template\Delete'); + $endpoint->setName($name); $endpoint->setParams($params); - $endpoint->setIndex($index); - $endpoint->setBody($body); return $this->performRequest($endpoint); } + /** - * $params['index'] = (list) A comma-separated list of indices to delete; use `_all` or `*` string to delete all indices (Required) - * $params['timeout'] = (time) Explicit operation timeout - * $params['master_timeout'] = (time) Specify timeout for connection to master - * $params['ignore_unavailable'] = (boolean) Ignore unavailable indexes (default: false) - * $params['allow_no_indices'] = (boolean) Ignore if a wildcard expression resolves to no concrete indices (default: false) - * $params['expand_wildcards'] = (enum) Whether wildcard expressions should get expanded to open or closed indices (default: open) (Options = open,closed,none,all) (Default = open) + * $params['index'] = (list) A comma-separated list of indices to delete; use `_all` or empty string to delete all indices + * ['timeout'] = (time) Explicit operation timeout + * + * @param $params array Associative array of parameters * - * @param array $params Associative array of parameters * @return array - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-delete-index.html */ - public function delete(array $params = []) + public function delete($params = array()) { $index = $this->extractArgument($params, 'index'); + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; + + /** @var \Elasticsearch\Endpoints\Indices\Delete $endpoint */ $endpoint = $endpointBuilder('Indices\Delete'); - $endpoint->setParams($params); $endpoint->setIndex($index); + $endpoint->setParams($params); return $this->performRequest($endpoint); } + /** - * $params['index'] = (list) A comma-separated list of index names (supports wildcards); use `_all` for all indices (Required) - * $params['name'] = (list) A comma-separated list of aliases to delete (supports wildcards); use `_all` to delete all aliases for the specified indices. (Required) - * $params['timeout'] = (time) Explicit timestamp for the document - * $params['master_timeout'] = (time) Specify timeout for connection to master + * $params['fields'] = (boolean) A comma-separated list of fields for `fielddata` metric (supports wildcards) + * ['index'] = (list) A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices + * ['indexing_types'] = (list) A comma-separated list of document types to include in the `indexing` statistics + * ['metric_family'] = (enum) Limit the information returned to a specific metric + * ['search_groups'] = (list) A comma-separated list of search groups to include in the `search` statistics + * ['all'] = (boolean) Return all available information + * ['clear'] = (boolean) Reset the default level of detail + * ['docs'] = (boolean) Return information about indexed and deleted documents + * ['fielddata'] = (boolean) Return information about field data + * ['filter_cache'] = (boolean) Return information about filter cache + * ['flush'] = (boolean) Return information about flush operations + * ['get'] = (boolean) Return information about get operations + * ['groups'] = (boolean) A comma-separated list of search groups for `search` statistics + * ['id_cache'] = (boolean) Return information about ID cache + * ['ignore_indices'] = (enum) When performed on multiple indices, allows to ignore `missing` ones + * ['indexing'] = (boolean) Return information about indexing operations + * ['merge'] = (boolean) Return information about merge operations + * ['refresh'] = (boolean) Return information about refresh operations + * ['search'] = (boolean) Return information about search operations; use the `groups` parameter to include information for specific search groups + * ['store'] = (boolean) Return information about the size of the index + * + * @param $params array Associative array of parameters * - * @param array $params Associative array of parameters * @return array - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-aliases.html */ - public function deleteAlias(array $params = []) + public function stats($params = array()) { + $metric = $this->extractArgument($params, 'metric'); + $index = $this->extractArgument($params, 'index'); - $name = $this->extractArgument($params, 'name'); + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Indices\DeleteAlias'); + + /** @var \Elasticsearch\Endpoints\Indices\Stats $endpoint */ + $endpoint = $endpointBuilder('Indices\Stats'); + $endpoint->setIndex($index) + ->setMetric($metric); $endpoint->setParams($params); - $endpoint->setIndex($index); - $endpoint->setName($name); return $this->performRequest($endpoint); } + /** - * $params['name'] = (string) The name of the template (Required) - * $params['timeout'] = (time) Explicit operation timeout - * $params['master_timeout'] = (time) Specify timeout for connection to master + * $params['index'] = (list) A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices + * ['body'] = (list) A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices + * + * @param $params array Associative array of parameters * - * @param array $params Associative array of parameters * @return array - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html */ - public function deleteTemplate(array $params = []) + public function putSettings($params = array()) { - $name = $this->extractArgument($params, 'name'); + $index = $this->extractArgument($params, 'index'); + + $body = $this->extractArgument($params, 'body'); + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Indices\DeleteTemplate'); + + /** @var \Elasticsearch\Endpoints\Indices\Settings\Put $endpoint */ + $endpoint = $endpointBuilder('Indices\Settings\Put'); + $endpoint->setIndex($index) + ->setBody($body); $endpoint->setParams($params); - $endpoint->setName($name); return $this->performRequest($endpoint); } + /** - * $params['index'] = (list) A comma-separated list of index names (Required) - * $params['local'] = (boolean) Return local information, do not retrieve the state from master node (default: false) - * $params['ignore_unavailable'] = (boolean) Ignore unavailable indexes (default: false) - * $params['allow_no_indices'] = (boolean) Ignore if a wildcard expression resolves to no concrete indices (default: false) - * $params['expand_wildcards'] = (enum) Whether wildcard expressions should get expanded to open or closed indices (default: open) (Options = open,closed,none,all) (Default = open) - * $params['flat_settings'] = (boolean) Return settings in flat format (default: false) - * $params['include_defaults'] = (boolean) Whether to return all default setting for each of the indices. (Default = false) + * $params['index'] = (list) A comma-separated list of index names; use `_all` or empty string for all indices + * ['ignore_unavailable'] = (bool) Whether specified concrete indices should be ignored when unavailable (missing or closed) + * ['allow_no_indices'] = (bool) Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) + * ['expand_wildcards'] = (enum) Whether to expand wildcard expression to concrete indices that are open, closed or both. * - * @param array $params Associative array of parameters - * @return bool - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-exists.html + * @param $params array Associative array of parameters + * + * @return array */ - public function exists(array $params = []): bool + public function snapshotIndex($params = array()) { $index = $this->extractArgument($params, 'index'); - // manually make this verbose so we can check status code - $params['client']['verbose'] = true; - + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Indices\Exists'); - $endpoint->setParams($params); + + /** @var \Elasticsearch\Endpoints\Indices\Gateway\Snapshot $endpoint */ + $endpoint = $endpointBuilder('Indices\Gateway\Snapshot'); $endpoint->setIndex($index); + $endpoint->setParams($params); - return BooleanRequestWrapper::performRequest($endpoint, $this->transport); + return $this->performRequest($endpoint); } + /** - * $params['index'] = (list) A comma-separated list of index names to filter aliases - * $params['name'] = (list) A comma-separated list of alias names to return (Required) - * $params['ignore_unavailable'] = (boolean) Whether specified concrete indices should be ignored when unavailable (missing or closed) - * $params['allow_no_indices'] = (boolean) Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) - * $params['expand_wildcards'] = (enum) Whether to expand wildcard expression to concrete indices that are open, closed or both. (Options = open,closed,none,all) (Default = all) - * $params['local'] = (boolean) Return local information, do not retrieve the state from master node (default: false) + * $params['index'] = (string) The name of the source index to shrink + * ['target'] = (string) The name of the target index to shrink into + * ['timeout'] = (time) Explicit operation timeout + * ['master_timeout'] = (time) Specify timeout for connection to master * - * @param array $params Associative array of parameters - * @return bool - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-aliases.html + * @param $params array Associative array of parameters + * + * @return array */ - public function existsAlias(array $params = []): bool + public function shrink($params = array()) { $index = $this->extractArgument($params, 'index'); - $name = $this->extractArgument($params, 'name'); - - // manually make this verbose so we can check status code - $params['client']['verbose'] = true; + $target = $this->extractArgument($params, 'target'); + $body = $this->extractArgument($params, 'body'); + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Indices\ExistsAlias'); - $endpoint->setParams($params); - $endpoint->setIndex($index); - $endpoint->setName($name); - return BooleanRequestWrapper::performRequest($endpoint, $this->transport); + /** @var \Elasticsearch\Endpoints\Indices\Shrink $endpoint */ + $endpoint = $endpointBuilder('Indices\Shrink'); + $endpoint->setIndex($index) + ->setTarget($target) + ->setBody($body); + + return $this->performRequest($endpoint); } + /** - * $params['name'] = (list) The comma separated names of the index templates (Required) - * $params['flat_settings'] = (boolean) Return settings in flat format (default: false) - * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node - * $params['local'] = (boolean) Return local information, do not retrieve the state from master node (default: false) + * $params['index'] = (list) A comma-separated list of index names; use `_all` or empty string for all indices + * ['type'] = (list) A comma-separated list of document types * - * @param array $params Associative array of parameters - * @return bool - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html + * @param $params array Associative array of parameters + * + * @return array */ - public function existsTemplate(array $params = []): bool + public function getMapping($params = array()) { - $name = $this->extractArgument($params, 'name'); + $index = $this->extractArgument($params, 'index'); - // manually make this verbose so we can check status code - $params['client']['verbose'] = true; + $type = $this->extractArgument($params, 'type'); + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Indices\ExistsTemplate'); + + /** @var \Elasticsearch\Endpoints\Indices\Mapping\Get $endpoint */ + $endpoint = $endpointBuilder('Indices\Mapping\Get'); + $endpoint->setIndex($index) + ->setType($type); $endpoint->setParams($params); - $endpoint->setName($name); - return BooleanRequestWrapper::performRequest($endpoint, $this->transport); + return $this->performRequest($endpoint); } + /** - * $params['index'] = (list) A comma-separated list of index names; use `_all` to check the types across all indices (Required) - * $params['type'] = (list) A comma-separated list of document types to check (Required) - * $params['ignore_unavailable'] = (boolean) Whether specified concrete indices should be ignored when unavailable (missing or closed) - * $params['allow_no_indices'] = (boolean) Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) - * $params['expand_wildcards'] = (enum) Whether to expand wildcard expression to concrete indices that are open, closed or both. (Options = open,closed,none,all) (Default = open) - * $params['local'] = (boolean) Return local information, do not retrieve the state from master node (default: false) + * $params['index'] = (list) A comma-separated list of index names; use `_all` or empty string for all indices + * ['type'] = (list) A comma-separated list of document types + * ['field'] = (list) A comma-separated list of document fields + * ['include_defaults'] = (bool) specifies default mapping values should be returned * - * @param array $params Associative array of parameters - * @return bool - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-types-exists.html + * @param $params array Associative array of parameters + * + * @return array */ - public function existsType(array $params = []): bool + public function getFieldMapping($params = array()) { $index = $this->extractArgument($params, 'index'); $type = $this->extractArgument($params, 'type'); + $fields = $this->extractArgument($params, 'fields'); - // manually make this verbose so we can check status code - $params['client']['verbose'] = true; + if (!isset($fields)) { + $fields = $this->extractArgument($params, 'field'); + } + + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Indices\ExistsType'); + + /** @var \Elasticsearch\Endpoints\Indices\Mapping\GetField $endpoint */ + $endpoint = $endpointBuilder('Indices\Mapping\GetField'); + $endpoint->setIndex($index) + ->setType($type) + ->setFields($fields); + $endpoint->setParams($params); - $endpoint->setIndex($index); - $endpoint->setType($type); - return BooleanRequestWrapper::performRequest($endpoint, $this->transport); + return $this->performRequest($endpoint); } + /** * $params['index'] = (list) A comma-separated list of index names; use `_all` or empty string for all indices - * $params['force'] = (boolean) Whether a flush should be forced even if it is not necessarily needed ie. if no changes will be committed to the index. This is useful if transaction log IDs should be incremented even if no uncommitted changes are present. (This setting can be considered as internal) - * $params['wait_if_ongoing'] = (boolean) If set to true the flush operation will block until the flush can be executed if another flush operation is already executing. The default is true. If set to false the flush will be skipped iff if another flush operation is already running. - * $params['ignore_unavailable'] = (boolean) Whether specified concrete indices should be ignored when unavailable (missing or closed) - * $params['allow_no_indices'] = (boolean) Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) - * $params['expand_wildcards'] = (enum) Whether to expand wildcard expression to concrete indices that are open, closed or both. (Options = open,closed,none,all) (Default = open) + * ['force'] = (boolean) TODO: ? + * ['full'] = (boolean) TODO: ? + * ['refresh'] = (boolean) Refresh the index after performing the operation + * ['ignore_unavailable'] = (bool) Whether specified concrete indices should be ignored when unavailable (missing or closed) + * ['allow_no_indices'] = (bool) Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) + * ['expand_wildcards'] = (enum) Whether to expand wildcard expression to concrete indices that are open, closed or both. + * + * @param $params array Associative array of parameters * - * @param array $params Associative array of parameters * @return array - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-flush.html */ - public function flush(array $params = []) + public function flush($params = array()) { $index = $this->extractArgument($params, 'index'); + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; + + /** @var \Elasticsearch\Endpoints\Indices\Flush $endpoint */ $endpoint = $endpointBuilder('Indices\Flush'); - $endpoint->setParams($params); $endpoint->setIndex($index); + $endpoint->setParams($params); return $this->performRequest($endpoint); } + /** * $params['index'] = (list) A comma-separated list of index names; use `_all` or empty string for all indices - * $params['ignore_unavailable'] = (boolean) Whether specified concrete indices should be ignored when unavailable (missing or closed) - * $params['allow_no_indices'] = (boolean) Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) - * $params['expand_wildcards'] = (enum) Whether to expand wildcard expression to concrete indices that are open, closed or both. (Options = open,closed,none,all) (Default = open) + * ['force'] = (boolean) TODO: ? + * ['full'] = (boolean) TODO: ? + * ['refresh'] = (boolean) Refresh the index after performing the operation + * ['ignore_unavailable'] = (bool) Whether specified concrete indices should be ignored when unavailable (missing or closed) + * ['allow_no_indices'] = (bool) Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) + * ['expand_wildcards'] = (enum) Whether to expand wildcard expression to concrete indices that are open, closed or both. + * + * @param $params array Associative array of parameters * - * @param array $params Associative array of parameters * @return array - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-synced-flush.html */ - public function flushSynced(array $params = []) + public function flushSynced($params = array()) { $index = $this->extractArgument($params, 'index'); + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Indices\FlushSynced'); - $endpoint->setParams($params); + + /** @var \Elasticsearch\Endpoints\Indices\Flush $endpoint */ + $endpoint = $endpointBuilder('Indices\Flush'); $endpoint->setIndex($index); + $endpoint->setParams($params); + $endpoint->setSynced(true); return $this->performRequest($endpoint); } + + /** - * $params['index'] = (list) A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices - * $params['flush'] = (boolean) Specify whether the index should be flushed after performing the operation (default: true) - * $params['ignore_unavailable'] = (boolean) Whether specified concrete indices should be ignored when unavailable (missing or closed) - * $params['allow_no_indices'] = (boolean) Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) - * $params['expand_wildcards'] = (enum) Whether to expand wildcard expression to concrete indices that are open, closed or both. (Options = open,closed,none,all) (Default = open) - * $params['max_num_segments'] = (number) The number of segments the index should be merged into (default: dynamic) - * $params['only_expunge_deletes'] = (boolean) Specify whether the operation should only expunge deleted documents + * $params['index'] = (list) A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices + * ['operation_threading'] = () TODO: ? + * ['ignore_unavailable'] = (bool) Whether specified concrete indices should be ignored when unavailable (missing or closed) + * ['allow_no_indices'] = (bool) Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) + * ['expand_wildcards'] = (enum) Whether to expand wildcard expression to concrete indices that are open, closed or both. + * + * @param $params array Associative array of parameters * - * @param array $params Associative array of parameters * @return array - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-forcemerge.html */ - public function forcemerge(array $params = []) + public function refresh($params = array()) { $index = $this->extractArgument($params, 'index'); + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Indices\ForceMerge'); - $endpoint->setParams($params); + + /** @var \Elasticsearch\Endpoints\Indices\Refresh $endpoint */ + $endpoint = $endpointBuilder('Indices\Refresh'); $endpoint->setIndex($index); + $endpoint->setParams($params); return $this->performRequest($endpoint); } + /** - * $params['index'] = (list) A comma-separated list of index names (Required) - * $params['include_type_name'] = (boolean) Whether to add the type name to the response (default: true) - * $params['local'] = (boolean) Return local information, do not retrieve the state from master node (default: false) - * $params['ignore_unavailable'] = (boolean) Ignore unavailable indexes (default: false) - * $params['allow_no_indices'] = (boolean) Ignore if a wildcard expression resolves to no concrete indices (default: false) - * $params['expand_wildcards'] = (enum) Whether wildcard expressions should get expanded to open or closed indices (default: open) (Options = open,closed,none,all) (Default = open) - * $params['flat_settings'] = (boolean) Return settings in flat format (default: false) - * $params['include_defaults'] = (boolean) Whether to return all default setting for each of the indices. (Default = false) - * $params['master_timeout'] = (time) Specify timeout for connection to master + * $params['index'] = (list) A comma-separated list of index names; use `_all` or empty string for all indices + * ['detailed'] = (bool) Whether to display detailed information about shard recovery + * ['active_only'] = (bool) Display only those recoveries that are currently on-going + * ['human'] = (bool) Whether to return time and byte values in human-readable format. + * + * @param $params array Associative array of parameters * - * @param array $params Associative array of parameters * @return array - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-index.html */ - public function get(array $params = []) + public function recovery($params = array()) { $index = $this->extractArgument($params, 'index'); + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Indices\Get'); - $endpoint->setParams($params); + + /** @var \Elasticsearch\Endpoints\Indices\Flush $endpoint */ + $endpoint = $endpointBuilder('Indices\Recovery'); $endpoint->setIndex($index); + $endpoint->setParams($params); return $this->performRequest($endpoint); } + /** - * $params['index'] = (list) A comma-separated list of index names to filter aliases - * $params['name'] = (list) A comma-separated list of alias names to return - * $params['ignore_unavailable'] = (boolean) Whether specified concrete indices should be ignored when unavailable (missing or closed) - * $params['allow_no_indices'] = (boolean) Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) - * $params['expand_wildcards'] = (enum) Whether to expand wildcard expression to concrete indices that are open, closed or both. (Options = open,closed,none,all) (Default = all) - * $params['local'] = (boolean) Return local information, do not retrieve the state from master node (default: false) + * $params['index'] = (list) A comma-separated list of index names; use `_all` to check the types across all indices (Required) + * ['type'] = (list) A comma-separated list of document types to check (Required) + * ['ignore_unavailable'] = (bool) Whether specified concrete indices should be ignored when unavailable (missing or closed) + * ['allow_no_indices'] = (bool) Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) + * ['expand_wildcards'] = (enum) Whether to expand wildcard expression to concrete indices that are open, closed or both. + * + * @param $params array Associative array of parameters + * + * @return boolean + */ + public function existsType($params) + { + $index = $this->extractArgument($params, 'index'); + + $type = $this->extractArgument($params, 'type'); + + //manually make this verbose so we can check status code + $params['client']['verbose'] = true; + + /** @var callback $endpointBuilder */ + $endpointBuilder = $this->endpoints; + + /** @var \Elasticsearch\Endpoints\Indices\Type\Exists $endpoint */ + $endpoint = $endpointBuilder('Indices\Type\Exists'); + $endpoint->setIndex($index) + ->setType($type); + $endpoint->setParams($params); + + return BooleanRequestWrapper::performRequest($endpoint, $this->transport); + } + + /** + * $params['index'] = (string) The name of the index with an alias + * ['name'] = (string) The name of the alias to be created or updated + * ['timeout'] = (time) Explicit timestamp for the document + * ['body'] = (time) Explicit timestamp for the document + * + * @param $params array Associative array of parameters * - * @param array $params Associative array of parameters * @return array - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-aliases.html */ - public function getAlias(array $params = []) + public function putAlias($params = array()) { $index = $this->extractArgument($params, 'index'); + $name = $this->extractArgument($params, 'name'); + $body = $this->extractArgument($params, 'body'); + + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Indices\GetAlias'); + + /** @var \Elasticsearch\Endpoints\Indices\Alias\Put $endpoint */ + $endpoint = $endpointBuilder('Indices\Alias\Put'); + $endpoint->setIndex($index) + ->setName($name) + ->setBody($body); $endpoint->setParams($params); - $endpoint->setIndex($index); - $endpoint->setName($name); return $this->performRequest($endpoint); } + /** - * $params['index'] = (list) A comma-separated list of index names - * $params['type'] = (list) A comma-separated list of document types - * $params['fields'] = (list) A comma-separated list of fields (Required) - * $params['include_type_name'] = (boolean) Whether a type should be returned in the body of the mappings. - * $params['include_defaults'] = (boolean) Whether the default mapping values should be returned as well - * $params['ignore_unavailable'] = (boolean) Whether specified concrete indices should be ignored when unavailable (missing or closed) - * $params['allow_no_indices'] = (boolean) Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) - * $params['expand_wildcards'] = (enum) Whether to expand wildcard expression to concrete indices that are open, closed or both. (Options = open,closed,none,all) (Default = open) - * $params['local'] = (boolean) Return local information, do not retrieve the state from master node (default: false) + * $params['name'] = (string) The name of the template (Required) + * ['order'] = (number) The order for this template when merging multiple matching ones (higher numbers are merged later, overriding the lower numbers) + * ['timeout'] = (time) Explicit operation timeout + * ['body'] = (time) Explicit operation timeout + * ['create'] = (bool) Whether the index template should only be added if new or can also replace an existing one + * + * @param $params array Associative array of parameters * - * @param array $params Associative array of parameters * @return array - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-field-mapping.html */ - public function getFieldMapping(array $params = []) + public function putTemplate($params) { - $index = $this->extractArgument($params, 'index'); - $type = $this->extractArgument($params, 'type'); - $fields = $this->extractArgument($params, 'fields'); + $name = $this->extractArgument($params, 'name'); + + $body = $this->extractArgument($params, 'body'); + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Indices\GetFieldMapping'); + + /** @var \Elasticsearch\Endpoints\Indices\Template\Put $endpoint */ + $endpoint = $endpointBuilder('Indices\Template\Put'); + $endpoint->setName($name) + ->setBody($body); $endpoint->setParams($params); - $endpoint->setIndex($index); - $endpoint->setType($type); - $endpoint->setFields($fields); return $this->performRequest($endpoint); } + /** - * $params['index'] = (list) A comma-separated list of index names - * $params['type'] = (list) A comma-separated list of document types - * $params['include_type_name'] = (boolean) Whether to add the type name to the response. - * $params['ignore_unavailable'] = (boolean) Whether specified concrete indices should be ignored when unavailable (missing or closed) - * $params['allow_no_indices'] = (boolean) Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) - * $params['expand_wildcards'] = (enum) Whether to expand wildcard expression to concrete indices that are open, closed or both. (Options = open,closed,none,all) (Default = open) - * $params['master_timeout'] = (time) Specify timeout for connection to master - * $params['local'] = (boolean) Return local information, do not retrieve the state from master node (default: false) + * $params['index'] = (list) A comma-separated list of index names to restrict the operation; use `_all` or empty string to perform the operation on all indices + * ['type'] = (list) A comma-separated list of document types to restrict the operation; leave empty to perform the operation on all types + * ['explain'] = (boolean) Return detailed information about the error + * ['ignore_indices'] = (enum) When performed on multiple indices, allows to ignore `missing` ones + * ['operation_threading'] = () TODO: ? + * ['source'] = (string) The URL-encoded query definition (instead of using the request body) + * ['body'] = (string) The URL-encoded query definition (instead of using the request body) + * + * @param $params array Associative array of parameters * - * @param array $params Associative array of parameters * @return array - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-mapping.html */ - public function getMapping(array $params = []) + public function validateQuery($params = array()) { $index = $this->extractArgument($params, 'index'); + $type = $this->extractArgument($params, 'type'); + $body = $this->extractArgument($params, 'body'); + + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Indices\GetMapping'); + + /** @var \Elasticsearch\Endpoints\Indices\Validate\Query $endpoint */ + $endpoint = $endpointBuilder('Indices\Validate\Query'); + $endpoint->setIndex($index) + ->setType($type) + ->setBody($body); $endpoint->setParams($params); - $endpoint->setIndex($index); - $endpoint->setType($type); return $this->performRequest($endpoint); } + /** - * $params['index'] = (list) A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices - * $params['name'] = (list) The name of the settings that should be included - * $params['master_timeout'] = (time) Specify timeout for connection to master - * $params['ignore_unavailable'] = (boolean) Whether specified concrete indices should be ignored when unavailable (missing or closed) - * $params['allow_no_indices'] = (boolean) Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) - * $params['expand_wildcards'] = (enum) Whether to expand wildcard expression to concrete indices that are open, closed or both. (Options = open,closed,none,all) (Default = open,closed) - * $params['flat_settings'] = (boolean) Return settings in flat format (default: false) - * $params['local'] = (boolean) Return local information, do not retrieve the state from master node (default: false) - * $params['include_defaults'] = (boolean) Whether to return all default setting for each of the indices. (Default = false) + * $params['name'] = (list) A comma-separated list of alias names to return (Required) + * ['index'] = (list) A comma-separated list of index names to filter aliases + * ['ignore_indices'] = (enum) When performed on multiple indices, allows to ignore `missing` ones + * ['name'] = (list) A comma-separated list of alias names to return + * + * @param $params array Associative array of parameters * - * @param array $params Associative array of parameters * @return array - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-settings.html */ - public function getSettings(array $params = []) + public function getAlias($params) { $index = $this->extractArgument($params, 'index'); + $name = $this->extractArgument($params, 'name'); + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Indices\GetSettings'); + + /** @var \Elasticsearch\Endpoints\Indices\Alias\Get $endpoint */ + $endpoint = $endpointBuilder('Indices\Alias\Get'); + $endpoint->setIndex($index) + ->setName($name); $endpoint->setParams($params); - $endpoint->setIndex($index); - $endpoint->setName($name); return $this->performRequest($endpoint); } + /** - * $params['name'] = (list) The comma separated names of the index templates - * $params['include_type_name'] = (boolean) Whether a type should be returned in the body of the mappings. - * $params['flat_settings'] = (boolean) Return settings in flat format (default: false) - * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node - * $params['local'] = (boolean) Return local information, do not retrieve the state from master node (default: false) + * $params['index'] = (list) A comma-separated list of index names; use `_all` to perform the operation on all indices (Required) + * ['type'] = (string) The name of the document type + * ['ignore_conflicts'] = (boolean) Specify whether to ignore conflicts while updating the mapping (default: false) + * ['timeout'] = (time) Explicit operation timeout + * ['body'] = (time) Explicit operation timeout + * + * @param $params array Associative array of parameters * - * @param array $params Associative array of parameters * @return array - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html */ - public function getTemplate(array $params = []) + public function putMapping($params) { - $name = $this->extractArgument($params, 'name'); + $index = $this->extractArgument($params, 'index'); + $type = $this->extractArgument($params, 'type'); + + $body = $this->extractArgument($params, 'body'); + + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Indices\GetTemplate'); + + /** @var \Elasticsearch\Endpoints\Indices\Mapping\Put $endpoint */ + $endpoint = $endpointBuilder('Indices\Mapping\Put'); + $endpoint->setIndex($index) + ->setType($type) + ->setBody($body); $endpoint->setParams($params); - $endpoint->setName($name); return $this->performRequest($endpoint); } + /** - * $params['index'] = (list) A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices - * $params['ignore_unavailable'] = (boolean) Whether specified concrete indices should be ignored when unavailable (missing or closed) - * $params['allow_no_indices'] = (boolean) Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) - * $params['expand_wildcards'] = (enum) Whether to expand wildcard expression to concrete indices that are open, closed or both. (Options = open,closed,none,all) (Default = open) + * $params['index'] = (list) A comma-separated list of index names; use `_all` for all indices (Required) + * ['type'] = (string) The name of the document type to delete (Required) + * + * @param $params array Associative array of parameters * - * @param array $params Associative array of parameters * @return array - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-upgrade.html */ - public function getUpgrade(array $params = []) + public function deleteMapping($params) { $index = $this->extractArgument($params, 'index'); + $type = $this->extractArgument($params, 'type'); + + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Indices\GetUpgrade'); + + /** @var \Elasticsearch\Endpoints\Indices\Mapping\Delete $endpoint */ + $endpoint = $endpointBuilder('Indices\Mapping\Delete'); + $endpoint->setIndex($index) + ->setType($type); $endpoint->setParams($params); - $endpoint->setIndex($index); return $this->performRequest($endpoint); } + /** - * $params['index'] = (list) A comma separated list of indices to open (Required) - * $params['timeout'] = (time) Explicit operation timeout - * $params['master_timeout'] = (time) Specify timeout for connection to master - * $params['ignore_unavailable'] = (boolean) Whether specified concrete indices should be ignored when unavailable (missing or closed) - * $params['allow_no_indices'] = (boolean) Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) - * $params['expand_wildcards'] = (enum) Whether to expand wildcard expression to concrete indices that are open, closed or both. (Options = open,closed,none,all) (Default = closed) - * $params['wait_for_active_shards'] = (string) Sets the number of active shards to wait for before the operation returns. + * $params['name'] = (string) The name of the template (Required) + * + * @param $params array Associative array of parameters * - * @param array $params Associative array of parameters * @return array - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-open-close.html */ - public function open(array $params = []) + public function getTemplate($params) { - $index = $this->extractArgument($params, 'index'); + $name = $this->extractArgument($params, 'name'); + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Indices\Open'); + + /** @var \Elasticsearch\Endpoints\Indices\Template\Get $endpoint */ + $endpoint = $endpointBuilder('Indices\Template\Get'); + $endpoint->setName($name); $endpoint->setParams($params); - $endpoint->setIndex($index); return $this->performRequest($endpoint); } + /** - * $params['index'] = (list) A comma-separated list of index names the alias should point to (supports wildcards); use `_all` to perform the operation on all indices. (Required) - * $params['name'] = (string) The name of the alias to be created or updated (Required) - * $params['timeout'] = (time) Explicit timestamp for the document - * $params['master_timeout'] = (time) Specify timeout for connection to master - * $params['body'] = (array) The settings for the alias, such as `routing` or `filter` + * $params['name'] = (string) The name of the template (Required) * - * @param array $params Associative array of parameters - * @return array - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-aliases.html + * @param $params array Associative array of parameters + * + * @return boolean */ - public function putAlias(array $params = []) + public function existsTemplate($params) { - $index = $this->extractArgument($params, 'index'); $name = $this->extractArgument($params, 'name'); - $body = $this->extractArgument($params, 'body'); + //manually make this verbose so we can check status code + $params['client']['verbose'] = true; + + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Indices\PutAlias'); - $endpoint->setParams($params); - $endpoint->setIndex($index); + + /** @var \Elasticsearch\Endpoints\Indices\Template\Exists $endpoint */ + $endpoint = $endpointBuilder('Indices\Template\Exists'); $endpoint->setName($name); - $endpoint->setBody($body); + $endpoint->setParams($params); - return $this->performRequest($endpoint); + return BooleanRequestWrapper::performRequest($endpoint, $this->transport); } + /** - * $params['index'] = (list) A comma-separated list of index names the mapping should be added to (supports wildcards); use `_all` or omit to add the mapping on all indices. - * $params['type'] = (string) The name of the document type - * $params['include_type_name'] = (boolean) Whether a type should be expected in the body of the mappings. - * $params['timeout'] = (time) Explicit operation timeout - * $params['master_timeout'] = (time) Specify timeout for connection to master - * $params['ignore_unavailable'] = (boolean) Whether specified concrete indices should be ignored when unavailable (missing or closed) - * $params['allow_no_indices'] = (boolean) Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) - * $params['expand_wildcards'] = (enum) Whether to expand wildcard expression to concrete indices that are open, closed or both. (Options = open,closed,none,all) (Default = open) - * $params['update_all_types'] = (boolean) Whether to update the mapping for all fields with the same name across all types or not - * $params['body'] = (array) The mapping definition (Required) + * $params['index'] = (string) The name of the index (Required) + * ['timeout'] = (time) Explicit operation timeout + * ['body'] = (time) Explicit operation timeout + * + * @param $params array Associative array of parameters * - * @param array $params Associative array of parameters * @return array - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-put-mapping.html */ - public function putMapping(array $params = []) + public function create($params) { $index = $this->extractArgument($params, 'index'); - $type = $this->extractArgument($params, 'type'); + $body = $this->extractArgument($params, 'body'); + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Indices\PutMapping'); + + /** @var \Elasticsearch\Endpoints\Indices\Create $endpoint */ + $endpoint = $endpointBuilder('Indices\Create'); + $endpoint->setIndex($index) + ->setBody($body); $endpoint->setParams($params); - $endpoint->setIndex($index); - $endpoint->setType($type); - $endpoint->setBody($body); return $this->performRequest($endpoint); } + /** - * $params['index'] = (list) A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices - * $params['master_timeout'] = (time) Specify timeout for connection to master - * $params['timeout'] = (time) Explicit operation timeout - * $params['preserve_existing'] = (boolean) Whether to update existing settings. If set to `true` existing settings on an index remain unchanged, the default is `false` - * $params['ignore_unavailable'] = (boolean) Whether specified concrete indices should be ignored when unavailable (missing or closed) - * $params['allow_no_indices'] = (boolean) Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) - * $params['expand_wildcards'] = (enum) Whether to expand wildcard expression to concrete indices that are open, closed or both. (Options = open,closed,none,all) (Default = open) - * $params['flat_settings'] = (boolean) Return settings in flat format (default: false) - * $params['body'] = (array) The index settings to be updated (Required) + * $params['index'] = (list) A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices + * ['flush'] = (boolean) Specify whether the index should be flushed after performing the operation (default: true) + * ['max_num_segments'] = (number) The number of segments the index should be merged into (default: dynamic) + * ['only_expunge_deletes'] = (boolean) Specify whether the operation should only expunge deleted documents + * ['operation_threading'] = () TODO: ? + * ['refresh'] = (boolean) Specify whether the index should be refreshed after performing the operation (default: true) + * ['wait_for_merge'] = (boolean) Specify whether the request should block until the merge process is finished (default: true) + * ['ignore_unavailable'] = (bool) Whether specified concrete indices should be ignored when unavailable (missing or closed) + * ['allow_no_indices'] = (bool) Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) + * ['expand_wildcards'] = (enum) Whether to expand wildcard expression to concrete indices that are open, closed or both. + * + * @param $params array Associative array of parameters * - * @param array $params Associative array of parameters * @return array - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-update-settings.html */ - public function putSettings(array $params = []) + public function forceMerge($params = array()) { $index = $this->extractArgument($params, 'index'); - $body = $this->extractArgument($params, 'body'); + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Indices\PutSettings'); - $endpoint->setParams($params); + + /** @var \Elasticsearch\Endpoints\Indices\ForceMerge $endpoint */ + $endpoint = $endpointBuilder('Indices\ForceMerge'); $endpoint->setIndex($index); - $endpoint->setBody($body); + $endpoint->setParams($params); return $this->performRequest($endpoint); } + /** - * $params['name'] = (string) The name of the template (Required) - * $params['include_type_name'] = (boolean) Whether a type should be returned in the body of the mappings. - * $params['order'] = (number) The order for this template when merging multiple matching ones (higher numbers are merged later, overriding the lower numbers) - * $params['create'] = (boolean) Whether the index template should only be added if new or can also replace an existing one (Default = false) - * $params['timeout'] = (time) Explicit operation timeout - * $params['master_timeout'] = (time) Specify timeout for connection to master - * $params['flat_settings'] = (boolean) Return settings in flat format (default: false) - * $params['body'] = (array) The template definition (Required) + * $params['index'] = (string) The name of the index with an alias (Required) + * ['name'] = (string) The name of the alias to be deleted (Required) + * ['timeout'] = (time) Explicit timestamp for the document + * + * @param $params array Associative array of parameters * - * @param array $params Associative array of parameters * @return array - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html */ - public function putTemplate(array $params = []) + public function deleteAlias($params) { + $index = $this->extractArgument($params, 'index'); + $name = $this->extractArgument($params, 'name'); - $body = $this->extractArgument($params, 'body'); + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Indices\PutTemplate'); + + /** @var \Elasticsearch\Endpoints\Indices\Alias\Delete $endpoint */ + $endpoint = $endpointBuilder('Indices\Alias\Delete'); + $endpoint->setIndex($index) + ->setName($name); $endpoint->setParams($params); - $endpoint->setName($name); - $endpoint->setBody($body); return $this->performRequest($endpoint); } + /** - * $params['index'] = (list) A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices - * $params['detailed'] = (boolean) Whether to display detailed information about shard recovery (Default = false) - * $params['active_only'] = (boolean) Display only those recoveries that are currently on-going (Default = false) + * $params['index'] = (string) The name of the index (Required) + * ['timeout'] = (time) Explicit operation timeout + * + * @param $params array Associative array of parameters * - * @param array $params Associative array of parameters * @return array - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-recovery.html */ - public function recovery(array $params = []) + public function open($params) { $index = $this->extractArgument($params, 'index'); + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Indices\Recovery'); - $endpoint->setParams($params); + + /** @var \Elasticsearch\Endpoints\Indices\Open $endpoint */ + $endpoint = $endpointBuilder('Indices\Open'); $endpoint->setIndex($index); + $endpoint->setParams($params); return $this->performRequest($endpoint); } + /** - * $params['index'] = (list) A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices - * $params['ignore_unavailable'] = (boolean) Whether specified concrete indices should be ignored when unavailable (missing or closed) - * $params['allow_no_indices'] = (boolean) Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) - * $params['expand_wildcards'] = (enum) Whether to expand wildcard expression to concrete indices that are open, closed or both. (Options = open,closed,none,all) (Default = open) + * $params['index'] = (string) The name of the index to scope the operation + * ['analyzer'] = (string) The name of the analyzer to use + * ['field'] = (string) Use the analyzer configured for this field (instead of passing the analyzer name) + * ['filter'] = (list) A comma-separated list of filters to use for the analysis + * ['prefer_local'] = (boolean) With `true`, specify that a local shard should be used if available, with `false`, use a random shard (default: true) + * ['text'] = (string) The text on which the analysis should be performed (when request body is not used) + * ['tokenizer'] = (string) The name of the tokenizer to use for the analysis + * ['format'] = (enum) Format of the output + * ['body'] = (enum) Format of the output + * ['char_filter'] = (list) A comma-separated list of character filters to use for the analysis + * ['explain'] = (bool) With `true`, outputs more advanced details. (default: false) + * ['attributes'] = (list) A comma-separated list of token attributes to output, this parameter works only with `explain=true` + * ['format'] = (enum) Format of the output (["detailed", "text"]) + * + * @param $params array Associative array of parameters * - * @param array $params Associative array of parameters * @return array - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-refresh.html */ - public function refresh(array $params = []) + public function analyze($params = array()) { $index = $this->extractArgument($params, 'index'); + $body = $this->extractArgument($params, 'body'); + + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Indices\Refresh'); + + /** @var \Elasticsearch\Endpoints\Indices\Analyze $endpoint */ + $endpoint = $endpointBuilder('Indices\Analyze'); + $endpoint->setIndex($index) + ->setBody($body); $endpoint->setParams($params); - $endpoint->setIndex($index); return $this->performRequest($endpoint); } + /** - * $params['alias'] = (string) The name of the alias to rollover (Required) - * $params['new_index'] = (string) The name of the rollover index - * $params['include_type_name'] = (boolean) Whether a type should be included in the body of the mappings. - * $params['timeout'] = (time) Explicit operation timeout - * $params['dry_run'] = (boolean) If set to true the rollover action will only be validated but not actually performed even if a condition matches. The default is false - * $params['master_timeout'] = (time) Specify timeout for connection to master - * $params['wait_for_active_shards'] = (string) Set the number of active shards to wait for on the newly created rollover index before the operation returns. - * $params['body'] = (array) The conditions that needs to be met for executing rollover + * $params['index'] = (list) A comma-separated list of index name to limit the operation + * ['field_data'] = (boolean) Clear field data + * ['fielddata'] = (boolean) Clear field data + * ['fields'] = (list) A comma-separated list of fields to clear when using the `field_data` parameter (default: all) + * ['filter'] = (boolean) Clear filter caches + * ['filter_cache'] = (boolean) Clear filter caches + * ['filter_keys'] = (boolean) A comma-separated list of keys to clear when using the `filter_cache` parameter (default: all) + * ['id'] = (boolean) Clear ID caches for parent/child + * ['id_cache'] = (boolean) Clear ID caches for parent/child + * ['recycler'] = (boolean) Clear the recycler cache + * ['ignore_unavailable'] = (bool) Whether specified concrete indices should be ignored when unavailable (missing or closed) + * ['allow_no_indices'] = (bool) Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) + * ['expand_wildcards'] = (enum) Whether to expand wildcard expression to concrete indices that are open, closed or both. + * + * @param $params array Associative array of parameters * - * @param array $params Associative array of parameters * @return array - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-rollover-index.html */ - public function rollover(array $params = []) + public function clearCache($params = array()) { - $alias = $this->extractArgument($params, 'alias'); - $new_index = $this->extractArgument($params, 'new_index'); - $body = $this->extractArgument($params, 'body'); + $index = $this->extractArgument($params, 'index'); + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Indices\Rollover'); + + /** @var \Elasticsearch\Endpoints\Indices\Cache\Clear $endpoint */ + $endpoint = $endpointBuilder('Indices\Cache\Clear'); + $endpoint->setIndex($index); $endpoint->setParams($params); - $endpoint->setAlias($alias); - $endpoint->setNewIndex($new_index); - $endpoint->setBody($body); return $this->performRequest($endpoint); } + /** - * $params['index'] = (list) A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices - * $params['ignore_unavailable'] = (boolean) Whether specified concrete indices should be ignored when unavailable (missing or closed) - * $params['allow_no_indices'] = (boolean) Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) - * $params['expand_wildcards'] = (enum) Whether to expand wildcard expression to concrete indices that are open, closed or both. (Options = open,closed,none,all) (Default = open) - * $params['verbose'] = (boolean) Includes detailed memory usage by Lucene. (Default = false) + * $params['index'] = (list) A comma-separated list of index names to filter aliases + * ['timeout'] = (time) Explicit timestamp for the document + * ['body'] = (time) Explicit timestamp for the document + * + * @param $params array Associative array of parameters * - * @param array $params Associative array of parameters * @return array - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-segments.html */ - public function segments(array $params = []) + public function updateAliases($params = array()) { $index = $this->extractArgument($params, 'index'); + $body = $this->extractArgument($params, 'body'); + + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Indices\Segments'); + + /** @var \Elasticsearch\Endpoints\Indices\Aliases\Update $endpoint */ + $endpoint = $endpointBuilder('Indices\Aliases\Update'); + $endpoint->setIndex($index) + ->setBody($body); $endpoint->setParams($params); - $endpoint->setIndex($index); return $this->performRequest($endpoint); } + /** - * $params['index'] = (list) A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices - * $params['status'] = (list) A comma-separated list of statuses used to filter on shards to get store information for (Options = green,yellow,red,all) - * $params['ignore_unavailable'] = (boolean) Whether specified concrete indices should be ignored when unavailable (missing or closed) - * $params['allow_no_indices'] = (boolean) Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) - * $params['expand_wildcards'] = (enum) Whether to expand wildcard expression to concrete indices that are open, closed or both. (Options = open,closed,none,all) (Default = open) + * $params['local'] = (bool) Return local information, do not retrieve the state from master node (default: false) + * ['timeout'] = (time) Explicit timestamp for the document + * + * @param $params array Associative array of parameters * - * @param array $params Associative array of parameters * @return array - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-shards-stores.html */ - public function shardStores(array $params = []) + public function getAliases($params = array()) { $index = $this->extractArgument($params, 'index'); + $name = $this->extractArgument($params, 'name'); + + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Indices\ShardStores'); + + /** @var \Elasticsearch\Endpoints\Indices\Alias\Get $endpoint */ + $endpoint = $endpointBuilder('Indices\Alias\Get'); + $endpoint->setIndex($index) + ->setName($name); $endpoint->setParams($params); - $endpoint->setIndex($index); return $this->performRequest($endpoint); } + /** - * $params['index'] = (string) The name of the source index to shrink (Required) - * $params['target'] = (string) The name of the target index to shrink into (Required) - * $params['copy_settings'] = (boolean) whether or not to copy settings from the source index (defaults to false) - * $params['timeout'] = (time) Explicit operation timeout - * $params['master_timeout'] = (time) Specify timeout for connection to master - * $params['wait_for_active_shards'] = (string) Set the number of active shards to wait for on the shrunken index before the operation returns. - * $params['body'] = (array) The configuration for the target index (`settings` and `aliases`) + * $params['name'] = (list) A comma-separated list of alias names to return (Required) + * ['index'] = (list) A comma-separated list of index names to filter aliases + * ['ignore_unavailable'] = (bool) Whether specified concrete indices should be ignored when unavailable (missing or closed) + * ['allow_no_indices'] = (bool) Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) + * ['expand_wildcards'] = (enum) Whether to expand wildcard expression to concrete indices that are open, closed or both. * - * @param array $params Associative array of parameters - * @return array - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-shrink-index.html + * @param $params array Associative array of parameters + * + * @return boolean */ - public function shrink(array $params = []) + public function existsAlias($params) { $index = $this->extractArgument($params, 'index'); - $target = $this->extractArgument($params, 'target'); - $body = $this->extractArgument($params, 'body'); + $name = $this->extractArgument($params, 'name'); + + //manually make this verbose so we can check status code + $params['client']['verbose'] = true; + + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Indices\Shrink'); + + /** @var \Elasticsearch\Endpoints\Indices\Alias\Exists $endpoint */ + $endpoint = $endpointBuilder('Indices\Alias\Exists'); + $endpoint->setIndex($index) + ->setName($name); $endpoint->setParams($params); - $endpoint->setIndex($index); - $endpoint->setTarget($target); - $endpoint->setBody($body); - return $this->performRequest($endpoint); + return BooleanRequestWrapper::performRequest($endpoint, $this->transport); } + /** - * $params['index'] = (string) The name of the source index to split (Required) - * $params['target'] = (string) The name of the target index to split into (Required) - * $params['copy_settings'] = (boolean) whether or not to copy settings from the source index (defaults to false) - * $params['timeout'] = (time) Explicit operation timeout - * $params['master_timeout'] = (time) Specify timeout for connection to master - * $params['wait_for_active_shards'] = (string) Set the number of active shards to wait for on the shrunken index before the operation returns. - * $params['body'] = (array) The configuration for the target index (`settings` and `aliases`) + * $params['index'] = (list) A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices + * ['ignore_indices'] = (enum) When performed on multiple indices, allows to ignore `missing` ones + * ['operation_threading'] = () TODO: ? + * ['recovery'] = (boolean) Return information about shard recovery + * ['snapshot'] = (boolean) TODO: ? + * + * @param $params array Associative array of parameters * - * @param array $params Associative array of parameters * @return array - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-split-index.html */ - public function split(array $params = []) + public function status($params = array()) { $index = $this->extractArgument($params, 'index'); - $target = $this->extractArgument($params, 'target'); - $body = $this->extractArgument($params, 'body'); + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Indices\Split'); - $endpoint->setParams($params); + + /** @var \Elasticsearch\Endpoints\Indices\Status $endpoint */ + $endpoint = $endpointBuilder('Indices\Status'); $endpoint->setIndex($index); - $endpoint->setTarget($target); - $endpoint->setBody($body); + $endpoint->setParams($params); return $this->performRequest($endpoint); } + /** - * $params['index'] = (list) A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices - * $params['metric'] = (list) Limit the information returned the specific metrics. - * $params['completion_fields'] = (list) A comma-separated list of fields for `fielddata` and `suggest` index metric (supports wildcards) - * $params['fielddata_fields'] = (list) A comma-separated list of fields for `fielddata` index metric (supports wildcards) - * $params['fields'] = (list) A comma-separated list of fields for `fielddata` and `completion` index metric (supports wildcards) - * $params['groups'] = (list) A comma-separated list of search groups for `search` index metric - * $params['level'] = (enum) Return stats aggregated at cluster, index or shard level (Options = cluster,indices,shards) (Default = indices) - * $params['types'] = (list) A comma-separated list of document types for the `indexing` index metric - * $params['include_segment_file_sizes'] = (boolean) Whether to report the aggregated disk usage of each one of the Lucene index files (only applies if segment stats are requested) (Default = false) + * $params['index'] = (list) A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices + * + * @param $params array Associative array of parameters * - * @param array $params Associative array of parameters * @return array - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-stats.html */ - public function stats(array $params = []) + public function getSettings($params = array()) { $index = $this->extractArgument($params, 'index'); - $metric = $this->extractArgument($params, 'metric'); + $name = $this->extractArgument($params, 'name'); + + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Indices\Stats'); + + /** @var \Elasticsearch\Endpoints\Indices\Settings\Get $endpoint */ + $endpoint = $endpointBuilder('Indices\Settings\Get'); + $endpoint->setIndex($index) + ->setName($name); $endpoint->setParams($params); - $endpoint->setIndex($index); - $endpoint->setMetric($metric); return $this->performRequest($endpoint); } + /** - * $params['timeout'] = (time) Request timeout - * $params['master_timeout'] = (time) Specify timeout for connection to master - * $params['body'] = (array) The definition of `actions` to perform (Required) + * $params['index'] = (string) The name of the index (Required) + * ['timeout'] = (time) Explicit operation timeout + * + * @param $params array Associative array of parameters * - * @param array $params Associative array of parameters * @return array - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-aliases.html */ - public function updateAliases(array $params = []) + public function close($params) { - $body = $this->extractArgument($params, 'body'); + $index = $this->extractArgument($params, 'index'); + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Indices\UpdateAliases'); + + /** @var \Elasticsearch\Endpoints\Indices\Close $endpoint */ + $endpoint = $endpointBuilder('Indices\Close'); + $endpoint->setIndex($index); $endpoint->setParams($params); - $endpoint->setBody($body); return $this->performRequest($endpoint); } + /** - * $params['index'] = (list) A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices - * $params['allow_no_indices'] = (boolean) Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) - * $params['expand_wildcards'] = (enum) Whether to expand wildcard expression to concrete indices that are open, closed or both. (Options = open,closed,none,all) (Default = open) - * $params['ignore_unavailable'] = (boolean) Whether specified concrete indices should be ignored when unavailable (missing or closed) - * $params['wait_for_completion'] = (boolean) Specify whether the request should block until the all segments are upgraded (default: false) - * $params['only_ancient_segments'] = (boolean) If true, only ancient (an older Lucene major release) segments will be upgraded + * $params['index'] = (string) The name of the index + * + * @param $params array Associative array of parameters * - * @param array $params Associative array of parameters * @return array - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/indices-upgrade.html */ - public function upgrade(array $params = []) + public function seal($params) { $index = $this->extractArgument($params, 'index'); + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Indices\Upgrade'); - $endpoint->setParams($params); + + /** @var \Elasticsearch\Endpoints\Indices\Seal $endpoint */ + $endpoint = $endpointBuilder('Indices\Seal'); $endpoint->setIndex($index); + $endpoint->setParams($params); return $this->performRequest($endpoint); } + /** - * $params['index'] = (list) A comma-separated list of index names to restrict the operation; use `_all` or empty string to perform the operation on all indices - * $params['type'] = (list) A comma-separated list of document types to restrict the operation; leave empty to perform the operation on all types - * $params['explain'] = (boolean) Return detailed information about the error - * $params['ignore_unavailable'] = (boolean) Whether specified concrete indices should be ignored when unavailable (missing or closed) - * $params['allow_no_indices'] = (boolean) Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) - * $params['expand_wildcards'] = (enum) Whether to expand wildcard expression to concrete indices that are open, closed or both. (Options = open,closed,none,all) (Default = open) - * $params['q'] = (string) Query in the Lucene query string syntax - * $params['analyzer'] = (string) The analyzer to use for the query string - * $params['analyze_wildcard'] = (boolean) Specify whether wildcard and prefix queries should be analyzed (default: false) - * $params['default_operator'] = (enum) The default operator for query string query (AND or OR) (Options = AND,OR) (Default = OR) - * $params['df'] = (string) The field to use as default where no field prefix is given in the query string - * $params['lenient'] = (boolean) Specify whether format-based query failures (such as providing text to a numeric field) should be ignored - * $params['rewrite'] = (boolean) Provide a more detailed explanation showing the actual Lucene query that will be executed. - * $params['all_shards'] = (boolean) Execute validation on all shards instead of one random shard per index - * $params['body'] = (array) The query definition specified with the Query DSL + * $params['index'] = (list) A comma-separated list of index names; use `_all` or empty string for all indices + * ['wait_for_completion']= (boolean) Specify whether the request should block until the all segments are upgraded (default: false) + * ['only_ancient_segments'] = (boolean) If true, only ancient (an older Lucene major release) segments will be upgraded + * ['refresh'] = (boolean) Refresh the index after performing the operation + * ['ignore_unavailable'] = (bool) Whether specified concrete indices should be ignored when unavailable (missing or closed) + * ['allow_no_indices'] = (bool) Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) + * ['expand_wildcards'] = (enum) Whether to expand wildcard expression to concrete indices that are open, closed or both. + * + * @param $params array Associative array of parameters * - * @param array $params Associative array of parameters * @return array - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/search-validate.html */ - public function validateQuery(array $params = []) + public function upgrade($params = array()) { $index = $this->extractArgument($params, 'index'); - $type = $this->extractArgument($params, 'type'); - $body = $this->extractArgument($params, 'body'); + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Indices\ValidateQuery'); - $endpoint->setParams($params); + + /** @var \Elasticsearch\Endpoints\Indices\Upgrade\Post $endpoint */ + $endpoint = $endpointBuilder('Indices\Upgrade\Post'); $endpoint->setIndex($index); - $endpoint->setType($type); - $endpoint->setBody($body); + $endpoint->setParams($params); return $this->performRequest($endpoint); } + /** - * $params['index'] = (string) The name of the index to freeze (Required) - * $params['timeout'] = (time) Explicit operation timeout - * $params['master_timeout'] = (time) Specify timeout for connection to master - * $params['ignore_unavailable'] = (boolean) Whether specified concrete indices should be ignored when unavailable (missing or closed) - * $params['allow_no_indices'] = (boolean) Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) - * $params['expand_wildcards'] = (enum) Whether to expand wildcard expression to concrete indices that are open, closed or both. (Options = open,closed,none,all) (Default = closed) - * $params['wait_for_active_shards'] = (string) Sets the number of active shards to wait for before the operation returns. + * $params['index'] = (list) A comma-separated list of index names; use `_all` or empty string for all indices + * ['wait_for_completion']= (boolean) Specify whether the request should block until the all segments are upgraded (default: false) + * ['only_ancient_segments'] = (boolean) If true, only ancient (an older Lucene major release) segments will be upgraded + * ['refresh'] = (boolean) Refresh the index after performing the operation + * ['ignore_unavailable'] = (bool) Whether specified concrete indices should be ignored when unavailable (missing or closed) + * ['allow_no_indices'] = (bool) Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) + * ['expand_wildcards'] = (enum) Whether to expand wildcard expression to concrete indices that are open, closed or both. + * + * @param $params array Associative array of parameters * - * @param array $params Associative array of parameters * @return array - * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/frozen.html */ - public function freeze(array $params = []) + public function getUpgrade($params = array()) { $index = $this->extractArgument($params, 'index'); + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Indices\Freeze'); - $endpoint->setParams($params); + + /** @var \Elasticsearch\Endpoints\Indices\Upgrade\Get $endpoint */ + $endpoint = $endpointBuilder('Indices\Upgrade\Get'); $endpoint->setIndex($index); + $endpoint->setParams($params); return $this->performRequest($endpoint); } + /** - * $params['index'] = (string) The name of the index to unfreeze (Required) - * $params['timeout'] = (time) Explicit operation timeout - * $params['master_timeout'] = (time) Specify timeout for connection to master - * $params['ignore_unavailable'] = (boolean) Whether specified concrete indices should be ignored when unavailable (missing or closed) - * $params['allow_no_indices'] = (boolean) Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) - * $params['expand_wildcards'] = (enum) Whether to expand wildcard expression to concrete indices that are open, closed or both. (Options = open,closed,none,all) (Default = closed) - * $params['wait_for_active_shards'] = (string) Sets the number of active shards to wait for before the operation returns. + * $params['index'] = (string) A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices + * ['status'] = (list) A comma-separated list of statuses used to filter on shards to get store information for + * ['ignore_unavailable'] = (boolean) Whether specified concrete indices should be ignored when unavailable (missing or closed) + * ['allow_no_indices'] = (boolean) Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) + * ['expand_wildcards'] = (boolean) Whether to expand wildcard expression to concrete indices that are open, closed or both. + * ['operation_threading'] + * + * @param $params array Associative array of parameters * - * @param array $params Associative array of parameters * @return array - * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/frozen.html */ - public function unfreeze(array $params = []) + public function shardStores($params) { $index = $this->extractArgument($params, 'index'); + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Indices\Unfreeze'); - $endpoint->setParams($params); + + /** @var \Elasticsearch\Endpoints\Indices\ShardStores $endpoint */ + $endpoint = $endpointBuilder('Indices\ShardStores'); $endpoint->setIndex($index); + $endpoint->setParams($params); return $this->performRequest($endpoint); } /** - * Proxy to getAlias() - * - * @see https://github.com/elastic/elasticsearch-php/issues/1112 + * $params['newIndex'] = (string) The name of the rollover index + * ['alias'] = (string) The name of the alias to rollover + * ['timeout'] = (time) Explicit operation timeout + * ['master_timeout'] = (time) Specify timeout for connection to master + * + * @param $params array Associative array of parameters + * + * @return array */ - public function getAliases(array $params = []) + public function rollover($params) { - return $this->getAlias($params); + $newIndex = $this->extractArgument($params, 'newIndex'); + $alias = $this->extractArgument($params, 'alias'); + $body = $this->extractArgument($params, 'body'); + + /** @var callback $endpointBuilder */ + $endpointBuilder = $this->endpoints; + + /** @var \Elasticsearch\Endpoints\Indices\Rollover $endpoint */ + $endpoint = $endpointBuilder('Indices\Rollover'); + $endpoint->setNewIndex($newIndex) + ->setAlias($alias) + ->setParams($params) + ->setBody($body); + + return $this->performRequest($endpoint); } } diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Namespaces/IngestNamespace.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Namespaces/IngestNamespace.php index be715c37f..93f904615 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Namespaces/IngestNamespace.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Namespaces/IngestNamespace.php @@ -1,128 +1,132 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class IngestNamespace extends AbstractNamespace { - /** - * $params['id'] = (string) Pipeline ID (Required) - * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node - * $params['timeout'] = (time) Explicit operation timeout + * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node + * ['timeout'] = (time) Explicit operation timeout + * + * @param $params array Associative array of parameters * - * @param array $params Associative array of parameters * @return array - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/delete-pipeline-api.html */ - public function deletePipeline(array $params = []) + public function deletePipeline($params = array()) { $id = $this->extractArgument($params, 'id'); + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Ingest\DeletePipeline'); + + /** @var Delete $endpoint */ + $endpoint = $endpointBuilder('Ingest\Pipeline\Delete'); + $endpoint->setID($id); $endpoint->setParams($params); - $endpoint->setId($id); return $this->performRequest($endpoint); } + /** - * $params['id'] = (string) Comma separated list of pipeline ids. Wildcards supported - * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node + * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node + * + * @param $params array Associative array of parameters * - * @param array $params Associative array of parameters * @return array - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/get-pipeline-api.html */ - public function getPipeline(array $params = []) + public function getPipeline($params = array()) { $id = $this->extractArgument($params, 'id'); + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Ingest\GetPipeline'); + + /** @var Get $endpoint */ + $endpoint = $endpointBuilder('Ingest\Pipeline\Get'); + $endpoint->setID($id); $endpoint->setParams($params); - $endpoint->setId($id); return $this->performRequest($endpoint); } + /** + * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node + * ['timeout'] = (time) Explicit operation timeout + * + * @param $params array Associative array of parameters * - * @param array $params Associative array of parameters * @return array - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/grok-processor.html#grok-processor-rest-get */ - public function processorGrok(array $params = []) + public function putPipeline($params = array()) { + $body = $this->extractArgument($params, 'body'); + $id = $this->extractArgument($params, 'id'); + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Ingest\ProcessorGrok'); - $endpoint->setParams($params); + + /** @var Put $endpoint */ + $endpoint = $endpointBuilder('Ingest\Pipeline\Put'); + $endpoint->setID($id) + ->setBody($body) + ->setParams($params); return $this->performRequest($endpoint); } + /** - * $params['id'] = (string) Pipeline ID (Required) - * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node - * $params['timeout'] = (time) Explicit operation timeout - * $params['body'] = (array) The ingest definition (Required) + * $params['verbose'] = (bool) Verbose mode. Display data output for each processor in executed pipeline + * + * @param $params array Associative array of parameters * - * @param array $params Associative array of parameters * @return array - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/put-pipeline-api.html */ - public function putPipeline(array $params = []) + public function simulate($params = array()) { - $id = $this->extractArgument($params, 'id'); $body = $this->extractArgument($params, 'body'); + $id = $this->extractArgument($params, 'id'); + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Ingest\PutPipeline'); - $endpoint->setParams($params); - $endpoint->setId($id); - $endpoint->setBody($body); + + /** @var Simulate $endpoint */ + $endpoint = $endpointBuilder('Ingest\Simulate'); + $endpoint->setID($id) + ->setBody($body) + ->setParams($params); return $this->performRequest($endpoint); } + /** - * $params['id'] = (string) Pipeline ID - * $params['verbose'] = (boolean) Verbose mode. Display data output for each processor in executed pipeline (Default = false) - * $params['body'] = (array) The simulate definition (Required) + * $params[] + * + * @param $params array Associative array of parameters * - * @param array $params Associative array of parameters * @return array - * @see https://www.elastic.co/guide/en/elasticsearch/reference/master/simulate-pipeline-api.html */ - public function simulate(array $params = []) + public function processorGrok($params = []) { - $id = $this->extractArgument($params, 'id'); - $body = $this->extractArgument($params, 'body'); - + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Ingest\Simulate'); - $endpoint->setParams($params); - $endpoint->setId($id); - $endpoint->setBody($body); + + /** @var ProcessorGrok $endpoint */ + $endpoint = $endpointBuilder('Ingest\ProcessorGrok'); return $this->performRequest($endpoint); } diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Namespaces/NamespaceBuilderInterface.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Namespaces/NamespaceBuilderInterface.php index 5331b4b03..b2fd0741e 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Namespaces/NamespaceBuilderInterface.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Namespaces/NamespaceBuilderInterface.php @@ -1,23 +1,12 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ namespace Elasticsearch\Namespaces; diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Namespaces/NodesNamespace.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Namespaces/NodesNamespace.php index 328034e3a..e8bbaf928 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Namespaces/NodesNamespace.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Namespaces/NodesNamespace.php @@ -1,149 +1,133 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class NodesNamespace extends AbstractNamespace { - /** - * $params['node_id'] = (list) A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes - * $params['interval'] = (time) The interval for the second sampling of threads - * $params['snapshots'] = (number) Number of samples of thread stacktrace (default: 10) - * $params['threads'] = (number) Specify the number of threads to provide information for (default: 3) - * $params['ignore_idle_threads'] = (boolean) Don't show threads that are in known-idle places, such as waiting on a socket select or pulling from an empty task queue (default: true) - * $params['type'] = (enum) The type to sample (default: cpu) (Options = cpu,wait,block) - * $params['timeout'] = (time) Explicit operation timeout + * $params['fields'] = (list) A comma-separated list of fields for `fielddata` metric (supports wildcards) + * ['metric_family'] = (enum) Limit the information returned to a certain metric family + * ['metric'] = (enum) Limit the information returned for `indices` family to a specific metric + * ['node_id'] = (list) A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes + * ['all'] = (boolean) Return all available information + * ['clear'] = (boolean) Reset the default level of detail + * ['fs'] = (boolean) Return information about the filesystem + * ['http'] = (boolean) Return information about HTTP + * ['indices'] = (boolean) Return information about indices + * ['jvm'] = (boolean) Return information about the JVM + * ['network'] = (boolean) Return information about network + * ['os'] = (boolean) Return information about the operating system + * ['process'] = (boolean) Return information about the Elasticsearch process + * ['thread_pool'] = (boolean) Return information about the thread pool + * ['transport'] = (boolean) Return information about transport + * + * @param $params array Associative array of parameters * - * @param array $params Associative array of parameters * @return array - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-nodes-hot-threads.html */ - public function hotThreads(array $params = []) + public function stats($params = array()) { - $node_id = $this->extractArgument($params, 'node_id'); + $nodeID = $this->extractArgument($params, 'node_id'); + + $metric = $this->extractArgument($params, 'metric'); + $index_metric = $this->extractArgument($params, 'index_metric'); + + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Nodes\HotThreads'); - $endpoint->setParams($params); - $endpoint->setNodeId($node_id); + + /** @var \Elasticsearch\Endpoints\Cluster\Nodes\Stats $endpoint */ + $endpoint = $endpointBuilder('Cluster\Nodes\Stats'); + $endpoint->setNodeID($nodeID) + ->setMetric($metric) + ->setIndexMetric($index_metric) + ->setParams($params); return $this->performRequest($endpoint); } + /** * $params['node_id'] = (list) A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes - * $params['metric'] = (list) A comma-separated list of metrics you wish returned. Leave empty to return all. - * $params['flat_settings'] = (boolean) Return settings in flat format (default: false) - * $params['timeout'] = (time) Explicit operation timeout + * ['metric'] = (list) A comma-separated list of metrics you wish returned. Leave empty to return all. + * ['flat_settings'] = (boolean) Return settings in flat format (default: false) + * ['human'] = (boolean) Whether to return time and byte values in human-readable format. + + * + * @param $params array Associative array of parameters * - * @param array $params Associative array of parameters * @return array - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-nodes-info.html */ - public function info(array $params = []) + public function info($params = array()) { - $node_id = $this->extractArgument($params, 'node_id'); + $nodeID = $this->extractArgument($params, 'node_id'); $metric = $this->extractArgument($params, 'metric'); + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Nodes\Info'); - $endpoint->setParams($params); - $endpoint->setNodeId($node_id); - $endpoint->setMetric($metric); - - return $this->performRequest($endpoint); - } - /** - * $params['node_id'] = (list) A comma-separated list of node IDs to span the reload/reinit call. Should stay empty because reloading usually involves all cluster nodes. - * $params['timeout'] = (time) Explicit operation timeout - * - * @param array $params Associative array of parameters - * @return array - * @see https://www.elastic.co/guide/en/elasticsearch/reference/6.x/secure-settings.html#reloadable-secure-settings - */ - public function reloadSecureSettings(array $params = []) - { - $node_id = $this->extractArgument($params, 'node_id'); - $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Nodes\ReloadSecureSettings'); + /** @var \Elasticsearch\Endpoints\Cluster\Nodes\Info $endpoint */ + $endpoint = $endpointBuilder('Cluster\Nodes\Info'); + $endpoint->setNodeID($nodeID)->setMetric($metric); $endpoint->setParams($params); - $endpoint->setNodeId($node_id); return $this->performRequest($endpoint); } + /** - * $params['metric'] = (list) Limit the information returned to the specified metrics - * $params['index_metric'] = (list) Limit the information returned for `indices` metric to the specific index metrics. Isn't used if `indices` (or `all`) metric isn't specified. - * $params['node_id'] = (list) A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes - * $params['completion_fields'] = (list) A comma-separated list of fields for `fielddata` and `suggest` index metric (supports wildcards) - * $params['fielddata_fields'] = (list) A comma-separated list of fields for `fielddata` index metric (supports wildcards) - * $params['fields'] = (list) A comma-separated list of fields for `fielddata` and `completion` index metric (supports wildcards) - * $params['groups'] = (boolean) A comma-separated list of search groups for `search` index metric - * $params['level'] = (enum) Return indices stats aggregated at index, node or shard level (Options = indices,node,shards) (Default = node) - * $params['types'] = (list) A comma-separated list of document types for the `indexing` index metric - * $params['timeout'] = (time) Explicit operation timeout - * $params['include_segment_file_sizes'] = (boolean) Whether to report the aggregated disk usage of each one of the Lucene index files (only applies if segment stats are requested) (Default = false) + * $params['node_id'] = (list) A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes + * ['interval'] = (time) The interval for the second sampling of threads + * ['snapshots'] = (number) Number of samples of thread stacktrace (default: 10) + * ['threads'] = (number) Specify the number of threads to provide information for (default: 3) + * ['type'] = (enum) The type to sample (default: cpu) + * + * @param $params array Associative array of parameters * - * @param array $params Associative array of parameters * @return array - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-nodes-stats.html */ - public function stats(array $params = []) + public function hotThreads($params = array()) { - $metric = $this->extractArgument($params, 'metric'); - $index_metric = $this->extractArgument($params, 'index_metric'); - $node_id = $this->extractArgument($params, 'node_id'); + $nodeID = $this->extractArgument($params, 'node_id'); + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Nodes\Stats'); + + /** @var \Elasticsearch\Endpoints\Cluster\Nodes\HotThreads $endpoint */ + $endpoint = $endpointBuilder('Cluster\Nodes\HotThreads'); + $endpoint->setNodeID($nodeID); $endpoint->setParams($params); - $endpoint->setMetric($metric); - $endpoint->setIndexMetric($index_metric); - $endpoint->setNodeId($node_id); return $this->performRequest($endpoint); } + /** - * $params['metric'] = (list) Limit the information returned to the specified metrics - * $params['node_id'] = (list) A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes - * $params['timeout'] = (time) Explicit operation timeout + * $params['node_id'] = (list) A comma-separated list of node IDs or names to perform the operation on; use `_local` to perform the operation on the node you're connected to, leave empty to perform the operation on all nodes + * ['delay'] = (time) Set the delay for the operation (default: 1s) + * ['exit'] = (boolean) Exit the JVM as well (default: true) + * + * @param $params array Associative array of parameters * - * @param array $params Associative array of parameters * @return array - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-nodes-usage.html */ - public function usage(array $params = []) + public function shutdown($params = array()) { - $metric = $this->extractArgument($params, 'metric'); - $node_id = $this->extractArgument($params, 'node_id'); + $nodeID = $this->extractArgument($params, 'node_id'); + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Nodes\Usage'); + + /** @var \Elasticsearch\Endpoints\Cluster\Nodes\Shutdown $endpoint */ + $endpoint = $endpointBuilder('Cluster\Nodes\Shutdown'); + $endpoint->setNodeID($nodeID); $endpoint->setParams($params); - $endpoint->setMetric($metric); - $endpoint->setNodeId($node_id); return $this->performRequest($endpoint); } diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Namespaces/RemoteNamespace.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Namespaces/RemoteNamespace.php new file mode 100644 index 000000000..270530a54 --- /dev/null +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Namespaces/RemoteNamespace.php @@ -0,0 +1,34 @@ + + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co + */ +class RemoteNamespace extends AbstractNamespace +{ + /** + * @param $params array Associative array of parameters + * + * @return array + */ + public function info($params = array()) + { + /** @var callback $endpointBuilder */ + $endpointBuilder = $this->endpoints; + + /** @var Info $endpoint */ + $endpoint = $endpointBuilder('Remote\Info'); + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } +} diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Namespaces/SnapshotNamespace.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Namespaces/SnapshotNamespace.php index c2cbf53c6..6f22d9425 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Namespaces/SnapshotNamespace.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Namespaces/SnapshotNamespace.php @@ -1,234 +1,234 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class SnapshotNamespace extends AbstractNamespace { - /** - * $params['repository'] = (string) A repository name (Required) - * $params['snapshot'] = (string) A snapshot name (Required) - * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node - * $params['wait_for_completion'] = (boolean) Should this request wait until the operation has completed before returning (Default = false) - * $params['body'] = (array) The snapshot definition + * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node + * ['wait_for_completion'] = (bool) Should this request wait until the operation has completed before returning + * + * @param $params array Associative array of parameters * - * @param array $params Associative array of parameters * @return array - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html */ - public function create(array $params = []) + public function create($params = array()) { $repository = $this->extractArgument($params, 'repository'); $snapshot = $this->extractArgument($params, 'snapshot'); $body = $this->extractArgument($params, 'body'); + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; + + /** @var \Elasticsearch\Endpoints\Snapshot\Create $endpoint */ $endpoint = $endpointBuilder('Snapshot\Create'); - $endpoint->setParams($params); - $endpoint->setRepository($repository); - $endpoint->setSnapshot($snapshot); - $endpoint->setBody($body); + $endpoint->setRepository($repository) + ->setSnapshot($snapshot) + ->setParams($params) + ->setBody($body); return $this->performRequest($endpoint); } + /** - * $params['repository'] = (string) A repository name (Required) * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node - * $params['timeout'] = (time) Explicit operation timeout - * $params['verify'] = (boolean) Whether to verify the repository after creation - * $params['body'] = (array) The repository definition (Required) + * ['timeout'] = (time) Explicit operation timeout + * + * @param $params array Associative array of parameters * - * @param array $params Associative array of parameters * @return array - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html */ - public function createRepository(array $params = []) + public function createRepository($params = array()) { $repository = $this->extractArgument($params, 'repository'); $body = $this->extractArgument($params, 'body'); + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Snapshot\CreateRepository'); - $endpoint->setParams($params); - $endpoint->setRepository($repository); - $endpoint->setBody($body); + + /** @var \Elasticsearch\Endpoints\Snapshot\Repository\Create $endpoint */ + $endpoint = $endpointBuilder('Snapshot\Repository\Create'); + $endpoint->setRepository($repository) + ->setBody($body) + ->setParams($params); return $this->performRequest($endpoint); } + /** - * $params['repository'] = (string) A repository name (Required) - * $params['snapshot'] = (string) A snapshot name (Required) * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node * - * @param array $params Associative array of parameters + * @param $params array Associative array of parameters + * * @return array - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html */ - public function delete(array $params = []) + public function delete($params = array()) { $repository = $this->extractArgument($params, 'repository'); $snapshot = $this->extractArgument($params, 'snapshot'); + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; + + /** @var \Elasticsearch\Endpoints\Snapshot\Delete $endpoint */ $endpoint = $endpointBuilder('Snapshot\Delete'); - $endpoint->setParams($params); - $endpoint->setRepository($repository); - $endpoint->setSnapshot($snapshot); + $endpoint->setRepository($repository) + ->setSnapshot($snapshot) + ->setParams($params); return $this->performRequest($endpoint); } + /** - * $params['repository'] = (list) A comma-separated list of repository names (Required) * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node - * $params['timeout'] = (time) Explicit operation timeout + * ['timeout'] = (time) Explicit operation timeout + * + * @param $params array Associative array of parameters * - * @param array $params Associative array of parameters * @return array - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html */ - public function deleteRepository(array $params = []) + public function deleteRepository($params = array()) { $repository = $this->extractArgument($params, 'repository'); + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Snapshot\DeleteRepository'); - $endpoint->setParams($params); - $endpoint->setRepository($repository); + + /** @var \Elasticsearch\Endpoints\Snapshot\Repository\Delete $endpoint */ + $endpoint = $endpointBuilder('Snapshot\Repository\Delete'); + $endpoint->setRepository($repository) + ->setParams($params); return $this->performRequest($endpoint); } + /** - * $params['repository'] = (string) A repository name (Required) - * $params['snapshot'] = (list) A comma-separated list of snapshot names (Required) - * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node - * $params['ignore_unavailable'] = (boolean) Whether to ignore unavailable snapshots, defaults to false which means a SnapshotMissingException is thrown - * $params['verbose'] = (boolean) Whether to show verbose snapshot info or only show the basic info found in the repository index blob + * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node + * + * @param $params array Associative array of parameters * - * @param array $params Associative array of parameters * @return array - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html */ - public function get(array $params = []) + public function get($params = array()) { $repository = $this->extractArgument($params, 'repository'); $snapshot = $this->extractArgument($params, 'snapshot'); + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; + + /** @var \Elasticsearch\Endpoints\Snapshot\Get $endpoint */ $endpoint = $endpointBuilder('Snapshot\Get'); - $endpoint->setParams($params); - $endpoint->setRepository($repository); - $endpoint->setSnapshot($snapshot); + $endpoint->setRepository($repository) + ->setSnapshot($snapshot) + ->setParams($params); return $this->performRequest($endpoint); } + /** - * $params['repository'] = (list) A comma-separated list of repository names * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node - * $params['local'] = (boolean) Return local information, do not retrieve the state from master node (default: false) + * ['timeout'] = (time) Explicit operation timeout + * + * @param $params array Associative array of parameters * - * @param array $params Associative array of parameters * @return array - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html */ - public function getRepository(array $params = []) + public function getRepository($params = array()) { $repository = $this->extractArgument($params, 'repository'); + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Snapshot\GetRepository'); - $endpoint->setParams($params); - $endpoint->setRepository($repository); + + /** @var \Elasticsearch\Endpoints\Snapshot\Repository\Get $endpoint */ + $endpoint = $endpointBuilder('Snapshot\Repository\Get'); + $endpoint->setRepository($repository) + ->setParams($params); return $this->performRequest($endpoint); } + /** - * $params['repository'] = (string) A repository name (Required) - * $params['snapshot'] = (string) A snapshot name (Required) - * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node - * $params['wait_for_completion'] = (boolean) Should this request wait until the operation has completed before returning (Default = false) - * $params['body'] = (array) Details of what to restore + * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node + * ['wait_for_completion'] = (bool) Should this request wait until the operation has completed before returning + * + * @param $params array Associative array of parameters * - * @param array $params Associative array of parameters * @return array - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html */ - public function restore(array $params = []) + public function restore($params = array()) { $repository = $this->extractArgument($params, 'repository'); $snapshot = $this->extractArgument($params, 'snapshot'); $body = $this->extractArgument($params, 'body'); + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; + + /** @var \Elasticsearch\Endpoints\Snapshot\Restore $endpoint */ $endpoint = $endpointBuilder('Snapshot\Restore'); - $endpoint->setParams($params); - $endpoint->setRepository($repository); - $endpoint->setSnapshot($snapshot); - $endpoint->setBody($body); + $endpoint->setRepository($repository) + ->setSnapshot($snapshot) + ->setParams($params) + ->setBody($body); return $this->performRequest($endpoint); } + /** - * $params['repository'] = (string) A repository name - * $params['snapshot'] = (list) A comma-separated list of snapshot names - * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node - * $params['ignore_unavailable'] = (boolean) Whether to ignore unavailable snapshots, defaults to false which means a SnapshotMissingException is thrown + * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node + * + * @param $params array Associative array of parameters * - * @param array $params Associative array of parameters * @return array - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html */ - public function status(array $params = []) + public function status($params = array()) { $repository = $this->extractArgument($params, 'repository'); $snapshot = $this->extractArgument($params, 'snapshot'); + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; + + /** @var \Elasticsearch\Endpoints\Snapshot\Status $endpoint */ $endpoint = $endpointBuilder('Snapshot\Status'); - $endpoint->setParams($params); - $endpoint->setRepository($repository); - $endpoint->setSnapshot($snapshot); + $endpoint->setRepository($repository) + ->setSnapshot($snapshot) + ->setParams($params); return $this->performRequest($endpoint); } + /** - * $params['repository'] = (string) A repository name (Required) * $params['master_timeout'] = (time) Explicit operation timeout for connection to master node - * $params['timeout'] = (time) Explicit operation timeout + * ['timeout'] = (time) Explicit operation timeout + * + * @param $params array Associative array of parameters * - * @param array $params Associative array of parameters * @return array - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/modules-snapshots.html */ - public function verifyRepository(array $params = []) + public function verifyRepository($params = array()) { $repository = $this->extractArgument($params, 'repository'); + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Snapshot\VerifyRepository'); - $endpoint->setParams($params); - $endpoint->setRepository($repository); + + /** @var \Elasticsearch\Endpoints\Snapshot\Repository\Verify $endpoint */ + $endpoint = $endpointBuilder('Snapshot\Repository\Verify'); + $endpoint->setRepository($repository) + ->setParams($params); return $this->performRequest($endpoint); } diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Namespaces/TasksNamespace.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Namespaces/TasksNamespace.php index 6ef0446e2..6782292e2 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Namespaces/TasksNamespace.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Namespaces/TasksNamespace.php @@ -1,92 +1,90 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class TasksNamespace extends AbstractNamespace { - /** - * $params['task_id'] = (string) Cancel the task with specified task id (node_id:task_number) - * $params['nodes'] = (list) A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes - * $params['actions'] = (list) A comma-separated list of actions that should be cancelled. Leave empty to cancel all. - * $params['parent_task_id'] = (string) Cancel tasks with specified parent task id (node_id:task_number). Set to -1 to cancel all. + * $params['wait_for_completion'] = (bool) Wait for the matching tasks to complete (default: false) + * + * @param $params array Associative array of parameters * - * @param array $params Associative array of parameters * @return array - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/tasks.html */ - public function cancel(array $params = []) + public function get($params = array()) { - $task_id = $this->extractArgument($params, 'task_id'); + $id = $this->extractArgument($params, 'task_id'); + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Tasks\Cancel'); - $endpoint->setParams($params); - $endpoint->setTaskId($task_id); + + /** @var Get $endpoint */ + $endpoint = $endpointBuilder('Tasks\Get'); + $endpoint->setTaskId($id) + ->setParams($params); return $this->performRequest($endpoint); } + /** - * $params['task_id'] = (string) Return the task with specified id (node_id:task_number) (Required) - * $params['wait_for_completion'] = (boolean) Wait for the matching tasks to complete (default: false) - * $params['timeout'] = (time) Explicit operation timeout + * $params['node_id'] = (list) A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes + * ['actions'] = (list) A comma-separated list of actions that should be cancelled. Leave empty to cancel all. + * ['parent_node'] = (string) Cancel tasks with specified parent node + * ['parent_task'] = (string) Cancel tasks with specified parent task id (node_id:task_number). Set to -1 to cancel all. + * ['detailed'] = (bool) Return detailed task information (default: false) + * ['wait_for_completion'] = (bool) Wait for the matching tasks to complete (default: false) + * ['group_by'] = (enum) Group tasks by nodes or parent/child relationships + * + * @param $params array Associative array of parameters * - * @param array $params Associative array of parameters * @return array - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/tasks.html */ - public function get(array $params = []) + public function tasksList($params = array()) { - $task_id = $this->extractArgument($params, 'task_id'); + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Tasks\Get'); + + /** @var Get $endpoint */ + $endpoint = $endpointBuilder('Tasks\TasksList'); $endpoint->setParams($params); - $endpoint->setTaskId($task_id); return $this->performRequest($endpoint); } + /** - * $params['nodes'] = (list) A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes - * $params['actions'] = (list) A comma-separated list of actions that should be returned. Leave empty to return all. - * $params['detailed'] = (boolean) Return detailed task information (default: false) - * $params['parent_task_id'] = (string) Return tasks with specified parent task id (node_id:task_number). Set to -1 to return all. - * $params['wait_for_completion'] = (boolean) Wait for the matching tasks to complete (default: false) - * $params['group_by'] = (enum) Group tasks by nodes or parent/child relationships (Options = nodes,parents,none) (Default = nodes) - * $params['timeout'] = (time) Explicit operation timeout + * $params['node_id'] = (list) A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes + * ['actions'] = (list) A comma-separated list of actions that should be cancelled. Leave empty to cancel all. + * ['parent_node'] = (string) Cancel tasks with specified parent node + * ['parent_task'] = (string) Cancel tasks with specified parent task id (node_id:task_number). Set to -1 to cancel all. + * + * @param $params array Associative array of parameters * - * @param array $params Associative array of parameters * @return array - * @see http://www.elastic.co/guide/en/elasticsearch/reference/master/tasks.html */ - public function list(array $params = []) + public function cancel($params = array()) { + $id = $this->extractArgument($params, 'id'); + /** @var callback $endpointBuilder */ $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Tasks\ListTasks'); - $endpoint->setParams($params); + + /** @var Cancel $endpoint */ + $endpoint = $endpointBuilder('Tasks\Cancel'); + $endpoint->setTaskId($id) + ->setParams($params); return $this->performRequest($endpoint); } diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Serializers/ArrayToJSONSerializer.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Serializers/ArrayToJSONSerializer.php index 943aa5b95..97b247e91 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Serializers/ArrayToJSONSerializer.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Serializers/ArrayToJSONSerializer.php @@ -1,20 +1,4 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class ArrayToJSONSerializer implements SerializerInterface { diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Serializers/EverythingToJSONSerializer.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Serializers/EverythingToJSONSerializer.php index 699afded3..2f291daa3 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Serializers/EverythingToJSONSerializer.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Serializers/EverythingToJSONSerializer.php @@ -1,20 +1,4 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class EverythingToJSONSerializer implements SerializerInterface { diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Serializers/SerializerInterface.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Serializers/SerializerInterface.php index 11d8b1cb5..a23796309 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Serializers/SerializerInterface.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Serializers/SerializerInterface.php @@ -1,33 +1,22 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ interface SerializerInterface { /** * Serialize a complex data-structure into a json encoded string * - * @param mixed $data The data to encode + * @param mixed The data to encode * * @return string */ diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Serializers/SmartSerializer.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Serializers/SmartSerializer.php index bb37428d7..af89af2dc 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Serializers/SmartSerializer.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Serializers/SmartSerializer.php @@ -1,20 +1,4 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class SmartSerializer implements SerializerInterface { @@ -79,7 +68,7 @@ public function deserialize($data, $headers) /** * @todo For 2.0, remove the E_NOTICE check before raising the exception. * - * @param string|null $data + * @param $data * * @return array * @throws JsonErrorException diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Transport.php b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Transport.php index e27d9fdbd..bd7782aa8 100644 --- a/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Transport.php +++ b/openml_OS/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Transport.php @@ -1,20 +1,4 @@ + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co */ class Transport { @@ -54,14 +43,14 @@ class Transport * Transport class is responsible for dispatching requests to the * underlying cluster connections * - * @param int $retries + * @param $retries * @param bool $sniffOnStart * @param ConnectionPool\AbstractConnectionPool $connectionPool - * @param \Psr\Log\LoggerInterface $log + * @param \Psr\Log\LoggerInterface $log Monolog logger object */ // @codingStandardsIgnoreStart // "Arguments with default values must be at the end of the argument list" - cannot change the interface - public function __construct(int $retries, AbstractConnectionPool $connectionPool, LoggerInterface $log, bool $sniffOnStart = false) + public function __construct($retries, $sniffOnStart = false, AbstractConnectionPool $connectionPool, LoggerInterface $log) { // @codingStandardsIgnoreEnd @@ -129,9 +118,8 @@ function ($response) { }, //onFailure function ($response) { - $code = $response->getCode(); // Ignore 400 level errors, as that means the server responded just fine - if ($code < 400 || $code >= 500) { + if (!(isset($response['code']) && $response['code'] >=400 && $response['code'] < 500)) { // Otherwise schedule a check $this->connectionPool->scheduleCheck(); } @@ -147,19 +135,23 @@ function ($response) { * * @return callable|array */ - public function resultOrFuture(FutureArrayInterface $result, array $options = []) + public function resultOrFuture($result, $options = []) { + $response = null; $async = isset($options['client']['future']) ? $options['client']['future'] : null; if (is_null($async) || $async === false) { do { $result = $result->wait(); } while ($result instanceof FutureArrayInterface); - } - return $result; + + return $result; + } elseif ($async === true || $async === 'lazy') { + return $result; + } } /** - * @param array $request + * @param $request * * @return bool */ diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/tests/Elasticsearch/Tests/ClientBuilder/DummyLogger.php b/openml_OS/vendor/elasticsearch/elasticsearch/tests/Elasticsearch/Tests/ClientBuilder/DummyLogger.php new file mode 100644 index 000000000..f5c536c77 --- /dev/null +++ b/openml_OS/vendor/elasticsearch/elasticsearch/tests/Elasticsearch/Tests/ClientBuilder/DummyLogger.php @@ -0,0 +1,9 @@ +expectException(InvalidArgumentException::class); + $this->expectExceptionMessage('$logger must implement \Psr\Log\LoggerInterface!'); + + ClientBuilder::create()->setLogger(new \Elasticsearch\Tests\ClientBuilder\DummyLogger()); + } + + public function testClientBuilderThrowsExceptionForIncorrectTracerClass() + { + $this->expectException(InvalidArgumentException::class); + $this->expectExceptionMessage('$tracer must implement \Psr\Log\LoggerInterface!'); + + ClientBuilder::create()->setTracer(new \Elasticsearch\Tests\ClientBuilder\DummyLogger()); + } +} diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/tests/Elasticsearch/Tests/ClientIntegrationTests.php b/openml_OS/vendor/elasticsearch/elasticsearch/tests/Elasticsearch/Tests/ClientIntegrationTests.php new file mode 100644 index 000000000..98cb76572 --- /dev/null +++ b/openml_OS/vendor/elasticsearch/elasticsearch/tests/Elasticsearch/Tests/ClientIntegrationTests.php @@ -0,0 +1,37 @@ + + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elasticsearch.org + */ +class ClientIntegrationTests extends \PHPUnit\Framework\TestCase +{ + public function testCustomQueryParams() + { + $client = Elasticsearch\ClientBuilder::create()->setHosts([$_SERVER['ES_TEST_HOST']])->build(); + + $getParams = [ + 'index' => 'test', + 'type' => 'test', + 'id' => 1, + 'parent' => 'abc', + 'custom' => ['customToken' => 'abc', 'otherToken' => 123], + 'client' => ['ignore' => 400] + ]; + $exists = $client->exists($getParams); + + $this->assertFalse($exists); + } +} diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/tests/Elasticsearch/Tests/ClientTest.php b/openml_OS/vendor/elasticsearch/elasticsearch/tests/Elasticsearch/Tests/ClientTest.php new file mode 100644 index 000000000..50ea22497 --- /dev/null +++ b/openml_OS/vendor/elasticsearch/elasticsearch/tests/Elasticsearch/Tests/ClientTest.php @@ -0,0 +1,405 @@ + + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elasticsearch.org + */ +class ClientTest extends \PHPUnit\Framework\TestCase +{ + public function tearDown() + { + m::close(); + } + + /** + * @expectedException \Elasticsearch\Common\Exceptions\InvalidArgumentException + */ + public function testConstructorIllegalPort() + { + $client = Elasticsearch\ClientBuilder::create()->setHosts(['localhost:abc'])->build(); + } + + public function testFromConfig() + { + $params = [ + 'hosts' => [ + 'localhost:9200' + ], + 'retries' => 2, + 'handler' => ClientBuilder::multiHandler() + ]; + $client = ClientBuilder::fromConfig($params); + } + + /** + * @expectedException \Elasticsearch\Common\Exceptions\RuntimeException + */ + public function testFromConfigBadParam() + { + $params = [ + 'hosts' => [ + 'localhost:9200' + ], + 'retries' => 2, + 'imNotReal' => 5 + ]; + $client = ClientBuilder::fromConfig($params); + } + + public function testFromConfigBadParamQuiet() + { + $params = [ + 'hosts' => [ + 'localhost:9200' + ], + 'retries' => 2, + 'imNotReal' => 5 + ]; + $client = ClientBuilder::fromConfig($params, true); + } + + public function testNullDelete() + { + $client = ClientBuilder::create()->build(); + + try { + $client->delete([ + 'index' => null, + 'type' => 'test', + 'id' => 'test' + ]); + $this->fail("InvalidArgumentException was not thrown"); + } catch (Elasticsearch\Common\Exceptions\InvalidArgumentException $e) { + // all good + } + + try { + $client->delete([ + 'index' => 'test', + 'type' => null, + 'id' => 'test' + ]); + $this->fail("InvalidArgumentException was not thrown"); + } catch (Elasticsearch\Common\Exceptions\InvalidArgumentException $e) { + // all good + } + + try { + $client->delete([ + 'index' => 'test', + 'type' => 'test', + 'id' => null + ]); + $this->fail("InvalidArgumentException was not thrown"); + } catch (Elasticsearch\Common\Exceptions\InvalidArgumentException $e) { + // all good + } + } + + public function testEmptyStringDelete() + { + $client = ClientBuilder::create()->build(); + + try { + $client->delete([ + 'index' => '', + 'type' => 'test', + 'id' => 'test' + ]); + $this->fail("InvalidArgumentException was not thrown"); + } catch (Elasticsearch\Common\Exceptions\InvalidArgumentException $e) { + // all good + } + + try { + $client->delete([ + 'index' => 'test', + 'type' => '', + 'id' => 'test' + ]); + $this->fail("InvalidArgumentException was not thrown"); + } catch (Elasticsearch\Common\Exceptions\InvalidArgumentException $e) { + // all good + } + + try { + $client->delete([ + 'index' => 'test', + 'type' => 'test', + 'id' => '' + ]); + $this->fail("InvalidArgumentException was not thrown"); + } catch (Elasticsearch\Common\Exceptions\InvalidArgumentException $e) { + // all good + } + } + + public function testArrayOfEmptyStringDelete() + { + $client = ClientBuilder::create()->build(); + + try { + $client->delete([ + 'index' => ['', '', ''], + 'type' => 'test', + 'id' => 'test' + ]); + $this->fail("InvalidArgumentException was not thrown"); + } catch (Elasticsearch\Common\Exceptions\InvalidArgumentException $e) { + // all good + } + + try { + $client->delete([ + 'index' => 'test', + 'type' => ['', '', ''], + 'id' => 'test' + ]); + $this->fail("InvalidArgumentException was not thrown"); + } catch (Elasticsearch\Common\Exceptions\InvalidArgumentException $e) { + // all good + } + } + + public function testArrayOfNullDelete() + { + $client = ClientBuilder::create()->build(); + + try { + $client->delete([ + 'index' => [null, null, null], + 'type' => 'test', + 'id' => 'test' + ]); + $this->fail("InvalidArgumentException was not thrown"); + } catch (Elasticsearch\Common\Exceptions\InvalidArgumentException $e) { + // all good + } + + try { + $client->delete([ + 'index' => 'test', + 'type' => [null, null, null], + 'id' => 'test' + ]); + $this->fail("InvalidArgumentException was not thrown"); + } catch (Elasticsearch\Common\Exceptions\InvalidArgumentException $e) { + // all good + } + } + + public function testMaxRetriesException() + { + $client = Elasticsearch\ClientBuilder::create() + ->setHosts(["localhost:1"]) + ->setRetries(0) + ->build(); + + $searchParams = [ + 'index' => 'test', + 'type' => 'test', + 'body' => [ + 'query' => [ + 'match_all' => [] + ] + ] + ]; + + $client = Elasticsearch\ClientBuilder::create() + ->setHosts(["localhost:1"]) + ->setRetries(0) + ->build(); + + try { + $client->search($searchParams); + $this->fail("Should have thrown CouldNotConnectToHost"); + } catch (Elasticsearch\Common\Exceptions\Curl\CouldNotConnectToHost $e) { + // All good + $previous = $e->getPrevious(); + $this->assertInstanceOf(MaxRetriesException::class, $previous); + } catch (\Exception $e) { + throw $e; + } + + + $client = Elasticsearch\ClientBuilder::create() + ->setHosts(["localhost:1"]) + ->setRetries(0) + ->build(); + + try { + $client->search($searchParams); + $this->fail("Should have thrown TransportException"); + } catch (Elasticsearch\Common\Exceptions\TransportException $e) { + // All good + $previous = $e->getPrevious(); + $this->assertInstanceOf(MaxRetriesException::class, $previous); + } catch (\Exception $e) { + throw $e; + } + } + + public function testInlineHosts() + { + $client = Elasticsearch\ClientBuilder::create()->setHosts([ + 'localhost:9200' + ])->build(); + $host = $client->transport->getConnection(); + $this->assertSame("localhost:9200", $host->getHost()); + $this->assertSame("http", $host->getTransportSchema()); + + + $client = Elasticsearch\ClientBuilder::create()->setHosts([ + 'http://localhost:9200' + ])->build(); + $host = $client->transport->getConnection(); + $this->assertSame("localhost:9200", $host->getHost()); + $this->assertSame("http", $host->getTransportSchema()); + + $client = Elasticsearch\ClientBuilder::create()->setHosts([ + 'http://foo.com:9200' + ])->build(); + $host = $client->transport->getConnection(); + $this->assertSame("foo.com:9200", $host->getHost()); + $this->assertSame("http", $host->getTransportSchema()); + + $client = Elasticsearch\ClientBuilder::create()->setHosts([ + 'https://foo.com:9200' + ])->build(); + $host = $client->transport->getConnection(); + $this->assertSame("foo.com:9200", $host->getHost()); + $this->assertSame("https", $host->getTransportSchema()); + + + $client = Elasticsearch\ClientBuilder::create()->setHosts([ + 'https://user:pass@foo.com:9200' + ])->build(); + $host = $client->transport->getConnection(); + $this->assertSame("foo.com:9200", $host->getHost()); + $this->assertSame("https", $host->getTransportSchema()); + $this->assertSame("user:pass", $host->getUserPass()); + } + + public function testExtendedHosts() + { + $client = Elasticsearch\ClientBuilder::create()->setHosts([ + [ + 'host' => 'localhost', + 'port' => 9200, + 'scheme' => 'http' + ] + ])->build(); + $host = $client->transport->getConnection(); + $this->assertSame("localhost:9200", $host->getHost()); + $this->assertSame("http", $host->getTransportSchema()); + + + $client = Elasticsearch\ClientBuilder::create()->setHosts([ + [ + 'host' => 'foo.com', + 'port' => 9200, + 'scheme' => 'http' + ] + ])->build(); + $host = $client->transport->getConnection(); + $this->assertSame("foo.com:9200", $host->getHost()); + $this->assertSame("http", $host->getTransportSchema()); + + + $client = Elasticsearch\ClientBuilder::create()->setHosts([ + [ + 'host' => 'foo.com', + 'port' => 9200, + 'scheme' => 'https' + ] + ])->build(); + $host = $client->transport->getConnection(); + $this->assertSame("foo.com:9200", $host->getHost()); + $this->assertSame("https", $host->getTransportSchema()); + + + $client = Elasticsearch\ClientBuilder::create()->setHosts([ + [ + 'host' => 'foo.com', + 'scheme' => 'http' + ] + ])->build(); + $host = $client->transport->getConnection(); + $this->assertSame("foo.com:9200", $host->getHost()); + $this->assertSame("http", $host->getTransportSchema()); + + + $client = Elasticsearch\ClientBuilder::create()->setHosts([ + [ + 'host' => 'foo.com' + ] + ])->build(); + $host = $client->transport->getConnection(); + $this->assertSame("foo.com:9200", $host->getHost()); + $this->assertSame("http", $host->getTransportSchema()); + + + $client = Elasticsearch\ClientBuilder::create()->setHosts([ + [ + 'host' => 'foo.com', + 'port' => 9500, + 'scheme' => 'https' + ] + ])->build(); + $host = $client->transport->getConnection(); + $this->assertSame("foo.com:9500", $host->getHost()); + $this->assertSame("https", $host->getTransportSchema()); + + + try { + $client = Elasticsearch\ClientBuilder::create()->setHosts([ + [ + 'port' => 9200, + 'scheme' => 'http' + ] + ])->build(); + $this->fail("Expected RuntimeException from missing host, none thrown"); + } catch (Elasticsearch\Common\Exceptions\RuntimeException $e) { + // good + } + + // Underscore host, questionably legal, but inline method would break + $client = Elasticsearch\ClientBuilder::create()->setHosts([ + [ + 'host' => 'the_foo.com' + ] + ])->build(); + $host = $client->transport->getConnection(); + $this->assertSame("the_foo.com:9200", $host->getHost()); + $this->assertSame("http", $host->getTransportSchema()); + + + // Special characters in user/pass, would break inline + $client = Elasticsearch\ClientBuilder::create()->setHosts([ + [ + 'host' => 'foo.com', + 'user' => 'user', + 'pass' => 'abc#$@?%!abc' + ] + ])->build(); + $host = $client->transport->getConnection(); + $this->assertSame("foo.com:9200", $host->getHost()); + $this->assertSame("http", $host->getTransportSchema()); + $this->assertSame("user:abc#$@?%!abc", $host->getUserPass()); + } +} diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/tests/Elasticsearch/Tests/ConnectionPool/Selectors/RoundRobinSelectorTest.php b/openml_OS/vendor/elasticsearch/elasticsearch/tests/Elasticsearch/Tests/ConnectionPool/Selectors/RoundRobinSelectorTest.php new file mode 100644 index 000000000..c7eda50de --- /dev/null +++ b/openml_OS/vendor/elasticsearch/elasticsearch/tests/Elasticsearch/Tests/ConnectionPool/Selectors/RoundRobinSelectorTest.php @@ -0,0 +1,103 @@ + + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elasticsearch.org + */ +class RoundRobinSelectorTest extends \PHPUnit\Framework\TestCase +{ + /** + * Add Ten connections, select 15 to verify round robin + * + * @covers \Elasticsearch\ConnectionPool\Selectors\RoundRobinSelector::select + * + * @return void + */ + public function testTenConnections() + { + $roundRobin = new Elasticsearch\ConnectionPool\Selectors\RoundRobinSelector(); + + $mockConnections = []; + foreach (range(0, 9) as $index) { + $mockConnections[$index] = $this->getMockBuilder(ConnectionInterface::class) + ->disableOriginalConstructor() + ->getMock(); + } + + // select ten + $this->assertSame($mockConnections[0], $roundRobin->select($mockConnections)); + $this->assertSame($mockConnections[1], $roundRobin->select($mockConnections)); + $this->assertSame($mockConnections[2], $roundRobin->select($mockConnections)); + $this->assertSame($mockConnections[3], $roundRobin->select($mockConnections)); + $this->assertSame($mockConnections[4], $roundRobin->select($mockConnections)); + $this->assertSame($mockConnections[5], $roundRobin->select($mockConnections)); + $this->assertSame($mockConnections[6], $roundRobin->select($mockConnections)); + $this->assertSame($mockConnections[7], $roundRobin->select($mockConnections)); + $this->assertSame($mockConnections[8], $roundRobin->select($mockConnections)); + $this->assertSame($mockConnections[9], $roundRobin->select($mockConnections)); + + // select five - should start from the first one (index: 0) + $this->assertSame($mockConnections[0], $roundRobin->select($mockConnections)); + $this->assertSame($mockConnections[1], $roundRobin->select($mockConnections)); + $this->assertSame($mockConnections[2], $roundRobin->select($mockConnections)); + $this->assertSame($mockConnections[3], $roundRobin->select($mockConnections)); + $this->assertSame($mockConnections[4], $roundRobin->select($mockConnections)); + } + + /** + * Add Ten connections, select five, remove three, test another 10 to check + * that the round-robining works after removing connections + * + * @covers \Elasticsearch\ConnectionPool\Selectors\RoundRobinSelector::select + * + * @return void + */ + public function testAddTenConnectionsTestFiveRemoveThreeTestTen() + { + $roundRobin = new Elasticsearch\ConnectionPool\Selectors\RoundRobinSelector(); + + $mockConnections = []; + foreach (range(0, 9) as $index) { + $mockConnections[$index] = $this->getMockBuilder(ConnectionInterface::class) + ->disableOriginalConstructor() + ->getMock(); + } + + // select five + $this->assertSame($mockConnections[0], $roundRobin->select($mockConnections)); + $this->assertSame($mockConnections[1], $roundRobin->select($mockConnections)); + $this->assertSame($mockConnections[2], $roundRobin->select($mockConnections)); + $this->assertSame($mockConnections[3], $roundRobin->select($mockConnections)); + $this->assertSame($mockConnections[4], $roundRobin->select($mockConnections)); + + // remove three + unset($mockConnections[8]); + unset($mockConnections[9]); + unset($mockConnections[10]); + + // select ten after removal + $this->assertSame($mockConnections[5], $roundRobin->select($mockConnections)); + $this->assertSame($mockConnections[6], $roundRobin->select($mockConnections)); + $this->assertSame($mockConnections[7], $roundRobin->select($mockConnections)); + $this->assertSame($mockConnections[0], $roundRobin->select($mockConnections)); + $this->assertSame($mockConnections[1], $roundRobin->select($mockConnections)); + $this->assertSame($mockConnections[2], $roundRobin->select($mockConnections)); + $this->assertSame($mockConnections[3], $roundRobin->select($mockConnections)); + $this->assertSame($mockConnections[4], $roundRobin->select($mockConnections)); + $this->assertSame($mockConnections[5], $roundRobin->select($mockConnections)); + $this->assertSame($mockConnections[6], $roundRobin->select($mockConnections)); + } +} diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/tests/Elasticsearch/Tests/ConnectionPool/Selectors/StickyRoundRobinSelectorTest.php b/openml_OS/vendor/elasticsearch/elasticsearch/tests/Elasticsearch/Tests/ConnectionPool/Selectors/StickyRoundRobinSelectorTest.php new file mode 100644 index 000000000..d996c0403 --- /dev/null +++ b/openml_OS/vendor/elasticsearch/elasticsearch/tests/Elasticsearch/Tests/ConnectionPool/Selectors/StickyRoundRobinSelectorTest.php @@ -0,0 +1,68 @@ + + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elasticsearch.org + */ +class StickyRoundRobinSelectorTest extends \PHPUnit\Framework\TestCase +{ + public function tearDown() + { + m::close(); + } + + public function testTenConnections() + { + $roundRobin = new Elasticsearch\ConnectionPool\Selectors\StickyRoundRobinSelector(); + + $mockConnections = []; + $mockConnections[] = m::mock(ConnectionInterface::class) + ->shouldReceive('isAlive')->times(16)->andReturn(true)->getMock(); + + foreach (range(0, 9) as $index) { + $mockConnections[] = m::mock(ConnectionInterface::class); + } + + foreach (range(0, 15) as $index) { + $retConnection = $roundRobin->select($mockConnections); + + $this->assertSame($mockConnections[0], $retConnection); + } + } + + public function testTenConnectionsFirstDies() + { + $roundRobin = new Elasticsearch\ConnectionPool\Selectors\StickyRoundRobinSelector(); + + $mockConnections = []; + $mockConnections[] = m::mock(ConnectionInterface::class) + ->shouldReceive('isAlive')->once()->andReturn(false)->getMock(); + + $mockConnections[] = m::mock(ConnectionInterface::class) + ->shouldReceive('isAlive')->times(15)->andReturn(true)->getMock(); + + foreach (range(0, 8) as $index) { + $mockConnections[] = m::mock(ConnectionInterface::class); + } + + foreach (range(0, 15) as $index) { + $retConnection = $roundRobin->select($mockConnections); + + $this->assertSame($mockConnections[1], $retConnection); + } + } +} diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/tests/Elasticsearch/Tests/ConnectionPool/SniffingConnectionPoolIntegrationTest.php b/openml_OS/vendor/elasticsearch/elasticsearch/tests/Elasticsearch/Tests/ConnectionPool/SniffingConnectionPoolIntegrationTest.php new file mode 100644 index 000000000..5963bf294 --- /dev/null +++ b/openml_OS/vendor/elasticsearch/elasticsearch/tests/Elasticsearch/Tests/ConnectionPool/SniffingConnectionPoolIntegrationTest.php @@ -0,0 +1,32 @@ + + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elasticsearch.org + */ +class SniffingConnectionPoolIntegrationTest extends \PHPUnit\Framework\TestCase +{ + public function testSniff() + { + $client = ClientBuilder::create() + ->setHosts([$_SERVER['ES_TEST_HOST']]) + ->setConnectionPool(SniffingConnectionPool::class, ['sniffingInterval' => -10]) + ->build(); + + $pinged = $client->ping(); + $this->assertTrue($pinged); + } +} diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/tests/Elasticsearch/Tests/ConnectionPool/SniffingConnectionPoolTest.php b/openml_OS/vendor/elasticsearch/elasticsearch/tests/Elasticsearch/Tests/ConnectionPool/SniffingConnectionPoolTest.php new file mode 100644 index 000000000..8e2ff578c --- /dev/null +++ b/openml_OS/vendor/elasticsearch/elasticsearch/tests/Elasticsearch/Tests/ConnectionPool/SniffingConnectionPoolTest.php @@ -0,0 +1,432 @@ + + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elasticsearch.org + */ +class SniffingConnectionPoolTest extends \PHPUnit\Framework\TestCase +{ + protected function setUp() + { + static::markTestSkipped("All of Sniffing unit tests use outdated cluster state format, need to redo"); + } + + + public function tearDown() + { + m::close(); + } + + public function testAddOneHostThenGetConnection() + { + $mockConnection = m::mock(Connection::class) + ->shouldReceive('ping') + ->andReturn(true) + ->getMock() + ->shouldReceive('isAlive') + ->andReturn(true) + ->getMock(); + + $connections = [$mockConnection]; + + $selector = m::mock(RoundRobinSelector::class) + ->shouldReceive('select') + ->andReturn($connections[0]) + ->getMock(); + + $connectionFactory = m::mock(ConnectionFactory::class); + + $connectionPoolParams = ['randomizeHosts' => false]; + $connectionPool = new SniffingConnectionPool($connections, $selector, $connectionFactory, $connectionPoolParams); + + $retConnection = $connectionPool->nextConnection(); + + $this->assertSame($mockConnection, $retConnection); + } + + public function testAddOneHostAndTriggerSniff() + { + $clusterState = json_decode('{"ok":true,"cluster_name":"elasticsearch_zach","nodes":{"Bl2ihSr7TcuUHxhu1GA_YQ":{"name":"Vesta","transport_address":"inet[/192.168.1.119:9300]","hostname":"zach-ThinkPad-W530","version":"0.90.5","http_address":"inet[/192.168.1.119:9200]"}}}', true); + + $mockConnection = m::mock(Connection::class) + ->shouldReceive('ping')->andReturn(true)->getMock() + ->shouldReceive('isAlive')->andReturn(true)->getMock() + ->shouldReceive('getTransportSchema')->once()->andReturn('http')->getMock() + ->shouldReceive('sniff')->once()->andReturn($clusterState)->getMock(); + + $connections = [$mockConnection]; + $mockNewConnection = m::mock(Connection::class) + ->shouldReceive('isAlive')->andReturn(true)->getMock(); + + $selector = m::mock(RoundRobinSelector::class) + ->shouldReceive('select')->twice() + ->andReturn($mockNewConnection) + ->getMock(); + + $connectionFactory = m::mock(ConnectionFactory::class) + ->shouldReceive('create')->with(['host' => '192.168.1.119', 'port' => 9200])->andReturn($mockNewConnection)->getMock(); + + $connectionPoolParams = [ + 'randomizeHosts' => false, + 'sniffingInterval' => -1 + ]; + $connectionPool = new SniffingConnectionPool($connections, $selector, $connectionFactory, $connectionPoolParams); + + $retConnection = $connectionPool->nextConnection(); + + $this->assertSame($mockNewConnection, $retConnection); + } + + public function testAddOneHostAndForceNext() + { + $clusterState = json_decode('{"ok":true,"cluster_name":"elasticsearch_zach","nodes":{"Bl2ihSr7TcuUHxhu1GA_YQ":{"name":"Vesta","transport_address":"inet[/192.168.1.119:9300]","hostname":"zach-ThinkPad-W530","version":"0.90.5","http_address":"inet[/192.168.1.119:9200]"}}}', true); + + $mockConnection = m::mock(Connection::class) + ->shouldReceive('ping')->andReturn(true)->getMock() + ->shouldReceive('isAlive')->andReturn(true)->getMock() + ->shouldReceive('getTransportSchema')->once()->andReturn('http')->getMock() + ->shouldReceive('sniff')->once()->andReturn($clusterState)->getMock(); + + $connections = [$mockConnection]; + $mockNewConnection = m::mock(Connection::class) + ->shouldReceive('isAlive')->andReturn(true)->getMock(); + + $selector = m::mock(RoundRobinSelector::class) + ->shouldReceive('select')->once()->andReturn($mockConnection)->getMock() + ->shouldReceive('select')->once()->andReturn($mockNewConnection)->getMock(); + + $connectionFactory = m::mock(ConnectionFactory::class) + ->shouldReceive('create')->with(['host' => '192.168.1.119', 'port' => 9200])->andReturn($mockNewConnection)->getMock(); + + $connectionPoolParams = [ + 'randomizeHosts' => false + ]; + $connectionPool = new SniffingConnectionPool($connections, $selector, $connectionFactory, $connectionPoolParams); + + $retConnection = $connectionPool->nextConnection(true); + + $this->assertSame($mockNewConnection, $retConnection); + } + + public function testAddTenNodesThenGetConnection() + { + $connections = []; + + foreach (range(1, 10) as $index) { + $mockConnection = m::mock(Connection::class) + ->shouldReceive('ping') + ->andReturn(true) + ->getMock() + ->shouldReceive('isAlive') + ->andReturn(true) + ->getMock(); + + $connections[] = $mockConnection; + } + + $selector = m::mock(RoundRobinSelector::class) + ->shouldReceive('select') + ->andReturn($connections[0]) + ->getMock(); + + $connectionFactory = m::mock(ConnectionFactory::class); + + $connectionPoolParams = ['randomizeHosts' => false]; + $connectionPool = new SniffingConnectionPool($connections, $selector, $connectionFactory, $connectionPoolParams); + + $retConnection = $connectionPool->nextConnection(); + + $this->assertSame($connections[0], $retConnection); + } + + public function testAddTenNodesTimeoutAllButLast() + { + $connections = []; + + foreach (range(1, 9) as $index) { + $mockConnection = m::mock(Connection::class) + ->shouldReceive('ping') + ->andReturn(false) + ->getMock() + ->shouldReceive('isAlive') + ->andReturn(false) + ->getMock(); + + $connections[] = $mockConnection; + } + + $mockConnection = m::mock(Connection::class) + ->shouldReceive('ping') + ->andReturn(true) + ->getMock() + ->shouldReceive('isAlive') + ->andReturn(true) + ->getMock(); + + $connections[] = $mockConnection; + + $selector = m::mock(RoundRobinSelector::class) + ->shouldReceive('select') + ->andReturnValues($connections) + ->getMock(); + + $connectionFactory = m::mock(ConnectionFactory::class); + + $connectionPoolParams = ['randomizeHosts' => false]; + $connectionPool = new SniffingConnectionPool($connections, $selector, $connectionFactory, $connectionPoolParams); + + $retConnection = $connectionPool->nextConnection(); + + $this->assertSame($connections[9], $retConnection); + } + + public function testAddTenNodesAllTimeout() + { + $connections = []; + + foreach (range(1, 10) as $index) { + $mockConnection = m::mock(Connection::class) + ->shouldReceive('ping') + ->andReturn(false) + ->getMock() + ->shouldReceive('isAlive') + ->andReturn(false) + ->getMock(); + + $connections[] = $mockConnection; + } + + $selector = m::mock(RoundRobinSelector::class) + ->shouldReceive('select') + ->andReturnValues($connections) + ->getMock(); + + $connectionFactory = m::mock(ConnectionFactory::class); + + $connectionPoolParams = ['randomizeHosts' => false]; + $connectionPool = new SniffingConnectionPool($connections, $selector, $connectionFactory, $connectionPoolParams); + + $this->expectException(\Elasticsearch\Common\Exceptions\NoNodesAvailableException::class); + $this->expectExceptionMessage('No alive nodes found in your cluster'); + + $retConnection = $connectionPool->nextConnection(); + } + + public function testAddOneHostSniffTwo() + { + $clusterState = json_decode('{"ok":true,"cluster_name":"elasticsearch_zach","nodes":{"node1":{"name":"Vesta","transport_address":"inet[/192.168.1.119:9300]","hostname":"zach-ThinkPad-W530","version":"0.90.5","http_address":"inet[/192.168.1.119:9200]"}, "node2":{"name":"Vesta","transport_address":"inet[/192.168.1.119:9301]","hostname":"zach-ThinkPad-W530","version":"0.90.5","http_address":"inet[/192.168.1.119:9201]"}}}', true); + + $mockConnection = m::mock(Connection::class) + ->shouldReceive('ping')->andReturn(true)->getMock() + ->shouldReceive('isAlive')->andReturn(true)->getMock() + ->shouldReceive('getTransportSchema')->twice()->andReturn('http')->getMock() + ->shouldReceive('sniff')->twice()->andReturn($clusterState)->getMock(); + + $connections = [$mockConnection]; + + $newConnections = []; + $newConnections[] = m::mock(Connection::class) + ->shouldReceive('isAlive')->andReturn(true)->getMock(); + + $newConnections[] = m::mock(Connection::class) + ->shouldReceive('isAlive')->andReturn(true)->getMock(); + + $selector = m::mock(RoundRobinSelector::class) + ->shouldReceive('select') + ->andReturnValues([ //selects provided node first, then the new cluster list + $mockConnection, + $newConnections[0], + $newConnections[1] + ]) + ->getMock(); + + $connectionFactory = m::mock(ConnectionFactory::class) + ->shouldReceive('create')->with(['host' => '192.168.1.119', 'port' => 9200])->andReturn($newConnections[0])->getMock() + ->shouldReceive('create')->with(['host' => '192.168.1.119', 'port' => 9201])->andReturn($newConnections[1])->getMock(); + + $connectionPoolParams = [ + 'randomizeHosts' => false, + 'sniffingInterval' => -1 + ]; + $connectionPool = new SniffingConnectionPool($connections, $selector, $connectionFactory, $connectionPoolParams); + + $retConnection = $connectionPool->nextConnection(); + $this->assertSame($newConnections[0], $retConnection); + + $retConnection = $connectionPool->nextConnection(); + $this->assertSame($newConnections[1], $retConnection); + } + + public function testAddSeedSniffTwoTimeoutTwo() + { + $clusterState = json_decode('{"ok":true,"cluster_name":"elasticsearch_zach","nodes":{"node1":{"name":"Vesta","transport_address":"inet[/192.168.1.119:9300]","hostname":"zach-ThinkPad-W530","version":"0.90.5","http_address":"inet[/192.168.1.119:9200]"}, "node2":{"name":"Vesta","transport_address":"inet[/192.168.1.119:9301]","hostname":"zach-ThinkPad-W530","version":"0.90.5","http_address":"inet[/192.168.1.119:9201]"}}}', true); + + $mockConnection = m::mock(Connection::class) + ->shouldReceive('ping')->andReturn(true)->getMock() + ->shouldReceive('isAlive')->andReturn(true)->getMock() + ->shouldReceive('getTransportSchema')->once()->andReturn('http')->getMock() + ->shouldReceive('sniff')->once()->andReturn($clusterState)->getMock(); + + $connections = [$mockConnection]; + + $newConnections = []; + $newConnections[] = m::mock(Connection::class) + ->shouldReceive('isAlive')->andReturn(false)->getMock() + ->shouldReceive('ping')->andReturn(false)->getMock(); + + $newConnections[] = m::mock(Connection::class) + ->shouldReceive('isAlive')->andReturn(false)->getMock() + ->shouldReceive('ping')->andReturn(false)->getMock(); + + $selector = m::mock(RoundRobinSelector::class) + ->shouldReceive('select') + ->andReturnValues([ //selects provided node first, then the new cluster list + $mockConnection, + $newConnections[0], + $newConnections[1] + ]) + ->getMock(); + + $connectionFactory = m::mock(ConnectionFactory::class) + ->shouldReceive('create')->with(['host' => '192.168.1.119', 'port' => 9200])->andReturn($newConnections[0])->getMock() + ->shouldReceive('create')->with(['host' => '192.168.1.119', 'port' => 9201])->andReturn($newConnections[1])->getMock(); + + $connectionPoolParams = [ + 'randomizeHosts' => false, + 'sniffingInterval' => -1 + ]; + $connectionPool = new SniffingConnectionPool($connections, $selector, $connectionFactory, $connectionPoolParams); + + $this->expectException(\Elasticsearch\Common\Exceptions\NoNodesAvailableException::class); + $this->expectExceptionMessage('No alive nodes found in your cluster'); + + $retConnection = $connectionPool->nextConnection(); + } + + public function testTenTimeoutNineSniffTenthAddTwoAlive() + { + $clusterState = json_decode('{"ok":true,"cluster_name":"elasticsearch_zach","nodes":{"node1":{"name":"Vesta","transport_address":"inet[/192.168.1.119:9300]","hostname":"zach-ThinkPad-W530","version":"0.90.5","http_address":"inet[/192.168.1.119:9200]"}, "node2":{"name":"Vesta","transport_address":"inet[/192.168.1.119:9301]","hostname":"zach-ThinkPad-W530","version":"0.90.5","http_address":"inet[/192.168.1.119:9201]"}}}', true); + + $connections = []; + + foreach (range(1, 10) as $index) { + $mockConnection = m::mock(Connection::class) + ->shouldReceive('ping')->andReturn(false)->getMock() + ->shouldReceive('isAlive')->andReturn(true)->getMock() + ->shouldReceive('sniff')->andThrow(OperationTimeoutException::class)->getMock(); + + $connections[] = $mockConnection; + } + + $mockConnection = m::mock(Connection::class) + ->shouldReceive('ping')->andReturn(true)->getMock() + ->shouldReceive('isAlive')->andReturn(true)->getMock() + ->shouldReceive('sniff')->andReturn($clusterState)->getMock() + ->shouldReceive('getTransportSchema')->twice()->andReturn('http')->getMock(); + + $connections[] = $mockConnection; + + $newConnections = $connections; + $newConnections[] = m::mock(Connection::class) + ->shouldReceive('isAlive')->andReturn(true)->getMock() + ->shouldReceive('ping')->andReturn(true)->getMock(); + + $newConnections[] = m::mock(Connection::class) + ->shouldReceive('isAlive')->andReturn(true)->getMock() + ->shouldReceive('ping')->andReturn(true)->getMock(); + + $selector = m::mock(RoundRobinSelector::class) + ->shouldReceive('select') + ->andReturnValues($newConnections) + ->getMock(); + + $connectionFactory = m::mock(ConnectionFactory::class) + ->shouldReceive('create')->with(['host' => '192.168.1.119', 'port' => 9200])->andReturn($newConnections[10])->getMock() + ->shouldReceive('create')->with(['host' => '192.168.1.119', 'port' => 9201])->andReturn($newConnections[11])->getMock(); + + $connectionPoolParams = [ + 'randomizeHosts' => false, + 'sniffingInterval' => -1 + ]; + $connectionPool = new SniffingConnectionPool($connections, $selector, $connectionFactory, $connectionPoolParams); + + $retConnection = $connectionPool->nextConnection(); + $this->assertSame($newConnections[11], $retConnection); + + $retConnection = $connectionPool->nextConnection(); + $this->assertSame($newConnections[12], $retConnection); + } + + public function testTenTimeoutNineSniffTenthAddTwoDeadTimeoutEveryone() + { + $clusterState = json_decode('{"ok":true,"cluster_name":"elasticsearch_zach","nodes":{"node1":{"name":"Vesta","transport_address":"inet[/192.168.1.119:9300]","hostname":"zach-ThinkPad-W530","version":"0.90.5","http_address":"inet[/192.168.1.119:9200]"}, "node2":{"name":"Vesta","transport_address":"inet[/192.168.1.119:9301]","hostname":"zach-ThinkPad-W530","version":"0.90.5","http_address":"inet[/192.168.1.119:9201]"}}}', true); + + $connections = []; + + foreach (range(1, 10) as $index) { + $mockConnection = m::mock(Connection::class) + ->shouldReceive('ping')->andReturn(false)->getMock() + ->shouldReceive('isAlive')->andReturn(true)->getMock() + ->shouldReceive('sniff')->andThrow(OperationTimeoutException::class)->getMock(); + + $connections[] = $mockConnection; + } + + $mockConnection = m::mock(Connection::class) + ->shouldReceive('ping')->andReturn(true)->getMock() + ->shouldReceive('isAlive')->andReturn(true)->getMock() + ->shouldReceive('sniff')->andReturn($clusterState)->getMock() + ->shouldReceive('getTransportSchema')->once()->andReturn('http')->getMock() + ->shouldReceive('sniff')->andThrow(OperationTimeoutException::class)->getMock(); + + $connections[] = $mockConnection; + + $newConnections = $connections; + $newConnections[] = m::mock(Connection::class) + ->shouldReceive('isAlive')->andReturn(false)->getMock() + ->shouldReceive('ping')->andReturn(false)->getMock() + ->shouldReceive('sniff')->andThrow(OperationTimeoutException::class)->getMock(); + + $newConnections[] = m::mock(Connection::class) + ->shouldReceive('isAlive')->andReturn(false)->getMock() + ->shouldReceive('ping')->andReturn(false)->getMock() + ->shouldReceive('sniff')->andThrow(OperationTimeoutException::class)->getMock(); + + $selector = m::mock(RoundRobinSelector::class) + ->shouldReceive('select') + ->andReturnValues($newConnections) + ->getMock(); + + $connectionFactory = m::mock(ConnectionFactory::class) + ->shouldReceive('create')->with(['host' => '192.168.1.119', 'port' => 9200])->andReturn($newConnections[10])->getMock() + ->shouldReceive('create')->with(['host' => '192.168.1.119', 'port' => 9201])->andReturn($newConnections[11])->getMock(); + + $connectionPoolParams = [ + 'randomizeHosts' => false, + 'sniffingInterval' => -1 + ]; + $connectionPool = new SniffingConnectionPool($connections, $selector, $connectionFactory, $connectionPoolParams); + + $this->expectException(\Elasticsearch\Common\Exceptions\NoNodesAvailableException::class); + $this->expectExceptionMessage('No alive nodes found in your cluster'); + + $retConnection = $connectionPool->nextConnection(); + } +} diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/tests/Elasticsearch/Tests/ConnectionPool/StaticConnectionPoolIntegrationTest.php b/openml_OS/vendor/elasticsearch/elasticsearch/tests/Elasticsearch/Tests/ConnectionPool/StaticConnectionPoolIntegrationTest.php new file mode 100644 index 000000000..8251701fb --- /dev/null +++ b/openml_OS/vendor/elasticsearch/elasticsearch/tests/Elasticsearch/Tests/ConnectionPool/StaticConnectionPoolIntegrationTest.php @@ -0,0 +1,38 @@ + + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elasticsearch.org + */ +class StaticConnectionPoolIntegrationTest extends \PHPUnit\Framework\TestCase +{ + // Issue #636 + public function test404Liveness() + { + $client = \Elasticsearch\ClientBuilder::create() + ->setHosts([$_SERVER['ES_TEST_HOST']]) + ->setConnectionPool(\Elasticsearch\ConnectionPool\StaticConnectionPool::class) + ->build(); + + $connection = $client->transport->getConnection(); + + // Ensure connection is dead + $connection->markDead(); + + // The index doesn't exist, but the server is up so this will return a 404 + $this->assertFalse($client->indices()->exists(['index' => 'not_existing_index'])); + + // But the node should be marked as alive since the server responded + $this->assertTrue($connection->isAlive()); + } +} diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/tests/Elasticsearch/Tests/ConnectionPool/StaticConnectionPoolTest.php b/openml_OS/vendor/elasticsearch/elasticsearch/tests/Elasticsearch/Tests/ConnectionPool/StaticConnectionPoolTest.php new file mode 100644 index 000000000..a87768869 --- /dev/null +++ b/openml_OS/vendor/elasticsearch/elasticsearch/tests/Elasticsearch/Tests/ConnectionPool/StaticConnectionPoolTest.php @@ -0,0 +1,245 @@ + + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elasticsearch.org + */ +class StaticConnectionPoolTest extends \PHPUnit\Framework\TestCase +{ + public function tearDown() + { + m::close(); + } + + public function testAddOneHostThenGetConnection() + { + $mockConnection = m::mock(Connection::class) + ->shouldReceive('ping') + ->andReturn(true) + ->getMock() + ->shouldReceive('isAlive') + ->andReturn(true) + ->getMock() + ->shouldReceive('markDead')->once()->getMock(); + + $connections = [$mockConnection]; + + $selector = m::mock(RoundRobinSelector::class) + ->shouldReceive('select') + ->andReturn($connections[0]) + ->getMock(); + + $connectionFactory = m::mock(ConnectionFactory::class); + + $connectionPoolParams = [ + 'randomizeHosts' => false, + ]; + $connectionPool = new StaticConnectionPool($connections, $selector, $connectionFactory, $connectionPoolParams); + + $retConnection = $connectionPool->nextConnection(); + + $this->assertSame($mockConnection, $retConnection); + } + + public function testAddMultipleHostsThenGetFirst() + { + $connections = []; + + foreach (range(1, 10) as $index) { + $mockConnection = m::mock(Connection::class) + ->shouldReceive('ping') + ->andReturn(true) + ->getMock() + ->shouldReceive('isAlive') + ->andReturn(true) + ->getMock() + ->shouldReceive('markDead')->once()->getMock(); + + $connections[] = $mockConnection; + } + + $selector = m::mock(RoundRobinSelector::class) + ->shouldReceive('select') + ->andReturn($connections[0]) + ->getMock(); + + $connectionFactory = m::mock(ConnectionFactory::class); + + $connectionPoolParams = [ + 'randomizeHosts' => false, + ]; + $connectionPool = new StaticConnectionPool($connections, $selector, $connectionFactory, $connectionPoolParams); + + $retConnection = $connectionPool->nextConnection(); + + $this->assertSame($connections[0], $retConnection); + } + + public function testAllHostsFailPing() + { + $connections = []; + + foreach (range(1, 10) as $index) { + $mockConnection = m::mock(Connection::class) + ->shouldReceive('ping') + ->andReturn(false) + ->getMock() + ->shouldReceive('isAlive') + ->andReturn(false) + ->getMock() + ->shouldReceive('markDead')->once()->getMock() + ->shouldReceive('getPingFailures')->andReturn(0)->once()->getMock() + ->shouldReceive('getLastPing')->andReturn(time())->once()->getMock(); + + $connections[] = $mockConnection; + } + + $selector = m::mock(RoundRobinSelector::class) + ->shouldReceive('select') + ->andReturnValues($connections) + ->getMock(); + + $connectionFactory = m::mock(ConnectionFactory::class); + + $connectionPoolParams = [ + 'randomizeHosts' => false, + ]; + $connectionPool = new StaticConnectionPool($connections, $selector, $connectionFactory, $connectionPoolParams); + + $this->expectException(\Elasticsearch\Common\Exceptions\NoNodesAvailableException::class); + $this->expectExceptionMessage('No alive nodes found in your cluster'); + + $this->expectException(\Elasticsearch\Common\Exceptions\NoNodesAvailableException::class); + $this->expectExceptionMessage('No alive nodes found in your cluster'); + + $connectionPool->nextConnection(); + } + + public function testAllExceptLastHostFailPingRevivesInSkip() + { + $connections = []; + + foreach (range(1, 9) as $index) { + $mockConnection = m::mock(Connection::class) + ->shouldReceive('ping') + ->andReturn(false) + ->getMock() + ->shouldReceive('isAlive') + ->andReturn(false) + ->getMock() + ->shouldReceive('markDead')->once()->getMock() + ->shouldReceive('getPingFailures')->andReturn(0)->once()->getMock() + ->shouldReceive('getLastPing')->andReturn(time())->once()->getMock(); + + $connections[] = $mockConnection; + } + + $goodConnection = m::mock(Connection::class) + ->shouldReceive('ping')->once() + ->andReturn(true) + ->getMock() + ->shouldReceive('isAlive')->once() + ->andReturn(false) + ->getMock() + ->shouldReceive('markDead')->once()->getMock() + ->shouldReceive('getPingFailures')->andReturn(0)->once()->getMock() + ->shouldReceive('getLastPing')->andReturn(time())->once()->getMock(); + + $connections[] = $goodConnection; + + $selector = m::mock(RoundRobinSelector::class) + ->shouldReceive('select') + ->andReturnValues($connections) + ->getMock(); + + $connectionFactory = m::mock(ConnectionFactory::class); + + $connectionPoolParams = [ + 'randomizeHosts' => false, + ]; + $connectionPool = new StaticConnectionPool($connections, $selector, $connectionFactory, $connectionPoolParams); + + $ret = $connectionPool->nextConnection(); + $this->assertSame($goodConnection, $ret); + } + + public function testAllExceptLastHostFailPingRevivesPreSkip() + { + $connections = []; + + foreach (range(1, 9) as $index) { + $mockConnection = m::mock(Connection::class) + ->shouldReceive('ping') + ->andReturn(false) + ->getMock() + ->shouldReceive('isAlive') + ->andReturn(false) + ->getMock() + ->shouldReceive('markDead')->once()->getMock() + ->shouldReceive('getPingFailures')->andReturn(0)->once()->getMock() + ->shouldReceive('getLastPing')->andReturn(time())->once()->getMock(); + + $connections[] = $mockConnection; + } + + $goodConnection = m::mock(Connection::class) + ->shouldReceive('ping')->once() + ->andReturn(true) + ->getMock() + ->shouldReceive('isAlive')->once() + ->andReturn(false) + ->getMock() + ->shouldReceive('markDead')->once()->getMock() + ->shouldReceive('getPingFailures')->andReturn(0)->once()->getMock() + ->shouldReceive('getLastPing')->andReturn(time()-10000)->once()->getMock(); + + $connections[] = $goodConnection; + + $selector = m::mock(RoundRobinSelector::class) + ->shouldReceive('select') + ->andReturnValues($connections) + ->getMock(); + + $connectionFactory = m::mock(ConnectionFactory::class); + + $connectionPoolParams = [ + 'randomizeHosts' => false, + ]; + $connectionPool = new StaticConnectionPool($connections, $selector, $connectionFactory, $connectionPoolParams); + + $ret = $connectionPool->nextConnection(); + $this->assertSame($goodConnection, $ret); + } + + public function testCustomConnectionPoolIT() + { + $clientBuilder = \Elasticsearch\ClientBuilder::create(); + $clientBuilder->setHosts(['localhost:1']); + $client = $clientBuilder + ->setRetries(0) + ->setConnectionPool(StaticConnectionPool::class, []) + ->build(); + + $this->expectException(Elasticsearch\Common\Exceptions\NoNodesAvailableException::class); + $this->expectExceptionMessage('No alive nodes found in your cluster'); + + $client->search([]); + } +} diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/tests/Elasticsearch/Tests/Endpoints/AbstractEndpointTest.php b/openml_OS/vendor/elasticsearch/elasticsearch/tests/Elasticsearch/Tests/Endpoints/AbstractEndpointTest.php new file mode 100644 index 000000000..81fddf50d --- /dev/null +++ b/openml_OS/vendor/elasticsearch/elasticsearch/tests/Elasticsearch/Tests/Endpoints/AbstractEndpointTest.php @@ -0,0 +1,38 @@ + 10]], + [['invalid' => 10, 'invalid2' => 'another']], + ]; + } + + /** + * @dataProvider invalidParameters + * @expectedException \Elasticsearch\Common\Exceptions\UnexpectedValueException + */ + public function testInvalidParamsCauseErrorsWhenProvidedToSetParams(array $params) + { + $this->endpoint->expects($this->once()) + ->method('getParamWhitelist') + ->willReturn(['one', 'two']); + + $this->endpoint->setParams($params); + } + + protected function setUp() + { + $this->endpoint = $this->getMockForAbstractClass(AbstractEndpoint::class); + } +} diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/tests/Elasticsearch/Tests/Helper/Iterators/SearchResponseIteratorTest.php b/openml_OS/vendor/elasticsearch/elasticsearch/tests/Elasticsearch/Tests/Helper/Iterators/SearchResponseIteratorTest.php new file mode 100644 index 000000000..ae5a1b9e5 --- /dev/null +++ b/openml_OS/vendor/elasticsearch/elasticsearch/tests/Elasticsearch/Tests/Helper/Iterators/SearchResponseIteratorTest.php @@ -0,0 +1,171 @@ + + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://Elasticsearch.org + */ +class SearchResponseIteratorTest extends \PHPUnit\Framework\TestCase +{ + + public function tearDown() + { + m::close(); + } + + public function testWithNoResults() + { + $search_params = [ + 'scroll' => '5m', + 'index' => 'twitter', + 'size' => 1000, + 'body' => [ + 'query' => [ + 'match_all' => new \StdClass + ] + ] + ]; + + $mock_client = m::mock(Client::class); + + $mock_client->shouldReceive('search') + ->once() + ->ordered() + ->with($search_params) + ->andReturn(['_scroll_id' => 'scroll_id_01']); + + $mock_client->shouldReceive('scroll') + ->never(); + + $mock_client->shouldReceive('clearScroll') + ->once() + ->ordered() + ->withAnyArgs(); + + + $responses = new SearchResponseIterator($mock_client, $search_params); + + $this->assertCount(0, $responses); + } + + public function testWithHits() + { + $search_params = [ + 'scroll' => '5m', + 'index' => 'twitter', + 'size' => 1000, + 'body' => [ + 'query' => [ + 'match_all' => new \StdClass + ] + ] + ]; + + $mock_client = m::mock(Client::class); + + $mock_client->shouldReceive('search') + ->once() + ->ordered() + ->with($search_params) + ->andReturn([ + '_scroll_id' => 'scroll_id_01', + 'hits' => [ + 'hits' => [ + [ + 'foo' => 'bar' + ] + ] + ] + ]); + + $mock_client->shouldReceive('scroll') + ->once() + ->ordered() + ->with( + [ + 'scroll_id' => 'scroll_id_01', + 'scroll' => '5m' + ] + ) + ->andReturn( + [ + '_scroll_id' => 'scroll_id_02', + 'hits' => [ + 'hits' => [ + [ + 'foo' => 'bar' + ] + ] + ] + ] + ); + + $mock_client->shouldReceive('scroll') + ->once() + ->ordered() + ->with( + [ + 'scroll_id' => 'scroll_id_02', + 'scroll' => '5m' + ] + ) + ->andReturn( + [ + '_scroll_id' => 'scroll_id_03', + 'hits' => [ + 'hits' => [ + [ + 'foo' => 'bar' + ] + ] + ] + ] + ); + + $mock_client->shouldReceive('scroll') + ->once() + ->ordered() + ->with( + [ + 'scroll_id' => 'scroll_id_03', + 'scroll' => '5m' + ] + ) + ->andReturn( + [ + '_scroll_id' => 'scroll_id_04', + 'hits' => [ + 'hits' => [] + ] + ] + ); + + $mock_client->shouldReceive('scroll') + ->never() + ->with( + [ + 'scroll_id' => 'scroll_id_04', + 'scroll' => '5m' + ] + ); + + $mock_client->shouldReceive('clearScroll') + ->once() + ->ordered() + ->withAnyArgs(); + + $responses = new SearchResponseIterator($mock_client, $search_params); + + $this->assertCount(4, $responses); + } +} diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/tests/Elasticsearch/Tests/RegisteredNamespaceTest.php b/openml_OS/vendor/elasticsearch/elasticsearch/tests/Elasticsearch/Tests/RegisteredNamespaceTest.php new file mode 100644 index 000000000..910580031 --- /dev/null +++ b/openml_OS/vendor/elasticsearch/elasticsearch/tests/Elasticsearch/Tests/RegisteredNamespaceTest.php @@ -0,0 +1,69 @@ + + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elasticsearch.org + */ +class RegisteredNamespaceTest extends \PHPUnit\Framework\TestCase +{ + public function tearDown() + { + m::close(); + } + + public function testRegisteringNamespace() + { + $builder = new FooNamespaceBuilder(); + $client = ClientBuilder::create()->registerNamespace($builder)->build(); + $this->assertSame("123", $client->foo()->fooMethod()); + } + + /** + * @expectedException \Elasticsearch\Common\Exceptions\BadMethodCallException + */ + public function testNonExistingNamespace() + { + $builder = new FooNamespaceBuilder(); + $client = ClientBuilder::create()->registerNamespace($builder)->build(); + $this->assertSame("123", $client->bar()->fooMethod()); + } +} + +// @codingStandardsIgnoreStart "Each class must be in a file by itself" - not worth the extra work here +class FooNamespaceBuilder implements Elasticsearch\Namespaces\NamespaceBuilderInterface +{ + public function getName() + { + return "foo"; + } + + public function getObject(Transport $transport, SerializerInterface $serializer) + { + return new FooNamespace(); + } +} + +class FooNamespace +{ + public function fooMethod() + { + return "123"; + } +} +// @codingStandardsIgnoreEnd diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/tests/Elasticsearch/Tests/Serializers/ArrayToJSONSerializerTest.php b/openml_OS/vendor/elasticsearch/elasticsearch/tests/Elasticsearch/Tests/Serializers/ArrayToJSONSerializerTest.php new file mode 100644 index 000000000..280b3ef74 --- /dev/null +++ b/openml_OS/vendor/elasticsearch/elasticsearch/tests/Elasticsearch/Tests/Serializers/ArrayToJSONSerializerTest.php @@ -0,0 +1,53 @@ + 'field']; + + $ret = $serializer->serialize($body); + + $body = json_encode($body, JSON_PRESERVE_ZERO_FRACTION); + $this->assertSame($body, $ret); + } + + public function testSerializeString() + { + $serializer = new ArrayToJSONSerializer(); + $body = 'abc'; + + $ret = $serializer->serialize($body); + + $this->assertSame($body, $ret); + } + + public function testDeserializeJSON() + { + $serializer = new ArrayToJSONSerializer(); + $body = '{"field":"value"}'; + + $ret = $serializer->deserialize($body, []); + + $body = json_decode($body, true); + $this->assertSame($body, $ret); + } +} diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/tests/Elasticsearch/Tests/Serializers/EverythingToJSONSerializerTest.php b/openml_OS/vendor/elasticsearch/elasticsearch/tests/Elasticsearch/Tests/Serializers/EverythingToJSONSerializerTest.php new file mode 100644 index 000000000..606e795c8 --- /dev/null +++ b/openml_OS/vendor/elasticsearch/elasticsearch/tests/Elasticsearch/Tests/Serializers/EverythingToJSONSerializerTest.php @@ -0,0 +1,54 @@ + 'field']; + + $ret = $serializer->serialize($body); + + $body = json_encode($body, JSON_PRESERVE_ZERO_FRACTION); + $this->assertSame($body, $ret); + } + + public function testSerializeString() + { + $serializer = new EverythingToJSONSerializer(); + $body = 'abc'; + + $ret = $serializer->serialize($body); + + $body = '"abc"'; + $this->assertSame($body, $ret); + } + + public function testDeserializeJSON() + { + $serializer = new EverythingToJSONSerializer(); + $body = '{"field":"value"}'; + + $ret = $serializer->deserialize($body, []); + + $body = json_decode($body, true); + $this->assertSame($body, $ret); + } +} diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/tests/Elasticsearch/Tests/YamlRunnerTest.php b/openml_OS/vendor/elasticsearch/elasticsearch/tests/Elasticsearch/Tests/YamlRunnerTest.php new file mode 100644 index 000000000..3c6b2336b --- /dev/null +++ b/openml_OS/vendor/elasticsearch/elasticsearch/tests/Elasticsearch/Tests/YamlRunnerTest.php @@ -0,0 +1,1094 @@ + + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elasticsearch.org + */ +class YamlRunnerTest extends \PHPUnit\Framework\TestCase +{ + /** @var \Symfony\Component\Yaml\Yaml Yaml parser for reading integrations tests */ + private $yaml; + + /** @var Elasticsearch\Client client used by elasticsearch */ + private $client; + + /** @var string Es version */ + private static $esVersion; + + /** @var array A list of supported features */ + private static $supportedFeatures = [ + 'stash_in_path', 'warnings', 'headers' + ]; + + /** @var array A mapping for endpoint when there is a reserved keywords for the method / namespace name */ + private static $endpointMapping = [ + 'tasks' => [ + 'list' => ['tasksList', 'tasks'], + ], + ]; + + private static $skippedTests = [ + + ]; + + /** @var array A list of skipped test with their reasons */ + private static $skippedFiles = [ + + 'cat.nodeattrs/10_basic.yml' => 'Using java regex fails in PHP', + 'cat.nodeattrs/10_basic.yaml' => 'Using java regex fails in PHP', + + 'cat.repositories/10_basic.yml' => 'Using java regex fails in PHP', + 'cat.repositories/10_basic.yaml' => 'Using java regex fails in PHP', + + 'indices.shrink/10_basic.yml' => 'Shrink tests seem to require multiple nodes', + 'indices.shrink/10_basic.yaml' => 'Shrink tests seem to require multiple nodes', + + 'indices.rollover/10_basic.yml' => 'Rollover test seems buggy atm', + 'indices.rollover/10_basic.yaml' => 'Rollover test seems buggy atm', + + ]; + + /** @var array A list of files to skip completely, due to fatal parsing errors */ + private static $fatalFiles = [ + 'indices.create/10_basic.yml' => 'Temporary: Yaml parser doesnt support "inline" empty keys', + 'indices.create/10_basic.yaml' => 'Temporary: Yaml parser doesnt support "inline" empty keys', + + 'indices.put_mapping/10_basic.yml' => 'Temporary: Yaml parser doesnt support "inline" empty keys', + 'indices.put_mapping/10_basic.yaml' => 'Temporary: Yaml parser doesnt support "inline" empty keys', + + 'search/110_field_collapsing.yml' => 'Temporary: parse error, malformed inline yaml', + 'search/110_field_collapsing.yaml' => 'Temporary: parse error, malformed inline yaml', + + 'cat.nodes/10_basic.yml' => 'Temporary: parse error, something about $body: |', + 'cat.nodes/10_basic.yaml' => 'Temporary: parse error, something about $body: |', + 'search.aggregation/180_percentiles_tdigest_metric.yml' => 'array of objects, unclear how to fix', + 'search.aggregation/190_percentiles_hdr_metric.yml' => 'array of objects, unclear how to fix' + ]; + + /** + * Return the elasticsearch host + * + * @return string + */ + public static function getHost() + { + if (isset($_SERVER['ES_TEST_HOST']) === true) { + return $_SERVER['ES_TEST_HOST']; + } + + echo 'Environment variable for elasticsearch test cluster (ES_TEST_HOST) not defined. Exiting yaml test'; + exit; + } + + + public static function setUpBeforeClass() + { + $host = static::getHost(); + echo "Test Host: $host\n"; + + $ch = curl_init($host); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET"); + curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); + + $response = curl_exec($ch); + curl_close($ch); + + $response = json_decode($response, true); + static::$esVersion = $response['version']['number']; + echo "ES Version: ".static::$esVersion."\n"; + } + + public function setUp() + { + $this->clean(); + $this->client = Elasticsearch\ClientBuilder::create()->setHosts([self::getHost()])->build(); + } + + /** + * @dataProvider yamlProvider + * @group sync + */ + public function testIntegration($testProcedure, $skip, $setupProcedure, $fileName) + { + if ($skip) { + static::markTestIncomplete($testProcedure); + } + + if (array_key_exists($fileName, static::$skippedFiles)) { + static::markTestSkipped(static::$skippedFiles[$fileName]); + } + + if (null !== $setupProcedure) { + $this->processProcedure(current($setupProcedure), 'setup', $fileName); + $this->waitForYellow(); + } + + $this->processProcedure(current($testProcedure), key($testProcedure), $fileName); + } + + /** + * @dataProvider yamlProvider + * @group async + */ + public function testAsyncIntegration($testProcedure, $skip, $setupProcedure, $fileName) + { + if ($skip) { + static::markTestIncomplete($testProcedure); + } + + if (array_key_exists($fileName, static::$skippedFiles)) { + static::markTestSkipped(static::$skippedFiles[$fileName]); + } + + if (null !== $setupProcedure) { + $this->processProcedure(current($setupProcedure), 'setup', $fileName); + $this->waitForYellow(); + } + + $this->processProcedure(current($testProcedure), key($testProcedure), $fileName, true); + } + + /** + * Process a procedure + * + * @param $procedure + * @param $name + * @param bool $async + */ + public function processProcedure($procedure, $name, $fileName, $async = false) + { + $lastOperationResult = null; + $context = []; + + if (array_key_exists("$fileName#$name", static::$skippedTests)) { + static::markTestSkipped(static::$skippedTests["$fileName#$name"]); + } + + foreach ($procedure as $operation) { + $lastOperationResult = $this->processOperation($operation, $lastOperationResult, $context, $name, $async); + } + } + + /** + * Process an operation + * + * @param $operation + * @param $lastOperationResult + * @param $testName + * @param array $context + * @param bool $async + * + * @return mixed + */ + public function processOperation($operation, $lastOperationResult, &$context, $testName, $async = false) + { + $operationName = array_keys((array)$operation)[0]; + + if ('do' === $operationName) { + return $this->operationDo($operation->{$operationName}, $lastOperationResult, $context, $testName, $async); + } + + if ('is_false' === $operationName) { + return $this->operationIsFalse($operation->{$operationName}, $lastOperationResult, $context, $testName); + } + + if ('is_true' === $operationName) { + return $this->operationIsTrue($operation->{$operationName}, $lastOperationResult, $context, $testName); + } + + if ('match' === $operationName) { + return $this->operationMatch($operation->{$operationName}, $lastOperationResult, $context, $testName); + } + + if ('gte' === $operationName) { + return $this->operationGreaterThanOrEqual($operation->{$operationName}, $lastOperationResult, $context, $testName); + } + + if ('gt' === $operationName) { + return $this->operationGreaterThan($operation->{$operationName}, $lastOperationResult, $context, $testName); + } + + if ('lte' === $operationName) { + return $this->operationLessThanOrEqual($operation->{$operationName}, $lastOperationResult, $context, $testName); + } + + if ('t' === $operationName) { + return $this->operationLessThan($operation->{$operationName}, $lastOperationResult, $context, $testName); + } + + if ('length' === $operationName) { + return $this->operationLength($operation->{$operationName}, $lastOperationResult, $context, $testName); + } + + if ('set' === $operationName) { + return $this->operationSet($operation->{$operationName}, $lastOperationResult, $context, $testName); + } + + if ('skip' === $operationName) { + return $this->operationSkip($operation->{$operationName}, $lastOperationResult, $testName); + } + + self::markTestIncomplete(sprintf('Operation %s not supported for test "%s"', $operationName, $testName)); + } + + /** + * Do something on the client + * + * @param $operation + * @param $lastOperationResult + * @param array $context + * @param $testName + * @param bool $async + * + * @throws \Exception + * + * @return mixed + */ + public function operationDo($operation, $lastOperationResult, &$context, $testName, $async = false) + { + $expectedError = null; + $expectedWarnings = null; + $headers = null; + + // Check if a error must be caught + if ('catch' === key($operation)) { + $expectedError = current($operation); + next($operation); + } + + // Check if a warning must be caught + if ('warnings' === key($operation)) { + $expectedWarnings = current($operation); + next($operation); + } + + // Any specific headers to add? + if ('headers' === key($operation)) { + $headers = current($operation); + next($operation); + } + + $endpointInfo = explode('.', key($operation)); + $endpointParams = $this->replaceWithContext(current($operation), $context); + $caller = $this->client; + $namespace = null; + $method = null; + + if (count($endpointInfo) === 1) { + $method = Inflector::camelize($endpointInfo[0]); + } + + if (count($endpointInfo) === 2) { + $namespace = $endpointInfo[0]; + $method = Inflector::camelize($endpointInfo[1]); + } + + if (is_object($endpointParams) === true && property_exists($endpointParams, 'ignore')) { + $ignore = $endpointParams->ignore; + unset($endpointParams->ignore); + + $endpointParams->client['ignore'] = $ignore; + } + + if ($async) { + $endpointParams->client['future'] = true; + } + + if ($headers != null) { + $endpointParams->client['headers'] = $headers; + } + + if (!is_string($method)) { + throw new \Exception('$method must be string'); + } + list($method, $namespace) = $this->mapEndpoint($method, $namespace); + + if (null !== $namespace) { + $caller = $caller->$namespace(); + } + + if (null === $method) { + self::markTestIncomplete(sprintf('Invalid do operation for test "%s"', $testName)); + } + + if (!method_exists($caller, $method)) { + self::markTestIncomplete(sprintf('Method "%s" not implement in "%s"', $method, get_class($caller))); + } + + // TODO remove this after cat testing situation resolved + if ($caller instanceof Elasticsearch\Namespaces\CatNamespace) { + if (!isset($endpointParams->format)) { + $endpointParams->format = 'text'; + } + } + + // Exist* methods have to be manually 'unwrapped' into true/false for async + if (strpos($method, "exist") !== false && $async === true) { + return $this->executeAsyncExistRequest($caller, $method, $endpointParams, $expectedError, $expectedWarnings, $testName); + } + + return $this->executeRequest($caller, $method, $endpointParams, $expectedError, $expectedWarnings, $testName); + } + + /** + * Obtain the response from the server + * + * @param $caller + * @param $method + * @param $endpointParams + * @param $expectedError + * @param $testName + * + * @throws \Exception + * + * @return array|mixed + */ + public function executeRequest($caller, $method, $endpointParams, $expectedError, $expectedWarnings, $testName) + { + try { + $response = $caller->$method($endpointParams); + + while ($response instanceof FutureArrayInterface) { + $response = $response->wait(); + } + + $this->checkForWarnings($expectedWarnings); + + return $response; + } catch (\Exception $exception) { + if (null !== $expectedError) { + return $this->assertException($exception, $expectedError, $testName); + } + + $msg = $exception->getMessage() + ."\nException in ".get_class($caller)." with [$method].\n Context:\n" + .var_export($endpointParams, true); + throw new \Exception($msg, 0, $exception); + } + } + + /** + * Obtain the response when it is an Exists* method. These are converted into + * true/false responses + * + * @param $caller + * @param $method + * @param $endpointParams + * @param $expectedError + * @param $testName + * + * @throws \Exception + * + * @return bool|mixed[] + */ + public function executeAsyncExistRequest($caller, $method, $endpointParams, $expectedError, $expectedWarnings, $testName) + { + try { + $response = $caller->$method($endpointParams); + + while ($response instanceof FutureArrayInterface) { + $response = $response->wait(); + } + + $this->checkForWarnings($expectedWarnings); + + if ($response['status'] === 200) { + return true; + } else { + return false; + } + } catch (Missing404Exception $exception) { + return false; + } catch (RoutingMissingException $exception) { + return false; + } catch (\Exception $exception) { + if (null !== $expectedError) { + return $this->assertException($exception, $expectedError, $testName); + } + + throw $exception; + } + } + + public function checkForWarnings($expectedWarnings) + { + $last = $this->client->transport->getLastConnection()->getLastRequestInfo(); + + + // We have some warnings to check + if ($expectedWarnings !== null) { + if (isset($last['response']['headers']['Warning']) === true) { + foreach ($last['response']['headers']['Warning'] as $warning) { + //$position = array_search($warning, $expectedWarnings); + $position = false; + foreach ($expectedWarnings as $index => $value) { + if (stristr($warning, $value) !== false) { + $position = $index; + break; + } + } + if ($position !== false) { + // found the warning + unset($expectedWarnings[$position]); + } else { + // didn't find, throw error + //throw new \Exception("Expected to find warning [$warning] but did not."); + } + } + if (count($expectedWarnings) > 0) { + print_r($last['response']); + throw new \Exception("Expected to find more warnings: ". print_r($expectedWarnings, true)); + } + } + } + + // Check to make sure we're adding headers + $this->assertArrayHasKey('Content-Type', $last['request']['headers'], print_r($last['request']['headers'], true)); + $this->assertSame('application/json', $last['request']['headers']['Content-Type'][0], print_r($last['request']['headers'], true)); + $this->assertArrayHasKey('Accept', $last['request']['headers'], print_r($last['request']['headers'], true)); + $this->assertSame('application/json', $last['request']['headers']['Accept'][0], print_r($last['request']['headers'], true)); + } + + /** + * Check if a field in the last operation is false + * + * @param $operation + * @param $lastOperationResult + * @param $testName + */ + public function operationIsFalse($operation, $lastOperationResult, &$context, $testName) + { + $value = (bool)$this->resolveValue($lastOperationResult, $operation, $context); + $msg = "Failed to assert that a value is false in test \"$testName\"\n" + ."$operation was [".print_r($value, true)."]" + .var_export($lastOperationResult, true); + $this->assertFalse($value, $msg); + + return $lastOperationResult; + } + + /** + * Check if a field in the last operation is true + * + * @param $operation + * @param $lastOperationResult + * @param $testName + */ + public function operationIsTrue($operation, $lastOperationResult, &$context, $testName) + { + $value = $this->resolveValue($lastOperationResult, $operation, $context); + + $msg = "Failed to assert that a value is true in test \"$testName\"\n" + ."$operation was [".print_r($value, true)."]" + .var_export($lastOperationResult, true); + $this->assertNotEquals(0, $value, $msg); + $this->assertNotFalse($value, $msg); + $this->assertNotNull($value, $msg); + $this->assertNotEquals('', $msg); + + return $lastOperationResult; + } + + /** + * Check if a field in the last operation match an expected value + * + * @param $operation + * @param $lastOperationResult + * @param $testName + */ + public function operationMatch($operation, $lastOperationResult, &$context, $testName) + { + $key = key($operation); + + if ($key === '$body') { + $match = $lastOperationResult; + } else { + $match = $this->resolveValue($lastOperationResult, $key, $context); + } + + $expected = $this->replaceWithContext(current($operation), $context); + $msg = "Failed to match in test \"$testName\". Expected [" + .var_export($expected, true)."] does not match [".var_export($match, true)."]\n".var_export($lastOperationResult, true); + + if ($expected instanceof \stdClass) { + // Avoid stdClass / array mismatch + $expected = json_decode(json_encode($expected), true); + $match = json_decode(json_encode($match), true); + + $this->assertEquals($expected, $match, $msg); + } elseif (is_string($expected) && preg_match('#^/.+?/$#s', $expected)) { + $this->assertRegExp($this->formatRegex($expected), $match, $msg); + } else { + $this->assertEquals($expected, $match, $msg); + } + + return $lastOperationResult; + } + + /** + * Check if a field in the last operation is greater than or equal a value + * + * @param $operation + * @param $lastOperationResult + * @param $testName + */ + public function operationGreaterThanOrEqual($operation, $lastOperationResult, &$context, $testName) + { + $value = $this->resolveValue($lastOperationResult, key($operation), $context); + $expected = current($operation); + + $this->assertGreaterThanOrEqual($expected, $value, 'Failed to gte in test ' . $testName); + + return $lastOperationResult; + } + + /** + * Check if a field in the last operation is greater than a value + * + * @param $operation + * @param $lastOperationResult + * @param $testName + */ + public function operationGreaterThan($operation, $lastOperationResult, &$context, $testName) + { + $value = $this->resolveValue($lastOperationResult, key($operation), $context); + $expected = current($operation); + + $this->assertGreaterThan($expected, $value, 'Failed to gt in test ' . $testName); + + return $lastOperationResult; + } + + /** + * Check if a field in the last operation is less than or equal a value + * + * @param $operation + * @param $lastOperationResult + * @param $testName + */ + public function operationLessThanOrEqual($operation, $lastOperationResult, &$context, $testName) + { + $value = $this->resolveValue($lastOperationResult, key($operation), $context); + $expected = current($operation); + + $this->assertLessThanOrEqual($expected, $value, 'Failed to lte in test ' . $testName); + + return $lastOperationResult; + } + + /** + * Check if a field in the last operation is less than a value + * + * @param $operation + * @param $lastOperationResult + * @param $testName + */ + public function operationLessThan($operation, $lastOperationResult, &$context, $testName) + { + $value = $this->resolveValue($lastOperationResult, key($operation), $context); + $expected = current($operation); + + $this->assertLessThan($expected, $value, 'Failed to lt in test ' . $testName); + + return $lastOperationResult; + } + + /** + * Check if a field in the last operation has length of a value + * + * @param $operation + * @param $lastOperationResult + * @param $testName + */ + public function operationLength($operation, $lastOperationResult, &$context, $testName) + { + $value = $this->resolveValue($lastOperationResult, key($operation), $context); + $expected = current($operation); + + $this->assertCount($expected, $value, 'Failed to gte in test ' . $testName); + + return $lastOperationResult; + } + + /** + * Set a variable into context from last operation + * + * @param $operation + * @param $lastOperationResult + * @param $context + * @param $testName + */ + public function operationSet($operation, $lastOperationResult, &$context, $testName) + { + $key = key($operation); + $value = $this->resolveValue($lastOperationResult, $key, $context); + $variable = current($operation); + + $context['$' . $variable] = $value; + + return $lastOperationResult; + } + + /** + * Skip an operation depending on Elasticsearch Version + * + * @param $operation + * @param $lastOperationResult + * @param $testName + */ + public function operationSkip($operation, $lastOperationResult, $testName) + { + if (is_object($operation) !== true) { + return $lastOperationResult; + } + + if (property_exists($operation, 'features')) { + if (is_array($operation->features)) { + if (count(array_intersect($operation->features, static::$supportedFeatures)) != count($operation->features)) { + static::markTestSkipped(sprintf('Feature(s) %s not supported in test "%s"', json_encode($operation->features), $testName)); + } + } else { + if (!in_array($operation->features, static::$supportedFeatures, true)) { + static::markTestSkipped(sprintf('Feature(s) %s not supported in test "%s"', json_encode($operation->features), $testName)); + } + } + } + + if (property_exists($operation, 'version')) { + $version = $operation->version; + $version = str_replace(" ", "", $version); + $version = explode("-", $version); + + if (isset($version[0]) && $version[0] == 'all') { + static::markTestSkipped(sprintf('Skip test "%s", as all versions should be skipped (%s)', $testName, $operation->reason)); + } + + if (!isset($version[0]) || $version[0] === "") { + $version[0] = ~PHP_INT_MAX; + } + + if (!isset($version[1]) || $version[1] === "") { + $version[1] = PHP_INT_MAX; + } + + if (version_compare(static::$esVersion, (string)$version[0], '>=') && version_compare(static::$esVersion, (string)$version[1], '<=')) { + static::markTestSkipped(sprintf('Skip test "%s", as version %s should be skipped (%s)', $testName, static::$esVersion, $operation->reason)); + } + } + + return $lastOperationResult; + } + + /** + * Assert an expected error + * + * @param \Exception $exception + * @param $expectedError + * @param $testName + * + * @return array + */ + private function assertException(\Exception $exception, $expectedError, $testName) + { + if (is_string($expectedError) && preg_match('#^/.+?/$#', $expectedError)) { + $this->assertRegExp($expectedError, $exception->getMessage(), 'Failed to catch error in test ' . $testName); + } elseif ($exception instanceof BadRequest400Exception && $expectedError === 'bad_request') { + $this->assertTrue(true); + } elseif ($exception instanceof Unauthorized401Exception && $expectedError === 'unauthorized') { + $this->assertTrue(true); + } elseif ($exception instanceof Missing404Exception && $expectedError === 'missing') { + $this->assertTrue(true); + } elseif ($exception instanceof Conflict409Exception && $expectedError === 'conflict') { + $this->assertTrue(true); + } elseif ($exception instanceof Forbidden403Exception && $expectedError === 'forbidden') { + $this->assertTrue(true); + } elseif ($exception instanceof RequestTimeout408Exception && $expectedError === 'request_timeout') { + $this->assertTrue(true); + } elseif ($exception instanceof BadRequest400Exception && $expectedError === 'request') { + $this->assertTrue(true); + } elseif ($exception instanceof ServerErrorResponseException && $expectedError === 'request') { + $this->assertTrue(true); + } elseif ($exception instanceof \RuntimeException && $expectedError === 'param') { + $this->assertTrue(true); + } else { + $this->assertContains($expectedError, $exception->getMessage()); + } + + if ($exception->getPrevious() !== null) { + return json_decode($exception->getPrevious()->getMessage(), true); + } + + return json_decode($exception->getMessage(), true); + } + + /** + * Provider list of document to test + * + * @return array + */ + public function yamlProvider() + { + $this->yaml = new Yaml(); + $path = __DIR__ . '/../../../util/elasticsearch/rest-api-spec/src/main/resources/rest-api-spec/test'; + $files = []; + + $finder = new Finder(); + $finder->in($path); + $finder->files(); + $finder->name('*.yml'); + + // *.yaml files should be included until the library is ES 6.0+ only + $finder->name('*.yaml'); + + $filter = isset($_SERVER['TEST_CASE']) ? $_SERVER['TEST_CASE'] : null; + + /** @var SplFileInfo $file */ + foreach ($finder as $file) { + $files = array_merge($files, $this->splitDocument($file, $path, $filter)); + } + + return $files; + } + + /** + * Return the real namespace / method couple for elasticsearch php + * + * @param string $method + * @param string|null $namespace + * + * @return array + */ + private function mapEndpoint($method, $namespace = null) + { + if (null === $namespace && array_key_exists($method, static::$endpointMapping)) { + return static::$endpointMapping[$method]; + } + + if (null !== $namespace && array_key_exists($namespace, static::$endpointMapping) && array_key_exists($method, static::$endpointMapping[$namespace])) { + return static::$endpointMapping[$namespace][$method]; + } + + return [$method, $namespace]; + } + + /** + * Replace contextual variable into a bunch of data + * + * @param $data + * @param $context + * + * @return mixed + */ + private function replaceWithContext($data, $context) + { + if (empty($context)) { + return $data; + } + + if (is_string($data)) { + if (array_key_exists($data, $context)) { + return $context[$data]; + } + } + + if (!is_array($data) && !$data instanceof \stdClass) { + return $data; + } + + foreach ($data as $key => &$value) { + $value = $this->replaceWithContext($value, $context); + } + + return $data; + } + + /** + * Resolve a value into an array given a specific field + * + * @param $result + * @param $field + * + * @return mixed + */ + private function resolveValue($result, $field, &$context) + { + if (empty($field)) { + return $result; + } + + foreach ($context as $key => $value) { + $field = preg_replace('/('.preg_quote($key, '/').')/', $value, $field); + } + + $operationSplit = explode('.', $field); + $value = $result; + + do { + $key = array_shift($operationSplit); + + if (substr($key, -1) === '\\') { + $key = substr($key, 0, -1) . '.' . array_shift($operationSplit); + } + + if (!is_array($value)) { + return $value; + } + + if (!array_key_exists($key, $value)) { + return false; + } + + $value = $value[$key]; + } while (count($operationSplit) > 0); + + return $value; + } + + /** + * Format a regex for PHP + * + * @param $regex + * + * @return string + */ + private function formatRegex($regex) + { + $regex = trim($regex); + $regex = substr($regex, 1, -1); + $regex = str_replace('/', '\\/', $regex); + $regex = '/' . $regex . '/mx'; + + return $regex; + } + + /** + * Split file content into multiple document + * + * @param SplFileInfo $file + * @param string $path; + * + * @return array + */ + private function splitDocument($file, $path, $filter = null) + { + + $fileContent = $file->getContents(); + // cleanup some bad comments + $fileContent = str_replace('"#', '" #', $fileContent); + + $documents = explode("---\n", $fileContent); + $documents = array_filter($documents, function ($item) { + return trim($item) !== ''; + }); + + $documentsParsed = []; + $setup = null; + $setupSkip = false; + $fileName = str_replace($path . '/', '', $file); + + if (array_key_exists($fileName, static::$fatalFiles)) { + echo "Skipping: $fileName. ".static::$fatalFiles[$fileName]."\n"; + return []; + } + + if (null !== $filter && !preg_match('/'.preg_quote($filter, '/').'/', $fileName)) { + return []; + } + $skip = false; + $documentParsed = null; + foreach ($documents as $documentString) { + try { + if (!$setupSkip) { + $documentParsed = $this->yaml->parse($documentString, false, false, true); + $skip = false; + } + } catch (ParseException $exception) { + $documentParsed = sprintf( + "[ParseException]Cannot run this test as it cannot be parsed (%s) in file %s", + $exception->getMessage(), + $fileName + ); + + if (preg_match("#\nsetup:#mx", $documentString)) { + $setupSkip = true; + } + + $skip = true; + } catch (\Exception $exception) { + $documentParsed = sprintf( + "[Exception] Cannot run this test as it generated an exception (%s) in file %s", + $exception->getMessage(), + $fileName + ); + + if (preg_match("#\nsetup:#mx", $documentString)) { + $setupSkip = true; + } + + $skip = true; + } + + if (!$skip && key($documentParsed) === 'setup') { + $setup = $documentParsed; + $setupSkip = $skip; + } else { + $documentsParsed[] = [$documentParsed, $skip || $setupSkip, $setup, $fileName]; + } + } + + return $documentsParsed; + } + + /** + * Clean the cluster + */ + private function clean() + { + $host = static::getHost(); + $ch = curl_init($host."/*"); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE"); + curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); + + $response = curl_exec($ch); + curl_close($ch); + + $ch = curl_init($host."/_template/*"); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE"); + curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); + + $response = curl_exec($ch); + curl_close($ch); + + $ch = curl_init($host."/_analyzer/*"); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE"); + curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); + + $response = curl_exec($ch); + curl_close($ch); + + $ch = curl_init($host."/_snapshot/_all"); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET"); + curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); + + $response = curl_exec($ch); + curl_close($ch); + if ($response != "{}") { + $response = json_decode($response, true); + foreach ($response as $repo => $settings) { + if ($settings['type'] == 'fs') { + $ch = curl_init($host."/_snapshot/$repo/_all?ignore_unavailable"); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET"); + curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); + + $snapshots = json_decode(curl_exec($ch), true); + curl_close($ch); + foreach ($snapshots['snapshots'] as $snapshot) { + $snapshotName = $snapshot['snapshot']; + $ch = curl_init($host."/_snapshot/$repo/$snapshotName"); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE"); + curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); + + $response = curl_exec($ch); + curl_close($ch); + } + $ch = curl_init($host."/_snapshot/$repo"); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE"); + curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); + + $response = curl_exec($ch); + curl_close($ch); + } + } + } + + $this->rmDirRecursively('/tmp/test_repo_create_1_loc'); + $this->rmDirRecursively('/tmp/test_repo_restore_1_loc'); + $this->rmDirRecursively('/tmp/test_cat_repo_1_loc'); + $this->rmDirRecursively('/tmp/test_cat_repo_2_loc'); + $this->rmDirRecursively('/tmp/test_cat_snapshots_1_loc'); + + $this->waitForYellow(); + } + + private function rmDirRecursively($dir) + { + if (!is_dir($dir)) { + return; + } + $files = new RecursiveIteratorIterator( + new RecursiveDirectoryIterator($dir, RecursiveDirectoryIterator::SKIP_DOTS), + RecursiveIteratorIterator::CHILD_FIRST + ); + + foreach ($files as $fileinfo) { + $todo = ($fileinfo->isDir() ? 'rmdir' : 'unlink'); + $todo($fileinfo->getRealPath()); + } + + rmdir($dir); + } + + /** + * Wait for cluster to be in a "YELLOW" state + */ + private function waitForYellow() + { + $host = static::getHost(); + $ch = curl_init("$host/_cluster/health?wait_for_status=yellow&timeout=50s"); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET"); + curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); + + $response = json_decode(curl_exec($ch), true); + + $counter = 0; + while ($response['status'] === 'red') { + sleep(0.5); + $response = json_decode(curl_exec($ch), true); + ++$counter; + + if ($counter > 10) { + echo "Aborting test due to failure in clearing cluster.\n"; + echo print_r($response, true); + exit; + } + } + curl_close($ch); + } +} diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/tests/bootstrap.php b/openml_OS/vendor/elasticsearch/elasticsearch/tests/bootstrap.php new file mode 100644 index 000000000..9e4d302dd --- /dev/null +++ b/openml_OS/vendor/elasticsearch/elasticsearch/tests/bootstrap.php @@ -0,0 +1,18 @@ +/dev/null + +which java +java -version + + +echo "Downloading Elasticsearch v${ES_VERSION}-SNAPSHOT..." + +ES_URL=$(curl -sS "https://esvm-props.kibana.rocks/builds" | jq -r ".branches[\"$ES_VERSION\"].zip") + +curl -L -o elasticsearch-latest-SNAPSHOT.zip $ES_URL +unzip "elasticsearch-latest-SNAPSHOT.zip" + +echo "Adding repo to config..." +find . -name "elasticsearch.yml" | while read TXT ; do echo 'repositories.url.allowed_urls: ["http://*"]' >> $TXT ; done +find . -name "elasticsearch.yml" | while read TXT ; do echo 'path.repo: ["/tmp"]' >> $TXT ; done +find . -name "elasticsearch.yml" | while read TXT ; do echo 'node.max_local_storage_nodes: 1' >> $TXT ; done +find . -name "elasticsearch.yml" | while read TXT ; do echo 'cluster.routing.allocation.disk.watermark.low: 0.1%' >> $TXT ; done +find . -name "elasticsearch.yml" | while read TXT ; do echo 'cluster.routing.allocation.disk.watermark.high: 0.1%' >> $TXT ; done +find . -name "elasticsearch.yml" | while read TXT ; do echo 'node.attr.testattr: test' >> $TXT ; done +find . -name "elasticsearch.yml" | while read TXT ; do echo 'script.max_compilations_rate: 2048/1m' >> $TXT ; done + +echo "Starting Elasticsearch v${ES_VERSION}" + +./elasticsearch-*/bin/elasticsearch -d + + +sleep 3 diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/travis/generate_docs.sh b/openml_OS/vendor/elasticsearch/elasticsearch/travis/generate_docs.sh new file mode 100755 index 000000000..88092120b --- /dev/null +++ b/openml_OS/vendor/elasticsearch/elasticsearch/travis/generate_docs.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash + +curl -O http://get.sensiolabs.org/sami.phar +php sami.phar update --force -v util/docsConfig.php diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/util/EnsureClusterAlive.php b/openml_OS/vendor/elasticsearch/elasticsearch/util/EnsureClusterAlive.php new file mode 100644 index 000000000..fbf942506 --- /dev/null +++ b/openml_OS/vendor/elasticsearch/elasticsearch/util/EnsureClusterAlive.php @@ -0,0 +1,48 @@ + [$_SERVER['ES_TEST_HOST']] +]); + +$count = 0; +while (!$client->ping()) { + $count += 1; + + if ($count > 15) { + echo "Live cluster could not be found in 15s!\nContents of elasticsearch.log:\n\n"; + + $dir = new DirectoryIterator(dirname(__DIR__)); + + foreach ($dir as $fileinfo) { + if ($fileinfo->isDir() && !$fileinfo->isDot()) { + if (strpos($fileinfo->getFilename(), "elasticsearch") === 0) { + $log = file_get_contents(dirname(__DIR__)."/$fileinfo/logs/elasticsearch.log"); + echo $log; + break; + } + + } + } + + throw new \Exception(); + } + sleep(1); +} + diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/util/RestSpecRunner.php b/openml_OS/vendor/elasticsearch/elasticsearch/util/RestSpecRunner.php new file mode 100644 index 000000000..c4a295a72 --- /dev/null +++ b/openml_OS/vendor/elasticsearch/elasticsearch/util/RestSpecRunner.php @@ -0,0 +1,37 @@ + [$_SERVER['ES_TEST_HOST']] +]); +$serverInfo = $client->info(); +var_dump($serverInfo); + +$gitWrapper = new \GitWrapper\GitWrapper(); +echo "Git cwd: ".dirname(__DIR__) . "/util/elasticsearch\n"; +$git = $gitWrapper->workingCopy(dirname(__DIR__) . '/util/elasticsearch'); + +echo "Update elasticsearch submodule\n"; +$git->fetchAll(array('verbose' => true)); + +$hash = $serverInfo['version']['build_hash']; +echo "Checkout yaml tests (hash: $hash)\n"; +$git->checkout($hash, array('force' => true, 'quiet' => true)); diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/util/SpecParser.php b/openml_OS/vendor/elasticsearch/elasticsearch/util/SpecParser.php new file mode 100755 index 000000000..386367224 --- /dev/null +++ b/openml_OS/vendor/elasticsearch/elasticsearch/util/SpecParser.php @@ -0,0 +1,217 @@ +#!/usr/bin/env php +loadTemplate('endpoint.twig'); + +$counter = 0; + + +function getApiPath() +{ + $path = dirname(__FILE__).'/elasticsearch/rest-api-spec/api'; + if (file_exists($path) !== true) { + $path = dirname(__FILE__).'/elasticsearch/rest-api-spec/src/main/resources/rest-api-spec/api'; + } + return $path; +} + + +if ($handle = opendir(getApiPath())) { + while (false !== ($entry = readdir($handle))) { + if ($entry != "." && $entry != "..") { + generateTemplate($entry, $template); + } + } + closedir($handle); +} + +function processURLPaths($data) +{ + $final = array(); + + $containsType = false; + $containsIndex = false; + foreach ($data['url']['paths'] as $path) { + $params = array(); + preg_match_all('/{(.*?)}/', $path, $params); + $params = $params[1]; + $count = count($params); + $parsedPath = str_replace('}', '', $path); + $parsedPath = str_replace('{', '$', $parsedPath); + + if (array_search('index', $params) !== false) { + $containsIndex = true; + } + + if (array_search('type', $params) !== false) { + $containsType = true; + } + + $duplicate = false; + foreach ($final as $existing) { + if ($existing['params'] === $params) { + $duplicate = true; + } + } + + if ($duplicate !== true) { + $final[] = array( + 'path' => $path, + 'parsedPath' => $parsedPath, + 'params' => $params, + 'count' => $count + ); + } + } + + /* + foreach ($final as &$existing) { + if ($containsIndex === true && array_search('index', $existing['params']) === false && array_search('type', $existing['params']) !== false) { + $existing['parsedPath'] = '/_all'.$existing['parsedPath']; + } + } + */ + + usort($final, function ($a, $b) { + if ($a['count'] == $b['count']) { + return 0; + } + + return ($a['count'] > $b['count']) ? -1 : 1; + }); + + return $final; +} + +function getDefaultPath($path) +{ + if ($path['count'] === 0) { + return $path['path']; + } else { + $final = str_replace('}', '', $path['path']); + $final = str_replace('{', '$', $final); + + return $final; + } +} + +function forbid($key, $value) +{ + $forbid = array( + 'GET' => array( + '/_nodes/hotthreads', + '/_nodes/{node_id}/hotthreads', + '/_nodes/{metric}' + ), + 'HEAD' => array(), + 'PUT' => array( + '/{index}/{type}/_mapping' + ), + 'POST' => array( + '/_all/{type}/_bulk', + '/_all/{type}/_mget' + ), + 'DELETE' => array( + '/{index}/{type}', + '/{index}/{type}/_mapping' + ), + 'QS' => array( + 'operation_threading', + 'field_data' + ) + ); + + if (isset($forbid['key']) && $forbid['key'] === $value) { + return true; + } else { + return false; + } +} + +function generateTemplate($path, $template) +{ + $ignoreList = array( + 'index.json', 'bulk.json' + ); + + if (array_search($path, $ignoreList) !== false) { + return; + } + + $path = getApiPath().DIRECTORY_SEPARATOR.$path; + $json = file_get_contents($path); + $data = json_decode($json, true); + + reset($data); + $namespace = key($data); + $data = $data[$namespace]; + $namespace = explode('.', $namespace); + + $underscoreNamespace = array( + 'get', + 'put', + 'post', + 'delete', + 'exists', + 'update', + 'create' + ); + + $exceptions = array( + 'delete_by_query', + 'update_by_query', + ); + + if (strpos($namespace[count($namespace)-1], '_')) { + $temp = explode('_', $namespace[count($namespace)-1]); + + if (array_search($temp[0], $underscoreNamespace) !== false && array_search($namespace[count($namespace)-1], $exceptions) === false) { + $namespace[count($namespace)-1] = $temp[1]; + $namespace[] = $temp[0]; + } else { + $namespace[count($namespace)-1] = str_replace('_', '', $namespace[count($namespace)-1]); + } + } + + $data['url']['processed'] = processURLPaths($data); + $data['url']['default'] = getDefaultPath($data['url']['processed'][count($data['url']['processed'])-1]); + if (count($data['methods']) > 1) { + if (in_array("GET", $data['methods'])) { + $data['methods'] = "GET"; + } else { + $data['methods'] = $data['methods'][0]; + } + } + $renderVars = array( + 'json' => $json, + 'data' => $data, + 'namespace' => $namespace, + 'className' => ucfirst($namespace[count($namespace)-1]), + ); + + $ret = $template->render($renderVars); + + $dir = __DIR__.'/output/'.implode('/', array_map('ucfirst', array_splice($namespace, 0, count($namespace)-1))); + + if (substr($dir, -1) !== '/') { + $dir .= '/'; + } + if (!file_exists($dir)) { + echo 'making dir: '.$dir."\n\n"; + $oldumask = umask(0); + mkdir($dir, 0777, true); + umask($oldumask); + } + + echo $dir."\n\n"; + $path = $dir.$renderVars['className'].'.php'; + echo $path."\n\n"; + + file_put_contents($path, $ret); +} diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/util/docsConfig.php b/openml_OS/vendor/elasticsearch/elasticsearch/util/docsConfig.php new file mode 100644 index 000000000..d0a5690c3 --- /dev/null +++ b/openml_OS/vendor/elasticsearch/elasticsearch/util/docsConfig.php @@ -0,0 +1,22 @@ +files() + ->name('*Namespace.php') + ->name("Client.php") + ->name("ClientBuilder.php") + ->notName("AbstractNamespace.php") + ->in(__DIR__.'/../src/'); + +return new Sami($iterator, [ + 'theme' => 'asciidoc', + 'template_dirs' => [__DIR__.'/docstheme/'], + 'title' => 'Elasticsearch-php', + 'build_dir' => __DIR__.'/../docs/build', + 'cache_dir' => __DIR__.'/cache/', +]); diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/util/docstheme/layout/base.twig b/openml_OS/vendor/elasticsearch/elasticsearch/util/docstheme/layout/base.twig new file mode 100644 index 000000000..70610e193 --- /dev/null +++ b/openml_OS/vendor/elasticsearch/elasticsearch/util/docstheme/layout/base.twig @@ -0,0 +1,13 @@ +{% from "macros.twig" import replace_backslash, sanitize %} + +{% block title %} +{% set parts = title|split("\\") %} +{% set path = parts|slice(0, -1)|join("\\") %} +{% set name = parts|slice(-1, 1)|join("\\") %} + +[[{{ sanitize(replace_backslash(title)) }}]] +=== {{ title }} + +{% endblock %} +{% block content %} +{% endblock %} diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/util/docstheme/macros.twig b/openml_OS/vendor/elasticsearch/elasticsearch/util/docstheme/macros.twig new file mode 100644 index 000000000..9ea1834e8 --- /dev/null +++ b/openml_OS/vendor/elasticsearch/elasticsearch/util/docstheme/macros.twig @@ -0,0 +1,138 @@ +{% macro class_item(class, short = false, indent = "") -%} +{{ indent }}{{ _self.class_name(class, short) }}{% if class.shortdesc %} -- {{ class.shortdesc }}{% endif %} +{%- endmacro -%} + +{% macro class_name(class, short = false, suffix = "") -%} +{% spaceless -%} +{% if class.projectclass or class.phpclass %} +{% if class.projectclass %} +<<{{_self.replace_backslash( (short ? class.shortname : class)~suffix) }},{{ class }}>> +{% else %} +http://php.net/class.{{ class }}[{{ short ? class.shortname : class }}{{ suffix }}] +{% endif %}) +{% else %} +`{{ class }}` +{% endif %} +{%- endspaceless %} +{%- endmacro -%} + +{% macro class_type(class, sentence = false) -%} +{% spaceless %} +{% if class.interface %} +{% if sentence %}an {% endif %} +interface +{%- else -%} +{% if sentence %}{% if class.abstract %}an{% else %}a{% endif %} {% endif %} +{% if class.abstract %}abstract {% endif %} +class +{%- endif -%} +{% endspaceless %} +{%- endmacro -%} + +{% macro hint(hint) -%} +{% spaceless %} +{% if hint.class -%} +{{ _self.class_name(hint.name) }} +{%- elseif hint.name -%} +{{ hint.name }} +{%- endif %} +{% endspaceless %} +{%- endmacro -%} + +{% macro markdown_path(path) -%} +{% spaceless %} +{{- path|replace({".html": ".md"}) -}} +{% endspaceless %} +{%- endmacro -%} + +{% macro replace_backslash(path) -%} + {% spaceless %} + {{- path|replace({"\\": "_"}) -}} + {% endspaceless %} +{%- endmacro -%} + +{% macro back_to_forward(path) -%} + {% spaceless %} + {{- path|replace({"\\": "/"}) -}} + {% endspaceless %} +{%- endmacro -%} + +{% macro sanitize(path) -%} + {% spaceless %} + {{- path|replace({"$": "", "::": "", "__": "-"}) -}} + {% endspaceless %} +{%- endmacro -%} + +{% macro get_namespace(class) -%} + {% spaceless %} + {% if class.shortname == 'Client' %} + $client + {% else %} + $client->{{ class.shortname|lower|replace({"namespace": ""}) }}() + {% endif %} + {% endspaceless %} +{%- endmacro -%} + + + +{% macro param_list(member) -%} + {% spaceless %} + {% for parameter in member.parameters %}${{ parameter.name }},{% endfor %} + {% endspaceless %} +{%- endmacro -%} + +{% macro member_signature(type, member) -%} +* It is a **{{ _self.member_visibility(member) }}{% if member.abstract is defined and member.abstract %} abstract{% endif %}** {{ type }}. +{% if member.final %} +* It is a **finalized** {{ type }}. +{% endif %} +{% if "property" == type %} +{% if member.hint|length > 1 %} +* It can be one of the following types: +{%- for hint in member.hint %} + + * {{ _self.hint(hint) }} +{%- endfor -%} +{%- elseif member.hint|length > 0 %} +* It is a(n) {{ _self.hint(member.hint[0]) }} value. +{%- else %} +* Its type is not specified. +{% endif %} +{% elseif "method" == type %} +{% if member.parameters %} +* It accepts the following parameter(s): +{% for parameter in member.parameters %} + * `${{ parameter.name }}`{% if parameter.hint %} ({% for hint in parameter.hint %}{{ _self.hint(hint) }}{% if not loop.last %}|{% endif %}{% endfor %}){% endif %}{% if parameter.shortdesc %} -- {{ parameter.shortdesc }}{% endif %} + +{% endfor %} +{% endif %} +{% if (member.hint|length > 1) or member.hintDesc %} +{% if member.hintDesc %} +* _Returns:_ {{ member.hintDesc }} +{% else %} +* It can return one of the following values: +{% endif %} +{% for hint in member.hint %} + * {{ _self.hint(hint) }} +{% endfor -%} +{% elseif member.hint|length > 0 %} +* It returns a(n) {{ _self.hint(member.hint[0]) }} value. +{% else %} +* It does not return anything. +{% endif %} +{% if member.exceptions %} +* It throws one of the following exceptions: +{% for exception in member.exceptions %} + * {{ _self.class_name(exception[0]) }}{% if exception[1] is defined and exception[1] is not empty %} -- {{ exception[1] }}{% endif %} + +{% endfor %} +{% endif %} +{% endif %} +{%- endmacro -%} + +{% macro member_visibility(member) -%} +{% spaceless %} +{% if member.private %}private{% elseif member.protected %}protected{% else %}public{% endif %} +{% if member.static %} static{% endif %} +{% endspaceless %} +{%- endmacro -%} diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/util/docstheme/manifest.yml b/openml_OS/vendor/elasticsearch/elasticsearch/util/docstheme/manifest.yml new file mode 100644 index 000000000..c1b212dc9 --- /dev/null +++ b/openml_OS/vendor/elasticsearch/elasticsearch/util/docstheme/manifest.yml @@ -0,0 +1,9 @@ +name: asciidoc + +global: + "pages/namespaces.twig": "namespaces.asciidoc" + "pages/interfaces.twig": "interfaces.asciidoc" + "pages/classes.twig": "classes.asciidoc" + +class: + "pages/class.twig": "%s.asciidoc" diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/util/docstheme/pages/class.twig b/openml_OS/vendor/elasticsearch/elasticsearch/util/docstheme/pages/class.twig new file mode 100644 index 000000000..633ca1266 --- /dev/null +++ b/openml_OS/vendor/elasticsearch/elasticsearch/util/docstheme/pages/class.twig @@ -0,0 +1,82 @@ +{% extends "layout/base.twig" %} + +{% from "macros.twig" import class_item, class_name, class_type, member_signature, replace_backslash, sanitize, param_list, get_namespace %} + +{% block title %} +{% set title = class %} +{{ parent() }} +{% endblock %} + +{% block content %} +{% if class.shortdesc %} + +{{ class.shortdesc|raw }} +{% endif %} +{% if class.longdesc %} + +*Description* + + +{{ class.longdesc|raw }} +{% endif %} + +{% if class.methods %} + +*Methods* + +The {{ class_type(class) }} defines the following methods: + +{% for method in class.methods %} +{% if method.name != "__construct" %} +* <<{{ sanitize(replace_backslash(method)~"_"~method.name) }},`{{ method.name }}()`>> +{% endif %} +{% endfor %} + +{% for method in class.methods %} +{% if method.name != "__construct" %} + + +{% if class.shortname != "ClientBuilder" %} +[[{{ sanitize(replace_backslash(method)~"_"~method.name) }}]] +.`{{ method.name }}()` +**** +[source,php] +---- +/* +{% if method.shortdesc %} +{{ method.shortdesc|raw }} + ['body'] = (array) Request body +{% endif %} +*/ + +$params = [ + // ... +]; + +$client = ClientBuilder::create()->build(); +$response = {{ get_namespace(class) }}->{{ method.name }}({{ param_list(method)|trim(',') }}); +---- +**** +{% else %} +[[{{ sanitize(replace_backslash(method)~"_"~method.name) }}]] +.`{{ method.name }}()` +**** +[source,php] +---- +/* +{% if method.shortdesc %} + {{ method.shortdesc|raw }} + ['body'] = (array) Request body +{% endif %} +*/ + +---- +**** +{% endif %} +{% endif %} + +{% endfor %} +{% endif %} + +{% endblock %} + diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/util/docstheme/pages/classes.twig b/openml_OS/vendor/elasticsearch/elasticsearch/util/docstheme/pages/classes.twig new file mode 100644 index 000000000..f8c652179 --- /dev/null +++ b/openml_OS/vendor/elasticsearch/elasticsearch/util/docstheme/pages/classes.twig @@ -0,0 +1,27 @@ +{% extends "layout/base.twig" %} + +{% from "macros.twig" import class_item, replace_backslash, back_to_forward, sanitize %} + +{% block title %} +[[{{ sanitize(replace_backslash("ElasticsearchPHP_Endpoints")) }}]] +== {{ "Reference - Endpoints" }} +{% endblock %} + +{% block content %} + +This is a complete list of namespaces and their associated endpoints. + +NOTE: This is auto-generated documentation + +{% for class in classes if not class.interface %} +* <<{{ replace_backslash(class) }}, {{ class }}>> +{% else %} +* There are no endpoints available. +{% endfor %} +{% for class in classes if not class.interface %} +include::{{ back_to_forward(class) }}.asciidoc[] +{% else %} +{% endfor %} +{% endblock %} + + diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/util/docstheme/pages/interfaces.twig b/openml_OS/vendor/elasticsearch/elasticsearch/util/docstheme/pages/interfaces.twig new file mode 100644 index 000000000..dfa5a9458 --- /dev/null +++ b/openml_OS/vendor/elasticsearch/elasticsearch/util/docstheme/pages/interfaces.twig @@ -0,0 +1,23 @@ +{% extends "layout/base.twig" %} + +{% from "macros.twig" import class_item, replace_backslash, back_to_forward, sanitize %} + +{% block title %} +[[{{ sanitize(replace_backslash("ElasticsearchPHP_Interfaces")) }}]] +== {{ "Reference - Interfaces" }} +{% endblock %} + +{% block content %} + +This is a complete list of available interfaces: + +{% for interface in classes if interface.interface %} +* <<{{ replace_backslash(interface) }}, {{ interface }}>> +{% else %} +* There are no interfaces available. +{% endfor %} +{% for interface in classes if interface.interface %} +include::{{ back_to_forward(interface) }}.asciidoc[] +{% else %} +{% endfor %} +{% endblock %} diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/util/docstheme/pages/namespaces.twig b/openml_OS/vendor/elasticsearch/elasticsearch/util/docstheme/pages/namespaces.twig new file mode 100644 index 000000000..8b82c2f65 --- /dev/null +++ b/openml_OS/vendor/elasticsearch/elasticsearch/util/docstheme/pages/namespaces.twig @@ -0,0 +1,23 @@ +{% extends "layout/base.twig" %} + +{% from "macros.twig" import markdown_path, replace_backslash, back_to_forward, sanitize %} + +{% block title %} +[[{{ sanitize(replace_backslash("ElasticsearchPHP_Namespaces")) }}]] +== {{ "Reference - Namespaces" }} +{% endblock %} + +{% block content %} + +This is a complete list of available namespaces: + +{% for namespace in namespaces %} +* <<{{ replace_backslash(namespace) }}, {{ namespace }}>> +{% else %} +* There are no namespaces available. +{% endfor %} +{% for namespace in namespaces %} +include::{{ back_to_forward(namespace) }}.asciidoc[] +{% else %} +{% endfor %} +{% endblock %} diff --git a/openml_OS/vendor/elasticsearch/elasticsearch/util/templates/endpoint.twig b/openml_OS/vendor/elasticsearch/elasticsearch/util/templates/endpoint.twig new file mode 100644 index 000000000..5a704af8e --- /dev/null +++ b/openml_OS/vendor/elasticsearch/elasticsearch/util/templates/endpoint.twig @@ -0,0 +1,150 @@ + + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 + * @link http://elastic.co + */ + +class {{ className|title }} extends AbstractEndpoint +{ +{% for part, info in data.url.parts %} +{% if part != 'index' and part != 'type' and part != 'id' %} + // {{info.description }} + private ${{part}}; +{% endif %} +{% endfor %} +{% if data.body is not null %} + /** + * @param array $body + * + * @throws \Elasticsearch\Common\Exceptions\InvalidArgumentException + * @return $this + */ + public function setBody($body) + { + if (isset($body) !== true) { + return $this; + } + + $this->body = $body; + return $this; + } + + + +{% endif %} +{% for part, info in data.url.parts %} +{% if part != 'index' and part != 'type' and part != 'id' %} + /** + * @param ${{part}} + * + * @return $this + */ + public function set{{part|title|replace({'_': ""})}}(${{part}}) + { + if (isset(${{part}}) !== true) { + return $this; + } +{% if info.type == 'list' %} + if (is_array(${{part}}) === true) { + ${{part}} = implode(",", ${{part}}); + } +{% endif %} + $this->{{part}} = ${{part}}; + return $this; + } + +{% endif %} +{% endfor %} +{% set exception = '' %} + /** +{% for part, info in data.url.parts %}{% if info.required is not null %}{% set exception = ' * @throws \\Elasticsearch\\Common\\Exceptions\\BadMethodCallException + ' %}{% endif %}{% endfor %} + {% autoescape false %}{{ exception }}{% endautoescape %} + * @return string + */ + protected function getURI() + { +{% for part, info in data.url.parts %} +{% if info.required == true %} + if (isset($this->{{ part }}) !== true) { + throw new Exceptions\RuntimeException( + '{{ part }} is required for {{ className }}' + ); + } +{% endif %} +{% endfor %} +{% for part, info in data.url.parts %} + ${{ part }} = $this->{{ part }}; +{% endfor %} + $uri = "{{ data.url.default }}"; +{% set loopCounter = 0 %} +{% for part, info in data.url.processed %} +{% if info.count > 0 %} +{% set counter = 0 %} +{% if loopCounter != 0 %} + else{% endif %}if ({% for param in info.params %}{% if counter == 0 %}isset(${{ param }}) === true{% else %} && isset(${{ param }}) === true{% endif %}{% set counter = counter + 1 %}{% endfor %}) + { + $uri = "{{ info.parsedPath }}"; + } +{% set loopCounter = 1 %} +{% endif %} +{% endfor %} + + return $uri; + } + + + /** + * @return string[] + */ + protected function getParamWhitelist() + { + return array( +{% for param, options in data.url.params %} + '{{ param }}', +{% endfor %} + ); + } + + +{% if data.body.required == true %} + /** + * @return array + * @throws \Elasticsearch\Common\Exceptions\RuntimeException + */ + protected function getBody() + { + if (isset($this->body) !== true) { + throw new Exceptions\RuntimeException('Body is required for {{ className|title }}'); + } + return $this->body; + } + + +{% endif %} + /** + * @return string + */ + protected function getMethod() + { +{% if data.methods|length > 1 %} + //TODO Fix Me! + return '{{ data.methods|join(',') }}'; +{% else %} + return '{{ data.methods[0] }}'; +{% endif %} + } +} \ No newline at end of file diff --git a/openml_OS/vendor/guzzlehttp/ringphp/.editorconfig b/openml_OS/vendor/guzzlehttp/ringphp/.editorconfig new file mode 100644 index 000000000..70dabca13 --- /dev/null +++ b/openml_OS/vendor/guzzlehttp/ringphp/.editorconfig @@ -0,0 +1,12 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +indent_size = 4 +indent_style = space +insert_final_newline = true +trim_trailing_whitespace = true + +[{Makefile,*.mk}] +indent_style = tab diff --git a/openml_OS/vendor/guzzlehttp/ringphp/.gitignore b/openml_OS/vendor/guzzlehttp/ringphp/.gitignore new file mode 100644 index 000000000..290a94524 --- /dev/null +++ b/openml_OS/vendor/guzzlehttp/ringphp/.gitignore @@ -0,0 +1,4 @@ +vendor +build/artifacts/ +composer.lock +docs/_build/ diff --git a/openml_OS/vendor/guzzlehttp/ringphp/.travis.yml b/openml_OS/vendor/guzzlehttp/ringphp/.travis.yml new file mode 100644 index 000000000..18562e427 --- /dev/null +++ b/openml_OS/vendor/guzzlehttp/ringphp/.travis.yml @@ -0,0 +1,43 @@ +language: php + +cache: + directories: + - $HOME/.composer/cache/files + +php: + - 5.4 + - 5.5 + - 5.6 + - 7.0 + - 7.1 + - 7.2 + - hhvm + - nightly + +env: + global: + - TEST_COMMAND="composer test" + +matrix: + allow_failures: + - php: hhvm + - php: nightly + fast_finish: true + include: + - php: 5.4 + env: COMPOSER_FLAGS="--prefer-stable --prefer-lowest" + +before_install: + - if [[ $COVERAGE != true ]]; then phpenv config-rm xdebug.ini || true; fi + +install: + # To be removed when this issue will be resolved: https://github.com/composer/composer/issues/5355 + - if [[ "$COMPOSER_FLAGS" == *"--prefer-lowest"* ]]; then travis_retry composer update --prefer-dist --no-interaction --prefer-stable --quiet; fi + - travis_retry composer update ${COMPOSER_FLAGS} --prefer-dist --no-interaction + +before_script: + - ~/.nvm/nvm.sh install v0.6.14 + - ~/.nvm/nvm.sh run v0.6.14 + +script: + - $TEST_COMMAND diff --git a/openml_OS/vendor/guzzlehttp/ringphp/CHANGELOG.md b/openml_OS/vendor/guzzlehttp/ringphp/CHANGELOG.md new file mode 100644 index 000000000..8e12bf3cc --- /dev/null +++ b/openml_OS/vendor/guzzlehttp/ringphp/CHANGELOG.md @@ -0,0 +1,118 @@ +# Changelog + + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). + + +## [Unreleased] + + +## [1.1.1] - 2018-07-31 + +### Fixed + +- `continue` keyword usage on PHP 7.3 + + +## [1.1.0] - 2015-05-19 + +### Added + +- Added `CURL_HTTP_VERSION_2_0` + +### Changed + +- The PHP stream wrapper handler now sets `allow_self_signed` to `false` to + match the cURL handler when `verify` is set to `true` or a certificate file. +- Ensuring that a directory exists before using the `save_to` option. +- Response protocol version is now correctly extracted from a response. + +### Fixed + +- Fixed a bug in which the result of `CurlFactory::retryFailedRewind` did not + return an array. + + +## [1.0.7] - 2015-03-29 + +### Fixed + +- PHP 7 fixes. + + +## [1.0.6] - 2015-02-26 + +### Changed + +- The multi handle of the CurlMultiHandler is now created lazily. + +### Fixed + +- Bug fix: futures now extend from React's PromiseInterface to ensure that they + are properly forwarded down the promise chain. + + +## [1.0.5] - 2014-12-10 + +### Added + +- Adding more error information to PHP stream wrapper exceptions. +- Added digest auth integration test support to test server. + + +## [1.0.4] - 2014-12-01 + +### Added + +- Added support for older versions of cURL that do not have CURLOPT_TIMEOUT_MS. +- Added a fix to the StreamHandler to return a `FutureArrayInterface` when an + +### Changed + +- Setting debug to `false` does not enable debug output. error occurs. + + +## [1.0.3] - 2014-11-03 + +### Fixed + +- Setting the `header` stream option as a string to be compatible with GAE. +- Header parsing now ensures that header order is maintained in the parsed + message. + + +## [1.0.2] - 2014-10-28 + +### Fixed + +- Now correctly honoring a `version` option is supplied in a request. + See https://github.com/guzzle/RingPHP/pull/8 + + +## [1.0.1] - 2014-10-26 + +### Fixed + +- Fixed a header parsing issue with the `CurlHandler` and `CurlMultiHandler` + that caused cURL requests with multiple responses to merge repsonses together + (e.g., requests with digest authentication). + + +## 1.0.0 - 2014-10-12 + +- Initial release + + +[Unreleased]: https://github.com/guzzle/RingPHP/compare/1.1.1...HEAD +[1.1.1]: https://github.com/guzzle/RingPHP/compare/1.1.0...1.1.1 +[1.1.0]: https://github.com/guzzle/RingPHP/compare/1.0.7...1.1.0 +[1.0.7]: https://github.com/guzzle/RingPHP/compare/1.0.6...1.0.7 +[1.0.6]: https://github.com/guzzle/RingPHP/compare/1.0.5...1.0.6 +[1.0.5]: https://github.com/guzzle/RingPHP/compare/1.0.4...1.0.5 +[1.0.4]: https://github.com/guzzle/RingPHP/compare/1.0.3...1.0.4 +[1.0.3]: https://github.com/guzzle/RingPHP/compare/1.0.2...1.0.3 +[1.0.2]: https://github.com/guzzle/RingPHP/compare/1.0.1...1.0.2 +[1.0.1]: https://github.com/guzzle/RingPHP/compare/1.0.0...1.0.1 diff --git a/openml_OS/vendor/guzzlehttp/ringphp/LICENSE b/openml_OS/vendor/guzzlehttp/ringphp/LICENSE new file mode 100644 index 000000000..71d3b783c --- /dev/null +++ b/openml_OS/vendor/guzzlehttp/ringphp/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2014 Michael Dowling, https://github.com/mtdowling + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/openml_OS/vendor/guzzlehttp/ringphp/Makefile b/openml_OS/vendor/guzzlehttp/ringphp/Makefile new file mode 100644 index 000000000..21c812e38 --- /dev/null +++ b/openml_OS/vendor/guzzlehttp/ringphp/Makefile @@ -0,0 +1,46 @@ +all: clean coverage docs + +docs: + cd docs && make html + +view-docs: + open docs/_build/html/index.html + +start-server: stop-server + node tests/Client/server.js &> /dev/null & + +stop-server: + @PID=$(shell ps axo pid,command \ + | grep 'tests/Client/server.js' \ + | grep -v grep \ + | cut -f 1 -d " "\ + ) && [ -n "$$PID" ] && kill $$PID || true + +test: start-server + vendor/bin/phpunit $(TEST) + $(MAKE) stop-server + +coverage: start-server + vendor/bin/phpunit --coverage-html=build/artifacts/coverage $(TEST) + $(MAKE) stop-server + +view-coverage: + open build/artifacts/coverage/index.html + +clean: + rm -rf build/artifacts/* + cd docs && make clean + +tag: + $(if $(TAG),,$(error TAG is not defined. Pass via "make tag TAG=4.2.1")) + @echo Tagging $(TAG) + chag update -m '$(TAG) ()' + git add -A + git commit -m '$(TAG) release' + chag tag + +perf: start-server + php tests/perf.php + $(MAKE) stop-server + +.PHONY: docs diff --git a/openml_OS/vendor/guzzlehttp/ringphp/README.rst b/openml_OS/vendor/guzzlehttp/ringphp/README.rst new file mode 100644 index 000000000..10374e813 --- /dev/null +++ b/openml_OS/vendor/guzzlehttp/ringphp/README.rst @@ -0,0 +1,46 @@ +======= +RingPHP +======= + +Provides a simple API and specification that abstracts away the details of HTTP +into a single PHP function. RingPHP be used to power HTTP clients and servers +through a PHP function that accepts a request hash and returns a response hash +that is fulfilled using a `promise `_, +allowing RingPHP to support both synchronous and asynchronous workflows. + +By abstracting the implementation details of different HTTP clients and +servers, RingPHP allows you to utilize pluggable HTTP clients and servers +without tying your application to a specific implementation. + +.. code-block:: php + + 'GET', + 'uri' => '/', + 'headers' => [ + 'host' => ['www.google.com'], + 'x-foo' => ['baz'] + ] + ]); + + $response->then(function (array $response) { + echo $response['status']; + }); + + $response->wait(); + +RingPHP is inspired by Clojure's `Ring `_, +which, in turn, was inspired by Python's WSGI and Ruby's Rack. RingPHP is +utilized as the handler layer in `Guzzle `_ 5.0+ to send +HTTP requests. + +Documentation +------------- + +See http://ringphp.readthedocs.org/ for the full online documentation. diff --git a/openml_OS/vendor/guzzlehttp/ringphp/composer.json b/openml_OS/vendor/guzzlehttp/ringphp/composer.json new file mode 100644 index 000000000..8df60eccc --- /dev/null +++ b/openml_OS/vendor/guzzlehttp/ringphp/composer.json @@ -0,0 +1,43 @@ +{ + "name": "guzzlehttp/ringphp", + "description": "Provides a simple API and specification that abstracts away the details of HTTP into a single PHP function.", + "license": "MIT", + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "require": { + "php": ">=5.4.0", + "guzzlehttp/streams": "~3.0", + "react/promise": "~2.0" + }, + "require-dev": { + "ext-curl": "*", + "phpunit/phpunit": "~4.0" + }, + "suggest": { + "ext-curl": "Guzzle will use specific adapters if cURL is present" + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Ring\\": "src/" + } + }, + "autoload-dev": { + "psr-4": { + "GuzzleHttp\\Tests\\Ring\\": "tests/" + } + }, + "scripts": { + "test": "make test", + "test-ci": "make coverage" + }, + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + } +} diff --git a/openml_OS/vendor/guzzlehttp/ringphp/docs/Makefile b/openml_OS/vendor/guzzlehttp/ringphp/docs/Makefile new file mode 100644 index 000000000..51270aa5d --- /dev/null +++ b/openml_OS/vendor/guzzlehttp/ringphp/docs/Makefile @@ -0,0 +1,153 @@ +# Makefile for Sphinx documentation +# + +# You can set these variables from the command line. +SPHINXOPTS = +SPHINXBUILD = sphinx-build +PAPER = +BUILDDIR = _build + +# Internal variables. +PAPEROPT_a4 = -D latex_paper_size=a4 +PAPEROPT_letter = -D latex_paper_size=letter +ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . +# the i18n builder cannot share the environment and doctrees with the others +I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . + +.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext + +help: + @echo "Please use \`make ' where is one of" + @echo " html to make standalone HTML files" + @echo " dirhtml to make HTML files named index.html in directories" + @echo " singlehtml to make a single large HTML file" + @echo " pickle to make pickle files" + @echo " json to make JSON files" + @echo " htmlhelp to make HTML files and a HTML help project" + @echo " qthelp to make HTML files and a qthelp project" + @echo " devhelp to make HTML files and a Devhelp project" + @echo " epub to make an epub" + @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" + @echo " latexpdf to make LaTeX files and run them through pdflatex" + @echo " text to make text files" + @echo " man to make manual pages" + @echo " texinfo to make Texinfo files" + @echo " info to make Texinfo files and run them through makeinfo" + @echo " gettext to make PO message catalogs" + @echo " changes to make an overview of all changed/added/deprecated items" + @echo " linkcheck to check all external links for integrity" + @echo " doctest to run all doctests embedded in the documentation (if enabled)" + +clean: + -rm -rf $(BUILDDIR)/* + +html: + $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html + @echo + @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." + +dirhtml: + $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml + @echo + @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." + +singlehtml: + $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml + @echo + @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." + +pickle: + $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle + @echo + @echo "Build finished; now you can process the pickle files." + +json: + $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json + @echo + @echo "Build finished; now you can process the JSON files." + +htmlhelp: + $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp + @echo + @echo "Build finished; now you can run HTML Help Workshop with the" \ + ".hhp project file in $(BUILDDIR)/htmlhelp." + +qthelp: + $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp + @echo + @echo "Build finished; now you can run "qcollectiongenerator" with the" \ + ".qhcp project file in $(BUILDDIR)/qthelp, like this:" + @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/GuzzleRing.qhcp" + @echo "To view the help file:" + @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/GuzzleRing.qhc" + +devhelp: + $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp + @echo + @echo "Build finished." + @echo "To view the help file:" + @echo "# mkdir -p $$HOME/.local/share/devhelp/GuzzleRing" + @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/GuzzleRing" + @echo "# devhelp" + +epub: + $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub + @echo + @echo "Build finished. The epub file is in $(BUILDDIR)/epub." + +latex: + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex + @echo + @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." + @echo "Run \`make' in that directory to run these through (pdf)latex" \ + "(use \`make latexpdf' here to do that automatically)." + +latexpdf: + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex + @echo "Running LaTeX files through pdflatex..." + $(MAKE) -C $(BUILDDIR)/latex all-pdf + @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." + +text: + $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text + @echo + @echo "Build finished. The text files are in $(BUILDDIR)/text." + +man: + $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man + @echo + @echo "Build finished. The manual pages are in $(BUILDDIR)/man." + +texinfo: + $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo + @echo + @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo." + @echo "Run \`make' in that directory to run these through makeinfo" \ + "(use \`make info' here to do that automatically)." + +info: + $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo + @echo "Running Texinfo files through makeinfo..." + make -C $(BUILDDIR)/texinfo info + @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo." + +gettext: + $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale + @echo + @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale." + +changes: + $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes + @echo + @echo "The overview file is in $(BUILDDIR)/changes." + +linkcheck: + $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck + @echo + @echo "Link check complete; look for any errors in the above output " \ + "or in $(BUILDDIR)/linkcheck/output.txt." + +doctest: + $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest + @echo "Testing of doctests in the sources finished, look at the " \ + "results in $(BUILDDIR)/doctest/output.txt." diff --git a/openml_OS/vendor/guzzlehttp/ringphp/docs/client_handlers.rst b/openml_OS/vendor/guzzlehttp/ringphp/docs/client_handlers.rst new file mode 100644 index 000000000..3151f0021 --- /dev/null +++ b/openml_OS/vendor/guzzlehttp/ringphp/docs/client_handlers.rst @@ -0,0 +1,173 @@ +=============== +Client Handlers +=============== + +Client handlers accept a request array and return a future response array that +can be used synchronously as an array or asynchronously using a promise. + +Built-In Handlers +----------------- + +RingPHP comes with three built-in client handlers. + +Stream Handler +~~~~~~~~~~~~~~ + +The ``GuzzleHttp\Ring\Client\StreamHandler`` uses PHP's +`http stream wrapper `_ to send +requests. + +.. note:: + + This handler cannot send requests concurrently. + +You can provide an associative array of custom stream context options to the +StreamHandler using the ``stream_context`` key of the ``client`` request +option. + +.. code-block:: php + + use GuzzleHttp\Ring\Client\StreamHandler; + + $response = $handler([ + 'http_method' => 'GET', + 'uri' => '/', + 'headers' => ['host' => ['httpbin.org']], + 'client' => [ + 'stream_context' => [ + 'http' => [ + 'request_fulluri' => true, + 'method' => 'HEAD' + ], + 'socket' => [ + 'bindto' => '127.0.0.1:0' + ], + 'ssl' => [ + 'verify_peer' => false + ] + ] + ] + ]); + + // Even though it's already completed, you can still use a promise + $response->then(function ($response) { + echo $response['status']; // 200 + }); + + // Or access the response using the future interface + echo $response['status']; // 200 + +cURL Handler +~~~~~~~~~~~~ + +The ``GuzzleHttp\Ring\Client\CurlHandler`` can be used with PHP 5.5+ to send +requests using cURL easy handles. This handler is great for sending requests +one at a time because the execute and select loop is implemented in C code +which executes faster and consumes less memory than using PHP's +``curl_multi_*`` interface. + +.. note:: + + This handler cannot send requests concurrently. + +When using the CurlHandler, custom curl options can be specified as an +associative array of `cURL option constants `_ +mapping to values in the ``client`` option of a requst using the **curl** key. + +.. code-block:: php + + use GuzzleHttp\Ring\Client\CurlHandler; + + $handler = new CurlHandler(); + + $request = [ + 'http_method' => 'GET', + 'headers' => ['host' => [Server::$host]], + 'client' => ['curl' => [CURLOPT_LOW_SPEED_LIMIT => 10]] + ]; + + $response = $handler($request); + + // The response can be used directly as an array. + echo $response['status']; // 200 + + // Or, it can be used as a promise (that has already fulfilled). + $response->then(function ($response) { + echo $response['status']; // 200 + }); + +cURL Multi Handler +~~~~~~~~~~~~~~~~~~ + +The ``GuzzleHttp\Ring\Client\CurlMultiHandler`` transfers requests using +cURL's `multi API `_. The +``CurlMultiHandler`` is great for sending requests concurrently. + +.. code-block:: php + + use GuzzleHttp\Ring\Client\CurlMultiHandler; + + $handler = new CurlMultiHandler(); + + $request = [ + 'http_method' => 'GET', + 'headers' => ['host' => [Server::$host]] + ]; + + // this call returns a future array immediately. + $response = $handler($request); + + // Ideally, you should use the promise API to not block. + $response + ->then(function ($response) { + // Got the response at some point in the future + echo $response['status']; // 200 + // Don't break the chain + return $response; + })->then(function ($response) { + // ... + }); + + // If you really need to block, then you can use the response as an + // associative array. This will block until it has completed. + echo $response['status']; // 200 + +Just like the ``CurlHandler``, the ``CurlMultiHandler`` accepts custom curl +option in the ``curl`` key of the ``client`` request option. + +Mock Handler +~~~~~~~~~~~~ + +The ``GuzzleHttp\Ring\Client\MockHandler`` is used to return mock responses. +When constructed, the handler can be configured to return the same response +array over and over, a future response, or a the evaluation of a callback +function. + +.. code-block:: php + + use GuzzleHttp\Ring\Client\MockHandler; + + // Return a canned response. + $mock = new MockHandler(['status' => 200]); + $response = $mock([]); + assert(200 == $response['status']); + assert([] == $response['headers']); + +Implementing Handlers +--------------------- + +Client handlers are just PHP callables (functions or classes that have the +``__invoke`` magic method). The callable accepts a request array and MUST +return an instance of ``GuzzleHttp\Ring\Future\FutureArrayInterface`` so that +the response can be used by both blocking and non-blocking consumers. + +Handlers need to follow a few simple rules: + +1. Do not throw exceptions. If an error is encountered, return an array that + contains the ``error`` key that maps to an ``\Exception`` value. +2. If the request has a ``delay`` client option, then the handler should only + send the request after the specified delay time in seconds. Blocking + handlers may find it convenient to just let the + ``GuzzleHttp\Ring\Core::doSleep($request)`` function handle this for them. +3. Always return an instance of ``GuzzleHttp\Ring\Future\FutureArrayInterface``. +4. Complete any outstanding requests when the handler is destructed. diff --git a/openml_OS/vendor/guzzlehttp/ringphp/docs/client_middleware.rst b/openml_OS/vendor/guzzlehttp/ringphp/docs/client_middleware.rst new file mode 100644 index 000000000..5a2c1a8ab --- /dev/null +++ b/openml_OS/vendor/guzzlehttp/ringphp/docs/client_middleware.rst @@ -0,0 +1,165 @@ +================= +Client Middleware +================= + +Middleware intercepts requests before they are sent over the wire and can be +used to add functionality to handlers. + +Modifying Requests +------------------ + +Let's say you wanted to modify requests before they are sent over the wire +so that they always add specific headers. This can be accomplished by creating +a function that accepts a handler and returns a new function that adds the +composed behavior. + +.. code-block:: php + + use GuzzleHttp\Ring\Client\CurlHandler; + + $handler = new CurlHandler(); + + $addHeaderHandler = function (callable $handler, array $headers = []) { + return function (array $request) use ($handler, $headers) { + // Add our custom headers + foreach ($headers as $key => $value) { + $request['headers'][$key] = $value; + } + + // Send the request using the handler and return the response. + return $handler($request); + } + }; + + // Create a new handler that adds headers to each request. + $handler = $addHeaderHandler($handler, [ + 'X-AddMe' => 'hello', + 'Authorization' => 'Basic xyz' + ]); + + $response = $handler([ + 'http_method' => 'GET', + 'headers' => ['Host' => ['httpbin.org']] + ]); + +Modifying Responses +------------------- + +You can change a response as it's returned from a middleware. Remember that +responses returned from an handler (including middleware) must implement +``GuzzleHttp\Ring\Future\FutureArrayInterface``. In order to be a good citizen, +you should not expect that the responses returned through your middleware will +be completed synchronously. Instead, you should use the +``GuzzleHttp\Ring\Core::proxy()`` function to modify the response when the +underlying promise is resolved. This function is a helper function that makes it +easy to create a new instance of ``FutureArrayInterface`` that wraps an existing +``FutureArrayInterface`` object. + +Let's say you wanted to add headers to a response as they are returned from +your middleware, but you want to make sure you aren't causing future +responses to be dereferenced right away. You can achieve this by modifying the +incoming request and using the ``Core::proxy`` function. + +.. code-block:: php + + use GuzzleHttp\Ring\Core; + use GuzzleHttp\Ring\Client\CurlHandler; + + $handler = new CurlHandler(); + + $responseHeaderHandler = function (callable $handler, array $headers) { + return function (array $request) use ($handler, $headers) { + // Send the request using the wrapped handler. + return Core::proxy($handler($request), function ($response) use ($headers) { + // Add the headers to the response when it is available. + foreach ($headers as $key => $value) { + $response['headers'][$key] = (array) $value; + } + // Note that you can return a regular response array when using + // the proxy method. + return $response; + }); + } + }; + + // Create a new handler that adds headers to each response. + $handler = $responseHeaderHandler($handler, ['X-Header' => 'hello!']); + + $response = $handler([ + 'http_method' => 'GET', + 'headers' => ['Host' => ['httpbin.org']] + ]); + + assert($response['headers']['X-Header'] == 'hello!'); + +Built-In Middleware +------------------- + +RingPHP comes with a few basic client middlewares that modify requests +and responses. + +Streaming Middleware +~~~~~~~~~~~~~~~~~~~~ + +If you want to send all requests with the ``streaming`` option to a specific +handler but other requests to a different handler, then use the streaming +middleware. + +.. code-block:: php + + use GuzzleHttp\Ring\Client\CurlHandler; + use GuzzleHttp\Ring\Client\StreamHandler; + use GuzzleHttp\Ring\Client\Middleware; + + $defaultHandler = new CurlHandler(); + $streamingHandler = new StreamHandler(); + $streamingHandler = Middleware::wrapStreaming( + $defaultHandler, + $streamingHandler + ); + + // Send the request using the streaming handler. + $response = $streamingHandler([ + 'http_method' => 'GET', + 'headers' => ['Host' => ['www.google.com']], + 'stream' => true + ]); + + // Send the request using the default handler. + $response = $streamingHandler([ + 'http_method' => 'GET', + 'headers' => ['Host' => ['www.google.com']] + ]); + +Future Middleware +~~~~~~~~~~~~~~~~~ + +If you want to send all requests with the ``future`` option to a specific +handler but other requests to a different handler, then use the future +middleware. + +.. code-block:: php + + use GuzzleHttp\Ring\Client\CurlHandler; + use GuzzleHttp\Ring\Client\CurlMultiHandler; + use GuzzleHttp\Ring\Client\Middleware; + + $defaultHandler = new CurlHandler(); + $futureHandler = new CurlMultiHandler(); + $futureHandler = Middleware::wrapFuture( + $defaultHandler, + $futureHandler + ); + + // Send the request using the blocking CurlHandler. + $response = $futureHandler([ + 'http_method' => 'GET', + 'headers' => ['Host' => ['www.google.com']] + ]); + + // Send the request using the non-blocking CurlMultiHandler. + $response = $futureHandler([ + 'http_method' => 'GET', + 'headers' => ['Host' => ['www.google.com']], + 'future' => true + ]); diff --git a/openml_OS/vendor/guzzlehttp/ringphp/docs/conf.py b/openml_OS/vendor/guzzlehttp/ringphp/docs/conf.py new file mode 100644 index 000000000..c6404aa1e --- /dev/null +++ b/openml_OS/vendor/guzzlehttp/ringphp/docs/conf.py @@ -0,0 +1,23 @@ +import sys, os +import sphinx_rtd_theme +from sphinx.highlighting import lexers +from pygments.lexers.web import PhpLexer + + +lexers['php'] = PhpLexer(startinline=True, linenos=1) +lexers['php-annotations'] = PhpLexer(startinline=True, linenos=1) +primary_domain = 'php' + +extensions = [] +templates_path = ['_templates'] +source_suffix = '.rst' +master_doc = 'index' +project = u'RingPHP' +copyright = u'2014, Michael Dowling' +version = '1.0.0-alpha' +exclude_patterns = ['_build'] + +html_title = "RingPHP" +html_short_title = "RingPHP" +html_theme = "sphinx_rtd_theme" +html_theme_path = [sphinx_rtd_theme.get_html_theme_path()] diff --git a/openml_OS/vendor/guzzlehttp/ringphp/docs/futures.rst b/openml_OS/vendor/guzzlehttp/ringphp/docs/futures.rst new file mode 100644 index 000000000..af29cb378 --- /dev/null +++ b/openml_OS/vendor/guzzlehttp/ringphp/docs/futures.rst @@ -0,0 +1,164 @@ +======= +Futures +======= + +Futures represent a computation that may have not yet completed. RingPHP +uses hybrid of futures and promises to provide a consistent API that can be +used for both blocking and non-blocking consumers. + +Promises +-------- + +You can get the result of a future when it is ready using the promise interface +of a future. Futures expose a promise API via a ``then()`` method that utilizes +`React's promise library `_. You should +use this API when you do not wish to block. + +.. code-block:: php + + use GuzzleHttp\Ring\Client\CurlMultiHandler; + + $request = [ + 'http_method' => 'GET', + 'uri' => '/', + 'headers' => ['host' => ['httpbin.org']] + ]; + + $response = $handler($request); + + // Use the then() method to use the promise API of the future. + $response->then(function ($response) { + echo $response['status']; + }); + +You can get the promise used by a future, an instance of +``React\Promise\PromiseInterface``, by calling the ``promise()`` method. + +.. code-block:: php + + $response = $handler($request); + $promise = $response->promise(); + $promise->then(function ($response) { + echo $response['status']; + }); + +This promise value can be used with React's +`aggregate promise functions `_. + +Waiting +------- + +You can wait on a future to complete and retrieve the value, or *dereference* +the future, using the ``wait()`` method. Calling the ``wait()`` method of a +future will block until the result is available. The result is then returned or +an exception is thrown if and exception was encountered while waiting on the +the result. Subsequent calls to dereference a future will return the previously +completed result or throw the previously encountered exception. Futures can be +cancelled, which stops the computation if possible. + +.. code-block:: php + + use GuzzleHttp\Ring\Client\CurlMultiHandler; + + $response = $handler([ + 'http_method' => 'GET', + 'uri' => '/', + 'headers' => ['host' => ['httpbin.org']] + ]); + + // You can explicitly call block to wait on a result. + $realizedResponse = $response->wait(); + + // Future responses can be used like a regular PHP array. + echo $response['status']; + +In addition to explicitly calling the ``wait()`` function, using a future like +a normal value will implicitly trigger the ``wait()`` function. + +Future Responses +---------------- + +RingPHP uses futures to return asynchronous responses immediately. Client +handlers always return future responses that implement +``GuzzleHttp\Ring\Future\ArrayFutureInterface``. These future responses act +just like normal PHP associative arrays for blocking access and provide a +promise interface for non-blocking access. + +.. code-block:: php + + use GuzzleHttp\Ring\Client\CurlMultiHandler; + + $handler = new CurlMultiHandler(); + + $request = [ + 'http_method' => 'GET', + 'uri' => '/', + 'headers' => ['Host' => ['www.google.com']] + ]; + + $response = $handler($request); + + // Use the promise API for non-blocking access to the response. The actual + // response value will be delivered to the promise. + $response->then(function ($response) { + echo $response['status']; + }); + + // You can wait (block) until the future is completed. + $response->wait(); + + // This will implicitly call wait(), and will block too! + $response['status']; + +.. important:: + + Futures that are not completed by the time the underlying handler is + destructed will be completed when the handler is shutting down. + +Cancelling +---------- + +Futures can be cancelled if they have not already been dereferenced. + +RingPHP futures are typically implemented with the +``GuzzleHttp\Ring\Future\BaseFutureTrait``. This trait provides the cancellation +functionality that should be common to most implementations. Cancelling a +future response will try to prevent the request from sending over the wire. + +When a future is cancelled, the cancellation function is invoked and performs +the actual work needed to cancel the request from sending if possible +(e.g., telling an event loop to stop sending a request or to close a socket). +If no cancellation function is provided, then a request cannot be cancelled. If +a cancel function is provided, then it should accept the future as an argument +and return true if the future was successfully cancelled or false if it could +not be cancelled. + +Wrapping an existing Promise +---------------------------- + +You can easily create a future from any existing promise using the +``GuzzleHttp\Ring\Future\FutureValue`` class. This class's constructor +accepts a promise as the first argument, a wait function as the second +argument, and a cancellation function as the third argument. The dereference +function is used to force the promise to resolve (for example, manually ticking +an event loop). The cancel function is optional and is used to tell the thing +that created the promise that it can stop computing the result (for example, +telling an event loop to stop transferring a request). + +.. code-block:: php + + use GuzzleHttp\Ring\Future\FutureValue; + use React\Promise\Deferred; + + $deferred = new Deferred(); + $promise = $deferred->promise(); + + $f = new FutureValue( + $promise, + function () use ($deferred) { + // This function is responsible for blocking and resolving the + // promise. Here we pass in a reference to the deferred so that + // it can be resolved or rejected. + $deferred->resolve('foo'); + } + ); diff --git a/openml_OS/vendor/guzzlehttp/ringphp/docs/index.rst b/openml_OS/vendor/guzzlehttp/ringphp/docs/index.rst new file mode 100644 index 000000000..4bbce631c --- /dev/null +++ b/openml_OS/vendor/guzzlehttp/ringphp/docs/index.rst @@ -0,0 +1,50 @@ +======= +RingPHP +======= + +Provides a simple API and specification that abstracts away the details of HTTP +into a single PHP function. RingPHP be used to power HTTP clients and servers +through a PHP function that accepts a request hash and returns a response hash +that is fulfilled using a `promise `_, +allowing RingPHP to support both synchronous and asynchronous workflows. + +By abstracting the implementation details of different HTTP clients and +servers, RingPHP allows you to utilize pluggable HTTP clients and servers +without tying your application to a specific implementation. + +.. toctree:: + :maxdepth: 2 + + spec + futures + client_middleware + client_handlers + testing + +.. code-block:: php + + 'GET', + 'uri' => '/', + 'headers' => [ + 'host' => ['www.google.com'], + 'x-foo' => ['baz'] + ] + ]); + + $response->then(function (array $response) { + echo $response['status']; + }); + + $response->wait(); + +RingPHP is inspired by Clojure's `Ring `_, +which, in turn, was inspired by Python's WSGI and Ruby's Rack. RingPHP is +utilized as the handler layer in `Guzzle `_ 5.0+ to send +HTTP requests. diff --git a/openml_OS/vendor/guzzlehttp/ringphp/docs/requirements.txt b/openml_OS/vendor/guzzlehttp/ringphp/docs/requirements.txt new file mode 100644 index 000000000..483a4e960 --- /dev/null +++ b/openml_OS/vendor/guzzlehttp/ringphp/docs/requirements.txt @@ -0,0 +1 @@ +sphinx_rtd_theme diff --git a/openml_OS/vendor/guzzlehttp/ringphp/docs/spec.rst b/openml_OS/vendor/guzzlehttp/ringphp/docs/spec.rst new file mode 100644 index 000000000..bc9107898 --- /dev/null +++ b/openml_OS/vendor/guzzlehttp/ringphp/docs/spec.rst @@ -0,0 +1,311 @@ +============= +Specification +============= + +RingPHP applications consist of handlers, requests, responses, and +middleware. + +Handlers +-------- + +Handlers are implemented as a PHP ``callable`` that accept a request array +and return a response array (``GuzzleHttp\Ring\Future\FutureArrayInterface``). + +For example: + +.. code-block:: php + + use GuzzleHttp\Ring\Future\CompletedFutureArray; + + $mockHandler = function (array $request) { + return new CompletedFutureArray([ + 'status' => 200, + 'headers' => ['X-Foo' => ['Bar']], + 'body' => 'Hello!' + ]); + }; + +This handler returns the same response each time it is invoked. All RingPHP +handlers must return a ``GuzzleHttp\Ring\Future\FutureArrayInterface``. Use +``GuzzleHttp\Ring\Future\CompletedFutureArray`` when returning a response that +has already completed. + +Requests +-------- + +A request array is a PHP associative array that contains the configuration +settings need to send a request. + +.. code-block:: php + + $request = [ + 'http_method' => 'GET', + 'scheme' => 'http', + 'uri' => '/', + 'body' => 'hello!', + 'client' => ['timeout' => 1.0], + 'headers' => [ + 'host' => ['httpbin.org'], + 'X-Foo' => ['baz', 'bar'] + ] + ]; + +The request array contains the following key value pairs: + +request_method + (string, required) The HTTP request method, must be all caps corresponding + to a HTTP request method, such as ``GET`` or ``POST``. + +scheme + (string) The transport protocol, must be one of ``http`` or ``https``. + Defaults to ``http``. + +uri + (string, required) The request URI excluding the query string. Must + start with "/". + +query_string + (string) The query string, if present (e.g., ``foo=bar``). + +version + (string) HTTP protocol version. Defaults to ``1.1``. + +headers + (required, array) Associative array of headers. Each key represents the + header name. Each value contains an array of strings where each entry of + the array SHOULD be sent over the wire on a separate header line. + +body + (string, fopen resource, ``Iterator``, ``GuzzleHttp\Stream\StreamInterface``) + The body of the request, if present. Can be a string, resource returned + from fopen, an ``Iterator`` that yields chunks of data, an object that + implemented ``__toString``, or a ``GuzzleHttp\Stream\StreamInterface``. + +future + (bool, string) Controls the asynchronous behavior of a response. + + Set to ``true`` or omit the ``future`` option to *request* that a request + will be completed asynchronously. Keep in mind that your request might not + necessarily be completed asynchronously based on the handler you are using. + Set the ``future`` option to ``false`` to request that a synchronous + response be provided. + + You can provide a string value to specify fine-tuned future behaviors that + may be specific to the underlying handlers you are using. There are, + however, some common future options that handlers should implement if + possible. + + lazy + Requests that the handler does not open and send the request + immediately, but rather only opens and sends the request once the + future is dereferenced. This option is often useful for sending a large + number of requests concurrently to allow handlers to take better + advantage of non-blocking transfers by first building up a pool of + requests. + + If an handler does not implement or understand a provided string value, + then the request MUST be treated as if the user provided ``true`` rather + than the string value. + + Future responses created by asynchronous handlers MUST attempt to complete + any outstanding future responses when they are destructed. Asynchronous + handlers MAY choose to automatically complete responses when the number + of outstanding requests reaches an handler-specific threshold. + +Client Specific Options +~~~~~~~~~~~~~~~~~~~~~~~ + +The following options are only used in ring client handlers. + +.. _client-options: + +client + (array) Associative array of client specific transfer options. The + ``client`` request key value pair can contain the following keys: + + cert + (string, array) Set to a string to specify the path to a file + containing a PEM formatted SSL client side certificate. If a password + is required, then set ``cert`` to an array containing the path to the + PEM file in the first array element followed by the certificate + password in the second array element. + + connect_timeout + (float) Float describing the number of seconds to wait while trying to + connect to a server. Use ``0`` to wait indefinitely (the default + behavior). + + debug + (bool, fopen() resource) Set to true or set to a PHP stream returned by + fopen() to enable debug output with the handler used to send a request. + If set to ``true``, the output is written to PHP's STDOUT. If a PHP + ``fopen`` resource handle is provided, the output is written to the + stream. + + "Debug output" is handler specific: different handlers will yield + different output and various various level of detail. For example, when + using cURL to transfer requests, cURL's `CURLOPT_VERBOSE `_ + will be used. When using the PHP stream wrapper, `stream notifications `_ + will be emitted. + + decode_content + (bool) Specify whether or not ``Content-Encoding`` responses + (gzip, deflate, etc.) are automatically decoded. Set to ``true`` to + automatically decode encoded responses. Set to ``false`` to not decode + responses. By default, content is *not* decoded automatically. + + delay + (int) The number of milliseconds to delay before sending the request. + This is often used for delaying before retrying a request. Handlers + SHOULD implement this if possible, but it is not a strict requirement. + + progress + (function) Defines a function to invoke when transfer progress is made. + The function accepts the following arguments: + + 1. The total number of bytes expected to be downloaded + 2. The number of bytes downloaded so far + 3. The number of bytes expected to be uploaded + 4. The number of bytes uploaded so far + + proxy + (string, array) Pass a string to specify an HTTP proxy, or an + associative array to specify different proxies for different protocols + where the scheme is the key and the value is the proxy address. + + .. code-block:: php + + $request = [ + 'http_method' => 'GET', + 'headers' => ['host' => ['httpbin.org']], + 'client' => [ + // Use different proxies for different URI schemes. + 'proxy' => [ + 'http' => 'http://proxy.example.com:5100', + 'https' => 'https://proxy.example.com:6100' + ] + ] + ]; + + ssl_key + (string, array) Specify the path to a file containing a private SSL key + in PEM format. If a password is required, then set to an array + containing the path to the SSL key in the first array element followed + by the password required for the certificate in the second element. + + save_to + (string, fopen resource, ``GuzzleHttp\Stream\StreamInterface``) + Specifies where the body of the response is downloaded. Pass a string to + open a local file on disk and save the output to the file. Pass an fopen + resource to save the output to a PHP stream resource. Pass a + ``GuzzleHttp\Stream\StreamInterface`` to save the output to a Guzzle + StreamInterface. Omitting this option will typically save the body of a + response to a PHP temp stream. + + stream + (bool) Set to true to stream a response rather than download it all + up-front. This option will only be utilized when the corresponding + handler supports it. + + timeout + (float) Float describing the timeout of the request in seconds. Use 0 to + wait indefinitely (the default behavior). + + verify + (bool, string) Describes the SSL certificate verification behavior of a + request. Set to true to enable SSL certificate verification using the + system CA bundle when available (the default). Set to false to disable + certificate verification (this is insecure!). Set to a string to provide + the path to a CA bundle on disk to enable verification using a custom + certificate. + + version + (string) HTTP protocol version to use with the request. + +Server Specific Options +~~~~~~~~~~~~~~~~~~~~~~~ + +The following options are only used in ring server handlers. + +server_port + (integer) The port on which the request is being handled. This is only + used with ring servers, and is required. + +server_name + (string) The resolved server name, or the server IP address. Required when + using a Ring server. + +remote_addr + (string) The IP address of the client or the last proxy that sent the + request. Required when using a Ring server. + +Responses +--------- + +A response is an array-like object that implements +``GuzzleHttp\Ring\Future\FutureArrayInterface``. Responses contain the +following key value pairs: + +body + (string, fopen resource, ``Iterator``, ``GuzzleHttp\Stream\StreamInterface``) + The body of the response, if present. Can be a string, resource returned + from fopen, an ``Iterator`` that yields chunks of data, an object that + implemented ``__toString``, or a ``GuzzleHttp\Stream\StreamInterface``. + +effective_url + (string) The URL that returned the resulting response. + +error + (``\Exception``) Contains an exception describing any errors that were + encountered during the transfer. + +headers + (Required, array) Associative array of headers. Each key represents the + header name. Each value contains an array of strings where each entry of + the array is a header line. The headers array MAY be an empty array in the + event an error occurred before a response was received. + +reason + (string) Optional reason phrase. This option should be provided when the + reason phrase does not match the typical reason phrase associated with the + ``status`` code. See `RFC 7231 `_ + for a list of HTTP reason phrases mapped to status codes. + +status + (Required, integer) The HTTP status code. The status code MAY be set to + ``null`` in the event an error occurred before a response was received + (e.g., a networking error). + +transfer_stats + (array) Provides an associative array of arbitrary transfer statistics if + provided by the underlying handler. + +version + (string) HTTP protocol version. Defaults to ``1.1``. + +Middleware +---------- + +Ring middleware augments the functionality of handlers by invoking them in the +process of generating responses. Middleware is typically implemented as a +higher-order function that takes one or more handlers as arguments followed by +an optional associative array of options as the last argument, returning a new +handler with the desired compound behavior. + +Here's an example of a middleware that adds a Content-Type header to each +request. + +.. code-block:: php + + use GuzzleHttp\Ring\Client\CurlHandler; + use GuzzleHttp\Ring\Core; + + $contentTypeHandler = function(callable $handler, $contentType) { + return function (array $request) use ($handler, $contentType) { + return $handler(Core::setHeader('Content-Type', $contentType)); + }; + }; + + $baseHandler = new CurlHandler(); + $wrappedHandler = $contentTypeHandler($baseHandler, 'text/html'); + $response = $wrappedHandler([/** request hash **/]); diff --git a/openml_OS/vendor/guzzlehttp/ringphp/docs/testing.rst b/openml_OS/vendor/guzzlehttp/ringphp/docs/testing.rst new file mode 100644 index 000000000..9df2562ed --- /dev/null +++ b/openml_OS/vendor/guzzlehttp/ringphp/docs/testing.rst @@ -0,0 +1,74 @@ +======= +Testing +======= + +RingPHP tests client handlers using `PHPUnit `_ and a +built-in node.js web server. + +Running Tests +------------- + +First, install the dependencies using `Composer `_. + + composer.phar install + +Next, run the unit tests using ``Make``. + + make test + +The tests are also run on Travis-CI on each commit: https://travis-ci.org/guzzle/guzzle-ring + +Test Server +----------- + +Testing client handlers usually involves actually sending HTTP requests. +RingPHP provides a node.js web server that returns canned responses and +keep a list of the requests that have been received. The server can then +be queried to get a list of the requests that were sent by the client so that +you can ensure that the client serialized and transferred requests as intended. + +The server keeps a list of queued responses and returns responses that are +popped off of the queue as HTTP requests are received. When there are not +more responses to serve, the server returns a 500 error response. + +The test server uses the ``GuzzleHttp\Tests\Ring\Client\Server`` class to +control the server. + +.. code-block:: php + + use GuzzleHttp\Ring\Client\StreamHandler; + use GuzzleHttp\Tests\Ring\Client\Server; + + // First return a 200 followed by a 404 response. + Server::enqueue([ + ['status' => 200], + ['status' => 404] + ]); + + $handler = new StreamHandler(); + + $response = $handler([ + 'http_method' => 'GET', + 'headers' => ['host' => [Server::$host]], + 'uri' => '/' + ]); + + assert(200 == $response['status']); + + $response = $handler([ + 'http_method' => 'HEAD', + 'headers' => ['host' => [Server::$host]], + 'uri' => '/' + ]); + + assert(404 == $response['status']); + +After requests have been sent, you can get a list of the requests as they +were sent over the wire to ensure they were sent correctly. + +.. code-block:: php + + $received = Server::received(); + + assert('GET' == $received[0]['http_method']); + assert('HEAD' == $received[1]['http_method']); diff --git a/openml_OS/vendor/guzzlehttp/ringphp/phpunit.xml.dist b/openml_OS/vendor/guzzlehttp/ringphp/phpunit.xml.dist new file mode 100644 index 000000000..1d1929025 --- /dev/null +++ b/openml_OS/vendor/guzzlehttp/ringphp/phpunit.xml.dist @@ -0,0 +1,14 @@ + + + + + tests + + + + + src + + + diff --git a/openml_OS/vendor/guzzlehttp/ringphp/src/Client/ClientUtils.php b/openml_OS/vendor/guzzlehttp/ringphp/src/Client/ClientUtils.php new file mode 100644 index 000000000..27d5fe7ea --- /dev/null +++ b/openml_OS/vendor/guzzlehttp/ringphp/src/Client/ClientUtils.php @@ -0,0 +1,74 @@ +getDefaultOptions($request, $headers); + $this->applyMethod($request, $options); + + if (isset($request['client'])) { + $this->applyHandlerOptions($request, $options); + } + + $this->applyHeaders($request, $options); + unset($options['_headers']); + + // Add handler options from the request's configuration options + if (isset($request['client']['curl'])) { + $options = $this->applyCustomCurlOptions( + $request['client']['curl'], + $options + ); + } + + if (!$handle) { + $handle = curl_init(); + } + + $body = $this->getOutputBody($request, $options); + curl_setopt_array($handle, $options); + + return [$handle, &$headers, $body]; + } + + /** + * Creates a response hash from a cURL result. + * + * @param callable $handler Handler that was used. + * @param array $request Request that sent. + * @param array $response Response hash to update. + * @param array $headers Headers received during transfer. + * @param resource $body Body fopen response. + * + * @return array + */ + public static function createResponse( + callable $handler, + array $request, + array $response, + array $headers, + $body + ) { + if (isset($response['transfer_stats']['url'])) { + $response['effective_url'] = $response['transfer_stats']['url']; + } + + if (!empty($headers)) { + $startLine = explode(' ', array_shift($headers), 3); + $headerList = Core::headersFromLines($headers); + $response['headers'] = $headerList; + $response['version'] = isset($startLine[0]) ? substr($startLine[0], 5) : null; + $response['status'] = isset($startLine[1]) ? (int) $startLine[1] : null; + $response['reason'] = isset($startLine[2]) ? $startLine[2] : null; + $response['body'] = $body; + Core::rewindBody($response); + } + + return !empty($response['curl']['errno']) || !isset($response['status']) + ? self::createErrorResponse($handler, $request, $response) + : $response; + } + + private static function createErrorResponse( + callable $handler, + array $request, + array $response + ) { + static $connectionErrors = [ + CURLE_OPERATION_TIMEOUTED => true, + CURLE_COULDNT_RESOLVE_HOST => true, + CURLE_COULDNT_CONNECT => true, + CURLE_SSL_CONNECT_ERROR => true, + CURLE_GOT_NOTHING => true, + ]; + + // Retry when nothing is present or when curl failed to rewind. + if (!isset($response['err_message']) + && (empty($response['curl']['errno']) + || $response['curl']['errno'] == 65) + ) { + return self::retryFailedRewind($handler, $request, $response); + } + + $message = isset($response['err_message']) + ? $response['err_message'] + : sprintf('cURL error %s: %s', + $response['curl']['errno'], + isset($response['curl']['error']) + ? $response['curl']['error'] + : 'See http://curl.haxx.se/libcurl/c/libcurl-errors.html'); + + $error = isset($response['curl']['errno']) + && isset($connectionErrors[$response['curl']['errno']]) + ? new ConnectException($message) + : new RingException($message); + + return $response + [ + 'status' => null, + 'reason' => null, + 'body' => null, + 'headers' => [], + 'error' => $error, + ]; + } + + private function getOutputBody(array $request, array &$options) + { + // Determine where the body of the response (if any) will be streamed. + if (isset($options[CURLOPT_WRITEFUNCTION])) { + return $request['client']['save_to']; + } + + if (isset($options[CURLOPT_FILE])) { + return $options[CURLOPT_FILE]; + } + + if ($request['http_method'] != 'HEAD') { + // Create a default body if one was not provided + return $options[CURLOPT_FILE] = fopen('php://temp', 'w+'); + } + + return null; + } + + private function getDefaultOptions(array $request, array &$headers) + { + $url = Core::url($request); + $startingResponse = false; + + $options = [ + '_headers' => $request['headers'], + CURLOPT_CUSTOMREQUEST => $request['http_method'], + CURLOPT_URL => $url, + CURLOPT_RETURNTRANSFER => false, + CURLOPT_HEADER => false, + CURLOPT_CONNECTTIMEOUT => 150, + CURLOPT_HEADERFUNCTION => function ($ch, $h) use (&$headers, &$startingResponse) { + $value = trim($h); + if ($value === '') { + $startingResponse = true; + } elseif ($startingResponse) { + $startingResponse = false; + $headers = [$value]; + } else { + $headers[] = $value; + } + return strlen($h); + }, + ]; + + if (isset($request['version'])) { + if ($request['version'] == 2.0) { + $options[CURLOPT_HTTP_VERSION] = CURL_HTTP_VERSION_2_0; + } else if ($request['version'] == 1.1) { + $options[CURLOPT_HTTP_VERSION] = CURL_HTTP_VERSION_1_1; + } else { + $options[CURLOPT_HTTP_VERSION] = CURL_HTTP_VERSION_1_0; + } + } + + if (defined('CURLOPT_PROTOCOLS')) { + $options[CURLOPT_PROTOCOLS] = CURLPROTO_HTTP | CURLPROTO_HTTPS; + } + + return $options; + } + + private function applyMethod(array $request, array &$options) + { + if (isset($request['body'])) { + $this->applyBody($request, $options); + return; + } + + switch ($request['http_method']) { + case 'PUT': + case 'POST': + // See http://tools.ietf.org/html/rfc7230#section-3.3.2 + if (!Core::hasHeader($request, 'Content-Length')) { + $options[CURLOPT_HTTPHEADER][] = 'Content-Length: 0'; + } + break; + case 'HEAD': + $options[CURLOPT_NOBODY] = true; + unset( + $options[CURLOPT_WRITEFUNCTION], + $options[CURLOPT_READFUNCTION], + $options[CURLOPT_FILE], + $options[CURLOPT_INFILE] + ); + } + } + + private function applyBody(array $request, array &$options) + { + $contentLength = Core::firstHeader($request, 'Content-Length'); + $size = $contentLength !== null ? (int) $contentLength : null; + + // Send the body as a string if the size is less than 1MB OR if the + // [client][curl][body_as_string] request value is set. + if (($size !== null && $size < 1000000) || + isset($request['client']['curl']['body_as_string']) || + is_string($request['body']) + ) { + $options[CURLOPT_POSTFIELDS] = Core::body($request); + // Don't duplicate the Content-Length header + $this->removeHeader('Content-Length', $options); + $this->removeHeader('Transfer-Encoding', $options); + } else { + $options[CURLOPT_UPLOAD] = true; + if ($size !== null) { + // Let cURL handle setting the Content-Length header + $options[CURLOPT_INFILESIZE] = $size; + $this->removeHeader('Content-Length', $options); + } + $this->addStreamingBody($request, $options); + } + + // If the Expect header is not present, prevent curl from adding it + if (!Core::hasHeader($request, 'Expect')) { + $options[CURLOPT_HTTPHEADER][] = 'Expect:'; + } + + // cURL sometimes adds a content-type by default. Prevent this. + if (!Core::hasHeader($request, 'Content-Type')) { + $options[CURLOPT_HTTPHEADER][] = 'Content-Type:'; + } + } + + private function addStreamingBody(array $request, array &$options) + { + $body = $request['body']; + + if ($body instanceof StreamInterface) { + $options[CURLOPT_READFUNCTION] = function ($ch, $fd, $length) use ($body) { + return (string) $body->read($length); + }; + if (!isset($options[CURLOPT_INFILESIZE])) { + if ($size = $body->getSize()) { + $options[CURLOPT_INFILESIZE] = $size; + } + } + } elseif (is_resource($body)) { + $options[CURLOPT_INFILE] = $body; + } elseif ($body instanceof \Iterator) { + $buf = ''; + $options[CURLOPT_READFUNCTION] = function ($ch, $fd, $length) use ($body, &$buf) { + if ($body->valid()) { + $buf .= $body->current(); + $body->next(); + } + $result = (string) substr($buf, 0, $length); + $buf = substr($buf, $length); + return $result; + }; + } else { + throw new \InvalidArgumentException('Invalid request body provided'); + } + } + + private function applyHeaders(array $request, array &$options) + { + foreach ($options['_headers'] as $name => $values) { + foreach ($values as $value) { + $options[CURLOPT_HTTPHEADER][] = "$name: $value"; + } + } + + // Remove the Accept header if one was not set + if (!Core::hasHeader($request, 'Accept')) { + $options[CURLOPT_HTTPHEADER][] = 'Accept:'; + } + } + + /** + * Takes an array of curl options specified in the 'curl' option of a + * request's configuration array and maps them to CURLOPT_* options. + * + * This method is only called when a request has a 'curl' config setting. + * + * @param array $config Configuration array of custom curl option + * @param array $options Array of existing curl options + * + * @return array Returns a new array of curl options + */ + private function applyCustomCurlOptions(array $config, array $options) + { + $curlOptions = []; + foreach ($config as $key => $value) { + if (is_int($key)) { + $curlOptions[$key] = $value; + } + } + + return $curlOptions + $options; + } + + /** + * Remove a header from the options array. + * + * @param string $name Case-insensitive header to remove + * @param array $options Array of options to modify + */ + private function removeHeader($name, array &$options) + { + foreach (array_keys($options['_headers']) as $key) { + if (!strcasecmp($key, $name)) { + unset($options['_headers'][$key]); + return; + } + } + } + + /** + * Applies an array of request client options to a the options array. + * + * This method uses a large switch rather than double-dispatch to save on + * high overhead of calling functions in PHP. + */ + private function applyHandlerOptions(array $request, array &$options) + { + foreach ($request['client'] as $key => $value) { + switch ($key) { + // Violating PSR-4 to provide more room. + case 'verify': + + if ($value === false) { + unset($options[CURLOPT_CAINFO]); + $options[CURLOPT_SSL_VERIFYHOST] = 0; + $options[CURLOPT_SSL_VERIFYPEER] = false; + continue 2; + } + + $options[CURLOPT_SSL_VERIFYHOST] = 2; + $options[CURLOPT_SSL_VERIFYPEER] = true; + + if (is_string($value)) { + $options[CURLOPT_CAINFO] = $value; + if (!file_exists($value)) { + throw new \InvalidArgumentException( + "SSL CA bundle not found: $value" + ); + } + } + break; + + case 'decode_content': + + if ($value === false) { + continue 2; + } + + $accept = Core::firstHeader($request, 'Accept-Encoding'); + if ($accept) { + $options[CURLOPT_ENCODING] = $accept; + } else { + $options[CURLOPT_ENCODING] = ''; + // Don't let curl send the header over the wire + $options[CURLOPT_HTTPHEADER][] = 'Accept-Encoding:'; + } + break; + + case 'save_to': + + if (is_string($value)) { + if (!is_dir(dirname($value))) { + throw new \RuntimeException(sprintf( + 'Directory %s does not exist for save_to value of %s', + dirname($value), + $value + )); + } + $value = new LazyOpenStream($value, 'w+'); + } + + if ($value instanceof StreamInterface) { + $options[CURLOPT_WRITEFUNCTION] = + function ($ch, $write) use ($value) { + return $value->write($write); + }; + } elseif (is_resource($value)) { + $options[CURLOPT_FILE] = $value; + } else { + throw new \InvalidArgumentException('save_to must be a ' + . 'GuzzleHttp\Stream\StreamInterface or resource'); + } + break; + + case 'timeout': + + if (defined('CURLOPT_TIMEOUT_MS')) { + $options[CURLOPT_TIMEOUT_MS] = $value * 1000; + } else { + $options[CURLOPT_TIMEOUT] = $value; + } + break; + + case 'connect_timeout': + + if (defined('CURLOPT_CONNECTTIMEOUT_MS')) { + $options[CURLOPT_CONNECTTIMEOUT_MS] = $value * 1000; + } else { + $options[CURLOPT_CONNECTTIMEOUT] = $value; + } + break; + + case 'proxy': + + if (!is_array($value)) { + $options[CURLOPT_PROXY] = $value; + } elseif (isset($request['scheme'])) { + $scheme = $request['scheme']; + if (isset($value[$scheme])) { + $options[CURLOPT_PROXY] = $value[$scheme]; + } + } + break; + + case 'cert': + + if (is_array($value)) { + $options[CURLOPT_SSLCERTPASSWD] = $value[1]; + $value = $value[0]; + } + + if (!file_exists($value)) { + throw new \InvalidArgumentException( + "SSL certificate not found: {$value}" + ); + } + + $options[CURLOPT_SSLCERT] = $value; + break; + + case 'ssl_key': + + if (is_array($value)) { + $options[CURLOPT_SSLKEYPASSWD] = $value[1]; + $value = $value[0]; + } + + if (!file_exists($value)) { + throw new \InvalidArgumentException( + "SSL private key not found: {$value}" + ); + } + + $options[CURLOPT_SSLKEY] = $value; + break; + + case 'progress': + + if (!is_callable($value)) { + throw new \InvalidArgumentException( + 'progress client option must be callable' + ); + } + + $options[CURLOPT_NOPROGRESS] = false; + $options[CURLOPT_PROGRESSFUNCTION] = + function () use ($value) { + $args = func_get_args(); + // PHP 5.5 pushed the handle onto the start of the args + if (is_resource($args[0])) { + array_shift($args); + } + call_user_func_array($value, $args); + }; + break; + + case 'debug': + + if ($value) { + $options[CURLOPT_STDERR] = Core::getDebugResource($value); + $options[CURLOPT_VERBOSE] = true; + } + break; + } + } + } + + /** + * This function ensures that a response was set on a transaction. If one + * was not set, then the request is retried if possible. This error + * typically means you are sending a payload, curl encountered a + * "Connection died, retrying a fresh connect" error, tried to rewind the + * stream, and then encountered a "necessary data rewind wasn't possible" + * error, causing the request to be sent through curl_multi_info_read() + * without an error status. + */ + private static function retryFailedRewind( + callable $handler, + array $request, + array $response + ) { + // If there is no body, then there is some other kind of issue. This + // is weird and should probably never happen. + if (!isset($request['body'])) { + $response['err_message'] = 'No response was received for a request ' + . 'with no body. This could mean that you are saturating your ' + . 'network.'; + return self::createErrorResponse($handler, $request, $response); + } + + if (!Core::rewindBody($request)) { + $response['err_message'] = 'The connection unexpectedly failed ' + . 'without providing an error. The request would have been ' + . 'retried, but attempting to rewind the request body failed.'; + return self::createErrorResponse($handler, $request, $response); + } + + // Retry no more than 3 times before giving up. + if (!isset($request['curl']['retries'])) { + $request['curl']['retries'] = 1; + } elseif ($request['curl']['retries'] == 2) { + $response['err_message'] = 'The cURL request was retried 3 times ' + . 'and did no succeed. cURL was unable to rewind the body of ' + . 'the request and subsequent retries resulted in the same ' + . 'error. Turn on the debug option to see what went wrong. ' + . 'See https://bugs.php.net/bug.php?id=47204 for more information.'; + return self::createErrorResponse($handler, $request, $response); + } else { + $request['curl']['retries']++; + } + + return $handler($request); + } +} diff --git a/openml_OS/vendor/guzzlehttp/ringphp/src/Client/CurlHandler.php b/openml_OS/vendor/guzzlehttp/ringphp/src/Client/CurlHandler.php new file mode 100644 index 000000000..e00aa4eac --- /dev/null +++ b/openml_OS/vendor/guzzlehttp/ringphp/src/Client/CurlHandler.php @@ -0,0 +1,135 @@ +handles = $this->ownedHandles = []; + $this->factory = isset($options['handle_factory']) + ? $options['handle_factory'] + : new CurlFactory(); + $this->maxHandles = isset($options['max_handles']) + ? $options['max_handles'] + : 5; + } + + public function __destruct() + { + foreach ($this->handles as $handle) { + if (is_resource($handle)) { + curl_close($handle); + } + } + } + + /** + * @param array $request + * + * @return CompletedFutureArray + */ + public function __invoke(array $request) + { + return new CompletedFutureArray( + $this->_invokeAsArray($request) + ); + } + + /** + * @internal + * + * @param array $request + * + * @return array + */ + public function _invokeAsArray(array $request) + { + $factory = $this->factory; + + // Ensure headers are by reference. They're updated elsewhere. + $result = $factory($request, $this->checkoutEasyHandle()); + $h = $result[0]; + $hd =& $result[1]; + $bd = $result[2]; + Core::doSleep($request); + curl_exec($h); + $response = ['transfer_stats' => curl_getinfo($h)]; + $response['curl']['error'] = curl_error($h); + $response['curl']['errno'] = curl_errno($h); + $response['transfer_stats'] = array_merge($response['transfer_stats'], $response['curl']); + $this->releaseEasyHandle($h); + + return CurlFactory::createResponse([$this, '_invokeAsArray'], $request, $response, $hd, $bd); + } + + private function checkoutEasyHandle() + { + // Find an unused handle in the cache + if (false !== ($key = array_search(false, $this->ownedHandles, true))) { + $this->ownedHandles[$key] = true; + return $this->handles[$key]; + } + + // Add a new handle + $handle = curl_init(); + $id = (int) $handle; + $this->handles[$id] = $handle; + $this->ownedHandles[$id] = true; + + return $handle; + } + + private function releaseEasyHandle($handle) + { + $id = (int) $handle; + if (count($this->ownedHandles) > $this->maxHandles) { + curl_close($this->handles[$id]); + unset($this->handles[$id], $this->ownedHandles[$id]); + } else { + // curl_reset doesn't clear these out for some reason + static $unsetValues = [ + CURLOPT_HEADERFUNCTION => null, + CURLOPT_WRITEFUNCTION => null, + CURLOPT_READFUNCTION => null, + CURLOPT_PROGRESSFUNCTION => null, + ]; + curl_setopt_array($handle, $unsetValues); + curl_reset($handle); + $this->ownedHandles[$id] = false; + } + } +} diff --git a/openml_OS/vendor/guzzlehttp/ringphp/src/Client/CurlMultiHandler.php b/openml_OS/vendor/guzzlehttp/ringphp/src/Client/CurlMultiHandler.php new file mode 100644 index 000000000..f84cf1993 --- /dev/null +++ b/openml_OS/vendor/guzzlehttp/ringphp/src/Client/CurlMultiHandler.php @@ -0,0 +1,248 @@ +_mh = $options['mh']; + } + $this->factory = isset($options['handle_factory']) + ? $options['handle_factory'] : new CurlFactory(); + $this->selectTimeout = isset($options['select_timeout']) + ? $options['select_timeout'] : 1; + $this->maxHandles = isset($options['max_handles']) + ? $options['max_handles'] : 100; + } + + public function __get($name) + { + if ($name === '_mh') { + return $this->_mh = curl_multi_init(); + } + + throw new \BadMethodCallException(); + } + + public function __destruct() + { + // Finish any open connections before terminating the script. + if ($this->handles) { + $this->execute(); + } + + if (isset($this->_mh)) { + curl_multi_close($this->_mh); + unset($this->_mh); + } + } + + public function __invoke(array $request) + { + $factory = $this->factory; + $result = $factory($request); + $entry = [ + 'request' => $request, + 'response' => [], + 'handle' => $result[0], + 'headers' => &$result[1], + 'body' => $result[2], + 'deferred' => new Deferred(), + ]; + + $id = (int) $result[0]; + + $future = new FutureArray( + $entry['deferred']->promise(), + [$this, 'execute'], + function () use ($id) { + return $this->cancel($id); + } + ); + + $this->addRequest($entry); + + // Transfer outstanding requests if there are too many open handles. + if (count($this->handles) >= $this->maxHandles) { + $this->execute(); + } + + return $future; + } + + /** + * Runs until all outstanding connections have completed. + */ + public function execute() + { + do { + + if ($this->active && + curl_multi_select($this->_mh, $this->selectTimeout) === -1 + ) { + // Perform a usleep if a select returns -1. + // See: https://bugs.php.net/bug.php?id=61141 + usleep(250); + } + + // Add any delayed futures if needed. + if ($this->delays) { + $this->addDelays(); + } + + do { + $mrc = curl_multi_exec($this->_mh, $this->active); + } while ($mrc === CURLM_CALL_MULTI_PERFORM); + + $this->processMessages(); + + // If there are delays but no transfers, then sleep for a bit. + if (!$this->active && $this->delays) { + usleep(500); + } + + } while ($this->active || $this->handles); + } + + private function addRequest(array &$entry) + { + $id = (int) $entry['handle']; + $this->handles[$id] = $entry; + + // If the request is a delay, then add the reques to the curl multi + // pool only after the specified delay. + if (isset($entry['request']['client']['delay'])) { + $this->delays[$id] = microtime(true) + ($entry['request']['client']['delay'] / 1000); + } elseif (empty($entry['request']['future'])) { + curl_multi_add_handle($this->_mh, $entry['handle']); + } else { + curl_multi_add_handle($this->_mh, $entry['handle']); + // "lazy" futures are only sent once the pool has many requests. + if ($entry['request']['future'] !== 'lazy') { + do { + $mrc = curl_multi_exec($this->_mh, $this->active); + } while ($mrc === CURLM_CALL_MULTI_PERFORM); + $this->processMessages(); + } + } + } + + private function removeProcessed($id) + { + if (isset($this->handles[$id])) { + curl_multi_remove_handle( + $this->_mh, + $this->handles[$id]['handle'] + ); + curl_close($this->handles[$id]['handle']); + unset($this->handles[$id], $this->delays[$id]); + } + } + + /** + * Cancels a handle from sending and removes references to it. + * + * @param int $id Handle ID to cancel and remove. + * + * @return bool True on success, false on failure. + */ + private function cancel($id) + { + // Cannot cancel if it has been processed. + if (!isset($this->handles[$id])) { + return false; + } + + $handle = $this->handles[$id]['handle']; + unset($this->delays[$id], $this->handles[$id]); + curl_multi_remove_handle($this->_mh, $handle); + curl_close($handle); + + return true; + } + + private function addDelays() + { + $currentTime = microtime(true); + + foreach ($this->delays as $id => $delay) { + if ($currentTime >= $delay) { + unset($this->delays[$id]); + curl_multi_add_handle( + $this->_mh, + $this->handles[$id]['handle'] + ); + } + } + } + + private function processMessages() + { + while ($done = curl_multi_info_read($this->_mh)) { + $id = (int) $done['handle']; + + if (!isset($this->handles[$id])) { + // Probably was cancelled. + continue; + } + + $entry = $this->handles[$id]; + $entry['response']['transfer_stats'] = curl_getinfo($done['handle']); + + if ($done['result'] !== CURLM_OK) { + $entry['response']['curl']['errno'] = $done['result']; + $entry['response']['curl']['error'] = curl_error($done['handle']); + } + + $result = CurlFactory::createResponse( + $this, + $entry['request'], + $entry['response'], + $entry['headers'], + $entry['body'] + ); + + $this->removeProcessed($id); + $entry['deferred']->resolve($result); + } + } +} diff --git a/openml_OS/vendor/guzzlehttp/ringphp/src/Client/Middleware.php b/openml_OS/vendor/guzzlehttp/ringphp/src/Client/Middleware.php new file mode 100644 index 000000000..6fa7318ab --- /dev/null +++ b/openml_OS/vendor/guzzlehttp/ringphp/src/Client/Middleware.php @@ -0,0 +1,58 @@ +result = $result; + } + + public function __invoke(array $request) + { + Core::doSleep($request); + $response = is_callable($this->result) + ? call_user_func($this->result, $request) + : $this->result; + + if (is_array($response)) { + $response = new CompletedFutureArray($response + [ + 'status' => null, + 'body' => null, + 'headers' => [], + 'reason' => null, + 'effective_url' => null, + ]); + } elseif (!$response instanceof FutureArrayInterface) { + throw new \InvalidArgumentException( + 'Response must be an array or FutureArrayInterface. Found ' + . Core::describeType($request) + ); + } + + return $response; + } +} diff --git a/openml_OS/vendor/guzzlehttp/ringphp/src/Client/StreamHandler.php b/openml_OS/vendor/guzzlehttp/ringphp/src/Client/StreamHandler.php new file mode 100644 index 000000000..4bacec133 --- /dev/null +++ b/openml_OS/vendor/guzzlehttp/ringphp/src/Client/StreamHandler.php @@ -0,0 +1,414 @@ +options = $options; + } + + public function __invoke(array $request) + { + $url = Core::url($request); + Core::doSleep($request); + + try { + // Does not support the expect header. + $request = Core::removeHeader($request, 'Expect'); + $stream = $this->createStream($url, $request); + return $this->createResponse($request, $url, $stream); + } catch (RingException $e) { + return $this->createErrorResponse($url, $e); + } + } + + private function createResponse(array $request, $url, $stream) + { + $hdrs = $this->lastHeaders; + $this->lastHeaders = null; + $parts = explode(' ', array_shift($hdrs), 3); + $response = [ + 'version' => substr($parts[0], 5), + 'status' => $parts[1], + 'reason' => isset($parts[2]) ? $parts[2] : null, + 'headers' => Core::headersFromLines($hdrs), + 'effective_url' => $url, + ]; + + $stream = $this->checkDecode($request, $response, $stream); + + // If not streaming, then drain the response into a stream. + if (empty($request['client']['stream'])) { + $dest = isset($request['client']['save_to']) + ? $request['client']['save_to'] + : fopen('php://temp', 'r+'); + $stream = $this->drain($stream, $dest); + } + + $response['body'] = $stream; + + return new CompletedFutureArray($response); + } + + private function checkDecode(array $request, array $response, $stream) + { + // Automatically decode responses when instructed. + if (!empty($request['client']['decode_content'])) { + switch (Core::firstHeader($response, 'Content-Encoding', true)) { + case 'gzip': + case 'deflate': + $stream = new InflateStream(Stream::factory($stream)); + break; + } + } + + return $stream; + } + + /** + * Drains the stream into the "save_to" client option. + * + * @param resource $stream + * @param string|resource|StreamInterface $dest + * + * @return Stream + * @throws \RuntimeException when the save_to option is invalid. + */ + private function drain($stream, $dest) + { + if (is_resource($stream)) { + if (!is_resource($dest)) { + $stream = Stream::factory($stream); + } else { + stream_copy_to_stream($stream, $dest); + fclose($stream); + rewind($dest); + return $dest; + } + } + + // Stream the response into the destination stream + $dest = is_string($dest) + ? new Stream(Utils::open($dest, 'r+')) + : Stream::factory($dest); + + Utils::copyToStream($stream, $dest); + $dest->seek(0); + $stream->close(); + + return $dest; + } + + /** + * Creates an error response for the given stream. + * + * @param string $url + * @param RingException $e + * + * @return array + */ + private function createErrorResponse($url, RingException $e) + { + // Determine if the error was a networking error. + $message = $e->getMessage(); + + // This list can probably get more comprehensive. + if (strpos($message, 'getaddrinfo') // DNS lookup failed + || strpos($message, 'Connection refused') + ) { + $e = new ConnectException($e->getMessage(), 0, $e); + } + + return new CompletedFutureArray([ + 'status' => null, + 'body' => null, + 'headers' => [], + 'effective_url' => $url, + 'error' => $e + ]); + } + + /** + * Create a resource and check to ensure it was created successfully + * + * @param callable $callback Callable that returns stream resource + * + * @return resource + * @throws \RuntimeException on error + */ + private function createResource(callable $callback) + { + $errors = null; + set_error_handler(function ($_, $msg, $file, $line) use (&$errors) { + $errors[] = [ + 'message' => $msg, + 'file' => $file, + 'line' => $line + ]; + return true; + }); + + $resource = $callback(); + restore_error_handler(); + + if (!$resource) { + $message = 'Error creating resource: '; + foreach ($errors as $err) { + foreach ($err as $key => $value) { + $message .= "[$key] $value" . PHP_EOL; + } + } + throw new RingException(trim($message)); + } + + return $resource; + } + + private function createStream($url, array $request) + { + static $methods; + if (!$methods) { + $methods = array_flip(get_class_methods(__CLASS__)); + } + + // HTTP/1.1 streams using the PHP stream wrapper require a + // Connection: close header + if ((!isset($request['version']) || $request['version'] == '1.1') + && !Core::hasHeader($request, 'Connection') + ) { + $request['headers']['Connection'] = ['close']; + } + + // Ensure SSL is verified by default + if (!isset($request['client']['verify'])) { + $request['client']['verify'] = true; + } + + $params = []; + $options = $this->getDefaultOptions($request); + + if (isset($request['client'])) { + foreach ($request['client'] as $key => $value) { + $method = "add_{$key}"; + if (isset($methods[$method])) { + $this->{$method}($request, $options, $value, $params); + } + } + } + + return $this->createStreamResource( + $url, + $request, + $options, + $this->createContext($request, $options, $params) + ); + } + + private function getDefaultOptions(array $request) + { + $headers = ""; + foreach ($request['headers'] as $name => $value) { + foreach ((array) $value as $val) { + $headers .= "$name: $val\r\n"; + } + } + + $context = [ + 'http' => [ + 'method' => $request['http_method'], + 'header' => $headers, + 'protocol_version' => isset($request['version']) ? $request['version'] : 1.1, + 'ignore_errors' => true, + 'follow_location' => 0, + ], + ]; + + $body = Core::body($request); + if (isset($body)) { + $context['http']['content'] = $body; + // Prevent the HTTP handler from adding a Content-Type header. + if (!Core::hasHeader($request, 'Content-Type')) { + $context['http']['header'] .= "Content-Type:\r\n"; + } + } + + $context['http']['header'] = rtrim($context['http']['header']); + + return $context; + } + + private function add_proxy(array $request, &$options, $value, &$params) + { + if (!is_array($value)) { + $options['http']['proxy'] = $value; + } else { + $scheme = isset($request['scheme']) ? $request['scheme'] : 'http'; + if (isset($value[$scheme])) { + $options['http']['proxy'] = $value[$scheme]; + } + } + } + + private function add_timeout(array $request, &$options, $value, &$params) + { + $options['http']['timeout'] = $value; + } + + private function add_verify(array $request, &$options, $value, &$params) + { + if ($value === true) { + // PHP 5.6 or greater will find the system cert by default. When + // < 5.6, use the Guzzle bundled cacert. + if (PHP_VERSION_ID < 50600) { + $options['ssl']['cafile'] = ClientUtils::getDefaultCaBundle(); + } + } elseif (is_string($value)) { + $options['ssl']['cafile'] = $value; + if (!file_exists($value)) { + throw new RingException("SSL CA bundle not found: $value"); + } + } elseif ($value === false) { + $options['ssl']['verify_peer'] = false; + $options['ssl']['allow_self_signed'] = true; + return; + } else { + throw new RingException('Invalid verify request option'); + } + + $options['ssl']['verify_peer'] = true; + $options['ssl']['allow_self_signed'] = false; + } + + private function add_cert(array $request, &$options, $value, &$params) + { + if (is_array($value)) { + $options['ssl']['passphrase'] = $value[1]; + $value = $value[0]; + } + + if (!file_exists($value)) { + throw new RingException("SSL certificate not found: {$value}"); + } + + $options['ssl']['local_cert'] = $value; + } + + private function add_progress(array $request, &$options, $value, &$params) + { + $fn = function ($code, $_1, $_2, $_3, $transferred, $total) use ($value) { + if ($code == STREAM_NOTIFY_PROGRESS) { + $value($total, $transferred, null, null); + } + }; + + // Wrap the existing function if needed. + $params['notification'] = isset($params['notification']) + ? Core::callArray([$params['notification'], $fn]) + : $fn; + } + + private function add_debug(array $request, &$options, $value, &$params) + { + if ($value === false) { + return; + } + + static $map = [ + STREAM_NOTIFY_CONNECT => 'CONNECT', + STREAM_NOTIFY_AUTH_REQUIRED => 'AUTH_REQUIRED', + STREAM_NOTIFY_AUTH_RESULT => 'AUTH_RESULT', + STREAM_NOTIFY_MIME_TYPE_IS => 'MIME_TYPE_IS', + STREAM_NOTIFY_FILE_SIZE_IS => 'FILE_SIZE_IS', + STREAM_NOTIFY_REDIRECTED => 'REDIRECTED', + STREAM_NOTIFY_PROGRESS => 'PROGRESS', + STREAM_NOTIFY_FAILURE => 'FAILURE', + STREAM_NOTIFY_COMPLETED => 'COMPLETED', + STREAM_NOTIFY_RESOLVE => 'RESOLVE', + ]; + + static $args = ['severity', 'message', 'message_code', + 'bytes_transferred', 'bytes_max']; + + $value = Core::getDebugResource($value); + $ident = $request['http_method'] . ' ' . Core::url($request); + $fn = function () use ($ident, $value, $map, $args) { + $passed = func_get_args(); + $code = array_shift($passed); + fprintf($value, '<%s> [%s] ', $ident, $map[$code]); + foreach (array_filter($passed) as $i => $v) { + fwrite($value, $args[$i] . ': "' . $v . '" '); + } + fwrite($value, "\n"); + }; + + // Wrap the existing function if needed. + $params['notification'] = isset($params['notification']) + ? Core::callArray([$params['notification'], $fn]) + : $fn; + } + + private function applyCustomOptions(array $request, array &$options) + { + if (!isset($request['client']['stream_context'])) { + return; + } + + if (!is_array($request['client']['stream_context'])) { + throw new RingException('stream_context must be an array'); + } + + $options = array_replace_recursive( + $options, + $request['client']['stream_context'] + ); + } + + private function createContext(array $request, array $options, array $params) + { + $this->applyCustomOptions($request, $options); + return $this->createResource( + function () use ($request, $options, $params) { + return stream_context_create($options, $params); + }, + $request, + $options + ); + } + + private function createStreamResource( + $url, + array $request, + array $options, + $context + ) { + return $this->createResource( + function () use ($url, $context) { + if (false === strpos($url, 'http')) { + trigger_error("URL is invalid: {$url}", E_USER_WARNING); + return null; + } + $resource = fopen($url, 'r', null, $context); + $this->lastHeaders = $http_response_header; + return $resource; + }, + $request, + $options + ); + } +} diff --git a/openml_OS/vendor/guzzlehttp/ringphp/src/Core.php b/openml_OS/vendor/guzzlehttp/ringphp/src/Core.php new file mode 100644 index 000000000..dd7d1a0c5 --- /dev/null +++ b/openml_OS/vendor/guzzlehttp/ringphp/src/Core.php @@ -0,0 +1,364 @@ + $value) { + if (!strcasecmp($name, $header)) { + $result = array_merge($result, $value); + } + } + } + + return $result; + } + + /** + * Gets a header value from a message as a string or null + * + * This method searches through the "headers" key of a message for a header + * using a case-insensitive search. The lines of the header are imploded + * using commas into a single string return value. + * + * @param array $message Request or response hash. + * @param string $header Header to retrieve + * + * @return string|null Returns the header string if found, or null if not. + */ + public static function header($message, $header) + { + $match = self::headerLines($message, $header); + return $match ? implode(', ', $match) : null; + } + + /** + * Returns the first header value from a message as a string or null. If + * a header line contains multiple values separated by a comma, then this + * function will return the first value in the list. + * + * @param array $message Request or response hash. + * @param string $header Header to retrieve + * + * @return string|null Returns the value as a string if found. + */ + public static function firstHeader($message, $header) + { + if (!empty($message['headers'])) { + foreach ($message['headers'] as $name => $value) { + if (!strcasecmp($name, $header)) { + // Return the match itself if it is a single value. + $pos = strpos($value[0], ','); + return $pos ? substr($value[0], 0, $pos) : $value[0]; + } + } + } + + return null; + } + + /** + * Returns true if a message has the provided case-insensitive header. + * + * @param array $message Request or response hash. + * @param string $header Header to check + * + * @return bool + */ + public static function hasHeader($message, $header) + { + if (!empty($message['headers'])) { + foreach ($message['headers'] as $name => $value) { + if (!strcasecmp($name, $header)) { + return true; + } + } + } + + return false; + } + + /** + * Parses an array of header lines into an associative array of headers. + * + * @param array $lines Header lines array of strings in the following + * format: "Name: Value" + * @return array + */ + public static function headersFromLines($lines) + { + $headers = []; + + foreach ($lines as $line) { + $parts = explode(':', $line, 2); + $headers[trim($parts[0])][] = isset($parts[1]) + ? trim($parts[1]) + : null; + } + + return $headers; + } + + /** + * Removes a header from a message using a case-insensitive comparison. + * + * @param array $message Message that contains 'headers' + * @param string $header Header to remove + * + * @return array + */ + public static function removeHeader(array $message, $header) + { + if (isset($message['headers'])) { + foreach (array_keys($message['headers']) as $key) { + if (!strcasecmp($header, $key)) { + unset($message['headers'][$key]); + } + } + } + + return $message; + } + + /** + * Replaces any existing case insensitive headers with the given value. + * + * @param array $message Message that contains 'headers' + * @param string $header Header to set. + * @param array $value Value to set. + * + * @return array + */ + public static function setHeader(array $message, $header, array $value) + { + $message = self::removeHeader($message, $header); + $message['headers'][$header] = $value; + + return $message; + } + + /** + * Creates a URL string from a request. + * + * If the "url" key is present on the request, it is returned, otherwise + * the url is built up based on the scheme, host, uri, and query_string + * request values. + * + * @param array $request Request to get the URL from + * + * @return string Returns the request URL as a string. + * @throws \InvalidArgumentException if no Host header is present. + */ + public static function url(array $request) + { + if (isset($request['url'])) { + return $request['url']; + } + + $uri = (isset($request['scheme']) + ? $request['scheme'] : 'http') . '://'; + + if ($host = self::header($request, 'host')) { + $uri .= $host; + } else { + throw new \InvalidArgumentException('No Host header was provided'); + } + + if (isset($request['uri'])) { + $uri .= $request['uri']; + } + + if (isset($request['query_string'])) { + $uri .= '?' . $request['query_string']; + } + + return $uri; + } + + /** + * Reads the body of a message into a string. + * + * @param array|FutureArrayInterface $message Array containing a "body" key + * + * @return null|string Returns the body as a string or null if not set. + * @throws \InvalidArgumentException if a request body is invalid. + */ + public static function body($message) + { + if (!isset($message['body'])) { + return null; + } + + if ($message['body'] instanceof StreamInterface) { + return (string) $message['body']; + } + + switch (gettype($message['body'])) { + case 'string': + return $message['body']; + case 'resource': + return stream_get_contents($message['body']); + case 'object': + if ($message['body'] instanceof \Iterator) { + return implode('', iterator_to_array($message['body'])); + } elseif (method_exists($message['body'], '__toString')) { + return (string) $message['body']; + } + default: + throw new \InvalidArgumentException('Invalid request body: ' + . self::describeType($message['body'])); + } + } + + /** + * Rewind the body of the provided message if possible. + * + * @param array $message Message that contains a 'body' field. + * + * @return bool Returns true on success, false on failure + */ + public static function rewindBody($message) + { + if ($message['body'] instanceof StreamInterface) { + return $message['body']->seek(0); + } + + if ($message['body'] instanceof \Generator) { + return false; + } + + if ($message['body'] instanceof \Iterator) { + $message['body']->rewind(); + return true; + } + + if (is_resource($message['body'])) { + return rewind($message['body']); + } + + return is_string($message['body']) + || (is_object($message['body']) + && method_exists($message['body'], '__toString')); + } + + /** + * Debug function used to describe the provided value type and class. + * + * @param mixed $input + * + * @return string Returns a string containing the type of the variable and + * if a class is provided, the class name. + */ + public static function describeType($input) + { + switch (gettype($input)) { + case 'object': + return 'object(' . get_class($input) . ')'; + case 'array': + return 'array(' . count($input) . ')'; + default: + ob_start(); + var_dump($input); + // normalize float vs double + return str_replace('double(', 'float(', rtrim(ob_get_clean())); + } + } + + /** + * Sleep for the specified amount of time specified in the request's + * ['client']['delay'] option if present. + * + * This function should only be used when a non-blocking sleep is not + * possible. + * + * @param array $request Request to sleep + */ + public static function doSleep(array $request) + { + if (isset($request['client']['delay'])) { + usleep($request['client']['delay'] * 1000); + } + } + + /** + * Returns a proxied future that modifies the dereferenced value of another + * future using a promise. + * + * @param FutureArrayInterface $future Future to wrap with a new future + * @param callable $onFulfilled Invoked when the future fulfilled + * @param callable $onRejected Invoked when the future rejected + * @param callable $onProgress Invoked when the future progresses + * + * @return FutureArray + */ + public static function proxy( + FutureArrayInterface $future, + callable $onFulfilled = null, + callable $onRejected = null, + callable $onProgress = null + ) { + return new FutureArray( + $future->then($onFulfilled, $onRejected, $onProgress), + [$future, 'wait'], + [$future, 'cancel'] + ); + } + + /** + * Returns a debug stream based on the provided variable. + * + * @param mixed $value Optional value + * + * @return resource + */ + public static function getDebugResource($value = null) + { + if (is_resource($value)) { + return $value; + } elseif (defined('STDOUT')) { + return STDOUT; + } else { + return fopen('php://output', 'w'); + } + } +} diff --git a/openml_OS/vendor/guzzlehttp/ringphp/src/Exception/CancelledException.php b/openml_OS/vendor/guzzlehttp/ringphp/src/Exception/CancelledException.php new file mode 100644 index 000000000..95b353acf --- /dev/null +++ b/openml_OS/vendor/guzzlehttp/ringphp/src/Exception/CancelledException.php @@ -0,0 +1,7 @@ +wrappedPromise = $promise; + $this->waitfn = $wait; + $this->cancelfn = $cancel; + } + + public function wait() + { + if (!$this->isRealized) { + $this->addShadow(); + if (!$this->isRealized && $this->waitfn) { + $this->invokeWait(); + } + if (!$this->isRealized) { + $this->error = new RingException('Waiting did not resolve future'); + } + } + + if ($this->error) { + throw $this->error; + } + + return $this->result; + } + + public function promise() + { + return $this->wrappedPromise; + } + + public function then( + callable $onFulfilled = null, + callable $onRejected = null, + callable $onProgress = null + ) { + return $this->wrappedPromise->then($onFulfilled, $onRejected, $onProgress); + } + + public function cancel() + { + if (!$this->isRealized) { + $cancelfn = $this->cancelfn; + $this->waitfn = $this->cancelfn = null; + $this->isRealized = true; + $this->error = new CancelledFutureAccessException(); + if ($cancelfn) { + $cancelfn($this); + } + } + } + + private function addShadow() + { + // Get the result and error when the promise is resolved. Note that + // calling this function might trigger the resolution immediately. + $this->wrappedPromise->then( + function ($value) { + $this->isRealized = true; + $this->result = $value; + $this->waitfn = $this->cancelfn = null; + }, + function ($error) { + $this->isRealized = true; + $this->error = $error; + $this->waitfn = $this->cancelfn = null; + } + ); + } + + private function invokeWait() + { + try { + $wait = $this->waitfn; + $this->waitfn = null; + $wait(); + } catch (\Exception $e) { + // Defer can throw to reject. + $this->error = $e; + $this->isRealized = true; + } + } +} diff --git a/openml_OS/vendor/guzzlehttp/ringphp/src/Future/CompletedFutureArray.php b/openml_OS/vendor/guzzlehttp/ringphp/src/Future/CompletedFutureArray.php new file mode 100644 index 000000000..0a90c939f --- /dev/null +++ b/openml_OS/vendor/guzzlehttp/ringphp/src/Future/CompletedFutureArray.php @@ -0,0 +1,43 @@ +result[$offset]); + } + + public function offsetGet($offset) + { + return $this->result[$offset]; + } + + public function offsetSet($offset, $value) + { + $this->result[$offset] = $value; + } + + public function offsetUnset($offset) + { + unset($this->result[$offset]); + } + + public function count() + { + return count($this->result); + } + + public function getIterator() + { + return new \ArrayIterator($this->result); + } +} diff --git a/openml_OS/vendor/guzzlehttp/ringphp/src/Future/CompletedFutureValue.php b/openml_OS/vendor/guzzlehttp/ringphp/src/Future/CompletedFutureValue.php new file mode 100644 index 000000000..0d25af72d --- /dev/null +++ b/openml_OS/vendor/guzzlehttp/ringphp/src/Future/CompletedFutureValue.php @@ -0,0 +1,57 @@ +result = $result; + $this->error = $e; + } + + public function wait() + { + if ($this->error) { + throw $this->error; + } + + return $this->result; + } + + public function cancel() {} + + public function promise() + { + if (!$this->cachedPromise) { + $this->cachedPromise = $this->error + ? new RejectedPromise($this->error) + : new FulfilledPromise($this->result); + } + + return $this->cachedPromise; + } + + public function then( + callable $onFulfilled = null, + callable $onRejected = null, + callable $onProgress = null + ) { + return $this->promise()->then($onFulfilled, $onRejected, $onProgress); + } +} diff --git a/openml_OS/vendor/guzzlehttp/ringphp/src/Future/FutureArray.php b/openml_OS/vendor/guzzlehttp/ringphp/src/Future/FutureArray.php new file mode 100644 index 000000000..3d64c9643 --- /dev/null +++ b/openml_OS/vendor/guzzlehttp/ringphp/src/Future/FutureArray.php @@ -0,0 +1,40 @@ +_value[$offset]); + } + + public function offsetGet($offset) + { + return $this->_value[$offset]; + } + + public function offsetSet($offset, $value) + { + $this->_value[$offset] = $value; + } + + public function offsetUnset($offset) + { + unset($this->_value[$offset]); + } + + public function count() + { + return count($this->_value); + } + + public function getIterator() + { + return new \ArrayIterator($this->_value); + } +} diff --git a/openml_OS/vendor/guzzlehttp/ringphp/src/Future/FutureArrayInterface.php b/openml_OS/vendor/guzzlehttp/ringphp/src/Future/FutureArrayInterface.php new file mode 100644 index 000000000..58f5f7367 --- /dev/null +++ b/openml_OS/vendor/guzzlehttp/ringphp/src/Future/FutureArrayInterface.php @@ -0,0 +1,11 @@ +_value = $this->wait(); + } +} diff --git a/openml_OS/vendor/guzzlehttp/ringphp/tests/Client/CurlFactoryTest.php b/openml_OS/vendor/guzzlehttp/ringphp/tests/Client/CurlFactoryTest.php new file mode 100644 index 000000000..ebde187cf --- /dev/null +++ b/openml_OS/vendor/guzzlehttp/ringphp/tests/Client/CurlFactoryTest.php @@ -0,0 +1,821 @@ + 200, + 'headers' => [ + 'Foo' => ['Bar'], + 'Baz' => ['bam'], + 'Content-Length' => [2], + ], + 'body' => 'hi', + ]]); + + $stream = Stream::factory(); + + $request = [ + 'http_method' => 'PUT', + 'headers' => [ + 'host' => [Server::$url], + 'Hi' => [' 123'], + ], + 'body' => 'testing', + 'client' => ['save_to' => $stream], + ]; + + $f = new CurlFactory(); + $result = $f($request); + $this->assertInternalType('array', $result); + $this->assertCount(3, $result); + $this->assertInternalType('resource', $result[0]); + $this->assertInternalType('array', $result[1]); + $this->assertSame($stream, $result[2]); + curl_close($result[0]); + + $this->assertEquals('PUT', $_SERVER['_curl'][CURLOPT_CUSTOMREQUEST]); + $this->assertEquals( + 'http://http://127.0.0.1:8125/', + $_SERVER['_curl'][CURLOPT_URL] + ); + // Sends via post fields when the request is small enough + $this->assertEquals('testing', $_SERVER['_curl'][CURLOPT_POSTFIELDS]); + $this->assertEquals(0, $_SERVER['_curl'][CURLOPT_RETURNTRANSFER]); + $this->assertEquals(0, $_SERVER['_curl'][CURLOPT_HEADER]); + $this->assertEquals(150, $_SERVER['_curl'][CURLOPT_CONNECTTIMEOUT]); + $this->assertInstanceOf('Closure', $_SERVER['_curl'][CURLOPT_HEADERFUNCTION]); + + if (defined('CURLOPT_PROTOCOLS')) { + $this->assertEquals( + CURLPROTO_HTTP | CURLPROTO_HTTPS, + $_SERVER['_curl'][CURLOPT_PROTOCOLS] + ); + } + + $this->assertContains('Expect:', $_SERVER['_curl'][CURLOPT_HTTPHEADER]); + $this->assertContains('Accept:', $_SERVER['_curl'][CURLOPT_HTTPHEADER]); + $this->assertContains('Content-Type:', $_SERVER['_curl'][CURLOPT_HTTPHEADER]); + $this->assertContains('Hi: 123', $_SERVER['_curl'][CURLOPT_HTTPHEADER]); + $this->assertContains('host: http://127.0.0.1:8125/', $_SERVER['_curl'][CURLOPT_HTTPHEADER]); + } + + public function testSendsHeadRequests() + { + Server::flush(); + Server::enqueue([['status' => 200]]); + $a = new CurlMultiHandler(); + $response = $a([ + 'http_method' => 'HEAD', + 'headers' => ['host' => [Server::$host]], + ]); + $response->wait(); + $this->assertEquals(true, $_SERVER['_curl'][CURLOPT_NOBODY]); + $checks = [CURLOPT_WRITEFUNCTION, CURLOPT_READFUNCTION, CURLOPT_FILE, CURLOPT_INFILE]; + foreach ($checks as $check) { + $this->assertArrayNotHasKey($check, $_SERVER['_curl']); + } + $this->assertEquals('HEAD', Server::received()[0]['http_method']); + } + + public function testCanAddCustomCurlOptions() + { + Server::flush(); + Server::enqueue([['status' => 200]]); + $a = new CurlMultiHandler(); + $a([ + 'http_method' => 'GET', + 'headers' => ['host' => [Server::$host]], + 'client' => ['curl' => [CURLOPT_LOW_SPEED_LIMIT => 10]], + ]); + $this->assertEquals(10, $_SERVER['_curl'][CURLOPT_LOW_SPEED_LIMIT]); + } + + /** + * @expectedException \InvalidArgumentException + * @expectedExceptionMessage SSL CA bundle not found: /does/not/exist + */ + public function testValidatesVerify() + { + $f = new CurlFactory(); + $f([ + 'http_method' => 'GET', + 'headers' => ['host' => ['foo.com']], + 'client' => ['verify' => '/does/not/exist'], + ]); + } + + public function testCanSetVerifyToFile() + { + $f = new CurlFactory(); + $f([ + 'http_method' => 'GET', + 'headers' => ['host' => ['foo.com']], + 'client' => ['verify' => __FILE__], + ]); + $this->assertEquals(__FILE__, $_SERVER['_curl'][CURLOPT_CAINFO]); + $this->assertEquals(2, $_SERVER['_curl'][CURLOPT_SSL_VERIFYHOST]); + $this->assertEquals(true, $_SERVER['_curl'][CURLOPT_SSL_VERIFYPEER]); + } + + public function testAddsVerifyAsTrue() + { + $f = new CurlFactory(); + $f([ + 'http_method' => 'GET', + 'headers' => ['host' => ['foo.com']], + 'client' => ['verify' => true], + ]); + $this->assertEquals(2, $_SERVER['_curl'][CURLOPT_SSL_VERIFYHOST]); + $this->assertEquals(true, $_SERVER['_curl'][CURLOPT_SSL_VERIFYPEER]); + $this->assertArrayNotHasKey(CURLOPT_CAINFO, $_SERVER['_curl']); + } + + public function testCanDisableVerify() + { + $f = new CurlFactory(); + $f([ + 'http_method' => 'GET', + 'headers' => ['host' => ['foo.com']], + 'client' => ['verify' => false], + ]); + $this->assertEquals(0, $_SERVER['_curl'][CURLOPT_SSL_VERIFYHOST]); + $this->assertEquals(false, $_SERVER['_curl'][CURLOPT_SSL_VERIFYPEER]); + } + + public function testAddsProxy() + { + $f = new CurlFactory(); + $f([ + 'http_method' => 'GET', + 'headers' => ['host' => ['foo.com']], + 'client' => ['proxy' => 'http://bar.com'], + ]); + $this->assertEquals('http://bar.com', $_SERVER['_curl'][CURLOPT_PROXY]); + } + + public function testAddsViaScheme() + { + $f = new CurlFactory(); + $f([ + 'http_method' => 'GET', + 'scheme' => 'http', + 'headers' => ['host' => ['foo.com']], + 'client' => [ + 'proxy' => ['http' => 'http://bar.com', 'https' => 'https://t'], + ], + ]); + $this->assertEquals('http://bar.com', $_SERVER['_curl'][CURLOPT_PROXY]); + } + + /** + * @expectedException \InvalidArgumentException + * @expectedExceptionMessage SSL private key not found: /does/not/exist + */ + public function testValidatesSslKey() + { + $f = new CurlFactory(); + $f([ + 'http_method' => 'GET', + 'headers' => ['host' => ['foo.com']], + 'client' => ['ssl_key' => '/does/not/exist'], + ]); + } + + public function testAddsSslKey() + { + $f = new CurlFactory(); + $f([ + 'http_method' => 'GET', + 'headers' => ['host' => ['foo.com']], + 'client' => ['ssl_key' => __FILE__], + ]); + $this->assertEquals(__FILE__, $_SERVER['_curl'][CURLOPT_SSLKEY]); + } + + public function testAddsSslKeyWithPassword() + { + $f = new CurlFactory(); + $f([ + 'http_method' => 'GET', + 'headers' => ['host' => ['foo.com']], + 'client' => ['ssl_key' => [__FILE__, 'test']], + ]); + $this->assertEquals(__FILE__, $_SERVER['_curl'][CURLOPT_SSLKEY]); + $this->assertEquals('test', $_SERVER['_curl'][CURLOPT_SSLKEYPASSWD]); + } + + /** + * @expectedException \InvalidArgumentException + * @expectedExceptionMessage SSL certificate not found: /does/not/exist + */ + public function testValidatesCert() + { + $f = new CurlFactory(); + $f([ + 'http_method' => 'GET', + 'headers' => ['host' => ['foo.com']], + 'client' => ['cert' => '/does/not/exist'], + ]); + } + + public function testAddsCert() + { + $f = new CurlFactory(); + $f([ + 'http_method' => 'GET', + 'headers' => ['host' => ['foo.com']], + 'client' => ['cert' => __FILE__], + ]); + $this->assertEquals(__FILE__, $_SERVER['_curl'][CURLOPT_SSLCERT]); + } + + public function testAddsCertWithPassword() + { + $f = new CurlFactory(); + $f([ + 'http_method' => 'GET', + 'headers' => ['host' => ['foo.com']], + 'client' => ['cert' => [__FILE__, 'test']], + ]); + $this->assertEquals(__FILE__, $_SERVER['_curl'][CURLOPT_SSLCERT]); + $this->assertEquals('test', $_SERVER['_curl'][CURLOPT_SSLCERTPASSWD]); + } + + /** + * @expectedException \InvalidArgumentException + * @expectedExceptionMessage progress client option must be callable + */ + public function testValidatesProgress() + { + $f = new CurlFactory(); + $f([ + 'http_method' => 'GET', + 'headers' => ['host' => ['foo.com']], + 'client' => ['progress' => 'foo'], + ]); + } + + public function testEmitsDebugInfoToStream() + { + $res = fopen('php://memory', 'r+'); + Server::flush(); + Server::enqueue([['status' => 200]]); + $a = new CurlMultiHandler(); + $response = $a([ + 'http_method' => 'HEAD', + 'headers' => ['host' => [Server::$host]], + 'client' => ['debug' => $res], + ]); + $response->wait(); + rewind($res); + $output = str_replace("\r", '', stream_get_contents($res)); + $this->assertContains( + "> HEAD / HTTP/1.1\nhost: 127.0.0.1:8125\n\n", + $output + ); + $this->assertContains("< HTTP/1.1 200", $output); + fclose($res); + } + + public function testEmitsProgressToFunction() + { + Server::flush(); + Server::enqueue([['status' => 200]]); + $a = new CurlMultiHandler(); + $called = []; + $response = $a([ + 'http_method' => 'HEAD', + 'headers' => ['host' => [Server::$host]], + 'client' => [ + 'progress' => function () use (&$called) { + $called[] = func_get_args(); + }, + ], + ]); + $response->wait(); + $this->assertNotEmpty($called); + foreach ($called as $call) { + $this->assertCount(4, $call); + } + } + + private function addDecodeResponse($withEncoding = true) + { + $content = gzencode('test'); + $response = [ + 'status' => 200, + 'reason' => 'OK', + 'headers' => ['Content-Length' => [strlen($content)]], + 'body' => $content, + ]; + + if ($withEncoding) { + $response['headers']['Content-Encoding'] = ['gzip']; + } + + Server::flush(); + Server::enqueue([$response]); + + return $content; + } + + public function testDecodesGzippedResponses() + { + $this->addDecodeResponse(); + $handler = new CurlMultiHandler(); + $response = $handler([ + 'http_method' => 'GET', + 'headers' => ['host' => [Server::$host]], + 'client' => ['decode_content' => true], + ]); + $response->wait(); + $this->assertEquals('test', Core::body($response)); + $this->assertEquals('', $_SERVER['_curl'][CURLOPT_ENCODING]); + $sent = Server::received()[0]; + $this->assertNull(Core::header($sent, 'Accept-Encoding')); + } + + public function testDecodesGzippedResponsesWithHeader() + { + $this->addDecodeResponse(); + $handler = new CurlMultiHandler(); + $response = $handler([ + 'http_method' => 'GET', + 'headers' => [ + 'host' => [Server::$host], + 'Accept-Encoding' => ['gzip'], + ], + 'client' => ['decode_content' => true], + ]); + $response->wait(); + $this->assertEquals('gzip', $_SERVER['_curl'][CURLOPT_ENCODING]); + $sent = Server::received()[0]; + $this->assertEquals('gzip', Core::header($sent, 'Accept-Encoding')); + $this->assertEquals('test', Core::body($response)); + } + + public function testDoesNotForceDecode() + { + $content = $this->addDecodeResponse(); + $handler = new CurlMultiHandler(); + $response = $handler([ + 'http_method' => 'GET', + 'headers' => ['host' => [Server::$host]], + 'client' => ['decode_content' => false], + ]); + $response->wait(); + $sent = Server::received()[0]; + $this->assertNull(Core::header($sent, 'Accept-Encoding')); + $this->assertEquals($content, Core::body($response)); + } + + public function testProtocolVersion() + { + Server::flush(); + Server::enqueue([['status' => 200]]); + $a = new CurlMultiHandler(); + $a([ + 'http_method' => 'GET', + 'headers' => ['host' => [Server::$host]], + 'version' => 1.0, + ]); + $this->assertEquals(CURL_HTTP_VERSION_1_0, $_SERVER['_curl'][CURLOPT_HTTP_VERSION]); + } + + /** + * @expectedException \InvalidArgumentException + */ + public function testValidatesSaveTo() + { + $handler = new CurlMultiHandler(); + $handler([ + 'http_method' => 'GET', + 'headers' => ['host' => [Server::$host]], + 'client' => ['save_to' => true], + ]); + } + + public function testSavesToStream() + { + $stream = fopen('php://memory', 'r+'); + $this->addDecodeResponse(); + $handler = new CurlMultiHandler(); + $response = $handler([ + 'http_method' => 'GET', + 'headers' => ['host' => [Server::$host]], + 'client' => [ + 'decode_content' => true, + 'save_to' => $stream, + ], + ]); + $response->wait(); + rewind($stream); + $this->assertEquals('test', stream_get_contents($stream)); + } + + public function testSavesToGuzzleStream() + { + $stream = Stream::factory(); + $this->addDecodeResponse(); + $handler = new CurlMultiHandler(); + $response = $handler([ + 'http_method' => 'GET', + 'headers' => ['host' => [Server::$host]], + 'client' => [ + 'decode_content' => true, + 'save_to' => $stream, + ], + ]); + $response->wait(); + $this->assertEquals('test', (string) $stream); + } + + public function testSavesToFileOnDisk() + { + $tmpfile = tempnam(sys_get_temp_dir(), 'testfile'); + $this->addDecodeResponse(); + $handler = new CurlMultiHandler(); + $response = $handler([ + 'http_method' => 'GET', + 'headers' => ['host' => [Server::$host]], + 'client' => [ + 'decode_content' => true, + 'save_to' => $tmpfile, + ], + ]); + $response->wait(); + $this->assertEquals('test', file_get_contents($tmpfile)); + unlink($tmpfile); + } + + /** + * @expectedException \InvalidArgumentException + */ + public function testValidatesBody() + { + $handler = new CurlMultiHandler(); + $handler([ + 'http_method' => 'GET', + 'headers' => ['host' => [Server::$host]], + 'body' => false, + ]); + } + + public function testAddsLargePayloadFromStreamWithNoSizeUsingChunked() + { + $stream = Stream::factory('foo'); + $stream = FnStream::decorate($stream, [ + 'getSize' => function () { + return null; + } + ]); + $this->addDecodeResponse(); + $handler = new CurlMultiHandler(); + $response = $handler([ + 'http_method' => 'GET', + 'headers' => ['host' => [Server::$host]], + 'body' => $stream, + ]); + $response->wait(); + $sent = Server::received()[0]; + $this->assertEquals('chunked', Core::header($sent, 'Transfer-Encoding')); + $this->assertNull(Core::header($sent, 'Content-Length')); + $this->assertEquals('foo', $sent['body']); + } + + public function testAddsPayloadFromIterator() + { + $iter = new \ArrayIterator(['f', 'o', 'o']); + $this->addDecodeResponse(); + $handler = new CurlMultiHandler(); + $response = $handler([ + 'http_method' => 'GET', + 'headers' => ['host' => [Server::$host]], + 'body' => $iter, + ]); + $response->wait(); + $sent = Server::received()[0]; + $this->assertEquals('chunked', Core::header($sent, 'Transfer-Encoding')); + $this->assertNull(Core::header($sent, 'Content-Length')); + $this->assertEquals('foo', $sent['body']); + } + + public function testAddsPayloadFromResource() + { + $res = fopen('php://memory', 'r+'); + $data = str_repeat('.', 1000000); + fwrite($res, $data); + rewind($res); + $this->addDecodeResponse(); + $handler = new CurlMultiHandler(); + $response = $handler([ + 'http_method' => 'GET', + 'headers' => [ + 'host' => [Server::$host], + 'content-length' => [1000000], + ], + 'body' => $res, + ]); + $response->wait(); + $sent = Server::received()[0]; + $this->assertNull(Core::header($sent, 'Transfer-Encoding')); + $this->assertEquals(1000000, Core::header($sent, 'Content-Length')); + $this->assertEquals($data, $sent['body']); + } + + public function testAddsContentLengthFromStream() + { + $stream = Stream::factory('foo'); + $this->addDecodeResponse(); + $handler = new CurlMultiHandler(); + $response = $handler([ + 'http_method' => 'GET', + 'headers' => ['host' => [Server::$host]], + 'body' => $stream, + ]); + $response->wait(); + $sent = Server::received()[0]; + $this->assertEquals(3, Core::header($sent, 'Content-Length')); + $this->assertNull(Core::header($sent, 'Transfer-Encoding')); + $this->assertEquals('foo', $sent['body']); + } + + public function testDoesNotAddMultipleContentLengthHeaders() + { + $this->addDecodeResponse(); + $handler = new CurlMultiHandler(); + $response = $handler([ + 'http_method' => 'GET', + 'headers' => [ + 'host' => [Server::$host], + 'content-length' => [3], + ], + 'body' => 'foo', + ]); + $response->wait(); + $sent = Server::received()[0]; + $this->assertEquals(3, Core::header($sent, 'Content-Length')); + $this->assertNull(Core::header($sent, 'Transfer-Encoding')); + $this->assertEquals('foo', $sent['body']); + } + + public function testSendsPostWithNoBodyOrDefaultContentType() + { + Server::flush(); + Server::enqueue([['status' => 200]]); + $handler = new CurlMultiHandler(); + $response = $handler([ + 'http_method' => 'POST', + 'uri' => '/', + 'headers' => ['host' => [Server::$host]], + ]); + $response->wait(); + $received = Server::received()[0]; + $this->assertEquals('POST', $received['http_method']); + $this->assertNull(Core::header($received, 'content-type')); + $this->assertSame('0', Core::firstHeader($received, 'content-length')); + } + + public function testParseProtocolVersion() + { + $res = CurlFactory::createResponse( + function () {}, + [], + ['curl' => ['errno' => null]], + ['HTTP/1.1 200 Ok'], + null + ); + + $this->assertSame('1.1', $res['version']); + } + + public function testFailsWhenNoResponseAndNoBody() + { + $res = CurlFactory::createResponse(function () {}, [], [], [], null); + $this->assertInstanceOf('GuzzleHttp\Ring\Exception\RingException', $res['error']); + $this->assertContains( + 'No response was received for a request with no body', + $res['error']->getMessage() + ); + } + + public function testFailsWhenCannotRewindRetry() + { + $res = CurlFactory::createResponse(function () {}, [ + 'body' => new NoSeekStream(Stream::factory('foo')) + ], [], [], null); + $this->assertInstanceOf('GuzzleHttp\Ring\Exception\RingException', $res['error']); + $this->assertContains( + 'rewind the request body failed', + $res['error']->getMessage() + ); + } + + public function testRetriesWhenBodyCanBeRewound() + { + $callHandler = $called = false; + $res = CurlFactory::createResponse(function () use (&$callHandler) { + $callHandler = true; + return ['status' => 200]; + }, [ + 'body' => FnStream::decorate(Stream::factory('test'), [ + 'seek' => function () use (&$called) { + $called = true; + return true; + } + ]) + ], [], [], null); + + $this->assertTrue($callHandler); + $this->assertTrue($called); + $this->assertEquals('200', $res['status']); + } + + public function testFailsWhenRetryMoreThanThreeTimes() + { + $call = 0; + $mock = new MockHandler(function (array $request) use (&$mock, &$call) { + $call++; + return CurlFactory::createResponse($mock, $request, [], [], null); + }); + $response = $mock([ + 'http_method' => 'GET', + 'body' => 'test', + ]); + $this->assertEquals(3, $call); + $this->assertArrayHasKey('error', $response); + $this->assertContains( + 'The cURL request was retried 3 times', + $response['error']->getMessage() + ); + } + + public function testHandles100Continue() + { + Server::flush(); + Server::enqueue([ + [ + 'status' => '200', + 'reason' => 'OK', + 'headers' => [ + 'Test' => ['Hello'], + 'Content-Length' => ['4'], + ], + 'body' => 'test', + ], + ]); + + $request = [ + 'http_method' => 'PUT', + 'headers' => [ + 'Host' => [Server::$host], + 'Expect' => ['100-Continue'], + ], + 'body' => 'test', + ]; + + $handler = new CurlMultiHandler(); + $response = $handler($request)->wait(); + $this->assertEquals(200, $response['status']); + $this->assertEquals('OK', $response['reason']); + $this->assertEquals(['Hello'], $response['headers']['Test']); + $this->assertEquals(['4'], $response['headers']['Content-Length']); + $this->assertEquals('test', Core::body($response)); + } + + public function testCreatesConnectException() + { + $m = new \ReflectionMethod('GuzzleHttp\Ring\Client\CurlFactory', 'createErrorResponse'); + $m->setAccessible(true); + $response = $m->invoke( + null, + function () {}, + [], + [ + 'err_message' => 'foo', + 'curl' => [ + 'errno' => CURLE_COULDNT_CONNECT, + ] + ] + ); + $this->assertInstanceOf('GuzzleHttp\Ring\Exception\ConnectException', $response['error']); + } + + public function testParsesLastResponseOnly() + { + $response1 = [ + 'status' => 301, + 'headers' => [ + 'Content-Length' => ['0'], + 'Location' => ['/foo'] + ] + ]; + + $response2 = [ + 'status' => 200, + 'headers' => [ + 'Content-Length' => ['0'], + 'Foo' => ['bar'] + ] + ]; + + Server::flush(); + Server::enqueue([$response1, $response2]); + + $a = new CurlMultiHandler(); + $response = $a([ + 'http_method' => 'GET', + 'headers' => ['Host' => [Server::$host]], + 'client' => [ + 'curl' => [ + CURLOPT_FOLLOWLOCATION => true + ] + ] + ])->wait(); + + $this->assertEquals(1, $response['transfer_stats']['redirect_count']); + $this->assertEquals('http://127.0.0.1:8125/foo', $response['effective_url']); + $this->assertEquals(['bar'], $response['headers']['Foo']); + $this->assertEquals(200, $response['status']); + $this->assertFalse(Core::hasHeader($response, 'Location')); + } + + public function testMaintainsMultiHeaderOrder() + { + Server::flush(); + Server::enqueue([ + [ + 'status' => 200, + 'headers' => [ + 'Content-Length' => ['0'], + 'Foo' => ['a', 'b'], + 'foo' => ['c', 'd'], + ] + ] + ]); + + $a = new CurlMultiHandler(); + $response = $a([ + 'http_method' => 'GET', + 'headers' => ['Host' => [Server::$host]] + ])->wait(); + + $this->assertEquals( + ['a', 'b', 'c', 'd'], + Core::headerLines($response, 'Foo') + ); + } + + /** + * @expectedException \RuntimeException + * @expectedExceptionMessage Directory /path/to/does/not does not exist for save_to value of /path/to/does/not/exist.txt + */ + public function testThrowsWhenDirNotFound() + { + $request = [ + 'http_method' => 'GET', + 'headers' => ['host' => [Server::$url]], + 'client' => ['save_to' => '/path/to/does/not/exist.txt'], + ]; + + $f = new CurlFactory(); + $f($request); + } +} + +} diff --git a/openml_OS/vendor/guzzlehttp/ringphp/tests/Client/CurlHandlerTest.php b/openml_OS/vendor/guzzlehttp/ringphp/tests/Client/CurlHandlerTest.php new file mode 100644 index 000000000..ba03b8cd3 --- /dev/null +++ b/openml_OS/vendor/guzzlehttp/ringphp/tests/Client/CurlHandlerTest.php @@ -0,0 +1,96 @@ +markTestSkipped('curl_reset() is not available'); + } + } + + protected function getHandler($factory = null, $options = []) + { + return new CurlHandler($options); + } + + public function testCanSetMaxHandles() + { + $a = new CurlHandler(['max_handles' => 10]); + $this->assertEquals(10, $this->readAttribute($a, 'maxHandles')); + } + + public function testCreatesCurlErrors() + { + $handler = new CurlHandler(); + $response = $handler([ + 'http_method' => 'GET', + 'uri' => '/', + 'headers' => ['host' => ['localhost:123']], + 'client' => ['timeout' => 0.001, 'connect_timeout' => 0.001], + ]); + $this->assertNull($response['status']); + $this->assertNull($response['reason']); + $this->assertEquals([], $response['headers']); + $this->assertInstanceOf( + 'GuzzleHttp\Ring\Exception\RingException', + $response['error'] + ); + + $this->assertEquals( + 1, + preg_match('/^cURL error \d+: .*$/', $response['error']->getMessage()) + ); + } + + public function testReleasesAdditionalEasyHandles() + { + Server::flush(); + $response = [ + 'status' => 200, + 'headers' => ['Content-Length' => [4]], + 'body' => 'test', + ]; + + Server::enqueue([$response, $response, $response, $response]); + $a = new CurlHandler(['max_handles' => 2]); + + $fn = function () use (&$calls, $a, &$fn) { + if (++$calls < 4) { + $a([ + 'http_method' => 'GET', + 'headers' => ['host' => [Server::$host]], + 'client' => ['progress' => $fn], + ]); + } + }; + + $request = [ + 'http_method' => 'GET', + 'headers' => ['host' => [Server::$host]], + 'client' => [ + 'progress' => $fn, + ], + ]; + + $a($request); + $this->assertCount(2, $this->readAttribute($a, 'handles')); + } + + public function testReusesHandles() + { + Server::flush(); + $response = ['status' => 200]; + Server::enqueue([$response, $response]); + $a = new CurlHandler(); + $request = [ + 'http_method' => 'GET', + 'headers' => ['host' => [Server::$host]], + ]; + $a($request); + $a($request); + } +} diff --git a/openml_OS/vendor/guzzlehttp/ringphp/tests/Client/CurlMultiHandlerTest.php b/openml_OS/vendor/guzzlehttp/ringphp/tests/Client/CurlMultiHandlerTest.php new file mode 100644 index 000000000..530b2394a --- /dev/null +++ b/openml_OS/vendor/guzzlehttp/ringphp/tests/Client/CurlMultiHandlerTest.php @@ -0,0 +1,181 @@ + 200]]); + $a = new CurlMultiHandler(); + $response = $a([ + 'http_method' => 'GET', + 'headers' => ['host' => [Server::$host]], + ]); + $this->assertInstanceOf('GuzzleHttp\Ring\Future\FutureArray', $response); + $this->assertEquals(200, $response['status']); + $this->assertArrayHasKey('transfer_stats', $response); + $realUrl = trim($response['transfer_stats']['url'], '/'); + $this->assertEquals(trim(Server::$url, '/'), $realUrl); + $this->assertArrayHasKey('effective_url', $response); + $this->assertEquals( + trim(Server::$url, '/'), + trim($response['effective_url'], '/') + ); + } + + public function testCreatesErrorResponses() + { + $url = 'http://localhost:123/'; + $a = new CurlMultiHandler(); + $response = $a([ + 'http_method' => 'GET', + 'headers' => ['host' => ['localhost:123']], + ]); + $this->assertInstanceOf('GuzzleHttp\Ring\Future\FutureArray', $response); + $this->assertNull($response['status']); + $this->assertNull($response['reason']); + $this->assertEquals([], $response['headers']); + $this->assertArrayHasKey('error', $response); + $this->assertContains('cURL error ', $response['error']->getMessage()); + $this->assertArrayHasKey('transfer_stats', $response); + $this->assertEquals( + trim($url, '/'), + trim($response['transfer_stats']['url'], '/') + ); + $this->assertArrayHasKey('effective_url', $response); + $this->assertEquals( + trim($url, '/'), + trim($response['effective_url'], '/') + ); + } + + public function testSendsFuturesWhenDestructed() + { + Server::enqueue([['status' => 200]]); + $a = new CurlMultiHandler(); + $response = $a([ + 'http_method' => 'GET', + 'headers' => ['host' => [Server::$host]], + ]); + $this->assertInstanceOf('GuzzleHttp\Ring\Future\FutureArray', $response); + $a->__destruct(); + $this->assertEquals(200, $response['status']); + } + + public function testCanSetMaxHandles() + { + $a = new CurlMultiHandler(['max_handles' => 2]); + $this->assertEquals(2, $this->readAttribute($a, 'maxHandles')); + } + + public function testCanSetSelectTimeout() + { + $a = new CurlMultiHandler(['select_timeout' => 2]); + $this->assertEquals(2, $this->readAttribute($a, 'selectTimeout')); + } + + public function testSendsFuturesWhenMaxHandlesIsReached() + { + $request = [ + 'http_method' => 'PUT', + 'headers' => ['host' => [Server::$host]], + 'future' => 'lazy', // passing this to control the test + ]; + $response = ['status' => 200]; + Server::flush(); + Server::enqueue([$response, $response, $response]); + $a = new CurlMultiHandler(['max_handles' => 3]); + for ($i = 0; $i < 5; $i++) { + $responses[] = $a($request); + } + $this->assertCount(3, Server::received()); + $responses[3]->cancel(); + $responses[4]->cancel(); + } + + public function testCanCancel() + { + Server::flush(); + $response = ['status' => 200]; + Server::enqueue(array_fill_keys(range(0, 10), $response)); + $a = new CurlMultiHandler(); + $responses = []; + + for ($i = 0; $i < 10; $i++) { + $response = $a([ + 'http_method' => 'GET', + 'headers' => ['host' => [Server::$host]], + 'future' => 'lazy', + ]); + $response->cancel(); + $responses[] = $response; + } + + $this->assertCount(0, Server::received()); + + foreach ($responses as $response) { + $this->assertTrue($this->readAttribute($response, 'isRealized')); + } + } + + public function testCannotCancelFinished() + { + Server::flush(); + Server::enqueue([['status' => 200]]); + $a = new CurlMultiHandler(); + $response = $a([ + 'http_method' => 'GET', + 'headers' => ['host' => [Server::$host]], + ]); + $response->wait(); + $response->cancel(); + } + + public function testDelaysInParallel() + { + Server::flush(); + Server::enqueue([['status' => 200]]); + $a = new CurlMultiHandler(); + $expected = microtime(true) + (100 / 1000); + $response = $a([ + 'http_method' => 'GET', + 'headers' => ['host' => [Server::$host]], + 'client' => ['delay' => 100], + ]); + $response->wait(); + $this->assertGreaterThanOrEqual($expected, microtime(true)); + } + + public function testSendsNonLazyFutures() + { + $request = [ + 'http_method' => 'GET', + 'headers' => ['host' => [Server::$host]], + 'future' => true, + ]; + Server::flush(); + Server::enqueue([['status' => 202]]); + $a = new CurlMultiHandler(); + $response = $a($request); + $this->assertInstanceOf('GuzzleHttp\Ring\Future\FutureArray', $response); + $this->assertEquals(202, $response['status']); + } + + public function testExtractsErrors() + { + $request = [ + 'http_method' => 'GET', + 'headers' => ['host' => ['127.0.0.1:123']], + 'future' => true, + ]; + Server::flush(); + Server::enqueue([['status' => 202]]); + $a = new CurlMultiHandler(); + $response = $a($request); + $this->assertInstanceOf('GuzzleHttp\Ring\Future\FutureArray', $response); + $this->assertEquals(CURLE_COULDNT_CONNECT, $response['curl']['errno']); + $this->assertNotEmpty($response['curl']['error']); + } +} diff --git a/openml_OS/vendor/guzzlehttp/ringphp/tests/Client/MiddlewareTest.php b/openml_OS/vendor/guzzlehttp/ringphp/tests/Client/MiddlewareTest.php new file mode 100644 index 000000000..a47bb30ba --- /dev/null +++ b/openml_OS/vendor/guzzlehttp/ringphp/tests/Client/MiddlewareTest.php @@ -0,0 +1,65 @@ + 200]); + $calledA = false; + $a = function (array $req) use (&$calledA, $future) { + $calledA = true; + return $future; + }; + $calledB = false; + $b = function (array $req) use (&$calledB) { $calledB = true; }; + $s = Middleware::wrapFuture($a, $b); + $s([]); + $this->assertTrue($calledA); + $this->assertFalse($calledB); + } + + public function testFutureCallsStreamingHandler() + { + $future = new CompletedFutureArray(['status' => 200]); + $calledA = false; + $a = function (array $req) use (&$calledA) { $calledA = true; }; + $calledB = false; + $b = function (array $req) use (&$calledB, $future) { + $calledB = true; + return $future; + }; + $s = Middleware::wrapFuture($a, $b); + $result = $s(['client' => ['future' => true]]); + $this->assertFalse($calledA); + $this->assertTrue($calledB); + $this->assertSame($future, $result); + } + + public function testStreamingCallsDefaultHandler() + { + $calledA = false; + $a = function (array $req) use (&$calledA) { $calledA = true; }; + $calledB = false; + $b = function (array $req) use (&$calledB) { $calledB = true; }; + $s = Middleware::wrapStreaming($a, $b); + $s([]); + $this->assertTrue($calledA); + $this->assertFalse($calledB); + } + + public function testStreamingCallsStreamingHandler() + { + $calledA = false; + $a = function (array $req) use (&$calledA) { $calledA = true; }; + $calledB = false; + $b = function (array $req) use (&$calledB) { $calledB = true; }; + $s = Middleware::wrapStreaming($a, $b); + $s(['client' => ['stream' => true]]); + $this->assertFalse($calledA); + $this->assertTrue($calledB); + } +} diff --git a/openml_OS/vendor/guzzlehttp/ringphp/tests/Client/MockHandlerTest.php b/openml_OS/vendor/guzzlehttp/ringphp/tests/Client/MockHandlerTest.php new file mode 100644 index 000000000..26bcd6cdc --- /dev/null +++ b/openml_OS/vendor/guzzlehttp/ringphp/tests/Client/MockHandlerTest.php @@ -0,0 +1,86 @@ + 200]); + $response = $mock([]); + $this->assertEquals(200, $response['status']); + $this->assertEquals([], $response['headers']); + $this->assertNull($response['body']); + $this->assertNull($response['reason']); + $this->assertNull($response['effective_url']); + } + + public function testReturnsFutures() + { + $deferred = new Deferred(); + $future = new FutureArray( + $deferred->promise(), + function () use ($deferred) { + $deferred->resolve(['status' => 200]); + } + ); + $mock = new MockHandler($future); + $response = $mock([]); + $this->assertInstanceOf('GuzzleHttp\Ring\Future\FutureArray', $response); + $this->assertEquals(200, $response['status']); + } + + public function testReturnsFuturesWithThenCall() + { + $deferred = new Deferred(); + $future = new FutureArray( + $deferred->promise(), + function () use ($deferred) { + $deferred->resolve(['status' => 200]); + } + ); + $mock = new MockHandler($future); + $response = $mock([]); + $this->assertInstanceOf('GuzzleHttp\Ring\Future\FutureArray', $response); + $this->assertEquals(200, $response['status']); + $req = null; + $promise = $response->then(function ($value) use (&$req) { + $req = $value; + $this->assertEquals(200, $req['status']); + }); + $this->assertInstanceOf('React\Promise\PromiseInterface', $promise); + $this->assertEquals(200, $req['status']); + } + + public function testReturnsFuturesAndProxiesCancel() + { + $c = null; + $deferred = new Deferred(); + $future = new FutureArray( + $deferred->promise(), + function () {}, + function () use (&$c) { + $c = true; + return true; + } + ); + $mock = new MockHandler($future); + $response = $mock([]); + $this->assertInstanceOf('GuzzleHttp\Ring\Future\FutureArray', $response); + $response->cancel(); + $this->assertTrue($c); + } + + /** + * @expectedException \InvalidArgumentException + * @expectedExceptionMessage Response must be an array or FutureArrayInterface. Found + */ + public function testEnsuresMockIsValid() + { + $mock = new MockHandler('foo'); + $mock([]); + } +} diff --git a/openml_OS/vendor/guzzlehttp/ringphp/tests/Client/Server.php b/openml_OS/vendor/guzzlehttp/ringphp/tests/Client/Server.php new file mode 100644 index 000000000..14665a556 --- /dev/null +++ b/openml_OS/vendor/guzzlehttp/ringphp/tests/Client/Server.php @@ -0,0 +1,183 @@ + [], 'reason' => '', 'body' => '']; + $data[] = $response; + } + + self::send('PUT', '/guzzle-server/responses', json_encode($data)); + } + + /** + * Get all of the received requests as a RingPHP request structure. + * + * @return array + * @throws \RuntimeException + */ + public static function received() + { + if (!self::$started) { + return []; + } + + $response = self::send('GET', '/guzzle-server/requests'); + $body = Core::body($response); + $result = json_decode($body, true); + if ($result === false) { + throw new \RuntimeException('Error decoding response: ' + . json_last_error()); + } + + foreach ($result as &$res) { + if (isset($res['uri'])) { + $res['resource'] = $res['uri']; + } + if (isset($res['query_string'])) { + $res['resource'] .= '?' . $res['query_string']; + } + if (!isset($res['resource'])) { + $res['resource'] = ''; + } + // Ensure that headers are all arrays + if (isset($res['headers'])) { + foreach ($res['headers'] as &$h) { + $h = (array) $h; + } + unset($h); + } + } + + unset($res); + return $result; + } + + /** + * Stop running the node.js server + */ + public static function stop() + { + if (self::$started) { + self::send('DELETE', '/guzzle-server'); + } + + self::$started = false; + } + + public static function wait($maxTries = 20) + { + $tries = 0; + while (!self::isListening() && ++$tries < $maxTries) { + usleep(100000); + } + + if (!self::isListening()) { + throw new \RuntimeException('Unable to contact node.js server'); + } + } + + public static function start() + { + if (self::$started) { + return; + } + + try { + self::wait(); + } catch (\Exception $e) { + exec('node ' . __DIR__ . \DIRECTORY_SEPARATOR . 'server.js ' + . self::$port . ' >> /tmp/server.log 2>&1 &'); + self::wait(); + } + + self::$started = true; + } + + private static function isListening() + { + $response = self::send('GET', '/guzzle-server/perf', null, [ + 'connect_timeout' => 1, + 'timeout' => 1 + ]); + + return !isset($response['error']); + } + + private static function send( + $method, + $path, + $body = null, + array $client = [] + ) { + $handler = new StreamHandler(); + + $request = [ + 'http_method' => $method, + 'uri' => $path, + 'request_port' => 8125, + 'headers' => ['host' => ['127.0.0.1:8125']], + 'body' => $body, + 'client' => $client, + ]; + + if ($body) { + $request['headers']['content-length'] = [strlen($body)]; + } + + return $handler($request); + } +} diff --git a/openml_OS/vendor/guzzlehttp/ringphp/tests/Client/StreamHandlerTest.php b/openml_OS/vendor/guzzlehttp/ringphp/tests/Client/StreamHandlerTest.php new file mode 100644 index 000000000..3cb9a8e1e --- /dev/null +++ b/openml_OS/vendor/guzzlehttp/ringphp/tests/Client/StreamHandlerTest.php @@ -0,0 +1,480 @@ +queueRes(); + $handler = new StreamHandler(); + $response = $handler([ + 'http_method' => 'GET', + 'uri' => '/', + 'headers' => [ + 'host' => [Server::$host], + 'Foo' => ['Bar'], + ], + ]); + + $this->assertEquals('1.1', $response['version']); + $this->assertEquals(200, $response['status']); + $this->assertEquals('OK', $response['reason']); + $this->assertEquals(['Bar'], $response['headers']['Foo']); + $this->assertEquals(['8'], $response['headers']['Content-Length']); + $this->assertEquals('hi there', Core::body($response)); + + $sent = Server::received()[0]; + $this->assertEquals('GET', $sent['http_method']); + $this->assertEquals('/', $sent['resource']); + $this->assertEquals(['127.0.0.1:8125'], $sent['headers']['host']); + $this->assertEquals('Bar', Core::header($sent, 'foo')); + } + + public function testAddsErrorToResponse() + { + $handler = new StreamHandler(); + $result = $handler([ + 'http_method' => 'GET', + 'headers' => ['host' => ['localhost:123']], + 'client' => ['timeout' => 0.01], + ]); + $this->assertInstanceOf( + 'GuzzleHttp\Ring\Future\CompletedFutureArray', + $result + ); + $this->assertNull($result['status']); + $this->assertNull($result['body']); + $this->assertEquals([], $result['headers']); + $this->assertInstanceOf( + 'GuzzleHttp\Ring\Exception\RingException', + $result['error'] + ); + } + + public function testEnsuresTheHttpProtocol() + { + $handler = new StreamHandler(); + $result = $handler([ + 'http_method' => 'GET', + 'url' => 'ftp://localhost:123', + ]); + $this->assertArrayHasKey('error', $result); + $this->assertContains( + 'URL is invalid: ftp://localhost:123', + $result['error']->getMessage() + ); + } + + public function testStreamAttributeKeepsStreamOpen() + { + $this->queueRes(); + $handler = new StreamHandler(); + $response = $handler([ + 'http_method' => 'PUT', + 'uri' => '/foo', + 'query_string' => 'baz=bar', + 'headers' => [ + 'host' => [Server::$host], + 'Foo' => ['Bar'], + ], + 'body' => 'test', + 'client' => ['stream' => true], + ]); + + $this->assertEquals(200, $response['status']); + $this->assertEquals('OK', $response['reason']); + $this->assertEquals('8', Core::header($response, 'Content-Length')); + $body = $response['body']; + $this->assertTrue(is_resource($body)); + $this->assertEquals('http', stream_get_meta_data($body)['wrapper_type']); + $this->assertEquals('hi there', stream_get_contents($body)); + fclose($body); + $sent = Server::received()[0]; + $this->assertEquals('PUT', $sent['http_method']); + $this->assertEquals('/foo', $sent['uri']); + $this->assertEquals('baz=bar', $sent['query_string']); + $this->assertEquals('/foo?baz=bar', $sent['resource']); + $this->assertEquals('127.0.0.1:8125', Core::header($sent, 'host')); + $this->assertEquals('Bar', Core::header($sent, 'foo')); + } + + public function testDrainsResponseIntoTempStream() + { + $this->queueRes(); + $handler = new StreamHandler(); + $response = $handler([ + 'http_method' => 'GET', + 'uri' => '/', + 'headers' => ['host' => [Server::$host]], + ]); + $body = $response['body']; + $this->assertEquals('php://temp', stream_get_meta_data($body)['uri']); + $this->assertEquals('hi', fread($body, 2)); + fclose($body); + } + + public function testDrainsResponseIntoSaveToBody() + { + $r = fopen('php://temp', 'r+'); + $this->queueRes(); + $handler = new StreamHandler(); + $response = $handler([ + 'http_method' => 'GET', + 'uri' => '/', + 'headers' => ['host' => [Server::$host]], + 'client' => ['save_to' => $r], + ]); + $body = $response['body']; + $this->assertEquals('php://temp', stream_get_meta_data($body)['uri']); + $this->assertEquals('hi', fread($body, 2)); + $this->assertEquals(' there', stream_get_contents($r)); + fclose($r); + } + + public function testDrainsResponseIntoSaveToBodyAtPath() + { + $tmpfname = tempnam('/tmp', 'save_to_path'); + $this->queueRes(); + $handler = new StreamHandler(); + $response = $handler([ + 'http_method' => 'GET', + 'uri' => '/', + 'headers' => ['host' => [Server::$host]], + 'client' => ['save_to' => $tmpfname], + ]); + $body = $response['body']; + $this->assertInstanceOf('GuzzleHttp\Stream\StreamInterface', $body); + $this->assertEquals($tmpfname, $body->getMetadata('uri')); + $this->assertEquals('hi', $body->read(2)); + $body->close(); + unlink($tmpfname); + } + + public function testAutomaticallyDecompressGzip() + { + Server::flush(); + $content = gzencode('test'); + Server::enqueue([ + [ + 'status' => 200, + 'reason' => 'OK', + 'headers' => [ + 'Content-Encoding' => ['gzip'], + 'Content-Length' => [strlen($content)], + ], + 'body' => $content, + ], + ]); + + $handler = new StreamHandler(); + $response = $handler([ + 'http_method' => 'GET', + 'headers' => ['host' => [Server::$host]], + 'uri' => '/', + 'client' => ['decode_content' => true], + ]); + $this->assertEquals('test', Core::body($response)); + } + + public function testDoesNotForceGzipDecode() + { + Server::flush(); + $content = gzencode('test'); + Server::enqueue([ + [ + 'status' => 200, + 'reason' => 'OK', + 'headers' => [ + 'Content-Encoding' => ['gzip'], + 'Content-Length' => [strlen($content)], + ], + 'body' => $content, + ], + ]); + + $handler = new StreamHandler(); + $response = $handler([ + 'http_method' => 'GET', + 'headers' => ['host' => [Server::$host]], + 'uri' => '/', + 'client' => ['stream' => true, 'decode_content' => false], + ]); + $this->assertSame($content, Core::body($response)); + } + + public function testProtocolVersion() + { + $this->queueRes(); + $handler = new StreamHandler(); + $handler([ + 'http_method' => 'GET', + 'uri' => '/', + 'headers' => ['host' => [Server::$host]], + 'version' => 1.0, + ]); + + $this->assertEquals(1.0, Server::received()[0]['version']); + } + + protected function getSendResult(array $opts) + { + $this->queueRes(); + $handler = new StreamHandler(); + $opts['stream'] = true; + return $handler([ + 'http_method' => 'GET', + 'uri' => '/', + 'headers' => ['host' => [Server::$host]], + 'client' => $opts, + ]); + } + + public function testAddsProxy() + { + $res = $this->getSendResult(['stream' => true, 'proxy' => '127.0.0.1:8125']); + $opts = stream_context_get_options($res['body']); + $this->assertEquals('127.0.0.1:8125', $opts['http']['proxy']); + } + + public function testAddsTimeout() + { + $res = $this->getSendResult(['stream' => true, 'timeout' => 200]); + $opts = stream_context_get_options($res['body']); + $this->assertEquals(200, $opts['http']['timeout']); + } + + public function testVerifiesVerifyIsValidIfPath() + { + $res = $this->getSendResult(['verify' => '/does/not/exist']); + $this->assertContains( + 'SSL CA bundle not found: /does/not/exist', + (string) $res['error'] + ); + } + + public function testVerifyCanBeDisabled() + { + $res = $this->getSendResult(['verify' => false]); + $this->assertArrayNotHasKey('error', $res); + } + + public function testVerifiesCertIfValidPath() + { + $res = $this->getSendResult(['cert' => '/does/not/exist']); + $this->assertContains( + 'SSL certificate not found: /does/not/exist', + (string) $res['error'] + ); + } + + public function testVerifyCanBeSetToPath() + { + $path = $path = ClientUtils::getDefaultCaBundle(); + $res = $this->getSendResult(['verify' => $path]); + $this->assertArrayNotHasKey('error', $res); + $opts = stream_context_get_options($res['body']); + $this->assertEquals(true, $opts['ssl']['verify_peer']); + $this->assertEquals($path, $opts['ssl']['cafile']); + $this->assertTrue(file_exists($opts['ssl']['cafile'])); + } + + public function testUsesSystemDefaultBundle() + { + $path = $path = ClientUtils::getDefaultCaBundle(); + $res = $this->getSendResult(['verify' => true]); + $this->assertArrayNotHasKey('error', $res); + $opts = stream_context_get_options($res['body']); + if (PHP_VERSION_ID < 50600) { + $this->assertEquals($path, $opts['ssl']['cafile']); + } + } + + public function testEnsuresVerifyOptionIsValid() + { + $res = $this->getSendResult(['verify' => 10]); + $this->assertContains( + 'Invalid verify request option', + (string) $res['error'] + ); + } + + public function testCanSetPasswordWhenSettingCert() + { + $path = __FILE__; + $res = $this->getSendResult(['cert' => [$path, 'foo']]); + $opts = stream_context_get_options($res['body']); + $this->assertEquals($path, $opts['ssl']['local_cert']); + $this->assertEquals('foo', $opts['ssl']['passphrase']); + } + + public function testDebugAttributeWritesToStream() + { + $this->queueRes(); + $f = fopen('php://temp', 'w+'); + $this->getSendResult(['debug' => $f]); + fseek($f, 0); + $contents = stream_get_contents($f); + $this->assertContains(' [CONNECT]', $contents); + $this->assertContains(' [FILE_SIZE_IS]', $contents); + $this->assertContains(' [PROGRESS]', $contents); + } + + public function testDebugAttributeWritesStreamInfoToBuffer() + { + $called = false; + $this->queueRes(); + $buffer = fopen('php://temp', 'r+'); + $this->getSendResult([ + 'progress' => function () use (&$called) { $called = true; }, + 'debug' => $buffer, + ]); + fseek($buffer, 0); + $contents = stream_get_contents($buffer); + $this->assertContains(' [CONNECT]', $contents); + $this->assertContains(' [FILE_SIZE_IS] message: "Content-Length: 8"', $contents); + $this->assertContains(' [PROGRESS] bytes_max: "8"', $contents); + $this->assertTrue($called); + } + + public function testEmitsProgressInformation() + { + $called = []; + $this->queueRes(); + $this->getSendResult([ + 'progress' => function () use (&$called) { + $called[] = func_get_args(); + }, + ]); + $this->assertNotEmpty($called); + $this->assertEquals(8, $called[0][0]); + $this->assertEquals(0, $called[0][1]); + } + + public function testEmitsProgressInformationAndDebugInformation() + { + $called = []; + $this->queueRes(); + $buffer = fopen('php://memory', 'w+'); + $this->getSendResult([ + 'debug' => $buffer, + 'progress' => function () use (&$called) { + $called[] = func_get_args(); + }, + ]); + $this->assertNotEmpty($called); + $this->assertEquals(8, $called[0][0]); + $this->assertEquals(0, $called[0][1]); + rewind($buffer); + $this->assertNotEmpty(stream_get_contents($buffer)); + fclose($buffer); + } + + public function testAddsProxyByProtocol() + { + $url = str_replace('http', 'tcp', Server::$url); + $res = $this->getSendResult(['proxy' => ['http' => $url]]); + $opts = stream_context_get_options($res['body']); + $this->assertEquals($url, $opts['http']['proxy']); + } + + public function testPerformsShallowMergeOfCustomContextOptions() + { + $res = $this->getSendResult([ + 'stream_context' => [ + 'http' => [ + 'request_fulluri' => true, + 'method' => 'HEAD', + ], + 'socket' => [ + 'bindto' => '127.0.0.1:0', + ], + 'ssl' => [ + 'verify_peer' => false, + ], + ], + ]); + + $opts = stream_context_get_options($res['body']); + $this->assertEquals('HEAD', $opts['http']['method']); + $this->assertTrue($opts['http']['request_fulluri']); + $this->assertFalse($opts['ssl']['verify_peer']); + $this->assertEquals('127.0.0.1:0', $opts['socket']['bindto']); + } + + public function testEnsuresThatStreamContextIsAnArray() + { + $res = $this->getSendResult(['stream_context' => 'foo']); + $this->assertContains( + 'stream_context must be an array', + (string) $res['error'] + ); + } + + public function testDoesNotAddContentTypeByDefault() + { + $this->queueRes(); + $handler = new StreamHandler(); + $handler([ + 'http_method' => 'PUT', + 'uri' => '/', + 'headers' => ['host' => [Server::$host], 'content-length' => [3]], + 'body' => 'foo', + ]); + $req = Server::received()[0]; + $this->assertEquals('', Core::header($req, 'Content-Type')); + $this->assertEquals(3, Core::header($req, 'Content-Length')); + } + + private function queueRes() + { + Server::flush(); + Server::enqueue([ + [ + 'status' => 200, + 'reason' => 'OK', + 'headers' => [ + 'Foo' => ['Bar'], + 'Content-Length' => [8], + ], + 'body' => 'hi there', + ], + ]); + } + + public function testSupports100Continue() + { + Server::flush(); + Server::enqueue([ + [ + 'status' => '200', + 'reason' => 'OK', + 'headers' => [ + 'Test' => ['Hello'], + 'Content-Length' => ['4'], + ], + 'body' => 'test', + ], + ]); + + $request = [ + 'http_method' => 'PUT', + 'headers' => [ + 'Host' => [Server::$host], + 'Expect' => ['100-Continue'], + ], + 'body' => 'test', + ]; + + $handler = new StreamHandler(); + $response = $handler($request); + $this->assertEquals(200, $response['status']); + $this->assertEquals('OK', $response['reason']); + $this->assertEquals(['Hello'], $response['headers']['Test']); + $this->assertEquals(['4'], $response['headers']['Content-Length']); + $this->assertEquals('test', Core::body($response)); + } +} diff --git a/openml_OS/vendor/guzzlehttp/ringphp/tests/Client/server.js b/openml_OS/vendor/guzzlehttp/ringphp/tests/Client/server.js new file mode 100644 index 000000000..6a03e33ab --- /dev/null +++ b/openml_OS/vendor/guzzlehttp/ringphp/tests/Client/server.js @@ -0,0 +1,241 @@ +/** + * Guzzle node.js test server to return queued responses to HTTP requests and + * expose a RESTful API for enqueueing responses and retrieving the requests + * that have been received. + * + * - Delete all requests that have been received: + * > DELETE /guzzle-server/requests + * > Host: 127.0.0.1:8125 + * + * - Enqueue responses + * > PUT /guzzle-server/responses + * > Host: 127.0.0.1:8125 + * > + * > [{'status': 200, 'reason': 'OK', 'headers': {}, 'body': '' }] + * + * - Get the received requests + * > GET /guzzle-server/requests + * > Host: 127.0.0.1:8125 + * + * < HTTP/1.1 200 OK + * < + * < [{'http_method': 'GET', 'uri': '/', 'headers': {}, 'body': 'string'}] + * + * - Attempt access to the secure area + * > GET /secure/by-digest/qop-auth/guzzle-server/requests + * > Host: 127.0.0.1:8125 + * + * < HTTP/1.1 401 Unauthorized + * < WWW-Authenticate: Digest realm="Digest Test", qop="auth", nonce="0796e98e1aeef43141fab2a66bf4521a", algorithm="MD5", stale="false" + * < + * < 401 Unauthorized + * + * - Shutdown the server + * > DELETE /guzzle-server + * > Host: 127.0.0.1:8125 + * + * @package Guzzle PHP + * @license See the LICENSE file that was distributed with this source code. + */ + +var http = require('http'); +var url = require('url'); + +/** + * Guzzle node.js server + * @class + */ +var GuzzleServer = function(port, log) { + + this.port = port; + this.log = log; + this.responses = []; + this.requests = []; + var that = this; + + var md5 = function(input) { + var crypto = require('crypto'); + var hasher = crypto.createHash('md5'); + hasher.update(input); + return hasher.digest('hex'); + } + + /** + * Node.js HTTP server authentication module. + * + * It is only initialized on demand (by loadAuthentifier). This avoids + * requiring the dependency to http-auth on standard operations, and the + * performance hit at startup. + */ + var auth; + + /** + * Provides authentication handlers (Basic, Digest). + */ + var loadAuthentifier = function(type, options) { + var typeId = type; + if (type == 'digest') { + typeId += '.'+(options && options.qop ? options.qop : 'none'); + } + if (!loadAuthentifier[typeId]) { + if (!auth) { + try { + auth = require('http-auth'); + } catch (e) { + if (e.code == 'MODULE_NOT_FOUND') { + return; + } + } + } + switch (type) { + case 'digest': + var digestParams = { + realm: 'Digest Test', + login: 'me', + password: 'test' + }; + if (options && options.qop) { + digestParams.qop = options.qop; + } + loadAuthentifier[typeId] = auth.digest(digestParams, function(username, callback) { + callback(md5(digestParams.login + ':' + digestParams.realm + ':' + digestParams.password)); + }); + break + } + } + return loadAuthentifier[typeId]; + }; + + var firewallRequest = function(request, req, res, requestHandlerCallback) { + var securedAreaUriParts = request.uri.match(/^\/secure\/by-(digest)(\/qop-([^\/]*))?(\/.*)$/); + if (securedAreaUriParts) { + var authentifier = loadAuthentifier(securedAreaUriParts[1], { qop: securedAreaUriParts[2] }); + if (!authentifier) { + res.writeHead(501, 'HTTP authentication not implemented', { 'Content-Length': 0 }); + res.end(); + return; + } + authentifier.check(req, res, function(req, res) { + req.url = securedAreaUriParts[4]; + requestHandlerCallback(request, req, res); + }); + } else { + requestHandlerCallback(request, req, res); + } + }; + + var controlRequest = function(request, req, res) { + if (req.url == '/guzzle-server/perf') { + res.writeHead(200, 'OK', {'Content-Length': 16}); + res.end('Body of response'); + } else if (req.method == 'DELETE') { + if (req.url == '/guzzle-server/requests') { + // Clear the received requests + that.requests = []; + res.writeHead(200, 'OK', { 'Content-Length': 0 }); + res.end(); + if (that.log) { + console.log('Flushing requests'); + } + } else if (req.url == '/guzzle-server') { + // Shutdown the server + res.writeHead(200, 'OK', { 'Content-Length': 0, 'Connection': 'close' }); + res.end(); + if (that.log) { + console.log('Shutting down'); + } + that.server.close(); + } + } else if (req.method == 'GET') { + if (req.url === '/guzzle-server/requests') { + if (that.log) { + console.log('Sending received requests'); + } + // Get received requests + var body = JSON.stringify(that.requests); + res.writeHead(200, 'OK', { 'Content-Length': body.length }); + res.end(body); + } + } else if (req.method == 'PUT' && req.url == '/guzzle-server/responses') { + if (that.log) { + console.log('Adding responses...'); + } + if (!request.body) { + if (that.log) { + console.log('No response data was provided'); + } + res.writeHead(400, 'NO RESPONSES IN REQUEST', { 'Content-Length': 0 }); + } else { + that.responses = eval('(' + request.body + ')'); + for (var i = 0; i < that.responses.length; i++) { + if (that.responses[i].body) { + that.responses[i].body = new Buffer(that.responses[i].body, 'base64'); + } + } + if (that.log) { + console.log(that.responses); + } + res.writeHead(200, 'OK', { 'Content-Length': 0 }); + } + res.end(); + } + }; + + var receivedRequest = function(request, req, res) { + if (req.url.indexOf('/guzzle-server') === 0) { + controlRequest(request, req, res); + } else if (req.url.indexOf('/guzzle-server') == -1 && !that.responses.length) { + res.writeHead(500); + res.end('No responses in queue'); + } else { + if (that.log) { + console.log('Returning response from queue and adding request'); + } + that.requests.push(request); + var response = that.responses.shift(); + res.writeHead(response.status, response.reason, response.headers); + res.end(response.body); + } + }; + + this.start = function() { + + that.server = http.createServer(function(req, res) { + + var parts = url.parse(req.url, false); + var request = { + http_method: req.method, + scheme: parts.scheme, + uri: parts.pathname, + query_string: parts.query, + headers: req.headers, + version: req.httpVersion, + body: '' + }; + + // Receive each chunk of the request body + req.addListener('data', function(chunk) { + request.body += chunk; + }); + + // Called when the request completes + req.addListener('end', function() { + firewallRequest(request, req, res, receivedRequest); + }); + }); + + that.server.listen(this.port, '127.0.0.1'); + + if (this.log) { + console.log('Server running at http://127.0.0.1:8125/'); + } + }; +}; + +// Get the port from the arguments +port = process.argv.length >= 3 ? process.argv[2] : 8125; +log = process.argv.length >= 4 ? process.argv[3] : false; + +// Start the server +server = new GuzzleServer(port, log); +server.start(); diff --git a/openml_OS/vendor/guzzlehttp/ringphp/tests/CoreTest.php b/openml_OS/vendor/guzzlehttp/ringphp/tests/CoreTest.php new file mode 100644 index 000000000..49522f26b --- /dev/null +++ b/openml_OS/vendor/guzzlehttp/ringphp/tests/CoreTest.php @@ -0,0 +1,336 @@ +assertNull(Core::header([], 'Foo')); + $this->assertNull(Core::firstHeader([], 'Foo')); + } + + public function testChecksIfHasHeader() + { + $message = [ + 'headers' => [ + 'Foo' => ['Bar', 'Baz'], + 'foo' => ['hello'], + 'bar' => ['1'] + ] + ]; + $this->assertTrue(Core::hasHeader($message, 'Foo')); + $this->assertTrue(Core::hasHeader($message, 'foo')); + $this->assertTrue(Core::hasHeader($message, 'FoO')); + $this->assertTrue(Core::hasHeader($message, 'bar')); + $this->assertFalse(Core::hasHeader($message, 'barr')); + } + + public function testReturnsFirstHeaderWhenSimple() + { + $this->assertEquals('Bar', Core::firstHeader([ + 'headers' => ['Foo' => ['Bar', 'Baz']], + ], 'Foo')); + } + + public function testReturnsFirstHeaderWhenMultiplePerLine() + { + $this->assertEquals('Bar', Core::firstHeader([ + 'headers' => ['Foo' => ['Bar, Baz']], + ], 'Foo')); + } + + public function testExtractsCaseInsensitiveHeader() + { + $this->assertEquals( + 'hello', + Core::header(['headers' => ['foo' => ['hello']]], 'FoO') + ); + } + + public function testExtractsCaseInsensitiveHeaderLines() + { + $this->assertEquals( + ['a', 'b', 'c', 'd'], + Core::headerLines([ + 'headers' => [ + 'foo' => ['a', 'b'], + 'Foo' => ['c', 'd'] + ] + ], 'foo') + ); + } + + public function testExtractsHeaderLines() + { + $this->assertEquals( + ['bar', 'baz'], + Core::headerLines([ + 'headers' => [ + 'Foo' => ['bar', 'baz'], + ], + ], 'Foo') + ); + } + + public function testExtractsHeaderAsString() + { + $this->assertEquals( + 'bar, baz', + Core::header([ + 'headers' => [ + 'Foo' => ['bar', 'baz'], + ], + ], 'Foo', true) + ); + } + + public function testReturnsNullWhenHeaderNotFound() + { + $this->assertNull(Core::header(['headers' => []], 'Foo')); + } + + public function testRemovesHeaders() + { + $message = [ + 'headers' => [ + 'foo' => ['bar'], + 'Foo' => ['bam'], + 'baz' => ['123'], + ], + ]; + + $this->assertSame($message, Core::removeHeader($message, 'bam')); + $this->assertEquals([ + 'headers' => ['baz' => ['123']], + ], Core::removeHeader($message, 'foo')); + } + + public function testCreatesUrl() + { + $req = [ + 'scheme' => 'http', + 'headers' => ['host' => ['foo.com']], + 'uri' => '/', + ]; + + $this->assertEquals('http://foo.com/', Core::url($req)); + } + + /** + * @expectedException \InvalidArgumentException + * @expectedExceptionMessage No Host header was provided + */ + public function testEnsuresHostIsAvailableWhenCreatingUrls() + { + Core::url([]); + } + + public function testCreatesUrlWithQueryString() + { + $req = [ + 'scheme' => 'http', + 'headers' => ['host' => ['foo.com']], + 'uri' => '/', + 'query_string' => 'foo=baz', + ]; + + $this->assertEquals('http://foo.com/?foo=baz', Core::url($req)); + } + + public function testUsesUrlIfSet() + { + $req = ['url' => 'http://foo.com']; + $this->assertEquals('http://foo.com', Core::url($req)); + } + + public function testReturnsNullWhenNoBody() + { + $this->assertNull(Core::body([])); + } + + public function testReturnsStreamAsString() + { + $this->assertEquals( + 'foo', + Core::body(['body' => Stream::factory('foo')]) + ); + } + + public function testReturnsString() + { + $this->assertEquals('foo', Core::body(['body' => 'foo'])); + } + + public function testReturnsResourceContent() + { + $r = fopen('php://memory', 'w+'); + fwrite($r, 'foo'); + rewind($r); + $this->assertEquals('foo', Core::body(['body' => $r])); + fclose($r); + } + + public function testReturnsIteratorContent() + { + $a = new \ArrayIterator(['a', 'b', 'cd', '']); + $this->assertEquals('abcd', Core::body(['body' => $a])); + } + + public function testReturnsObjectToString() + { + $this->assertEquals('foo', Core::body(['body' => new StrClass])); + } + + /** + * @expectedException \InvalidArgumentException + */ + public function testEnsuresBodyIsValid() + { + Core::body(['body' => false]); + } + + public function testParsesHeadersFromLines() + { + $lines = ['Foo: bar', 'Foo: baz', 'Abc: 123', 'Def: a, b']; + $this->assertEquals([ + 'Foo' => ['bar', 'baz'], + 'Abc' => ['123'], + 'Def' => ['a, b'], + ], Core::headersFromLines($lines)); + } + + public function testParsesHeadersFromLinesWithMultipleLines() + { + $lines = ['Foo: bar', 'Foo: baz', 'Foo: 123']; + $this->assertEquals([ + 'Foo' => ['bar', 'baz', '123'], + ], Core::headersFromLines($lines)); + } + + public function testCreatesArrayCallFunctions() + { + $called = []; + $a = function ($a, $b) use (&$called) { + $called['a'] = func_get_args(); + }; + $b = function ($a, $b) use (&$called) { + $called['b'] = func_get_args(); + }; + $c = Core::callArray([$a, $b]); + $c(1, 2); + $this->assertEquals([1, 2], $called['a']); + $this->assertEquals([1, 2], $called['b']); + } + + public function testRewindsGuzzleStreams() + { + $str = Stream::factory('foo'); + $this->assertTrue(Core::rewindBody(['body' => $str])); + } + + public function testRewindsStreams() + { + $str = Stream::factory('foo')->detach(); + $this->assertTrue(Core::rewindBody(['body' => $str])); + } + + public function testRewindsIterators() + { + $iter = new \ArrayIterator(['foo']); + $this->assertTrue(Core::rewindBody(['body' => $iter])); + } + + public function testRewindsStrings() + { + $this->assertTrue(Core::rewindBody(['body' => 'hi'])); + } + + public function testRewindsToStrings() + { + $this->assertTrue(Core::rewindBody(['body' => new StrClass()])); + } + + public function typeProvider() + { + return [ + ['foo', 'string(3) "foo"'], + [true, 'bool(true)'], + [false, 'bool(false)'], + [10, 'int(10)'], + [1.0, 'float(1)'], + [new StrClass(), 'object(GuzzleHttp\Tests\Ring\StrClass)'], + [['foo'], 'array(1)'] + ]; + } + + /** + * @dataProvider typeProvider + */ + public function testDescribesType($input, $output) + { + $this->assertEquals($output, Core::describeType($input)); + } + + public function testDoesSleep() + { + $t = microtime(true); + $expected = $t + (100 / 1000); + Core::doSleep(['client' => ['delay' => 100]]); + $this->assertGreaterThanOrEqual($expected, microtime(true)); + } + + public function testProxiesFuture() + { + $f = new CompletedFutureArray(['status' => 200]); + $res = null; + $proxied = Core::proxy($f, function ($value) use (&$res) { + $value['foo'] = 'bar'; + $res = $value; + return $value; + }); + $this->assertNotSame($f, $proxied); + $this->assertEquals(200, $f->wait()['status']); + $this->assertArrayNotHasKey('foo', $f->wait()); + $this->assertEquals('bar', $proxied->wait()['foo']); + $this->assertEquals(200, $proxied->wait()['status']); + } + + public function testProxiesDeferredFuture() + { + $d = new Deferred(); + $f = new FutureArray($d->promise()); + $f2 = Core::proxy($f); + $d->resolve(['foo' => 'bar']); + $this->assertEquals('bar', $f['foo']); + $this->assertEquals('bar', $f2['foo']); + } + + public function testProxiesDeferredFutureFailure() + { + $d = new Deferred(); + $f = new FutureArray($d->promise()); + $f2 = Core::proxy($f); + $d->reject(new \Exception('foo')); + try { + $f2['hello?']; + $this->fail('did not throw'); + } catch (\Exception $e) { + $this->assertEquals('foo', $e->getMessage()); + } + + } +} + +final class StrClass +{ + public function __toString() + { + return 'foo'; + } +} diff --git a/openml_OS/vendor/guzzlehttp/ringphp/tests/Future/CompletedFutureArrayTest.php b/openml_OS/vendor/guzzlehttp/ringphp/tests/Future/CompletedFutureArrayTest.php new file mode 100644 index 000000000..82d7efbf5 --- /dev/null +++ b/openml_OS/vendor/guzzlehttp/ringphp/tests/Future/CompletedFutureArrayTest.php @@ -0,0 +1,21 @@ + 'bar']); + $this->assertEquals('bar', $f['foo']); + $this->assertFalse(isset($f['baz'])); + $f['abc'] = '123'; + $this->assertTrue(isset($f['abc'])); + $this->assertEquals(['foo' => 'bar', 'abc' => '123'], iterator_to_array($f)); + $this->assertEquals(2, count($f)); + unset($f['abc']); + $this->assertEquals(1, count($f)); + $this->assertEquals(['foo' => 'bar'], iterator_to_array($f)); + } +} diff --git a/openml_OS/vendor/guzzlehttp/ringphp/tests/Future/CompletedFutureValueTest.php b/openml_OS/vendor/guzzlehttp/ringphp/tests/Future/CompletedFutureValueTest.php new file mode 100644 index 000000000..6ded40dfb --- /dev/null +++ b/openml_OS/vendor/guzzlehttp/ringphp/tests/Future/CompletedFutureValueTest.php @@ -0,0 +1,46 @@ +assertEquals('hi', $f->wait()); + $f->cancel(); + + $a = null; + $f->then(function ($v) use (&$a) { + $a = $v; + }); + $this->assertSame('hi', $a); + } + + public function testThrows() + { + $ex = new \Exception('foo'); + $f = new CompletedFutureValue(null, $ex); + $f->cancel(); + try { + $f->wait(); + $this->fail('did not throw'); + } catch (\Exception $e) { + $this->assertSame($e, $ex); + } + } + + public function testMarksAsCancelled() + { + $ex = new CancelledFutureAccessException(); + $f = new CompletedFutureValue(null, $ex); + try { + $f->wait(); + $this->fail('did not throw'); + } catch (\Exception $e) { + $this->assertSame($e, $ex); + } + } +} diff --git a/openml_OS/vendor/guzzlehttp/ringphp/tests/Future/FutureArrayTest.php b/openml_OS/vendor/guzzlehttp/ringphp/tests/Future/FutureArrayTest.php new file mode 100644 index 000000000..0e09f5afa --- /dev/null +++ b/openml_OS/vendor/guzzlehttp/ringphp/tests/Future/FutureArrayTest.php @@ -0,0 +1,56 @@ +promise(), + function () use (&$c, $deferred) { + $c = true; + $deferred->resolve(['status' => 200]); + } + ); + $this->assertFalse($c); + $this->assertFalse($this->readAttribute($f, 'isRealized')); + $this->assertEquals(200, $f['status']); + $this->assertTrue($c); + } + + public function testActsLikeArray() + { + $deferred = new Deferred(); + $f = new FutureArray( + $deferred->promise(), + function () use (&$c, $deferred) { + $deferred->resolve(['status' => 200]); + } + ); + + $this->assertTrue(isset($f['status'])); + $this->assertEquals(200, $f['status']); + $this->assertEquals(['status' => 200], $f->wait()); + $this->assertEquals(1, count($f)); + $f['baz'] = 10; + $this->assertEquals(10, $f['baz']); + unset($f['baz']); + $this->assertFalse(isset($f['baz'])); + $this->assertEquals(['status' => 200], iterator_to_array($f)); + } + + /** + * @expectedException \RuntimeException + */ + public function testThrowsWhenAccessingInvalidProperty() + { + $deferred = new Deferred(); + $f = new FutureArray($deferred->promise(), function () {}); + $f->foo; + } +} diff --git a/openml_OS/vendor/guzzlehttp/ringphp/tests/Future/FutureValueTest.php b/openml_OS/vendor/guzzlehttp/ringphp/tests/Future/FutureValueTest.php new file mode 100644 index 000000000..d59c543d0 --- /dev/null +++ b/openml_OS/vendor/guzzlehttp/ringphp/tests/Future/FutureValueTest.php @@ -0,0 +1,109 @@ +promise(), + function () use ($deferred, &$called) { + $called++; + $deferred->resolve('foo'); + } + ); + + $this->assertEquals('foo', $f->wait()); + $this->assertEquals(1, $called); + $this->assertEquals('foo', $f->wait()); + $this->assertEquals(1, $called); + $f->cancel(); + $this->assertTrue($this->readAttribute($f, 'isRealized')); + } + + /** + * @expectedException \GuzzleHttp\Ring\Exception\CancelledFutureAccessException + */ + public function testThrowsWhenAccessingCancelled() + { + $f = new FutureValue( + (new Deferred())->promise(), + function () {}, + function () { return true; } + ); + $f->cancel(); + $f->wait(); + } + + /** + * @expectedException \OutOfBoundsException + */ + public function testThrowsWhenDerefFailure() + { + $called = false; + $deferred = new Deferred(); + $f = new FutureValue( + $deferred->promise(), + function () use(&$called) { + $called = true; + } + ); + $deferred->reject(new \OutOfBoundsException()); + $f->wait(); + $this->assertFalse($called); + } + + /** + * @expectedException \GuzzleHttp\Ring\Exception\RingException + * @expectedExceptionMessage Waiting did not resolve future + */ + public function testThrowsWhenDerefDoesNotResolve() + { + $deferred = new Deferred(); + $f = new FutureValue( + $deferred->promise(), + function () use(&$called) { + $called = true; + } + ); + $f->wait(); + } + + public function testThrowingCancelledFutureAccessExceptionCancels() + { + $deferred = new Deferred(); + $f = new FutureValue( + $deferred->promise(), + function () use ($deferred) { + throw new CancelledFutureAccessException(); + } + ); + try { + $f->wait(); + $this->fail('did not throw'); + } catch (CancelledFutureAccessException $e) {} + } + + /** + * @expectedException \Exception + * @expectedExceptionMessage foo + */ + public function testThrowingExceptionInDerefMarksAsFailed() + { + $deferred = new Deferred(); + $f = new FutureValue( + $deferred->promise(), + function () { + throw new \Exception('foo'); + } + ); + $f->wait(); + } +} diff --git a/openml_OS/vendor/guzzlehttp/ringphp/tests/bootstrap.php b/openml_OS/vendor/guzzlehttp/ringphp/tests/bootstrap.php new file mode 100644 index 000000000..017610fe0 --- /dev/null +++ b/openml_OS/vendor/guzzlehttp/ringphp/tests/bootstrap.php @@ -0,0 +1,11 @@ + + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/openml_OS/vendor/guzzlehttp/streams/Makefile b/openml_OS/vendor/guzzlehttp/streams/Makefile new file mode 100644 index 000000000..f4d42849e --- /dev/null +++ b/openml_OS/vendor/guzzlehttp/streams/Makefile @@ -0,0 +1,19 @@ +all: clean coverage + +release: tag + git push origin --tags + +tag: + chag tag --sign --debug CHANGELOG.rst + +test: + vendor/bin/phpunit + +coverage: + vendor/bin/phpunit --coverage-html=artifacts/coverage + +view-coverage: + open artifacts/coverage/index.html + +clean: + rm -rf artifacts/* diff --git a/openml_OS/vendor/guzzlehttp/streams/README.rst b/openml_OS/vendor/guzzlehttp/streams/README.rst new file mode 100644 index 000000000..baff63b37 --- /dev/null +++ b/openml_OS/vendor/guzzlehttp/streams/README.rst @@ -0,0 +1,36 @@ +============== +Guzzle Streams +============== + +Provides a simple abstraction over streams of data. + +This library is used in `Guzzle 5 `_, and is +(currently) compatible with the WIP PSR-7. + +Installation +============ + +This package can be installed easily using `Composer `_. +Simply add the following to the composer.json file at the root of your project: + +.. code-block:: javascript + + { + "require": { + "guzzlehttp/streams": "~3.0" + } + } + +Then install your dependencies using ``composer.phar install``. + +Documentation +============= + +The documentation for this package can be found on the main Guzzle website at +http://docs.guzzlephp.org/en/guzzle4/streams.html. + +Testing +======= + +This library is tested using PHPUnit. You'll need to install the dependencies +using `Composer `_ then run ``make test``. diff --git a/openml_OS/vendor/guzzlehttp/streams/composer.json b/openml_OS/vendor/guzzlehttp/streams/composer.json new file mode 100644 index 000000000..6d7034370 --- /dev/null +++ b/openml_OS/vendor/guzzlehttp/streams/composer.json @@ -0,0 +1,28 @@ +{ + "name": "guzzlehttp/streams", + "description": "Provides a simple abstraction over streams of data", + "homepage": "http://guzzlephp.org/", + "keywords": ["stream", "guzzle"], + "license": "MIT", + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "require": { + "php": ">=5.4.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "autoload": { + "psr-4": { "GuzzleHttp\\Stream\\": "src/" } + }, + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + } +} diff --git a/openml_OS/vendor/guzzlehttp/streams/phpunit.xml.dist b/openml_OS/vendor/guzzlehttp/streams/phpunit.xml.dist new file mode 100644 index 000000000..6e758c192 --- /dev/null +++ b/openml_OS/vendor/guzzlehttp/streams/phpunit.xml.dist @@ -0,0 +1,17 @@ + + + + + tests + + + + + src + + src/functions.php + + + + diff --git a/openml_OS/vendor/guzzlehttp/streams/src/AppendStream.php b/openml_OS/vendor/guzzlehttp/streams/src/AppendStream.php new file mode 100644 index 000000000..94bda7173 --- /dev/null +++ b/openml_OS/vendor/guzzlehttp/streams/src/AppendStream.php @@ -0,0 +1,220 @@ +addStream($stream); + } + } + + public function __toString() + { + try { + $this->seek(0); + return $this->getContents(); + } catch (\Exception $e) { + return ''; + } + } + + /** + * Add a stream to the AppendStream + * + * @param StreamInterface $stream Stream to append. Must be readable. + * + * @throws \InvalidArgumentException if the stream is not readable + */ + public function addStream(StreamInterface $stream) + { + if (!$stream->isReadable()) { + throw new \InvalidArgumentException('Each stream must be readable'); + } + + // The stream is only seekable if all streams are seekable + if (!$stream->isSeekable()) { + $this->seekable = false; + } + + $this->streams[] = $stream; + } + + public function getContents() + { + return Utils::copyToString($this); + } + + /** + * Closes each attached stream. + * + * {@inheritdoc} + */ + public function close() + { + $this->pos = $this->current = 0; + + foreach ($this->streams as $stream) { + $stream->close(); + } + + $this->streams = []; + } + + /** + * Detaches each attached stream + * + * {@inheritdoc} + */ + public function detach() + { + $this->close(); + $this->detached = true; + } + + public function attach($stream) + { + throw new CannotAttachException(); + } + + public function tell() + { + return $this->pos; + } + + /** + * Tries to calculate the size by adding the size of each stream. + * + * If any of the streams do not return a valid number, then the size of the + * append stream cannot be determined and null is returned. + * + * {@inheritdoc} + */ + public function getSize() + { + $size = 0; + + foreach ($this->streams as $stream) { + $s = $stream->getSize(); + if ($s === null) { + return null; + } + $size += $s; + } + + return $size; + } + + public function eof() + { + return !$this->streams || + ($this->current >= count($this->streams) - 1 && + $this->streams[$this->current]->eof()); + } + + /** + * Attempts to seek to the given position. Only supports SEEK_SET. + * + * {@inheritdoc} + */ + public function seek($offset, $whence = SEEK_SET) + { + if (!$this->seekable || $whence !== SEEK_SET) { + return false; + } + + $success = true; + $this->pos = $this->current = 0; + + // Rewind each stream + foreach ($this->streams as $stream) { + if (!$stream->seek(0)) { + $success = false; + } + } + + if (!$success) { + return false; + } + + // Seek to the actual position by reading from each stream + while ($this->pos < $offset && !$this->eof()) { + $this->read(min(8096, $offset - $this->pos)); + } + + return $this->pos == $offset; + } + + /** + * Reads from all of the appended streams until the length is met or EOF. + * + * {@inheritdoc} + */ + public function read($length) + { + $buffer = ''; + $total = count($this->streams) - 1; + $remaining = $length; + + while ($remaining > 0) { + // Progress to the next stream if needed. + if ($this->streams[$this->current]->eof()) { + if ($this->current == $total) { + break; + } + $this->current++; + } + $buffer .= $this->streams[$this->current]->read($remaining); + $remaining = $length - strlen($buffer); + } + + $this->pos += strlen($buffer); + + return $buffer; + } + + public function isReadable() + { + return true; + } + + public function isWritable() + { + return false; + } + + public function isSeekable() + { + return $this->seekable; + } + + public function write($string) + { + return false; + } + + public function getMetadata($key = null) + { + return $key ? null : []; + } +} diff --git a/openml_OS/vendor/guzzlehttp/streams/src/AsyncReadStream.php b/openml_OS/vendor/guzzlehttp/streams/src/AsyncReadStream.php new file mode 100644 index 000000000..25ad96021 --- /dev/null +++ b/openml_OS/vendor/guzzlehttp/streams/src/AsyncReadStream.php @@ -0,0 +1,207 @@ +isReadable() || !$buffer->isWritable()) { + throw new \InvalidArgumentException( + 'Buffer must be readable and writable' + ); + } + + if (isset($config['size'])) { + $this->size = $config['size']; + } + + static $callables = ['pump', 'drain']; + foreach ($callables as $check) { + if (isset($config[$check])) { + if (!is_callable($config[$check])) { + throw new \InvalidArgumentException( + $check . ' must be callable' + ); + } + $this->{$check} = $config[$check]; + } + } + + $this->hwm = $buffer->getMetadata('hwm'); + + // Cannot drain when there's no high water mark. + if ($this->hwm === null) { + $this->drain = null; + } + + $this->stream = $buffer; + } + + /** + * Factory method used to create new async stream and an underlying buffer + * if no buffer is provided. + * + * This function accepts the same options as AsyncReadStream::__construct, + * but added the following key value pairs: + * + * - buffer: (StreamInterface) Buffer used to buffer data. If none is + * provided, a default buffer is created. + * - hwm: (int) High water mark to use if a buffer is created on your + * behalf. + * - max_buffer: (int) If provided, wraps the utilized buffer in a + * DroppingStream decorator to ensure that buffer does not exceed a given + * length. When exceeded, the stream will begin dropping data. Set the + * max_buffer to 0, to use a NullStream which does not store data. + * - write: (callable) A function that is invoked when data is written + * to the underlying buffer. The function accepts the buffer as the first + * argument, and the data being written as the second. The function MUST + * return the number of bytes that were written or false to let writers + * know to slow down. + * - drain: (callable) See constructor documentation. + * - pump: (callable) See constructor documentation. + * + * @param array $options Associative array of options. + * + * @return array Returns an array containing the buffer used to buffer + * data, followed by the ready to use AsyncReadStream object. + */ + public static function create(array $options = []) + { + $maxBuffer = isset($options['max_buffer']) + ? $options['max_buffer'] + : null; + + if ($maxBuffer === 0) { + $buffer = new NullStream(); + } elseif (isset($options['buffer'])) { + $buffer = $options['buffer']; + } else { + $hwm = isset($options['hwm']) ? $options['hwm'] : 16384; + $buffer = new BufferStream($hwm); + } + + if ($maxBuffer > 0) { + $buffer = new DroppingStream($buffer, $options['max_buffer']); + } + + // Call the on_write callback if an on_write function was provided. + if (isset($options['write'])) { + $onWrite = $options['write']; + $buffer = FnStream::decorate($buffer, [ + 'write' => function ($string) use ($buffer, $onWrite) { + $result = $buffer->write($string); + $onWrite($buffer, $string); + return $result; + } + ]); + } + + return [$buffer, new self($buffer, $options)]; + } + + public function getSize() + { + return $this->size; + } + + public function isWritable() + { + return false; + } + + public function write($string) + { + return false; + } + + public function read($length) + { + if (!$this->needsDrain && $this->drain) { + $this->needsDrain = $this->stream->getSize() >= $this->hwm; + } + + $result = $this->stream->read($length); + + // If we need to drain, then drain when the buffer is empty. + if ($this->needsDrain && $this->stream->getSize() === 0) { + $this->needsDrain = false; + $drainFn = $this->drain; + $drainFn($this->stream); + } + + $resultLen = strlen($result); + + // If a pump was provided, the buffer is still open, and not enough + // data was given, then block until the data is provided. + if ($this->pump && $resultLen < $length) { + $pumpFn = $this->pump; + $result .= $pumpFn($length - $resultLen); + } + + return $result; + } +} diff --git a/openml_OS/vendor/guzzlehttp/streams/src/BufferStream.php b/openml_OS/vendor/guzzlehttp/streams/src/BufferStream.php new file mode 100644 index 000000000..0fffbd63a --- /dev/null +++ b/openml_OS/vendor/guzzlehttp/streams/src/BufferStream.php @@ -0,0 +1,138 @@ +hwm = $hwm; + } + + public function __toString() + { + return $this->getContents(); + } + + public function getContents() + { + $buffer = $this->buffer; + $this->buffer = ''; + + return $buffer; + } + + public function close() + { + $this->buffer = ''; + } + + public function detach() + { + $this->close(); + } + + public function attach($stream) + { + throw new CannotAttachException(); + } + + public function getSize() + { + return strlen($this->buffer); + } + + public function isReadable() + { + return true; + } + + public function isWritable() + { + return true; + } + + public function isSeekable() + { + return false; + } + + public function seek($offset, $whence = SEEK_SET) + { + return false; + } + + public function eof() + { + return strlen($this->buffer) === 0; + } + + public function tell() + { + return false; + } + + /** + * Reads data from the buffer. + */ + public function read($length) + { + $currentLength = strlen($this->buffer); + + if ($length >= $currentLength) { + // No need to slice the buffer because we don't have enough data. + $result = $this->buffer; + $this->buffer = ''; + } else { + // Slice up the result to provide a subset of the buffer. + $result = substr($this->buffer, 0, $length); + $this->buffer = substr($this->buffer, $length); + } + + return $result; + } + + /** + * Writes data to the buffer. + */ + public function write($string) + { + $this->buffer .= $string; + + if (strlen($this->buffer) >= $this->hwm) { + return false; + } + + return strlen($string); + } + + public function getMetadata($key = null) + { + if ($key == 'hwm') { + return $this->hwm; + } + + return $key ? null : []; + } +} diff --git a/openml_OS/vendor/guzzlehttp/streams/src/CachingStream.php b/openml_OS/vendor/guzzlehttp/streams/src/CachingStream.php new file mode 100644 index 000000000..60bb9056c --- /dev/null +++ b/openml_OS/vendor/guzzlehttp/streams/src/CachingStream.php @@ -0,0 +1,122 @@ +remoteStream = $stream; + $this->stream = $target ?: new Stream(fopen('php://temp', 'r+')); + } + + public function getSize() + { + return max($this->stream->getSize(), $this->remoteStream->getSize()); + } + + /** + * {@inheritdoc} + * @throws SeekException When seeking with SEEK_END or when seeking + * past the total size of the buffer stream + */ + public function seek($offset, $whence = SEEK_SET) + { + if ($whence == SEEK_SET) { + $byte = $offset; + } elseif ($whence == SEEK_CUR) { + $byte = $offset + $this->tell(); + } else { + return false; + } + + // You cannot skip ahead past where you've read from the remote stream + if ($byte > $this->stream->getSize()) { + throw new SeekException( + $this, + $byte, + sprintf('Cannot seek to byte %d when the buffered stream only' + . ' contains %d bytes', $byte, $this->stream->getSize()) + ); + } + + return $this->stream->seek($byte); + } + + public function read($length) + { + // Perform a regular read on any previously read data from the buffer + $data = $this->stream->read($length); + $remaining = $length - strlen($data); + + // More data was requested so read from the remote stream + if ($remaining) { + // If data was written to the buffer in a position that would have + // been filled from the remote stream, then we must skip bytes on + // the remote stream to emulate overwriting bytes from that + // position. This mimics the behavior of other PHP stream wrappers. + $remoteData = $this->remoteStream->read( + $remaining + $this->skipReadBytes + ); + + if ($this->skipReadBytes) { + $len = strlen($remoteData); + $remoteData = substr($remoteData, $this->skipReadBytes); + $this->skipReadBytes = max(0, $this->skipReadBytes - $len); + } + + $data .= $remoteData; + $this->stream->write($remoteData); + } + + return $data; + } + + public function write($string) + { + // When appending to the end of the currently read stream, you'll want + // to skip bytes from being read from the remote stream to emulate + // other stream wrappers. Basically replacing bytes of data of a fixed + // length. + $overflow = (strlen($string) + $this->tell()) - $this->remoteStream->tell(); + if ($overflow > 0) { + $this->skipReadBytes += $overflow; + } + + return $this->stream->write($string); + } + + public function eof() + { + return $this->stream->eof() && $this->remoteStream->eof(); + } + + /** + * Close both the remote stream and buffer stream + */ + public function close() + { + $this->remoteStream->close() && $this->stream->close(); + } +} diff --git a/openml_OS/vendor/guzzlehttp/streams/src/DroppingStream.php b/openml_OS/vendor/guzzlehttp/streams/src/DroppingStream.php new file mode 100644 index 000000000..56ee80c12 --- /dev/null +++ b/openml_OS/vendor/guzzlehttp/streams/src/DroppingStream.php @@ -0,0 +1,42 @@ +stream = $stream; + $this->maxLength = $maxLength; + } + + public function write($string) + { + $diff = $this->maxLength - $this->stream->getSize(); + + // Begin returning false when the underlying stream is too large. + if ($diff <= 0) { + return false; + } + + // Write the stream or a subset of the stream if needed. + if (strlen($string) < $diff) { + return $this->stream->write($string); + } + + $this->stream->write(substr($string, 0, $diff)); + + return false; + } +} diff --git a/openml_OS/vendor/guzzlehttp/streams/src/Exception/CannotAttachException.php b/openml_OS/vendor/guzzlehttp/streams/src/Exception/CannotAttachException.php new file mode 100644 index 000000000..e631b9fa4 --- /dev/null +++ b/openml_OS/vendor/guzzlehttp/streams/src/Exception/CannotAttachException.php @@ -0,0 +1,4 @@ +stream = $stream; + $msg = $msg ?: 'Could not seek the stream to position ' . $pos; + parent::__construct($msg); + } + + /** + * @return StreamInterface + */ + public function getStream() + { + return $this->stream; + } +} diff --git a/openml_OS/vendor/guzzlehttp/streams/src/FnStream.php b/openml_OS/vendor/guzzlehttp/streams/src/FnStream.php new file mode 100644 index 000000000..6b5872d7f --- /dev/null +++ b/openml_OS/vendor/guzzlehttp/streams/src/FnStream.php @@ -0,0 +1,147 @@ +methods = $methods; + + // Create the functions on the class + foreach ($methods as $name => $fn) { + $this->{'_fn_' . $name} = $fn; + } + } + + /** + * Lazily determine which methods are not implemented. + * @throws \BadMethodCallException + */ + public function __get($name) + { + throw new \BadMethodCallException(str_replace('_fn_', '', $name) + . '() is not implemented in the FnStream'); + } + + /** + * The close method is called on the underlying stream only if possible. + */ + public function __destruct() + { + if (isset($this->_fn_close)) { + call_user_func($this->_fn_close); + } + } + + /** + * Adds custom functionality to an underlying stream by intercepting + * specific method calls. + * + * @param StreamInterface $stream Stream to decorate + * @param array $methods Hash of method name to a closure + * + * @return FnStream + */ + public static function decorate(StreamInterface $stream, array $methods) + { + // If any of the required methods were not provided, then simply + // proxy to the decorated stream. + foreach (array_diff(self::$slots, array_keys($methods)) as $diff) { + $methods[$diff] = [$stream, $diff]; + } + + return new self($methods); + } + + public function __toString() + { + return call_user_func($this->_fn___toString); + } + + public function close() + { + return call_user_func($this->_fn_close); + } + + public function detach() + { + return call_user_func($this->_fn_detach); + } + + public function attach($stream) + { + return call_user_func($this->_fn_attach, $stream); + } + + public function getSize() + { + return call_user_func($this->_fn_getSize); + } + + public function tell() + { + return call_user_func($this->_fn_tell); + } + + public function eof() + { + return call_user_func($this->_fn_eof); + } + + public function isSeekable() + { + return call_user_func($this->_fn_isSeekable); + } + + public function seek($offset, $whence = SEEK_SET) + { + return call_user_func($this->_fn_seek, $offset, $whence); + } + + public function isWritable() + { + return call_user_func($this->_fn_isWritable); + } + + public function write($string) + { + return call_user_func($this->_fn_write, $string); + } + + public function isReadable() + { + return call_user_func($this->_fn_isReadable); + } + + public function read($length) + { + return call_user_func($this->_fn_read, $length); + } + + public function getContents() + { + return call_user_func($this->_fn_getContents); + } + + public function getMetadata($key = null) + { + return call_user_func($this->_fn_getMetadata, $key); + } +} diff --git a/openml_OS/vendor/guzzlehttp/streams/src/GuzzleStreamWrapper.php b/openml_OS/vendor/guzzlehttp/streams/src/GuzzleStreamWrapper.php new file mode 100644 index 000000000..4d049a693 --- /dev/null +++ b/openml_OS/vendor/guzzlehttp/streams/src/GuzzleStreamWrapper.php @@ -0,0 +1,117 @@ +isReadable()) { + $mode = $stream->isWritable() ? 'r+' : 'r'; + } elseif ($stream->isWritable()) { + $mode = 'w'; + } else { + throw new \InvalidArgumentException('The stream must be readable, ' + . 'writable, or both.'); + } + + return fopen('guzzle://stream', $mode, null, stream_context_create([ + 'guzzle' => ['stream' => $stream] + ])); + } + + /** + * Registers the stream wrapper if needed + */ + public static function register() + { + if (!in_array('guzzle', stream_get_wrappers())) { + stream_wrapper_register('guzzle', __CLASS__); + } + } + + public function stream_open($path, $mode, $options, &$opened_path) + { + $options = stream_context_get_options($this->context); + + if (!isset($options['guzzle']['stream'])) { + return false; + } + + $this->mode = $mode; + $this->stream = $options['guzzle']['stream']; + + return true; + } + + public function stream_read($count) + { + return $this->stream->read($count); + } + + public function stream_write($data) + { + return (int) $this->stream->write($data); + } + + public function stream_tell() + { + return $this->stream->tell(); + } + + public function stream_eof() + { + return $this->stream->eof(); + } + + public function stream_seek($offset, $whence) + { + return $this->stream->seek($offset, $whence); + } + + public function stream_stat() + { + static $modeMap = [ + 'r' => 33060, + 'r+' => 33206, + 'w' => 33188 + ]; + + return [ + 'dev' => 0, + 'ino' => 0, + 'mode' => $modeMap[$this->mode], + 'nlink' => 0, + 'uid' => 0, + 'gid' => 0, + 'rdev' => 0, + 'size' => $this->stream->getSize() ?: 0, + 'atime' => 0, + 'mtime' => 0, + 'ctime' => 0, + 'blksize' => 0, + 'blocks' => 0 + ]; + } +} diff --git a/openml_OS/vendor/guzzlehttp/streams/src/InflateStream.php b/openml_OS/vendor/guzzlehttp/streams/src/InflateStream.php new file mode 100644 index 000000000..978af2103 --- /dev/null +++ b/openml_OS/vendor/guzzlehttp/streams/src/InflateStream.php @@ -0,0 +1,27 @@ +stream = new Stream($resource); + } +} diff --git a/openml_OS/vendor/guzzlehttp/streams/src/LazyOpenStream.php b/openml_OS/vendor/guzzlehttp/streams/src/LazyOpenStream.php new file mode 100644 index 000000000..6242ee7b5 --- /dev/null +++ b/openml_OS/vendor/guzzlehttp/streams/src/LazyOpenStream.php @@ -0,0 +1,37 @@ +filename = $filename; + $this->mode = $mode; + } + + /** + * Creates the underlying stream lazily when required. + * + * @return StreamInterface + */ + protected function createStream() + { + return Stream::factory(Utils::open($this->filename, $this->mode)); + } +} diff --git a/openml_OS/vendor/guzzlehttp/streams/src/LimitStream.php b/openml_OS/vendor/guzzlehttp/streams/src/LimitStream.php new file mode 100644 index 000000000..e9fad9857 --- /dev/null +++ b/openml_OS/vendor/guzzlehttp/streams/src/LimitStream.php @@ -0,0 +1,161 @@ +stream = $stream; + $this->setLimit($limit); + $this->setOffset($offset); + } + + public function eof() + { + // Always return true if the underlying stream is EOF + if ($this->stream->eof()) { + return true; + } + + // No limit and the underlying stream is not at EOF + if ($this->limit == -1) { + return false; + } + + $tell = $this->stream->tell(); + if ($tell === false) { + return false; + } + + return $tell >= $this->offset + $this->limit; + } + + /** + * Returns the size of the limited subset of data + * {@inheritdoc} + */ + public function getSize() + { + if (null === ($length = $this->stream->getSize())) { + return null; + } elseif ($this->limit == -1) { + return $length - $this->offset; + } else { + return min($this->limit, $length - $this->offset); + } + } + + /** + * Allow for a bounded seek on the read limited stream + * {@inheritdoc} + */ + public function seek($offset, $whence = SEEK_SET) + { + if ($whence !== SEEK_SET || $offset < 0) { + return false; + } + + $offset += $this->offset; + + if ($this->limit !== -1) { + if ($offset > $this->offset + $this->limit) { + $offset = $this->offset + $this->limit; + } + } + + return $this->stream->seek($offset); + } + + /** + * Give a relative tell() + * {@inheritdoc} + */ + public function tell() + { + return $this->stream->tell() - $this->offset; + } + + /** + * Set the offset to start limiting from + * + * @param int $offset Offset to seek to and begin byte limiting from + * + * @return self + * @throws SeekException + */ + public function setOffset($offset) + { + $current = $this->stream->tell(); + + if ($current !== $offset) { + // If the stream cannot seek to the offset position, then read to it + if (!$this->stream->seek($offset)) { + if ($current > $offset) { + throw new SeekException($this, $offset); + } else { + $this->stream->read($offset - $current); + } + } + } + + $this->offset = $offset; + + return $this; + } + + /** + * Set the limit of bytes that the decorator allows to be read from the + * stream. + * + * @param int $limit Number of bytes to allow to be read from the stream. + * Use -1 for no limit. + * @return self + */ + public function setLimit($limit) + { + $this->limit = $limit; + + return $this; + } + + public function read($length) + { + if ($this->limit == -1) { + return $this->stream->read($length); + } + + // Check if the current position is less than the total allowed + // bytes + original offset + $remaining = ($this->offset + $this->limit) - $this->stream->tell(); + if ($remaining > 0) { + // Only return the amount of requested data, ensuring that the byte + // limit is not exceeded + return $this->stream->read(min($remaining, $length)); + } else { + return false; + } + } +} diff --git a/openml_OS/vendor/guzzlehttp/streams/src/MetadataStreamInterface.php b/openml_OS/vendor/guzzlehttp/streams/src/MetadataStreamInterface.php new file mode 100644 index 000000000..c1433ad83 --- /dev/null +++ b/openml_OS/vendor/guzzlehttp/streams/src/MetadataStreamInterface.php @@ -0,0 +1,11 @@ +stream->attach($stream); + } +} diff --git a/openml_OS/vendor/guzzlehttp/streams/src/NullStream.php b/openml_OS/vendor/guzzlehttp/streams/src/NullStream.php new file mode 100644 index 000000000..41ee77668 --- /dev/null +++ b/openml_OS/vendor/guzzlehttp/streams/src/NullStream.php @@ -0,0 +1,78 @@ +source = $source; + $this->size = isset($options['size']) ? $options['size'] : null; + $this->metadata = isset($options['metadata']) ? $options['metadata'] : []; + $this->buffer = new BufferStream(); + } + + public function __toString() + { + return Utils::copyToString($this); + } + + public function close() + { + $this->detach(); + } + + public function detach() + { + $this->tellPos = false; + $this->source = null; + } + + public function attach($stream) + { + throw new CannotAttachException(); + } + + public function getSize() + { + return $this->size; + } + + public function tell() + { + return $this->tellPos; + } + + public function eof() + { + return !$this->source; + } + + public function isSeekable() + { + return false; + } + + public function seek($offset, $whence = SEEK_SET) + { + return false; + } + + public function isWritable() + { + return false; + } + + public function write($string) + { + return false; + } + + public function isReadable() + { + return true; + } + + public function read($length) + { + $data = $this->buffer->read($length); + $readLen = strlen($data); + $this->tellPos += $readLen; + $remaining = $length - $readLen; + + if ($remaining) { + $this->pump($remaining); + $data .= $this->buffer->read($remaining); + $this->tellPos += strlen($data) - $readLen; + } + + return $data; + } + + public function getContents() + { + $result = ''; + while (!$this->eof()) { + $result .= $this->read(1000000); + } + + return $result; + } + + public function getMetadata($key = null) + { + if (!$key) { + return $this->metadata; + } + + return isset($this->metadata[$key]) ? $this->metadata[$key] : null; + } + + private function pump($length) + { + if ($this->source) { + do { + $data = call_user_func($this->source, $length); + if ($data === false || $data === null) { + $this->source = null; + return; + } + $this->buffer->write($data); + $length -= strlen($data); + } while ($length > 0); + } + } +} diff --git a/openml_OS/vendor/guzzlehttp/streams/src/Stream.php b/openml_OS/vendor/guzzlehttp/streams/src/Stream.php new file mode 100644 index 000000000..7adbc5e3f --- /dev/null +++ b/openml_OS/vendor/guzzlehttp/streams/src/Stream.php @@ -0,0 +1,261 @@ + [ + 'r' => true, 'w+' => true, 'r+' => true, 'x+' => true, 'c+' => true, + 'rb' => true, 'w+b' => true, 'r+b' => true, 'x+b' => true, + 'c+b' => true, 'rt' => true, 'w+t' => true, 'r+t' => true, + 'x+t' => true, 'c+t' => true, 'a+' => true + ], + 'write' => [ + 'w' => true, 'w+' => true, 'rw' => true, 'r+' => true, 'x+' => true, + 'c+' => true, 'wb' => true, 'w+b' => true, 'r+b' => true, + 'x+b' => true, 'c+b' => true, 'w+t' => true, 'r+t' => true, + 'x+t' => true, 'c+t' => true, 'a' => true, 'a+' => true + ] + ]; + + /** + * Create a new stream based on the input type. + * + * This factory accepts the same associative array of options as described + * in the constructor. + * + * @param resource|string|StreamInterface $resource Entity body data + * @param array $options Additional options + * + * @return Stream + * @throws \InvalidArgumentException if the $resource arg is not valid. + */ + public static function factory($resource = '', array $options = []) + { + $type = gettype($resource); + + if ($type == 'string') { + $stream = fopen('php://temp', 'r+'); + if ($resource !== '') { + fwrite($stream, $resource); + fseek($stream, 0); + } + return new self($stream, $options); + } + + if ($type == 'resource') { + return new self($resource, $options); + } + + if ($resource instanceof StreamInterface) { + return $resource; + } + + if ($type == 'object' && method_exists($resource, '__toString')) { + return self::factory((string) $resource, $options); + } + + if (is_callable($resource)) { + return new PumpStream($resource, $options); + } + + if ($resource instanceof \Iterator) { + return new PumpStream(function () use ($resource) { + if (!$resource->valid()) { + return false; + } + $result = $resource->current(); + $resource->next(); + return $result; + }, $options); + } + + throw new \InvalidArgumentException('Invalid resource type: ' . $type); + } + + /** + * This constructor accepts an associative array of options. + * + * - size: (int) If a read stream would otherwise have an indeterminate + * size, but the size is known due to foreknownledge, then you can + * provide that size, in bytes. + * - metadata: (array) Any additional metadata to return when the metadata + * of the stream is accessed. + * + * @param resource $stream Stream resource to wrap. + * @param array $options Associative array of options. + * + * @throws \InvalidArgumentException if the stream is not a stream resource + */ + public function __construct($stream, $options = []) + { + if (!is_resource($stream)) { + throw new \InvalidArgumentException('Stream must be a resource'); + } + + if (isset($options['size'])) { + $this->size = $options['size']; + } + + $this->customMetadata = isset($options['metadata']) + ? $options['metadata'] + : []; + + $this->attach($stream); + } + + /** + * Closes the stream when the destructed + */ + public function __destruct() + { + $this->close(); + } + + public function __toString() + { + if (!$this->stream) { + return ''; + } + + $this->seek(0); + + return (string) stream_get_contents($this->stream); + } + + public function getContents() + { + return $this->stream ? stream_get_contents($this->stream) : ''; + } + + public function close() + { + if (is_resource($this->stream)) { + fclose($this->stream); + } + + $this->detach(); + } + + public function detach() + { + $result = $this->stream; + $this->stream = $this->size = $this->uri = null; + $this->readable = $this->writable = $this->seekable = false; + + return $result; + } + + public function attach($stream) + { + $this->stream = $stream; + $meta = stream_get_meta_data($this->stream); + $this->seekable = $meta['seekable']; + $this->readable = isset(self::$readWriteHash['read'][$meta['mode']]); + $this->writable = isset(self::$readWriteHash['write'][$meta['mode']]); + $this->uri = $this->getMetadata('uri'); + } + + public function getSize() + { + if ($this->size !== null) { + return $this->size; + } + + if (!$this->stream) { + return null; + } + + // Clear the stat cache if the stream has a URI + if ($this->uri) { + clearstatcache(true, $this->uri); + } + + $stats = fstat($this->stream); + if (isset($stats['size'])) { + $this->size = $stats['size']; + return $this->size; + } + + return null; + } + + public function isReadable() + { + return $this->readable; + } + + public function isWritable() + { + return $this->writable; + } + + public function isSeekable() + { + return $this->seekable; + } + + public function eof() + { + return !$this->stream || feof($this->stream); + } + + public function tell() + { + return $this->stream ? ftell($this->stream) : false; + } + + public function setSize($size) + { + $this->size = $size; + + return $this; + } + + public function seek($offset, $whence = SEEK_SET) + { + return $this->seekable + ? fseek($this->stream, $offset, $whence) === 0 + : false; + } + + public function read($length) + { + return $this->readable ? fread($this->stream, $length) : false; + } + + public function write($string) + { + // We can't know the size after writing anything + $this->size = null; + + return $this->writable ? fwrite($this->stream, $string) : false; + } + + public function getMetadata($key = null) + { + if (!$this->stream) { + return $key ? null : []; + } elseif (!$key) { + return $this->customMetadata + stream_get_meta_data($this->stream); + } elseif (isset($this->customMetadata[$key])) { + return $this->customMetadata[$key]; + } + + $meta = stream_get_meta_data($this->stream); + + return isset($meta[$key]) ? $meta[$key] : null; + } +} diff --git a/openml_OS/vendor/guzzlehttp/streams/src/StreamDecoratorTrait.php b/openml_OS/vendor/guzzlehttp/streams/src/StreamDecoratorTrait.php new file mode 100644 index 000000000..39c19c58c --- /dev/null +++ b/openml_OS/vendor/guzzlehttp/streams/src/StreamDecoratorTrait.php @@ -0,0 +1,143 @@ +stream = $stream; + } + + /** + * Magic method used to create a new stream if streams are not added in + * the constructor of a decorator (e.g., LazyOpenStream). + */ + public function __get($name) + { + if ($name == 'stream') { + $this->stream = $this->createStream(); + return $this->stream; + } + + throw new \UnexpectedValueException("$name not found on class"); + } + + public function __toString() + { + try { + $this->seek(0); + return $this->getContents(); + } catch (\Exception $e) { + // Really, PHP? https://bugs.php.net/bug.php?id=53648 + trigger_error('StreamDecorator::__toString exception: ' + . (string) $e, E_USER_ERROR); + return ''; + } + } + + public function getContents() + { + return Utils::copyToString($this); + } + + /** + * Allow decorators to implement custom methods + * + * @param string $method Missing method name + * @param array $args Method arguments + * + * @return mixed + */ + public function __call($method, array $args) + { + $result = call_user_func_array(array($this->stream, $method), $args); + + // Always return the wrapped object if the result is a return $this + return $result === $this->stream ? $this : $result; + } + + public function close() + { + $this->stream->close(); + } + + public function getMetadata($key = null) + { + return $this->stream->getMetadata($key); + } + + public function detach() + { + return $this->stream->detach(); + } + + public function attach($stream) + { + throw new CannotAttachException(); + } + + public function getSize() + { + return $this->stream->getSize(); + } + + public function eof() + { + return $this->stream->eof(); + } + + public function tell() + { + return $this->stream->tell(); + } + + public function isReadable() + { + return $this->stream->isReadable(); + } + + public function isWritable() + { + return $this->stream->isWritable(); + } + + public function isSeekable() + { + return $this->stream->isSeekable(); + } + + public function seek($offset, $whence = SEEK_SET) + { + return $this->stream->seek($offset, $whence); + } + + public function read($length) + { + return $this->stream->read($length); + } + + public function write($string) + { + return $this->stream->write($string); + } + + /** + * Implement in subclasses to dynamically create streams when requested. + * + * @return StreamInterface + * @throws \BadMethodCallException + */ + protected function createStream() + { + throw new \BadMethodCallException('createStream() not implemented in ' + . get_class($this)); + } +} diff --git a/openml_OS/vendor/guzzlehttp/streams/src/StreamInterface.php b/openml_OS/vendor/guzzlehttp/streams/src/StreamInterface.php new file mode 100644 index 000000000..fd19c6f25 --- /dev/null +++ b/openml_OS/vendor/guzzlehttp/streams/src/StreamInterface.php @@ -0,0 +1,159 @@ +eof()) { + $buf = $stream->read(1048576); + if ($buf === false) { + break; + } + $buffer .= $buf; + } + return $buffer; + } + + $len = 0; + while (!$stream->eof() && $len < $maxLen) { + $buf = $stream->read($maxLen - $len); + if ($buf === false) { + break; + } + $buffer .= $buf; + $len = strlen($buffer); + } + + return $buffer; + } + + /** + * Copy the contents of a stream into another stream until the given number + * of bytes have been read. + * + * @param StreamInterface $source Stream to read from + * @param StreamInterface $dest Stream to write to + * @param int $maxLen Maximum number of bytes to read. Pass -1 + * to read the entire stream. + */ + public static function copyToStream( + StreamInterface $source, + StreamInterface $dest, + $maxLen = -1 + ) { + if ($maxLen === -1) { + while (!$source->eof()) { + if (!$dest->write($source->read(1048576))) { + break; + } + } + return; + } + + $bytes = 0; + while (!$source->eof()) { + $buf = $source->read($maxLen - $bytes); + if (!($len = strlen($buf))) { + break; + } + $bytes += $len; + $dest->write($buf); + if ($bytes == $maxLen) { + break; + } + } + } + + /** + * Calculate a hash of a Stream + * + * @param StreamInterface $stream Stream to calculate the hash for + * @param string $algo Hash algorithm (e.g. md5, crc32, etc) + * @param bool $rawOutput Whether or not to use raw output + * + * @return string Returns the hash of the stream + * @throws SeekException + */ + public static function hash( + StreamInterface $stream, + $algo, + $rawOutput = false + ) { + $pos = $stream->tell(); + + if ($pos > 0 && !$stream->seek(0)) { + throw new SeekException($stream); + } + + $ctx = hash_init($algo); + while (!$stream->eof()) { + hash_update($ctx, $stream->read(1048576)); + } + + $out = hash_final($ctx, (bool) $rawOutput); + $stream->seek($pos); + + return $out; + } + + /** + * Read a line from the stream up to the maximum allowed buffer length + * + * @param StreamInterface $stream Stream to read from + * @param int $maxLength Maximum buffer length + * + * @return string|bool + */ + public static function readline(StreamInterface $stream, $maxLength = null) + { + $buffer = ''; + $size = 0; + + while (!$stream->eof()) { + if (false === ($byte = $stream->read(1))) { + return $buffer; + } + $buffer .= $byte; + // Break when a new line is found or the max length - 1 is reached + if ($byte == PHP_EOL || ++$size == $maxLength - 1) { + break; + } + } + + return $buffer; + } + + /** + * Alias of GuzzleHttp\Stream\Stream::factory. + * + * @param mixed $resource Resource to create + * @param array $options Associative array of stream options defined in + * {@see \GuzzleHttp\Stream\Stream::__construct} + * + * @return StreamInterface + * + * @see GuzzleHttp\Stream\Stream::factory + * @see GuzzleHttp\Stream\Stream::__construct + */ + public static function create($resource, array $options = []) + { + return Stream::factory($resource, $options); + } +} diff --git a/openml_OS/vendor/guzzlehttp/streams/tests/AppendStreamTest.php b/openml_OS/vendor/guzzlehttp/streams/tests/AppendStreamTest.php new file mode 100644 index 000000000..78798d9f7 --- /dev/null +++ b/openml_OS/vendor/guzzlehttp/streams/tests/AppendStreamTest.php @@ -0,0 +1,178 @@ +getMockBuilder('GuzzleHttp\Stream\StreamInterface') + ->setMethods(['isReadable']) + ->getMockForAbstractClass(); + $s->expects($this->once()) + ->method('isReadable') + ->will($this->returnValue(false)); + $a->addStream($s); + } + + public function testValidatesSeekType() + { + $a = new AppendStream(); + $this->assertFalse($a->seek(100, SEEK_CUR)); + } + + public function testTriesToRewindOnSeek() + { + $a = new AppendStream(); + $s = $this->getMockBuilder('GuzzleHttp\Stream\StreamInterface') + ->setMethods(['isReadable', 'seek', 'isSeekable']) + ->getMockForAbstractClass(); + $s->expects($this->once()) + ->method('isReadable') + ->will($this->returnValue(true)); + $s->expects($this->once()) + ->method('isSeekable') + ->will($this->returnValue(true)); + $s->expects($this->once()) + ->method('seek') + ->will($this->returnValue(false)); + $a->addStream($s); + $this->assertFalse($a->seek(10)); + } + + public function testSeeksToPositionByReading() + { + $a = new AppendStream([ + Stream::factory('foo'), + Stream::factory('bar'), + Stream::factory('baz'), + ]); + + $this->assertTrue($a->seek(3)); + $this->assertEquals(3, $a->tell()); + $this->assertEquals('bar', $a->read(3)); + $a->seek(6); + $this->assertEquals(6, $a->tell()); + $this->assertEquals('baz', $a->read(3)); + } + + public function testDetachesEachStream() + { + $s1 = Stream::factory('foo'); + $s2 = Stream::factory('foo'); + $a = new AppendStream([$s1, $s2]); + $this->assertSame('foofoo', (string) $a); + $a->detach(); + $this->assertSame('', (string) $a); + $this->assertSame(0, $a->getSize()); + } + + public function testClosesEachStream() + { + $s1 = Stream::factory('foo'); + $a = new AppendStream([$s1]); + $a->close(); + $this->assertSame('', (string) $a); + } + + public function testIsNotWritable() + { + $a = new AppendStream([Stream::factory('foo')]); + $this->assertFalse($a->isWritable()); + $this->assertTrue($a->isSeekable()); + $this->assertTrue($a->isReadable()); + $this->assertFalse($a->write('foo')); + } + + public function testDoesNotNeedStreams() + { + $a = new AppendStream(); + $this->assertEquals('', (string) $a); + } + + public function testCanReadFromMultipleStreams() + { + $a = new AppendStream([ + Stream::factory('foo'), + Stream::factory('bar'), + Stream::factory('baz'), + ]); + $this->assertFalse($a->eof()); + $this->assertSame(0, $a->tell()); + $this->assertEquals('foo', $a->read(3)); + $this->assertEquals('bar', $a->read(3)); + $this->assertEquals('baz', $a->read(3)); + $this->assertTrue($a->eof()); + $this->assertSame(9, $a->tell()); + $this->assertEquals('foobarbaz', (string) $a); + } + + public function testCanDetermineSizeFromMultipleStreams() + { + $a = new AppendStream([ + Stream::factory('foo'), + Stream::factory('bar') + ]); + $this->assertEquals(6, $a->getSize()); + + $s = $this->getMockBuilder('GuzzleHttp\Stream\StreamInterface') + ->setMethods(['isSeekable', 'isReadable']) + ->getMockForAbstractClass(); + $s->expects($this->once()) + ->method('isSeekable') + ->will($this->returnValue(null)); + $s->expects($this->once()) + ->method('isReadable') + ->will($this->returnValue(true)); + $a->addStream($s); + $this->assertNull($a->getSize()); + } + + public function testCatchesExceptionsWhenCastingToString() + { + $s = $this->getMockBuilder('GuzzleHttp\Stream\StreamInterface') + ->setMethods(['read', 'isReadable', 'eof']) + ->getMockForAbstractClass(); + $s->expects($this->once()) + ->method('read') + ->will($this->throwException(new \RuntimeException('foo'))); + $s->expects($this->once()) + ->method('isReadable') + ->will($this->returnValue(true)); + $s->expects($this->any()) + ->method('eof') + ->will($this->returnValue(false)); + $a = new AppendStream([$s]); + $this->assertFalse($a->eof()); + $this->assertSame('', (string) $a); + } + + public function testCanDetach() + { + $s = new AppendStream(); + $s->detach(); + } + + public function testReturnsEmptyMetadata() + { + $s = new AppendStream(); + $this->assertEquals([], $s->getMetadata()); + $this->assertNull($s->getMetadata('foo')); + } + + /** + * @expectedException \GuzzleHttp\Stream\Exception\CannotAttachException + */ + public function testCannotAttach() + { + $p = new AppendStream(); + $p->attach('a'); + } +} diff --git a/openml_OS/vendor/guzzlehttp/streams/tests/AsyncReadStreamTest.php b/openml_OS/vendor/guzzlehttp/streams/tests/AsyncReadStreamTest.php new file mode 100644 index 000000000..8c7899596 --- /dev/null +++ b/openml_OS/vendor/guzzlehttp/streams/tests/AsyncReadStreamTest.php @@ -0,0 +1,186 @@ + function () { return false; }] + )); + } + + /** + * @expectedException \InvalidArgumentException + * @expectedExceptionMessage Buffer must be readable and writable + */ + public function testValidatesWritableBuffer() + { + new AsyncReadStream(FnStream::decorate( + Stream::factory(), + ['isWritable' => function () { return false; }] + )); + } + + public function testValidatesHwmMetadata() + { + $a = new AsyncReadStream(Stream::factory(), [ + 'drain' => function() {} + ]); + $this->assertNull($this->readAttribute($a, 'drain')); + } + + /** + * @expectedException \InvalidArgumentException + * @expectedExceptionMessage pump must be callable + */ + public function testValidatesPumpIsCallable() + { + new AsyncReadStream(new BufferStream(), ['pump' => true]); + } + + /** + * @expectedException \InvalidArgumentException + * @expectedExceptionMessage drain must be callable + */ + public function testValidatesDrainIsCallable() + { + new AsyncReadStream(new BufferStream(), ['drain' => true]); + } + + public function testCanInitialize() + { + $buffer = new BufferStream(); + $a = new AsyncReadStream($buffer, [ + 'size' => 10, + 'drain' => function () {}, + 'pump' => function () {}, + ]); + $this->assertSame($buffer, $this->readAttribute($a, 'stream')); + $this->assertTrue(is_callable($this->readAttribute($a, 'drain'))); + $this->assertTrue(is_callable($this->readAttribute($a, 'pump'))); + $this->assertTrue($a->isReadable()); + $this->assertFalse($a->isSeekable()); + $this->assertFalse($a->isWritable()); + $this->assertFalse($a->write('foo')); + $this->assertEquals(10, $a->getSize()); + } + + public function testReadsFromBufferWithNoDrainOrPump() + { + $buffer = new BufferStream(); + $a = new AsyncReadStream($buffer); + $buffer->write('foo'); + $this->assertNull($a->getSize()); + $this->assertEquals('foo', $a->read(10)); + $this->assertEquals('', $a->read(10)); + } + + public function testCallsPumpForMoreDataWhenRequested() + { + $called = 0; + $buffer = new BufferStream(); + $a = new AsyncReadStream($buffer, [ + 'pump' => function ($size) use (&$called) { + $called++; + return str_repeat('.', $size); + } + ]); + $buffer->write('foobar'); + $this->assertEquals('foo', $a->read(3)); + $this->assertEquals(0, $called); + $this->assertEquals('bar.....', $a->read(8)); + $this->assertEquals(1, $called); + $this->assertEquals('..', $a->read(2)); + $this->assertEquals(2, $called); + } + + public function testCallsDrainWhenNeeded() + { + $called = 0; + $buffer = new BufferStream(5); + $a = new AsyncReadStream($buffer, [ + 'drain' => function (BufferStream $b) use (&$called, $buffer) { + $this->assertSame($b, $buffer); + $called++; + } + ]); + + $buffer->write('foobar'); + $this->assertEquals(6, $buffer->getSize()); + $this->assertEquals(0, $called); + + $a->read(3); + $this->assertTrue($this->readAttribute($a, 'needsDrain')); + $this->assertEquals(3, $buffer->getSize()); + $this->assertEquals(0, $called); + + $a->read(3); + $this->assertEquals(0, $buffer->getSize()); + $this->assertFalse($this->readAttribute($a, 'needsDrain')); + $this->assertEquals(1, $called); + } + + public function testCreatesBufferWithNoConfig() + { + list($buffer, $async) = AsyncReadStream::create(); + $this->assertInstanceOf('GuzzleHttp\Stream\BufferStream', $buffer); + $this->assertInstanceOf('GuzzleHttp\Stream\AsyncReadStream', $async); + } + + public function testCreatesBufferWithSpecifiedBuffer() + { + $buf = new BufferStream(); + list($buffer, $async) = AsyncReadStream::create(['buffer' => $buf]); + $this->assertSame($buf, $buffer); + $this->assertInstanceOf('GuzzleHttp\Stream\AsyncReadStream', $async); + } + + public function testCreatesNullStream() + { + list($buffer, $async) = AsyncReadStream::create(['max_buffer' => 0]); + $this->assertInstanceOf('GuzzleHttp\Stream\NullStream', $buffer); + $this->assertInstanceOf('GuzzleHttp\Stream\AsyncReadStream', $async); + } + + public function testCreatesDroppingStream() + { + list($buffer, $async) = AsyncReadStream::create(['max_buffer' => 5]); + $this->assertInstanceOf('GuzzleHttp\Stream\DroppingStream', $buffer); + $this->assertInstanceOf('GuzzleHttp\Stream\AsyncReadStream', $async); + $buffer->write('12345678910'); + $this->assertEquals(5, $buffer->getSize()); + } + + public function testCreatesOnWriteStream() + { + $c = 0; + $b = new BufferStream(); + list($buffer, $async) = AsyncReadStream::create([ + 'buffer' => $b, + 'write' => function (BufferStream $buf, $data) use (&$c, $b) { + $this->assertSame($buf, $b); + $this->assertEquals('foo', $data); + $c++; + } + ]); + $this->assertInstanceOf('GuzzleHttp\Stream\FnStream', $buffer); + $this->assertInstanceOf('GuzzleHttp\Stream\AsyncReadStream', $async); + $this->assertEquals(0, $c); + $this->assertEquals(3, $buffer->write('foo')); + $this->assertEquals(1, $c); + $this->assertEquals(3, $buffer->write('foo')); + $this->assertEquals(2, $c); + $this->assertEquals('foofoo', (string) $buffer); + } +} diff --git a/openml_OS/vendor/guzzlehttp/streams/tests/BufferStreamTest.php b/openml_OS/vendor/guzzlehttp/streams/tests/BufferStreamTest.php new file mode 100644 index 000000000..f9bfea21d --- /dev/null +++ b/openml_OS/vendor/guzzlehttp/streams/tests/BufferStreamTest.php @@ -0,0 +1,69 @@ +assertTrue($b->isReadable()); + $this->assertTrue($b->isWritable()); + $this->assertFalse($b->isSeekable()); + $this->assertEquals(null, $b->getMetadata('foo')); + $this->assertEquals(10, $b->getMetadata('hwm')); + $this->assertEquals([], $b->getMetadata()); + } + + public function testRemovesReadDataFromBuffer() + { + $b = new BufferStream(); + $this->assertEquals(3, $b->write('foo')); + $this->assertEquals(3, $b->getSize()); + $this->assertFalse($b->eof()); + $this->assertEquals('foo', $b->read(10)); + $this->assertTrue($b->eof()); + $this->assertEquals('', $b->read(10)); + } + + public function testCanCastToStringOrGetContents() + { + $b = new BufferStream(); + $b->write('foo'); + $b->write('baz'); + $this->assertEquals('foo', $b->read(3)); + $b->write('bar'); + $this->assertEquals('bazbar', (string) $b); + $this->assertFalse($b->tell()); + } + + public function testDetachClearsBuffer() + { + $b = new BufferStream(); + $b->write('foo'); + $b->detach(); + $this->assertEquals(0, $b->tell()); + $this->assertTrue($b->eof()); + $this->assertEquals(3, $b->write('abc')); + $this->assertEquals('abc', $b->read(10)); + } + + public function testExceedingHighwaterMarkReturnsFalseButStillBuffers() + { + $b = new BufferStream(5); + $this->assertEquals(3, $b->write('hi ')); + $this->assertFalse($b->write('hello')); + $this->assertEquals('hi hello', (string) $b); + $this->assertEquals(4, $b->write('test')); + } + + /** + * @expectedException \GuzzleHttp\Stream\Exception\CannotAttachException + */ + public function testCannotAttach() + { + $p = new BufferStream(); + $p->attach('a'); + } +} diff --git a/openml_OS/vendor/guzzlehttp/streams/tests/CachingStreamTest.php b/openml_OS/vendor/guzzlehttp/streams/tests/CachingStreamTest.php new file mode 100644 index 000000000..ea969b3ad --- /dev/null +++ b/openml_OS/vendor/guzzlehttp/streams/tests/CachingStreamTest.php @@ -0,0 +1,136 @@ +decorated = Stream::factory('testing'); + $this->body = new CachingStream($this->decorated); + } + + public function tearDown() + { + $this->decorated->close(); + $this->body->close(); + } + + public function testUsesRemoteSizeIfPossible() + { + $body = Stream::factory('test'); + $caching = new CachingStream($body); + $this->assertEquals(4, $caching->getSize()); + } + + /** + * @expectedException \RuntimeException + * @expectedExceptionMessage Cannot seek to byte 10 + */ + public function testCannotSeekPastWhatHasBeenRead() + { + $this->body->seek(10); + } + + public function testCannotUseSeekEnd() + { + $this->assertFalse($this->body->seek(2, SEEK_END)); + } + + public function testRewindUsesSeek() + { + $a = Stream::factory('foo'); + $d = $this->getMockBuilder('GuzzleHttp\Stream\CachingStream') + ->setMethods(array('seek')) + ->setConstructorArgs(array($a)) + ->getMock(); + $d->expects($this->once()) + ->method('seek') + ->with(0) + ->will($this->returnValue(true)); + $d->seek(0); + } + + public function testCanSeekToReadBytes() + { + $this->assertEquals('te', $this->body->read(2)); + $this->body->seek(0); + $this->assertEquals('test', $this->body->read(4)); + $this->assertEquals(4, $this->body->tell()); + $this->body->seek(2); + $this->assertEquals(2, $this->body->tell()); + $this->body->seek(2, SEEK_CUR); + $this->assertEquals(4, $this->body->tell()); + $this->assertEquals('ing', $this->body->read(3)); + } + + public function testWritesToBufferStream() + { + $this->body->read(2); + $this->body->write('hi'); + $this->body->seek(0); + $this->assertEquals('tehiing', (string) $this->body); + } + + public function testSkipsOverwrittenBytes() + { + $decorated = Stream::factory( + implode("\n", array_map(function ($n) { + return str_pad($n, 4, '0', STR_PAD_LEFT); + }, range(0, 25))) + ); + + $body = new CachingStream($decorated); + + $this->assertEquals("0000\n", Utils::readline($body)); + $this->assertEquals("0001\n", Utils::readline($body)); + // Write over part of the body yet to be read, so skip some bytes + $this->assertEquals(5, $body->write("TEST\n")); + $this->assertEquals(5, $this->readAttribute($body, 'skipReadBytes')); + // Read, which skips bytes, then reads + $this->assertEquals("0003\n", Utils::readline($body)); + $this->assertEquals(0, $this->readAttribute($body, 'skipReadBytes')); + $this->assertEquals("0004\n", Utils::readline($body)); + $this->assertEquals("0005\n", Utils::readline($body)); + + // Overwrite part of the cached body (so don't skip any bytes) + $body->seek(5); + $this->assertEquals(5, $body->write("ABCD\n")); + $this->assertEquals(0, $this->readAttribute($body, 'skipReadBytes')); + $this->assertEquals("TEST\n", Utils::readline($body)); + $this->assertEquals("0003\n", Utils::readline($body)); + $this->assertEquals("0004\n", Utils::readline($body)); + $this->assertEquals("0005\n", Utils::readline($body)); + $this->assertEquals("0006\n", Utils::readline($body)); + $this->assertEquals(5, $body->write("1234\n")); + $this->assertEquals(5, $this->readAttribute($body, 'skipReadBytes')); + + // Seek to 0 and ensure the overwritten bit is replaced + $body->seek(0); + $this->assertEquals("0000\nABCD\nTEST\n0003\n0004\n0005\n0006\n1234\n0008\n0009\n", $body->read(50)); + + // Ensure that casting it to a string does not include the bit that was overwritten + $this->assertContains("0000\nABCD\nTEST\n0003\n0004\n0005\n0006\n1234\n0008\n0009\n", (string) $body); + } + + public function testClosesBothStreams() + { + $s = fopen('php://temp', 'r'); + $a = Stream::factory($s); + $d = new CachingStream($a); + $d->close(); + $this->assertFalse(is_resource($s)); + } +} diff --git a/openml_OS/vendor/guzzlehttp/streams/tests/DroppingStreamTest.php b/openml_OS/vendor/guzzlehttp/streams/tests/DroppingStreamTest.php new file mode 100644 index 000000000..bb2cb2204 --- /dev/null +++ b/openml_OS/vendor/guzzlehttp/streams/tests/DroppingStreamTest.php @@ -0,0 +1,26 @@ +assertEquals(3, $drop->write('hel')); + $this->assertFalse($drop->write('lo')); + $this->assertEquals(5, $drop->getSize()); + $this->assertEquals('hello', $drop->read(5)); + $this->assertEquals(0, $drop->getSize()); + $drop->write('12345678910'); + $this->assertEquals(5, $stream->getSize()); + $this->assertEquals(5, $drop->getSize()); + $this->assertEquals('12345', (string) $drop); + $this->assertEquals(0, $drop->getSize()); + $drop->write('hello'); + $this->assertFalse($drop->write('test')); + } +} diff --git a/openml_OS/vendor/guzzlehttp/streams/tests/Exception/SeekExceptionTest.php b/openml_OS/vendor/guzzlehttp/streams/tests/Exception/SeekExceptionTest.php new file mode 100644 index 000000000..fd8cd1ad2 --- /dev/null +++ b/openml_OS/vendor/guzzlehttp/streams/tests/Exception/SeekExceptionTest.php @@ -0,0 +1,16 @@ +assertSame($s, $e->getStream()); + $this->assertContains('10', $e->getMessage()); + } +} diff --git a/openml_OS/vendor/guzzlehttp/streams/tests/FnStreamTest.php b/openml_OS/vendor/guzzlehttp/streams/tests/FnStreamTest.php new file mode 100644 index 000000000..6cc336b91 --- /dev/null +++ b/openml_OS/vendor/guzzlehttp/streams/tests/FnStreamTest.php @@ -0,0 +1,89 @@ +seek(1); + } + + public function testProxiesToFunction() + { + $s = new FnStream([ + 'read' => function ($len) { + $this->assertEquals(3, $len); + return 'foo'; + } + ]); + + $this->assertEquals('foo', $s->read(3)); + } + + public function testCanCloseOnDestruct() + { + $called = false; + $s = new FnStream([ + 'close' => function () use (&$called) { + $called = true; + } + ]); + unset($s); + $this->assertTrue($called); + } + + public function testDoesNotRequireClose() + { + $s = new FnStream([]); + unset($s); + } + + public function testDecoratesStream() + { + $a = Stream::factory('foo'); + $b = FnStream::decorate($a, []); + $this->assertEquals(3, $b->getSize()); + $this->assertEquals($b->isWritable(), true); + $this->assertEquals($b->isReadable(), true); + $this->assertEquals($b->isSeekable(), true); + $this->assertEquals($b->read(3), 'foo'); + $this->assertEquals($b->tell(), 3); + $this->assertEquals($a->tell(), 3); + $this->assertEquals($b->eof(), true); + $this->assertEquals($a->eof(), true); + $b->seek(0); + $this->assertEquals('foo', (string) $b); + $b->seek(0); + $this->assertEquals('foo', $b->getContents()); + $this->assertEquals($a->getMetadata(), $b->getMetadata()); + $b->seek(0, SEEK_END); + $b->write('bar'); + $this->assertEquals('foobar', (string) $b); + $this->assertInternalType('resource', $b->detach()); + $b->close(); + } + + public function testDecoratesWithCustomizations() + { + $called = false; + $a = Stream::factory('foo'); + $b = FnStream::decorate($a, [ + 'read' => function ($len) use (&$called, $a) { + $called = true; + return $a->read($len); + } + ]); + $this->assertEquals('foo', $b->read(3)); + $this->assertTrue($called); + } +} diff --git a/openml_OS/vendor/guzzlehttp/streams/tests/GuzzleStreamWrapperTest.php b/openml_OS/vendor/guzzlehttp/streams/tests/GuzzleStreamWrapperTest.php new file mode 100644 index 000000000..33c3eccb4 --- /dev/null +++ b/openml_OS/vendor/guzzlehttp/streams/tests/GuzzleStreamWrapperTest.php @@ -0,0 +1,99 @@ +assertSame('foo', fread($handle, 3)); + $this->assertSame(3, ftell($handle)); + $this->assertSame(3, fwrite($handle, 'bar')); + $this->assertSame(0, fseek($handle, 0)); + $this->assertSame('foobar', fread($handle, 6)); + $this->assertTrue(feof($handle)); + + // This fails on HHVM for some reason + if (!defined('HHVM_VERSION')) { + $this->assertEquals([ + 'dev' => 0, + 'ino' => 0, + 'mode' => 33206, + 'nlink' => 0, + 'uid' => 0, + 'gid' => 0, + 'rdev' => 0, + 'size' => 6, + 'atime' => 0, + 'mtime' => 0, + 'ctime' => 0, + 'blksize' => 0, + 'blocks' => 0, + 0 => 0, + 1 => 0, + 2 => 33206, + 3 => 0, + 4 => 0, + 5 => 0, + 6 => 0, + 7 => 6, + 8 => 0, + 9 => 0, + 10 => 0, + 11 => 0, + 12 => 0, + ], fstat($handle)); + } + + $this->assertTrue(fclose($handle)); + $this->assertSame('foobar', (string) $stream); + } + + /** + * @expectedException \InvalidArgumentException + */ + public function testValidatesStream() + { + $stream = $this->getMockBuilder('GuzzleHttp\Stream\StreamInterface') + ->setMethods(['isReadable', 'isWritable']) + ->getMockForAbstractClass(); + $stream->expects($this->once()) + ->method('isReadable') + ->will($this->returnValue(false)); + $stream->expects($this->once()) + ->method('isWritable') + ->will($this->returnValue(false)); + GuzzleStreamWrapper::getResource($stream); + } + + /** + * @expectedException \PHPUnit_Framework_Error_Warning + */ + public function testReturnsFalseWhenStreamDoesNotExist() + { + fopen('guzzle://foo', 'r'); + } + + public function testCanOpenReadonlyStream() + { + $stream = $this->getMockBuilder('GuzzleHttp\Stream\StreamInterface') + ->setMethods(['isReadable', 'isWritable']) + ->getMockForAbstractClass(); + $stream->expects($this->once()) + ->method('isReadable') + ->will($this->returnValue(false)); + $stream->expects($this->once()) + ->method('isWritable') + ->will($this->returnValue(true)); + $r = GuzzleStreamWrapper::getResource($stream); + $this->assertInternalType('resource', $r); + fclose($r); + } +} diff --git a/openml_OS/vendor/guzzlehttp/streams/tests/InflateStreamTest.php b/openml_OS/vendor/guzzlehttp/streams/tests/InflateStreamTest.php new file mode 100644 index 000000000..ead9356a5 --- /dev/null +++ b/openml_OS/vendor/guzzlehttp/streams/tests/InflateStreamTest.php @@ -0,0 +1,16 @@ +assertEquals('test', (string) $b); + } +} diff --git a/openml_OS/vendor/guzzlehttp/streams/tests/LazyOpenStreamTest.php b/openml_OS/vendor/guzzlehttp/streams/tests/LazyOpenStreamTest.php new file mode 100644 index 000000000..79e0078e8 --- /dev/null +++ b/openml_OS/vendor/guzzlehttp/streams/tests/LazyOpenStreamTest.php @@ -0,0 +1,64 @@ +fname = tempnam('/tmp', 'tfile'); + + if (file_exists($this->fname)) { + unlink($this->fname); + } + } + + public function tearDown() + { + if (file_exists($this->fname)) { + unlink($this->fname); + } + } + + public function testOpensLazily() + { + $l = new LazyOpenStream($this->fname, 'w+'); + $l->write('foo'); + $this->assertInternalType('array', $l->getMetadata()); + $this->assertFileExists($this->fname); + $this->assertEquals('foo', file_get_contents($this->fname)); + $this->assertEquals('foo', (string) $l); + } + + public function testProxiesToFile() + { + file_put_contents($this->fname, 'foo'); + $l = new LazyOpenStream($this->fname, 'r'); + $this->assertEquals('foo', $l->read(4)); + $this->assertTrue($l->eof()); + $this->assertEquals(3, $l->tell()); + $this->assertTrue($l->isReadable()); + $this->assertTrue($l->isSeekable()); + $this->assertFalse($l->isWritable()); + $l->seek(1); + $this->assertEquals('oo', $l->getContents()); + $this->assertEquals('foo', (string) $l); + $this->assertEquals(3, $l->getSize()); + $this->assertInternalType('array', $l->getMetadata()); + $l->close(); + } + + public function testDetachesUnderlyingStream() + { + file_put_contents($this->fname, 'foo'); + $l = new LazyOpenStream($this->fname, 'r'); + $r = $l->detach(); + $this->assertInternalType('resource', $r); + fseek($r, 0); + $this->assertEquals('foo', stream_get_contents($r)); + fclose($r); + } +} diff --git a/openml_OS/vendor/guzzlehttp/streams/tests/LimitStreamTest.php b/openml_OS/vendor/guzzlehttp/streams/tests/LimitStreamTest.php new file mode 100644 index 000000000..efb1dc58f --- /dev/null +++ b/openml_OS/vendor/guzzlehttp/streams/tests/LimitStreamTest.php @@ -0,0 +1,133 @@ +decorated = Stream::factory(fopen(__FILE__, 'r')); + $this->body = new LimitStream($this->decorated, 10, 3); + } + + public function testReturnsSubset() + { + $body = new LimitStream(Stream::factory('foo'), -1, 1); + $this->assertEquals('oo', (string) $body); + $this->assertTrue($body->eof()); + $body->seek(0); + $this->assertFalse($body->eof()); + $this->assertEquals('oo', $body->read(100)); + $this->assertTrue($body->eof()); + } + + public function testReturnsSubsetWhenCastToString() + { + $body = Stream::factory('foo_baz_bar'); + $limited = new LimitStream($body, 3, 4); + $this->assertEquals('baz', (string) $limited); + } + + public function testReturnsSubsetOfEmptyBodyWhenCastToString() + { + $body = Stream::factory(''); + $limited = new LimitStream($body, 0, 10); + $this->assertEquals('', (string) $limited); + } + + public function testSeeksWhenConstructed() + { + $this->assertEquals(0, $this->body->tell()); + $this->assertEquals(3, $this->decorated->tell()); + } + + public function testAllowsBoundedSeek() + { + $this->assertEquals(true, $this->body->seek(100)); + $this->assertEquals(10, $this->body->tell()); + $this->assertEquals(13, $this->decorated->tell()); + $this->assertEquals(true, $this->body->seek(0)); + $this->assertEquals(0, $this->body->tell()); + $this->assertEquals(3, $this->decorated->tell()); + $this->assertEquals(false, $this->body->seek(-10)); + $this->assertEquals(0, $this->body->tell()); + $this->assertEquals(3, $this->decorated->tell()); + $this->assertEquals(true, $this->body->seek(5)); + $this->assertEquals(5, $this->body->tell()); + $this->assertEquals(8, $this->decorated->tell()); + $this->assertEquals(false, $this->body->seek(1000, SEEK_END)); + } + + public function testReadsOnlySubsetOfData() + { + $data = $this->body->read(100); + $this->assertEquals(10, strlen($data)); + $this->assertFalse($this->body->read(1000)); + + $this->body->setOffset(10); + $newData = $this->body->read(100); + $this->assertEquals(10, strlen($newData)); + $this->assertNotSame($data, $newData); + } + + /** + * @expectedException \GuzzleHttp\Stream\Exception\SeekException + * @expectedExceptionMessage Could not seek the stream to position 2 + */ + public function testThrowsWhenCurrentGreaterThanOffsetSeek() + { + $a = Stream::factory('foo_bar'); + $b = new NoSeekStream($a); + $c = new LimitStream($b); + $a->getContents(); + $c->setOffset(2); + } + + public function testClaimsConsumedWhenReadLimitIsReached() + { + $this->assertFalse($this->body->eof()); + $this->body->read(1000); + $this->assertTrue($this->body->eof()); + } + + public function testContentLengthIsBounded() + { + $this->assertEquals(10, $this->body->getSize()); + } + + public function testGetContentsIsBasedOnSubset() + { + $body = new LimitStream(Stream::factory('foobazbar'), 3, 3); + $this->assertEquals('baz', $body->getContents()); + } + + public function testReturnsNullIfSizeCannotBeDetermined() + { + $a = new FnStream([ + 'getSize' => function () { return null; }, + 'tell' => function () { return 0; }, + ]); + $b = new LimitStream($a); + $this->assertNull($b->getSize()); + } + + public function testLengthLessOffsetWhenNoLimitSize() + { + $a = Stream::factory('foo_bar'); + $b = new LimitStream($a, -1, 4); + $this->assertEquals(3, $b->getSize()); + } +} diff --git a/openml_OS/vendor/guzzlehttp/streams/tests/NoSeekStreamTest.php b/openml_OS/vendor/guzzlehttp/streams/tests/NoSeekStreamTest.php new file mode 100644 index 000000000..21b7c6d22 --- /dev/null +++ b/openml_OS/vendor/guzzlehttp/streams/tests/NoSeekStreamTest.php @@ -0,0 +1,41 @@ +getMockBuilder('GuzzleHttp\Stream\StreamInterface') + ->setMethods(['isSeekable', 'seek']) + ->getMockForAbstractClass(); + $s->expects($this->never())->method('seek'); + $s->expects($this->never())->method('isSeekable'); + $wrapped = new NoSeekStream($s); + $this->assertFalse($wrapped->isSeekable()); + $this->assertFalse($wrapped->seek(2)); + } + + public function testHandlesClose() + { + $s = Stream::factory('foo'); + $wrapped = new NoSeekStream($s); + $wrapped->close(); + $this->assertFalse($wrapped->write('foo')); + } + + public function testCanAttach() + { + $s1 = Stream::factory('foo'); + $s2 = Stream::factory('bar'); + $wrapped = new NoSeekStream($s1); + $wrapped->attach($s2->detach()); + $this->assertEquals('bar', (string) $wrapped); + } +} diff --git a/openml_OS/vendor/guzzlehttp/streams/tests/NullStreamTest.php b/openml_OS/vendor/guzzlehttp/streams/tests/NullStreamTest.php new file mode 100644 index 000000000..8e4143159 --- /dev/null +++ b/openml_OS/vendor/guzzlehttp/streams/tests/NullStreamTest.php @@ -0,0 +1,39 @@ +assertEquals('', $b->read(10)); + $this->assertEquals(4, $b->write('test')); + $this->assertEquals('', (string) $b); + $this->assertNull($b->getMetadata('a')); + $this->assertEquals([], $b->getMetadata()); + $this->assertEquals(0, $b->getSize()); + $this->assertEquals('', $b->getContents()); + $this->assertEquals(0, $b->tell()); + + $this->assertTrue($b->isReadable()); + $this->assertTrue($b->isWritable()); + $this->assertTrue($b->isSeekable()); + $this->assertFalse($b->seek(10)); + + $this->assertTrue($b->eof()); + $b->detach(); + $this->assertTrue($b->eof()); + $b->close(); + } + + /** + * @expectedException \GuzzleHttp\Stream\Exception\CannotAttachException + */ + public function testCannotAttach() + { + $p = new NullStream(); + $p->attach('a'); + } +} diff --git a/openml_OS/vendor/guzzlehttp/streams/tests/PumpStreamTest.php b/openml_OS/vendor/guzzlehttp/streams/tests/PumpStreamTest.php new file mode 100644 index 000000000..2d20ce90c --- /dev/null +++ b/openml_OS/vendor/guzzlehttp/streams/tests/PumpStreamTest.php @@ -0,0 +1,77 @@ + ['foo' => 'bar'], + 'size' => 100 + ]); + + $this->assertEquals('bar', $p->getMetadata('foo')); + $this->assertEquals(['foo' => 'bar'], $p->getMetadata()); + $this->assertEquals(100, $p->getSize()); + } + + public function testCanReadFromCallable() + { + $p = Stream::factory(function ($size) { + return 'a'; + }); + $this->assertEquals('a', $p->read(1)); + $this->assertEquals(1, $p->tell()); + $this->assertEquals('aaaaa', $p->read(5)); + $this->assertEquals(6, $p->tell()); + } + + public function testStoresExcessDataInBuffer() + { + $called = []; + $p = Stream::factory(function ($size) use (&$called) { + $called[] = $size; + return 'abcdef'; + }); + $this->assertEquals('a', $p->read(1)); + $this->assertEquals('b', $p->read(1)); + $this->assertEquals('cdef', $p->read(4)); + $this->assertEquals('abcdefabc', $p->read(9)); + $this->assertEquals([1, 9, 3], $called); + } + + public function testInifiniteStreamWrappedInLimitStream() + { + $p = Stream::factory(function () { return 'a'; }); + $s = new LimitStream($p, 5); + $this->assertEquals('aaaaa', (string) $s); + } + + public function testDescribesCapabilities() + { + $p = Stream::factory(function () {}); + $this->assertTrue($p->isReadable()); + $this->assertFalse($p->isSeekable()); + $this->assertFalse($p->isWritable()); + $this->assertNull($p->getSize()); + $this->assertFalse($p->write('aa')); + $this->assertEquals('', $p->getContents()); + $this->assertEquals('', (string) $p); + $p->close(); + $this->assertEquals('', $p->read(10)); + $this->assertTrue($p->eof()); + } + + /** + * @expectedException \GuzzleHttp\Stream\Exception\CannotAttachException + */ + public function testCannotAttach() + { + $p = Stream::factory(function () {}); + $p->attach('a'); + } +} diff --git a/openml_OS/vendor/guzzlehttp/streams/tests/StreamDecoratorTraitTest.php b/openml_OS/vendor/guzzlehttp/streams/tests/StreamDecoratorTraitTest.php new file mode 100644 index 000000000..2ba79addf --- /dev/null +++ b/openml_OS/vendor/guzzlehttp/streams/tests/StreamDecoratorTraitTest.php @@ -0,0 +1,147 @@ +c = fopen('php://temp', 'r+'); + fwrite($this->c, 'foo'); + fseek($this->c, 0); + $this->a = Stream::factory($this->c); + $this->b = new Str($this->a); + } + + public function testCatchesExceptionsWhenCastingToString() + { + $s = $this->getMockBuilder('GuzzleHttp\Stream\StreamInterface') + ->setMethods(['read']) + ->getMockForAbstractClass(); + $s->expects($this->once()) + ->method('read') + ->will($this->throwException(new \Exception('foo'))); + $msg = ''; + set_error_handler(function ($errNo, $str) use (&$msg) { $msg = $str; }); + echo new Str($s); + restore_error_handler(); + $this->assertContains('foo', $msg); + } + + public function testToString() + { + $this->assertEquals('foo', (string) $this->b); + } + + public function testHasSize() + { + $this->assertEquals(3, $this->b->getSize()); + $this->assertSame($this->b, $this->b->setSize(2)); + $this->assertEquals(2, $this->b->getSize()); + } + + public function testReads() + { + $this->assertEquals('foo', $this->b->read(10)); + } + + public function testCheckMethods() + { + $this->assertEquals($this->a->isReadable(), $this->b->isReadable()); + $this->assertEquals($this->a->isWritable(), $this->b->isWritable()); + $this->assertEquals($this->a->isSeekable(), $this->b->isSeekable()); + } + + public function testSeeksAndTells() + { + $this->assertTrue($this->b->seek(1)); + $this->assertEquals(1, $this->a->tell()); + $this->assertEquals(1, $this->b->tell()); + $this->assertTrue($this->b->seek(0)); + $this->assertEquals(0, $this->a->tell()); + $this->assertEquals(0, $this->b->tell()); + $this->assertTrue($this->b->seek(0, SEEK_END)); + $this->assertEquals(3, $this->a->tell()); + $this->assertEquals(3, $this->b->tell()); + } + + public function testGetsContents() + { + $this->assertEquals('foo', $this->b->getContents()); + $this->assertEquals('', $this->b->getContents()); + $this->b->seek(1); + $this->assertEquals('oo', $this->b->getContents(1)); + } + + public function testCloses() + { + $this->b->close(); + $this->assertFalse(is_resource($this->c)); + } + + public function testDetaches() + { + $this->b->detach(); + $this->assertFalse($this->b->isReadable()); + } + + /** + * @expectedException \GuzzleHttp\Stream\Exception\CannotAttachException + */ + public function testCannotAttachByDefault() + { + $this->b->attach('a'); + } + + public function testWrapsMetadata() + { + $this->assertSame($this->b->getMetadata(), $this->a->getMetadata()); + $this->assertSame($this->b->getMetadata('uri'), $this->a->getMetadata('uri')); + } + + public function testWrapsWrites() + { + $this->b->seek(0, SEEK_END); + $this->b->write('foo'); + $this->assertEquals('foofoo', (string) $this->a); + } + + /** + * @expectedException \UnexpectedValueException + */ + public function testThrowsWithInvalidGetter() + { + $this->b->foo; + } + + /** + * @expectedException \BadMethodCallException + */ + public function testThrowsWhenGetterNotImplemented() + { + $s = new BadStream(); + $s->stream; + } +} + +class BadStream +{ + use StreamDecoratorTrait; + + public function __construct() {} +} diff --git a/openml_OS/vendor/guzzlehttp/streams/tests/StreamTest.php b/openml_OS/vendor/guzzlehttp/streams/tests/StreamTest.php new file mode 100644 index 000000000..2985bfbb1 --- /dev/null +++ b/openml_OS/vendor/guzzlehttp/streams/tests/StreamTest.php @@ -0,0 +1,252 @@ +assertTrue($stream->isReadable()); + $this->assertTrue($stream->isWritable()); + $this->assertTrue($stream->isSeekable()); + $this->assertEquals('php://temp', $stream->getMetadata('uri')); + $this->assertInternalType('array', $stream->getMetadata()); + $this->assertEquals(4, $stream->getSize()); + $this->assertFalse($stream->eof()); + $stream->close(); + } + + public function testStreamClosesHandleOnDestruct() + { + $handle = fopen('php://temp', 'r'); + $stream = new Stream($handle); + unset($stream); + $this->assertFalse(is_resource($handle)); + } + + public function testConvertsToString() + { + $handle = fopen('php://temp', 'w+'); + fwrite($handle, 'data'); + $stream = new Stream($handle); + $this->assertEquals('data', (string) $stream); + $this->assertEquals('data', (string) $stream); + $stream->close(); + } + + public function testGetsContents() + { + $handle = fopen('php://temp', 'w+'); + fwrite($handle, 'data'); + $stream = new Stream($handle); + $this->assertEquals('', $stream->getContents()); + $stream->seek(0); + $this->assertEquals('data', $stream->getContents()); + $this->assertEquals('', $stream->getContents()); + } + + public function testChecksEof() + { + $handle = fopen('php://temp', 'w+'); + fwrite($handle, 'data'); + $stream = new Stream($handle); + $this->assertFalse($stream->eof()); + $stream->read(4); + $this->assertTrue($stream->eof()); + $stream->close(); + } + + public function testAllowsSettingManualSize() + { + $handle = fopen('php://temp', 'w+'); + fwrite($handle, 'data'); + $stream = new Stream($handle); + $stream->setSize(10); + $this->assertEquals(10, $stream->getSize()); + $stream->close(); + } + + public function testGetSize() + { + $size = filesize(__FILE__); + $handle = fopen(__FILE__, 'r'); + $stream = new Stream($handle); + $this->assertEquals($size, $stream->getSize()); + // Load from cache + $this->assertEquals($size, $stream->getSize()); + $stream->close(); + } + + public function testEnsuresSizeIsConsistent() + { + $h = fopen('php://temp', 'w+'); + $this->assertEquals(3, fwrite($h, 'foo')); + $stream = new Stream($h); + $this->assertEquals(3, $stream->getSize()); + $this->assertEquals(4, $stream->write('test')); + $this->assertEquals(7, $stream->getSize()); + $this->assertEquals(7, $stream->getSize()); + $stream->close(); + } + + public function testProvidesStreamPosition() + { + $handle = fopen('php://temp', 'w+'); + $stream = new Stream($handle); + $this->assertEquals(0, $stream->tell()); + $stream->write('foo'); + $this->assertEquals(3, $stream->tell()); + $stream->seek(1); + $this->assertEquals(1, $stream->tell()); + $this->assertSame(ftell($handle), $stream->tell()); + $stream->close(); + } + + public function testKeepsPositionOfResource() + { + $h = fopen(__FILE__, 'r'); + fseek($h, 10); + $stream = Stream::factory($h); + $this->assertEquals(10, $stream->tell()); + $stream->close(); + } + + public function testCanDetachAndAttachStream() + { + $r = fopen('php://temp', 'w+'); + $stream = new Stream($r); + $stream->write('foo'); + $this->assertTrue($stream->isReadable()); + $this->assertSame($r, $stream->detach()); + $this->assertNull($stream->detach()); + + $this->assertFalse($stream->isReadable()); + $this->assertFalse($stream->read(10)); + $this->assertFalse($stream->isWritable()); + $this->assertFalse($stream->write('bar')); + $this->assertFalse($stream->isSeekable()); + $this->assertFalse($stream->seek(10)); + $this->assertFalse($stream->tell()); + $this->assertTrue($stream->eof()); + $this->assertNull($stream->getSize()); + $this->assertSame('', (string) $stream); + $this->assertSame('', $stream->getContents()); + + $stream->attach($r); + $stream->seek(0); + $this->assertEquals('foo', $stream->getContents()); + $this->assertTrue($stream->isReadable()); + $this->assertTrue($stream->isWritable()); + $this->assertTrue($stream->isSeekable()); + + $stream->close(); + } + + public function testCloseClearProperties() + { + $handle = fopen('php://temp', 'r+'); + $stream = new Stream($handle); + $stream->close(); + + $this->assertEmpty($stream->getMetadata()); + $this->assertFalse($stream->isSeekable()); + $this->assertFalse($stream->isReadable()); + $this->assertFalse($stream->isWritable()); + $this->assertNull($stream->getSize()); + } + + public function testCreatesWithFactory() + { + $stream = Stream::factory('foo'); + $this->assertInstanceOf('GuzzleHttp\Stream\Stream', $stream); + $this->assertEquals('foo', $stream->getContents()); + $stream->close(); + } + + public function testFactoryCreatesFromEmptyString() + { + $s = Stream::factory(); + $this->assertInstanceOf('GuzzleHttp\Stream\Stream', $s); + } + + public function testFactoryCreatesFromResource() + { + $r = fopen(__FILE__, 'r'); + $s = Stream::factory($r); + $this->assertInstanceOf('GuzzleHttp\Stream\Stream', $s); + $this->assertSame(file_get_contents(__FILE__), (string) $s); + } + + public function testFactoryCreatesFromObjectWithToString() + { + $r = new HasToString(); + $s = Stream::factory($r); + $this->assertInstanceOf('GuzzleHttp\Stream\Stream', $s); + $this->assertEquals('foo', (string) $s); + } + + public function testCreatePassesThrough() + { + $s = Stream::factory('foo'); + $this->assertSame($s, Stream::factory($s)); + } + + /** + * @expectedException \InvalidArgumentException + */ + public function testThrowsExceptionForUnknown() + { + Stream::factory(new \stdClass()); + } + + public function testReturnsCustomMetadata() + { + $s = Stream::factory('foo', ['metadata' => ['hwm' => 3]]); + $this->assertEquals(3, $s->getMetadata('hwm')); + $this->assertArrayHasKey('hwm', $s->getMetadata()); + } + + public function testCanSetSize() + { + $s = Stream::factory('', ['size' => 10]); + $this->assertEquals(10, $s->getSize()); + } + + public function testCanCreateIteratorBasedStream() + { + $a = new \ArrayIterator(['foo', 'bar', '123']); + $p = Stream::factory($a); + $this->assertInstanceOf('GuzzleHttp\Stream\PumpStream', $p); + $this->assertEquals('foo', $p->read(3)); + $this->assertFalse($p->eof()); + $this->assertEquals('b', $p->read(1)); + $this->assertEquals('a', $p->read(1)); + $this->assertEquals('r12', $p->read(3)); + $this->assertFalse($p->eof()); + $this->assertEquals('3', $p->getContents()); + $this->assertTrue($p->eof()); + $this->assertEquals(9, $p->tell()); + } +} + +class HasToString +{ + public function __toString() { + return 'foo'; + } +} diff --git a/openml_OS/vendor/guzzlehttp/streams/tests/UtilsTest.php b/openml_OS/vendor/guzzlehttp/streams/tests/UtilsTest.php new file mode 100644 index 000000000..6e3e3b216 --- /dev/null +++ b/openml_OS/vendor/guzzlehttp/streams/tests/UtilsTest.php @@ -0,0 +1,155 @@ +assertEquals('foobaz', Utils::copyToString($s)); + $s->seek(0); + $this->assertEquals('foo', Utils::copyToString($s, 3)); + $this->assertEquals('baz', Utils::copyToString($s, 3)); + $this->assertEquals('', Utils::copyToString($s)); + } + + public function testCopiesToStringStopsWhenReadFails() + { + $s1 = Stream::factory('foobaz'); + $s1 = FnStream::decorate($s1, [ + 'read' => function () { + return false; + } + ]); + $result = Utils::copyToString($s1); + $this->assertEquals('', $result); + } + + public function testCopiesToStream() + { + $s1 = Stream::factory('foobaz'); + $s2 = Stream::factory(''); + Utils::copyToStream($s1, $s2); + $this->assertEquals('foobaz', (string) $s2); + $s2 = Stream::factory(''); + $s1->seek(0); + Utils::copyToStream($s1, $s2, 3); + $this->assertEquals('foo', (string) $s2); + Utils::copyToStream($s1, $s2, 3); + $this->assertEquals('foobaz', (string) $s2); + } + + public function testStopsCopyToStreamWhenWriteFails() + { + $s1 = Stream::factory('foobaz'); + $s2 = Stream::factory(''); + $s2 = FnStream::decorate($s2, ['write' => function () { return 0; }]); + Utils::copyToStream($s1, $s2); + $this->assertEquals('', (string) $s2); + } + + public function testStopsCopyToSteamWhenWriteFailsWithMaxLen() + { + $s1 = Stream::factory('foobaz'); + $s2 = Stream::factory(''); + $s2 = FnStream::decorate($s2, ['write' => function () { return 0; }]); + Utils::copyToStream($s1, $s2, 10); + $this->assertEquals('', (string) $s2); + } + + public function testStopsCopyToSteamWhenReadFailsWithMaxLen() + { + $s1 = Stream::factory('foobaz'); + $s1 = FnStream::decorate($s1, ['read' => function () { return ''; }]); + $s2 = Stream::factory(''); + Utils::copyToStream($s1, $s2, 10); + $this->assertEquals('', (string) $s2); + } + + public function testReadsLines() + { + $s = Stream::factory("foo\nbaz\nbar"); + $this->assertEquals("foo\n", Utils::readline($s)); + $this->assertEquals("baz\n", Utils::readline($s)); + $this->assertEquals("bar", Utils::readline($s)); + } + + public function testReadsLinesUpToMaxLength() + { + $s = Stream::factory("12345\n"); + $this->assertEquals("123", Utils::readline($s, 4)); + $this->assertEquals("45\n", Utils::readline($s)); + } + + public function testReadsLineUntilFalseReturnedFromRead() + { + $s = $this->getMockBuilder('GuzzleHttp\Stream\Stream') + ->setMethods(['read', 'eof']) + ->disableOriginalConstructor() + ->getMock(); + $s->expects($this->exactly(2)) + ->method('read') + ->will($this->returnCallback(function () { + static $c = false; + if ($c) { + return false; + } + $c = true; + return 'h'; + })); + $s->expects($this->exactly(2)) + ->method('eof') + ->will($this->returnValue(false)); + $this->assertEquals("h", Utils::readline($s)); + } + + public function testCalculatesHash() + { + $s = Stream::factory('foobazbar'); + $this->assertEquals(md5('foobazbar'), Utils::hash($s, 'md5')); + } + + /** + * @expectedException \GuzzleHttp\Stream\Exception\SeekException + */ + public function testCalculatesHashThrowsWhenSeekFails() + { + $s = new NoSeekStream(Stream::factory('foobazbar')); + $s->read(2); + Utils::hash($s, 'md5'); + } + + public function testCalculatesHashSeeksToOriginalPosition() + { + $s = Stream::factory('foobazbar'); + $s->seek(4); + $this->assertEquals(md5('foobazbar'), Utils::hash($s, 'md5')); + $this->assertEquals(4, $s->tell()); + } + + public function testOpensFilesSuccessfully() + { + $r = Utils::open(__FILE__, 'r'); + $this->assertInternalType('resource', $r); + fclose($r); + } + + /** + * @expectedException \RuntimeException + * @expectedExceptionMessage Unable to open /path/to/does/not/exist using mode r + */ + public function testThrowsExceptionNotWarning() + { + Utils::open('/path/to/does/not/exist', 'r'); + } + + public function testProxiesToFactory() + { + $this->assertEquals('foo', (string) Utils::create('foo')); + } +} diff --git a/openml_OS/vendor/psr/log/.gitignore b/openml_OS/vendor/psr/log/.gitignore new file mode 100644 index 000000000..22d0d82f8 --- /dev/null +++ b/openml_OS/vendor/psr/log/.gitignore @@ -0,0 +1 @@ +vendor diff --git a/openml_OS/vendor/psr/log/Psr/Log/AbstractLogger.php b/openml_OS/vendor/psr/log/Psr/Log/AbstractLogger.php index e02f9daf3..90e721af2 100644 --- a/openml_OS/vendor/psr/log/Psr/Log/AbstractLogger.php +++ b/openml_OS/vendor/psr/log/Psr/Log/AbstractLogger.php @@ -14,8 +14,8 @@ abstract class AbstractLogger implements LoggerInterface /** * System is unusable. * - * @param string $message - * @param mixed[] $context + * @param string $message + * @param array $context * * @return void */ @@ -30,8 +30,8 @@ public function emergency($message, array $context = array()) * Example: Entire website down, database unavailable, etc. This should * trigger the SMS alerts and wake you up. * - * @param string $message - * @param mixed[] $context + * @param string $message + * @param array $context * * @return void */ @@ -45,8 +45,8 @@ public function alert($message, array $context = array()) * * Example: Application component unavailable, unexpected exception. * - * @param string $message - * @param mixed[] $context + * @param string $message + * @param array $context * * @return void */ @@ -59,8 +59,8 @@ public function critical($message, array $context = array()) * Runtime errors that do not require immediate action but should typically * be logged and monitored. * - * @param string $message - * @param mixed[] $context + * @param string $message + * @param array $context * * @return void */ @@ -75,8 +75,8 @@ public function error($message, array $context = array()) * Example: Use of deprecated APIs, poor use of an API, undesirable things * that are not necessarily wrong. * - * @param string $message - * @param mixed[] $context + * @param string $message + * @param array $context * * @return void */ @@ -88,8 +88,8 @@ public function warning($message, array $context = array()) /** * Normal but significant events. * - * @param string $message - * @param mixed[] $context + * @param string $message + * @param array $context * * @return void */ @@ -103,8 +103,8 @@ public function notice($message, array $context = array()) * * Example: User logs in, SQL logs. * - * @param string $message - * @param mixed[] $context + * @param string $message + * @param array $context * * @return void */ @@ -116,8 +116,8 @@ public function info($message, array $context = array()) /** * Detailed debug information. * - * @param string $message - * @param mixed[] $context + * @param string $message + * @param array $context * * @return void */ diff --git a/openml_OS/vendor/psr/log/Psr/Log/LoggerAwareTrait.php b/openml_OS/vendor/psr/log/Psr/Log/LoggerAwareTrait.php index 82bf45c89..639f79bda 100644 --- a/openml_OS/vendor/psr/log/Psr/Log/LoggerAwareTrait.php +++ b/openml_OS/vendor/psr/log/Psr/Log/LoggerAwareTrait.php @@ -10,7 +10,7 @@ trait LoggerAwareTrait /** * The logger instance. * - * @var LoggerInterface|null + * @var LoggerInterface */ protected $logger; diff --git a/openml_OS/vendor/psr/log/Psr/Log/LoggerInterface.php b/openml_OS/vendor/psr/log/Psr/Log/LoggerInterface.php index 2206cfde4..5ea72438b 100644 --- a/openml_OS/vendor/psr/log/Psr/Log/LoggerInterface.php +++ b/openml_OS/vendor/psr/log/Psr/Log/LoggerInterface.php @@ -22,8 +22,8 @@ interface LoggerInterface /** * System is unusable. * - * @param string $message - * @param mixed[] $context + * @param string $message + * @param array $context * * @return void */ @@ -35,8 +35,8 @@ public function emergency($message, array $context = array()); * Example: Entire website down, database unavailable, etc. This should * trigger the SMS alerts and wake you up. * - * @param string $message - * @param mixed[] $context + * @param string $message + * @param array $context * * @return void */ @@ -47,8 +47,8 @@ public function alert($message, array $context = array()); * * Example: Application component unavailable, unexpected exception. * - * @param string $message - * @param mixed[] $context + * @param string $message + * @param array $context * * @return void */ @@ -58,8 +58,8 @@ public function critical($message, array $context = array()); * Runtime errors that do not require immediate action but should typically * be logged and monitored. * - * @param string $message - * @param mixed[] $context + * @param string $message + * @param array $context * * @return void */ @@ -71,8 +71,8 @@ public function error($message, array $context = array()); * Example: Use of deprecated APIs, poor use of an API, undesirable things * that are not necessarily wrong. * - * @param string $message - * @param mixed[] $context + * @param string $message + * @param array $context * * @return void */ @@ -81,8 +81,8 @@ public function warning($message, array $context = array()); /** * Normal but significant events. * - * @param string $message - * @param mixed[] $context + * @param string $message + * @param array $context * * @return void */ @@ -93,8 +93,8 @@ public function notice($message, array $context = array()); * * Example: User logs in, SQL logs. * - * @param string $message - * @param mixed[] $context + * @param string $message + * @param array $context * * @return void */ @@ -103,8 +103,8 @@ public function info($message, array $context = array()); /** * Detailed debug information. * - * @param string $message - * @param mixed[] $context + * @param string $message + * @param array $context * * @return void */ @@ -113,13 +113,11 @@ public function debug($message, array $context = array()); /** * Logs with an arbitrary level. * - * @param mixed $level - * @param string $message - * @param mixed[] $context + * @param mixed $level + * @param string $message + * @param array $context * * @return void - * - * @throws \Psr\Log\InvalidArgumentException */ public function log($level, $message, array $context = array()); } diff --git a/openml_OS/vendor/psr/log/Psr/Log/LoggerTrait.php b/openml_OS/vendor/psr/log/Psr/Log/LoggerTrait.php index e392fef0a..867225df1 100644 --- a/openml_OS/vendor/psr/log/Psr/Log/LoggerTrait.php +++ b/openml_OS/vendor/psr/log/Psr/Log/LoggerTrait.php @@ -135,8 +135,6 @@ public function debug($message, array $context = array()) * @param array $context * * @return void - * - * @throws \Psr\Log\InvalidArgumentException */ abstract public function log($level, $message, array $context = array()); } diff --git a/openml_OS/vendor/psr/log/Psr/Log/NullLogger.php b/openml_OS/vendor/psr/log/Psr/Log/NullLogger.php index c8f7293b1..d8cd682c8 100644 --- a/openml_OS/vendor/psr/log/Psr/Log/NullLogger.php +++ b/openml_OS/vendor/psr/log/Psr/Log/NullLogger.php @@ -20,8 +20,6 @@ class NullLogger extends AbstractLogger * @param array $context * * @return void - * - * @throws \Psr\Log\InvalidArgumentException */ public function log($level, $message, array $context = array()) { diff --git a/openml_OS/vendor/psr/log/Psr/Log/Test/LoggerInterfaceTest.php b/openml_OS/vendor/psr/log/Psr/Log/Test/LoggerInterfaceTest.php index e1e5354d2..a0391a52b 100644 --- a/openml_OS/vendor/psr/log/Psr/Log/Test/LoggerInterfaceTest.php +++ b/openml_OS/vendor/psr/log/Psr/Log/Test/LoggerInterfaceTest.php @@ -4,7 +4,6 @@ use Psr\Log\LoggerInterface; use Psr\Log\LogLevel; -use PHPUnit\Framework\TestCase; /** * Provides a base test class for ensuring compliance with the LoggerInterface. @@ -12,7 +11,7 @@ * Implementors can extend the class and implement abstract methods to run this * as part of their test suite. */ -abstract class LoggerInterfaceTest extends TestCase +abstract class LoggerInterfaceTest extends \PHPUnit_Framework_TestCase { /** * @return LoggerInterface @@ -102,9 +101,6 @@ public function testObjectCastToString() public function testContextCanContainAnything() { - $closed = fopen('php://memory', 'r'); - fclose($closed); - $context = array( 'bool' => true, 'null' => null, @@ -114,7 +110,6 @@ public function testContextCanContainAnything() 'nested' => array('with object' => new DummyTest), 'object' => new \DateTime, 'resource' => fopen('php://memory', 'r'), - 'closed' => $closed, ); $this->getLogger()->warning('Crazy context data', $context); @@ -136,3 +131,10 @@ public function testContextExceptionKeyCanBeExceptionOrOtherValues() $this->assertEquals($expected, $this->getLogs()); } } + +class DummyTest +{ + public function __toString() + { + } +} diff --git a/openml_OS/vendor/psr/log/README.md b/openml_OS/vendor/psr/log/README.md index a9f20c437..574bc1cb2 100644 --- a/openml_OS/vendor/psr/log/README.md +++ b/openml_OS/vendor/psr/log/README.md @@ -7,13 +7,6 @@ This repository holds all interfaces/classes/traits related to Note that this is not a logger of its own. It is merely an interface that describes a logger. See the specification for more details. -Installation ------------- - -```bash -composer require psr/log -``` - Usage ----- @@ -38,12 +31,6 @@ class Foo if ($this->logger) { $this->logger->info('Doing work'); } - - try { - $this->doSomethingElse(); - } catch (Exception $exception) { - $this->logger->error('Oh no!', array('exception' => $exception)); - } // do something useful } diff --git a/openml_OS/vendor/psr/log/composer.json b/openml_OS/vendor/psr/log/composer.json index ca0569537..87934d707 100644 --- a/openml_OS/vendor/psr/log/composer.json +++ b/openml_OS/vendor/psr/log/composer.json @@ -7,7 +7,7 @@ "authors": [ { "name": "PHP-FIG", - "homepage": "https://www.php-fig.org/" + "homepage": "http://www.php-fig.org/" } ], "require": { @@ -20,7 +20,7 @@ }, "extra": { "branch-alias": { - "dev-master": "1.1.x-dev" + "dev-master": "1.0.x-dev" } } } diff --git a/openml_OS/vendor/react/promise/.gitignore b/openml_OS/vendor/react/promise/.gitignore new file mode 100644 index 000000000..5241c60ab --- /dev/null +++ b/openml_OS/vendor/react/promise/.gitignore @@ -0,0 +1,5 @@ +composer.lock +composer.phar +phpunit.xml +build/ +vendor/ diff --git a/openml_OS/vendor/react/promise/.travis.yml b/openml_OS/vendor/react/promise/.travis.yml new file mode 100644 index 000000000..bcbe642ff --- /dev/null +++ b/openml_OS/vendor/react/promise/.travis.yml @@ -0,0 +1,28 @@ +language: php + +php: + - 5.4 + - 5.5 + - 5.6 + - 7.0 + - 7.1 + - nightly # ignore errors, see below + - hhvm # ignore errors, see below + +# lock distro so new future defaults will not break the build +dist: trusty + +matrix: + allow_failures: + - php: hhvm + - php: nightly + +install: + - composer install + +script: + - ./vendor/bin/phpunit -v --coverage-text --coverage-clover=./build/logs/clover.xml + +after_script: + - if [ -f ./build/logs/clover.xml ]; then travis_retry composer require satooshi/php-coveralls --no-interaction --update-with-dependencies; fi + - if [ -f ./build/logs/clover.xml ]; then php vendor/bin/coveralls -v; fi diff --git a/openml_OS/vendor/react/promise/CHANGELOG.md b/openml_OS/vendor/react/promise/CHANGELOG.md index 7f785eb5c..97033b04b 100644 --- a/openml_OS/vendor/react/promise/CHANGELOG.md +++ b/openml_OS/vendor/react/promise/CHANGELOG.md @@ -1,64 +1,6 @@ CHANGELOG for 2.x ================= -* 2.9.0 (2022-02-11) - - * Feature: Support union types and address deprecation of `ReflectionType::getClass()` (PHP 8+). - (#198 by @cdosoftei and @SimonFrings) - - ```php - $promise->otherwise(function (OverflowException|UnderflowException $e) { - echo 'Error: ' . $e->getMessage() . PHP_EOL; - }); - ``` - - * Feature: Support intersection types (PHP 8.1+). - (#195 by @bzikarsky) - - ```php - $promise->otherwise(function (OverflowException&CacheException $e) { - echo 'Error: ' . $e->getMessage() . PHP_EOL; - }); - ``` - - * Improve test suite, use GitHub actions for continuous integration (CI), - update to PHPUnit 9, and add full core team to the license. - (#174, #183, #186, and #201 by @SimonFrings and #211 by @clue) - -* 2.8.0 (2020-05-12) - - * Mark `FulfilledPromise`, `RejectedPromise` and `LazyPromise` as deprecated for Promise v2 (and remove for Promise v3). - (#143 and #165 by @clue) - - ```php - // deprecated - $fulfilled = new React\Promise\FulfilledPromise($value); - $rejected = new React\Promise\RejectedPromise($reason); - - // recommended alternatives - $fulfilled = React\Promise\resolve($value); - $rejected = React\Promise\reject($reason); - ``` - - * Fix: Fix checking whether cancellable promise is an object and avoid possible warning. - (#168 by @smscr and @jsor) - - * Improve documentation and add docblocks to functions and interfaces. - (#135 by @CharlotteDunois) - - * Add `.gitattributes` to exclude dev files from exports. - (#154 by @reedy) - - * Improve test suite, run tests on PHP 7.4 and update PHPUnit test setup. - (#163 by @clue) - -* 2.7.1 (2018-01-07) - - * Fix: file_exists warning when resolving with long strings. - (#130 by @sbesselsen) - * Improve performance by prefixing all global functions calls with \ to skip the look up and resolve process and go straight to the global function. - (#133 by @WyriHaximus) - * 2.7.0 (2018-06-13) * Feature: Improve memory consumption for pending promises by using static internal callbacks without binding to self. diff --git a/openml_OS/vendor/react/promise/LICENSE b/openml_OS/vendor/react/promise/LICENSE index 21c1357b7..5919d20ff 100644 --- a/openml_OS/vendor/react/promise/LICENSE +++ b/openml_OS/vendor/react/promise/LICENSE @@ -1,6 +1,4 @@ -The MIT License (MIT) - -Copyright (c) 2012 Jan Sorgalla, Christian Lück, Cees-Jan Kiewiet, Chris Boden +Copyright (c) 2012-2016 Jan Sorgalla Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/openml_OS/vendor/react/promise/README.md b/openml_OS/vendor/react/promise/README.md index d904a1d8f..368556612 100644 --- a/openml_OS/vendor/react/promise/README.md +++ b/openml_OS/vendor/react/promise/README.md @@ -4,7 +4,8 @@ Promise A lightweight implementation of [CommonJS Promises/A](http://wiki.commonjs.org/wiki/Promises/A) for PHP. -[![CI status](https://github.com/reactphp/promise/workflows/CI/badge.svg?branch=2.x)](https://github.com/reactphp/promise/actions) +[![Build Status](https://travis-ci.org/reactphp/promise.svg?branch=master)](http://travis-ci.org/reactphp/promise) +[![Coverage Status](https://coveralls.io/repos/github/reactphp/promise/badge.svg?branch=master)](https://coveralls.io/github/reactphp/promise?branch=master) Table of Contents ----------------- @@ -172,9 +173,9 @@ Neither its state nor its result (or error) can be modified. #### Implementations * [Promise](#promise-2) -* [FulfilledPromise](#fulfilledpromise) (deprecated) -* [RejectedPromise](#rejectedpromise) (deprecated) -* [LazyPromise](#lazypromise) (deprecated) +* [FulfilledPromise](#fulfilledpromise) +* [RejectedPromise](#rejectedpromise) +* [LazyPromise](#lazypromise) #### PromiseInterface::then() @@ -224,9 +225,9 @@ and utility methods which are not part of the Promises/A specification. #### Implementations * [Promise](#promise-1) -* [FulfilledPromise](#fulfilledpromise) (deprecated) -* [RejectedPromise](#rejectedpromise) (deprecated) -* [LazyPromise](#lazypromise) (deprecated) +* [FulfilledPromise](#fulfilledpromise) +* [RejectedPromise](#rejectedpromise) +* [LazyPromise](#lazypromise) #### ExtendedPromiseInterface::done() @@ -356,9 +357,9 @@ a promise has no effect. #### Implementations * [Promise](#promise-1) -* [FulfilledPromise](#fulfilledpromise) (deprecated) -* [RejectedPromise](#rejectedpromise) (deprecated) -* [LazyPromise](#lazypromise) (deprecated) +* [FulfilledPromise](#fulfilledpromise) +* [RejectedPromise](#rejectedpromise) +* [LazyPromise](#lazypromise) ### Promise @@ -408,8 +409,6 @@ once all consumers called the `cancel()` method of the promise. ### FulfilledPromise -> Deprecated in v2.8.0: External usage of `FulfilledPromise` is deprecated, use `resolve()` instead. - Creates a already fulfilled promise. ```php @@ -421,8 +420,6 @@ Note, that `$value` **cannot** be a promise. It's recommended to use ### RejectedPromise -> Deprecated in v2.8.0: External usage of `RejectedPromise` is deprecated, use `reject()` instead. - Creates a already rejected promise. ```php @@ -434,8 +431,6 @@ Note, that `$reason` **cannot** be a promise. It's recommended to use ### LazyPromise -> Deprecated in v2.8.0: LazyPromise is deprecated and should not be used anymore. - Creates a promise which will be lazily initialized by `$factory` once a consumer calls the `then()` method. @@ -849,14 +844,15 @@ This project follows [SemVer](https://semver.org/). This will install the latest supported version: ```bash -$ composer require react/promise:^2.9 +$ composer require react/promise:^2.7 ``` See also the [CHANGELOG](CHANGELOG.md) for details about version upgrades. This project aims to run on any platform and thus does not require any PHP -extensions and supports running on legacy PHP 5.4 through current PHP 8+ and HHVM. -It's *highly recommended to use the latest supported PHP version* for this project. +extensions and supports running on legacy PHP 5.4 through current PHP 7+ and HHVM. +It's *highly recommended to use PHP 7+* for this project due to its vast +performance improvements. Credits ------- diff --git a/openml_OS/vendor/react/promise/composer.json b/openml_OS/vendor/react/promise/composer.json index f933f1537..2fc480919 100644 --- a/openml_OS/vendor/react/promise/composer.json +++ b/openml_OS/vendor/react/promise/composer.json @@ -3,32 +3,13 @@ "description": "A lightweight implementation of CommonJS Promises/A for PHP", "license": "MIT", "authors": [ - { - "name": "Jan Sorgalla", - "homepage": "https://sorgalla.com/", - "email": "jsorgalla@gmail.com" - }, - { - "name": "Christian Lück", - "homepage": "https://clue.engineering/", - "email": "christian@clue.engineering" - }, - { - "name": "Cees-Jan Kiewiet", - "homepage": "https://wyrihaximus.net/", - "email": "reactphp@ceesjankiewiet.nl" - }, - { - "name": "Chris Boden", - "homepage": "https://cboden.dev/", - "email": "cboden@gmail.com" - } + {"name": "Jan Sorgalla", "email": "jsorgalla@gmail.com"} ], "require": { "php": ">=5.4.0" }, "require-dev": { - "phpunit/phpunit": "^9.3 || ^5.7 || ^4.8.36" + "phpunit/phpunit": "~4.8" }, "autoload": { "psr-4": { @@ -38,7 +19,7 @@ }, "autoload-dev": { "psr-4": { - "React\\Promise\\": ["tests", "tests/fixtures"] + "React\\Promise\\": "tests/fixtures" } }, "keywords": [ diff --git a/openml_OS/vendor/react/promise/phpunit.xml.dist b/openml_OS/vendor/react/promise/phpunit.xml.dist new file mode 100644 index 000000000..b9a689d74 --- /dev/null +++ b/openml_OS/vendor/react/promise/phpunit.xml.dist @@ -0,0 +1,28 @@ + + + + + + ./tests/ + + + + + + ./src/ + + ./src/functions_include.php + + + + diff --git a/openml_OS/vendor/react/promise/src/CancellablePromiseInterface.php b/openml_OS/vendor/react/promise/src/CancellablePromiseInterface.php index 6b3a8c65d..896db2d37 100644 --- a/openml_OS/vendor/react/promise/src/CancellablePromiseInterface.php +++ b/openml_OS/vendor/react/promise/src/CancellablePromiseInterface.php @@ -5,12 +5,6 @@ interface CancellablePromiseInterface extends PromiseInterface { /** - * The `cancel()` method notifies the creator of the promise that there is no - * further interest in the results of the operation. - * - * Once a promise is settled (either fulfilled or rejected), calling `cancel()` on - * a promise has no effect. - * * @return void */ public function cancel(); diff --git a/openml_OS/vendor/react/promise/src/CancellationQueue.php b/openml_OS/vendor/react/promise/src/CancellationQueue.php index a381e9780..a366994d9 100644 --- a/openml_OS/vendor/react/promise/src/CancellationQueue.php +++ b/openml_OS/vendor/react/promise/src/CancellationQueue.php @@ -19,11 +19,11 @@ public function __invoke() public function enqueue($cancellable) { - if (!\is_object($cancellable) || !\method_exists($cancellable, 'then') || !\method_exists($cancellable, 'cancel')) { + if (!method_exists($cancellable, 'then') || !method_exists($cancellable, 'cancel')) { return; } - $length = \array_push($this->queue, $cancellable); + $length = array_push($this->queue, $cancellable); if ($this->started && 1 === $length) { $this->drain(); diff --git a/openml_OS/vendor/react/promise/src/Deferred.php b/openml_OS/vendor/react/promise/src/Deferred.php index 3ca034b85..6534bc86d 100644 --- a/openml_OS/vendor/react/promise/src/Deferred.php +++ b/openml_OS/vendor/react/promise/src/Deferred.php @@ -33,14 +33,14 @@ public function resolve($value = null) { $this->promise(); - \call_user_func($this->resolveCallback, $value); + call_user_func($this->resolveCallback, $value); } public function reject($reason = null) { $this->promise(); - \call_user_func($this->rejectCallback, $reason); + call_user_func($this->rejectCallback, $reason); } /** @@ -51,7 +51,7 @@ public function notify($update = null) { $this->promise(); - \call_user_func($this->notifyCallback, $update); + call_user_func($this->notifyCallback, $update); } /** diff --git a/openml_OS/vendor/react/promise/src/ExtendedPromiseInterface.php b/openml_OS/vendor/react/promise/src/ExtendedPromiseInterface.php index 13b636917..3654177c5 100644 --- a/openml_OS/vendor/react/promise/src/ExtendedPromiseInterface.php +++ b/openml_OS/vendor/react/promise/src/ExtendedPromiseInterface.php @@ -5,92 +5,24 @@ interface ExtendedPromiseInterface extends PromiseInterface { /** - * Consumes the promise's ultimate value if the promise fulfills, or handles the - * ultimate error. * - * It will cause a fatal error if either `$onFulfilled` or - * `$onRejected` throw or return a rejected promise. + * The `$onProgress` argument is deprecated and should not be used anymore. * - * Since the purpose of `done()` is consumption rather than transformation, - * `done()` always returns `null`. - * - * @param callable|null $onFulfilled - * @param callable|null $onRejected - * @param callable|null $onProgress This argument is deprecated and should not be used anymore. * @return void */ public function done(callable $onFulfilled = null, callable $onRejected = null, callable $onProgress = null); /** - * Registers a rejection handler for promise. It is a shortcut for: - * - * ```php - * $promise->then(null, $onRejected); - * ``` - * - * Additionally, you can type hint the `$reason` argument of `$onRejected` to catch - * only specific errors. - * - * @param callable $onRejected * @return ExtendedPromiseInterface */ public function otherwise(callable $onRejected); /** - * Allows you to execute "cleanup" type tasks in a promise chain. - * - * It arranges for `$onFulfilledOrRejected` to be called, with no arguments, - * when the promise is either fulfilled or rejected. - * - * * If `$promise` fulfills, and `$onFulfilledOrRejected` returns successfully, - * `$newPromise` will fulfill with the same value as `$promise`. - * * If `$promise` fulfills, and `$onFulfilledOrRejected` throws or returns a - * rejected promise, `$newPromise` will reject with the thrown exception or - * rejected promise's reason. - * * If `$promise` rejects, and `$onFulfilledOrRejected` returns successfully, - * `$newPromise` will reject with the same reason as `$promise`. - * * If `$promise` rejects, and `$onFulfilledOrRejected` throws or returns a - * rejected promise, `$newPromise` will reject with the thrown exception or - * rejected promise's reason. - * - * `always()` behaves similarly to the synchronous finally statement. When combined - * with `otherwise()`, `always()` allows you to write code that is similar to the familiar - * synchronous catch/finally pair. - * - * Consider the following synchronous code: - * - * ```php - * try { - * return doSomething(); - * } catch(\Exception $e) { - * return handleError($e); - * } finally { - * cleanup(); - * } - * ``` - * - * Similar asynchronous code (with `doSomething()` that returns a promise) can be - * written: - * - * ```php - * return doSomething() - * ->otherwise('handleError') - * ->always('cleanup'); - * ``` - * - * @param callable $onFulfilledOrRejected * @return ExtendedPromiseInterface */ public function always(callable $onFulfilledOrRejected); /** - * Registers a handler for progress updates from promise. It is a shortcut for: - * - * ```php - * $promise->then(null, null, $onProgress); - * ``` - * - * @param callable $onProgress * @return ExtendedPromiseInterface * @deprecated 2.6.0 Progress support is deprecated and should not be used anymore. */ diff --git a/openml_OS/vendor/react/promise/src/FulfilledPromise.php b/openml_OS/vendor/react/promise/src/FulfilledPromise.php index 147275277..914bb5c15 100644 --- a/openml_OS/vendor/react/promise/src/FulfilledPromise.php +++ b/openml_OS/vendor/react/promise/src/FulfilledPromise.php @@ -2,9 +2,6 @@ namespace React\Promise; -/** - * @deprecated 2.8.0 External usage of FulfilledPromise is deprecated, use `resolve()` instead. - */ class FulfilledPromise implements ExtendedPromiseInterface, CancellablePromiseInterface { private $value; diff --git a/openml_OS/vendor/react/promise/src/LazyPromise.php b/openml_OS/vendor/react/promise/src/LazyPromise.php index bbe9293e1..7e3a3d3dd 100644 --- a/openml_OS/vendor/react/promise/src/LazyPromise.php +++ b/openml_OS/vendor/react/promise/src/LazyPromise.php @@ -2,9 +2,6 @@ namespace React\Promise; -/** - * @deprecated 2.8.0 LazyPromise is deprecated and should not be used anymore. - */ class LazyPromise implements ExtendedPromiseInterface, CancellablePromiseInterface { private $factory; @@ -53,7 +50,7 @@ public function promise() { if (null === $this->promise) { try { - $this->promise = resolve(\call_user_func($this->factory)); + $this->promise = resolve(call_user_func($this->factory)); } catch (\Throwable $exception) { $this->promise = new RejectedPromise($exception); } catch (\Exception $exception) { diff --git a/openml_OS/vendor/react/promise/src/Promise.php b/openml_OS/vendor/react/promise/src/Promise.php index 33759e6fe..77819ac48 100644 --- a/openml_OS/vendor/react/promise/src/Promise.php +++ b/openml_OS/vendor/react/promise/src/Promise.php @@ -201,9 +201,9 @@ private function call(callable $cb) // function arguments is actually faster than blindly passing them. // Also, this helps avoiding unnecessary function arguments in the call stack // if the callback creates an Exception (creating garbage cycles). - if (\is_array($callback)) { + if (is_array($callback)) { $ref = new \ReflectionMethod($callback[0], $callback[1]); - } elseif (\is_object($callback) && !$callback instanceof \Closure) { + } elseif (is_object($callback) && !$callback instanceof \Closure) { $ref = new \ReflectionMethod($callback, '__invoke'); } else { $ref = new \ReflectionFunction($callback); diff --git a/openml_OS/vendor/react/promise/src/PromiseInterface.php b/openml_OS/vendor/react/promise/src/PromiseInterface.php index edcb00770..fcd763d3f 100644 --- a/openml_OS/vendor/react/promise/src/PromiseInterface.php +++ b/openml_OS/vendor/react/promise/src/PromiseInterface.php @@ -5,36 +5,9 @@ interface PromiseInterface { /** - * Transforms a promise's value by applying a function to the promise's fulfillment - * or rejection value. Returns a new promise for the transformed result. * - * The `then()` method registers new fulfilled and rejection handlers with a promise - * (all parameters are optional): + * The `$onProgress` argument is deprecated and should not be used anymore. * - * * `$onFulfilled` will be invoked once the promise is fulfilled and passed - * the result as the first argument. - * * `$onRejected` will be invoked once the promise is rejected and passed the - * reason as the first argument. - * * `$onProgress` (deprecated) will be invoked whenever the producer of the promise - * triggers progress notifications and passed a single argument (whatever it - * wants) to indicate progress. - * - * It returns a new promise that will fulfill with the return value of either - * `$onFulfilled` or `$onRejected`, whichever is called, or will reject with - * the thrown exception if either throws. - * - * A promise makes the following guarantees about handlers registered in - * the same call to `then()`: - * - * 1. Only one of `$onFulfilled` or `$onRejected` will be called, - * never both. - * 2. `$onFulfilled` and `$onRejected` will never be called more - * than once. - * 3. `$onProgress` (deprecated) may be called multiple times. - * - * @param callable|null $onFulfilled - * @param callable|null $onRejected - * @param callable|null $onProgress This argument is deprecated and should not be used anymore. * @return PromiseInterface */ public function then(callable $onFulfilled = null, callable $onRejected = null, callable $onProgress = null); diff --git a/openml_OS/vendor/react/promise/src/PromisorInterface.php b/openml_OS/vendor/react/promise/src/PromisorInterface.php index bd6440086..9341a4fa8 100644 --- a/openml_OS/vendor/react/promise/src/PromisorInterface.php +++ b/openml_OS/vendor/react/promise/src/PromisorInterface.php @@ -5,8 +5,6 @@ interface PromisorInterface { /** - * Returns the promise of the deferred. - * * @return PromiseInterface */ public function promise(); diff --git a/openml_OS/vendor/react/promise/src/RejectedPromise.php b/openml_OS/vendor/react/promise/src/RejectedPromise.php index 09cd4ab2f..479a746b3 100644 --- a/openml_OS/vendor/react/promise/src/RejectedPromise.php +++ b/openml_OS/vendor/react/promise/src/RejectedPromise.php @@ -2,9 +2,6 @@ namespace React\Promise; -/** - * @deprecated 2.8.0 External usage of RejectedPromise is deprecated, use `reject()` instead. - */ class RejectedPromise implements ExtendedPromiseInterface, CancellablePromiseInterface { private $reason; diff --git a/openml_OS/vendor/react/promise/src/UnhandledRejectionException.php b/openml_OS/vendor/react/promise/src/UnhandledRejectionException.php index e7fe2f7a8..a44b7a1bf 100644 --- a/openml_OS/vendor/react/promise/src/UnhandledRejectionException.php +++ b/openml_OS/vendor/react/promise/src/UnhandledRejectionException.php @@ -19,7 +19,7 @@ public function __construct($reason) { $this->reason = $reason; - $message = \sprintf('Unhandled Rejection: %s', \json_encode($reason)); + $message = sprintf('Unhandled Rejection: %s', json_encode($reason)); parent::__construct($message, 0); } diff --git a/openml_OS/vendor/react/promise/src/functions.php b/openml_OS/vendor/react/promise/src/functions.php index 429f0e733..70c0eb72f 100644 --- a/openml_OS/vendor/react/promise/src/functions.php +++ b/openml_OS/vendor/react/promise/src/functions.php @@ -2,32 +2,16 @@ namespace React\Promise; -/** - * Creates a promise for the supplied `$promiseOrValue`. - * - * If `$promiseOrValue` is a value, it will be the resolution value of the - * returned promise. - * - * If `$promiseOrValue` is a thenable (any object that provides a `then()` method), - * a trusted promise that follows the state of the thenable is returned. - * - * If `$promiseOrValue` is a promise, it will be returned as is. - * - * @param mixed $promiseOrValue - * @return PromiseInterface - */ function resolve($promiseOrValue = null) { if ($promiseOrValue instanceof ExtendedPromiseInterface) { return $promiseOrValue; } - // Check is_object() first to avoid method_exists() triggering - // class autoloaders if $promiseOrValue is a string. - if (\is_object($promiseOrValue) && \method_exists($promiseOrValue, 'then')) { + if (method_exists($promiseOrValue, 'then')) { $canceller = null; - if (\method_exists($promiseOrValue, 'cancel')) { + if (method_exists($promiseOrValue, 'cancel')) { $canceller = [$promiseOrValue, 'cancel']; } @@ -39,22 +23,6 @@ function resolve($promiseOrValue = null) return new FulfilledPromise($promiseOrValue); } -/** - * Creates a rejected promise for the supplied `$promiseOrValue`. - * - * If `$promiseOrValue` is a value, it will be the rejection value of the - * returned promise. - * - * If `$promiseOrValue` is a promise, its completion value will be the rejected - * value of the returned promise. - * - * This can be useful in situations where you need to reject a promise without - * throwing an exception. For example, it allows you to propagate a rejection with - * the value of another promise. - * - * @param mixed $promiseOrValue - * @return PromiseInterface - */ function reject($promiseOrValue = null) { if ($promiseOrValue instanceof PromiseInterface) { @@ -66,15 +34,6 @@ function reject($promiseOrValue = null) return new RejectedPromise($promiseOrValue); } -/** - * Returns a promise that will resolve only once all the items in - * `$promisesOrValues` have resolved. The resolution value of the returned promise - * will be an array containing the resolution values of each of the items in - * `$promisesOrValues`. - * - * @param array $promisesOrValues - * @return PromiseInterface - */ function all($promisesOrValues) { return map($promisesOrValues, function ($val) { @@ -82,16 +41,6 @@ function all($promisesOrValues) }); } -/** - * Initiates a competitive race that allows one winner. Returns a promise which is - * resolved in the same way the first settled promise resolves. - * - * The returned promise will become **infinitely pending** if `$promisesOrValues` - * contains 0 items. - * - * @param array $promisesOrValues - * @return PromiseInterface - */ function race($promisesOrValues) { $cancellationQueue = new CancellationQueue(); @@ -115,46 +64,14 @@ function race($promisesOrValues) }, $cancellationQueue); } -/** - * Returns a promise that will resolve when any one of the items in - * `$promisesOrValues` resolves. The resolution value of the returned promise - * will be the resolution value of the triggering item. - * - * The returned promise will only reject if *all* items in `$promisesOrValues` are - * rejected. The rejection value will be an array of all rejection reasons. - * - * The returned promise will also reject with a `React\Promise\Exception\LengthException` - * if `$promisesOrValues` contains 0 items. - * - * @param array $promisesOrValues - * @return PromiseInterface - */ function any($promisesOrValues) { return some($promisesOrValues, 1) ->then(function ($val) { - return \array_shift($val); + return array_shift($val); }); } -/** - * Returns a promise that will resolve when `$howMany` of the supplied items in - * `$promisesOrValues` resolve. The resolution value of the returned promise - * will be an array of length `$howMany` containing the resolution values of the - * triggering items. - * - * The returned promise will reject if it becomes impossible for `$howMany` items - * to resolve (that is, when `(count($promisesOrValues) - $howMany) + 1` items - * reject). The rejection value will be an array of - * `(count($promisesOrValues) - $howMany) + 1` rejection reasons. - * - * The returned promise will also reject with a `React\Promise\Exception\LengthException` - * if `$promisesOrValues` contains less items than `$howMany`. - * - * @param array $promisesOrValues - * @param int $howMany - * @return PromiseInterface - */ function some($promisesOrValues, $howMany) { $cancellationQueue = new CancellationQueue(); @@ -163,16 +80,16 @@ function some($promisesOrValues, $howMany) return new Promise(function ($resolve, $reject, $notify) use ($promisesOrValues, $howMany, $cancellationQueue) { resolve($promisesOrValues) ->done(function ($array) use ($howMany, $cancellationQueue, $resolve, $reject, $notify) { - if (!\is_array($array) || $howMany < 1) { + if (!is_array($array) || $howMany < 1) { $resolve([]); return; } - $len = \count($array); + $len = count($array); if ($len < $howMany) { throw new Exception\LengthException( - \sprintf( + sprintf( 'Input array must contain at least %d item%s but contains only %s item%s.', $howMany, 1 === $howMany ? '' : 's', @@ -221,17 +138,6 @@ function some($promisesOrValues, $howMany) }, $cancellationQueue); } -/** - * Traditional map function, similar to `array_map()`, but allows input to contain - * promises and/or values, and `$mapFunc` may return either a value or a promise. - * - * The map function receives each item as argument, where item is a fully resolved - * value of a promise or value in `$promisesOrValues`. - * - * @param array $promisesOrValues - * @param callable $mapFunc - * @return PromiseInterface - */ function map($promisesOrValues, callable $mapFunc) { $cancellationQueue = new CancellationQueue(); @@ -240,12 +146,12 @@ function map($promisesOrValues, callable $mapFunc) return new Promise(function ($resolve, $reject, $notify) use ($promisesOrValues, $mapFunc, $cancellationQueue) { resolve($promisesOrValues) ->done(function ($array) use ($mapFunc, $cancellationQueue, $resolve, $reject, $notify) { - if (!\is_array($array) || !$array) { + if (!is_array($array) || !$array) { $resolve([]); return; } - $toResolve = \count($array); + $toResolve = count($array); $values = []; foreach ($array as $i => $promiseOrValue) { @@ -270,17 +176,6 @@ function ($mapped) use ($i, &$values, &$toResolve, $resolve) { }, $cancellationQueue); } -/** - * Traditional reduce function, similar to `array_reduce()`, but input may contain - * promises and/or values, and `$reduceFunc` may return either a value or a - * promise, *and* `$initialValue` may be a promise or a value for the starting - * value. - * - * @param array $promisesOrValues - * @param callable $reduceFunc - * @param mixed $initialValue - * @return PromiseInterface - */ function reduce($promisesOrValues, callable $reduceFunc, $initialValue = null) { $cancellationQueue = new CancellationQueue(); @@ -289,11 +184,11 @@ function reduce($promisesOrValues, callable $reduceFunc, $initialValue = null) return new Promise(function ($resolve, $reject, $notify) use ($promisesOrValues, $reduceFunc, $initialValue, $cancellationQueue) { resolve($promisesOrValues) ->done(function ($array) use ($reduceFunc, $initialValue, $cancellationQueue, $resolve, $reject, $notify) { - if (!\is_array($array)) { + if (!is_array($array)) { $array = []; } - $total = \count($array); + $total = count($array); $i = 0; // Wrap the supplied $reduceFunc with one that handles promises and then @@ -312,24 +207,22 @@ function reduce($promisesOrValues, callable $reduceFunc, $initialValue = null) $cancellationQueue->enqueue($initialValue); - \array_reduce($array, $wrappedReduceFunc, resolve($initialValue)) + array_reduce($array, $wrappedReduceFunc, resolve($initialValue)) ->done($resolve, $reject, $notify); }, $reject, $notify); }, $cancellationQueue); } -/** - * @internal - */ +// Internal functions function _checkTypehint(callable $callback, $object) { - if (!\is_object($object)) { + if (!is_object($object)) { return true; } - if (\is_array($callback)) { + if (is_array($callback)) { $callbackReflection = new \ReflectionMethod($callback[0], $callback[1]); - } elseif (\is_object($callback) && !$callback instanceof \Closure) { + } elseif (is_object($callback) && !$callback instanceof \Closure) { $callbackReflection = new \ReflectionMethod($callback, '__invoke'); } else { $callbackReflection = new \ReflectionFunction($callback); @@ -343,65 +236,9 @@ function _checkTypehint(callable $callback, $object) $expectedException = $parameters[0]; - // PHP before v8 used an easy API: - if (\PHP_VERSION_ID < 70100 || \defined('HHVM_VERSION')) { - if (!$expectedException->getClass()) { - return true; - } - - return $expectedException->getClass()->isInstance($object); - } - - // Extract the type of the argument and handle different possibilities - $type = $expectedException->getType(); - - $isTypeUnion = true; - $types = []; - - switch (true) { - case $type === null: - break; - case $type instanceof \ReflectionNamedType: - $types = [$type]; - break; - case $type instanceof \ReflectionIntersectionType: - $isTypeUnion = false; - case $type instanceof \ReflectionUnionType; - $types = $type->getTypes(); - break; - default: - throw new \LogicException('Unexpected return value of ReflectionParameter::getType'); - } - - // If there is no type restriction, it matches - if (empty($types)) { + if (!$expectedException->getClass()) { return true; } - foreach ($types as $type) { - if (!$type instanceof \ReflectionNamedType) { - throw new \LogicException('This implementation does not support groups of intersection or union types'); - } - - // A named-type can be either a class-name or a built-in type like string, int, array, etc. - $matches = ($type->isBuiltin() && \gettype($object) === $type->getName()) - || (new \ReflectionClass($type->getName()))->isInstance($object); - - - // If we look for a single match (union), we can return early on match - // If we look for a full match (intersection), we can return early on mismatch - if ($matches) { - if ($isTypeUnion) { - return true; - } - } else { - if (!$isTypeUnion) { - return false; - } - } - } - - // If we look for a single match (union) and did not return early, we matched no type and are false - // If we look for a full match (intersection) and did not return early, we matched all types and are true - return $isTypeUnion ? false : true; + return $expectedException->getClass()->isInstance($object); } diff --git a/openml_OS/vendor/react/promise/src/functions_include.php b/openml_OS/vendor/react/promise/src/functions_include.php index bd0c54fd5..c71decbf9 100644 --- a/openml_OS/vendor/react/promise/src/functions_include.php +++ b/openml_OS/vendor/react/promise/src/functions_include.php @@ -1,5 +1,5 @@ enqueue($p); + + $cancellationQueue(); + + $this->assertTrue($p->cancelCalled); + } + + /** @test */ + public function ignoresSimpleCancellable() + { + $p = new SimpleTestCancellable(); + + $cancellationQueue = new CancellationQueue(); + $cancellationQueue->enqueue($p); + + $cancellationQueue(); + + $this->assertFalse($p->cancelCalled); + } + + /** @test */ + public function callsCancelOnPromisesEnqueuedBeforeStart() + { + $d1 = $this->getCancellableDeferred(); + $d2 = $this->getCancellableDeferred(); + + $cancellationQueue = new CancellationQueue(); + $cancellationQueue->enqueue($d1->promise()); + $cancellationQueue->enqueue($d2->promise()); + + $cancellationQueue(); + } + + /** @test */ + public function callsCancelOnPromisesEnqueuedAfterStart() + { + $d1 = $this->getCancellableDeferred(); + $d2 = $this->getCancellableDeferred(); + + $cancellationQueue = new CancellationQueue(); + + $cancellationQueue(); + + $cancellationQueue->enqueue($d2->promise()); + $cancellationQueue->enqueue($d1->promise()); + } + + /** @test */ + public function doesNotCallCancelTwiceWhenStartedTwice() + { + $d = $this->getCancellableDeferred(); + + $cancellationQueue = new CancellationQueue(); + $cancellationQueue->enqueue($d->promise()); + + $cancellationQueue(); + $cancellationQueue(); + } + + /** @test */ + public function rethrowsExceptionsThrownFromCancel() + { + $this->setExpectedException('\Exception', 'test'); + + $mock = $this + ->getMockBuilder('React\Promise\CancellablePromiseInterface') + ->getMock(); + $mock + ->expects($this->once()) + ->method('cancel') + ->will($this->throwException(new \Exception('test'))); + + $cancellationQueue = new CancellationQueue(); + $cancellationQueue->enqueue($mock); + + $cancellationQueue(); + } + + private function getCancellableDeferred() + { + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke'); + + return new Deferred($mock); + } +} diff --git a/openml_OS/vendor/react/promise/tests/DeferredTest.php b/openml_OS/vendor/react/promise/tests/DeferredTest.php new file mode 100644 index 000000000..8ee40b8a8 --- /dev/null +++ b/openml_OS/vendor/react/promise/tests/DeferredTest.php @@ -0,0 +1,112 @@ + [$d, 'promise'], + 'resolve' => [$d, 'resolve'], + 'reject' => [$d, 'reject'], + 'notify' => [$d, 'progress'], + 'settle' => [$d, 'resolve'], + ]); + } + + /** @test */ + public function progressIsAnAliasForNotify() + { + $deferred = new Deferred(); + + $sentinel = new \stdClass(); + + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($sentinel); + + $deferred->promise() + ->then($this->expectCallableNever(), $this->expectCallableNever(), $mock); + + $deferred->progress($sentinel); + } + + /** @test */ + public function shouldRejectWithoutCreatingGarbageCyclesIfCancellerRejectsWithException() + { + gc_collect_cycles(); + $deferred = new Deferred(function ($resolve, $reject) { + $reject(new \Exception('foo')); + }); + $deferred->promise()->cancel(); + unset($deferred); + + $this->assertSame(0, gc_collect_cycles()); + } + + /** @test */ + public function shouldRejectWithoutCreatingGarbageCyclesIfParentCancellerRejectsWithException() + { + gc_collect_cycles(); + $deferred = new Deferred(function ($resolve, $reject) { + $reject(new \Exception('foo')); + }); + $deferred->promise()->then()->cancel(); + unset($deferred); + + $this->assertSame(0, gc_collect_cycles()); + } + + /** @test */ + public function shouldRejectWithoutCreatingGarbageCyclesIfCancellerHoldsReferenceAndExplicitlyRejectWithException() + { + gc_collect_cycles(); + $deferred = new Deferred(function () use (&$deferred) { }); + $deferred->reject(new \Exception('foo')); + unset($deferred); + + $this->assertSame(0, gc_collect_cycles()); + } + + /** @test */ + public function shouldNotLeaveGarbageCyclesWhenRemovingLastReferenceToPendingDeferred() + { + gc_collect_cycles(); + $deferred = new Deferred(); + $deferred->promise(); + unset($deferred); + + $this->assertSame(0, gc_collect_cycles()); + } + + /** @test */ + public function shouldNotLeaveGarbageCyclesWhenRemovingLastReferenceToPendingDeferredWithUnusedCanceller() + { + gc_collect_cycles(); + $deferred = new Deferred(function () { }); + $deferred->promise(); + unset($deferred); + + $this->assertSame(0, gc_collect_cycles()); + } + + /** @test */ + public function shouldNotLeaveGarbageCyclesWhenRemovingLastReferenceToPendingDeferredWithNoopCanceller() + { + gc_collect_cycles(); + $deferred = new Deferred(function () { }); + $deferred->promise()->cancel(); + unset($deferred); + + $this->assertSame(0, gc_collect_cycles()); + } +} diff --git a/openml_OS/vendor/react/promise/tests/FulfilledPromiseTest.php b/openml_OS/vendor/react/promise/tests/FulfilledPromiseTest.php new file mode 100644 index 000000000..f5a2da803 --- /dev/null +++ b/openml_OS/vendor/react/promise/tests/FulfilledPromiseTest.php @@ -0,0 +1,76 @@ + function () use (&$promise) { + if (!$promise) { + throw new \LogicException('FulfilledPromise must be resolved before obtaining the promise'); + } + + return $promise; + }, + 'resolve' => function ($value = null) use (&$promise) { + if (!$promise) { + $promise = new FulfilledPromise($value); + } + }, + 'reject' => function () { + throw new \LogicException('You cannot call reject() for React\Promise\FulfilledPromise'); + }, + 'notify' => function () { + // no-op + }, + 'settle' => function ($value = null) use (&$promise) { + if (!$promise) { + $promise = new FulfilledPromise($value); + } + }, + ]); + } + + /** @test */ + public function shouldThrowExceptionIfConstructedWithAPromise() + { + $this->setExpectedException('\InvalidArgumentException'); + + return new FulfilledPromise(new FulfilledPromise()); + } + + /** @test */ + public function shouldNotLeaveGarbageCyclesWhenRemovingLastReferenceToFulfilledPromiseWithAlwaysFollowers() + { + gc_collect_cycles(); + $promise = new FulfilledPromise(1); + $promise->always(function () { + throw new \RuntimeException(); + }); + unset($promise); + + $this->assertSame(0, gc_collect_cycles()); + } + + /** @test */ + public function shouldNotLeaveGarbageCyclesWhenRemovingLastReferenceToFulfilledPromiseWithThenFollowers() + { + gc_collect_cycles(); + $promise = new FulfilledPromise(1); + $promise = $promise->then(function () { + throw new \RuntimeException(); + }); + unset($promise); + + $this->assertSame(0, gc_collect_cycles()); + } +} diff --git a/openml_OS/vendor/react/promise/tests/FunctionAllTest.php b/openml_OS/vendor/react/promise/tests/FunctionAllTest.php new file mode 100644 index 000000000..74c1d7c31 --- /dev/null +++ b/openml_OS/vendor/react/promise/tests/FunctionAllTest.php @@ -0,0 +1,114 @@ +createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo([])); + + all([]) + ->then($mock); + } + + /** @test */ + public function shouldResolveValuesArray() + { + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo([1, 2, 3])); + + all([1, 2, 3]) + ->then($mock); + } + + /** @test */ + public function shouldResolvePromisesArray() + { + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo([1, 2, 3])); + + all([resolve(1), resolve(2), resolve(3)]) + ->then($mock); + } + + /** @test */ + public function shouldResolveSparseArrayInput() + { + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo([null, 1, null, 1, 1])); + + all([null, 1, null, 1, 1]) + ->then($mock); + } + + /** @test */ + public function shouldRejectIfAnyInputPromiseRejects() + { + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo(2)); + + all([resolve(1), reject(2), resolve(3)]) + ->then($this->expectCallableNever(), $mock); + } + + /** @test */ + public function shouldAcceptAPromiseForAnArray() + { + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo([1, 2, 3])); + + all(resolve([1, 2, 3])) + ->then($mock); + } + + /** @test */ + public function shouldResolveToEmptyArrayWhenInputPromiseDoesNotResolveToArray() + { + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo([])); + + all(resolve(1)) + ->then($mock); + } + + /** @test */ + public function shouldPreserveTheOrderOfArrayWhenResolvingAsyncPromises() + { + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo([1, 2, 3])); + + $deferred = new Deferred(); + + all([resolve(1), $deferred->promise(), resolve(3)]) + ->then($mock); + + $deferred->resolve(2); + } +} diff --git a/openml_OS/vendor/react/promise/tests/FunctionAnyTest.php b/openml_OS/vendor/react/promise/tests/FunctionAnyTest.php new file mode 100644 index 000000000..140b55122 --- /dev/null +++ b/openml_OS/vendor/react/promise/tests/FunctionAnyTest.php @@ -0,0 +1,204 @@ +createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with( + $this->callback(function($exception){ + return $exception instanceof LengthException && + 'Input array must contain at least 1 item but contains only 0 items.' === $exception->getMessage(); + }) + ); + + any([]) + ->then($this->expectCallableNever(), $mock); + } + + /** @test */ + public function shouldResolveToNullWithNonArrayInput() + { + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo(null)); + + any(null) + ->then($mock); + } + + /** @test */ + public function shouldResolveWithAnInputValue() + { + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo(1)); + + any([1, 2, 3]) + ->then($mock); + } + + /** @test */ + public function shouldResolveWithAPromisedInputValue() + { + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo(1)); + + any([resolve(1), resolve(2), resolve(3)]) + ->then($mock); + } + + /** @test */ + public function shouldRejectWithAllRejectedInputValuesIfAllInputsAreRejected() + { + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo([0 => 1, 1 => 2, 2 => 3])); + + any([reject(1), reject(2), reject(3)]) + ->then($this->expectCallableNever(), $mock); + } + + /** @test */ + public function shouldResolveWhenFirstInputPromiseResolves() + { + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo(1)); + + any([resolve(1), reject(2), reject(3)]) + ->then($mock); + } + + /** @test */ + public function shouldAcceptAPromiseForAnArray() + { + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo(1)); + + any(resolve([1, 2, 3])) + ->then($mock); + } + + /** @test */ + public function shouldResolveToNullArrayWhenInputPromiseDoesNotResolveToArray() + { + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo(null)); + + any(resolve(1)) + ->then($mock); + } + + /** @test */ + public function shouldNotRelyOnArryIndexesWhenUnwrappingToASingleResolutionValue() + { + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo(2)); + + $d1 = new Deferred(); + $d2 = new Deferred(); + + any(['abc' => $d1->promise(), 1 => $d2->promise()]) + ->then($mock); + + $d2->resolve(2); + $d1->resolve(1); + } + + /** @test */ + public function shouldRejectWhenInputPromiseRejects() + { + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo(null)); + + any(reject()) + ->then($this->expectCallableNever(), $mock); + } + + /** @test */ + public function shouldCancelInputPromise() + { + $mock = $this + ->getMockBuilder('React\Promise\CancellablePromiseInterface') + ->getMock(); + $mock + ->expects($this->once()) + ->method('cancel'); + + any($mock)->cancel(); + } + + /** @test */ + public function shouldCancelInputArrayPromises() + { + $mock1 = $this + ->getMockBuilder('React\Promise\CancellablePromiseInterface') + ->getMock(); + $mock1 + ->expects($this->once()) + ->method('cancel'); + + $mock2 = $this + ->getMockBuilder('React\Promise\CancellablePromiseInterface') + ->getMock(); + $mock2 + ->expects($this->once()) + ->method('cancel'); + + any([$mock1, $mock2])->cancel(); + } + + /** @test */ + public function shouldNotCancelOtherPendingInputArrayPromisesIfOnePromiseFulfills() + { + $mock = $this->createCallableMock(); + $mock + ->expects($this->never()) + ->method('__invoke'); + + + $deferred = New Deferred($mock); + $deferred->resolve(); + + $mock2 = $this + ->getMockBuilder('React\Promise\CancellablePromiseInterface') + ->getMock(); + $mock2 + ->expects($this->never()) + ->method('cancel'); + + some([$deferred->promise(), $mock2], 1)->cancel(); + } +} diff --git a/openml_OS/vendor/react/promise/tests/FunctionCheckTypehintTest.php b/openml_OS/vendor/react/promise/tests/FunctionCheckTypehintTest.php new file mode 100644 index 000000000..8449bc1f7 --- /dev/null +++ b/openml_OS/vendor/react/promise/tests/FunctionCheckTypehintTest.php @@ -0,0 +1,118 @@ +assertTrue(_checkTypehint(function (\InvalidArgumentException $e) { + }, new \InvalidArgumentException())); + $this->assertfalse(_checkTypehint(function (\InvalidArgumentException $e) { + }, new \Exception())); + } + + /** @test */ + public function shouldAcceptFunctionStringCallbackWithTypehint() + { + $this->assertTrue(_checkTypehint('React\Promise\testCallbackWithTypehint', new \InvalidArgumentException())); + $this->assertfalse(_checkTypehint('React\Promise\testCallbackWithTypehint', new \Exception())); + } + + /** @test */ + public function shouldAcceptInvokableObjectCallbackWithTypehint() + { + $this->assertTrue(_checkTypehint(new TestCallbackWithTypehintClass(), new \InvalidArgumentException())); + $this->assertfalse(_checkTypehint(new TestCallbackWithTypehintClass(), new \Exception())); + } + + /** @test */ + public function shouldAcceptObjectMethodCallbackWithTypehint() + { + $this->assertTrue(_checkTypehint([new TestCallbackWithTypehintClass(), 'testCallback'], new \InvalidArgumentException())); + $this->assertfalse(_checkTypehint([new TestCallbackWithTypehintClass(), 'testCallback'], new \Exception())); + } + + /** @test */ + public function shouldAcceptStaticClassCallbackWithTypehint() + { + $this->assertTrue(_checkTypehint(['React\Promise\TestCallbackWithTypehintClass', 'testCallbackStatic'], new \InvalidArgumentException())); + $this->assertfalse(_checkTypehint(['React\Promise\TestCallbackWithTypehintClass', 'testCallbackStatic'], new \Exception())); + } + + /** @test */ + public function shouldAcceptClosureCallbackWithoutTypehint() + { + $this->assertTrue(_checkTypehint(function (\InvalidArgumentException $e) { + }, new \InvalidArgumentException())); + } + + /** @test */ + public function shouldAcceptFunctionStringCallbackWithoutTypehint() + { + $this->assertTrue(_checkTypehint('React\Promise\testCallbackWithoutTypehint', new \InvalidArgumentException())); + } + + /** @test */ + public function shouldAcceptInvokableObjectCallbackWithoutTypehint() + { + $this->assertTrue(_checkTypehint(new TestCallbackWithoutTypehintClass(), new \InvalidArgumentException())); + } + + /** @test */ + public function shouldAcceptObjectMethodCallbackWithoutTypehint() + { + $this->assertTrue(_checkTypehint([new TestCallbackWithoutTypehintClass(), 'testCallback'], new \InvalidArgumentException())); + } + + /** @test */ + public function shouldAcceptStaticClassCallbackWithoutTypehint() + { + $this->assertTrue(_checkTypehint(['React\Promise\TestCallbackWithoutTypehintClass', 'testCallbackStatic'], new \InvalidArgumentException())); + } +} + +function testCallbackWithTypehint(\InvalidArgumentException $e) +{ +} + +function testCallbackWithoutTypehint() +{ +} + +class TestCallbackWithTypehintClass +{ + public function __invoke(\InvalidArgumentException $e) + { + + } + + public function testCallback(\InvalidArgumentException $e) + { + + } + + public static function testCallbackStatic(\InvalidArgumentException $e) + { + + } +} + +class TestCallbackWithoutTypehintClass +{ + public function __invoke() + { + + } + + public function testCallback() + { + + } + + public static function testCallbackStatic() + { + + } +} diff --git a/openml_OS/vendor/react/promise/tests/FunctionMapTest.php b/openml_OS/vendor/react/promise/tests/FunctionMapTest.php new file mode 100644 index 000000000..1ea560a1f --- /dev/null +++ b/openml_OS/vendor/react/promise/tests/FunctionMapTest.php @@ -0,0 +1,198 @@ +createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo([2, 4, 6])); + + map( + [1, 2, 3], + $this->mapper() + )->then($mock); + } + + /** @test */ + public function shouldMapInputPromisesArray() + { + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo([2, 4, 6])); + + map( + [resolve(1), resolve(2), resolve(3)], + $this->mapper() + )->then($mock); + } + + /** @test */ + public function shouldMapMixedInputArray() + { + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo([2, 4, 6])); + + map( + [1, resolve(2), 3], + $this->mapper() + )->then($mock); + } + + /** @test */ + public function shouldMapInputWhenMapperReturnsAPromise() + { + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo([2, 4, 6])); + + map( + [1, 2, 3], + $this->promiseMapper() + )->then($mock); + } + + /** @test */ + public function shouldAcceptAPromiseForAnArray() + { + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo([2, 4, 6])); + + map( + resolve([1, resolve(2), 3]), + $this->mapper() + )->then($mock); + } + + /** @test */ + public function shouldResolveToEmptyArrayWhenInputPromiseDoesNotResolveToArray() + { + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo([])); + + map( + resolve(1), + $this->mapper() + )->then($mock); + } + + /** @test */ + public function shouldPreserveTheOrderOfArrayWhenResolvingAsyncPromises() + { + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo([2, 4, 6])); + + $deferred = new Deferred(); + + map( + [resolve(1), $deferred->promise(), resolve(3)], + $this->mapper() + )->then($mock); + + $deferred->resolve(2); + } + + /** @test */ + public function shouldRejectWhenInputContainsRejection() + { + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo(2)); + + map( + [resolve(1), reject(2), resolve(3)], + $this->mapper() + )->then($this->expectCallableNever(), $mock); + } + + /** @test */ + public function shouldRejectWhenInputPromiseRejects() + { + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo(null)); + + map( + reject(), + $this->mapper() + )->then($this->expectCallableNever(), $mock); + } + + /** @test */ + public function shouldCancelInputPromise() + { + $mock = $this + ->getMockBuilder('React\Promise\CancellablePromiseInterface') + ->getMock(); + $mock + ->expects($this->once()) + ->method('cancel'); + + map( + $mock, + $this->mapper() + )->cancel(); + } + + /** @test */ + public function shouldCancelInputArrayPromises() + { + $mock1 = $this + ->getMockBuilder('React\Promise\CancellablePromiseInterface') + ->getMock(); + $mock1 + ->expects($this->once()) + ->method('cancel'); + + $mock2 = $this + ->getMockBuilder('React\Promise\CancellablePromiseInterface') + ->getMock(); + $mock2 + ->expects($this->once()) + ->method('cancel'); + + map( + [$mock1, $mock2], + $this->mapper() + )->cancel(); + } +} diff --git a/openml_OS/vendor/react/promise/tests/FunctionRaceTest.php b/openml_OS/vendor/react/promise/tests/FunctionRaceTest.php new file mode 100644 index 000000000..83770ec20 --- /dev/null +++ b/openml_OS/vendor/react/promise/tests/FunctionRaceTest.php @@ -0,0 +1,211 @@ +createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo(null)); + + race( + [] + )->then($mock); + } + + /** @test */ + public function shouldResolveValuesArray() + { + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo(1)); + + race( + [1, 2, 3] + )->then($mock); + } + + /** @test */ + public function shouldResolvePromisesArray() + { + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo(2)); + + $d1 = new Deferred(); + $d2 = new Deferred(); + $d3 = new Deferred(); + + race( + [$d1->promise(), $d2->promise(), $d3->promise()] + )->then($mock); + + $d2->resolve(2); + + $d1->resolve(1); + $d3->resolve(3); + } + + /** @test */ + public function shouldResolveSparseArrayInput() + { + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo(null)); + + race( + [null, 1, null, 2, 3] + )->then($mock); + } + + /** @test */ + public function shouldRejectIfFirstSettledPromiseRejects() + { + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo(2)); + + $d1 = new Deferred(); + $d2 = new Deferred(); + $d3 = new Deferred(); + + race( + [$d1->promise(), $d2->promise(), $d3->promise()] + )->then($this->expectCallableNever(), $mock); + + $d2->reject(2); + + $d1->resolve(1); + $d3->resolve(3); + } + + /** @test */ + public function shouldAcceptAPromiseForAnArray() + { + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo(1)); + + race( + resolve([1, 2, 3]) + )->then($mock); + } + + /** @test */ + public function shouldResolveToNullWhenInputPromiseDoesNotResolveToArray() + { + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo(null)); + + race( + resolve(1) + )->then($mock); + } + + /** @test */ + public function shouldRejectWhenInputPromiseRejects() + { + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo(null)); + + race( + reject() + )->then($this->expectCallableNever(), $mock); + } + + /** @test */ + public function shouldCancelInputPromise() + { + $mock = $this + ->getMockBuilder('React\Promise\CancellablePromiseInterface') + ->getMock(); + $mock + ->expects($this->once()) + ->method('cancel'); + + race($mock)->cancel(); + } + + /** @test */ + public function shouldCancelInputArrayPromises() + { + $mock1 = $this + ->getMockBuilder('React\Promise\CancellablePromiseInterface') + ->getMock(); + $mock1 + ->expects($this->once()) + ->method('cancel'); + + $mock2 = $this + ->getMockBuilder('React\Promise\CancellablePromiseInterface') + ->getMock(); + $mock2 + ->expects($this->once()) + ->method('cancel'); + + race([$mock1, $mock2])->cancel(); + } + + /** @test */ + public function shouldNotCancelOtherPendingInputArrayPromisesIfOnePromiseFulfills() + { + $mock = $this->createCallableMock(); + $mock + ->expects($this->never()) + ->method('__invoke'); + + $deferred = New Deferred($mock); + $deferred->resolve(); + + $mock2 = $this + ->getMockBuilder('React\Promise\CancellablePromiseInterface') + ->getMock(); + $mock2 + ->expects($this->never()) + ->method('cancel'); + + race([$deferred->promise(), $mock2])->cancel(); + } + + /** @test */ + public function shouldNotCancelOtherPendingInputArrayPromisesIfOnePromiseRejects() + { + $mock = $this->createCallableMock(); + $mock + ->expects($this->never()) + ->method('__invoke'); + + $deferred = New Deferred($mock); + $deferred->reject(); + + $mock2 = $this + ->getMockBuilder('React\Promise\CancellablePromiseInterface') + ->getMock(); + $mock2 + ->expects($this->never()) + ->method('cancel'); + + race([$deferred->promise(), $mock2])->cancel(); + } +} diff --git a/openml_OS/vendor/react/promise/tests/FunctionReduceTest.php b/openml_OS/vendor/react/promise/tests/FunctionReduceTest.php new file mode 100644 index 000000000..8b43a8787 --- /dev/null +++ b/openml_OS/vendor/react/promise/tests/FunctionReduceTest.php @@ -0,0 +1,347 @@ +createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo(6)); + + reduce( + [1, 2, 3], + $this->plus() + )->then($mock); + } + + /** @test */ + public function shouldReduceValuesWithInitialValue() + { + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo(7)); + + reduce( + [1, 2, 3], + $this->plus(), + 1 + )->then($mock); + } + + /** @test */ + public function shouldReduceValuesWithInitialPromise() + { + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo(7)); + + reduce( + [1, 2, 3], + $this->plus(), + resolve(1) + )->then($mock); + } + + /** @test */ + public function shouldReducePromisedValuesWithoutInitialValue() + { + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo(6)); + + reduce( + [resolve(1), resolve(2), resolve(3)], + $this->plus() + )->then($mock); + } + + /** @test */ + public function shouldReducePromisedValuesWithInitialValue() + { + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo(7)); + + reduce( + [resolve(1), resolve(2), resolve(3)], + $this->plus(), + 1 + )->then($mock); + } + + /** @test */ + public function shouldReducePromisedValuesWithInitialPromise() + { + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo(7)); + + reduce( + [resolve(1), resolve(2), resolve(3)], + $this->plus(), + resolve(1) + )->then($mock); + } + + /** @test */ + public function shouldReduceEmptyInputWithInitialValue() + { + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo(1)); + + reduce( + [], + $this->plus(), + 1 + )->then($mock); + } + + /** @test */ + public function shouldReduceEmptyInputWithInitialPromise() + { + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo(1)); + + reduce( + [], + $this->plus(), + resolve(1) + )->then($mock); + } + + /** @test */ + public function shouldRejectWhenInputContainsRejection() + { + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo(2)); + + reduce( + [resolve(1), reject(2), resolve(3)], + $this->plus(), + resolve(1) + )->then($this->expectCallableNever(), $mock); + } + + /** @test */ + public function shouldResolveWithNullWhenInputIsEmptyAndNoInitialValueOrPromiseProvided() + { + // Note: this is different from when.js's behavior! + // In when.reduce(), this rejects with a TypeError exception (following + // JavaScript's [].reduce behavior. + // We're following PHP's array_reduce behavior and resolve with NULL. + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo(null)); + + reduce( + [], + $this->plus() + )->then($mock); + } + + /** @test */ + public function shouldAllowSparseArrayInputWithoutInitialValue() + { + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo(3)); + + reduce( + [null, null, 1, null, 1, 1], + $this->plus() + )->then($mock); + } + + /** @test */ + public function shouldAllowSparseArrayInputWithInitialValue() + { + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo(4)); + + reduce( + [null, null, 1, null, 1, 1], + $this->plus(), + 1 + )->then($mock); + } + + /** @test */ + public function shouldReduceInInputOrder() + { + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo('123')); + + reduce( + [1, 2, 3], + $this->append(), + '' + )->then($mock); + } + + /** @test */ + public function shouldAcceptAPromiseForAnArray() + { + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo('123')); + + reduce( + resolve([1, 2, 3]), + $this->append(), + '' + )->then($mock); + } + + /** @test */ + public function shouldResolveToInitialValueWhenInputPromiseDoesNotResolveToAnArray() + { + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo(1)); + + reduce( + resolve(1), + $this->plus(), + 1 + )->then($mock); + } + + /** @test */ + public function shouldProvideCorrectBasisValue() + { + $insertIntoArray = function ($arr, $val, $i) { + $arr[$i] = $val; + + return $arr; + }; + + $d1 = new Deferred(); + $d2 = new Deferred(); + $d3 = new Deferred(); + + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo([1, 2, 3])); + + reduce( + [$d1->promise(), $d2->promise(), $d3->promise()], + $insertIntoArray, + [] + )->then($mock); + + $d3->resolve(3); + $d1->resolve(1); + $d2->resolve(2); + } + + /** @test */ + public function shouldRejectWhenInputPromiseRejects() + { + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo(null)); + + reduce( + reject(), + $this->plus(), + 1 + )->then($this->expectCallableNever(), $mock); + } + + /** @test */ + public function shouldCancelInputPromise() + { + $mock = $this + ->getMockBuilder('React\Promise\CancellablePromiseInterface') + ->getMock(); + $mock + ->expects($this->once()) + ->method('cancel'); + + reduce( + $mock, + $this->plus(), + 1 + )->cancel(); + } + + /** @test */ + public function shouldCancelInputArrayPromises() + { + $mock1 = $this + ->getMockBuilder('React\Promise\CancellablePromiseInterface') + ->getMock(); + $mock1 + ->expects($this->once()) + ->method('cancel'); + + $mock2 = $this + ->getMockBuilder('React\Promise\CancellablePromiseInterface') + ->getMock(); + $mock2 + ->expects($this->once()) + ->method('cancel'); + + reduce( + [$mock1, $mock2], + $this->plus(), + 1 + )->cancel(); + } +} diff --git a/openml_OS/vendor/react/promise/tests/FunctionRejectTest.php b/openml_OS/vendor/react/promise/tests/FunctionRejectTest.php new file mode 100644 index 000000000..84b8ec6a0 --- /dev/null +++ b/openml_OS/vendor/react/promise/tests/FunctionRejectTest.php @@ -0,0 +1,64 @@ +createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo($expected)); + + reject($expected) + ->then( + $this->expectCallableNever(), + $mock + ); + } + + /** @test */ + public function shouldRejectAFulfilledPromise() + { + $expected = 123; + + $resolved = new FulfilledPromise($expected); + + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo($expected)); + + reject($resolved) + ->then( + $this->expectCallableNever(), + $mock + ); + } + + /** @test */ + public function shouldRejectARejectedPromise() + { + $expected = 123; + + $resolved = new RejectedPromise($expected); + + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo($expected)); + + reject($resolved) + ->then( + $this->expectCallableNever(), + $mock + ); + } +} diff --git a/openml_OS/vendor/react/promise/tests/FunctionResolveTest.php b/openml_OS/vendor/react/promise/tests/FunctionResolveTest.php new file mode 100644 index 000000000..53126bc02 --- /dev/null +++ b/openml_OS/vendor/react/promise/tests/FunctionResolveTest.php @@ -0,0 +1,171 @@ +createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo($expected)); + + resolve($expected) + ->then( + $mock, + $this->expectCallableNever() + ); + } + + /** @test */ + public function shouldResolveAFulfilledPromise() + { + $expected = 123; + + $resolved = new FulfilledPromise($expected); + + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo($expected)); + + resolve($resolved) + ->then( + $mock, + $this->expectCallableNever() + ); + } + + /** @test */ + public function shouldResolveAThenable() + { + $thenable = new SimpleFulfilledTestThenable(); + + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo('foo')); + + resolve($thenable) + ->then( + $mock, + $this->expectCallableNever() + ); + } + + /** @test */ + public function shouldResolveACancellableThenable() + { + $thenable = new SimpleTestCancellableThenable(); + + $promise = resolve($thenable); + $promise->cancel(); + + $this->assertTrue($thenable->cancelCalled); + } + + /** @test */ + public function shouldRejectARejectedPromise() + { + $expected = 123; + + $resolved = new RejectedPromise($expected); + + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo($expected)); + + resolve($resolved) + ->then( + $this->expectCallableNever(), + $mock + ); + } + + /** @test */ + public function shouldSupportDeepNestingInPromiseChains() + { + $d = new Deferred(); + $d->resolve(false); + + $result = resolve(resolve($d->promise()->then(function ($val) { + $d = new Deferred(); + $d->resolve($val); + + $identity = function ($val) { + return $val; + }; + + return resolve($d->promise()->then($identity))->then( + function ($val) { + return !$val; + } + ); + }))); + + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo(true)); + + $result->then($mock); + } + + /** @test */ + public function shouldSupportVeryDeepNestedPromises() + { + $deferreds = []; + + // @TODO Increase count once global-queue is merged + for ($i = 0; $i < 10; $i++) { + $deferreds[] = $d = new Deferred(); + $p = $d->promise(); + + $last = $p; + for ($j = 0; $j < 10; $j++) { + $last = $last->then(function($result) { + return $result; + }); + } + } + + $p = null; + foreach ($deferreds as $d) { + if ($p) { + $d->resolve($p); + } + + $p = $d->promise(); + } + + $deferreds[0]->resolve(true); + + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo(true)); + + $deferreds[0]->promise()->then($mock); + } + + /** @test */ + public function returnsExtendePromiseForSimplePromise() + { + $promise = $this + ->getMockBuilder('React\Promise\PromiseInterface') + ->getMock(); + + $this->assertInstanceOf('React\Promise\ExtendedPromiseInterface', resolve($promise)); + } +} diff --git a/openml_OS/vendor/react/promise/tests/FunctionSomeTest.php b/openml_OS/vendor/react/promise/tests/FunctionSomeTest.php new file mode 100644 index 000000000..276b54bb2 --- /dev/null +++ b/openml_OS/vendor/react/promise/tests/FunctionSomeTest.php @@ -0,0 +1,258 @@ +createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with( + $this->callback(function($exception){ + return $exception instanceof LengthException && + 'Input array must contain at least 1 item but contains only 0 items.' === $exception->getMessage(); + }) + ); + + some( + [], + 1 + )->then($this->expectCallableNever(), $mock); + } + + /** @test */ + public function shouldRejectWithLengthExceptionWithInputArrayContainingNotEnoughItems() + { + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with( + $this->callback(function($exception){ + return $exception instanceof LengthException && + 'Input array must contain at least 4 items but contains only 3 items.' === $exception->getMessage(); + }) + ); + + some( + [1, 2, 3], + 4 + )->then($this->expectCallableNever(), $mock); + } + + /** @test */ + public function shouldResolveToEmptyArrayWithNonArrayInput() + { + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo([])); + + some( + null, + 1 + )->then($mock); + } + + /** @test */ + public function shouldResolveValuesArray() + { + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo([1, 2])); + + some( + [1, 2, 3], + 2 + )->then($mock); + } + + /** @test */ + public function shouldResolvePromisesArray() + { + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo([1, 2])); + + some( + [resolve(1), resolve(2), resolve(3)], + 2 + )->then($mock); + } + + /** @test */ + public function shouldResolveSparseArrayInput() + { + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo([null, 1])); + + some( + [null, 1, null, 2, 3], + 2 + )->then($mock); + } + + /** @test */ + public function shouldRejectIfAnyInputPromiseRejectsBeforeDesiredNumberOfInputsAreResolved() + { + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo([1 => 2, 2 => 3])); + + some( + [resolve(1), reject(2), reject(3)], + 2 + )->then($this->expectCallableNever(), $mock); + } + + /** @test */ + public function shouldAcceptAPromiseForAnArray() + { + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo([1, 2])); + + some( + resolve([1, 2, 3]), + 2 + )->then($mock); + } + + /** @test */ + public function shouldResolveWithEmptyArrayIfHowManyIsLessThanOne() + { + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo([])); + + some( + [1], + 0 + )->then($mock); + } + + /** @test */ + public function shouldResolveToEmptyArrayWhenInputPromiseDoesNotResolveToArray() + { + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo([])); + + some( + resolve(1), + 1 + )->then($mock); + } + + /** @test */ + public function shouldRejectWhenInputPromiseRejects() + { + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo(null)); + + some( + reject(), + 1 + )->then($this->expectCallableNever(), $mock); + } + + /** @test */ + public function shouldCancelInputPromise() + { + $mock = $this + ->getMockBuilder('React\Promise\CancellablePromiseInterface') + ->getMock(); + $mock + ->expects($this->once()) + ->method('cancel'); + + some($mock, 1)->cancel(); + } + + /** @test */ + public function shouldCancelInputArrayPromises() + { + $mock1 = $this + ->getMockBuilder('React\Promise\CancellablePromiseInterface') + ->getMock(); + $mock1 + ->expects($this->once()) + ->method('cancel'); + + $mock2 = $this + ->getMockBuilder('React\Promise\CancellablePromiseInterface') + ->getMock(); + $mock2 + ->expects($this->once()) + ->method('cancel'); + + some([$mock1, $mock2], 1)->cancel(); + } + + /** @test */ + public function shouldNotCancelOtherPendingInputArrayPromisesIfEnoughPromisesFulfill() + { + $mock = $this->createCallableMock(); + $mock + ->expects($this->never()) + ->method('__invoke'); + + $deferred = New Deferred($mock); + $deferred->resolve(); + + $mock2 = $this + ->getMockBuilder('React\Promise\CancellablePromiseInterface') + ->getMock(); + $mock2 + ->expects($this->never()) + ->method('cancel'); + + some([$deferred->promise(), $mock2], 1); + } + + /** @test */ + public function shouldNotCancelOtherPendingInputArrayPromisesIfEnoughPromisesReject() + { + $mock = $this->createCallableMock(); + $mock + ->expects($this->never()) + ->method('__invoke'); + + $deferred = New Deferred($mock); + $deferred->reject(); + + $mock2 = $this + ->getMockBuilder('React\Promise\CancellablePromiseInterface') + ->getMock(); + $mock2 + ->expects($this->never()) + ->method('cancel'); + + some([$deferred->promise(), $mock2], 2); + } +} diff --git a/openml_OS/vendor/react/promise/tests/LazyPromiseTest.php b/openml_OS/vendor/react/promise/tests/LazyPromiseTest.php new file mode 100644 index 000000000..b6308818a --- /dev/null +++ b/openml_OS/vendor/react/promise/tests/LazyPromiseTest.php @@ -0,0 +1,107 @@ +promise(); + }; + + return new CallbackPromiseAdapter([ + 'promise' => function () use ($factory) { + return new LazyPromise($factory); + }, + 'resolve' => [$d, 'resolve'], + 'reject' => [$d, 'reject'], + 'notify' => [$d, 'progress'], + 'settle' => [$d, 'resolve'], + ]); + } + + /** @test */ + public function shouldNotCallFactoryIfThenIsNotInvoked() + { + $factory = $this->createCallableMock(); + $factory + ->expects($this->never()) + ->method('__invoke'); + + new LazyPromise($factory); + } + + /** @test */ + public function shouldCallFactoryIfThenIsInvoked() + { + $factory = $this->createCallableMock(); + $factory + ->expects($this->once()) + ->method('__invoke'); + + $p = new LazyPromise($factory); + $p->then(); + } + + /** @test */ + public function shouldReturnPromiseFromFactory() + { + $factory = $this->createCallableMock(); + $factory + ->expects($this->once()) + ->method('__invoke') + ->will($this->returnValue(new FulfilledPromise(1))); + + $onFulfilled = $this->createCallableMock(); + $onFulfilled + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo(1)); + + $p = new LazyPromise($factory); + + $p->then($onFulfilled); + } + + /** @test */ + public function shouldReturnPromiseIfFactoryReturnsNull() + { + $factory = $this->createCallableMock(); + $factory + ->expects($this->once()) + ->method('__invoke') + ->will($this->returnValue(null)); + + $p = new LazyPromise($factory); + $this->assertInstanceOf('React\\Promise\\PromiseInterface', $p->then()); + } + + /** @test */ + public function shouldReturnRejectedPromiseIfFactoryThrowsException() + { + $exception = new \Exception(); + + $factory = $this->createCallableMock(); + $factory + ->expects($this->once()) + ->method('__invoke') + ->will($this->throwException($exception)); + + $onRejected = $this->createCallableMock(); + $onRejected + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo($exception)); + + $p = new LazyPromise($factory); + + $p->then($this->expectCallableNever(), $onRejected); + } +} diff --git a/openml_OS/vendor/react/promise/tests/PromiseAdapter/CallbackPromiseAdapter.php b/openml_OS/vendor/react/promise/tests/PromiseAdapter/CallbackPromiseAdapter.php new file mode 100644 index 000000000..bdedf4658 --- /dev/null +++ b/openml_OS/vendor/react/promise/tests/PromiseAdapter/CallbackPromiseAdapter.php @@ -0,0 +1,40 @@ +callbacks = $callbacks; + } + + public function promise() + { + return call_user_func_array($this->callbacks['promise'], func_get_args()); + } + + public function resolve() + { + return call_user_func_array($this->callbacks['resolve'], func_get_args()); + } + + public function reject() + { + return call_user_func_array($this->callbacks['reject'], func_get_args()); + } + + public function notify() + { + return call_user_func_array($this->callbacks['notify'], func_get_args()); + } + + public function settle() + { + return call_user_func_array($this->callbacks['settle'], func_get_args()); + } +} diff --git a/openml_OS/vendor/react/promise/tests/PromiseAdapter/PromiseAdapterInterface.php b/openml_OS/vendor/react/promise/tests/PromiseAdapter/PromiseAdapterInterface.php new file mode 100644 index 000000000..9157cd4ea --- /dev/null +++ b/openml_OS/vendor/react/promise/tests/PromiseAdapter/PromiseAdapterInterface.php @@ -0,0 +1,14 @@ + function () use ($promise) { + return $promise; + }, + 'resolve' => $resolveCallback, + 'reject' => $rejectCallback, + 'notify' => $progressCallback, + 'settle' => $resolveCallback, + ]); + } + + /** @test */ + public function shouldRejectIfResolverThrowsException() + { + $exception = new \Exception('foo'); + + $promise = new Promise(function () use ($exception) { + throw $exception; + }); + + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo($exception)); + + $promise + ->then($this->expectCallableNever(), $mock); + } + + /** @test */ + public function shouldResolveWithoutCreatingGarbageCyclesIfResolverResolvesWithException() + { + gc_collect_cycles(); + $promise = new Promise(function ($resolve) { + $resolve(new \Exception('foo')); + }); + unset($promise); + + $this->assertSame(0, gc_collect_cycles()); + } + + /** @test */ + public function shouldRejectWithoutCreatingGarbageCyclesIfResolverThrowsExceptionWithoutResolver() + { + gc_collect_cycles(); + $promise = new Promise(function () { + throw new \Exception('foo'); + }); + unset($promise); + + $this->assertSame(0, gc_collect_cycles()); + } + + /** @test */ + public function shouldRejectWithoutCreatingGarbageCyclesIfResolverRejectsWithException() + { + gc_collect_cycles(); + $promise = new Promise(function ($resolve, $reject) { + $reject(new \Exception('foo')); + }); + unset($promise); + + $this->assertSame(0, gc_collect_cycles()); + } + + /** @test */ + public function shouldRejectWithoutCreatingGarbageCyclesIfCancellerRejectsWithException() + { + gc_collect_cycles(); + $promise = new Promise(function ($resolve, $reject) { }, function ($resolve, $reject) { + $reject(new \Exception('foo')); + }); + $promise->cancel(); + unset($promise); + + $this->assertSame(0, gc_collect_cycles()); + } + + /** @test */ + public function shouldRejectWithoutCreatingGarbageCyclesIfParentCancellerRejectsWithException() + { + gc_collect_cycles(); + $promise = new Promise(function ($resolve, $reject) { }, function ($resolve, $reject) { + $reject(new \Exception('foo')); + }); + $promise->then()->then()->then()->cancel(); + unset($promise); + + $this->assertSame(0, gc_collect_cycles()); + } + + /** @test */ + public function shouldRejectWithoutCreatingGarbageCyclesIfResolverThrowsException() + { + gc_collect_cycles(); + $promise = new Promise(function ($resolve, $reject) { + throw new \Exception('foo'); + }); + unset($promise); + + $this->assertSame(0, gc_collect_cycles()); + } + + /** + * Test that checks number of garbage cycles after throwing from a canceller + * that explicitly uses a reference to the promise. This is rather synthetic, + * actual use cases often have implicit (hidden) references which ought not + * to be stored in the stack trace. + * + * Reassigned arguments only show up in the stack trace in PHP 7, so we can't + * avoid this on legacy PHP. As an alternative, consider explicitly unsetting + * any references before throwing. + * + * @test + * @requires PHP 7 + */ + public function shouldRejectWithoutCreatingGarbageCyclesIfCancellerWithReferenceThrowsException() + { + gc_collect_cycles(); + $promise = new Promise(function () {}, function () use (&$promise) { + throw new \Exception('foo'); + }); + $promise->cancel(); + unset($promise); + + $this->assertSame(0, gc_collect_cycles()); + } + + /** + * @test + * @requires PHP 7 + * @see self::shouldRejectWithoutCreatingGarbageCyclesIfCancellerWithReferenceThrowsException + */ + public function shouldRejectWithoutCreatingGarbageCyclesIfResolverWithReferenceThrowsException() + { + gc_collect_cycles(); + $promise = new Promise(function () use (&$promise) { + throw new \Exception('foo'); + }); + unset($promise); + + $this->assertSame(0, gc_collect_cycles()); + } + + /** + * @test + * @requires PHP 7 + * @see self::shouldRejectWithoutCreatingGarbageCyclesIfCancellerWithReferenceThrowsException + */ + public function shouldRejectWithoutCreatingGarbageCyclesIfCancellerHoldsReferenceAndResolverThrowsException() + { + gc_collect_cycles(); + $promise = new Promise(function () { + throw new \Exception('foo'); + }, function () use (&$promise) { }); + unset($promise); + + $this->assertSame(0, gc_collect_cycles()); + } + + /** @test */ + public function shouldIgnoreNotifyAfterReject() + { + $promise = new Promise(function () { }, function ($resolve, $reject, $notify) { + $reject(new \Exception('foo')); + $notify(42); + }); + + $promise->then(null, null, $this->expectCallableNever()); + $promise->cancel(); + } + + + /** @test */ + public function shouldNotLeaveGarbageCyclesWhenRemovingLastReferenceToPendingPromise() + { + gc_collect_cycles(); + $promise = new Promise(function () { }); + unset($promise); + + $this->assertSame(0, gc_collect_cycles()); + } + + /** @test */ + public function shouldNotLeaveGarbageCyclesWhenRemovingLastReferenceToPendingPromiseWithThenFollowers() + { + gc_collect_cycles(); + $promise = new Promise(function () { }); + $promise->then()->then()->then(); + unset($promise); + + $this->assertSame(0, gc_collect_cycles()); + } + + /** @test */ + public function shouldNotLeaveGarbageCyclesWhenRemovingLastReferenceToPendingPromiseWithDoneFollowers() + { + gc_collect_cycles(); + $promise = new Promise(function () { }); + $promise->done(); + unset($promise); + + $this->assertSame(0, gc_collect_cycles()); + } + + /** @test */ + public function shouldNotLeaveGarbageCyclesWhenRemovingLastReferenceToPendingPromiseWithOtherwiseFollowers() + { + gc_collect_cycles(); + $promise = new Promise(function () { }); + $promise->otherwise(function () { }); + unset($promise); + + $this->assertSame(0, gc_collect_cycles()); + } + + /** @test */ + public function shouldNotLeaveGarbageCyclesWhenRemovingLastReferenceToPendingPromiseWithAlwaysFollowers() + { + gc_collect_cycles(); + $promise = new Promise(function () { }); + $promise->always(function () { }); + unset($promise); + + $this->assertSame(0, gc_collect_cycles()); + } + + /** @test */ + public function shouldNotLeaveGarbageCyclesWhenRemovingLastReferenceToPendingPromiseWithProgressFollowers() + { + gc_collect_cycles(); + $promise = new Promise(function () { }); + $promise->then(null, null, function () { }); + unset($promise); + + $this->assertSame(0, gc_collect_cycles()); + } + + /** @test */ + public function shouldFulfillIfFullfilledWithSimplePromise() + { + $adapter = $this->getPromiseTestAdapter(); + + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo('foo')); + + $adapter->promise() + ->then($mock); + + $adapter->resolve(new SimpleFulfilledTestPromise()); + } + + /** @test */ + public function shouldRejectIfRejectedWithSimplePromise() + { + $adapter = $this->getPromiseTestAdapter(); + + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo('foo')); + + $adapter->promise() + ->then($this->expectCallableNever(), $mock); + + $adapter->resolve(new SimpleRejectedTestPromise()); + } +} diff --git a/openml_OS/vendor/react/promise/tests/PromiseTest/CancelTestTrait.php b/openml_OS/vendor/react/promise/tests/PromiseTest/CancelTestTrait.php new file mode 100644 index 000000000..2baab0240 --- /dev/null +++ b/openml_OS/vendor/react/promise/tests/PromiseTest/CancelTestTrait.php @@ -0,0 +1,246 @@ +getPromiseTestAdapter(function ($resolve, $reject, $notify) use (&$args) { + $args = func_get_args(); + }); + + $adapter->promise()->cancel(); + + $this->assertCount(3, $args); + $this->assertTrue(is_callable($args[0])); + $this->assertTrue(is_callable($args[1])); + $this->assertTrue(is_callable($args[2])); + } + + /** @test */ + public function cancelShouldCallCancellerWithoutArgumentsIfNotAccessed() + { + $args = null; + $adapter = $this->getPromiseTestAdapter(function () use (&$args) { + $args = func_num_args(); + }); + + $adapter->promise()->cancel(); + + $this->assertSame(0, $args); + } + + /** @test */ + public function cancelShouldFulfillPromiseIfCancellerFulfills() + { + $adapter = $this->getPromiseTestAdapter(function ($resolve) { + $resolve(1); + }); + + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo(1)); + + $adapter->promise() + ->then($mock, $this->expectCallableNever()); + + $adapter->promise()->cancel(); + } + + /** @test */ + public function cancelShouldRejectPromiseIfCancellerRejects() + { + $adapter = $this->getPromiseTestAdapter(function ($resolve, $reject) { + $reject(1); + }); + + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo(1)); + + $adapter->promise() + ->then($this->expectCallableNever(), $mock); + + $adapter->promise()->cancel(); + } + + /** @test */ + public function cancelShouldRejectPromiseWithExceptionIfCancellerThrows() + { + $e = new \Exception(); + + $adapter = $this->getPromiseTestAdapter(function () use ($e) { + throw $e; + }); + + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo($e)); + + $adapter->promise() + ->then($this->expectCallableNever(), $mock); + + $adapter->promise()->cancel(); + } + + /** @test */ + public function cancelShouldProgressPromiseIfCancellerNotifies() + { + $adapter = $this->getPromiseTestAdapter(function ($resolve, $reject, $progress) { + $progress(1); + }); + + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo(1)); + + $adapter->promise() + ->then($this->expectCallableNever(), $this->expectCallableNever(), $mock); + + $adapter->promise()->cancel(); + } + + /** @test */ + public function cancelShouldCallCancellerOnlyOnceIfCancellerResolves() + { + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->will($this->returnCallback(function ($resolve) { + $resolve(); + })); + + $adapter = $this->getPromiseTestAdapter($mock); + + $adapter->promise()->cancel(); + $adapter->promise()->cancel(); + } + + /** @test */ + public function cancelShouldHaveNoEffectIfCancellerDoesNothing() + { + $adapter = $this->getPromiseTestAdapter(function () {}); + + $adapter->promise() + ->then($this->expectCallableNever(), $this->expectCallableNever()); + + $adapter->promise()->cancel(); + $adapter->promise()->cancel(); + } + + /** @test */ + public function cancelShouldCallCancellerFromDeepNestedPromiseChain() + { + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke'); + + $adapter = $this->getPromiseTestAdapter($mock); + + $promise = $adapter->promise() + ->then(function () { + return new Promise\Promise(function () {}); + }) + ->then(function () { + $d = new Promise\Deferred(); + + return $d->promise(); + }) + ->then(function () { + return new Promise\Promise(function () {}); + }); + + $promise->cancel(); + } + + /** @test */ + public function cancelCalledOnChildrenSouldOnlyCancelWhenAllChildrenCancelled() + { + $adapter = $this->getPromiseTestAdapter($this->expectCallableNever()); + + $child1 = $adapter->promise() + ->then() + ->then(); + + $adapter->promise() + ->then(); + + $child1->cancel(); + } + + /** @test */ + public function cancelShouldTriggerCancellerWhenAllChildrenCancel() + { + $adapter = $this->getPromiseTestAdapter($this->expectCallableOnce()); + + $child1 = $adapter->promise() + ->then() + ->then(); + + $child2 = $adapter->promise() + ->then(); + + $child1->cancel(); + $child2->cancel(); + } + + /** @test */ + public function cancelShouldNotTriggerCancellerWhenCancellingOneChildrenMultipleTimes() + { + $adapter = $this->getPromiseTestAdapter($this->expectCallableNever()); + + $child1 = $adapter->promise() + ->then() + ->then(); + + $child2 = $adapter->promise() + ->then(); + + $child1->cancel(); + $child1->cancel(); + } + + /** @test */ + public function cancelShouldTriggerCancellerOnlyOnceWhenCancellingMultipleTimes() + { + $adapter = $this->getPromiseTestAdapter($this->expectCallableOnce()); + + $adapter->promise()->cancel(); + $adapter->promise()->cancel(); + } + + /** @test */ + public function cancelShouldAlwaysTriggerCancellerWhenCalledOnRootPromise() + { + $adapter = $this->getPromiseTestAdapter($this->expectCallableOnce()); + + $adapter->promise() + ->then() + ->then(); + + $adapter->promise() + ->then(); + + $adapter->promise()->cancel(); + } +} diff --git a/openml_OS/vendor/react/promise/tests/PromiseTest/FullTestTrait.php b/openml_OS/vendor/react/promise/tests/PromiseTest/FullTestTrait.php new file mode 100644 index 000000000..3ce45d61f --- /dev/null +++ b/openml_OS/vendor/react/promise/tests/PromiseTest/FullTestTrait.php @@ -0,0 +1,15 @@ +getPromiseTestAdapter(); + + $sentinel = new \stdClass(); + + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($sentinel); + + $adapter->promise() + ->then($this->expectCallableNever(), $this->expectCallableNever(), $mock); + + $adapter->notify($sentinel); + } + + /** @test */ + public function notifyShouldPropagateProgressToDownstreamPromises() + { + $adapter = $this->getPromiseTestAdapter(); + + $sentinel = new \stdClass(); + + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->will($this->returnArgument(0)); + + $mock2 = $this->createCallableMock(); + $mock2 + ->expects($this->once()) + ->method('__invoke') + ->with($sentinel); + + $adapter->promise() + ->then( + $this->expectCallableNever(), + $this->expectCallableNever(), + $mock + ) + ->then( + $this->expectCallableNever(), + $this->expectCallableNever(), + $mock2 + ); + + $adapter->notify($sentinel); + } + + /** @test */ + public function notifyShouldPropagateTransformedProgressToDownstreamPromises() + { + $adapter = $this->getPromiseTestAdapter(); + + $sentinel = new \stdClass(); + + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->will($this->returnValue($sentinel)); + + $mock2 = $this->createCallableMock(); + $mock2 + ->expects($this->once()) + ->method('__invoke') + ->with($sentinel); + + $adapter->promise() + ->then( + $this->expectCallableNever(), + $this->expectCallableNever(), + $mock + ) + ->then( + $this->expectCallableNever(), + $this->expectCallableNever(), + $mock2 + ); + + $adapter->notify(1); + } + + /** @test */ + public function notifyShouldPropagateCaughtExceptionValueAsProgress() + { + $adapter = $this->getPromiseTestAdapter(); + + $exception = new \Exception(); + + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->will($this->throwException($exception)); + + $mock2 = $this->createCallableMock(); + $mock2 + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo($exception)); + + $adapter->promise() + ->then( + $this->expectCallableNever(), + $this->expectCallableNever(), + $mock + ) + ->then( + $this->expectCallableNever(), + $this->expectCallableNever(), + $mock2 + ); + + $adapter->notify(1); + } + + /** @test */ + public function notifyShouldForwardProgressEventsWhenIntermediaryCallbackTiedToAResolvedPromiseReturnsAPromise() + { + $adapter = $this->getPromiseTestAdapter(); + $adapter2 = $this->getPromiseTestAdapter(); + + $promise2 = $adapter2->promise(); + + $sentinel = new \stdClass(); + + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($sentinel); + + // resolve BEFORE attaching progress handler + $adapter->resolve(); + + $adapter->promise() + ->then(function () use ($promise2) { + return $promise2; + }) + ->then( + $this->expectCallableNever(), + $this->expectCallableNever(), + $mock + ); + + $adapter2->notify($sentinel); + } + + /** @test */ + public function notifyShouldForwardProgressEventsWhenIntermediaryCallbackTiedToAnUnresolvedPromiseReturnsAPromise() + { + $adapter = $this->getPromiseTestAdapter(); + $adapter2 = $this->getPromiseTestAdapter(); + + $promise2 = $adapter2->promise(); + + $sentinel = new \stdClass(); + + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($sentinel); + + $adapter->promise() + ->then(function () use ($promise2) { + return $promise2; + }) + ->then( + $this->expectCallableNever(), + $this->expectCallableNever(), + $mock + ); + + // resolve AFTER attaching progress handler + $adapter->resolve(); + $adapter2->notify($sentinel); + } + + /** @test */ + public function notifyShouldForwardProgressWhenResolvedWithAnotherPromise() + { + $adapter = $this->getPromiseTestAdapter(); + $adapter2 = $this->getPromiseTestAdapter(); + + $sentinel = new \stdClass(); + + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->will($this->returnValue($sentinel)); + + $mock2 = $this->createCallableMock(); + $mock2 + ->expects($this->once()) + ->method('__invoke') + ->with($sentinel); + + $adapter->promise() + ->then( + $this->expectCallableNever(), + $this->expectCallableNever(), + $mock + ) + ->then( + $this->expectCallableNever(), + $this->expectCallableNever(), + $mock2 + ); + + $adapter->resolve($adapter2->promise()); + $adapter2->notify($sentinel); + } + + /** @test */ + public function notifyShouldAllowResolveAfterProgress() + { + $adapter = $this->getPromiseTestAdapter(); + + $mock = $this->createCallableMock(); + $mock + ->expects($this->at(0)) + ->method('__invoke') + ->with($this->identicalTo(1)); + $mock + ->expects($this->at(1)) + ->method('__invoke') + ->with($this->identicalTo(2)); + + $adapter->promise() + ->then( + $mock, + $this->expectCallableNever(), + $mock + ); + + $adapter->notify(1); + $adapter->resolve(2); + } + + /** @test */ + public function notifyShouldAllowRejectAfterProgress() + { + $adapter = $this->getPromiseTestAdapter(); + + $mock = $this->createCallableMock(); + $mock + ->expects($this->at(0)) + ->method('__invoke') + ->with($this->identicalTo(1)); + $mock + ->expects($this->at(1)) + ->method('__invoke') + ->with($this->identicalTo(2)); + + $adapter->promise() + ->then( + $this->expectCallableNever(), + $mock, + $mock + ); + + $adapter->notify(1); + $adapter->reject(2); + } + + /** @test */ + public function notifyShouldReturnSilentlyOnProgressWhenAlreadyRejected() + { + $adapter = $this->getPromiseTestAdapter(); + + $adapter->reject(1); + + $this->assertNull($adapter->notify()); + } + + /** @test */ + public function notifyShouldInvokeProgressHandler() + { + $adapter = $this->getPromiseTestAdapter(); + + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo(1)); + + $adapter->promise()->progress($mock); + $adapter->notify(1); + } + + /** @test */ + public function notifyShouldInvokeProgressHandlerFromDone() + { + $adapter = $this->getPromiseTestAdapter(); + + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo(1)); + + $this->assertNull($adapter->promise()->done(null, null, $mock)); + $adapter->notify(1); + } + + /** @test */ + public function notifyShouldThrowExceptionThrownProgressHandlerFromDone() + { + $adapter = $this->getPromiseTestAdapter(); + + $this->setExpectedException('\Exception', 'UnhandledRejectionException'); + + $this->assertNull($adapter->promise()->done(null, null, function () { + throw new \Exception('UnhandledRejectionException'); + })); + $adapter->notify(1); + } +} diff --git a/openml_OS/vendor/react/promise/tests/PromiseTest/PromiseFulfilledTestTrait.php b/openml_OS/vendor/react/promise/tests/PromiseTest/PromiseFulfilledTestTrait.php new file mode 100644 index 000000000..428230b97 --- /dev/null +++ b/openml_OS/vendor/react/promise/tests/PromiseTest/PromiseFulfilledTestTrait.php @@ -0,0 +1,351 @@ +getPromiseTestAdapter(); + + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo(1)); + + $adapter->resolve(1); + $adapter->resolve(2); + + $adapter->promise() + ->then( + $mock, + $this->expectCallableNever() + ); + } + + /** @test */ + public function fulfilledPromiseShouldInvokeNewlyAddedCallback() + { + $adapter = $this->getPromiseTestAdapter(); + + $adapter->resolve(1); + + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo(1)); + + $adapter->promise() + ->then($mock, $this->expectCallableNever()); + } + + /** @test */ + public function thenShouldForwardResultWhenCallbackIsNull() + { + $adapter = $this->getPromiseTestAdapter(); + + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo(1)); + + $adapter->resolve(1); + $adapter->promise() + ->then( + null, + $this->expectCallableNever() + ) + ->then( + $mock, + $this->expectCallableNever() + ); + } + + /** @test */ + public function thenShouldForwardCallbackResultToNextCallback() + { + $adapter = $this->getPromiseTestAdapter(); + + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo(2)); + + $adapter->resolve(1); + $adapter->promise() + ->then( + function ($val) { + return $val + 1; + }, + $this->expectCallableNever() + ) + ->then( + $mock, + $this->expectCallableNever() + ); + } + + /** @test */ + public function thenShouldForwardPromisedCallbackResultValueToNextCallback() + { + $adapter = $this->getPromiseTestAdapter(); + + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo(2)); + + $adapter->resolve(1); + $adapter->promise() + ->then( + function ($val) { + return \React\Promise\resolve($val + 1); + }, + $this->expectCallableNever() + ) + ->then( + $mock, + $this->expectCallableNever() + ); + } + + /** @test */ + public function thenShouldSwitchFromCallbacksToErrbacksWhenCallbackReturnsARejection() + { + $adapter = $this->getPromiseTestAdapter(); + + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo(2)); + + $adapter->resolve(1); + $adapter->promise() + ->then( + function ($val) { + return \React\Promise\reject($val + 1); + }, + $this->expectCallableNever() + ) + ->then( + $this->expectCallableNever(), + $mock + ); + } + + /** @test */ + public function thenShouldSwitchFromCallbacksToErrbacksWhenCallbackThrows() + { + $adapter = $this->getPromiseTestAdapter(); + + $exception = new \Exception(); + + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->will($this->throwException($exception)); + + $mock2 = $this->createCallableMock(); + $mock2 + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo($exception)); + + $adapter->resolve(1); + $adapter->promise() + ->then( + $mock, + $this->expectCallableNever() + ) + ->then( + $this->expectCallableNever(), + $mock2 + ); + } + + /** @test */ + public function cancelShouldReturnNullForFulfilledPromise() + { + $adapter = $this->getPromiseTestAdapter(); + + $adapter->resolve(); + + $this->assertNull($adapter->promise()->cancel()); + } + + /** @test */ + public function cancelShouldHaveNoEffectForFulfilledPromise() + { + $adapter = $this->getPromiseTestAdapter($this->expectCallableNever()); + + $adapter->resolve(); + + $adapter->promise()->cancel(); + } + + /** @test */ + public function doneShouldInvokeFulfillmentHandlerForFulfilledPromise() + { + $adapter = $this->getPromiseTestAdapter(); + + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo(1)); + + $adapter->resolve(1); + $this->assertNull($adapter->promise()->done($mock)); + } + + /** @test */ + public function doneShouldThrowExceptionThrownFulfillmentHandlerForFulfilledPromise() + { + $adapter = $this->getPromiseTestAdapter(); + + $this->setExpectedException('\Exception', 'UnhandledRejectionException'); + + $adapter->resolve(1); + $this->assertNull($adapter->promise()->done(function () { + throw new \Exception('UnhandledRejectionException'); + })); + } + + /** @test */ + public function doneShouldThrowUnhandledRejectionExceptionWhenFulfillmentHandlerRejectsForFulfilledPromise() + { + $adapter = $this->getPromiseTestAdapter(); + + $this->setExpectedException('React\\Promise\\UnhandledRejectionException'); + + $adapter->resolve(1); + $this->assertNull($adapter->promise()->done(function () { + return \React\Promise\reject(); + })); + } + + /** @test */ + public function otherwiseShouldNotInvokeRejectionHandlerForFulfilledPromise() + { + $adapter = $this->getPromiseTestAdapter(); + + $adapter->resolve(1); + $adapter->promise()->otherwise($this->expectCallableNever()); + } + + /** @test */ + public function alwaysShouldNotSuppressValueForFulfilledPromise() + { + $adapter = $this->getPromiseTestAdapter(); + + $value = new \stdClass(); + + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo($value)); + + $adapter->resolve($value); + $adapter->promise() + ->always(function () {}) + ->then($mock); + } + + /** @test */ + public function alwaysShouldNotSuppressValueWhenHandlerReturnsANonPromiseForFulfilledPromise() + { + $adapter = $this->getPromiseTestAdapter(); + + $value = new \stdClass(); + + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo($value)); + + $adapter->resolve($value); + $adapter->promise() + ->always(function () { + return 1; + }) + ->then($mock); + } + + /** @test */ + public function alwaysShouldNotSuppressValueWhenHandlerReturnsAPromiseForFulfilledPromise() + { + $adapter = $this->getPromiseTestAdapter(); + + $value = new \stdClass(); + + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo($value)); + + $adapter->resolve($value); + $adapter->promise() + ->always(function () { + return \React\Promise\resolve(1); + }) + ->then($mock); + } + + /** @test */ + public function alwaysShouldRejectWhenHandlerThrowsForFulfilledPromise() + { + $adapter = $this->getPromiseTestAdapter(); + + $exception = new \Exception(); + + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo($exception)); + + $adapter->resolve(1); + $adapter->promise() + ->always(function () use ($exception) { + throw $exception; + }) + ->then(null, $mock); + } + + /** @test */ + public function alwaysShouldRejectWhenHandlerRejectsForFulfilledPromise() + { + $adapter = $this->getPromiseTestAdapter(); + + $exception = new \Exception(); + + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo($exception)); + + $adapter->resolve(1); + $adapter->promise() + ->always(function () use ($exception) { + return \React\Promise\reject($exception); + }) + ->then(null, $mock); + } +} diff --git a/openml_OS/vendor/react/promise/tests/PromiseTest/PromisePendingTestTrait.php b/openml_OS/vendor/react/promise/tests/PromiseTest/PromisePendingTestTrait.php new file mode 100644 index 000000000..a4f48ee25 --- /dev/null +++ b/openml_OS/vendor/react/promise/tests/PromiseTest/PromisePendingTestTrait.php @@ -0,0 +1,68 @@ +getPromiseTestAdapter(); + + $this->assertInstanceOf('React\\Promise\\PromiseInterface', $adapter->promise()->then()); + } + + /** @test */ + public function thenShouldReturnAllowNullForPendingPromise() + { + $adapter = $this->getPromiseTestAdapter(); + + $this->assertInstanceOf('React\\Promise\\PromiseInterface', $adapter->promise()->then(null, null, null)); + } + + /** @test */ + public function cancelShouldReturnNullForPendingPromise() + { + $adapter = $this->getPromiseTestAdapter(); + + $this->assertNull($adapter->promise()->cancel()); + } + + /** @test */ + public function doneShouldReturnNullForPendingPromise() + { + $adapter = $this->getPromiseTestAdapter(); + + $this->assertNull($adapter->promise()->done()); + } + + /** @test */ + public function doneShouldReturnAllowNullForPendingPromise() + { + $adapter = $this->getPromiseTestAdapter(); + + $this->assertNull($adapter->promise()->done(null, null, null)); + } + + /** @test */ + public function otherwiseShouldNotInvokeRejectionHandlerForPendingPromise() + { + $adapter = $this->getPromiseTestAdapter(); + + $adapter->settle(); + $adapter->promise()->otherwise($this->expectCallableNever()); + } + + /** @test */ + public function alwaysShouldReturnAPromiseForPendingPromise() + { + $adapter = $this->getPromiseTestAdapter(); + + $this->assertInstanceOf('React\\Promise\\PromiseInterface', $adapter->promise()->always(function () {})); + } +} diff --git a/openml_OS/vendor/react/promise/tests/PromiseTest/PromiseRejectedTestTrait.php b/openml_OS/vendor/react/promise/tests/PromiseTest/PromiseRejectedTestTrait.php new file mode 100644 index 000000000..98d1dcf93 --- /dev/null +++ b/openml_OS/vendor/react/promise/tests/PromiseTest/PromiseRejectedTestTrait.php @@ -0,0 +1,512 @@ +getPromiseTestAdapter(); + + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo(1)); + + $adapter->reject(1); + $adapter->reject(2); + + $adapter->promise() + ->then( + $this->expectCallableNever(), + $mock + ); + } + + /** @test */ + public function rejectedPromiseShouldInvokeNewlyAddedCallback() + { + $adapter = $this->getPromiseTestAdapter(); + + $adapter->reject(1); + + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo(1)); + + $adapter->promise() + ->then($this->expectCallableNever(), $mock); + } + + /** @test */ + public function shouldForwardUndefinedRejectionValue() + { + $adapter = $this->getPromiseTestAdapter(); + + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with(null); + + $adapter->reject(1); + $adapter->promise() + ->then( + $this->expectCallableNever(), + function () { + // Presence of rejection handler is enough to switch back + // to resolve mode, even though it returns undefined. + // The ONLY way to propagate a rejection is to re-throw or + // return a rejected promise; + } + ) + ->then( + $mock, + $this->expectCallableNever() + ); + } + + /** @test */ + public function shouldSwitchFromErrbacksToCallbacksWhenErrbackDoesNotExplicitlyPropagate() + { + $adapter = $this->getPromiseTestAdapter(); + + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo(2)); + + $adapter->reject(1); + $adapter->promise() + ->then( + $this->expectCallableNever(), + function ($val) { + return $val + 1; + } + ) + ->then( + $mock, + $this->expectCallableNever() + ); + } + + /** @test */ + public function shouldSwitchFromErrbacksToCallbacksWhenErrbackReturnsAResolution() + { + $adapter = $this->getPromiseTestAdapter(); + + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo(2)); + + $adapter->reject(1); + $adapter->promise() + ->then( + $this->expectCallableNever(), + function ($val) { + return \React\Promise\resolve($val + 1); + } + ) + ->then( + $mock, + $this->expectCallableNever() + ); + } + + /** @test */ + public function shouldPropagateRejectionsWhenErrbackThrows() + { + $adapter = $this->getPromiseTestAdapter(); + + $exception = new \Exception(); + + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->will($this->throwException($exception)); + + $mock2 = $this->createCallableMock(); + $mock2 + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo($exception)); + + $adapter->reject(1); + $adapter->promise() + ->then( + $this->expectCallableNever(), + $mock + ) + ->then( + $this->expectCallableNever(), + $mock2 + ); + } + + /** @test */ + public function shouldPropagateRejectionsWhenErrbackReturnsARejection() + { + $adapter = $this->getPromiseTestAdapter(); + + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo(2)); + + $adapter->reject(1); + $adapter->promise() + ->then( + $this->expectCallableNever(), + function ($val) { + return \React\Promise\reject($val + 1); + } + ) + ->then( + $this->expectCallableNever(), + $mock + ); + } + + /** @test */ + public function doneShouldInvokeRejectionHandlerForRejectedPromise() + { + $adapter = $this->getPromiseTestAdapter(); + + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo(1)); + + $adapter->reject(1); + $this->assertNull($adapter->promise()->done(null, $mock)); + } + + /** @test */ + public function doneShouldThrowExceptionThrownByRejectionHandlerForRejectedPromise() + { + $adapter = $this->getPromiseTestAdapter(); + + $this->setExpectedException('\Exception', 'UnhandledRejectionException'); + + $adapter->reject(1); + $this->assertNull($adapter->promise()->done(null, function () { + throw new \Exception('UnhandledRejectionException'); + })); + } + + /** @test */ + public function doneShouldThrowUnhandledRejectionExceptionWhenRejectedWithNonExceptionForRejectedPromise() + { + $adapter = $this->getPromiseTestAdapter(); + + $this->setExpectedException('React\\Promise\\UnhandledRejectionException'); + + $adapter->reject(1); + $this->assertNull($adapter->promise()->done()); + } + + /** @test */ + public function unhandledRejectionExceptionThrownByDoneHoldsRejectionValue() + { + $adapter = $this->getPromiseTestAdapter(); + + $expected = new \stdClass(); + + $adapter->reject($expected); + + try { + $adapter->promise()->done(); + } catch (UnhandledRejectionException $e) { + $this->assertSame($expected, $e->getReason()); + return; + } + + $this->fail(); + } + + /** @test */ + public function doneShouldThrowUnhandledRejectionExceptionWhenRejectionHandlerRejectsForRejectedPromise() + { + $adapter = $this->getPromiseTestAdapter(); + + $this->setExpectedException('React\\Promise\\UnhandledRejectionException'); + + $adapter->reject(1); + $this->assertNull($adapter->promise()->done(null, function () { + return \React\Promise\reject(); + })); + } + + /** @test */ + public function doneShouldThrowRejectionExceptionWhenRejectionHandlerRejectsWithExceptionForRejectedPromise() + { + $adapter = $this->getPromiseTestAdapter(); + + $this->setExpectedException('\Exception', 'UnhandledRejectionException'); + + $adapter->reject(1); + $this->assertNull($adapter->promise()->done(null, function () { + return \React\Promise\reject(new \Exception('UnhandledRejectionException')); + })); + } + + /** @test */ + public function doneShouldThrowExceptionProvidedAsRejectionValueForRejectedPromise() + { + $adapter = $this->getPromiseTestAdapter(); + + $this->setExpectedException('\Exception', 'UnhandledRejectionException'); + + $adapter->reject(new \Exception('UnhandledRejectionException')); + $this->assertNull($adapter->promise()->done()); + } + + /** @test */ + public function doneShouldThrowWithDeepNestingPromiseChainsForRejectedPromise() + { + $this->setExpectedException('\Exception', 'UnhandledRejectionException'); + + $exception = new \Exception('UnhandledRejectionException'); + + $d = new Deferred(); + $d->resolve(); + + $result = \React\Promise\resolve(\React\Promise\resolve($d->promise()->then(function () use ($exception) { + $d = new Deferred(); + $d->resolve(); + + return \React\Promise\resolve($d->promise()->then(function () {}))->then( + function () use ($exception) { + throw $exception; + } + ); + }))); + + $result->done(); + } + + /** @test */ + public function doneShouldRecoverWhenRejectionHandlerCatchesExceptionForRejectedPromise() + { + $adapter = $this->getPromiseTestAdapter(); + + $adapter->reject(new \Exception('UnhandledRejectionException')); + $this->assertNull($adapter->promise()->done(null, function (\Exception $e) { + + })); + } + + /** @test */ + public function otherwiseShouldInvokeRejectionHandlerForRejectedPromise() + { + $adapter = $this->getPromiseTestAdapter(); + + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo(1)); + + $adapter->reject(1); + $adapter->promise()->otherwise($mock); + } + + /** @test */ + public function otherwiseShouldInvokeNonTypeHintedRejectionHandlerIfReasonIsAnExceptionForRejectedPromise() + { + $adapter = $this->getPromiseTestAdapter(); + + $exception = new \Exception(); + + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo($exception)); + + $adapter->reject($exception); + $adapter->promise() + ->otherwise(function ($reason) use ($mock) { + $mock($reason); + }); + } + + /** @test */ + public function otherwiseShouldInvokeRejectionHandlerIfReasonMatchesTypehintForRejectedPromise() + { + $adapter = $this->getPromiseTestAdapter(); + + $exception = new \InvalidArgumentException(); + + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo($exception)); + + $adapter->reject($exception); + $adapter->promise() + ->otherwise(function (\InvalidArgumentException $reason) use ($mock) { + $mock($reason); + }); + } + + /** @test */ + public function otherwiseShouldNotInvokeRejectionHandlerIfReaonsDoesNotMatchTypehintForRejectedPromise() + { + $adapter = $this->getPromiseTestAdapter(); + + $exception = new \Exception(); + + $mock = $this->expectCallableNever(); + + $adapter->reject($exception); + $adapter->promise() + ->otherwise(function (\InvalidArgumentException $reason) use ($mock) { + $mock($reason); + }); + } + + /** @test */ + public function alwaysShouldNotSuppressRejectionForRejectedPromise() + { + $adapter = $this->getPromiseTestAdapter(); + + $exception = new \Exception(); + + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo($exception)); + + $adapter->reject($exception); + $adapter->promise() + ->always(function () {}) + ->then(null, $mock); + } + + /** @test */ + public function alwaysShouldNotSuppressRejectionWhenHandlerReturnsANonPromiseForRejectedPromise() + { + $adapter = $this->getPromiseTestAdapter(); + + $exception = new \Exception(); + + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo($exception)); + + $adapter->reject($exception); + $adapter->promise() + ->always(function () { + return 1; + }) + ->then(null, $mock); + } + + /** @test */ + public function alwaysShouldNotSuppressRejectionWhenHandlerReturnsAPromiseForRejectedPromise() + { + $adapter = $this->getPromiseTestAdapter(); + + $exception = new \Exception(); + + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo($exception)); + + $adapter->reject($exception); + $adapter->promise() + ->always(function () { + return \React\Promise\resolve(1); + }) + ->then(null, $mock); + } + + /** @test */ + public function alwaysShouldRejectWhenHandlerThrowsForRejectedPromise() + { + $adapter = $this->getPromiseTestAdapter(); + + $exception1 = new \Exception(); + $exception2 = new \Exception(); + + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo($exception2)); + + $adapter->reject($exception1); + $adapter->promise() + ->always(function () use ($exception2) { + throw $exception2; + }) + ->then(null, $mock); + } + + /** @test */ + public function alwaysShouldRejectWhenHandlerRejectsForRejectedPromise() + { + $adapter = $this->getPromiseTestAdapter(); + + $exception1 = new \Exception(); + $exception2 = new \Exception(); + + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo($exception2)); + + $adapter->reject($exception1); + $adapter->promise() + ->always(function () use ($exception2) { + return \React\Promise\reject($exception2); + }) + ->then(null, $mock); + } + + /** @test */ + public function cancelShouldReturnNullForRejectedPromise() + { + $adapter = $this->getPromiseTestAdapter(); + + $adapter->reject(); + + $this->assertNull($adapter->promise()->cancel()); + } + + /** @test */ + public function cancelShouldHaveNoEffectForRejectedPromise() + { + $adapter = $this->getPromiseTestAdapter($this->expectCallableNever()); + + $adapter->reject(); + + $adapter->promise()->cancel(); + } +} diff --git a/openml_OS/vendor/react/promise/tests/PromiseTest/PromiseSettledTestTrait.php b/openml_OS/vendor/react/promise/tests/PromiseTest/PromiseSettledTestTrait.php new file mode 100644 index 000000000..e363b6d91 --- /dev/null +++ b/openml_OS/vendor/react/promise/tests/PromiseTest/PromiseSettledTestTrait.php @@ -0,0 +1,86 @@ +getPromiseTestAdapter(); + + $adapter->settle(); + $this->assertInstanceOf('React\\Promise\\PromiseInterface', $adapter->promise()->then()); + } + + /** @test */ + public function thenShouldReturnAllowNullForSettledPromise() + { + $adapter = $this->getPromiseTestAdapter(); + + $adapter->settle(); + $this->assertInstanceOf('React\\Promise\\PromiseInterface', $adapter->promise()->then(null, null, null)); + } + + /** @test */ + public function cancelShouldReturnNullForSettledPromise() + { + $adapter = $this->getPromiseTestAdapter(); + + $adapter->settle(); + + $this->assertNull($adapter->promise()->cancel()); + } + + /** @test */ + public function cancelShouldHaveNoEffectForSettledPromise() + { + $adapter = $this->getPromiseTestAdapter($this->expectCallableNever()); + + $adapter->settle(); + + $adapter->promise()->cancel(); + } + + /** @test */ + public function doneShouldReturnNullForSettledPromise() + { + $adapter = $this->getPromiseTestAdapter(); + + $adapter->settle(); + $this->assertNull($adapter->promise()->done(null, function () {})); + } + + /** @test */ + public function doneShouldReturnAllowNullForSettledPromise() + { + $adapter = $this->getPromiseTestAdapter(); + + $adapter->settle(); + $this->assertNull($adapter->promise()->done(null, function () {}, null)); + } + + /** @test */ + public function progressShouldNotInvokeProgressHandlerForSettledPromise() + { + $adapter = $this->getPromiseTestAdapter(); + + $adapter->settle(); + $adapter->promise()->progress($this->expectCallableNever()); + $adapter->notify(); + } + + /** @test */ + public function alwaysShouldReturnAPromiseForSettledPromise() + { + $adapter = $this->getPromiseTestAdapter(); + + $adapter->settle(); + $this->assertInstanceOf('React\\Promise\\PromiseInterface', $adapter->promise()->always(function () {})); + } +} diff --git a/openml_OS/vendor/react/promise/tests/PromiseTest/RejectTestTrait.php b/openml_OS/vendor/react/promise/tests/PromiseTest/RejectTestTrait.php new file mode 100644 index 000000000..063f178ad --- /dev/null +++ b/openml_OS/vendor/react/promise/tests/PromiseTest/RejectTestTrait.php @@ -0,0 +1,368 @@ +getPromiseTestAdapter(); + + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo(1)); + + $adapter->promise() + ->then($this->expectCallableNever(), $mock); + + $adapter->reject(1); + } + + /** @test */ + public function rejectShouldRejectWithFulfilledPromise() + { + $adapter = $this->getPromiseTestAdapter(); + + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo(1)); + + $adapter->promise() + ->then($this->expectCallableNever(), $mock); + + $adapter->reject(Promise\resolve(1)); + } + + /** @test */ + public function rejectShouldRejectWithRejectedPromise() + { + $adapter = $this->getPromiseTestAdapter(); + + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo(1)); + + $adapter->promise() + ->then($this->expectCallableNever(), $mock); + + $adapter->reject(Promise\reject(1)); + } + + /** @test */ + public function rejectShouldForwardReasonWhenCallbackIsNull() + { + $adapter = $this->getPromiseTestAdapter(); + + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo(1)); + + $adapter->promise() + ->then( + $this->expectCallableNever() + ) + ->then( + $this->expectCallableNever(), + $mock + ); + + $adapter->reject(1); + } + + /** @test */ + public function rejectShouldMakePromiseImmutable() + { + $adapter = $this->getPromiseTestAdapter(); + + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo(1)); + + $adapter->promise() + ->then(null, function ($value) use ($adapter) { + $adapter->reject(3); + + return Promise\reject($value); + }) + ->then( + $this->expectCallableNever(), + $mock + ); + + $adapter->reject(1); + $adapter->reject(2); + } + + /** @test */ + public function notifyShouldInvokeOtherwiseHandler() + { + $adapter = $this->getPromiseTestAdapter(); + + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo(1)); + + $adapter->promise() + ->otherwise($mock); + + $adapter->reject(1); + } + + /** @test */ + public function doneShouldInvokeRejectionHandler() + { + $adapter = $this->getPromiseTestAdapter(); + + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo(1)); + + $this->assertNull($adapter->promise()->done(null, $mock)); + $adapter->reject(1); + } + + /** @test */ + public function doneShouldThrowExceptionThrownByRejectionHandler() + { + $adapter = $this->getPromiseTestAdapter(); + + $this->setExpectedException('\Exception', 'UnhandledRejectionException'); + + $this->assertNull($adapter->promise()->done(null, function () { + throw new \Exception('UnhandledRejectionException'); + })); + $adapter->reject(1); + } + + /** @test */ + public function doneShouldThrowUnhandledRejectionExceptionWhenRejectedWithNonException() + { + $adapter = $this->getPromiseTestAdapter(); + + $this->setExpectedException('React\\Promise\\UnhandledRejectionException'); + + $this->assertNull($adapter->promise()->done()); + $adapter->reject(1); + } + + /** @test */ + public function doneShouldThrowUnhandledRejectionExceptionWhenRejectionHandlerRejects() + { + $adapter = $this->getPromiseTestAdapter(); + + $this->setExpectedException('React\\Promise\\UnhandledRejectionException'); + + $this->assertNull($adapter->promise()->done(null, function () { + return \React\Promise\reject(); + })); + $adapter->reject(1); + } + + /** @test */ + public function doneShouldThrowRejectionExceptionWhenRejectionHandlerRejectsWithException() + { + $adapter = $this->getPromiseTestAdapter(); + + $this->setExpectedException('\Exception', 'UnhandledRejectionException'); + + $this->assertNull($adapter->promise()->done(null, function () { + return \React\Promise\reject(new \Exception('UnhandledRejectionException')); + })); + $adapter->reject(1); + } + + /** @test */ + public function doneShouldThrowUnhandledRejectionExceptionWhenRejectionHandlerRetunsPendingPromiseWhichRejectsLater() + { + $adapter = $this->getPromiseTestAdapter(); + + $this->setExpectedException('React\\Promise\\UnhandledRejectionException'); + + $d = new Deferred(); + $promise = $d->promise(); + + $this->assertNull($adapter->promise()->done(null, function () use ($promise) { + return $promise; + })); + $adapter->reject(1); + $d->reject(1); + } + + /** @test */ + public function doneShouldThrowExceptionProvidedAsRejectionValue() + { + $adapter = $this->getPromiseTestAdapter(); + + $this->setExpectedException('\Exception', 'UnhandledRejectionException'); + + $this->assertNull($adapter->promise()->done()); + $adapter->reject(new \Exception('UnhandledRejectionException')); + } + + /** @test */ + public function doneShouldThrowWithDeepNestingPromiseChains() + { + $this->setExpectedException('\Exception', 'UnhandledRejectionException'); + + $exception = new \Exception('UnhandledRejectionException'); + + $d = new Deferred(); + + $result = \React\Promise\resolve(\React\Promise\resolve($d->promise()->then(function () use ($exception) { + $d = new Deferred(); + $d->resolve(); + + return \React\Promise\resolve($d->promise()->then(function () {}))->then( + function () use ($exception) { + throw $exception; + } + ); + }))); + + $result->done(); + + $d->resolve(); + } + + /** @test */ + public function doneShouldRecoverWhenRejectionHandlerCatchesException() + { + $adapter = $this->getPromiseTestAdapter(); + + $this->assertNull($adapter->promise()->done(null, function (\Exception $e) { + + })); + $adapter->reject(new \Exception('UnhandledRejectionException')); + } + + /** @test */ + public function alwaysShouldNotSuppressRejection() + { + $adapter = $this->getPromiseTestAdapter(); + + $exception = new \Exception(); + + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo($exception)); + + $adapter->promise() + ->always(function () {}) + ->then(null, $mock); + + $adapter->reject($exception); + } + + /** @test */ + public function alwaysShouldNotSuppressRejectionWhenHandlerReturnsANonPromise() + { + $adapter = $this->getPromiseTestAdapter(); + + $exception = new \Exception(); + + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo($exception)); + + $adapter->promise() + ->always(function () { + return 1; + }) + ->then(null, $mock); + + $adapter->reject($exception); + } + + /** @test */ + public function alwaysShouldNotSuppressRejectionWhenHandlerReturnsAPromise() + { + $adapter = $this->getPromiseTestAdapter(); + + $exception = new \Exception(); + + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo($exception)); + + $adapter->promise() + ->always(function () { + return \React\Promise\resolve(1); + }) + ->then(null, $mock); + + $adapter->reject($exception); + } + + /** @test */ + public function alwaysShouldRejectWhenHandlerThrowsForRejection() + { + $adapter = $this->getPromiseTestAdapter(); + + $exception = new \Exception(); + + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo($exception)); + + $adapter->promise() + ->always(function () use ($exception) { + throw $exception; + }) + ->then(null, $mock); + + $adapter->reject($exception); + } + + /** @test */ + public function alwaysShouldRejectWhenHandlerRejectsForRejection() + { + $adapter = $this->getPromiseTestAdapter(); + + $exception = new \Exception(); + + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo($exception)); + + $adapter->promise() + ->always(function () use ($exception) { + return \React\Promise\reject($exception); + }) + ->then(null, $mock); + + $adapter->reject($exception); + } +} diff --git a/openml_OS/vendor/react/promise/tests/PromiseTest/ResolveTestTrait.php b/openml_OS/vendor/react/promise/tests/PromiseTest/ResolveTestTrait.php new file mode 100644 index 000000000..0736d35a0 --- /dev/null +++ b/openml_OS/vendor/react/promise/tests/PromiseTest/ResolveTestTrait.php @@ -0,0 +1,312 @@ +getPromiseTestAdapter(); + + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo(1)); + + $adapter->promise() + ->then($mock); + + $adapter->resolve(1); + } + + /** @test */ + public function resolveShouldResolveWithPromisedValue() + { + $adapter = $this->getPromiseTestAdapter(); + + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo(1)); + + $adapter->promise() + ->then($mock); + + $adapter->resolve(Promise\resolve(1)); + } + + /** @test */ + public function resolveShouldRejectWhenResolvedWithRejectedPromise() + { + $adapter = $this->getPromiseTestAdapter(); + + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo(1)); + + $adapter->promise() + ->then($this->expectCallableNever(), $mock); + + $adapter->resolve(Promise\reject(1)); + } + + /** @test */ + public function resolveShouldForwardValueWhenCallbackIsNull() + { + $adapter = $this->getPromiseTestAdapter(); + + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo(1)); + + $adapter->promise() + ->then( + null, + $this->expectCallableNever() + ) + ->then( + $mock, + $this->expectCallableNever() + ); + + $adapter->resolve(1); + } + + /** @test */ + public function resolveShouldMakePromiseImmutable() + { + $adapter = $this->getPromiseTestAdapter(); + + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo(1)); + + $adapter->promise() + ->then(function ($value) use ($adapter) { + $adapter->resolve(3); + + return $value; + }) + ->then( + $mock, + $this->expectCallableNever() + ); + + $adapter->resolve(1); + $adapter->resolve(2); + } + + /** + * @test + */ + public function resolveShouldRejectWhenResolvedWithItself() + { + $adapter = $this->getPromiseTestAdapter(); + + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with(new \LogicException('Cannot resolve a promise with itself.')); + + $adapter->promise() + ->then( + $this->expectCallableNever(), + $mock + ); + + $adapter->resolve($adapter->promise()); + } + + /** + * @test + */ + public function resolveShouldRejectWhenResolvedWithAPromiseWhichFollowsItself() + { + $adapter1 = $this->getPromiseTestAdapter(); + $adapter2 = $this->getPromiseTestAdapter(); + + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with(new \LogicException('Cannot resolve a promise with itself.')); + + $promise1 = $adapter1->promise(); + + $promise2 = $adapter2->promise(); + + $promise2->then( + $this->expectCallableNever(), + $mock + ); + + $adapter1->resolve($promise2); + $adapter2->resolve($promise1); + } + + /** @test */ + public function doneShouldInvokeFulfillmentHandler() + { + $adapter = $this->getPromiseTestAdapter(); + + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo(1)); + + $this->assertNull($adapter->promise()->done($mock)); + $adapter->resolve(1); + } + + /** @test */ + public function doneShouldThrowExceptionThrownFulfillmentHandler() + { + $adapter = $this->getPromiseTestAdapter(); + + $this->setExpectedException('\Exception', 'UnhandledRejectionException'); + + $this->assertNull($adapter->promise()->done(function () { + throw new \Exception('UnhandledRejectionException'); + })); + $adapter->resolve(1); + } + + /** @test */ + public function doneShouldThrowUnhandledRejectionExceptionWhenFulfillmentHandlerRejects() + { + $adapter = $this->getPromiseTestAdapter(); + + $this->setExpectedException('React\\Promise\\UnhandledRejectionException'); + + $this->assertNull($adapter->promise()->done(function () { + return \React\Promise\reject(); + })); + $adapter->resolve(1); + } + + /** @test */ + public function alwaysShouldNotSuppressValue() + { + $adapter = $this->getPromiseTestAdapter(); + + $value = new \stdClass(); + + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo($value)); + + $adapter->promise() + ->always(function () {}) + ->then($mock); + + $adapter->resolve($value); + } + + /** @test */ + public function alwaysShouldNotSuppressValueWhenHandlerReturnsANonPromise() + { + $adapter = $this->getPromiseTestAdapter(); + + $value = new \stdClass(); + + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo($value)); + + $adapter->promise() + ->always(function () { + return 1; + }) + ->then($mock); + + $adapter->resolve($value); + } + + /** @test */ + public function alwaysShouldNotSuppressValueWhenHandlerReturnsAPromise() + { + $adapter = $this->getPromiseTestAdapter(); + + $value = new \stdClass(); + + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo($value)); + + $adapter->promise() + ->always(function () { + return \React\Promise\resolve(1); + }) + ->then($mock); + + $adapter->resolve($value); + } + + /** @test */ + public function alwaysShouldRejectWhenHandlerThrowsForFulfillment() + { + $adapter = $this->getPromiseTestAdapter(); + + $exception = new \Exception(); + + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo($exception)); + + $adapter->promise() + ->always(function () use ($exception) { + throw $exception; + }) + ->then(null, $mock); + + $adapter->resolve(1); + } + + /** @test */ + public function alwaysShouldRejectWhenHandlerRejectsForFulfillment() + { + $adapter = $this->getPromiseTestAdapter(); + + $exception = new \Exception(); + + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke') + ->with($this->identicalTo($exception)); + + $adapter->promise() + ->always(function () use ($exception) { + return \React\Promise\reject($exception); + }) + ->then(null, $mock); + + $adapter->resolve(1); + } +} diff --git a/openml_OS/vendor/react/promise/tests/RejectedPromiseTest.php b/openml_OS/vendor/react/promise/tests/RejectedPromiseTest.php new file mode 100644 index 000000000..825f56cd6 --- /dev/null +++ b/openml_OS/vendor/react/promise/tests/RejectedPromiseTest.php @@ -0,0 +1,76 @@ + function () use (&$promise) { + if (!$promise) { + throw new \LogicException('RejectedPromise must be rejected before obtaining the promise'); + } + + return $promise; + }, + 'resolve' => function () { + throw new \LogicException('You cannot call resolve() for React\Promise\RejectedPromise'); + }, + 'reject' => function ($reason = null) use (&$promise) { + if (!$promise) { + $promise = new RejectedPromise($reason); + } + }, + 'notify' => function () { + // no-op + }, + 'settle' => function ($reason = null) use (&$promise) { + if (!$promise) { + $promise = new RejectedPromise($reason); + } + }, + ]); + } + + /** @test */ + public function shouldThrowExceptionIfConstructedWithAPromise() + { + $this->setExpectedException('\InvalidArgumentException'); + + return new RejectedPromise(new RejectedPromise()); + } + + /** @test */ + public function shouldNotLeaveGarbageCyclesWhenRemovingLastReferenceToRejectedPromiseWithAlwaysFollowers() + { + gc_collect_cycles(); + $promise = new RejectedPromise(1); + $promise->always(function () { + throw new \RuntimeException(); + }); + unset($promise); + + $this->assertSame(0, gc_collect_cycles()); + } + + /** @test */ + public function shouldNotLeaveGarbageCyclesWhenRemovingLastReferenceToRejectedPromiseWithThenFollowers() + { + gc_collect_cycles(); + $promise = new RejectedPromise(1); + $promise = $promise->then(null, function () { + throw new \RuntimeException(); + }); + unset($promise); + + $this->assertSame(0, gc_collect_cycles()); + } +} diff --git a/openml_OS/vendor/react/promise/tests/Stub/CallableStub.php b/openml_OS/vendor/react/promise/tests/Stub/CallableStub.php new file mode 100644 index 000000000..012089335 --- /dev/null +++ b/openml_OS/vendor/react/promise/tests/Stub/CallableStub.php @@ -0,0 +1,10 @@ +createCallableMock(); + $mock + ->expects($this->exactly($amount)) + ->method('__invoke'); + + return $mock; + } + + public function expectCallableOnce() + { + $mock = $this->createCallableMock(); + $mock + ->expects($this->once()) + ->method('__invoke'); + + return $mock; + } + + public function expectCallableNever() + { + $mock = $this->createCallableMock(); + $mock + ->expects($this->never()) + ->method('__invoke'); + + return $mock; + } + + public function createCallableMock() + { + return $this + ->getMockBuilder('React\\Promise\Stub\CallableStub') + ->getMock(); + } +} diff --git a/openml_OS/vendor/react/promise/tests/bootstrap.php b/openml_OS/vendor/react/promise/tests/bootstrap.php new file mode 100644 index 000000000..9b7f872a5 --- /dev/null +++ b/openml_OS/vendor/react/promise/tests/bootstrap.php @@ -0,0 +1,7 @@ +addPsr4('React\\Promise\\', __DIR__); diff --git a/openml_OS/vendor/react/promise/tests/fixtures/SimpleFulfilledTestPromise.php b/openml_OS/vendor/react/promise/tests/fixtures/SimpleFulfilledTestPromise.php new file mode 100644 index 000000000..ef4d5301c --- /dev/null +++ b/openml_OS/vendor/react/promise/tests/fixtures/SimpleFulfilledTestPromise.php @@ -0,0 +1,21 @@ +cancelCalled = true; + } +} diff --git a/openml_OS/vendor/react/promise/tests/fixtures/SimpleTestCancellableThenable.php b/openml_OS/vendor/react/promise/tests/fixtures/SimpleTestCancellableThenable.php new file mode 100644 index 000000000..c0f15933a --- /dev/null +++ b/openml_OS/vendor/react/promise/tests/fixtures/SimpleTestCancellableThenable.php @@ -0,0 +1,18 @@ +cancelCalled = true; + } +} diff --git a/openml_OS/views/pages/api_new/v1/xml/data-get.tpl.php b/openml_OS/views/pages/api_new/v1/xml/data-get.tpl.php index 866d3734b..2cf26c3fb 100644 --- a/openml_OS/views/pages/api_new/v1/xml/data-get.tpl.php +++ b/openml_OS/views/pages/api_new/v1/xml/data-get.tpl.php @@ -23,7 +23,7 @@ - +