3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * Factory for search endpoints. */ class SearchEndpointFactory { /** * @var array Holds namespaces for endpoints. */ private static $endpoints = [ 'query' => 'ONGR\ElasticsearchDSL\SearchEndpoint\QueryEndpoint', 'post_filter' => 'ONGR\ElasticsearchDSL\SearchEndpoint\PostFilterEndpoint', 'sort' => 'ONGR\ElasticsearchDSL\SearchEndpoint\SortEndpoint', 'highlight' => 'ONGR\ElasticsearchDSL\SearchEndpoint\HighlightEndpoint', 'aggregations' => 'ONGR\ElasticsearchDSL\SearchEndpoint\AggregationsEndpoint', 'suggest' => 'ONGR\ElasticsearchDSL\SearchEndpoint\SuggestEndpoint', 'inner_hits' => 'ONGR\ElasticsearchDSL\SearchEndpoint\InnerHitsEndpoint', ]; /** * Returns a search endpoint instance. * * @param string $type Type of endpoint. * * @return SearchEndpointInterface * * @throws \RuntimeException Endpoint does not exist. */ public static function get($type) { if (!array_key_exists($type, self::$endpoints)) { throw new \RuntimeException('Endpoint does not exist.'); } var_dump((self::$endpoints[$type])); die; return new (self::$endpoints[$type])(); } } var_dump(SearchEndpointFactory::get('query'));
Output for git.master_jit, git.master
string(50) "ONGR\ElasticsearchDSL\SearchEndpoint\QueryEndpoint"

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
46.39 ms | 710 KiB | 4 Q