repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_code_tokens listlengths 15 672k | func_documentation_string stringlengths 1 47.2k | func_documentation_tokens listlengths 1 3.92k | split_name stringclasses 1
value | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|---|---|---|
ongr-io/ElasticsearchBundle | Service/ExportService.php | ExportService.getFileCount | protected function getFileCount($resultsCount, $maxLinesInFile, $fileCounter)
{
$leftToInsert = $resultsCount - ($fileCounter * $maxLinesInFile);
if ($leftToInsert <= $maxLinesInFile) {
$count = $leftToInsert;
} else {
$count = $maxLinesInFile;
}
retu... | php | protected function getFileCount($resultsCount, $maxLinesInFile, $fileCounter)
{
$leftToInsert = $resultsCount - ($fileCounter * $maxLinesInFile);
if ($leftToInsert <= $maxLinesInFile) {
$count = $leftToInsert;
} else {
$count = $maxLinesInFile;
}
retu... | [
"protected",
"function",
"getFileCount",
"(",
"$",
"resultsCount",
",",
"$",
"maxLinesInFile",
",",
"$",
"fileCounter",
")",
"{",
"$",
"leftToInsert",
"=",
"$",
"resultsCount",
"-",
"(",
"$",
"fileCounter",
"*",
"$",
"maxLinesInFile",
")",
";",
"if",
"(",
... | @param int $resultsCount
@param int $maxLinesInFile
@param int $fileCounter
@return int | [
"@param",
"int",
"$resultsCount",
"@param",
"int",
"$maxLinesInFile",
"@param",
"int",
"$fileCounter"
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Service/ExportService.php#L148-L158 |
ongr-io/ElasticsearchBundle | DependencyInjection/Compiler/MappingPass.php | MappingPass.process | public function process(ContainerBuilder $container)
{
$analysis = $container->getParameter('es.analysis');
$managers = $container->getParameter('es.managers');
$collector = $container->get('es.metadata_collector');
foreach ($managers as $managerName => $manager) {
$con... | php | public function process(ContainerBuilder $container)
{
$analysis = $container->getParameter('es.analysis');
$managers = $container->getParameter('es.managers');
$collector = $container->get('es.metadata_collector');
foreach ($managers as $managerName => $manager) {
$con... | [
"public",
"function",
"process",
"(",
"ContainerBuilder",
"$",
"container",
")",
"{",
"$",
"analysis",
"=",
"$",
"container",
"->",
"getParameter",
"(",
"'es.analysis'",
")",
";",
"$",
"managers",
"=",
"$",
"container",
"->",
"getParameter",
"(",
"'es.managers... | {@inheritdoc} | [
"{"
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/DependencyInjection/Compiler/MappingPass.php#L28-L94 |
ongr-io/ElasticsearchBundle | Command/CacheClearCommand.php | CacheClearCommand.execute | protected function execute(InputInterface $input, OutputInterface $output)
{
$io = new SymfonyStyle($input, $output);
$this
->getManager($input->getOption('manager'))
->clearCache();
$io->success(
sprintf(
'Elasticsearch index cache has bee... | php | protected function execute(InputInterface $input, OutputInterface $output)
{
$io = new SymfonyStyle($input, $output);
$this
->getManager($input->getOption('manager'))
->clearCache();
$io->success(
sprintf(
'Elasticsearch index cache has bee... | [
"protected",
"function",
"execute",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
"{",
"$",
"io",
"=",
"new",
"SymfonyStyle",
"(",
"$",
"input",
",",
"$",
"output",
")",
";",
"$",
"this",
"->",
"getManager",
"(",
"$",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Command/CacheClearCommand.php#L40-L52 |
ongr-io/ElasticsearchBundle | Mapping/MetadataCollector.php | MetadataCollector.getMappings | public function getMappings(array $bundles)
{
$output = [];
foreach ($bundles as $name => $bundleConfig) {
// Backward compatibility hack for support.
if (!is_array($bundleConfig)) {
$name = $bundleConfig;
$bundleConfig = [];
}
... | php | public function getMappings(array $bundles)
{
$output = [];
foreach ($bundles as $name => $bundleConfig) {
// Backward compatibility hack for support.
if (!is_array($bundleConfig)) {
$name = $bundleConfig;
$bundleConfig = [];
}
... | [
"public",
"function",
"getMappings",
"(",
"array",
"$",
"bundles",
")",
"{",
"$",
"output",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"bundles",
"as",
"$",
"name",
"=>",
"$",
"bundleConfig",
")",
"{",
"// Backward compatibility hack for support.",
"if",
"(",
... | Fetches bundles mapping from documents.
@param string[] $bundles Elasticsearch manager config. You can get bundles list from 'mappings' node.
@return array | [
"Fetches",
"bundles",
"mapping",
"from",
"documents",
"."
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Mapping/MetadataCollector.php#L71-L95 |
ongr-io/ElasticsearchBundle | Mapping/MetadataCollector.php | MetadataCollector.getBundleMapping | public function getBundleMapping($name, $config = [])
{
if (!is_string($name)) {
throw new \LogicException('getBundleMapping() in the Metadata collector expects a string argument only!');
}
$cacheName = 'ongr.metadata.mapping.' . md5($name.serialize($config));
$this->e... | php | public function getBundleMapping($name, $config = [])
{
if (!is_string($name)) {
throw new \LogicException('getBundleMapping() in the Metadata collector expects a string argument only!');
}
$cacheName = 'ongr.metadata.mapping.' . md5($name.serialize($config));
$this->e... | [
"public",
"function",
"getBundleMapping",
"(",
"$",
"name",
",",
"$",
"config",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"name",
")",
")",
"{",
"throw",
"new",
"\\",
"LogicException",
"(",
"'getBundleMapping() in the Metadata collector... | Searches for documents in the bundle and tries to read them.
@param string $name
@param array $config Bundle configuration
@return array Empty array on containing zero documents. | [
"Searches",
"for",
"documents",
"in",
"the",
"bundle",
"and",
"tries",
"to",
"read",
"them",
"."
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Mapping/MetadataCollector.php#L105-L172 |
ongr-io/ElasticsearchBundle | Mapping/MetadataCollector.php | MetadataCollector.getClientMapping | public function getClientMapping(array $bundles)
{
/** @var array $typesMapping Array of filtered mappings for the elasticsearch client*/
$typesMapping = null;
/** @var array $mappings All mapping info */
$mappings = $this->getMappings($bundles);
foreach ($mappings as $type... | php | public function getClientMapping(array $bundles)
{
/** @var array $typesMapping Array of filtered mappings for the elasticsearch client*/
$typesMapping = null;
/** @var array $mappings All mapping info */
$mappings = $this->getMappings($bundles);
foreach ($mappings as $type... | [
"public",
"function",
"getClientMapping",
"(",
"array",
"$",
"bundles",
")",
"{",
"/** @var array $typesMapping Array of filtered mappings for the elasticsearch client*/",
"$",
"typesMapping",
"=",
"null",
";",
"/** @var array $mappings All mapping info */",
"$",
"mappings",
"=",... | Retrieves prepared mapping to sent to the elasticsearch client.
@param array $bundles Manager config.
@return array|null | [
"Retrieves",
"prepared",
"mapping",
"to",
"sent",
"to",
"the",
"elasticsearch",
"client",
"."
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Mapping/MetadataCollector.php#L207-L230 |
ongr-io/ElasticsearchBundle | Mapping/MetadataCollector.php | MetadataCollector.getClientAnalysis | public function getClientAnalysis(array $bundles, $analysisConfig = [])
{
$cacheName = 'ongr.metadata.analysis.'.md5(serialize($bundles));
$this->enableCache && $typesAnalysis = $this->cache->fetch($cacheName);
if (isset($typesAnalysis) && false !== $typesAnalysis) {
return $typ... | php | public function getClientAnalysis(array $bundles, $analysisConfig = [])
{
$cacheName = 'ongr.metadata.analysis.'.md5(serialize($bundles));
$this->enableCache && $typesAnalysis = $this->cache->fetch($cacheName);
if (isset($typesAnalysis) && false !== $typesAnalysis) {
return $typ... | [
"public",
"function",
"getClientAnalysis",
"(",
"array",
"$",
"bundles",
",",
"$",
"analysisConfig",
"=",
"[",
"]",
")",
"{",
"$",
"cacheName",
"=",
"'ongr.metadata.analysis.'",
".",
"md5",
"(",
"serialize",
"(",
"$",
"bundles",
")",
")",
";",
"$",
"this",... | Prepares analysis node for Elasticsearch client.
@param array $bundles
@param array $analysisConfig
@return array | [
"Prepares",
"analysis",
"node",
"for",
"Elasticsearch",
"client",
"."
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Mapping/MetadataCollector.php#L240-L294 |
ongr-io/ElasticsearchBundle | Mapping/MetadataCollector.php | MetadataCollector.getAnalysisNodeConfiguration | private function getAnalysisNodeConfiguration($type, $analyzer, $analysisConfig, $container = [])
{
if (isset($analyzer[$type])) {
if (is_array($analyzer[$type])) {
foreach ($analyzer[$type] as $filter) {
if (isset($analysisConfig[$type][$filter])) {
... | php | private function getAnalysisNodeConfiguration($type, $analyzer, $analysisConfig, $container = [])
{
if (isset($analyzer[$type])) {
if (is_array($analyzer[$type])) {
foreach ($analyzer[$type] as $filter) {
if (isset($analysisConfig[$type][$filter])) {
... | [
"private",
"function",
"getAnalysisNodeConfiguration",
"(",
"$",
"type",
",",
"$",
"analyzer",
",",
"$",
"analysisConfig",
",",
"$",
"container",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"analyzer",
"[",
"$",
"type",
"]",
")",
")",
"{",
... | Prepares analysis node content for Elasticsearch client.
@param string $type Node type: filter, tokenizer or char_filter
@param array $analyzer Analyzer from which used helpers will be extracted.
@param array $analysisConfig Pre configured analyzers container
@param array $container Current analysis container where pr... | [
"Prepares",
"analysis",
"node",
"content",
"for",
"Elasticsearch",
"client",
"."
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Mapping/MetadataCollector.php#L306-L322 |
ongr-io/ElasticsearchBundle | Mapping/MetadataCollector.php | MetadataCollector.getMapping | public function getMapping($namespace)
{
$cacheName = 'ongr.metadata.document.'.md5($namespace);
$namespace = $this->getClassName($namespace);
$this->enableCache && $mapping = $this->cache->fetch($cacheName);
if (isset($mapping) && false !== $mapping) {
return $mapping;... | php | public function getMapping($namespace)
{
$cacheName = 'ongr.metadata.document.'.md5($namespace);
$namespace = $this->getClassName($namespace);
$this->enableCache && $mapping = $this->cache->fetch($cacheName);
if (isset($mapping) && false !== $mapping) {
return $mapping;... | [
"public",
"function",
"getMapping",
"(",
"$",
"namespace",
")",
"{",
"$",
"cacheName",
"=",
"'ongr.metadata.document.'",
".",
"md5",
"(",
"$",
"namespace",
")",
";",
"$",
"namespace",
"=",
"$",
"this",
"->",
"getClassName",
"(",
"$",
"namespace",
")",
";",... | Returns single document mapping metadata.
@param string $namespace Document namespace
@return array
@throws DocumentParserException | [
"Returns",
"single",
"document",
"mapping",
"metadata",
"."
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Mapping/MetadataCollector.php#L345-L361 |
ongr-io/ElasticsearchBundle | Result/Converter.php | Converter.convertToDocument | public function convertToDocument($rawData, Manager $manager)
{
$types = $this->metadataCollector->getMappings($manager->getConfig()['mappings']);
if (isset($types[$rawData['_type']])) {
$metadata = $types[$rawData['_type']];
} else {
throw new \LogicException("Got d... | php | public function convertToDocument($rawData, Manager $manager)
{
$types = $this->metadataCollector->getMappings($manager->getConfig()['mappings']);
if (isset($types[$rawData['_type']])) {
$metadata = $types[$rawData['_type']];
} else {
throw new \LogicException("Got d... | [
"public",
"function",
"convertToDocument",
"(",
"$",
"rawData",
",",
"Manager",
"$",
"manager",
")",
"{",
"$",
"types",
"=",
"$",
"this",
"->",
"metadataCollector",
"->",
"getMappings",
"(",
"$",
"manager",
"->",
"getConfig",
"(",
")",
"[",
"'mappings'",
"... | Converts raw array to document.
@param array $rawData
@param Manager $manager
@return object
@throws \LogicException | [
"Converts",
"raw",
"array",
"to",
"document",
"."
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Result/Converter.php#L50-L75 |
ongr-io/ElasticsearchBundle | Result/Converter.php | Converter.assignArrayToObject | public function assignArrayToObject(array $array, $object, array $aliases)
{
foreach ($array as $name => $value) {
if (!isset($aliases[$name])) {
continue;
}
if (isset($aliases[$name]['type'])) {
switch ($aliases[$name]['type']) {
... | php | public function assignArrayToObject(array $array, $object, array $aliases)
{
foreach ($array as $name => $value) {
if (!isset($aliases[$name])) {
continue;
}
if (isset($aliases[$name]['type'])) {
switch ($aliases[$name]['type']) {
... | [
"public",
"function",
"assignArrayToObject",
"(",
"array",
"$",
"array",
",",
"$",
"object",
",",
"array",
"$",
"aliases",
")",
"{",
"foreach",
"(",
"$",
"array",
"as",
"$",
"name",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"... | Assigns all properties to object.
@param array $array
@param object $object
@param array $aliases
@return object | [
"Assigns",
"all",
"properties",
"to",
"object",
"."
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Result/Converter.php#L86-L141 |
ongr-io/ElasticsearchBundle | Result/Converter.php | Converter.convertToArray | public function convertToArray($object, $aliases = [], $fields = [])
{
if (empty($aliases)) {
$aliases = $this->getAlias($object);
if (count($fields) > 0) {
$aliases = array_intersect_key($aliases, array_flip($fields));
}
}
$array = [];
... | php | public function convertToArray($object, $aliases = [], $fields = [])
{
if (empty($aliases)) {
$aliases = $this->getAlias($object);
if (count($fields) > 0) {
$aliases = array_intersect_key($aliases, array_flip($fields));
}
}
$array = [];
... | [
"public",
"function",
"convertToArray",
"(",
"$",
"object",
",",
"$",
"aliases",
"=",
"[",
"]",
",",
"$",
"fields",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"aliases",
")",
")",
"{",
"$",
"aliases",
"=",
"$",
"this",
"->",
"getAlias... | Converts object to an array.
@param mixed $object
@param array $aliases
@param array $fields
@return array | [
"Converts",
"object",
"to",
"an",
"array",
"."
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Result/Converter.php#L152-L221 |
ongr-io/ElasticsearchBundle | Result/Converter.php | Converter.checkVariableType | private function checkVariableType($object, array $expectedClasses)
{
if (!is_object($object)) {
$msg = 'Expected variable of type object, got ' . gettype($object) . ". (field isn't multiple)";
throw new \InvalidArgumentException($msg);
}
$classes = class_parents($ob... | php | private function checkVariableType($object, array $expectedClasses)
{
if (!is_object($object)) {
$msg = 'Expected variable of type object, got ' . gettype($object) . ". (field isn't multiple)";
throw new \InvalidArgumentException($msg);
}
$classes = class_parents($ob... | [
"private",
"function",
"checkVariableType",
"(",
"$",
"object",
",",
"array",
"$",
"expectedClasses",
")",
"{",
"if",
"(",
"!",
"is_object",
"(",
"$",
"object",
")",
")",
"{",
"$",
"msg",
"=",
"'Expected variable of type object, got '",
".",
"gettype",
"(",
... | Check if class matches the expected one.
@param object $object
@param array $expectedClasses
@throws \InvalidArgumentException | [
"Check",
"if",
"class",
"matches",
"the",
"expected",
"one",
"."
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Result/Converter.php#L231-L243 |
ongr-io/ElasticsearchBundle | Result/Converter.php | Converter.isCollection | private function isCollection($property, $value)
{
if (!$value instanceof Collection) {
$got = is_object($value) ? get_class($value) : gettype($value);
throw new \InvalidArgumentException(
sprintf('Value of "%s" property must be an instance of Collection, got %s.', $... | php | private function isCollection($property, $value)
{
if (!$value instanceof Collection) {
$got = is_object($value) ? get_class($value) : gettype($value);
throw new \InvalidArgumentException(
sprintf('Value of "%s" property must be an instance of Collection, got %s.', $... | [
"private",
"function",
"isCollection",
"(",
"$",
"property",
",",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"$",
"value",
"instanceof",
"Collection",
")",
"{",
"$",
"got",
"=",
"is_object",
"(",
"$",
"value",
")",
"?",
"get_class",
"(",
"$",
"value",
"... | Check if value is instance of Collection.
@param string $property
@param mixed $value
@throws \InvalidArgumentException | [
"Check",
"if",
"value",
"is",
"instance",
"of",
"Collection",
"."
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Result/Converter.php#L253-L262 |
ongr-io/ElasticsearchBundle | Command/IndexImportCommand.php | IndexImportCommand.execute | protected function execute(InputInterface $input, OutputInterface $output)
{
$io = new SymfonyStyle($input, $output);
$manager = $this->getManager($input->getOption('manager'));
// Initialize options array
$options = [];
if ($input->getOption('gzip')) {
$options[... | php | protected function execute(InputInterface $input, OutputInterface $output)
{
$io = new SymfonyStyle($input, $output);
$manager = $this->getManager($input->getOption('manager'));
// Initialize options array
$options = [];
if ($input->getOption('gzip')) {
$options[... | [
"protected",
"function",
"execute",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
"{",
"$",
"io",
"=",
"new",
"SymfonyStyle",
"(",
"$",
"input",
",",
"$",
"output",
")",
";",
"$",
"manager",
"=",
"$",
"this",
"->",
"g... | {@inheritdoc} | [
"{"
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Command/IndexImportCommand.php#L61-L83 |
ongr-io/ElasticsearchBundle | Service/ManagerFactory.php | ManagerFactory.createManager | public function createManager($managerName, $connection, $analysis, $managerConfig)
{
$mappings = $this->metadataCollector->getClientMapping($managerConfig['mappings']);
$client = ClientBuilder::create();
$client->setHosts($connection['hosts']);
$client->setTracer($this->tracer);
... | php | public function createManager($managerName, $connection, $analysis, $managerConfig)
{
$mappings = $this->metadataCollector->getClientMapping($managerConfig['mappings']);
$client = ClientBuilder::create();
$client->setHosts($connection['hosts']);
$client->setTracer($this->tracer);
... | [
"public",
"function",
"createManager",
"(",
"$",
"managerName",
",",
"$",
"connection",
",",
"$",
"analysis",
",",
"$",
"managerConfig",
")",
"{",
"$",
"mappings",
"=",
"$",
"this",
"->",
"metadataCollector",
"->",
"getClientMapping",
"(",
"$",
"managerConfig"... | Factory function to create a manager instance.
@param string $managerName Manager name.
@param array $connection Connection configuration.
@param array $analysis Analyzers, filters and tokenizers config.
@param array $managerConfig Manager configuration.
@return Manager | [
"Factory",
"function",
"to",
"create",
"a",
"manager",
"instance",
"."
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Service/ManagerFactory.php#L99-L155 |
ongr-io/ElasticsearchBundle | Profiler/ElasticsearchProfiler.php | ElasticsearchProfiler.collect | public function collect(Request $request, Response $response, \Exception $exception = null)
{
/** @var Logger $logger */
foreach ($this->loggers as $logger) {
foreach ($logger->getHandlers() as $handler) {
if ($handler instanceof CollectionHandler) {
$... | php | public function collect(Request $request, Response $response, \Exception $exception = null)
{
/** @var Logger $logger */
foreach ($this->loggers as $logger) {
foreach ($logger->getHandlers() as $handler) {
if ($handler instanceof CollectionHandler) {
$... | [
"public",
"function",
"collect",
"(",
"Request",
"$",
"request",
",",
"Response",
"$",
"response",
",",
"\\",
"Exception",
"$",
"exception",
"=",
"null",
")",
"{",
"/** @var Logger $logger */",
"foreach",
"(",
"$",
"this",
"->",
"loggers",
"as",
"$",
"logger... | {@inheritdoc} | [
"{"
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Profiler/ElasticsearchProfiler.php#L65-L76 |
ongr-io/ElasticsearchBundle | Profiler/ElasticsearchProfiler.php | ElasticsearchProfiler.handleRecords | private function handleRecords($route, $records)
{
$this->count += count($records) / 2;
$queryBody = '';
foreach ($records as $record) {
// First record will never have context.
if (!empty($record['context'])) {
$this->time += $record['context']['durat... | php | private function handleRecords($route, $records)
{
$this->count += count($records) / 2;
$queryBody = '';
foreach ($records as $record) {
// First record will never have context.
if (!empty($record['context'])) {
$this->time += $record['context']['durat... | [
"private",
"function",
"handleRecords",
"(",
"$",
"route",
",",
"$",
"records",
")",
"{",
"$",
"this",
"->",
"count",
"+=",
"count",
"(",
"$",
"records",
")",
"/",
"2",
";",
"$",
"queryBody",
"=",
"''",
";",
"foreach",
"(",
"$",
"records",
"as",
"$... | Handles passed records.
@param string $route
@param array $records | [
"Handles",
"passed",
"records",
"."
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Profiler/ElasticsearchProfiler.php#L160-L174 |
ongr-io/ElasticsearchBundle | Profiler/ElasticsearchProfiler.php | ElasticsearchProfiler.addQuery | private function addQuery($route, $record, $queryBody)
{
parse_str(parse_url($record['context']['uri'], PHP_URL_QUERY), $httpParameters);
$body = json_decode(trim($queryBody, " '\r\t\n"));
$this->queries[$route][] = array_merge(
[
'body' => $body !== null ? json_e... | php | private function addQuery($route, $record, $queryBody)
{
parse_str(parse_url($record['context']['uri'], PHP_URL_QUERY), $httpParameters);
$body = json_decode(trim($queryBody, " '\r\t\n"));
$this->queries[$route][] = array_merge(
[
'body' => $body !== null ? json_e... | [
"private",
"function",
"addQuery",
"(",
"$",
"route",
",",
"$",
"record",
",",
"$",
"queryBody",
")",
"{",
"parse_str",
"(",
"parse_url",
"(",
"$",
"record",
"[",
"'context'",
"]",
"[",
"'uri'",
"]",
",",
"PHP_URL_QUERY",
")",
",",
"$",
"httpParameters",... | Adds query to collected data array.
@param string $route
@param array $record
@param string $queryBody | [
"Adds",
"query",
"to",
"collected",
"data",
"array",
"."
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Profiler/ElasticsearchProfiler.php#L183-L196 |
ongr-io/ElasticsearchBundle | Profiler/ElasticsearchProfiler.php | ElasticsearchProfiler.getRoute | private function getRoute(Request $request)
{
$route = $request->attributes->get('_route');
return empty($route) ? self::UNDEFINED_ROUTE : $route;
} | php | private function getRoute(Request $request)
{
$route = $request->attributes->get('_route');
return empty($route) ? self::UNDEFINED_ROUTE : $route;
} | [
"private",
"function",
"getRoute",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"route",
"=",
"$",
"request",
"->",
"attributes",
"->",
"get",
"(",
"'_route'",
")",
";",
"return",
"empty",
"(",
"$",
"route",
")",
"?",
"self",
"::",
"UNDEFINED_ROUTE",
... | Returns route name from request.
@param Request $request
@return string | [
"Returns",
"route",
"name",
"from",
"request",
"."
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Profiler/ElasticsearchProfiler.php#L205-L210 |
ongr-io/ElasticsearchBundle | Result/AbstractResultsIterator.php | AbstractResultsIterator.getAggregation | public function getAggregation($name)
{
if (isset($this->aggregations[$name])) {
return $this->aggregations[$name];
}
return null;
} | php | public function getAggregation($name)
{
if (isset($this->aggregations[$name])) {
return $this->aggregations[$name];
}
return null;
} | [
"public",
"function",
"getAggregation",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"aggregations",
"[",
"$",
"name",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"aggregations",
"[",
"$",
"name",
"]",
";",
"}",
"ret... | Returns specific aggregation by name.
@param string $name
@return array | [
"Returns",
"specific",
"aggregation",
"by",
"name",
"."
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Result/AbstractResultsIterator.php#L143-L149 |
ongr-io/ElasticsearchBundle | Result/AbstractResultsIterator.php | AbstractResultsIterator.valid | public function valid()
{
if (!isset($this->documents)) {
return false;
}
$valid = $this->documentExists($this->key());
if ($valid) {
return true;
}
$this->page();
return $this->documentExists($this->key());
} | php | public function valid()
{
if (!isset($this->documents)) {
return false;
}
$valid = $this->documentExists($this->key());
if ($valid) {
return true;
}
$this->page();
return $this->documentExists($this->key());
} | [
"public",
"function",
"valid",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"documents",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"valid",
"=",
"$",
"this",
"->",
"documentExists",
"(",
"$",
"this",
"->",
"key",
"(",
")... | Checks if current position is valid.
@return bool | [
"Checks",
"if",
"current",
"position",
"is",
"valid",
"."
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Result/AbstractResultsIterator.php#L202-L216 |
ongr-io/ElasticsearchBundle | Result/AbstractResultsIterator.php | AbstractResultsIterator.getDocument | protected function getDocument($key)
{
if (!$this->documentExists($key)) {
return null;
}
return $this->convertDocument($this->documents[$key]);
} | php | protected function getDocument($key)
{
if (!$this->documentExists($key)) {
return null;
}
return $this->convertDocument($this->documents[$key]);
} | [
"protected",
"function",
"getDocument",
"(",
"$",
"key",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"documentExists",
"(",
"$",
"key",
")",
")",
"{",
"return",
"null",
";",
"}",
"return",
"$",
"this",
"->",
"convertDocument",
"(",
"$",
"this",
"->"... | Gets document array from the container.
@param mixed $key
@return mixed | [
"Gets",
"document",
"array",
"from",
"the",
"container",
"."
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Result/AbstractResultsIterator.php#L257-L264 |
ongr-io/ElasticsearchBundle | Result/AbstractResultsIterator.php | AbstractResultsIterator.advanceKey | protected function advanceKey()
{
if ($this->isScrollable() && ($this->documents[$this->key()] == end($this->documents))) {
$this->page();
} else {
$this->key++;
}
return $this;
} | php | protected function advanceKey()
{
if ($this->isScrollable() && ($this->documents[$this->key()] == end($this->documents))) {
$this->page();
} else {
$this->key++;
}
return $this;
} | [
"protected",
"function",
"advanceKey",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isScrollable",
"(",
")",
"&&",
"(",
"$",
"this",
"->",
"documents",
"[",
"$",
"this",
"->",
"key",
"(",
")",
"]",
"==",
"end",
"(",
"$",
"this",
"->",
"documents",... | Advances key.
@return $this | [
"Advances",
"key",
"."
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Result/AbstractResultsIterator.php#L283-L292 |
ongr-io/ElasticsearchBundle | Result/AbstractResultsIterator.php | AbstractResultsIterator.page | protected function page()
{
if ($this->key() == $this->count() || !$this->isScrollable()) {
return $this;
}
// $raw = $this->manager->scroll($this->scrollId, $this->scrollDuration, Result::RESULTS_RAW);
$raw = $this->manager->getClient()->scroll(
[
... | php | protected function page()
{
if ($this->key() == $this->count() || !$this->isScrollable()) {
return $this;
}
// $raw = $this->manager->scroll($this->scrollId, $this->scrollDuration, Result::RESULTS_RAW);
$raw = $this->manager->getClient()->scroll(
[
... | [
"protected",
"function",
"page",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"key",
"(",
")",
"==",
"$",
"this",
"->",
"count",
"(",
")",
"||",
"!",
"$",
"this",
"->",
"isScrollable",
"(",
")",
")",
"{",
"return",
"$",
"this",
";",
"}",
"// ... | Advances scan page.
@return $this | [
"Advances",
"scan",
"page",
"."
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Result/AbstractResultsIterator.php#L311-L329 |
ongr-io/ElasticsearchBundle | Result/AbstractResultsIterator.php | AbstractResultsIterator.getDocumentScore | public function getDocumentScore()
{
if (!$this->valid()) {
throw new \LogicException('Document score is available only while iterating over results.');
}
if (!isset($this->documents[$this->key]['_score'])) {
return null;
}
return $this->documents[$t... | php | public function getDocumentScore()
{
if (!$this->valid()) {
throw new \LogicException('Document score is available only while iterating over results.');
}
if (!isset($this->documents[$this->key]['_score'])) {
return null;
}
return $this->documents[$t... | [
"public",
"function",
"getDocumentScore",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"valid",
"(",
")",
")",
"{",
"throw",
"new",
"\\",
"LogicException",
"(",
"'Document score is available only while iterating over results.'",
")",
";",
"}",
"if",
"(",
... | Returns score of current hit.
@return int | [
"Returns",
"score",
"of",
"current",
"hit",
"."
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Result/AbstractResultsIterator.php#L336-L347 |
ongr-io/ElasticsearchBundle | Result/AbstractResultsIterator.php | AbstractResultsIterator.getDocumentSort | public function getDocumentSort()
{
if (!$this->valid()) {
throw new \LogicException('Document sort is available only while iterating over results.');
}
if (!isset($this->documents[$this->key]['sort'])) {
return null;
}
return $this->documents[$this-... | php | public function getDocumentSort()
{
if (!$this->valid()) {
throw new \LogicException('Document sort is available only while iterating over results.');
}
if (!isset($this->documents[$this->key]['sort'])) {
return null;
}
return $this->documents[$this-... | [
"public",
"function",
"getDocumentSort",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"valid",
"(",
")",
")",
"{",
"throw",
"new",
"\\",
"LogicException",
"(",
"'Document sort is available only while iterating over results.'",
")",
";",
"}",
"if",
"(",
"!... | Returns sort of current hit.
@return mixed | [
"Returns",
"sort",
"of",
"current",
"hit",
"."
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Result/AbstractResultsIterator.php#L354-L365 |
ongr-io/ElasticsearchBundle | Mapping/Caser.php | Caser.snake | public static function snake($string)
{
$string = preg_replace('#([A-Z\d]+)([A-Z][a-z])#', '\1_\2', self::camel($string));
$string = preg_replace('#([a-z\d])([A-Z])#', '\1_\2', $string);
return strtolower(strtr($string, '-', '_'));
} | php | public static function snake($string)
{
$string = preg_replace('#([A-Z\d]+)([A-Z][a-z])#', '\1_\2', self::camel($string));
$string = preg_replace('#([a-z\d])([A-Z])#', '\1_\2', $string);
return strtolower(strtr($string, '-', '_'));
} | [
"public",
"static",
"function",
"snake",
"(",
"$",
"string",
")",
"{",
"$",
"string",
"=",
"preg_replace",
"(",
"'#([A-Z\\d]+)([A-Z][a-z])#'",
",",
"'\\1_\\2'",
",",
"self",
"::",
"camel",
"(",
"$",
"string",
")",
")",
";",
"$",
"string",
"=",
"preg_replac... | Transforms string to snake case (e.g., result_string).
@param string $string Text to transform.
@return string | [
"Transforms",
"string",
"to",
"snake",
"case",
"(",
"e",
".",
"g",
".",
"result_string",
")",
"."
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Mapping/Caser.php#L40-L46 |
ongr-io/ElasticsearchBundle | Result/Aggregation/AggregationValue.php | AggregationValue.getValue | public function getValue($name = 'key')
{
if (!isset($this->rawData[$name])) {
return null;
}
return $this->rawData[$name];
} | php | public function getValue($name = 'key')
{
if (!isset($this->rawData[$name])) {
return null;
}
return $this->rawData[$name];
} | [
"public",
"function",
"getValue",
"(",
"$",
"name",
"=",
"'key'",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"rawData",
"[",
"$",
"name",
"]",
")",
")",
"{",
"return",
"null",
";",
"}",
"return",
"$",
"this",
"->",
"rawData",
"[",... | Returns aggregation value by name.
@param string $name
@return array | [
"Returns",
"aggregation",
"value",
"by",
"name",
"."
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Result/Aggregation/AggregationValue.php#L41-L48 |
ongr-io/ElasticsearchBundle | Result/Aggregation/AggregationValue.php | AggregationValue.getBuckets | public function getBuckets()
{
if (!isset($this->rawData['buckets'])) {
return null;
}
$buckets = [];
foreach ($this->rawData['buckets'] as $bucket) {
$buckets[] = new self($bucket);
}
return $buckets;
} | php | public function getBuckets()
{
if (!isset($this->rawData['buckets'])) {
return null;
}
$buckets = [];
foreach ($this->rawData['buckets'] as $bucket) {
$buckets[] = new self($bucket);
}
return $buckets;
} | [
"public",
"function",
"getBuckets",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"rawData",
"[",
"'buckets'",
"]",
")",
")",
"{",
"return",
"null",
";",
"}",
"$",
"buckets",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->"... | Returns array of bucket values.
@return AggregationValue[]|null | [
"Returns",
"array",
"of",
"bucket",
"values",
"."
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Result/Aggregation/AggregationValue.php#L65-L78 |
ongr-io/ElasticsearchBundle | Result/Aggregation/AggregationValue.php | AggregationValue.getAggregation | public function getAggregation($name)
{
if (!isset($this->rawData[$name])) {
return null;
}
return new self($this->rawData[$name]);
} | php | public function getAggregation($name)
{
if (!isset($this->rawData[$name])) {
return null;
}
return new self($this->rawData[$name]);
} | [
"public",
"function",
"getAggregation",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"rawData",
"[",
"$",
"name",
"]",
")",
")",
"{",
"return",
"null",
";",
"}",
"return",
"new",
"self",
"(",
"$",
"this",
"->",
"ra... | Returns sub-aggregation.
@param string $name
@return AggregationValue|null | [
"Returns",
"sub",
"-",
"aggregation",
"."
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Result/Aggregation/AggregationValue.php#L87-L94 |
ongr-io/ElasticsearchBundle | Result/Aggregation/AggregationValue.php | AggregationValue.find | public function find($path)
{
$name = explode('.', $path, 2);
$aggregation = $this->getAggregation($name[0]);
if ($aggregation === null || !isset($name[1])) {
return $aggregation;
}
return $aggregation->find($name[1]);
} | php | public function find($path)
{
$name = explode('.', $path, 2);
$aggregation = $this->getAggregation($name[0]);
if ($aggregation === null || !isset($name[1])) {
return $aggregation;
}
return $aggregation->find($name[1]);
} | [
"public",
"function",
"find",
"(",
"$",
"path",
")",
"{",
"$",
"name",
"=",
"explode",
"(",
"'.'",
",",
"$",
"path",
",",
"2",
")",
";",
"$",
"aggregation",
"=",
"$",
"this",
"->",
"getAggregation",
"(",
"$",
"name",
"[",
"0",
"]",
")",
";",
"i... | Applies path method to aggregations.
@param string $path
@return AggregationValue|null | [
"Applies",
"path",
"method",
"to",
"aggregations",
"."
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Result/Aggregation/AggregationValue.php#L103-L113 |
ongr-io/ElasticsearchBundle | Result/Aggregation/AggregationValue.php | AggregationValue.offsetGet | public function offsetGet($offset)
{
if (!isset($this->rawData[$offset])) {
return null;
}
return $this->rawData[$offset];
} | php | public function offsetGet($offset)
{
if (!isset($this->rawData[$offset])) {
return null;
}
return $this->rawData[$offset];
} | [
"public",
"function",
"offsetGet",
"(",
"$",
"offset",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"rawData",
"[",
"$",
"offset",
"]",
")",
")",
"{",
"return",
"null",
";",
"}",
"return",
"$",
"this",
"->",
"rawData",
"[",
"$",
"of... | {@inheritdoc} | [
"{"
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Result/Aggregation/AggregationValue.php#L126-L133 |
ongr-io/ElasticsearchBundle | Result/Aggregation/AggregationValue.php | AggregationValue.getIterator | public function getIterator()
{
$buckets = $this->getBuckets();
if ($buckets === null) {
throw new \LogicException('Can not iterate over aggregation without buckets!');
}
return new \ArrayIterator($this->getBuckets());
} | php | public function getIterator()
{
$buckets = $this->getBuckets();
if ($buckets === null) {
throw new \LogicException('Can not iterate over aggregation without buckets!');
}
return new \ArrayIterator($this->getBuckets());
} | [
"public",
"function",
"getIterator",
"(",
")",
"{",
"$",
"buckets",
"=",
"$",
"this",
"->",
"getBuckets",
"(",
")",
";",
"if",
"(",
"$",
"buckets",
"===",
"null",
")",
"{",
"throw",
"new",
"\\",
"LogicException",
"(",
"'Can not iterate over aggregation witho... | {@inheritdoc} | [
"{"
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Result/Aggregation/AggregationValue.php#L154-L163 |
ongr-io/ElasticsearchBundle | Result/ArrayIterator.php | ArrayIterator.convertDocument | protected function convertDocument(array $document)
{
if (array_key_exists('_source', $document)) {
return $document['_source'];
} elseif (array_key_exists('fields', $document)) {
return array_map('reset', $document['fields']);
}
return $document;
} | php | protected function convertDocument(array $document)
{
if (array_key_exists('_source', $document)) {
return $document['_source'];
} elseif (array_key_exists('fields', $document)) {
return array_map('reset', $document['fields']);
}
return $document;
} | [
"protected",
"function",
"convertDocument",
"(",
"array",
"$",
"document",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"'_source'",
",",
"$",
"document",
")",
")",
"{",
"return",
"$",
"document",
"[",
"'_source'",
"]",
";",
"}",
"elseif",
"(",
"array_key... | {@inheritdoc} | [
"{"
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Result/ArrayIterator.php#L54-L63 |
ongr-io/ElasticsearchBundle | Service/ImportService.php | ImportService.importIndex | public function importIndex(
Manager $manager,
$filename,
OutputInterface $output,
$options
) {
$reader = $this->getReader($manager, $this->getFilePath($filename), $options);
$progress = new ProgressBar($output, $reader->count());
$progress->setRedrawFrequenc... | php | public function importIndex(
Manager $manager,
$filename,
OutputInterface $output,
$options
) {
$reader = $this->getReader($manager, $this->getFilePath($filename), $options);
$progress = new ProgressBar($output, $reader->count());
$progress->setRedrawFrequenc... | [
"public",
"function",
"importIndex",
"(",
"Manager",
"$",
"manager",
",",
"$",
"filename",
",",
"OutputInterface",
"$",
"output",
",",
"$",
"options",
")",
"{",
"$",
"reader",
"=",
"$",
"this",
"->",
"getReader",
"(",
"$",
"manager",
",",
"$",
"this",
... | Imports Elasticsearch index data.
@param Manager $manager
@param string $filename
@param OutputInterface $output
@param array $options | [
"Imports",
"Elasticsearch",
"index",
"data",
"."
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Service/ImportService.php#L31-L65 |
ongr-io/ElasticsearchBundle | Service/ImportService.php | ImportService.getFilePath | protected function getFilePath($filename)
{
if ($filename{0} == '/' || strstr($filename, ':') !== false) {
return $filename;
}
return realpath(getcwd() . '/' . $filename);
} | php | protected function getFilePath($filename)
{
if ($filename{0} == '/' || strstr($filename, ':') !== false) {
return $filename;
}
return realpath(getcwd() . '/' . $filename);
} | [
"protected",
"function",
"getFilePath",
"(",
"$",
"filename",
")",
"{",
"if",
"(",
"$",
"filename",
"{",
"0",
"}",
"==",
"'/'",
"||",
"strstr",
"(",
"$",
"filename",
",",
"':'",
")",
"!==",
"false",
")",
"{",
"return",
"$",
"filename",
";",
"}",
"r... | Returns a real file path.
@param string $filename
@return string | [
"Returns",
"a",
"real",
"file",
"path",
"."
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Service/ImportService.php#L74-L81 |
ongr-io/ElasticsearchBundle | Command/IndexDropCommand.php | IndexDropCommand.execute | protected function execute(InputInterface $input, OutputInterface $output)
{
$io = new SymfonyStyle($input, $output);
if ($input->getOption('force')) {
$this->getManager($input->getOption('manager'))->dropIndex();
$io->text(
sprintf(
'Drop... | php | protected function execute(InputInterface $input, OutputInterface $output)
{
$io = new SymfonyStyle($input, $output);
if ($input->getOption('force')) {
$this->getManager($input->getOption('manager'))->dropIndex();
$io->text(
sprintf(
'Drop... | [
"protected",
"function",
"execute",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
"{",
"$",
"io",
"=",
"new",
"SymfonyStyle",
"(",
"$",
"input",
",",
"$",
"output",
")",
";",
"if",
"(",
"$",
"input",
"->",
"getOption",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Command/IndexDropCommand.php#L48-L65 |
ongr-io/ElasticsearchBundle | Command/DocumentGenerateCommand.php | DocumentGenerateCommand.interact | protected function interact(InputInterface $input, OutputInterface $output)
{
/** @var FormatterHelper $formatter */
$formatter = $this->getHelperSet()->get('formatter');
$this->questionHelper = new QuestionHelper();
$output->writeln(
[
'',
... | php | protected function interact(InputInterface $input, OutputInterface $output)
{
/** @var FormatterHelper $formatter */
$formatter = $this->getHelperSet()->get('formatter');
$this->questionHelper = new QuestionHelper();
$output->writeln(
[
'',
... | [
"protected",
"function",
"interact",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
"{",
"/** @var FormatterHelper $formatter */",
"$",
"formatter",
"=",
"$",
"this",
"->",
"getHelperSet",
"(",
")",
"->",
"get",
"(",
"'formatter'"... | {@inheritdoc} | [
"{"
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Command/DocumentGenerateCommand.php#L67-L279 |
ongr-io/ElasticsearchBundle | Command/DocumentGenerateCommand.php | DocumentGenerateCommand.isUniqueAnnotation | private function isUniqueAnnotation($properties, $annotation)
{
foreach ($properties as $property) {
if ($property['annotation'] == $annotation) {
return false;
}
}
return true;
} | php | private function isUniqueAnnotation($properties, $annotation)
{
foreach ($properties as $property) {
if ($property['annotation'] == $annotation) {
return false;
}
}
return true;
} | [
"private",
"function",
"isUniqueAnnotation",
"(",
"$",
"properties",
",",
"$",
"annotation",
")",
"{",
"foreach",
"(",
"$",
"properties",
"as",
"$",
"property",
")",
"{",
"if",
"(",
"$",
"property",
"[",
"'annotation'",
"]",
"==",
"$",
"annotation",
")",
... | @param array $properties
@param string $annotation
@return string | [
"@param",
"array",
"$properties",
"@param",
"string",
"$annotation"
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Command/DocumentGenerateCommand.php#L287-L296 |
ongr-io/ElasticsearchBundle | Command/DocumentGenerateCommand.php | DocumentGenerateCommand.askForPropertyName | private function askForPropertyName(InputInterface $input, OutputInterface $output, $default = null)
{
return $this->questionHelper->ask(
$input,
$output,
$this->getQuestion("\n" . 'Property name in Elasticsearch', $default, [$this, 'validateFieldName'])
);
} | php | private function askForPropertyName(InputInterface $input, OutputInterface $output, $default = null)
{
return $this->questionHelper->ask(
$input,
$output,
$this->getQuestion("\n" . 'Property name in Elasticsearch', $default, [$this, 'validateFieldName'])
);
} | [
"private",
"function",
"askForPropertyName",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
",",
"$",
"default",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"questionHelper",
"->",
"ask",
"(",
"$",
"input",
",",
"$",
"o... | Asks for property name
@param InputInterface $input
@param OutputInterface $output
@param string $default
@return string | [
"Asks",
"for",
"property",
"name"
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Command/DocumentGenerateCommand.php#L307-L314 |
ongr-io/ElasticsearchBundle | Command/DocumentGenerateCommand.php | DocumentGenerateCommand.askForPropertyOptions | private function askForPropertyOptions(InputInterface $input, OutputInterface $output)
{
$output->writeln(
"\n"
. '<info>Enter property options, for example <comment>"index"="not_analyzed"</comment>'
. ' allows mapper to index this field, so it is searchable, but ... | php | private function askForPropertyOptions(InputInterface $input, OutputInterface $output)
{
$output->writeln(
"\n"
. '<info>Enter property options, for example <comment>"index"="not_analyzed"</comment>'
. ' allows mapper to index this field, so it is searchable, but ... | [
"private",
"function",
"askForPropertyOptions",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
"{",
"$",
"output",
"->",
"writeln",
"(",
"\"\\n\"",
".",
"'<info>Enter property options, for example <comment>\"index\"=\"not_analyzed\"</comment>... | Asks for property options
@param InputInterface $input
@param OutputInterface $output
@return string | [
"Asks",
"for",
"property",
"options"
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Command/DocumentGenerateCommand.php#L324-L342 |
ongr-io/ElasticsearchBundle | Command/DocumentGenerateCommand.php | DocumentGenerateCommand.askForPropertyClass | private function askForPropertyClass(InputInterface $input, OutputInterface $output)
{
return $this->questionHelper->ask(
$input,
$output,
$this->getQuestion(
"\n" . 'Property class',
null,
[$this, 'validatePropertyClass'],
... | php | private function askForPropertyClass(InputInterface $input, OutputInterface $output)
{
return $this->questionHelper->ask(
$input,
$output,
$this->getQuestion(
"\n" . 'Property class',
null,
[$this, 'validatePropertyClass'],
... | [
"private",
"function",
"askForPropertyClass",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
"{",
"return",
"$",
"this",
"->",
"questionHelper",
"->",
"ask",
"(",
"$",
"input",
",",
"$",
"output",
",",
"$",
"this",
"->",
"... | Asks for property class
@param InputInterface $input
@param OutputInterface $output
@return string | [
"Asks",
"for",
"property",
"class"
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Command/DocumentGenerateCommand.php#L352-L364 |
ongr-io/ElasticsearchBundle | Command/DocumentGenerateCommand.php | DocumentGenerateCommand.getDocumentClasses | private function getDocumentClasses()
{
/** @var MetadataCollector $metadataCollector */
$metadataCollector = $this->getContainer()->get('es.metadata_collector');
$classes = [];
foreach ($this->getContainer()->getParameter('es.managers') as $manager) {
$documents = $meta... | php | private function getDocumentClasses()
{
/** @var MetadataCollector $metadataCollector */
$metadataCollector = $this->getContainer()->get('es.metadata_collector');
$classes = [];
foreach ($this->getContainer()->getParameter('es.managers') as $manager) {
$documents = $meta... | [
"private",
"function",
"getDocumentClasses",
"(",
")",
"{",
"/** @var MetadataCollector $metadataCollector */",
"$",
"metadataCollector",
"=",
"$",
"this",
"->",
"getContainer",
"(",
")",
"->",
"get",
"(",
"'es.metadata_collector'",
")",
";",
"$",
"classes",
"=",
"[... | Returns available document classes
@return array | [
"Returns",
"available",
"document",
"classes"
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Command/DocumentGenerateCommand.php#L371-L385 |
ongr-io/ElasticsearchBundle | Command/DocumentGenerateCommand.php | DocumentGenerateCommand.parseShortcutNotation | private function parseShortcutNotation($shortcut)
{
$shortcut = str_replace('/', '\\', $shortcut);
if (false === $pos = strpos($shortcut, ':')) {
throw $this->getException(
'The document name isn\'t valid ("%s" given, expecting something like AcmeBundle:Post)',
... | php | private function parseShortcutNotation($shortcut)
{
$shortcut = str_replace('/', '\\', $shortcut);
if (false === $pos = strpos($shortcut, ':')) {
throw $this->getException(
'The document name isn\'t valid ("%s" given, expecting something like AcmeBundle:Post)',
... | [
"private",
"function",
"parseShortcutNotation",
"(",
"$",
"shortcut",
")",
"{",
"$",
"shortcut",
"=",
"str_replace",
"(",
"'/'",
",",
"'\\\\'",
",",
"$",
"shortcut",
")",
";",
"if",
"(",
"false",
"===",
"$",
"pos",
"=",
"strpos",
"(",
"$",
"shortcut",
... | Parses shortcut notation
@param string $shortcut
@return string[]
@throws \InvalidArgumentException | [
"Parses",
"shortcut",
"notation"
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Command/DocumentGenerateCommand.php#L395-L407 |
ongr-io/ElasticsearchBundle | Command/DocumentGenerateCommand.php | DocumentGenerateCommand.validatePropertyClass | public function validatePropertyClass($input)
{
list($bundle, $document) = $this->parseShortcutNotation($input);
try {
$bundlePath = $this->getContainer()->get('kernel')->getBundle($bundle)->getPath();
} catch (\Exception $e) {
throw $this->getException('Bundle "%s" ... | php | public function validatePropertyClass($input)
{
list($bundle, $document) = $this->parseShortcutNotation($input);
try {
$bundlePath = $this->getContainer()->get('kernel')->getBundle($bundle)->getPath();
} catch (\Exception $e) {
throw $this->getException('Bundle "%s" ... | [
"public",
"function",
"validatePropertyClass",
"(",
"$",
"input",
")",
"{",
"list",
"(",
"$",
"bundle",
",",
"$",
"document",
")",
"=",
"$",
"this",
"->",
"parseShortcutNotation",
"(",
"$",
"input",
")",
";",
"try",
"{",
"$",
"bundlePath",
"=",
"$",
"t... | Validates property class
@param string $input
@return string
@throws \InvalidArgumentException | [
"Validates",
"property",
"class"
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Command/DocumentGenerateCommand.php#L417-L432 |
ongr-io/ElasticsearchBundle | Command/DocumentGenerateCommand.php | DocumentGenerateCommand.validateFieldName | public function validateFieldName($field)
{
if (!$field || $field != lcfirst(preg_replace('/[^a-zA-Z]+/', '', $field))) {
throw $this->getException(
'The parameter isn\'t valid ("%s" given, expecting camelcase separated words)',
[$field]
);
}
... | php | public function validateFieldName($field)
{
if (!$field || $field != lcfirst(preg_replace('/[^a-zA-Z]+/', '', $field))) {
throw $this->getException(
'The parameter isn\'t valid ("%s" given, expecting camelcase separated words)',
[$field]
);
}
... | [
"public",
"function",
"validateFieldName",
"(",
"$",
"field",
")",
"{",
"if",
"(",
"!",
"$",
"field",
"||",
"$",
"field",
"!=",
"lcfirst",
"(",
"preg_replace",
"(",
"'/[^a-zA-Z]+/'",
",",
"''",
",",
"$",
"field",
")",
")",
")",
"{",
"throw",
"$",
"th... | Validates field name
@param string $field
@return string
@throws \InvalidArgumentException | [
"Validates",
"field",
"name"
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Command/DocumentGenerateCommand.php#L462-L476 |
ongr-io/ElasticsearchBundle | Command/DocumentGenerateCommand.php | DocumentGenerateCommand.validatePropertyType | public function validatePropertyType($type)
{
if (!in_array($type, $this->getPropertyTypes())) {
throw $this->getException(
'The property type isn\'t valid ("%s" given, expecting one of following: %s)',
[$type, implode(', ', $this->getPropertyTypes())]
... | php | public function validatePropertyType($type)
{
if (!in_array($type, $this->getPropertyTypes())) {
throw $this->getException(
'The property type isn\'t valid ("%s" given, expecting one of following: %s)',
[$type, implode(', ', $this->getPropertyTypes())]
... | [
"public",
"function",
"validatePropertyType",
"(",
"$",
"type",
")",
"{",
"if",
"(",
"!",
"in_array",
"(",
"$",
"type",
",",
"$",
"this",
"->",
"getPropertyTypes",
"(",
")",
")",
")",
"{",
"throw",
"$",
"this",
"->",
"getException",
"(",
"'The property t... | Validates property type
@param string $type
@return string
@throws \InvalidArgumentException | [
"Validates",
"property",
"type"
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Command/DocumentGenerateCommand.php#L486-L496 |
ongr-io/ElasticsearchBundle | Command/DocumentGenerateCommand.php | DocumentGenerateCommand.validateDocumentAnnotation | public function validateDocumentAnnotation($annotation)
{
if (!in_array($annotation, $this->getDocumentAnnotations())) {
throw $this->getException(
'The document annotation isn\'t valid ("%s" given, expecting one of following: %s)',
[$annotation, implode(', ', $th... | php | public function validateDocumentAnnotation($annotation)
{
if (!in_array($annotation, $this->getDocumentAnnotations())) {
throw $this->getException(
'The document annotation isn\'t valid ("%s" given, expecting one of following: %s)',
[$annotation, implode(', ', $th... | [
"public",
"function",
"validateDocumentAnnotation",
"(",
"$",
"annotation",
")",
"{",
"if",
"(",
"!",
"in_array",
"(",
"$",
"annotation",
",",
"$",
"this",
"->",
"getDocumentAnnotations",
"(",
")",
")",
")",
"{",
"throw",
"$",
"this",
"->",
"getException",
... | Validates document annotation
@param string $annotation
@return string
@throws \InvalidArgumentException | [
"Validates",
"document",
"annotation"
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Command/DocumentGenerateCommand.php#L506-L516 |
ongr-io/ElasticsearchBundle | Command/DocumentGenerateCommand.php | DocumentGenerateCommand.validatePropertyAnnotation | public function validatePropertyAnnotation($annotation)
{
if (!in_array($annotation, $this->propertyAnnotations)) {
throw $this->getException(
'The property annotation isn\'t valid ("%s" given, expecting one of following: %s)',
[$annotation, implode(', ', $this->p... | php | public function validatePropertyAnnotation($annotation)
{
if (!in_array($annotation, $this->propertyAnnotations)) {
throw $this->getException(
'The property annotation isn\'t valid ("%s" given, expecting one of following: %s)',
[$annotation, implode(', ', $this->p... | [
"public",
"function",
"validatePropertyAnnotation",
"(",
"$",
"annotation",
")",
"{",
"if",
"(",
"!",
"in_array",
"(",
"$",
"annotation",
",",
"$",
"this",
"->",
"propertyAnnotations",
")",
")",
"{",
"throw",
"$",
"this",
"->",
"getException",
"(",
"'The pro... | Validates property annotation
@param string $annotation
@return string
@throws \InvalidArgumentException | [
"Validates",
"property",
"annotation"
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Command/DocumentGenerateCommand.php#L526-L536 |
ongr-io/ElasticsearchBundle | Command/DocumentGenerateCommand.php | DocumentGenerateCommand.validatePropertyVisibility | public function validatePropertyVisibility($visibility)
{
if (!in_array($visibility, $this->propertyVisibilities)) {
throw $this->getException(
'The property visibility isn\'t valid ("%s" given, expecting one of following: %s)',
[$visibility, implode(', ', $this->... | php | public function validatePropertyVisibility($visibility)
{
if (!in_array($visibility, $this->propertyVisibilities)) {
throw $this->getException(
'The property visibility isn\'t valid ("%s" given, expecting one of following: %s)',
[$visibility, implode(', ', $this->... | [
"public",
"function",
"validatePropertyVisibility",
"(",
"$",
"visibility",
")",
"{",
"if",
"(",
"!",
"in_array",
"(",
"$",
"visibility",
",",
"$",
"this",
"->",
"propertyVisibilities",
")",
")",
"{",
"throw",
"$",
"this",
"->",
"getException",
"(",
"'The pr... | Validates property visibility
@param string $visibility
@return string
@throws \InvalidArgumentException When the visibility is not found in the list of allowed ones. | [
"Validates",
"property",
"visibility"
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Command/DocumentGenerateCommand.php#L546-L556 |
ongr-io/ElasticsearchBundle | Command/DocumentGenerateCommand.php | DocumentGenerateCommand.getQuestion | private function getQuestion($question, $default = null, callable $validator = null, array $values = null)
{
$question = new Question(
sprintf('<info>%s</info>%s: ', $question, $default ? sprintf(' [<comment>%s</comment>]', $default) : ''),
$default
);
$question
... | php | private function getQuestion($question, $default = null, callable $validator = null, array $values = null)
{
$question = new Question(
sprintf('<info>%s</info>%s: ', $question, $default ? sprintf(' [<comment>%s</comment>]', $default) : ''),
$default
);
$question
... | [
"private",
"function",
"getQuestion",
"(",
"$",
"question",
",",
"$",
"default",
"=",
"null",
",",
"callable",
"$",
"validator",
"=",
"null",
",",
"array",
"$",
"values",
"=",
"null",
")",
"{",
"$",
"question",
"=",
"new",
"Question",
"(",
"sprintf",
"... | Returns formatted question
@param string $question
@param mixed $default
@param callable|null $validator
@param array|null $values
@return Question | [
"Returns",
"formatted",
"question"
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Command/DocumentGenerateCommand.php#L568-L580 |
ongr-io/ElasticsearchBundle | Command/DocumentGenerateCommand.php | DocumentGenerateCommand.getOptionsLabel | private function getOptionsLabel(array $options, $suffix)
{
$label = sprintf('<info>%s:</info> ', $suffix);
foreach ($options as &$option) {
$option = sprintf('<comment>%s</comment>', $option);
}
return ['', $label . implode(', ', $options) . '.'];
} | php | private function getOptionsLabel(array $options, $suffix)
{
$label = sprintf('<info>%s:</info> ', $suffix);
foreach ($options as &$option) {
$option = sprintf('<comment>%s</comment>', $option);
}
return ['', $label . implode(', ', $options) . '.'];
} | [
"private",
"function",
"getOptionsLabel",
"(",
"array",
"$",
"options",
",",
"$",
"suffix",
")",
"{",
"$",
"label",
"=",
"sprintf",
"(",
"'<info>%s:</info> '",
",",
"$",
"suffix",
")",
";",
"foreach",
"(",
"$",
"options",
"as",
"&",
"$",
"option",
")",
... | Returns options label
@param array $options
@param string $suffix
@return string[] | [
"Returns",
"options",
"label"
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Command/DocumentGenerateCommand.php#L590-L599 |
ongr-io/ElasticsearchBundle | Command/DocumentGenerateCommand.php | DocumentGenerateCommand.getException | private function getException($format, $args = [])
{
/** @var FormatterHelper $formatter */
$formatter = $this->getHelperSet()->get('formatter');
return new \InvalidArgumentException($formatter->formatBlock(vsprintf($format, $args), 'bg=red', true));
} | php | private function getException($format, $args = [])
{
/** @var FormatterHelper $formatter */
$formatter = $this->getHelperSet()->get('formatter');
return new \InvalidArgumentException($formatter->formatBlock(vsprintf($format, $args), 'bg=red', true));
} | [
"private",
"function",
"getException",
"(",
"$",
"format",
",",
"$",
"args",
"=",
"[",
"]",
")",
"{",
"/** @var FormatterHelper $formatter */",
"$",
"formatter",
"=",
"$",
"this",
"->",
"getHelperSet",
"(",
")",
"->",
"get",
"(",
"'formatter'",
")",
";",
"... | Returns formatted exception
@param string $format
@param array $args
@return \InvalidArgumentException | [
"Returns",
"formatted",
"exception"
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Command/DocumentGenerateCommand.php#L609-L614 |
ongr-io/ElasticsearchBundle | Command/DocumentGenerateCommand.php | DocumentGenerateCommand.getPropertyTypes | private function getPropertyTypes()
{
$reflection = new \ReflectionClass('ONGR\ElasticsearchBundle\Annotation\Property');
return $this
->getContainer()
->get('es.annotations.cached_reader')
->getPropertyAnnotation($reflection->getProperty('type'), 'Doctrine\Commo... | php | private function getPropertyTypes()
{
$reflection = new \ReflectionClass('ONGR\ElasticsearchBundle\Annotation\Property');
return $this
->getContainer()
->get('es.annotations.cached_reader')
->getPropertyAnnotation($reflection->getProperty('type'), 'Doctrine\Commo... | [
"private",
"function",
"getPropertyTypes",
"(",
")",
"{",
"$",
"reflection",
"=",
"new",
"\\",
"ReflectionClass",
"(",
"'ONGR\\ElasticsearchBundle\\Annotation\\Property'",
")",
";",
"return",
"$",
"this",
"->",
"getContainer",
"(",
")",
"->",
"get",
"(",
"'es.anno... | Returns available property types
@return array | [
"Returns",
"available",
"property",
"types"
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Command/DocumentGenerateCommand.php#L621-L630 |
ongr-io/ElasticsearchBundle | Mapping/DocumentFinder.php | DocumentFinder.getNamespace | public function getNamespace($namespace, $documentsDirectory = null)
{
if (!$documentsDirectory) {
$documentsDirectory = $this->documentDir;
}
if (strpos($namespace, ':') !== false) {
list($bundle, $document) = explode(':', $namespace);
$bundle = $this->g... | php | public function getNamespace($namespace, $documentsDirectory = null)
{
if (!$documentsDirectory) {
$documentsDirectory = $this->documentDir;
}
if (strpos($namespace, ':') !== false) {
list($bundle, $document) = explode(':', $namespace);
$bundle = $this->g... | [
"public",
"function",
"getNamespace",
"(",
"$",
"namespace",
",",
"$",
"documentsDirectory",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"documentsDirectory",
")",
"{",
"$",
"documentsDirectory",
"=",
"$",
"this",
"->",
"documentDir",
";",
"}",
"if",
"(",
... | Formats namespace from short syntax.
@param string $namespace
@param string $documentsDirectory Directory name where documents are stored in the bundle.
@return string | [
"Formats",
"namespace",
"from",
"short",
"syntax",
"."
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Mapping/DocumentFinder.php#L64-L94 |
ongr-io/ElasticsearchBundle | Mapping/DocumentFinder.php | DocumentFinder.getBundleClass | public function getBundleClass($name)
{
if (array_key_exists($name, $this->bundles)) {
return $this->bundles[$name];
}
throw new \LogicException(sprintf('Bundle \'%s\' does not exist.', $name));
} | php | public function getBundleClass($name)
{
if (array_key_exists($name, $this->bundles)) {
return $this->bundles[$name];
}
throw new \LogicException(sprintf('Bundle \'%s\' does not exist.', $name));
} | [
"public",
"function",
"getBundleClass",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"$",
"name",
",",
"$",
"this",
"->",
"bundles",
")",
")",
"{",
"return",
"$",
"this",
"->",
"bundles",
"[",
"$",
"name",
"]",
";",
"}",
"throw",
... | Returns bundle class namespace else throws an exception.
@param string $name
@return string
@throws \LogicException | [
"Returns",
"bundle",
"class",
"namespace",
"else",
"throws",
"an",
"exception",
"."
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Mapping/DocumentFinder.php#L105-L112 |
ongr-io/ElasticsearchBundle | Mapping/DocumentFinder.php | DocumentFinder.getBundleDocumentClasses | public function getBundleDocumentClasses($bundle, $documentsDirectory = null)
{
if (!$documentsDirectory) {
$documentsDirectory = $this->documentDir;
}
$bundleReflection = new \ReflectionClass($this->getBundleClass($bundle));
$documentsDirectory = DIRECTORY_SEPARATOR . ... | php | public function getBundleDocumentClasses($bundle, $documentsDirectory = null)
{
if (!$documentsDirectory) {
$documentsDirectory = $this->documentDir;
}
$bundleReflection = new \ReflectionClass($this->getBundleClass($bundle));
$documentsDirectory = DIRECTORY_SEPARATOR . ... | [
"public",
"function",
"getBundleDocumentClasses",
"(",
"$",
"bundle",
",",
"$",
"documentsDirectory",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"documentsDirectory",
")",
"{",
"$",
"documentsDirectory",
"=",
"$",
"this",
"->",
"documentDir",
";",
"}",
"$",... | Returns a list of bundle document classes.
Example output:
[
'Category',
'Product',
'SubDir\SomeObject'
]
@param string $bundle Bundle name. E.g. AppBundle
@param string $documentsDirectory Directory name where documents are stored in the bundle.
@return array | [
"Returns",
"a",
"list",
"of",
"bundle",
"document",
"classes",
"."
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Mapping/DocumentFinder.php#L130-L159 |
ongr-io/ElasticsearchBundle | Service/IndexSuffixFinder.php | IndexSuffixFinder.setNextFreeIndex | public function setNextFreeIndex(Manager $manager, \DateTime $time = null)
{
if ($time === null) {
$time = new \DateTime();
}
$date = $time->format('Y.m.d');
$indexName = $manager->getIndexName();
$nameBase = $indexName . '-' . $date;
$name = $nameBase;
... | php | public function setNextFreeIndex(Manager $manager, \DateTime $time = null)
{
if ($time === null) {
$time = new \DateTime();
}
$date = $time->format('Y.m.d');
$indexName = $manager->getIndexName();
$nameBase = $indexName . '-' . $date;
$name = $nameBase;
... | [
"public",
"function",
"setNextFreeIndex",
"(",
"Manager",
"$",
"manager",
",",
"\\",
"DateTime",
"$",
"time",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"time",
"===",
"null",
")",
"{",
"$",
"time",
"=",
"new",
"\\",
"DateTime",
"(",
")",
";",
"}",
"$"... | Constructs index name with date suffix. Sets name in the connection.
E.g. 2022.03.22-5 (if 4 indexes exists already for given date)
@param Manager $manager Connection to act upon.
@param null|\DateTime $time Date for which the suffix will be based on.
Current date if null.
@return string | [
"Constructs",
"index",
"name",
"with",
"date",
"suffix",
".",
"Sets",
"name",
"in",
"the",
"connection",
"."
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Service/IndexSuffixFinder.php#L30-L51 |
ongr-io/ElasticsearchBundle | Service/Json/JsonWriter.php | JsonWriter.initialize | protected function initialize()
{
if ($this->handle !== null) {
return;
}
$this->handle = fopen($this->filename, 'w');
fwrite($this->handle, "[\n");
fwrite($this->handle, json_encode($this->metadata));
} | php | protected function initialize()
{
if ($this->handle !== null) {
return;
}
$this->handle = fopen($this->filename, 'w');
fwrite($this->handle, "[\n");
fwrite($this->handle, json_encode($this->metadata));
} | [
"protected",
"function",
"initialize",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"handle",
"!==",
"null",
")",
"{",
"return",
";",
"}",
"$",
"this",
"->",
"handle",
"=",
"fopen",
"(",
"$",
"this",
"->",
"filename",
",",
"'w'",
")",
";",
"fwrite"... | Performs initialization. | [
"Performs",
"initialization",
"."
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Service/Json/JsonWriter.php#L75-L84 |
ongr-io/ElasticsearchBundle | Service/Json/JsonWriter.php | JsonWriter.finalize | public function finalize()
{
$this->initialize();
if (is_resource($this->handle)) {
fwrite($this->handle, "\n]");
fclose($this->handle);
}
} | php | public function finalize()
{
$this->initialize();
if (is_resource($this->handle)) {
fwrite($this->handle, "\n]");
fclose($this->handle);
}
} | [
"public",
"function",
"finalize",
"(",
")",
"{",
"$",
"this",
"->",
"initialize",
"(",
")",
";",
"if",
"(",
"is_resource",
"(",
"$",
"this",
"->",
"handle",
")",
")",
"{",
"fwrite",
"(",
"$",
"this",
"->",
"handle",
",",
"\"\\n]\"",
")",
";",
"fclo... | Performs finalization. | [
"Performs",
"finalization",
"."
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Service/Json/JsonWriter.php#L89-L97 |
ongr-io/ElasticsearchBundle | Service/Json/JsonWriter.php | JsonWriter.push | public function push($document)
{
$this->initialize();
$this->currentPosition++;
if (isset($this->metadata['count']) && $this->currentPosition > $this->metadata['count']) {
throw new \OverflowException(
sprintf('This writer was set up to write %d documents, got m... | php | public function push($document)
{
$this->initialize();
$this->currentPosition++;
if (isset($this->metadata['count']) && $this->currentPosition > $this->metadata['count']) {
throw new \OverflowException(
sprintf('This writer was set up to write %d documents, got m... | [
"public",
"function",
"push",
"(",
"$",
"document",
")",
"{",
"$",
"this",
"->",
"initialize",
"(",
")",
";",
"$",
"this",
"->",
"currentPosition",
"++",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"metadata",
"[",
"'count'",
"]",
")",
"&&",
"... | Writes single document to stream.
@param mixed $document Object to insert into stream.
@throws \OverflowException | [
"Writes",
"single",
"document",
"to",
"stream",
"."
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Service/Json/JsonWriter.php#L106-L123 |
ongr-io/ElasticsearchBundle | Service/GenerateService.php | GenerateService.generate | public function generate(
BundleInterface $bundle,
$document,
$annotation,
$type,
array $properties
) {
$documentPath = $bundle->getPath() . '/Document/' . str_replace('\\', '/', $document) . '.php';
$class = [
'name' => $bundle->getNamespace() . '... | php | public function generate(
BundleInterface $bundle,
$document,
$annotation,
$type,
array $properties
) {
$documentPath = $bundle->getPath() . '/Document/' . str_replace('\\', '/', $document) . '.php';
$class = [
'name' => $bundle->getNamespace() . '... | [
"public",
"function",
"generate",
"(",
"BundleInterface",
"$",
"bundle",
",",
"$",
"document",
",",
"$",
"annotation",
",",
"$",
"type",
",",
"array",
"$",
"properties",
")",
"{",
"$",
"documentPath",
"=",
"$",
"bundle",
"->",
"getPath",
"(",
")",
".",
... | Generates document class
@param BundleInterface $bundle
@param string $document
@param string $annotation
@param string $type
@param array $properties | [
"Generates",
"document",
"class"
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Service/GenerateService.php#L54-L73 |
ongr-io/ElasticsearchBundle | Result/DocumentIterator.php | DocumentIterator.getAggregations | public function getAggregations()
{
$aggregations = [];
foreach (parent::getAggregations() as $key => $aggregation) {
$aggregations[$key] = $this->getAggregation($key);
}
return $aggregations;
} | php | public function getAggregations()
{
$aggregations = [];
foreach (parent::getAggregations() as $key => $aggregation) {
$aggregations[$key] = $this->getAggregation($key);
}
return $aggregations;
} | [
"public",
"function",
"getAggregations",
"(",
")",
"{",
"$",
"aggregations",
"=",
"[",
"]",
";",
"foreach",
"(",
"parent",
"::",
"getAggregations",
"(",
")",
"as",
"$",
"key",
"=>",
"$",
"aggregation",
")",
"{",
"$",
"aggregations",
"[",
"$",
"key",
"]... | Returns aggregations.
@return array | [
"Returns",
"aggregations",
"."
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Result/DocumentIterator.php#L26-L35 |
ongr-io/ElasticsearchBundle | Result/DocumentIterator.php | DocumentIterator.getAggregation | public function getAggregation($name)
{
$aggregations = parent::getAggregations();
if (!array_key_exists($name, $aggregations)) {
return null;
}
return new AggregationValue($aggregations[$name]);
} | php | public function getAggregation($name)
{
$aggregations = parent::getAggregations();
if (!array_key_exists($name, $aggregations)) {
return null;
}
return new AggregationValue($aggregations[$name]);
} | [
"public",
"function",
"getAggregation",
"(",
"$",
"name",
")",
"{",
"$",
"aggregations",
"=",
"parent",
"::",
"getAggregations",
"(",
")",
";",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"name",
",",
"$",
"aggregations",
")",
")",
"{",
"return",
"null... | Get a specific aggregation by name. It fetches from the top level only.
@param string $name
@return AggregationValue|null | [
"Get",
"a",
"specific",
"aggregation",
"by",
"name",
".",
"It",
"fetches",
"from",
"the",
"top",
"level",
"only",
"."
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Result/DocumentIterator.php#L44-L52 |
ongr-io/ElasticsearchBundle | EventListener/TerminateListener.php | TerminateListener.onKernelTerminate | public function onKernelTerminate()
{
foreach ($this->managers as $key => $value) {
if ($value['force_commit']) {
try {
/** @var Manager $manager */
$manager = $this->container->get(sprintf('es.manager.%s', $key));
} catch (... | php | public function onKernelTerminate()
{
foreach ($this->managers as $key => $value) {
if ($value['force_commit']) {
try {
/** @var Manager $manager */
$manager = $this->container->get(sprintf('es.manager.%s', $key));
} catch (... | [
"public",
"function",
"onKernelTerminate",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"managers",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"value",
"[",
"'force_commit'",
"]",
")",
"{",
"try",
"{",
"/** @var Manager $manager... | Forces commit to elasticsearch on kernel terminate | [
"Forces",
"commit",
"to",
"elasticsearch",
"on",
"kernel",
"terminate"
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/EventListener/TerminateListener.php#L44-L57 |
ongr-io/ElasticsearchBundle | Service/Repository.php | Repository.find | public function find($id, $routing = null)
{
return $this->manager->find($this->type, $id, $routing);
} | php | public function find($id, $routing = null)
{
return $this->manager->find($this->type, $id, $routing);
} | [
"public",
"function",
"find",
"(",
"$",
"id",
",",
"$",
"routing",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"manager",
"->",
"find",
"(",
"$",
"this",
"->",
"type",
",",
"$",
"id",
",",
"$",
"routing",
")",
";",
"}"
] | Returns a single document data by ID or null if document is not found.
@param string $id Document ID to find
@param string $routing Custom routing for the document
@return object | [
"Returns",
"a",
"single",
"document",
"data",
"by",
"ID",
"or",
"null",
"if",
"document",
"is",
"not",
"found",
"."
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Service/Repository.php#L91-L94 |
ongr-io/ElasticsearchBundle | Service/Repository.php | Repository.findByIds | public function findByIds(array $ids)
{
$args = [];
$manager = $this->getManager();
$args['body']['docs'] = [];
$args['index'] = $manager->getIndexName();
$args['type'] = $this->getType();
foreach ($ids as $id) {
$args['body']['docs'][] = [
... | php | public function findByIds(array $ids)
{
$args = [];
$manager = $this->getManager();
$args['body']['docs'] = [];
$args['index'] = $manager->getIndexName();
$args['type'] = $this->getType();
foreach ($ids as $id) {
$args['body']['docs'][] = [
... | [
"public",
"function",
"findByIds",
"(",
"array",
"$",
"ids",
")",
"{",
"$",
"args",
"=",
"[",
"]",
";",
"$",
"manager",
"=",
"$",
"this",
"->",
"getManager",
"(",
")",
";",
"$",
"args",
"[",
"'body'",
"]",
"[",
"'docs'",
"]",
"=",
"[",
"]",
";"... | Returns documents by a set of ids
@param array $ids
@return DocumentIterator The objects. | [
"Returns",
"documents",
"by",
"a",
"set",
"of",
"ids"
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Service/Repository.php#L103-L135 |
ongr-io/ElasticsearchBundle | Service/Repository.php | Repository.findBy | public function findBy(
array $criteria,
array $orderBy = [],
$limit = null,
$offset = null
) {
$search = $this->createSearch();
if ($limit !== null) {
$search->setSize($limit);
}
if ($offset !== null) {
$search->setFrom($offse... | php | public function findBy(
array $criteria,
array $orderBy = [],
$limit = null,
$offset = null
) {
$search = $this->createSearch();
if ($limit !== null) {
$search->setSize($limit);
}
if ($offset !== null) {
$search->setFrom($offse... | [
"public",
"function",
"findBy",
"(",
"array",
"$",
"criteria",
",",
"array",
"$",
"orderBy",
"=",
"[",
"]",
",",
"$",
"limit",
"=",
"null",
",",
"$",
"offset",
"=",
"null",
")",
"{",
"$",
"search",
"=",
"$",
"this",
"->",
"createSearch",
"(",
")",
... | Finds documents by a set of criteria.
@param array $criteria Example: ['group' => ['best', 'worst'], 'job' => 'medic'].
@param array|null $orderBy Example: ['name' => 'ASC', 'surname' => 'DESC'].
@param int|null $limit Example: 5.
@param int|null $offset Example: 30.
@return array|DocumentItera... | [
"Finds",
"documents",
"by",
"a",
"set",
"of",
"criteria",
"."
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Service/Repository.php#L147-L181 |
ongr-io/ElasticsearchBundle | Service/Repository.php | Repository.getScrollConfiguration | public function getScrollConfiguration($raw, $scrollDuration)
{
$scrollConfig = [];
if (isset($raw['_scroll_id'])) {
$scrollConfig['_scroll_id'] = $raw['_scroll_id'];
$scrollConfig['duration'] = $scrollDuration;
}
return $scrollConfig;
} | php | public function getScrollConfiguration($raw, $scrollDuration)
{
$scrollConfig = [];
if (isset($raw['_scroll_id'])) {
$scrollConfig['_scroll_id'] = $raw['_scroll_id'];
$scrollConfig['duration'] = $scrollDuration;
}
return $scrollConfig;
} | [
"public",
"function",
"getScrollConfiguration",
"(",
"$",
"raw",
",",
"$",
"scrollDuration",
")",
"{",
"$",
"scrollConfig",
"=",
"[",
"]",
";",
"if",
"(",
"isset",
"(",
"$",
"raw",
"[",
"'_scroll_id'",
"]",
")",
")",
"{",
"$",
"scrollConfig",
"[",
"'_s... | Parses scroll configuration from raw response.
@param array $raw
@param string $scrollDuration
@return array | [
"Parses",
"scroll",
"configuration",
"from",
"raw",
"response",
"."
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Service/Repository.php#L214-L223 |
ongr-io/ElasticsearchBundle | Service/Repository.php | Repository.findDocuments | public function findDocuments(Search $search)
{
$results = $this->executeSearch($search);
return new DocumentIterator(
$results,
$this->getManager(),
$this->getScrollConfiguration($results, $search->getScroll())
);
} | php | public function findDocuments(Search $search)
{
$results = $this->executeSearch($search);
return new DocumentIterator(
$results,
$this->getManager(),
$this->getScrollConfiguration($results, $search->getScroll())
);
} | [
"public",
"function",
"findDocuments",
"(",
"Search",
"$",
"search",
")",
"{",
"$",
"results",
"=",
"$",
"this",
"->",
"executeSearch",
"(",
"$",
"search",
")",
";",
"return",
"new",
"DocumentIterator",
"(",
"$",
"results",
",",
"$",
"this",
"->",
"getMa... | Returns DocumentIterator with composed Document objects from array response.
@param Search $search
@return DocumentIterator | [
"Returns",
"DocumentIterator",
"with",
"composed",
"Document",
"objects",
"from",
"array",
"response",
"."
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Service/Repository.php#L232-L241 |
ongr-io/ElasticsearchBundle | Service/Repository.php | Repository.findArray | public function findArray(Search $search)
{
$results = $this->executeSearch($search);
return new ArrayIterator(
$results,
$this->getManager(),
$this->getScrollConfiguration($results, $search->getScroll())
);
} | php | public function findArray(Search $search)
{
$results = $this->executeSearch($search);
return new ArrayIterator(
$results,
$this->getManager(),
$this->getScrollConfiguration($results, $search->getScroll())
);
} | [
"public",
"function",
"findArray",
"(",
"Search",
"$",
"search",
")",
"{",
"$",
"results",
"=",
"$",
"this",
"->",
"executeSearch",
"(",
"$",
"search",
")",
";",
"return",
"new",
"ArrayIterator",
"(",
"$",
"results",
",",
"$",
"this",
"->",
"getManager",... | Returns ArrayIterator with access to unmodified documents directly.
@param Search $search
@return ArrayIterator | [
"Returns",
"ArrayIterator",
"with",
"access",
"to",
"unmodified",
"documents",
"directly",
"."
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Service/Repository.php#L251-L260 |
ongr-io/ElasticsearchBundle | Service/Repository.php | Repository.findRaw | public function findRaw(Search $search)
{
$results = $this->executeSearch($search);
return new RawIterator(
$results,
$this->getManager(),
$this->getScrollConfiguration($results, $search->getScroll())
);
} | php | public function findRaw(Search $search)
{
$results = $this->executeSearch($search);
return new RawIterator(
$results,
$this->getManager(),
$this->getScrollConfiguration($results, $search->getScroll())
);
} | [
"public",
"function",
"findRaw",
"(",
"Search",
"$",
"search",
")",
"{",
"$",
"results",
"=",
"$",
"this",
"->",
"executeSearch",
"(",
"$",
"search",
")",
";",
"return",
"new",
"RawIterator",
"(",
"$",
"results",
",",
"$",
"this",
"->",
"getManager",
"... | Returns RawIterator with access to node with all returned values included.
@param Search $search
@return RawIterator | [
"Returns",
"RawIterator",
"with",
"access",
"to",
"node",
"with",
"all",
"returned",
"values",
"included",
"."
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Service/Repository.php#L269-L278 |
ongr-io/ElasticsearchBundle | Service/Repository.php | Repository.executeSearch | private function executeSearch(Search $search)
{
return $this->getManager()->search([$this->getType()], $search->toArray(), $search->getUriParams());
} | php | private function executeSearch(Search $search)
{
return $this->getManager()->search([$this->getType()], $search->toArray(), $search->getUriParams());
} | [
"private",
"function",
"executeSearch",
"(",
"Search",
"$",
"search",
")",
"{",
"return",
"$",
"this",
"->",
"getManager",
"(",
")",
"->",
"search",
"(",
"[",
"$",
"this",
"->",
"getType",
"(",
")",
"]",
",",
"$",
"search",
"->",
"toArray",
"(",
")",... | Executes search to the elasticsearch and returns raw response.
@param Search $search
@return array | [
"Executes",
"search",
"to",
"the",
"elasticsearch",
"and",
"returns",
"raw",
"response",
"."
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Service/Repository.php#L287-L290 |
ongr-io/ElasticsearchBundle | Service/Repository.php | Repository.count | public function count(Search $search, array $params = [], $returnRaw = false)
{
$body = array_merge(
[
'index' => $this->getManager()->getIndexName(),
'type' => $this->type,
'body' => $search->toArray(),
],
$params
)... | php | public function count(Search $search, array $params = [], $returnRaw = false)
{
$body = array_merge(
[
'index' => $this->getManager()->getIndexName(),
'type' => $this->type,
'body' => $search->toArray(),
],
$params
)... | [
"public",
"function",
"count",
"(",
"Search",
"$",
"search",
",",
"array",
"$",
"params",
"=",
"[",
"]",
",",
"$",
"returnRaw",
"=",
"false",
")",
"{",
"$",
"body",
"=",
"array_merge",
"(",
"[",
"'index'",
"=>",
"$",
"this",
"->",
"getManager",
"(",
... | Counts documents by given search.
@param Search $search
@param array $params
@param bool $returnRaw If set true returns raw response gotten from client.
@return int|array | [
"Counts",
"documents",
"by",
"given",
"search",
"."
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Service/Repository.php#L301-L321 |
ongr-io/ElasticsearchBundle | Service/Repository.php | Repository.remove | public function remove($id, $routing = null)
{
$params = [
'index' => $this->getManager()->getIndexName(),
'type' => $this->type,
'id' => $id,
];
if ($routing) {
$params['routing'] = $routing;
}
$response = $this->getManager()... | php | public function remove($id, $routing = null)
{
$params = [
'index' => $this->getManager()->getIndexName(),
'type' => $this->type,
'id' => $id,
];
if ($routing) {
$params['routing'] = $routing;
}
$response = $this->getManager()... | [
"public",
"function",
"remove",
"(",
"$",
"id",
",",
"$",
"routing",
"=",
"null",
")",
"{",
"$",
"params",
"=",
"[",
"'index'",
"=>",
"$",
"this",
"->",
"getManager",
"(",
")",
"->",
"getIndexName",
"(",
")",
",",
"'type'",
"=>",
"$",
"this",
"->",... | Removes a single document data by ID.
@param string $id Document ID to remove
@param string $routing Custom routing for the document
@return array
@throws \LogicException | [
"Removes",
"a",
"single",
"document",
"data",
"by",
"ID",
"."
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Service/Repository.php#L333-L348 |
ongr-io/ElasticsearchBundle | Service/Repository.php | Repository.update | public function update($id, array $fields = [], $script = null, array $params = [])
{
$body = array_filter(
[
'doc' => $fields,
'script' => $script,
]
);
$params = array_merge(
[
'id' => $id,
... | php | public function update($id, array $fields = [], $script = null, array $params = [])
{
$body = array_filter(
[
'doc' => $fields,
'script' => $script,
]
);
$params = array_merge(
[
'id' => $id,
... | [
"public",
"function",
"update",
"(",
"$",
"id",
",",
"array",
"$",
"fields",
"=",
"[",
"]",
",",
"$",
"script",
"=",
"null",
",",
"array",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"$",
"body",
"=",
"array_filter",
"(",
"[",
"'doc'",
"=>",
"$",
"... | Partial document update.
@param string $id Document id to update.
@param array $fields Fields array to update.
@param string $script Groovy script to update fields.
@param array $params Additional parameters to pass to the client.
@return array | [
"Partial",
"document",
"update",
"."
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Service/Repository.php#L360-L380 |
ongr-io/ElasticsearchBundle | Command/AbstractManagerAwareCommand.php | AbstractManagerAwareCommand.getManager | protected function getManager($name)
{
$id = $this->getManagerId($name);
if ($this->getContainer()->has($id)) {
return $this->getContainer()->get($id);
}
throw new \RuntimeException(
sprintf(
'Manager named `%s` not found. Available: `%s`.',
... | php | protected function getManager($name)
{
$id = $this->getManagerId($name);
if ($this->getContainer()->has($id)) {
return $this->getContainer()->get($id);
}
throw new \RuntimeException(
sprintf(
'Manager named `%s` not found. Available: `%s`.',
... | [
"protected",
"function",
"getManager",
"(",
"$",
"name",
")",
"{",
"$",
"id",
"=",
"$",
"this",
"->",
"getManagerId",
"(",
"$",
"name",
")",
";",
"if",
"(",
"$",
"this",
"->",
"getContainer",
"(",
")",
"->",
"has",
"(",
"$",
"id",
")",
")",
"{",
... | Returns elasticsearch manager by name from service container.
@param string $name Manager name defined in configuration.
@return Manager
@throws \RuntimeException If manager was not found. | [
"Returns",
"elasticsearch",
"manager",
"by",
"name",
"from",
"service",
"container",
"."
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Command/AbstractManagerAwareCommand.php#L46-L61 |
ongr-io/ElasticsearchBundle | Result/ObjectIterator.php | ObjectIterator.convertDocument | protected function convertDocument(array $document)
{
return $this->converter->assignArrayToObject(
$document,
new $this->alias['namespace'](),
$this->alias['aliases']
);
} | php | protected function convertDocument(array $document)
{
return $this->converter->assignArrayToObject(
$document,
new $this->alias['namespace'](),
$this->alias['aliases']
);
} | [
"protected",
"function",
"convertDocument",
"(",
"array",
"$",
"document",
")",
"{",
"return",
"$",
"this",
"->",
"converter",
"->",
"assignArrayToObject",
"(",
"$",
"document",
",",
"new",
"$",
"this",
"->",
"alias",
"[",
"'namespace'",
"]",
"(",
")",
","... | {@inheritdoc} | [
"{"
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Result/ObjectIterator.php#L49-L56 |
ongr-io/ElasticsearchBundle | Command/IndexExportCommand.php | IndexExportCommand.execute | protected function execute(InputInterface $input, OutputInterface $output)
{
$io = new SymfonyStyle($input, $output);
$manager = $this->getManager($input->getOption('manager'));
/** @var ExportService $exportService */
$exportService = $this->getContainer()->get('es.export');
... | php | protected function execute(InputInterface $input, OutputInterface $output)
{
$io = new SymfonyStyle($input, $output);
$manager = $this->getManager($input->getOption('manager'));
/** @var ExportService $exportService */
$exportService = $this->getContainer()->get('es.export');
... | [
"protected",
"function",
"execute",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
"{",
"$",
"io",
"=",
"new",
"SymfonyStyle",
"(",
"$",
"input",
",",
"$",
"output",
")",
";",
"$",
"manager",
"=",
"$",
"this",
"->",
"g... | {@inheritdoc} | [
"{"
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Command/IndexExportCommand.php#L65-L82 |
ongr-io/ElasticsearchBundle | Service/Json/JsonReader.php | JsonReader.getFileHandler | protected function getFileHandler()
{
if ($this->handle === null) {
$isGzip = array_key_exists('gzip', $this->options);
$filename = !$isGzip?
$this->filename:
sprintf('compress.zlib://%s', $this->filename);
$fileHandler = @fopen($filename,... | php | protected function getFileHandler()
{
if ($this->handle === null) {
$isGzip = array_key_exists('gzip', $this->options);
$filename = !$isGzip?
$this->filename:
sprintf('compress.zlib://%s', $this->filename);
$fileHandler = @fopen($filename,... | [
"protected",
"function",
"getFileHandler",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"handle",
"===",
"null",
")",
"{",
"$",
"isGzip",
"=",
"array_key_exists",
"(",
"'gzip'",
",",
"$",
"this",
"->",
"options",
")",
";",
"$",
"filename",
"=",
"!",
... | Returns file handler.
@return resource
@throws \LogicException | [
"Returns",
"file",
"handler",
"."
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Service/Json/JsonReader.php#L102-L120 |
ongr-io/ElasticsearchBundle | Service/Json/JsonReader.php | JsonReader.readMetadata | protected function readMetadata()
{
if ($this->metadata !== null) {
return;
}
$line = fgets($this->getFileHandler());
if (trim($line) !== '[') {
throw new \InvalidArgumentException('Given file does not match expected pattern.');
}
$line = tr... | php | protected function readMetadata()
{
if ($this->metadata !== null) {
return;
}
$line = fgets($this->getFileHandler());
if (trim($line) !== '[') {
throw new \InvalidArgumentException('Given file does not match expected pattern.');
}
$line = tr... | [
"protected",
"function",
"readMetadata",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"metadata",
"!==",
"null",
")",
"{",
"return",
";",
"}",
"$",
"line",
"=",
"fgets",
"(",
"$",
"this",
"->",
"getFileHandler",
"(",
")",
")",
";",
"if",
"(",
"trim... | Reads metadata from file.
@throws \InvalidArgumentException | [
"Reads",
"metadata",
"from",
"file",
"."
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Service/Json/JsonReader.php#L127-L141 |
ongr-io/ElasticsearchBundle | Service/Json/JsonReader.php | JsonReader.readLine | protected function readLine()
{
$buffer = '';
while ($buffer === '') {
$buffer = fgets($this->getFileHandler());
if ($buffer === false) {
$this->currentLine = null;
return;
}
$buffer = trim($buffer);
}
... | php | protected function readLine()
{
$buffer = '';
while ($buffer === '') {
$buffer = fgets($this->getFileHandler());
if ($buffer === false) {
$this->currentLine = null;
return;
}
$buffer = trim($buffer);
}
... | [
"protected",
"function",
"readLine",
"(",
")",
"{",
"$",
"buffer",
"=",
"''",
";",
"while",
"(",
"$",
"buffer",
"===",
"''",
")",
"{",
"$",
"buffer",
"=",
"fgets",
"(",
"$",
"this",
"->",
"getFileHandler",
"(",
")",
")",
";",
"if",
"(",
"$",
"buf... | Reads single line from file. | [
"Reads",
"single",
"line",
"from",
"file",
"."
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Service/Json/JsonReader.php#L146-L170 |
ongr-io/ElasticsearchBundle | Service/Json/JsonReader.php | JsonReader.configureResolver | protected function configureResolver(OptionsResolver $resolver)
{
$resolver
->setRequired(['_id', '_type', '_source'])
->setDefaults(['_score' => null, 'fields' => []])
->addAllowedTypes('_id', ['integer', 'string'])
->addAllowedTypes('_type', 'string')
... | php | protected function configureResolver(OptionsResolver $resolver)
{
$resolver
->setRequired(['_id', '_type', '_source'])
->setDefaults(['_score' => null, 'fields' => []])
->addAllowedTypes('_id', ['integer', 'string'])
->addAllowedTypes('_type', 'string')
... | [
"protected",
"function",
"configureResolver",
"(",
"OptionsResolver",
"$",
"resolver",
")",
"{",
"$",
"resolver",
"->",
"setRequired",
"(",
"[",
"'_id'",
",",
"'_type'",
",",
"'_source'",
"]",
")",
"->",
"setDefaults",
"(",
"[",
"'_score'",
"=>",
"null",
","... | Configures OptionResolver for resolving document metadata fields.
@param OptionsResolver $resolver | [
"Configures",
"OptionResolver",
"for",
"resolving",
"document",
"metadata",
"fields",
"."
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Service/Json/JsonReader.php#L177-L186 |
ongr-io/ElasticsearchBundle | Service/Json/JsonReader.php | JsonReader.rewind | public function rewind()
{
rewind($this->getFileHandler());
$this->metadata = null;
$this->readMetadata();
$this->readLine();
} | php | public function rewind()
{
rewind($this->getFileHandler());
$this->metadata = null;
$this->readMetadata();
$this->readLine();
} | [
"public",
"function",
"rewind",
"(",
")",
"{",
"rewind",
"(",
"$",
"this",
"->",
"getFileHandler",
"(",
")",
")",
";",
"$",
"this",
"->",
"metadata",
"=",
"null",
";",
"$",
"this",
"->",
"readMetadata",
"(",
")",
";",
"$",
"this",
"->",
"readLine",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Service/Json/JsonReader.php#L231-L237 |
ongr-io/ElasticsearchBundle | Service/Json/JsonReader.php | JsonReader.getOptionsResolver | private function getOptionsResolver()
{
if (!$this->optionsResolver) {
$this->optionsResolver = new OptionsResolver();
$this->configureResolver($this->optionsResolver);
}
return $this->optionsResolver;
} | php | private function getOptionsResolver()
{
if (!$this->optionsResolver) {
$this->optionsResolver = new OptionsResolver();
$this->configureResolver($this->optionsResolver);
}
return $this->optionsResolver;
} | [
"private",
"function",
"getOptionsResolver",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"optionsResolver",
")",
"{",
"$",
"this",
"->",
"optionsResolver",
"=",
"new",
"OptionsResolver",
"(",
")",
";",
"$",
"this",
"->",
"configureResolver",
"(",
"$"... | Returns configured options resolver instance.
@return OptionsResolver | [
"Returns",
"configured",
"options",
"resolver",
"instance",
"."
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Service/Json/JsonReader.php#L270-L278 |
ongr-io/ElasticsearchBundle | Generator/DocumentGenerator.php | DocumentGenerator.generateDocumentClass | public function generateDocumentClass(array $metadata)
{
return implode(
"\n",
[
"<?php\n",
sprintf('namespace %s;', substr($metadata['name'], 0, strrpos($metadata['name'], '\\'))) . "\n",
$this->generateDocumentUse($metadata),
... | php | public function generateDocumentClass(array $metadata)
{
return implode(
"\n",
[
"<?php\n",
sprintf('namespace %s;', substr($metadata['name'], 0, strrpos($metadata['name'], '\\'))) . "\n",
$this->generateDocumentUse($metadata),
... | [
"public",
"function",
"generateDocumentClass",
"(",
"array",
"$",
"metadata",
")",
"{",
"return",
"implode",
"(",
"\"\\n\"",
",",
"[",
"\"<?php\\n\"",
",",
"sprintf",
"(",
"'namespace %s;'",
",",
"substr",
"(",
"$",
"metadata",
"[",
"'name'",
"]",
",",
"0",
... | @param array $metadata
@return string | [
"@param",
"array",
"$metadata"
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Generator/DocumentGenerator.php#L89-L104 |
ongr-io/ElasticsearchBundle | Generator/DocumentGenerator.php | DocumentGenerator.generateDocumentBody | private function generateDocumentBody(array $metadata)
{
$lines = [];
if ($properties = $this->generateDocumentProperties($metadata)) {
$lines[] = $properties;
}
if ($this->hasMultipleEmbedded($metadata)) {
$lines[] = $this->generateDocumentConstructor($meta... | php | private function generateDocumentBody(array $metadata)
{
$lines = [];
if ($properties = $this->generateDocumentProperties($metadata)) {
$lines[] = $properties;
}
if ($this->hasMultipleEmbedded($metadata)) {
$lines[] = $this->generateDocumentConstructor($meta... | [
"private",
"function",
"generateDocumentBody",
"(",
"array",
"$",
"metadata",
")",
"{",
"$",
"lines",
"=",
"[",
"]",
";",
"if",
"(",
"$",
"properties",
"=",
"$",
"this",
"->",
"generateDocumentProperties",
"(",
"$",
"metadata",
")",
")",
"{",
"$",
"lines... | Generates document body
@param array $metadata
@return string | [
"Generates",
"document",
"body"
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Generator/DocumentGenerator.php#L113-L130 |
ongr-io/ElasticsearchBundle | Generator/DocumentGenerator.php | DocumentGenerator.generateDocumentProperties | private function generateDocumentProperties(array $metadata)
{
$lines = [];
foreach ($metadata['properties'] as $property) {
$lines[] = $this->generatePropertyDocBlock($property);
$lines[] = $this->spaces . $property['visibility'] . ' $' . $property['field_name'] . ";\n";
... | php | private function generateDocumentProperties(array $metadata)
{
$lines = [];
foreach ($metadata['properties'] as $property) {
$lines[] = $this->generatePropertyDocBlock($property);
$lines[] = $this->spaces . $property['visibility'] . ' $' . $property['field_name'] . ";\n";
... | [
"private",
"function",
"generateDocumentProperties",
"(",
"array",
"$",
"metadata",
")",
"{",
"$",
"lines",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"metadata",
"[",
"'properties'",
"]",
"as",
"$",
"property",
")",
"{",
"$",
"lines",
"[",
"]",
"=",
"$"... | Generates document properties
@param array $metadata
@return string | [
"Generates",
"document",
"properties"
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Generator/DocumentGenerator.php#L139-L149 |
ongr-io/ElasticsearchBundle | Generator/DocumentGenerator.php | DocumentGenerator.generateDocumentMethods | private function generateDocumentMethods(array $metadata)
{
$lines = [];
foreach ($metadata['properties'] as $property) {
if (isset($property['visibility']) && $property['visibility'] === 'public') {
continue;
}
$lines[] = $this->generateDocumentM... | php | private function generateDocumentMethods(array $metadata)
{
$lines = [];
foreach ($metadata['properties'] as $property) {
if (isset($property['visibility']) && $property['visibility'] === 'public') {
continue;
}
$lines[] = $this->generateDocumentM... | [
"private",
"function",
"generateDocumentMethods",
"(",
"array",
"$",
"metadata",
")",
"{",
"$",
"lines",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"metadata",
"[",
"'properties'",
"]",
"as",
"$",
"property",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"prop... | Generates document methods
@param array $metadata
@return string | [
"Generates",
"document",
"methods"
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Generator/DocumentGenerator.php#L158-L175 |
ongr-io/ElasticsearchBundle | Generator/DocumentGenerator.php | DocumentGenerator.generateDocumentConstructor | private function generateDocumentConstructor(array $metadata)
{
$fields = [];
foreach ($metadata['properties'] as $prop) {
if ($prop['annotation'] == 'embedded' && isset($prop['property_multiple']) && $prop['property_multiple']) {
$fields[] = sprintf('%s$this->%s = new C... | php | private function generateDocumentConstructor(array $metadata)
{
$fields = [];
foreach ($metadata['properties'] as $prop) {
if ($prop['annotation'] == 'embedded' && isset($prop['property_multiple']) && $prop['property_multiple']) {
$fields[] = sprintf('%s$this->%s = new C... | [
"private",
"function",
"generateDocumentConstructor",
"(",
"array",
"$",
"metadata",
")",
"{",
"$",
"fields",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"metadata",
"[",
"'properties'",
"]",
"as",
"$",
"prop",
")",
"{",
"if",
"(",
"$",
"prop",
"[",
"'ann... | Generates document constructor
@param array $metadata
@return string | [
"Generates",
"document",
"constructor"
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Generator/DocumentGenerator.php#L184-L197 |
ongr-io/ElasticsearchBundle | Generator/DocumentGenerator.php | DocumentGenerator.generateDocumentMethod | private function generateDocumentMethod(array $metadata, $template)
{
return $this->prefixWithSpaces(
str_replace(
['<methodName>', '<fieldName>'],
[ucfirst($metadata['field_name']), $metadata['field_name']],
$template
)
);
... | php | private function generateDocumentMethod(array $metadata, $template)
{
return $this->prefixWithSpaces(
str_replace(
['<methodName>', '<fieldName>'],
[ucfirst($metadata['field_name']), $metadata['field_name']],
$template
)
);
... | [
"private",
"function",
"generateDocumentMethod",
"(",
"array",
"$",
"metadata",
",",
"$",
"template",
")",
"{",
"return",
"$",
"this",
"->",
"prefixWithSpaces",
"(",
"str_replace",
"(",
"[",
"'<methodName>'",
",",
"'<fieldName>'",
"]",
",",
"[",
"ucfirst",
"("... | Generates document method
@param array $metadata
@param string $template
@return string | [
"Generates",
"document",
"method"
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Generator/DocumentGenerator.php#L207-L216 |
ongr-io/ElasticsearchBundle | Generator/DocumentGenerator.php | DocumentGenerator.generatePropertyDocBlock | private function generatePropertyDocBlock(array $metadata)
{
$lines = [
$this->spaces . '/**',
$this->spaces . ' * @var string',
$this->spaces . ' *',
];
$column = [];
if (isset($metadata['property_name']) && $metadata['property_name'] != $metadat... | php | private function generatePropertyDocBlock(array $metadata)
{
$lines = [
$this->spaces . '/**',
$this->spaces . ' * @var string',
$this->spaces . ' *',
];
$column = [];
if (isset($metadata['property_name']) && $metadata['property_name'] != $metadat... | [
"private",
"function",
"generatePropertyDocBlock",
"(",
"array",
"$",
"metadata",
")",
"{",
"$",
"lines",
"=",
"[",
"$",
"this",
"->",
"spaces",
".",
"'/**'",
",",
"$",
"this",
"->",
"spaces",
".",
"' * @var string'",
",",
"$",
"this",
"->",
"spaces",
".... | Returns property doc block
@param array $metadata
@return string | [
"Returns",
"property",
"doc",
"block"
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Generator/DocumentGenerator.php#L225-L263 |
ongr-io/ElasticsearchBundle | Generator/DocumentGenerator.php | DocumentGenerator.generateDocumentDocBlock | private function generateDocumentDocBlock(array $metadata)
{
return str_replace(
['<className>', '<annotation>', '<options>'],
[
$this->getClassName($metadata),
ucfirst($metadata['annotation']),
$metadata['annotation'] != 'object' ? ($m... | php | private function generateDocumentDocBlock(array $metadata)
{
return str_replace(
['<className>', '<annotation>', '<options>'],
[
$this->getClassName($metadata),
ucfirst($metadata['annotation']),
$metadata['annotation'] != 'object' ? ($m... | [
"private",
"function",
"generateDocumentDocBlock",
"(",
"array",
"$",
"metadata",
")",
"{",
"return",
"str_replace",
"(",
"[",
"'<className>'",
",",
"'<annotation>'",
",",
"'<options>'",
"]",
",",
"[",
"$",
"this",
"->",
"getClassName",
"(",
"$",
"metadata",
"... | Generates document doc block
@param array $metadata
@return string | [
"Generates",
"document",
"doc",
"block"
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Generator/DocumentGenerator.php#L272-L288 |
ongr-io/ElasticsearchBundle | Generator/DocumentGenerator.php | DocumentGenerator.prefixWithSpaces | private function prefixWithSpaces($code)
{
$lines = explode("\n", $code);
foreach ($lines as $key => $value) {
if ($value) {
$lines[$key] = $this->spaces . $lines[$key];
}
}
return implode("\n", $lines);
} | php | private function prefixWithSpaces($code)
{
$lines = explode("\n", $code);
foreach ($lines as $key => $value) {
if ($value) {
$lines[$key] = $this->spaces . $lines[$key];
}
}
return implode("\n", $lines);
} | [
"private",
"function",
"prefixWithSpaces",
"(",
"$",
"code",
")",
"{",
"$",
"lines",
"=",
"explode",
"(",
"\"\\n\"",
",",
"$",
"code",
")",
";",
"foreach",
"(",
"$",
"lines",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"value",
... | @param string $code
@return string | [
"@param",
"string",
"$code"
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Generator/DocumentGenerator.php#L295-L306 |
ongr-io/ElasticsearchBundle | Generator/DocumentGenerator.php | DocumentGenerator.getClassName | private function getClassName(array $metadata)
{
return ($pos = strrpos($metadata['name'], '\\'))
? substr($metadata['name'], $pos + 1, strlen($metadata['name'])) : $metadata['name'];
} | php | private function getClassName(array $metadata)
{
return ($pos = strrpos($metadata['name'], '\\'))
? substr($metadata['name'], $pos + 1, strlen($metadata['name'])) : $metadata['name'];
} | [
"private",
"function",
"getClassName",
"(",
"array",
"$",
"metadata",
")",
"{",
"return",
"(",
"$",
"pos",
"=",
"strrpos",
"(",
"$",
"metadata",
"[",
"'name'",
"]",
",",
"'\\\\'",
")",
")",
"?",
"substr",
"(",
"$",
"metadata",
"[",
"'name'",
"]",
","... | Returns class name
@param array $metadata
@return string | [
"Returns",
"class",
"name"
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Generator/DocumentGenerator.php#L315-L319 |
ongr-io/ElasticsearchBundle | Generator/DocumentGenerator.php | DocumentGenerator.hasMultipleEmbedded | private function hasMultipleEmbedded(array $metadata)
{
foreach ($metadata['properties'] as $prop) {
if ($prop['annotation'] == 'embedded' && isset($prop['property_multiple']) && $prop['property_multiple']) {
return true;
}
}
return false;
} | php | private function hasMultipleEmbedded(array $metadata)
{
foreach ($metadata['properties'] as $prop) {
if ($prop['annotation'] == 'embedded' && isset($prop['property_multiple']) && $prop['property_multiple']) {
return true;
}
}
return false;
} | [
"private",
"function",
"hasMultipleEmbedded",
"(",
"array",
"$",
"metadata",
")",
"{",
"foreach",
"(",
"$",
"metadata",
"[",
"'properties'",
"]",
"as",
"$",
"prop",
")",
"{",
"if",
"(",
"$",
"prop",
"[",
"'annotation'",
"]",
"==",
"'embedded'",
"&&",
"is... | @param array $metadata
@return bool | [
"@param",
"array",
"$metadata"
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Generator/DocumentGenerator.php#L344-L353 |
ongr-io/ElasticsearchBundle | Annotation/Embedded.php | Embedded.dump | public function dump(array $exclude = [])
{
$array = array_diff_key(
array_filter(
get_object_vars($this),
function ($value) {
return $value || is_bool($value);
}
),
array_flip(array_merge(['class', 'name... | php | public function dump(array $exclude = [])
{
$array = array_diff_key(
array_filter(
get_object_vars($this),
function ($value) {
return $value || is_bool($value);
}
),
array_flip(array_merge(['class', 'name... | [
"public",
"function",
"dump",
"(",
"array",
"$",
"exclude",
"=",
"[",
"]",
")",
"{",
"$",
"array",
"=",
"array_diff_key",
"(",
"array_filter",
"(",
"get_object_vars",
"(",
"$",
"this",
")",
",",
"function",
"(",
"$",
"value",
")",
"{",
"return",
"$",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Annotation/Embedded.php#L60-L81 |
ongr-io/ElasticsearchBundle | Command/IndexCreateCommand.php | IndexCreateCommand.execute | protected function execute(InputInterface $input, OutputInterface $output)
{
$io = new SymfonyStyle($input, $output);
$manager = $this->getManager($input->getOption('manager'));
$originalIndexName = $manager->getIndexName();
if ($input->getOption('dump')) {
$io->note("In... | php | protected function execute(InputInterface $input, OutputInterface $output)
{
$io = new SymfonyStyle($input, $output);
$manager = $this->getManager($input->getOption('manager'));
$originalIndexName = $manager->getIndexName();
if ($input->getOption('dump')) {
$io->note("In... | [
"protected",
"function",
"execute",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
"{",
"$",
"io",
"=",
"new",
"SymfonyStyle",
"(",
"$",
"input",
",",
"$",
"output",
")",
";",
"$",
"manager",
"=",
"$",
"this",
"->",
"g... | {@inheritdoc} | [
"{"
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/Command/IndexCreateCommand.php#L57-L137 |
ongr-io/ElasticsearchBundle | DependencyInjection/Configuration.php | Configuration.getConfigTreeBuilder | public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('ongr_elasticsearch');
$rootNode
->children()
->booleanNode('cache')
->info(
'Enables cache handler to store metadata and oth... | php | public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('ongr_elasticsearch');
$rootNode
->children()
->booleanNode('cache')
->info(
'Enables cache handler to store metadata and oth... | [
"public",
"function",
"getConfigTreeBuilder",
"(",
")",
"{",
"$",
"treeBuilder",
"=",
"new",
"TreeBuilder",
"(",
")",
";",
"$",
"rootNode",
"=",
"$",
"treeBuilder",
"->",
"root",
"(",
"'ongr_elasticsearch'",
")",
";",
"$",
"rootNode",
"->",
"children",
"(",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/ongr-io/ElasticsearchBundle/blob/c817dc53d3b93129e8575a740e11484c67f79a87/DependencyInjection/Configuration.php#L26-L50 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.