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 |
|---|---|---|---|---|---|---|---|---|---|---|
duzun/hQuery.php | src/hQuery/HTML_Parser.php | HTML_Parser._index_attribs | private function _index_attribs($attrs)
{
$this->attr_idx = $this->attrs = $aix = $six = $iix = $iax = self::$_ar_;
$i = 0;
$ian = self::$_index_attribs;
foreach ($ian as $atn) {
if (!isset($iax[$atn])) {
$iax[$atn] = self::$_ar_;
... | php | private function _index_attribs($attrs)
{
$this->attr_idx = $this->attrs = $aix = $six = $iix = $iax = self::$_ar_;
$i = 0;
$ian = self::$_index_attribs;
foreach ($ian as $atn) {
if (!isset($iax[$atn])) {
$iax[$atn] = self::$_ar_;
... | [
"private",
"function",
"_index_attribs",
"(",
"$",
"attrs",
")",
"{",
"$",
"this",
"->",
"attr_idx",
"=",
"$",
"this",
"->",
"attrs",
"=",
"$",
"aix",
"=",
"$",
"six",
"=",
"$",
"iix",
"=",
"$",
"iax",
"=",
"self",
"::",
"$",
"_ar_",
";",
"$",
... | make attribute ids (aids) and index all attributes by aid at ids
@param $attrs
@return array | [
"make",
"attribute",
"ids",
"(",
"aids",
")",
"and",
"index",
"all",
"attributes",
"by",
"aid",
"at",
"ids"
] | train | https://github.com/duzun/hQuery.php/blob/3489e999f36879f69ef5e526b759b21ac5b65e44/src/hQuery/HTML_Parser.php#L600-L686 |
duzun/hQuery.php | src/hQuery/HTML_Parser.php | HTML_Parser._index_classes | private function _index_classes()
{
$ix = array();
$aix = $this->attr_idx;
foreach ($this->attribs as $aid => &$a) {
if (!empty($a['class'])) {
$cl = $a['class'];
if (!is_array($cl)) {
$cl = preg_split('|\\s+|', trim($cl));
... | php | private function _index_classes()
{
$ix = array();
$aix = $this->attr_idx;
foreach ($this->attribs as $aid => &$a) {
if (!empty($a['class'])) {
$cl = $a['class'];
if (!is_array($cl)) {
$cl = preg_split('|\\s+|', trim($cl));
... | [
"private",
"function",
"_index_classes",
"(",
")",
"{",
"$",
"ix",
"=",
"array",
"(",
")",
";",
"$",
"aix",
"=",
"$",
"this",
"->",
"attr_idx",
";",
"foreach",
"(",
"$",
"this",
"->",
"attribs",
"as",
"$",
"aid",
"=>",
"&",
"$",
"a",
")",
"{",
... | index all classes by class-name at aids
@return array | [
"index",
"all",
"classes",
"by",
"class",
"-",
"name",
"at",
"aids"
] | train | https://github.com/duzun/hQuery.php/blob/3489e999f36879f69ef5e526b759b21ac5b65e44/src/hQuery/HTML_Parser.php#L693-L718 |
duzun/hQuery.php | src/hQuery/HTML_Parser.php | HTML_Parser.hasClass | public function hasClass($id, $cl)
{
if (!is_array($cl)) {
$cl = preg_split('|\\s+|', trim($cl));
}
if (is_string($id) && !is_numeric($id)) {
$id = $this->find($id);
}
if ($id instanceof Node) {
$exc = $id->exc;
$id = $id->ids... | php | public function hasClass($id, $cl)
{
if (!is_array($cl)) {
$cl = preg_split('|\\s+|', trim($cl));
}
if (is_string($id) && !is_numeric($id)) {
$id = $this->find($id);
}
if ($id instanceof Node) {
$exc = $id->exc;
$id = $id->ids... | [
"public",
"function",
"hasClass",
"(",
"$",
"id",
",",
"$",
"cl",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"cl",
")",
")",
"{",
"$",
"cl",
"=",
"preg_split",
"(",
"'|\\\\s+|'",
",",
"trim",
"(",
"$",
"cl",
")",
")",
";",
"}",
"if",
"("... | Checks whether $this element/collection has a(ll) class(es).
@param int|array|string|Node $id - The context to check
@param string|array $cl - class(es) to check
@return false - no class, - doesn't have any class, true - has class, [id => true] | [
"Checks",
"whether",
"$this",
"element",
"/",
"collection",
"has",
"a",
"(",
"ll",
")",
"class",
"(",
"es",
")",
"."
] | train | https://github.com/duzun/hQuery.php/blob/3489e999f36879f69ef5e526b759b21ac5b65e44/src/hQuery/HTML_Parser.php#L988-L1034 |
duzun/hQuery.php | src/hQuery/HTML_Parser.php | HTML_Parser.get_ids_byAid | protected function get_ids_byAid($aid, $sort = true, $has_keys = false)
{
$ret = self::$_ar_;
if (!$has_keys) {
$aid = self::array_select($this->attr_idx, $aid);
}
foreach ($aid as $aid => $aix) {
if (!is_array($aix)) {
$aix = array($aix => $t... | php | protected function get_ids_byAid($aid, $sort = true, $has_keys = false)
{
$ret = self::$_ar_;
if (!$has_keys) {
$aid = self::array_select($this->attr_idx, $aid);
}
foreach ($aid as $aid => $aix) {
if (!is_array($aix)) {
$aix = array($aix => $t... | [
"protected",
"function",
"get_ids_byAid",
"(",
"$",
"aid",
",",
"$",
"sort",
"=",
"true",
",",
"$",
"has_keys",
"=",
"false",
")",
"{",
"$",
"ret",
"=",
"self",
"::",
"$",
"_ar_",
";",
"if",
"(",
"!",
"$",
"has_keys",
")",
"{",
"$",
"aid",
"=",
... | $has_keys == true => $aid == [aid=>[ids]]
$has_keys == false => $aid == [aids]
@return array | [
"$has_keys",
"==",
"true",
"=",
">",
"$aid",
"==",
"[",
"aid",
"=",
">",
"[",
"ids",
"]]",
"$has_keys",
"==",
"false",
"=",
">",
"$aid",
"==",
"[",
"aids",
"]"
] | train | https://github.com/duzun/hQuery.php/blob/3489e999f36879f69ef5e526b759b21ac5b65e44/src/hQuery/HTML_Parser.php#L1267-L1293 |
duzun/hQuery.php | src/hQuery.php | hQuery.fromHTML | public static function fromHTML($html, $url = null)
{
if ($html instanceof MessageInterface) {
$message = $html;
$html = $message->getBody() . '';
if (!isset($url) && $message instanceof RequestInterface) {
$url = $message->getUri() . '';
}... | php | public static function fromHTML($html, $url = null)
{
if ($html instanceof MessageInterface) {
$message = $html;
$html = $message->getBody() . '';
if (!isset($url) && $message instanceof RequestInterface) {
$url = $message->getUri() . '';
}... | [
"public",
"static",
"function",
"fromHTML",
"(",
"$",
"html",
",",
"$",
"url",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"html",
"instanceof",
"MessageInterface",
")",
"{",
"$",
"message",
"=",
"$",
"html",
";",
"$",
"html",
"=",
"$",
"message",
"->",
... | Parse an HTML string.
@param string|Psr\Http\Message\MessageInterface $html - source of some HTML document
@param string $url - OPTIONAL location of the document. Used for relative URLs inside the document.
@return hQuery $doc | [
"Parse",
"an",
"HTML",
"string",
"."
] | train | https://github.com/duzun/hQuery.php/blob/3489e999f36879f69ef5e526b759b21ac5b65e44/src/hQuery.php#L64-L97 |
duzun/hQuery.php | src/hQuery.php | hQuery.fromFile | public static function fromFile($filename, $use_include_path = false, $context = null)
{
$read_time = microtime(true);
$html = file_get_contents($filename, $use_include_path, $context);
$read_time = microtime(true) - $read_time;
if (false === $html) {
return $html;
... | php | public static function fromFile($filename, $use_include_path = false, $context = null)
{
$read_time = microtime(true);
$html = file_get_contents($filename, $use_include_path, $context);
$read_time = microtime(true) - $read_time;
if (false === $html) {
return $html;
... | [
"public",
"static",
"function",
"fromFile",
"(",
"$",
"filename",
",",
"$",
"use_include_path",
"=",
"false",
",",
"$",
"context",
"=",
"null",
")",
"{",
"$",
"read_time",
"=",
"microtime",
"(",
"true",
")",
";",
"$",
"html",
"=",
"file_get_contents",
"(... | Read the HTML document from a file.
@param string $filename - a valid filename
@param bool $use_include_path - OPTIONAL passed to file_get_contents()
@param resource $context - OPTIONAL A valid context resource created with stream_context_create(). See file_get_contents()
@return hQuery $do... | [
"Read",
"the",
"HTML",
"document",
"from",
"a",
"file",
"."
] | train | https://github.com/duzun/hQuery.php/blob/3489e999f36879f69ef5e526b759b21ac5b65e44/src/hQuery.php#L107-L120 |
duzun/hQuery.php | src/hQuery.php | hQuery.fromURL | public static function fromURL($url, $headers = null, $body = null, $options = null)
{
$opt = array(
'timeout' => 7,
'redirects' => 7,
'close' => false,
'decode' => 'gzip',
'expires' => self::$cache_expires,
);
$hd = arra... | php | public static function fromURL($url, $headers = null, $body = null, $options = null)
{
$opt = array(
'timeout' => 7,
'redirects' => 7,
'close' => false,
'decode' => 'gzip',
'expires' => self::$cache_expires,
);
$hd = arra... | [
"public",
"static",
"function",
"fromURL",
"(",
"$",
"url",
",",
"$",
"headers",
"=",
"null",
",",
"$",
"body",
"=",
"null",
",",
"$",
"options",
"=",
"null",
")",
"{",
"$",
"opt",
"=",
"array",
"(",
"'timeout'",
"=>",
"7",
",",
"'redirects'",
"=>"... | Fetch the HTML document from remote $url.
@param string $url - the URL of the document
@param array $headers - OPTIONAL request headers
@param array|string $body - OPTIONAL body of the request (for POST or PUT)
@param array $options - OPTIONAL request options (see self::http_wr() for mor... | [
"Fetch",
"the",
"HTML",
"document",
"from",
"remote",
"$url",
"."
] | train | https://github.com/duzun/hQuery.php/blob/3489e999f36879f69ef5e526b759b21ac5b65e44/src/hQuery.php#L131-L223 |
duzun/hQuery.php | src/hQuery.php | hQuery.sendRequest | public static function sendRequest(RequestInterface $request, $client = null)
{
// if ( !class_exists('Http\Discovery\HttpClientDiscovery') ) {
// throw new Exception('Http\Discovery\HttpClientDiscovery not found. Install a client (eg. `require php-http/curl-client`)');
// }
if (... | php | public static function sendRequest(RequestInterface $request, $client = null)
{
// if ( !class_exists('Http\Discovery\HttpClientDiscovery') ) {
// throw new Exception('Http\Discovery\HttpClientDiscovery not found. Install a client (eg. `require php-http/curl-client`)');
// }
if (... | [
"public",
"static",
"function",
"sendRequest",
"(",
"RequestInterface",
"$",
"request",
",",
"$",
"client",
"=",
"null",
")",
"{",
"// if ( !class_exists('Http\\Discovery\\HttpClientDiscovery') ) {",
"// throw new Exception('Http\\Discovery\\HttpClientDiscovery not found. Install... | Send a HTTP request and create a hQuery document from the response (PSR-7).
@param Psr\Http\Message\RequestInterface $request
@param Http\Client\HttpClient $client An optional HTTP client. If missing, HttpClientDiscovery is used to create one.
@return hQuery $doc | [
"Send",
"a",
"HTTP",
"request",
"and",
"create",
"a",
"hQuery",
"document",
"from",
"the",
"response",
"(",
"PSR",
"-",
"7",
")",
"."
] | train | https://github.com/duzun/hQuery.php/blob/3489e999f36879f69ef5e526b759b21ac5b65e44/src/hQuery.php#L232-L287 |
duzun/hQuery.php | src/hQuery.php | hQuery.find | public function find($sel, $_attr = null, $ctx = null)
{
$attr = array();
$c = func_num_args();
for ($i = 1; $i < $c; ++$i) {
$a = func_get_arg($i);
if (is_object($a)) {
if ($a instanceof hQuery\Node) {
$ctx = $a;
... | php | public function find($sel, $_attr = null, $ctx = null)
{
$attr = array();
$c = func_num_args();
for ($i = 1; $i < $c; ++$i) {
$a = func_get_arg($i);
if (is_object($a)) {
if ($a instanceof hQuery\Node) {
$ctx = $a;
... | [
"public",
"function",
"find",
"(",
"$",
"sel",
",",
"$",
"_attr",
"=",
"null",
",",
"$",
"ctx",
"=",
"null",
")",
"{",
"$",
"attr",
"=",
"array",
"(",
")",
";",
"$",
"c",
"=",
"func_num_args",
"(",
")",
";",
"for",
"(",
"$",
"i",
"=",
"1",
... | Finds a collection of nodes inside current document/context (similar to jQuery.fn.find()).
@param string $sel - A valid CSS selector (some pseudo-selectors supported).
@param array|string $attr - OPTIONAL attributes as string or key-value pairs.
@param hQuery\Node $ctx - OPTIONAL the c... | [
"Finds",
"a",
"collection",
"of",
"nodes",
"inside",
"current",
"document",
"/",
"context",
"(",
"similar",
"to",
"jQuery",
".",
"fn",
".",
"find",
"()",
")",
"."
] | train | https://github.com/duzun/hQuery.php/blob/3489e999f36879f69ef5e526b759b21ac5b65e44/src/hQuery.php#L298-L413 |
duzun/hQuery.php | src/hQuery.php | hQuery.find_html | public function find_html($sel, $attr = null, $ctx = null)
{
$r = $this->find($sel, $attr = null, $ctx = null);
$ret = self::$_ar_;
if ($r) {
foreach ($r as $k => $v) {
$ret[$k] = $v->html();
}
}
return $ret;
} | php | public function find_html($sel, $attr = null, $ctx = null)
{
$r = $this->find($sel, $attr = null, $ctx = null);
$ret = self::$_ar_;
if ($r) {
foreach ($r as $k => $v) {
$ret[$k] = $v->html();
}
}
return $ret;
} | [
"public",
"function",
"find_html",
"(",
"$",
"sel",
",",
"$",
"attr",
"=",
"null",
",",
"$",
"ctx",
"=",
"null",
")",
"{",
"$",
"r",
"=",
"$",
"this",
"->",
"find",
"(",
"$",
"sel",
",",
"$",
"attr",
"=",
"null",
",",
"$",
"ctx",
"=",
"null",... | Combination of ->find() + ->html()
@param string $sel - A valid CSS selector.
@param array|string $attr - OPTIONAL attributes as string or key-value pairs.
@param hQuery\Node $ctx - OPTIONAL the context where to search. If omitted, $this is used.
@return array list of HTML contents of all matched el... | [
"Combination",
"of",
"-",
">",
"find",
"()",
"+",
"-",
">",
"html",
"()"
] | train | https://github.com/duzun/hQuery.php/blob/3489e999f36879f69ef5e526b759b21ac5b65e44/src/hQuery.php#L423-L434 |
duzun/hQuery.php | src/hQuery.php | hQuery.find_text | public function find_text($sel, $attr = null, $ctx = null)
{
$r = $this->find($sel, $attr = null, $ctx = null);
$ret = self::$_ar_;
if ($r) {
foreach ($r as $k => $v) {
$ret[$k] = $v->text();
}
}
return $ret;
} | php | public function find_text($sel, $attr = null, $ctx = null)
{
$r = $this->find($sel, $attr = null, $ctx = null);
$ret = self::$_ar_;
if ($r) {
foreach ($r as $k => $v) {
$ret[$k] = $v->text();
}
}
return $ret;
} | [
"public",
"function",
"find_text",
"(",
"$",
"sel",
",",
"$",
"attr",
"=",
"null",
",",
"$",
"ctx",
"=",
"null",
")",
"{",
"$",
"r",
"=",
"$",
"this",
"->",
"find",
"(",
"$",
"sel",
",",
"$",
"attr",
"=",
"null",
",",
"$",
"ctx",
"=",
"null",... | Combination of ->find() + ->text()
@param string $sel - A valid CSS selector.
@param array|string $attr - OPTIONAL attributes as string or key-value pairs.
@param hQuery\Node $ctx - OPTIONAL the context where to search. If omitted, $this is used.
@return array list of Text contents of all matched el... | [
"Combination",
"of",
"-",
">",
"find",
"()",
"+",
"-",
">",
"text",
"()"
] | train | https://github.com/duzun/hQuery.php/blob/3489e999f36879f69ef5e526b759b21ac5b65e44/src/hQuery.php#L444-L455 |
duzun/hQuery.php | src/hQuery.php | hQuery.jsonize | public static function jsonize($data, &$type = null, $ops = 0)
{
if (defined('JSON_UNESCAPED_UNICODE')) {
$ops |= JSON_UNESCAPED_UNICODE;
}
$str = $ops ? json_encode($data, $ops) : json_encode($data);
if (false === $str/*&& json_last_error() != JSON_ERROR_NONE*/) {
... | php | public static function jsonize($data, &$type = null, $ops = 0)
{
if (defined('JSON_UNESCAPED_UNICODE')) {
$ops |= JSON_UNESCAPED_UNICODE;
}
$str = $ops ? json_encode($data, $ops) : json_encode($data);
if (false === $str/*&& json_last_error() != JSON_ERROR_NONE*/) {
... | [
"public",
"static",
"function",
"jsonize",
"(",
"$",
"data",
",",
"&",
"$",
"type",
"=",
"null",
",",
"$",
"ops",
"=",
"0",
")",
"{",
"if",
"(",
"defined",
"(",
"'JSON_UNESCAPED_UNICODE'",
")",
")",
"{",
"$",
"ops",
"|=",
"JSON_UNESCAPED_UNICODE",
";",... | Serialize $data as JSON, fallback to serialize.
@param mixed $data - the data to be serialized
@param &string $type - returns the serialization method used ('json' | 'ser')
@return string the serialized data | [
"Serialize",
"$data",
"as",
"JSON",
"fallback",
"to",
"serialize",
"."
] | train | https://github.com/duzun/hQuery.php/blob/3489e999f36879f69ef5e526b759b21ac5b65e44/src/hQuery.php#L473-L486 |
duzun/hQuery.php | src/hQuery.php | hQuery.unjsonize | public static function unjsonize($str, &$type = null)
{
if (!isset($type)) {
$type = self::serjstype($str);
}
/**
* @var mixed
*/
static $_json_support;
if (!isset($_json_support)) {
$_json_support = 0;
// PHP 5 >= 5.3.0
... | php | public static function unjsonize($str, &$type = null)
{
if (!isset($type)) {
$type = self::serjstype($str);
}
/**
* @var mixed
*/
static $_json_support;
if (!isset($_json_support)) {
$_json_support = 0;
// PHP 5 >= 5.3.0
... | [
"public",
"static",
"function",
"unjsonize",
"(",
"$",
"str",
",",
"&",
"$",
"type",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"type",
")",
")",
"{",
"$",
"type",
"=",
"self",
"::",
"serjstype",
"(",
"$",
"str",
")",
";",
"}",
... | Unserialize $data from either JSON or serialize.
if set, forces unjsonize() to use this method for unserialization.
@param string $str - the data to be unserialized
@param &string $type - if not set, returns the serialization method detected ('json' | 'ser');
@return mixed the unserialized data | [
"Unserialize",
"$data",
"from",
"either",
"JSON",
"or",
"serialize",
"."
] | train | https://github.com/duzun/hQuery.php/blob/3489e999f36879f69ef5e526b759b21ac5b65e44/src/hQuery.php#L496-L572 |
duzun/hQuery.php | src/hQuery.php | hQuery.serjstype | protected static function serjstype($str)
{
$c = substr($str, 0, 1);
if ('N;' === $str || strpos('sibadO', $c) !== false && substr($str, 1, 1) === ':') {
$type = 'ser';
} else {
$l = substr($str, -1);
if ('{' == $c && '}' == $l || '[' == $c && ']' == $l) {... | php | protected static function serjstype($str)
{
$c = substr($str, 0, 1);
if ('N;' === $str || strpos('sibadO', $c) !== false && substr($str, 1, 1) === ':') {
$type = 'ser';
} else {
$l = substr($str, -1);
if ('{' == $c && '}' == $l || '[' == $c && ']' == $l) {... | [
"protected",
"static",
"function",
"serjstype",
"(",
"$",
"str",
")",
"{",
"$",
"c",
"=",
"substr",
"(",
"$",
"str",
",",
"0",
",",
"1",
")",
";",
"if",
"(",
"'N;'",
"===",
"$",
"str",
"||",
"strpos",
"(",
"'sibadO'",
",",
"$",
"c",
")",
"!==",... | Tries to detect format of $str (json or ser).
@param string $str - JSON encoded or PHP serialized data.
@return string 'json' | 'ser', or FALSE on failure to detect format. | [
"Tries",
"to",
"detect",
"format",
"of",
"$str",
"(",
"json",
"or",
"ser",
")",
"."
] | train | https://github.com/duzun/hQuery.php/blob/3489e999f36879f69ef5e526b759b21ac5b65e44/src/hQuery.php#L580-L594 |
duzun/hQuery.php | src/hQuery.php | hQuery.gzdecode | public static function gzdecode($str)
{
/**
* @var mixed
*/
static $_gzdecode;
if (!isset($_gzdecode)) {
$_gzdecode = self::gz_supported();
}
return $_gzdecode ? $_gzdecode($str) : self::_gzdecode($str);
} | php | public static function gzdecode($str)
{
/**
* @var mixed
*/
static $_gzdecode;
if (!isset($_gzdecode)) {
$_gzdecode = self::gz_supported();
}
return $_gzdecode ? $_gzdecode($str) : self::_gzdecode($str);
} | [
"public",
"static",
"function",
"gzdecode",
"(",
"$",
"str",
")",
"{",
"/**\n * @var mixed\n */",
"static",
"$",
"_gzdecode",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"_gzdecode",
")",
")",
"{",
"$",
"_gzdecode",
"=",
"self",
"::",
"gz_support... | gzdecode() (for PHP < 5.4.0) | [
"gzdecode",
"()",
"(",
"for",
"PHP",
"<",
"5",
".",
"4",
".",
"0",
")"
] | train | https://github.com/duzun/hQuery.php/blob/3489e999f36879f69ef5e526b759b21ac5b65e44/src/hQuery.php#L611-L622 |
duzun/hQuery.php | src/hQuery.php | hQuery._gzdecode | protected static function _gzdecode($gzdata, $maxlen = null)
{
#-- decode header
$len = strlen($gzdata);
if ($len < 20) {
return;
}
$head = substr($gzdata, 0, 10);
$head = unpack('n1id/C1c... | php | protected static function _gzdecode($gzdata, $maxlen = null)
{
#-- decode header
$len = strlen($gzdata);
if ($len < 20) {
return;
}
$head = substr($gzdata, 0, 10);
$head = unpack('n1id/C1c... | [
"protected",
"static",
"function",
"_gzdecode",
"(",
"$",
"gzdata",
",",
"$",
"maxlen",
"=",
"null",
")",
"{",
"#-- decode header",
"$",
"len",
"=",
"strlen",
"(",
"$",
"gzdata",
")",
";",
"if",
"(",
"$",
"len",
"<",
"20",
")",
"{",
"return",
";",
... | Alternative gzdecode() (for PHP < 5.4.0)
source: https://github.com/Polycademy/upgradephp/blob/master/upgrade.php | [
"Alternative",
"gzdecode",
"()",
"(",
"for",
"PHP",
"<",
"5",
".",
"4",
".",
"0",
")",
"source",
":",
"https",
":",
"//",
"github",
".",
"com",
"/",
"Polycademy",
"/",
"upgradephp",
"/",
"blob",
"/",
"master",
"/",
"upgrade",
".",
"php"
] | train | https://github.com/duzun/hQuery.php/blob/3489e999f36879f69ef5e526b759b21ac5b65e44/src/hQuery.php#L628-L689 |
duzun/hQuery.php | src/hQuery.php | hQuery.get_cache | protected static function get_cache($fn, $expire = false, $meta_only = false)
{
$meta = $cnt = null;
if (file_exists($fn) and $fm = filemtime($fn) and (!$expire || $fm + $expire > time())) {
$cnt = self::flock_get_contents($fn);
}
$t = strlen($cnt);
if (!empty($cn... | php | protected static function get_cache($fn, $expire = false, $meta_only = false)
{
$meta = $cnt = null;
if (file_exists($fn) and $fm = filemtime($fn) and (!$expire || $fm + $expire > time())) {
$cnt = self::flock_get_contents($fn);
}
$t = strlen($cnt);
if (!empty($cn... | [
"protected",
"static",
"function",
"get_cache",
"(",
"$",
"fn",
",",
"$",
"expire",
"=",
"false",
",",
"$",
"meta_only",
"=",
"false",
")",
"{",
"$",
"meta",
"=",
"$",
"cnt",
"=",
"null",
";",
"if",
"(",
"file_exists",
"(",
"$",
"fn",
")",
"and",
... | Read data from a cache file.
@param string $fn - cache filename
@param int $expire - OPTIONAL contents returned only if it is newer then $expire seconds
@param bool $meta_only - OPTIONAL if TRUE, read only meta-info (faster)
@return array [mixed <contents>, array <meta_info>] | [
"Read",
"data",
"from",
"a",
"cache",
"file",
"."
] | train | https://github.com/duzun/hQuery.php/blob/3489e999f36879f69ef5e526b759b21ac5b65e44/src/hQuery.php#L699-L742 |
duzun/hQuery.php | src/hQuery.php | hQuery.set_cache | protected static function set_cache($fn, $cnt, $meta = null, $gzip = true)
{
if (false === $cnt) {
return !file_exists($fn) || unlink($fn);
}
$n = 0;
if (isset($meta)) {
$meta = self::jsonize($meta);
$n += strlen($meta);
}
$meta = ... | php | protected static function set_cache($fn, $cnt, $meta = null, $gzip = true)
{
if (false === $cnt) {
return !file_exists($fn) || unlink($fn);
}
$n = 0;
if (isset($meta)) {
$meta = self::jsonize($meta);
$n += strlen($meta);
}
$meta = ... | [
"protected",
"static",
"function",
"set_cache",
"(",
"$",
"fn",
",",
"$",
"cnt",
",",
"$",
"meta",
"=",
"null",
",",
"$",
"gzip",
"=",
"true",
")",
"{",
"if",
"(",
"false",
"===",
"$",
"cnt",
")",
"{",
"return",
"!",
"file_exists",
"(",
"$",
"fn"... | Save data to a cache file.
@param string $fn - cache filename
@param mixed $cnt - contents to be cached
@param array $meta - OPTIONAL meta information related to contents.
@param bool $gzip - OPTIONAL if TRUE and gzip supported, store contents gzipped
@return int|bool On success, number of written b... | [
"Save",
"data",
"to",
"a",
"cache",
"file",
"."
] | train | https://github.com/duzun/hQuery.php/blob/3489e999f36879f69ef5e526b759b21ac5b65e44/src/hQuery.php#L753-L779 |
duzun/hQuery.php | src/hQuery.php | hQuery.do_flock | public static function do_flock($fp, $lock, $timeout_ms = 384)
{
$l = flock($fp, $lock);
if (!$l && ($lock & LOCK_UN) != LOCK_UN) {
$st = microtime(true);
$m = min(1e3, $timeout_ms * 1e3);
$n = min(64e3, $timeout_ms * 1e3);
if ($m == $n) {
... | php | public static function do_flock($fp, $lock, $timeout_ms = 384)
{
$l = flock($fp, $lock);
if (!$l && ($lock & LOCK_UN) != LOCK_UN) {
$st = microtime(true);
$m = min(1e3, $timeout_ms * 1e3);
$n = min(64e3, $timeout_ms * 1e3);
if ($m == $n) {
... | [
"public",
"static",
"function",
"do_flock",
"(",
"$",
"fp",
",",
"$",
"lock",
",",
"$",
"timeout_ms",
"=",
"384",
")",
"{",
"$",
"l",
"=",
"flock",
"(",
"$",
"fp",
",",
"$",
"lock",
")",
";",
"if",
"(",
"!",
"$",
"l",
"&&",
"(",
"$",
"lock",
... | Lock with retries
@author Dumitru Uzun
@param resource $fp - Open file pointer
@param int $lock - Lock type
@param int $timeout_ms - OPTIONAL Timeout to wait for unlock in miliseconds
@return true on success, false on fail | [
"Lock",
"with",
"retries"
] | train | https://github.com/duzun/hQuery.php/blob/3489e999f36879f69ef5e526b759b21ac5b65e44/src/hQuery.php#L791-L810 |
duzun/hQuery.php | src/hQuery.php | hQuery.http_wr | public static function http_wr($host, $head = null, $body = null, $options = null)
{
self::$last_http_result =
$ret = new \stdClass();
empty($options) and $options = array();
// If $host is a URL
if ($p = strpos($host, '://') and $p < 7) {
... | php | public static function http_wr($host, $head = null, $body = null, $options = null)
{
self::$last_http_result =
$ret = new \stdClass();
empty($options) and $options = array();
// If $host is a URL
if ($p = strpos($host, '://') and $p < 7) {
... | [
"public",
"static",
"function",
"http_wr",
"(",
"$",
"host",
",",
"$",
"head",
"=",
"null",
",",
"$",
"body",
"=",
"null",
",",
"$",
"options",
"=",
"null",
")",
"{",
"self",
"::",
"$",
"last_http_result",
"=",
"$",
"ret",
"=",
"new",
"\\",
"stdCla... | Executes a HTTP write-read session.
timeout - connection timeout in seconds
host - goes to headers, overrides $host (ex. $host == '127.0.0.1', $options['host'] == 'www.example.com')
port - usefull when $host is not a full URL
scheme - http, ssl, tls, udp, ...
close - whether to close connection o not
redirect... | [
"Executes",
"a",
"HTTP",
"write",
"-",
"read",
"session",
"."
] | train | https://github.com/duzun/hQuery.php/blob/3489e999f36879f69ef5e526b759b21ac5b65e44/src/hQuery.php#L928-L1271 |
sleimanx2/plastic | src/Console/Mapping/Make.php | Make.handle | public function handle()
{
$model = trim($this->argument('model'));
$this->writeMapping($model);
$this->composer->dumpAutoloads();
} | php | public function handle()
{
$model = trim($this->argument('model'));
$this->writeMapping($model);
$this->composer->dumpAutoloads();
} | [
"public",
"function",
"handle",
"(",
")",
"{",
"$",
"model",
"=",
"trim",
"(",
"$",
"this",
"->",
"argument",
"(",
"'model'",
")",
")",
";",
"$",
"this",
"->",
"writeMapping",
"(",
"$",
"model",
")",
";",
"$",
"this",
"->",
"composer",
"->",
"dumpA... | Execute the console command. | [
"Execute",
"the",
"console",
"command",
"."
] | train | https://github.com/sleimanx2/plastic/blob/3d855a1384b247a1e17986dcf90e78ec454d5798/src/Console/Mapping/Make.php#L51-L58 |
sleimanx2/plastic | src/Console/Mapping/Make.php | Make.writeMapping | private function writeMapping($model)
{
$path = $this->getMappingPath();
$file = pathinfo($this->creator->create($model, $path), PATHINFO_FILENAME);
$this->comment($file.' was created successfully');
} | php | private function writeMapping($model)
{
$path = $this->getMappingPath();
$file = pathinfo($this->creator->create($model, $path), PATHINFO_FILENAME);
$this->comment($file.' was created successfully');
} | [
"private",
"function",
"writeMapping",
"(",
"$",
"model",
")",
"{",
"$",
"path",
"=",
"$",
"this",
"->",
"getMappingPath",
"(",
")",
";",
"$",
"file",
"=",
"pathinfo",
"(",
"$",
"this",
"->",
"creator",
"->",
"create",
"(",
"$",
"model",
",",
"$",
... | Create the mapping file.
@param $model | [
"Create",
"the",
"mapping",
"file",
"."
] | train | https://github.com/sleimanx2/plastic/blob/3d855a1384b247a1e17986dcf90e78ec454d5798/src/Console/Mapping/Make.php#L65-L72 |
sleimanx2/plastic | src/Map/Grammar.php | Grammar.compileCreate | public function compileCreate(Blueprint $blueprint, Fluent $command)
{
$fields = $blueprint->getFields();
$statement = $this->compileFields($fields);
return $statement;
} | php | public function compileCreate(Blueprint $blueprint, Fluent $command)
{
$fields = $blueprint->getFields();
$statement = $this->compileFields($fields);
return $statement;
} | [
"public",
"function",
"compileCreate",
"(",
"Blueprint",
"$",
"blueprint",
",",
"Fluent",
"$",
"command",
")",
"{",
"$",
"fields",
"=",
"$",
"blueprint",
"->",
"getFields",
"(",
")",
";",
"$",
"statement",
"=",
"$",
"this",
"->",
"compileFields",
"(",
"$... | Create a map body.
@param Blueprint $blueprint
@param Fluent $command
@return array | [
"Create",
"a",
"map",
"body",
"."
] | train | https://github.com/sleimanx2/plastic/blob/3d855a1384b247a1e17986dcf90e78ec454d5798/src/Map/Grammar.php#L17-L24 |
sleimanx2/plastic | src/Map/Grammar.php | Grammar.compileBinary | public function compileBinary(Fluent $fluent)
{
$map = [
'type' => 'binary',
'doc_values' => $fluent->doc_values,
'store' => $fluent->store,
];
return $this->formatMap($map);
} | php | public function compileBinary(Fluent $fluent)
{
$map = [
'type' => 'binary',
'doc_values' => $fluent->doc_values,
'store' => $fluent->store,
];
return $this->formatMap($map);
} | [
"public",
"function",
"compileBinary",
"(",
"Fluent",
"$",
"fluent",
")",
"{",
"$",
"map",
"=",
"[",
"'type'",
"=>",
"'binary'",
",",
"'doc_values'",
"=>",
"$",
"fluent",
"->",
"doc_values",
",",
"'store'",
"=>",
"$",
"fluent",
"->",
"store",
",",
"]",
... | Compile a binary map.
@param Fluent $fluent
@return array | [
"Compile",
"a",
"binary",
"map",
"."
] | train | https://github.com/sleimanx2/plastic/blob/3d855a1384b247a1e17986dcf90e78ec454d5798/src/Map/Grammar.php#L93-L102 |
sleimanx2/plastic | src/Map/Grammar.php | Grammar.compileDate | public function compileDate(Fluent $fluent)
{
$map = [
'type' => 'date',
'boost' => $fluent->boost,
'doc_values' => $fluent->doc_values,
'format' => $fluent->format,
'ignore_malformed' => $fluent->ignore_malfo... | php | public function compileDate(Fluent $fluent)
{
$map = [
'type' => 'date',
'boost' => $fluent->boost,
'doc_values' => $fluent->doc_values,
'format' => $fluent->format,
'ignore_malformed' => $fluent->ignore_malfo... | [
"public",
"function",
"compileDate",
"(",
"Fluent",
"$",
"fluent",
")",
"{",
"$",
"map",
"=",
"[",
"'type'",
"=>",
"'date'",
",",
"'boost'",
"=>",
"$",
"fluent",
"->",
"boost",
",",
"'doc_values'",
"=>",
"$",
"fluent",
"->",
"doc_values",
",",
"'format'"... | Compile a date map.
@param Fluent $fluent
@return array | [
"Compile",
"a",
"date",
"map",
"."
] | train | https://github.com/sleimanx2/plastic/blob/3d855a1384b247a1e17986dcf90e78ec454d5798/src/Map/Grammar.php#L123-L139 |
sleimanx2/plastic | src/Map/Grammar.php | Grammar.compileBoolean | public function compileBoolean(Fluent $fluent)
{
$map = [
'type' => 'boolean',
'boost' => $fluent->boost,
'doc_values' => $fluent->doc_values,
'index' => $fluent->index,
'null_value' => $fluent->null_value,
'store' ... | php | public function compileBoolean(Fluent $fluent)
{
$map = [
'type' => 'boolean',
'boost' => $fluent->boost,
'doc_values' => $fluent->doc_values,
'index' => $fluent->index,
'null_value' => $fluent->null_value,
'store' ... | [
"public",
"function",
"compileBoolean",
"(",
"Fluent",
"$",
"fluent",
")",
"{",
"$",
"map",
"=",
"[",
"'type'",
"=>",
"'boolean'",
",",
"'boost'",
"=>",
"$",
"fluent",
"->",
"boost",
",",
"'doc_values'",
"=>",
"$",
"fluent",
"->",
"doc_values",
",",
"'in... | Compile a boolean map.
@param Fluent $fluent
@return array | [
"Compile",
"a",
"boolean",
"map",
"."
] | train | https://github.com/sleimanx2/plastic/blob/3d855a1384b247a1e17986dcf90e78ec454d5798/src/Map/Grammar.php#L148-L160 |
sleimanx2/plastic | src/Map/Grammar.php | Grammar.compilePoint | public function compilePoint(Fluent $fluent)
{
$map = [
'type' => 'geo_point',
'geohash' => $fluent->geohash,
'geohash_precision' => $fluent->geohash_precision,
'geohash_prefix' => $fluent->geohash_prefix,
'ignore_malforme... | php | public function compilePoint(Fluent $fluent)
{
$map = [
'type' => 'geo_point',
'geohash' => $fluent->geohash,
'geohash_precision' => $fluent->geohash_precision,
'geohash_prefix' => $fluent->geohash_prefix,
'ignore_malforme... | [
"public",
"function",
"compilePoint",
"(",
"Fluent",
"$",
"fluent",
")",
"{",
"$",
"map",
"=",
"[",
"'type'",
"=>",
"'geo_point'",
",",
"'geohash'",
"=>",
"$",
"fluent",
"->",
"geohash",
",",
"'geohash_precision'",
"=>",
"$",
"fluent",
"->",
"geohash_precisi... | Compile a geo point map.
@param Fluent $fluent
@return array | [
"Compile",
"a",
"geo",
"point",
"map",
"."
] | train | https://github.com/sleimanx2/plastic/blob/3d855a1384b247a1e17986dcf90e78ec454d5798/src/Map/Grammar.php#L169-L182 |
sleimanx2/plastic | src/Map/Grammar.php | Grammar.compileShape | public function compileShape(Fluent $fluent)
{
$map = [
'type' => 'geo_shape',
'tree' => $fluent->tree,
'precision' => $fluent->precision,
'tree_levels' => $fluent->tree_levels,
'strategy' => $f... | php | public function compileShape(Fluent $fluent)
{
$map = [
'type' => 'geo_shape',
'tree' => $fluent->tree,
'precision' => $fluent->precision,
'tree_levels' => $fluent->tree_levels,
'strategy' => $f... | [
"public",
"function",
"compileShape",
"(",
"Fluent",
"$",
"fluent",
")",
"{",
"$",
"map",
"=",
"[",
"'type'",
"=>",
"'geo_shape'",
",",
"'tree'",
"=>",
"$",
"fluent",
"->",
"tree",
",",
"'precision'",
"=>",
"$",
"fluent",
"->",
"precision",
",",
"'tree_l... | Compile a geo shape map.
@param Fluent $fluent
@return array | [
"Compile",
"a",
"geo",
"shape",
"map",
"."
] | train | https://github.com/sleimanx2/plastic/blob/3d855a1384b247a1e17986dcf90e78ec454d5798/src/Map/Grammar.php#L191-L205 |
sleimanx2/plastic | src/Map/Grammar.php | Grammar.compileIp | public function compileIp(Fluent $fluent)
{
$map = [
'type' => $fluent->type,
'boost' => $fluent->boost,
'doc_values' => $fluent->doc_values,
'include_in_all' => $fluent->include_in_all,
'index' => $fluent->index,
... | php | public function compileIp(Fluent $fluent)
{
$map = [
'type' => $fluent->type,
'boost' => $fluent->boost,
'doc_values' => $fluent->doc_values,
'include_in_all' => $fluent->include_in_all,
'index' => $fluent->index,
... | [
"public",
"function",
"compileIp",
"(",
"Fluent",
"$",
"fluent",
")",
"{",
"$",
"map",
"=",
"[",
"'type'",
"=>",
"$",
"fluent",
"->",
"type",
",",
"'boost'",
"=>",
"$",
"fluent",
"->",
"boost",
",",
"'doc_values'",
"=>",
"$",
"fluent",
"->",
"doc_value... | Compile an ip map.
@param Fluent $fluent
@return array | [
"Compile",
"an",
"ip",
"map",
"."
] | train | https://github.com/sleimanx2/plastic/blob/3d855a1384b247a1e17986dcf90e78ec454d5798/src/Map/Grammar.php#L214-L228 |
sleimanx2/plastic | src/Map/Grammar.php | Grammar.compileCompletion | public function compileCompletion(Fluent $fluent)
{
$map = [
'type' => 'completion',
'analyzer' => $fluent->analyzer,
'search_analyzer' => $fluent->search_analyzer,
'payloads' => $fluent->payloads,
'preserve... | php | public function compileCompletion(Fluent $fluent)
{
$map = [
'type' => 'completion',
'analyzer' => $fluent->analyzer,
'search_analyzer' => $fluent->search_analyzer,
'payloads' => $fluent->payloads,
'preserve... | [
"public",
"function",
"compileCompletion",
"(",
"Fluent",
"$",
"fluent",
")",
"{",
"$",
"map",
"=",
"[",
"'type'",
"=>",
"'completion'",
",",
"'analyzer'",
"=>",
"$",
"fluent",
"->",
"analyzer",
",",
"'search_analyzer'",
"=>",
"$",
"fluent",
"->",
"search_an... | Compile a completion map.
@param Fluent $fluent
@return array | [
"Compile",
"a",
"completion",
"map",
"."
] | train | https://github.com/sleimanx2/plastic/blob/3d855a1384b247a1e17986dcf90e78ec454d5798/src/Map/Grammar.php#L237-L249 |
sleimanx2/plastic | src/Map/Grammar.php | Grammar.compileString | public function compileString(Fluent $fluent)
{
$map = [
'type' => 'string',
'analyzer' => $fluent->analyzer,
'boost' => $fluent->boost,
'doc_values' => $fluent->doc_values,
'fielddata' ... | php | public function compileString(Fluent $fluent)
{
$map = [
'type' => 'string',
'analyzer' => $fluent->analyzer,
'boost' => $fluent->boost,
'doc_values' => $fluent->doc_values,
'fielddata' ... | [
"public",
"function",
"compileString",
"(",
"Fluent",
"$",
"fluent",
")",
"{",
"$",
"map",
"=",
"[",
"'type'",
"=>",
"'string'",
",",
"'analyzer'",
"=>",
"$",
"fluent",
"->",
"analyzer",
",",
"'boost'",
"=>",
"$",
"fluent",
"->",
"boost",
",",
"'doc_valu... | Compile a string map.
@param Fluent $fluent
@return array | [
"Compile",
"a",
"string",
"map",
"."
] | train | https://github.com/sleimanx2/plastic/blob/3d855a1384b247a1e17986dcf90e78ec454d5798/src/Map/Grammar.php#L281-L305 |
sleimanx2/plastic | src/Map/Grammar.php | Grammar.compileNumeric | public function compileNumeric(Fluent $fluent)
{
$map = [
'type' => $fluent->type,
'coerce' => $fluent->coerce,
'boost' => $fluent->boost,
'doc_values' => $fluent->doc_values,
'ignore_malformed' => $fluent->ig... | php | public function compileNumeric(Fluent $fluent)
{
$map = [
'type' => $fluent->type,
'coerce' => $fluent->coerce,
'boost' => $fluent->boost,
'doc_values' => $fluent->doc_values,
'ignore_malformed' => $fluent->ig... | [
"public",
"function",
"compileNumeric",
"(",
"Fluent",
"$",
"fluent",
")",
"{",
"$",
"map",
"=",
"[",
"'type'",
"=>",
"$",
"fluent",
"->",
"type",
",",
"'coerce'",
"=>",
"$",
"fluent",
"->",
"coerce",
",",
"'boost'",
"=>",
"$",
"fluent",
"->",
"boost",... | Compile a numeric map.
@param Fluent $fluent
@return array | [
"Compile",
"a",
"numeric",
"map",
"."
] | train | https://github.com/sleimanx2/plastic/blob/3d855a1384b247a1e17986dcf90e78ec454d5798/src/Map/Grammar.php#L314-L329 |
sleimanx2/plastic | src/Map/Grammar.php | Grammar.compileObject | public function compileObject(Fluent $fluent)
{
$blueprint = new Blueprint($fluent->type);
/* @var \Closure $callback */
$callback = $fluent->callback;
if (is_callable($callback)) {
$callback($blueprint);
}
return [
'properties' => $this->co... | php | public function compileObject(Fluent $fluent)
{
$blueprint = new Blueprint($fluent->type);
/* @var \Closure $callback */
$callback = $fluent->callback;
if (is_callable($callback)) {
$callback($blueprint);
}
return [
'properties' => $this->co... | [
"public",
"function",
"compileObject",
"(",
"Fluent",
"$",
"fluent",
")",
"{",
"$",
"blueprint",
"=",
"new",
"Blueprint",
"(",
"$",
"fluent",
"->",
"type",
")",
";",
"/* @var \\Closure $callback */",
"$",
"callback",
"=",
"$",
"fluent",
"->",
"callback",
";"... | Compile a object map.
@param Fluent $fluent
@return array | [
"Compile",
"a",
"object",
"map",
"."
] | train | https://github.com/sleimanx2/plastic/blob/3d855a1384b247a1e17986dcf90e78ec454d5798/src/Map/Grammar.php#L362-L376 |
sleimanx2/plastic | src/Map/Grammar.php | Grammar.compileFields | public function compileFields($fields)
{
$statement = [];
foreach ($fields as $field) {
$method = 'compile'.ucfirst($field->type);
if (method_exists($this, $method)) {
if (!empty($map = $this->$method($field))) {
$statement[$field->name] ... | php | public function compileFields($fields)
{
$statement = [];
foreach ($fields as $field) {
$method = 'compile'.ucfirst($field->type);
if (method_exists($this, $method)) {
if (!empty($map = $this->$method($field))) {
$statement[$field->name] ... | [
"public",
"function",
"compileFields",
"(",
"$",
"fields",
")",
"{",
"$",
"statement",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"fields",
"as",
"$",
"field",
")",
"{",
"$",
"method",
"=",
"'compile'",
".",
"ucfirst",
"(",
"$",
"field",
"->",
"type",
... | Compile an array of fluent fields.
@param $fields
@return array | [
"Compile",
"an",
"array",
"of",
"fluent",
"fields",
"."
] | train | https://github.com/sleimanx2/plastic/blob/3d855a1384b247a1e17986dcf90e78ec454d5798/src/Map/Grammar.php#L397-L412 |
sleimanx2/plastic | src/Connection.php | Connection.buildClient | private function buildClient(array $config)
{
$client = ClientBuilder::create()
->setHosts($config['hosts']);
if (isset($config['retries'])) {
$client->setRetries($config['retries']);
}
if (isset($config['logging']) and $config['logging']['enabled'] == true)... | php | private function buildClient(array $config)
{
$client = ClientBuilder::create()
->setHosts($config['hosts']);
if (isset($config['retries'])) {
$client->setRetries($config['retries']);
}
if (isset($config['logging']) and $config['logging']['enabled'] == true)... | [
"private",
"function",
"buildClient",
"(",
"array",
"$",
"config",
")",
"{",
"$",
"client",
"=",
"ClientBuilder",
"::",
"create",
"(",
")",
"->",
"setHosts",
"(",
"$",
"config",
"[",
"'hosts'",
"]",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"config",
"... | Create an elastic search instance.
@param array $config
@return Client | [
"Create",
"an",
"elastic",
"search",
"instance",
"."
] | train | https://github.com/sleimanx2/plastic/blob/3d855a1384b247a1e17986dcf90e78ec454d5798/src/Connection.php#L247-L262 |
sleimanx2/plastic | src/Connection.php | Connection.setStatementIndex | private function setStatementIndex(array $params)
{
if (isset($params['index']) and $params['index']) {
return $params;
}
// merge the default index with the given params if the index is not set.
return array_merge($params, ['index' => $this->getDefaultIndex()]);
} | php | private function setStatementIndex(array $params)
{
if (isset($params['index']) and $params['index']) {
return $params;
}
// merge the default index with the given params if the index is not set.
return array_merge($params, ['index' => $this->getDefaultIndex()]);
} | [
"private",
"function",
"setStatementIndex",
"(",
"array",
"$",
"params",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"params",
"[",
"'index'",
"]",
")",
"and",
"$",
"params",
"[",
"'index'",
"]",
")",
"{",
"return",
"$",
"params",
";",
"}",
"// merge the d... | @param array $params
@return array | [
"@param",
"array",
"$params"
] | train | https://github.com/sleimanx2/plastic/blob/3d855a1384b247a1e17986dcf90e78ec454d5798/src/Connection.php#L269-L277 |
sleimanx2/plastic | src/Searchable.php | Searchable.bootSearchable | public static function bootSearchable()
{
static::saved(function ($model) {
if ($model->shouldSyncDocument()) {
$model->document()->save();
}
});
static::deleted(function ($model) {
if ($model->shouldSyncDocument()) {
$mode... | php | public static function bootSearchable()
{
static::saved(function ($model) {
if ($model->shouldSyncDocument()) {
$model->document()->save();
}
});
static::deleted(function ($model) {
if ($model->shouldSyncDocument()) {
$mode... | [
"public",
"static",
"function",
"bootSearchable",
"(",
")",
"{",
"static",
"::",
"saved",
"(",
"function",
"(",
"$",
"model",
")",
"{",
"if",
"(",
"$",
"model",
"->",
"shouldSyncDocument",
"(",
")",
")",
"{",
"$",
"model",
"->",
"document",
"(",
")",
... | Searchable boot model. | [
"Searchable",
"boot",
"model",
"."
] | train | https://github.com/sleimanx2/plastic/blob/3d855a1384b247a1e17986dcf90e78ec454d5798/src/Searchable.php#L47-L60 |
sleimanx2/plastic | src/Searchable.php | Searchable.getDocumentType | public function getDocumentType()
{
// if the type is defined use it else return the table name
if (isset($this->documentType) and !empty($this->documentType)) {
return $this->documentType;
}
return $this->getTable();
} | php | public function getDocumentType()
{
// if the type is defined use it else return the table name
if (isset($this->documentType) and !empty($this->documentType)) {
return $this->documentType;
}
return $this->getTable();
} | [
"public",
"function",
"getDocumentType",
"(",
")",
"{",
"// if the type is defined use it else return the table name",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"documentType",
")",
"and",
"!",
"empty",
"(",
"$",
"this",
"->",
"documentType",
")",
")",
"{",
"r... | Get the model elastic type.
@return string | [
"Get",
"the",
"model",
"elastic",
"type",
"."
] | train | https://github.com/sleimanx2/plastic/blob/3d855a1384b247a1e17986dcf90e78ec454d5798/src/Searchable.php#L77-L85 |
sleimanx2/plastic | src/Searchable.php | Searchable.getDocumentData | public function getDocumentData()
{
// If the model contain a buildDocument function
// use it to build the document
if (method_exists($this, 'buildDocument')) {
$document = $this->buildDocument();
return $document;
}
// If a searchable array is provi... | php | public function getDocumentData()
{
// If the model contain a buildDocument function
// use it to build the document
if (method_exists($this, 'buildDocument')) {
$document = $this->buildDocument();
return $document;
}
// If a searchable array is provi... | [
"public",
"function",
"getDocumentData",
"(",
")",
"{",
"// If the model contain a buildDocument function",
"// use it to build the document",
"if",
"(",
"method_exists",
"(",
"$",
"this",
",",
"'buildDocument'",
")",
")",
"{",
"$",
"document",
"=",
"$",
"this",
"->",... | Build the document data with the appropriate method.
@return array | [
"Build",
"the",
"document",
"data",
"with",
"the",
"appropriate",
"method",
"."
] | train | https://github.com/sleimanx2/plastic/blob/3d855a1384b247a1e17986dcf90e78ec454d5798/src/Searchable.php#L105-L125 |
sleimanx2/plastic | src/Searchable.php | Searchable.buildDocumentFromArray | protected function buildDocumentFromArray(array $searchable)
{
$document = [];
foreach ($searchable as $value) {
$result = $this->$value;
if ($result instanceof Collection) {
$result = $result->toArray();
} elseif ($result instanceof Carbon) {
... | php | protected function buildDocumentFromArray(array $searchable)
{
$document = [];
foreach ($searchable as $value) {
$result = $this->$value;
if ($result instanceof Collection) {
$result = $result->toArray();
} elseif ($result instanceof Carbon) {
... | [
"protected",
"function",
"buildDocumentFromArray",
"(",
"array",
"$",
"searchable",
")",
"{",
"$",
"document",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"searchable",
"as",
"$",
"value",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"$",
"value",
";"... | Build the document from a searchable array.
@param array $searchable
@return array | [
"Build",
"the",
"document",
"from",
"a",
"searchable",
"array",
"."
] | train | https://github.com/sleimanx2/plastic/blob/3d855a1384b247a1e17986dcf90e78ec454d5798/src/Searchable.php#L134-L153 |
sleimanx2/plastic | src/Map/Builder.php | Builder.create | public function create($type, Closure $callback, $index = null)
{
if (!is_string($type)) {
throw new InvalidArgumentException('type should be a string');
}
if ($index and !is_string($index)) {
throw new InvalidArgumentException('index should be a string');
}
... | php | public function create($type, Closure $callback, $index = null)
{
if (!is_string($type)) {
throw new InvalidArgumentException('type should be a string');
}
if ($index and !is_string($index)) {
throw new InvalidArgumentException('index should be a string');
}
... | [
"public",
"function",
"create",
"(",
"$",
"type",
",",
"Closure",
"$",
"callback",
",",
"$",
"index",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"type",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"'type should be a... | Create a map on your elasticsearch index.
@param string $type
@param string $index
@param Closure $callback | [
"Create",
"a",
"map",
"on",
"your",
"elasticsearch",
"index",
"."
] | train | https://github.com/sleimanx2/plastic/blob/3d855a1384b247a1e17986dcf90e78ec454d5798/src/Map/Builder.php#L50-L67 |
sleimanx2/plastic | src/Map/Builder.php | Builder.createBlueprint | protected function createBlueprint($type, Closure $callback = null, $index = null)
{
if (isset($this->resolver)) {
return call_user_func($this->resolver, $type, $callback, $index);
}
return new Blueprint($type, $callback, $index);
} | php | protected function createBlueprint($type, Closure $callback = null, $index = null)
{
if (isset($this->resolver)) {
return call_user_func($this->resolver, $type, $callback, $index);
}
return new Blueprint($type, $callback, $index);
} | [
"protected",
"function",
"createBlueprint",
"(",
"$",
"type",
",",
"Closure",
"$",
"callback",
"=",
"null",
",",
"$",
"index",
"=",
"null",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"resolver",
")",
")",
"{",
"return",
"call_user_func",
"("... | Create a new command set with a Closure.
@param string $type
@param Closure|null $callback
@param null $index
@return mixed|Blueprint | [
"Create",
"a",
"new",
"command",
"set",
"with",
"a",
"Closure",
"."
] | train | https://github.com/sleimanx2/plastic/blob/3d855a1384b247a1e17986dcf90e78ec454d5798/src/Map/Builder.php#L88-L95 |
sleimanx2/plastic | src/Console/Mapping/Run.php | Run.handle | public function handle()
{
if (!$this->confirmToProceed()) {
return;
}
$this->prepareDatabase();
$path = $this->getMappingPath();
$this->mapper->run($path, [
'step' => $this->option('step'),
'index' => $this->option('index'),
])... | php | public function handle()
{
if (!$this->confirmToProceed()) {
return;
}
$this->prepareDatabase();
$path = $this->getMappingPath();
$this->mapper->run($path, [
'step' => $this->option('step'),
'index' => $this->option('index'),
])... | [
"public",
"function",
"handle",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"confirmToProceed",
"(",
")",
")",
"{",
"return",
";",
"}",
"$",
"this",
"->",
"prepareDatabase",
"(",
")",
";",
"$",
"path",
"=",
"$",
"this",
"->",
"getMappingPath",
... | Execute the console command. | [
"Execute",
"the",
"console",
"command",
"."
] | train | https://github.com/sleimanx2/plastic/blob/3d855a1384b247a1e17986dcf90e78ec454d5798/src/Console/Mapping/Run.php#L46-L67 |
sleimanx2/plastic | src/DSL/SearchBuilder.php | SearchBuilder.model | public function model(Model $model)
{
// Check if the model is searchable before setting the query builder model
$traits = class_uses_recursive(get_class($model));
if (!isset($traits[Searchable::class])) {
throw new InvalidArgumentException(get_class($model).' does not use the s... | php | public function model(Model $model)
{
// Check if the model is searchable before setting the query builder model
$traits = class_uses_recursive(get_class($model));
if (!isset($traits[Searchable::class])) {
throw new InvalidArgumentException(get_class($model).' does not use the s... | [
"public",
"function",
"model",
"(",
"Model",
"$",
"model",
")",
"{",
"// Check if the model is searchable before setting the query builder model",
"$",
"traits",
"=",
"class_uses_recursive",
"(",
"get_class",
"(",
"$",
"model",
")",
")",
";",
"if",
"(",
"!",
"isset"... | Set the eloquent model to use when querying elastic search.
@param Model|Searchable $model
@throws InvalidArgumentException
@return $this | [
"Set",
"the",
"eloquent",
"model",
"to",
"use",
"when",
"querying",
"elastic",
"search",
"."
] | train | https://github.com/sleimanx2/plastic/blob/3d855a1384b247a1e17986dcf90e78ec454d5798/src/DSL/SearchBuilder.php#L142-L160 |
sleimanx2/plastic | src/DSL/SearchBuilder.php | SearchBuilder.sortBy | public function sortBy($fields, $order = null, array $parameters = [])
{
$fields = is_array($fields) ? $fields : [$fields];
foreach ($fields as $field) {
$sort = new FieldSort($field, $order, $parameters);
$this->query->addSort($sort);
}
return $this;
} | php | public function sortBy($fields, $order = null, array $parameters = [])
{
$fields = is_array($fields) ? $fields : [$fields];
foreach ($fields as $field) {
$sort = new FieldSort($field, $order, $parameters);
$this->query->addSort($sort);
}
return $this;
} | [
"public",
"function",
"sortBy",
"(",
"$",
"fields",
",",
"$",
"order",
"=",
"null",
",",
"array",
"$",
"parameters",
"=",
"[",
"]",
")",
"{",
"$",
"fields",
"=",
"is_array",
"(",
"$",
"fields",
")",
"?",
"$",
"fields",
":",
"[",
"$",
"fields",
"]... | Set the query sort values values.
@param string|array $fields
@param null $order
@param array $parameters
@return $this | [
"Set",
"the",
"query",
"sort",
"values",
"values",
"."
] | train | https://github.com/sleimanx2/plastic/blob/3d855a1384b247a1e17986dcf90e78ec454d5798/src/DSL/SearchBuilder.php#L199-L210 |
sleimanx2/plastic | src/DSL/SearchBuilder.php | SearchBuilder.ids | public function ids($ids)
{
$ids = is_array($ids) ? $ids : [$ids];
$query = new IdsQuery($ids);
$this->append($query);
return $this;
} | php | public function ids($ids)
{
$ids = is_array($ids) ? $ids : [$ids];
$query = new IdsQuery($ids);
$this->append($query);
return $this;
} | [
"public",
"function",
"ids",
"(",
"$",
"ids",
")",
"{",
"$",
"ids",
"=",
"is_array",
"(",
"$",
"ids",
")",
"?",
"$",
"ids",
":",
"[",
"$",
"ids",
"]",
";",
"$",
"query",
"=",
"new",
"IdsQuery",
"(",
"$",
"ids",
")",
";",
"$",
"this",
"->",
... | Add an ids query.
@param array | string $ids
@return $this | [
"Add",
"an",
"ids",
"query",
"."
] | train | https://github.com/sleimanx2/plastic/blob/3d855a1384b247a1e17986dcf90e78ec454d5798/src/DSL/SearchBuilder.php#L273-L282 |
sleimanx2/plastic | src/DSL/SearchBuilder.php | SearchBuilder.term | public function term($field, $term, array $attributes = [])
{
$query = new TermQuery($field, $term, $attributes);
$this->append($query);
return $this;
} | php | public function term($field, $term, array $attributes = [])
{
$query = new TermQuery($field, $term, $attributes);
$this->append($query);
return $this;
} | [
"public",
"function",
"term",
"(",
"$",
"field",
",",
"$",
"term",
",",
"array",
"$",
"attributes",
"=",
"[",
"]",
")",
"{",
"$",
"query",
"=",
"new",
"TermQuery",
"(",
"$",
"field",
",",
"$",
"term",
",",
"$",
"attributes",
")",
";",
"$",
"this"... | Add an term query.
@param string $field
@param string $term
@param array $attributes
@return $this | [
"Add",
"an",
"term",
"query",
"."
] | train | https://github.com/sleimanx2/plastic/blob/3d855a1384b247a1e17986dcf90e78ec454d5798/src/DSL/SearchBuilder.php#L293-L300 |
sleimanx2/plastic | src/DSL/SearchBuilder.php | SearchBuilder.terms | public function terms($field, array $terms, array $attributes = [])
{
$query = new TermsQuery($field, $terms, $attributes);
$this->append($query);
return $this;
} | php | public function terms($field, array $terms, array $attributes = [])
{
$query = new TermsQuery($field, $terms, $attributes);
$this->append($query);
return $this;
} | [
"public",
"function",
"terms",
"(",
"$",
"field",
",",
"array",
"$",
"terms",
",",
"array",
"$",
"attributes",
"=",
"[",
"]",
")",
"{",
"$",
"query",
"=",
"new",
"TermsQuery",
"(",
"$",
"field",
",",
"$",
"terms",
",",
"$",
"attributes",
")",
";",
... | Add an terms query.
@param string $field
@param array $terms
@param array $attributes
@return $this | [
"Add",
"an",
"terms",
"query",
"."
] | train | https://github.com/sleimanx2/plastic/blob/3d855a1384b247a1e17986dcf90e78ec454d5798/src/DSL/SearchBuilder.php#L311-L318 |
sleimanx2/plastic | src/DSL/SearchBuilder.php | SearchBuilder.exists | public function exists($fields)
{
$fields = is_array($fields) ? $fields : [$fields];
foreach ($fields as $field) {
$query = new ExistsQuery($field);
$this->append($query);
}
return $this;
} | php | public function exists($fields)
{
$fields = is_array($fields) ? $fields : [$fields];
foreach ($fields as $field) {
$query = new ExistsQuery($field);
$this->append($query);
}
return $this;
} | [
"public",
"function",
"exists",
"(",
"$",
"fields",
")",
"{",
"$",
"fields",
"=",
"is_array",
"(",
"$",
"fields",
")",
"?",
"$",
"fields",
":",
"[",
"$",
"fields",
"]",
";",
"foreach",
"(",
"$",
"fields",
"as",
"$",
"field",
")",
"{",
"$",
"query... | Add an exists query.
@param string|array $fields
@return $this | [
"Add",
"an",
"exists",
"query",
"."
] | train | https://github.com/sleimanx2/plastic/blob/3d855a1384b247a1e17986dcf90e78ec454d5798/src/DSL/SearchBuilder.php#L327-L338 |
sleimanx2/plastic | src/DSL/SearchBuilder.php | SearchBuilder.wildcard | public function wildcard($field, $value, $boost = 1.0)
{
$query = new WildcardQuery($field, $value, ['boost' => $boost]);
$this->append($query);
return $this;
} | php | public function wildcard($field, $value, $boost = 1.0)
{
$query = new WildcardQuery($field, $value, ['boost' => $boost]);
$this->append($query);
return $this;
} | [
"public",
"function",
"wildcard",
"(",
"$",
"field",
",",
"$",
"value",
",",
"$",
"boost",
"=",
"1.0",
")",
"{",
"$",
"query",
"=",
"new",
"WildcardQuery",
"(",
"$",
"field",
",",
"$",
"value",
",",
"[",
"'boost'",
"=>",
"$",
"boost",
"]",
")",
"... | Add a wildcard query.
@param string $field
@param string $value
@param float $boost
@return $this | [
"Add",
"a",
"wildcard",
"query",
"."
] | train | https://github.com/sleimanx2/plastic/blob/3d855a1384b247a1e17986dcf90e78ec454d5798/src/DSL/SearchBuilder.php#L349-L356 |
sleimanx2/plastic | src/DSL/SearchBuilder.php | SearchBuilder.match | public function match($field, $term, array $attributes = [])
{
$query = new MatchQuery($field, $term, $attributes);
$this->append($query);
return $this;
} | php | public function match($field, $term, array $attributes = [])
{
$query = new MatchQuery($field, $term, $attributes);
$this->append($query);
return $this;
} | [
"public",
"function",
"match",
"(",
"$",
"field",
",",
"$",
"term",
",",
"array",
"$",
"attributes",
"=",
"[",
"]",
")",
"{",
"$",
"query",
"=",
"new",
"MatchQuery",
"(",
"$",
"field",
",",
"$",
"term",
",",
"$",
"attributes",
")",
";",
"$",
"thi... | Add a match query.
@param string $field
@param string $term
@param array $attributes
@return $this | [
"Add",
"a",
"match",
"query",
"."
] | train | https://github.com/sleimanx2/plastic/blob/3d855a1384b247a1e17986dcf90e78ec454d5798/src/DSL/SearchBuilder.php#L385-L392 |
sleimanx2/plastic | src/DSL/SearchBuilder.php | SearchBuilder.multiMatch | public function multiMatch(array $fields, $term, array $attributes = [])
{
$query = new MultiMatchQuery($fields, $term, $attributes);
$this->append($query);
return $this;
} | php | public function multiMatch(array $fields, $term, array $attributes = [])
{
$query = new MultiMatchQuery($fields, $term, $attributes);
$this->append($query);
return $this;
} | [
"public",
"function",
"multiMatch",
"(",
"array",
"$",
"fields",
",",
"$",
"term",
",",
"array",
"$",
"attributes",
"=",
"[",
"]",
")",
"{",
"$",
"query",
"=",
"new",
"MultiMatchQuery",
"(",
"$",
"fields",
",",
"$",
"term",
",",
"$",
"attributes",
")... | Add a multi match query.
@param array $fields
@param string $term
@param array $attributes
@return $this | [
"Add",
"a",
"multi",
"match",
"query",
"."
] | train | https://github.com/sleimanx2/plastic/blob/3d855a1384b247a1e17986dcf90e78ec454d5798/src/DSL/SearchBuilder.php#L403-L410 |
sleimanx2/plastic | src/DSL/SearchBuilder.php | SearchBuilder.geoBoundingBox | public function geoBoundingBox($field, $values, array $parameters = [])
{
$query = new GeoBoundingBoxQuery($field, $values, $parameters);
$this->append($query);
return $this;
} | php | public function geoBoundingBox($field, $values, array $parameters = [])
{
$query = new GeoBoundingBoxQuery($field, $values, $parameters);
$this->append($query);
return $this;
} | [
"public",
"function",
"geoBoundingBox",
"(",
"$",
"field",
",",
"$",
"values",
",",
"array",
"$",
"parameters",
"=",
"[",
"]",
")",
"{",
"$",
"query",
"=",
"new",
"GeoBoundingBoxQuery",
"(",
"$",
"field",
",",
"$",
"values",
",",
"$",
"parameters",
")"... | Add a geo bounding box query.
@param string $field
@param array $values
@param array $parameters
@return $this | [
"Add",
"a",
"geo",
"bounding",
"box",
"query",
"."
] | train | https://github.com/sleimanx2/plastic/blob/3d855a1384b247a1e17986dcf90e78ec454d5798/src/DSL/SearchBuilder.php#L421-L428 |
sleimanx2/plastic | src/DSL/SearchBuilder.php | SearchBuilder.geoDistance | public function geoDistance($field, $distance, $location, array $attributes = [])
{
$query = new GeoDistanceQuery($field, $distance, $location, $attributes);
$this->append($query);
return $this;
} | php | public function geoDistance($field, $distance, $location, array $attributes = [])
{
$query = new GeoDistanceQuery($field, $distance, $location, $attributes);
$this->append($query);
return $this;
} | [
"public",
"function",
"geoDistance",
"(",
"$",
"field",
",",
"$",
"distance",
",",
"$",
"location",
",",
"array",
"$",
"attributes",
"=",
"[",
"]",
")",
"{",
"$",
"query",
"=",
"new",
"GeoDistanceQuery",
"(",
"$",
"field",
",",
"$",
"distance",
",",
... | Add a geo distance query.
@param string $field
@param string $distance
@param mixed $location
@param array $attributes
@return $this | [
"Add",
"a",
"geo",
"distance",
"query",
"."
] | train | https://github.com/sleimanx2/plastic/blob/3d855a1384b247a1e17986dcf90e78ec454d5798/src/DSL/SearchBuilder.php#L440-L447 |
sleimanx2/plastic | src/DSL/SearchBuilder.php | SearchBuilder.geoDistanceRange | public function geoDistanceRange($field, $from, $to, array $location, array $attributes = [])
{
$range = compact('from', 'to');
$query = new GeoDistanceRangeQuery($field, $range, $location, $attributes);
$this->append($query);
return $this;
} | php | public function geoDistanceRange($field, $from, $to, array $location, array $attributes = [])
{
$range = compact('from', 'to');
$query = new GeoDistanceRangeQuery($field, $range, $location, $attributes);
$this->append($query);
return $this;
} | [
"public",
"function",
"geoDistanceRange",
"(",
"$",
"field",
",",
"$",
"from",
",",
"$",
"to",
",",
"array",
"$",
"location",
",",
"array",
"$",
"attributes",
"=",
"[",
"]",
")",
"{",
"$",
"range",
"=",
"compact",
"(",
"'from'",
",",
"'to'",
")",
"... | Add a geo distance range query.
@param string $field
@param $from
@param $to
@param mixed $location
@param array $attributes
@return $this | [
"Add",
"a",
"geo",
"distance",
"range",
"query",
"."
] | train | https://github.com/sleimanx2/plastic/blob/3d855a1384b247a1e17986dcf90e78ec454d5798/src/DSL/SearchBuilder.php#L460-L469 |
sleimanx2/plastic | src/DSL/SearchBuilder.php | SearchBuilder.geoPolygon | public function geoPolygon($field, array $points = [], array $attributes = [])
{
$query = new GeoPolygonQuery($field, $points, $attributes);
$this->append($query);
return $this;
} | php | public function geoPolygon($field, array $points = [], array $attributes = [])
{
$query = new GeoPolygonQuery($field, $points, $attributes);
$this->append($query);
return $this;
} | [
"public",
"function",
"geoPolygon",
"(",
"$",
"field",
",",
"array",
"$",
"points",
"=",
"[",
"]",
",",
"array",
"$",
"attributes",
"=",
"[",
"]",
")",
"{",
"$",
"query",
"=",
"new",
"GeoPolygonQuery",
"(",
"$",
"field",
",",
"$",
"points",
",",
"$... | Add a geo polygon query.
@param string $field
@param array $points
@param array $attributes
@return $this | [
"Add",
"a",
"geo",
"polygon",
"query",
"."
] | train | https://github.com/sleimanx2/plastic/blob/3d855a1384b247a1e17986dcf90e78ec454d5798/src/DSL/SearchBuilder.php#L480-L487 |
sleimanx2/plastic | src/DSL/SearchBuilder.php | SearchBuilder.geoShape | public function geoShape($field, $type, array $coordinates = [], array $attributes = [])
{
$query = new GeoShapeQuery();
$query->addShape($field, $type, $coordinates, $attributes);
$this->append($query);
return $this;
} | php | public function geoShape($field, $type, array $coordinates = [], array $attributes = [])
{
$query = new GeoShapeQuery();
$query->addShape($field, $type, $coordinates, $attributes);
$this->append($query);
return $this;
} | [
"public",
"function",
"geoShape",
"(",
"$",
"field",
",",
"$",
"type",
",",
"array",
"$",
"coordinates",
"=",
"[",
"]",
",",
"array",
"$",
"attributes",
"=",
"[",
"]",
")",
"{",
"$",
"query",
"=",
"new",
"GeoShapeQuery",
"(",
")",
";",
"$",
"query"... | Add a geo shape query.
@param string $field
@param $type
@param array $coordinates
@param array $attributes
@return $this | [
"Add",
"a",
"geo",
"shape",
"query",
"."
] | train | https://github.com/sleimanx2/plastic/blob/3d855a1384b247a1e17986dcf90e78ec454d5798/src/DSL/SearchBuilder.php#L499-L508 |
sleimanx2/plastic | src/DSL/SearchBuilder.php | SearchBuilder.prefix | public function prefix($field, $term, array $attributes = [])
{
$query = new PrefixQuery($field, $term, $attributes);
$this->append($query);
return $this;
} | php | public function prefix($field, $term, array $attributes = [])
{
$query = new PrefixQuery($field, $term, $attributes);
$this->append($query);
return $this;
} | [
"public",
"function",
"prefix",
"(",
"$",
"field",
",",
"$",
"term",
",",
"array",
"$",
"attributes",
"=",
"[",
"]",
")",
"{",
"$",
"query",
"=",
"new",
"PrefixQuery",
"(",
"$",
"field",
",",
"$",
"term",
",",
"$",
"attributes",
")",
";",
"$",
"t... | Add a prefix query.
@param string $field
@param string $term
@param array $attributes
@return $this | [
"Add",
"a",
"prefix",
"query",
"."
] | train | https://github.com/sleimanx2/plastic/blob/3d855a1384b247a1e17986dcf90e78ec454d5798/src/DSL/SearchBuilder.php#L519-L526 |
sleimanx2/plastic | src/DSL/SearchBuilder.php | SearchBuilder.queryString | public function queryString($query, array $attributes = [])
{
$query = new QueryStringQuery($query, $attributes);
$this->append($query);
return $this;
} | php | public function queryString($query, array $attributes = [])
{
$query = new QueryStringQuery($query, $attributes);
$this->append($query);
return $this;
} | [
"public",
"function",
"queryString",
"(",
"$",
"query",
",",
"array",
"$",
"attributes",
"=",
"[",
"]",
")",
"{",
"$",
"query",
"=",
"new",
"QueryStringQuery",
"(",
"$",
"query",
",",
"$",
"attributes",
")",
";",
"$",
"this",
"->",
"append",
"(",
"$"... | Add a query string query.
@param string $query
@param array $attributes
@return $this | [
"Add",
"a",
"query",
"string",
"query",
"."
] | train | https://github.com/sleimanx2/plastic/blob/3d855a1384b247a1e17986dcf90e78ec454d5798/src/DSL/SearchBuilder.php#L536-L543 |
sleimanx2/plastic | src/DSL/SearchBuilder.php | SearchBuilder.simpleQueryString | public function simpleQueryString($query, array $attributes = [])
{
$query = new SimpleQueryStringQuery($query, $attributes);
$this->append($query);
return $this;
} | php | public function simpleQueryString($query, array $attributes = [])
{
$query = new SimpleQueryStringQuery($query, $attributes);
$this->append($query);
return $this;
} | [
"public",
"function",
"simpleQueryString",
"(",
"$",
"query",
",",
"array",
"$",
"attributes",
"=",
"[",
"]",
")",
"{",
"$",
"query",
"=",
"new",
"SimpleQueryStringQuery",
"(",
"$",
"query",
",",
"$",
"attributes",
")",
";",
"$",
"this",
"->",
"append",
... | Add a simple query string query.
@param string $query
@param array $attributes
@return $this | [
"Add",
"a",
"simple",
"query",
"string",
"query",
"."
] | train | https://github.com/sleimanx2/plastic/blob/3d855a1384b247a1e17986dcf90e78ec454d5798/src/DSL/SearchBuilder.php#L553-L560 |
sleimanx2/plastic | src/DSL/SearchBuilder.php | SearchBuilder.highlight | public function highlight($fields = ['_all' => []], $parameters = [], $preTag = '<mark>', $postTag = '</mark>')
{
$highlight = new Highlight();
$highlight->setTags([$preTag], [$postTag]);
foreach ($fields as $field => $fieldParams) {
$highlight->addField($field, $fieldParams);
... | php | public function highlight($fields = ['_all' => []], $parameters = [], $preTag = '<mark>', $postTag = '</mark>')
{
$highlight = new Highlight();
$highlight->setTags([$preTag], [$postTag]);
foreach ($fields as $field => $fieldParams) {
$highlight->addField($field, $fieldParams);
... | [
"public",
"function",
"highlight",
"(",
"$",
"fields",
"=",
"[",
"'_all'",
"=>",
"[",
"]",
"]",
",",
"$",
"parameters",
"=",
"[",
"]",
",",
"$",
"preTag",
"=",
"'<mark>'",
",",
"$",
"postTag",
"=",
"'</mark>'",
")",
"{",
"$",
"highlight",
"=",
"new... | Add a highlight to result.
@param array $fields
@param array $parameters
@param string $preTag
@param string $postTag
@see https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-highlighting.html
@return $this | [
"Add",
"a",
"highlight",
"to",
"result",
"."
] | train | https://github.com/sleimanx2/plastic/blob/3d855a1384b247a1e17986dcf90e78ec454d5798/src/DSL/SearchBuilder.php#L574-L590 |
sleimanx2/plastic | src/DSL/SearchBuilder.php | SearchBuilder.range | public function range($field, array $attributes = [])
{
$query = new RangeQuery($field, $attributes);
$this->append($query);
return $this;
} | php | public function range($field, array $attributes = [])
{
$query = new RangeQuery($field, $attributes);
$this->append($query);
return $this;
} | [
"public",
"function",
"range",
"(",
"$",
"field",
",",
"array",
"$",
"attributes",
"=",
"[",
"]",
")",
"{",
"$",
"query",
"=",
"new",
"RangeQuery",
"(",
"$",
"field",
",",
"$",
"attributes",
")",
";",
"$",
"this",
"->",
"append",
"(",
"$",
"query",... | Add a range query.
@param string $field
@param array $attributes
@return $this | [
"Add",
"a",
"range",
"query",
"."
] | train | https://github.com/sleimanx2/plastic/blob/3d855a1384b247a1e17986dcf90e78ec454d5798/src/DSL/SearchBuilder.php#L600-L607 |
sleimanx2/plastic | src/DSL/SearchBuilder.php | SearchBuilder.regexp | public function regexp($field, $regex, array $attributes = [])
{
$query = new RegexpQuery($field, $regex, $attributes);
$this->append($query);
return $this;
} | php | public function regexp($field, $regex, array $attributes = [])
{
$query = new RegexpQuery($field, $regex, $attributes);
$this->append($query);
return $this;
} | [
"public",
"function",
"regexp",
"(",
"$",
"field",
",",
"$",
"regex",
",",
"array",
"$",
"attributes",
"=",
"[",
"]",
")",
"{",
"$",
"query",
"=",
"new",
"RegexpQuery",
"(",
"$",
"field",
",",
"$",
"regex",
",",
"$",
"attributes",
")",
";",
"$",
... | Add a regexp query.
@param string $field
@param array $attributes
@return $this | [
"Add",
"a",
"regexp",
"query",
"."
] | train | https://github.com/sleimanx2/plastic/blob/3d855a1384b247a1e17986dcf90e78ec454d5798/src/DSL/SearchBuilder.php#L617-L624 |
sleimanx2/plastic | src/DSL/SearchBuilder.php | SearchBuilder.commonTerm | public function commonTerm($field, $term, array $attributes = [])
{
$query = new CommonTermsQuery($field, $term, $attributes);
$this->append($query);
return $this;
} | php | public function commonTerm($field, $term, array $attributes = [])
{
$query = new CommonTermsQuery($field, $term, $attributes);
$this->append($query);
return $this;
} | [
"public",
"function",
"commonTerm",
"(",
"$",
"field",
",",
"$",
"term",
",",
"array",
"$",
"attributes",
"=",
"[",
"]",
")",
"{",
"$",
"query",
"=",
"new",
"CommonTermsQuery",
"(",
"$",
"field",
",",
"$",
"term",
",",
"$",
"attributes",
")",
";",
... | Add a common term query.
@param $field
@param $term
@param array $attributes
@return $this | [
"Add",
"a",
"common",
"term",
"query",
"."
] | train | https://github.com/sleimanx2/plastic/blob/3d855a1384b247a1e17986dcf90e78ec454d5798/src/DSL/SearchBuilder.php#L635-L642 |
sleimanx2/plastic | src/DSL/SearchBuilder.php | SearchBuilder.fuzzy | public function fuzzy($field, $term, array $attributes = [])
{
$query = new FuzzyQuery($field, $term, $attributes);
$this->append($query);
return $this;
} | php | public function fuzzy($field, $term, array $attributes = [])
{
$query = new FuzzyQuery($field, $term, $attributes);
$this->append($query);
return $this;
} | [
"public",
"function",
"fuzzy",
"(",
"$",
"field",
",",
"$",
"term",
",",
"array",
"$",
"attributes",
"=",
"[",
"]",
")",
"{",
"$",
"query",
"=",
"new",
"FuzzyQuery",
"(",
"$",
"field",
",",
"$",
"term",
",",
"$",
"attributes",
")",
";",
"$",
"thi... | Add a fuzzy query.
@param $field
@param $term
@param array $attributes
@return $this | [
"Add",
"a",
"fuzzy",
"query",
"."
] | train | https://github.com/sleimanx2/plastic/blob/3d855a1384b247a1e17986dcf90e78ec454d5798/src/DSL/SearchBuilder.php#L653-L660 |
sleimanx2/plastic | src/DSL/SearchBuilder.php | SearchBuilder.nested | public function nested($field, \Closure $closure, $score_mode = 'avg')
{
$builder = new self($this->connection, new $this->query());
$closure($builder);
$nestedQuery = $builder->query->getQueries();
$query = new NestedQuery($field, $nestedQuery, ['score_mode' => $score_mode]);
... | php | public function nested($field, \Closure $closure, $score_mode = 'avg')
{
$builder = new self($this->connection, new $this->query());
$closure($builder);
$nestedQuery = $builder->query->getQueries();
$query = new NestedQuery($field, $nestedQuery, ['score_mode' => $score_mode]);
... | [
"public",
"function",
"nested",
"(",
"$",
"field",
",",
"\\",
"Closure",
"$",
"closure",
",",
"$",
"score_mode",
"=",
"'avg'",
")",
"{",
"$",
"builder",
"=",
"new",
"self",
"(",
"$",
"this",
"->",
"connection",
",",
"new",
"$",
"this",
"->",
"query",... | Add a nested query.
@param $field
@param \Closure $closure
@param string $score_mode
@return $this | [
"Add",
"a",
"nested",
"query",
"."
] | train | https://github.com/sleimanx2/plastic/blob/3d855a1384b247a1e17986dcf90e78ec454d5798/src/DSL/SearchBuilder.php#L671-L684 |
sleimanx2/plastic | src/DSL/SearchBuilder.php | SearchBuilder.aggregate | public function aggregate(\Closure $closure)
{
$builder = new AggregationBuilder($this->query);
$closure($builder);
return $this;
} | php | public function aggregate(\Closure $closure)
{
$builder = new AggregationBuilder($this->query);
$closure($builder);
return $this;
} | [
"public",
"function",
"aggregate",
"(",
"\\",
"Closure",
"$",
"closure",
")",
"{",
"$",
"builder",
"=",
"new",
"AggregationBuilder",
"(",
"$",
"this",
"->",
"query",
")",
";",
"$",
"closure",
"(",
"$",
"builder",
")",
";",
"return",
"$",
"this",
";",
... | Add aggregation.
@param \Closure $closure
@return $this | [
"Add",
"aggregation",
"."
] | train | https://github.com/sleimanx2/plastic/blob/3d855a1384b247a1e17986dcf90e78ec454d5798/src/DSL/SearchBuilder.php#L693-L700 |
sleimanx2/plastic | src/DSL/SearchBuilder.php | SearchBuilder.functions | public function functions(\Closure $search, \Closure $closure, $parameters = [])
{
$builder = new self($this->connection, new $this->query());
$search($builder);
$builder = new FunctionScoreBuilder($builder, $parameters);
$closure($builder);
$this->append($builder->getQuer... | php | public function functions(\Closure $search, \Closure $closure, $parameters = [])
{
$builder = new self($this->connection, new $this->query());
$search($builder);
$builder = new FunctionScoreBuilder($builder, $parameters);
$closure($builder);
$this->append($builder->getQuer... | [
"public",
"function",
"functions",
"(",
"\\",
"Closure",
"$",
"search",
",",
"\\",
"Closure",
"$",
"closure",
",",
"$",
"parameters",
"=",
"[",
"]",
")",
"{",
"$",
"builder",
"=",
"new",
"self",
"(",
"$",
"this",
"->",
"connection",
",",
"new",
"$",
... | Add function score.
@param \Closure $search
@param \Closure $closure
@param array $parameters
@return $this | [
"Add",
"function",
"score",
"."
] | train | https://github.com/sleimanx2/plastic/blob/3d855a1384b247a1e17986dcf90e78ec454d5798/src/DSL/SearchBuilder.php#L711-L723 |
sleimanx2/plastic | src/DSL/SearchBuilder.php | SearchBuilder.getRaw | public function getRaw()
{
$params = [
'index' => $this->getIndex(),
'type' => $this->getType(),
'body' => $this->toDSL(),
];
return $this->connection->searchStatement($params);
} | php | public function getRaw()
{
$params = [
'index' => $this->getIndex(),
'type' => $this->getType(),
'body' => $this->toDSL(),
];
return $this->connection->searchStatement($params);
} | [
"public",
"function",
"getRaw",
"(",
")",
"{",
"$",
"params",
"=",
"[",
"'index'",
"=>",
"$",
"this",
"->",
"getIndex",
"(",
")",
",",
"'type'",
"=>",
"$",
"this",
"->",
"getType",
"(",
")",
",",
"'body'",
"=>",
"$",
"this",
"->",
"toDSL",
"(",
"... | Execute the search query against elastic and return the raw result.
@return array | [
"Execute",
"the",
"search",
"query",
"against",
"elastic",
"and",
"return",
"the",
"raw",
"result",
"."
] | train | https://github.com/sleimanx2/plastic/blob/3d855a1384b247a1e17986dcf90e78ec454d5798/src/DSL/SearchBuilder.php#L750-L759 |
sleimanx2/plastic | src/DSL/SearchBuilder.php | SearchBuilder.get | public function get()
{
$result = $this->getRaw();
$result = new PlasticResult($result);
if ($this->model) {
$this->getModelFiller()->fill($this->model, $result);
}
return $result;
} | php | public function get()
{
$result = $this->getRaw();
$result = new PlasticResult($result);
if ($this->model) {
$this->getModelFiller()->fill($this->model, $result);
}
return $result;
} | [
"public",
"function",
"get",
"(",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"getRaw",
"(",
")",
";",
"$",
"result",
"=",
"new",
"PlasticResult",
"(",
"$",
"result",
")",
";",
"if",
"(",
"$",
"this",
"->",
"model",
")",
"{",
"$",
"this",
... | Execute the search query against elastic and return the raw result if the model is not set.
@return PlasticResult | [
"Execute",
"the",
"search",
"query",
"against",
"elastic",
"and",
"return",
"the",
"raw",
"result",
"if",
"the",
"model",
"is",
"not",
"set",
"."
] | train | https://github.com/sleimanx2/plastic/blob/3d855a1384b247a1e17986dcf90e78ec454d5798/src/DSL/SearchBuilder.php#L766-L777 |
sleimanx2/plastic | src/DSL/SearchBuilder.php | SearchBuilder.paginate | public function paginate($limit = 25, $current = null)
{
$page = $this->getCurrentPage($current);
$from = $limit * ($page - 1);
$size = $limit;
$result = $this->from($from)->size($size)->get();
return new PlasticPaginator($result, $size, $page);
} | php | public function paginate($limit = 25, $current = null)
{
$page = $this->getCurrentPage($current);
$from = $limit * ($page - 1);
$size = $limit;
$result = $this->from($from)->size($size)->get();
return new PlasticPaginator($result, $size, $page);
} | [
"public",
"function",
"paginate",
"(",
"$",
"limit",
"=",
"25",
",",
"$",
"current",
"=",
"null",
")",
"{",
"$",
"page",
"=",
"$",
"this",
"->",
"getCurrentPage",
"(",
"$",
"current",
")",
";",
"$",
"from",
"=",
"$",
"limit",
"*",
"(",
"$",
"page... | Paginate result hits.
@param int $limit
@param null|int $current
@return PlasticPaginator | [
"Paginate",
"result",
"hits",
"."
] | train | https://github.com/sleimanx2/plastic/blob/3d855a1384b247a1e17986dcf90e78ec454d5798/src/DSL/SearchBuilder.php#L827-L837 |
sleimanx2/plastic | src/PlasticManager.php | PlasticManager.connection | public function connection()
{
if (!$this->connection) {
$config = $this->app['config']['plastic'];
$this->connection = new Connection($config);
}
return $this->connection;
} | php | public function connection()
{
if (!$this->connection) {
$config = $this->app['config']['plastic'];
$this->connection = new Connection($config);
}
return $this->connection;
} | [
"public",
"function",
"connection",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"connection",
")",
"{",
"$",
"config",
"=",
"$",
"this",
"->",
"app",
"[",
"'config'",
"]",
"[",
"'plastic'",
"]",
";",
"$",
"this",
"->",
"connection",
"=",
"new... | Get an elastic search connection instance. | [
"Get",
"an",
"elastic",
"search",
"connection",
"instance",
"."
] | train | https://github.com/sleimanx2/plastic/blob/3d855a1384b247a1e17986dcf90e78ec454d5798/src/PlasticManager.php#L32-L41 |
sleimanx2/plastic | src/Persistence/EloquentPersistence.php | EloquentPersistence.model | public function model(Model $model)
{
// Check if the model is searchable before setting the query builder model
$traits = class_uses_recursive(get_class($model));
if (!isset($traits[Searchable::class])) {
throw new InvalidArgumentException(get_class($model).' does not use the s... | php | public function model(Model $model)
{
// Check if the model is searchable before setting the query builder model
$traits = class_uses_recursive(get_class($model));
if (!isset($traits[Searchable::class])) {
throw new InvalidArgumentException(get_class($model).' does not use the s... | [
"public",
"function",
"model",
"(",
"Model",
"$",
"model",
")",
"{",
"// Check if the model is searchable before setting the query builder model",
"$",
"traits",
"=",
"class_uses_recursive",
"(",
"get_class",
"(",
"$",
"model",
")",
")",
";",
"if",
"(",
"!",
"isset"... | Set the model to persist.
@param Model $model
@throws InvalidArgumentException
@return $this | [
"Set",
"the",
"model",
"to",
"persist",
"."
] | train | https://github.com/sleimanx2/plastic/blob/3d855a1384b247a1e17986dcf90e78ec454d5798/src/Persistence/EloquentPersistence.php#L53-L65 |
sleimanx2/plastic | src/Persistence/EloquentPersistence.php | EloquentPersistence.save | public function save()
{
$this->exitIfModelNotSet();
if (!$this->model->exists) {
throw new \Exception('Model not persisted yet');
}
$document = $this->model->getDocumentData();
$params = [
'id' => $this->model->getKey(),
'type' => $t... | php | public function save()
{
$this->exitIfModelNotSet();
if (!$this->model->exists) {
throw new \Exception('Model not persisted yet');
}
$document = $this->model->getDocumentData();
$params = [
'id' => $this->model->getKey(),
'type' => $t... | [
"public",
"function",
"save",
"(",
")",
"{",
"$",
"this",
"->",
"exitIfModelNotSet",
"(",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"model",
"->",
"exists",
")",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
"'Model not persisted yet'",
")",
";",
"}"... | Save a model instance.
@throws \Exception
@return mixed | [
"Save",
"a",
"model",
"instance",
"."
] | train | https://github.com/sleimanx2/plastic/blob/3d855a1384b247a1e17986dcf90e78ec454d5798/src/Persistence/EloquentPersistence.php#L74-L91 |
sleimanx2/plastic | src/Persistence/EloquentPersistence.php | EloquentPersistence.update | public function update()
{
$this->exitIfModelNotSet();
if (!$this->model->exists) {
throw new \Exception('Model not persisted yet');
}
$document = $this->model->getDocumentData();
$params = [
'id' => $this->model->getKey(),
'type' =>... | php | public function update()
{
$this->exitIfModelNotSet();
if (!$this->model->exists) {
throw new \Exception('Model not persisted yet');
}
$document = $this->model->getDocumentData();
$params = [
'id' => $this->model->getKey(),
'type' =>... | [
"public",
"function",
"update",
"(",
")",
"{",
"$",
"this",
"->",
"exitIfModelNotSet",
"(",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"model",
"->",
"exists",
")",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
"'Model not persisted yet'",
")",
";",
"... | Update a model document.
@throws \Exception
@return mixed | [
"Update",
"a",
"model",
"document",
"."
] | train | https://github.com/sleimanx2/plastic/blob/3d855a1384b247a1e17986dcf90e78ec454d5798/src/Persistence/EloquentPersistence.php#L100-L120 |
sleimanx2/plastic | src/Persistence/EloquentPersistence.php | EloquentPersistence.delete | public function delete()
{
$this->exitIfModelNotSet();
$params = [
'id' => $this->model->getKey(),
'type' => $this->model->getDocumentType(),
'index' => $this->model->getDocumentIndex(),
];
// check if the document exists before deleting
... | php | public function delete()
{
$this->exitIfModelNotSet();
$params = [
'id' => $this->model->getKey(),
'type' => $this->model->getDocumentType(),
'index' => $this->model->getDocumentIndex(),
];
// check if the document exists before deleting
... | [
"public",
"function",
"delete",
"(",
")",
"{",
"$",
"this",
"->",
"exitIfModelNotSet",
"(",
")",
";",
"$",
"params",
"=",
"[",
"'id'",
"=>",
"$",
"this",
"->",
"model",
"->",
"getKey",
"(",
")",
",",
"'type'",
"=>",
"$",
"this",
"->",
"model",
"->"... | Delete a model document.
@return mixed | [
"Delete",
"a",
"model",
"document",
"."
] | train | https://github.com/sleimanx2/plastic/blob/3d855a1384b247a1e17986dcf90e78ec454d5798/src/Persistence/EloquentPersistence.php#L127-L143 |
sleimanx2/plastic | src/Persistence/EloquentPersistence.php | EloquentPersistence.bulkSave | public function bulkSave($collection = [])
{
$params = [];
$defaultIndex = $this->connection->getDefaultIndex();
foreach ($collection as $item) {
$modelIndex = $item->getDocumentIndex();
$params['body'][] = [
'index' => [
'_id' ... | php | public function bulkSave($collection = [])
{
$params = [];
$defaultIndex = $this->connection->getDefaultIndex();
foreach ($collection as $item) {
$modelIndex = $item->getDocumentIndex();
$params['body'][] = [
'index' => [
'_id' ... | [
"public",
"function",
"bulkSave",
"(",
"$",
"collection",
"=",
"[",
"]",
")",
"{",
"$",
"params",
"=",
"[",
"]",
";",
"$",
"defaultIndex",
"=",
"$",
"this",
"->",
"connection",
"->",
"getDefaultIndex",
"(",
")",
";",
"foreach",
"(",
"$",
"collection",
... | Bulk save a collection Models.
@param array|Collection $collection
@return mixed | [
"Bulk",
"save",
"a",
"collection",
"Models",
"."
] | train | https://github.com/sleimanx2/plastic/blob/3d855a1384b247a1e17986dcf90e78ec454d5798/src/Persistence/EloquentPersistence.php#L152-L172 |
sleimanx2/plastic | src/Mappings/Creator.php | Creator.create | public function create($model, $path)
{
$path = $this->getPath($model, $path);
$stub = $this->getStub();
$this->files->put($path, $this->populateStub($model, $stub));
$this->firePostCreateHooks();
return $path;
} | php | public function create($model, $path)
{
$path = $this->getPath($model, $path);
$stub = $this->getStub();
$this->files->put($path, $this->populateStub($model, $stub));
$this->firePostCreateHooks();
return $path;
} | [
"public",
"function",
"create",
"(",
"$",
"model",
",",
"$",
"path",
")",
"{",
"$",
"path",
"=",
"$",
"this",
"->",
"getPath",
"(",
"$",
"model",
",",
"$",
"path",
")",
";",
"$",
"stub",
"=",
"$",
"this",
"->",
"getStub",
"(",
")",
";",
"$",
... | Create a mapping file.
@param $model
@param $path
@return string | [
"Create",
"a",
"mapping",
"file",
"."
] | train | https://github.com/sleimanx2/plastic/blob/3d855a1384b247a1e17986dcf90e78ec454d5798/src/Mappings/Creator.php#L43-L54 |
sleimanx2/plastic | src/Mappings/Creator.php | Creator.populateStub | protected function populateStub($model, $stub)
{
$stub = str_replace('DummyClass', $this->getClassName($model), $stub);
$stub = str_replace('DummyModel', $model, $stub);
return $stub;
} | php | protected function populateStub($model, $stub)
{
$stub = str_replace('DummyClass', $this->getClassName($model), $stub);
$stub = str_replace('DummyModel', $model, $stub);
return $stub;
} | [
"protected",
"function",
"populateStub",
"(",
"$",
"model",
",",
"$",
"stub",
")",
"{",
"$",
"stub",
"=",
"str_replace",
"(",
"'DummyClass'",
",",
"$",
"this",
"->",
"getClassName",
"(",
"$",
"model",
")",
",",
"$",
"stub",
")",
";",
"$",
"stub",
"="... | Populate the place-holders in the mapping stub.
@param string $model
@param string $stub
@return string | [
"Populate",
"the",
"place",
"-",
"holders",
"in",
"the",
"mapping",
"stub",
"."
] | train | https://github.com/sleimanx2/plastic/blob/3d855a1384b247a1e17986dcf90e78ec454d5798/src/Mappings/Creator.php#L86-L93 |
sleimanx2/plastic | src/Mappings/Creator.php | Creator.getPath | protected function getPath($model, $path)
{
$name = Str::lower(str_replace('\\', '_', $model));
return $path.'/'.$name.'.php';
} | php | protected function getPath($model, $path)
{
$name = Str::lower(str_replace('\\', '_', $model));
return $path.'/'.$name.'.php';
} | [
"protected",
"function",
"getPath",
"(",
"$",
"model",
",",
"$",
"path",
")",
"{",
"$",
"name",
"=",
"Str",
"::",
"lower",
"(",
"str_replace",
"(",
"'\\\\'",
",",
"'_'",
",",
"$",
"model",
")",
")",
";",
"return",
"$",
"path",
".",
"'/'",
".",
"$... | Get the full path name to the mapping.
@param string $model
@param string $path
@return string | [
"Get",
"the",
"full",
"path",
"name",
"to",
"the",
"mapping",
"."
] | train | https://github.com/sleimanx2/plastic/blob/3d855a1384b247a1e17986dcf90e78ec454d5798/src/Mappings/Creator.php#L149-L154 |
sleimanx2/plastic | src/Map/Blueprint.php | Blueprint.build | public function build(Connection $connection, Grammar $grammar)
{
$statement = [
'index' => $this->index,
'type' => $this->type,
'body' => [
$this->type => [
'_source' => [
'enabled' => true,
... | php | public function build(Connection $connection, Grammar $grammar)
{
$statement = [
'index' => $this->index,
'type' => $this->type,
'body' => [
$this->type => [
'_source' => [
'enabled' => true,
... | [
"public",
"function",
"build",
"(",
"Connection",
"$",
"connection",
",",
"Grammar",
"$",
"grammar",
")",
"{",
"$",
"statement",
"=",
"[",
"'index'",
"=>",
"$",
"this",
"->",
"index",
",",
"'type'",
"=>",
"$",
"this",
"->",
"type",
",",
"'body'",
"=>",... | Execute the blueprint against the database.
@param Connection $connection
@param Grammar $grammar
@return array | [
"Execute",
"the",
"blueprint",
"against",
"the",
"database",
"."
] | train | https://github.com/sleimanx2/plastic/blob/3d855a1384b247a1e17986dcf90e78ec454d5798/src/Map/Blueprint.php#L62-L78 |
sleimanx2/plastic | src/Map/Blueprint.php | Blueprint.addField | public function addField($type, $name, array $attributes = [])
{
$attributes = array_merge(compact('type', 'name'), $attributes);
$this->fields[] = $field = new Fluent($attributes);
return $field;
} | php | public function addField($type, $name, array $attributes = [])
{
$attributes = array_merge(compact('type', 'name'), $attributes);
$this->fields[] = $field = new Fluent($attributes);
return $field;
} | [
"public",
"function",
"addField",
"(",
"$",
"type",
",",
"$",
"name",
",",
"array",
"$",
"attributes",
"=",
"[",
"]",
")",
"{",
"$",
"attributes",
"=",
"array_merge",
"(",
"compact",
"(",
"'type'",
",",
"'name'",
")",
",",
"$",
"attributes",
")",
";"... | Add a new field to the blueprint.
@param string $type
@param string $name
@param array $attributes
@return Fluent | [
"Add",
"a",
"new",
"field",
"to",
"the",
"blueprint",
"."
] | train | https://github.com/sleimanx2/plastic/blob/3d855a1384b247a1e17986dcf90e78ec454d5798/src/Map/Blueprint.php#L320-L327 |
sleimanx2/plastic | src/Map/Blueprint.php | Blueprint.toDSL | public function toDSL(Grammar $grammar)
{
$statements = [];
// Each type of command has a corresponding compiler function on the schema
// grammar which is used to build the necessary DSL statements to build
// the blueprint element, so we'll just call that compilers function.
... | php | public function toDSL(Grammar $grammar)
{
$statements = [];
// Each type of command has a corresponding compiler function on the schema
// grammar which is used to build the necessary DSL statements to build
// the blueprint element, so we'll just call that compilers function.
... | [
"public",
"function",
"toDSL",
"(",
"Grammar",
"$",
"grammar",
")",
"{",
"$",
"statements",
"=",
"[",
"]",
";",
"// Each type of command has a corresponding compiler function on the schema",
"// grammar which is used to build the necessary DSL statements to build",
"// the blueprin... | Get the raw DSL statements for the blueprint.
@param Grammar $grammar
@return array | [
"Get",
"the",
"raw",
"DSL",
"statements",
"for",
"the",
"blueprint",
"."
] | train | https://github.com/sleimanx2/plastic/blob/3d855a1384b247a1e17986dcf90e78ec454d5798/src/Map/Blueprint.php#L384-L402 |
sleimanx2/plastic | src/DSL/SuggestionBuilder.php | SuggestionBuilder.completion | public function completion($name, $text, $field = 'suggest', $parameters = [])
{
$suggestion = new Suggest($name, 'completion', $text, $field, $parameters);
$this->append($suggestion);
return $this;
} | php | public function completion($name, $text, $field = 'suggest', $parameters = [])
{
$suggestion = new Suggest($name, 'completion', $text, $field, $parameters);
$this->append($suggestion);
return $this;
} | [
"public",
"function",
"completion",
"(",
"$",
"name",
",",
"$",
"text",
",",
"$",
"field",
"=",
"'suggest'",
",",
"$",
"parameters",
"=",
"[",
"]",
")",
"{",
"$",
"suggestion",
"=",
"new",
"Suggest",
"(",
"$",
"name",
",",
"'completion'",
",",
"$",
... | Add a completion suggestion.
@param $name
@param $text
@param $field
@param array $parameters
@return $this
@internal param $fields | [
"Add",
"a",
"completion",
"suggestion",
"."
] | train | https://github.com/sleimanx2/plastic/blob/3d855a1384b247a1e17986dcf90e78ec454d5798/src/DSL/SuggestionBuilder.php#L81-L88 |
sleimanx2/plastic | src/PlasticServiceProvider.php | PlasticServiceProvider.registerManager | protected function registerManager()
{
$this->app->singleton('plastic', function ($app) {
return new PlasticManager($app);
});
$this->app->singleton('plastic.connection', function ($app) {
return $app['plastic']->connection();
});
} | php | protected function registerManager()
{
$this->app->singleton('plastic', function ($app) {
return new PlasticManager($app);
});
$this->app->singleton('plastic.connection', function ($app) {
return $app['plastic']->connection();
});
} | [
"protected",
"function",
"registerManager",
"(",
")",
"{",
"$",
"this",
"->",
"app",
"->",
"singleton",
"(",
"'plastic'",
",",
"function",
"(",
"$",
"app",
")",
"{",
"return",
"new",
"PlasticManager",
"(",
"$",
"app",
")",
";",
"}",
")",
";",
"$",
"t... | Register plastic's Manager and connection. | [
"Register",
"plastic",
"s",
"Manager",
"and",
"connection",
"."
] | train | https://github.com/sleimanx2/plastic/blob/3d855a1384b247a1e17986dcf90e78ec454d5798/src/PlasticServiceProvider.php#L49-L58 |
sleimanx2/plastic | src/Console/Mapping/ReRun.php | ReRun.handle | public function handle()
{
if (!$this->confirmToProceed()) {
return;
}
$this->call('mapping:reset', [
'--database' => $this->option('database'),
'--force' => true,
]);
$this->call('mapping:run', [
'--index' => $this->opt... | php | public function handle()
{
if (!$this->confirmToProceed()) {
return;
}
$this->call('mapping:reset', [
'--database' => $this->option('database'),
'--force' => true,
]);
$this->call('mapping:run', [
'--index' => $this->opt... | [
"public",
"function",
"handle",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"confirmToProceed",
"(",
")",
")",
"{",
"return",
";",
"}",
"$",
"this",
"->",
"call",
"(",
"'mapping:reset'",
",",
"[",
"'--database'",
"=>",
"$",
"this",
"->",
"optio... | Execute the console command. | [
"Execute",
"the",
"console",
"command",
"."
] | train | https://github.com/sleimanx2/plastic/blob/3d855a1384b247a1e17986dcf90e78ec454d5798/src/Console/Mapping/ReRun.php#L37-L53 |
sleimanx2/plastic | src/Fillers/EloquentFiller.php | EloquentFiller.fill | public function fill(Model $model, Result $result)
{
$hits = $result->hits()->map(function ($hit) use ($model) {
return $this->fillModel($model, $hit);
});
$result->setHits($hits);
} | php | public function fill(Model $model, Result $result)
{
$hits = $result->hits()->map(function ($hit) use ($model) {
return $this->fillModel($model, $hit);
});
$result->setHits($hits);
} | [
"public",
"function",
"fill",
"(",
"Model",
"$",
"model",
",",
"Result",
"$",
"result",
")",
"{",
"$",
"hits",
"=",
"$",
"result",
"->",
"hits",
"(",
")",
"->",
"map",
"(",
"function",
"(",
"$",
"hit",
")",
"use",
"(",
"$",
"model",
")",
"{",
"... | Fill the results hists into Model.
@param Model $model
@param Result $result
@return mixed|void | [
"Fill",
"the",
"results",
"hists",
"into",
"Model",
"."
] | train | https://github.com/sleimanx2/plastic/blob/3d855a1384b247a1e17986dcf90e78ec454d5798/src/Fillers/EloquentFiller.php#L21-L28 |
sleimanx2/plastic | src/Fillers/EloquentFiller.php | EloquentFiller.fillModel | public function fillModel(Model $model, $hit = [])
{
$key_name = $model->getKeyName();
$attributes = $hit['_source'];
if (isset($hit['_id'])) {
$attributes[$key_name] = is_numeric($hit['_id']) ? intval($hit['_id']) : $hit['_id'];
}
// Add fields to attributes
... | php | public function fillModel(Model $model, $hit = [])
{
$key_name = $model->getKeyName();
$attributes = $hit['_source'];
if (isset($hit['_id'])) {
$attributes[$key_name] = is_numeric($hit['_id']) ? intval($hit['_id']) : $hit['_id'];
}
// Add fields to attributes
... | [
"public",
"function",
"fillModel",
"(",
"Model",
"$",
"model",
",",
"$",
"hit",
"=",
"[",
"]",
")",
"{",
"$",
"key_name",
"=",
"$",
"model",
"->",
"getKeyName",
"(",
")",
";",
"$",
"attributes",
"=",
"$",
"hit",
"[",
"'_source'",
"]",
";",
"if",
... | New From Hit Builder.
Variation on newFromBuilder. Instead, takes
@param $model
@param array $hit
@return static | [
"New",
"From",
"Hit",
"Builder",
"."
] | train | https://github.com/sleimanx2/plastic/blob/3d855a1384b247a1e17986dcf90e78ec454d5798/src/Fillers/EloquentFiller.php#L40-L76 |
sleimanx2/plastic | src/Fillers/EloquentFiller.php | EloquentFiller.newFromBuilderRecursive | public function newFromBuilderRecursive(Model $model, array $attributes = [], Relation $parentRelation = null)
{
$instance = $model->newInstance([], $exists = true);
// fill the instance attributes with checking
$instance->unguard();
$instance->fill($attributes);
$instance->... | php | public function newFromBuilderRecursive(Model $model, array $attributes = [], Relation $parentRelation = null)
{
$instance = $model->newInstance([], $exists = true);
// fill the instance attributes with checking
$instance->unguard();
$instance->fill($attributes);
$instance->... | [
"public",
"function",
"newFromBuilderRecursive",
"(",
"Model",
"$",
"model",
",",
"array",
"$",
"attributes",
"=",
"[",
"]",
",",
"Relation",
"$",
"parentRelation",
"=",
"null",
")",
"{",
"$",
"instance",
"=",
"$",
"model",
"->",
"newInstance",
"(",
"[",
... | Fill a model with form an elastic hit.
@param Model $model
@param array $attributes
@param Relation $parentRelation
@return mixed | [
"Fill",
"a",
"model",
"with",
"form",
"an",
"elastic",
"hit",
"."
] | train | https://github.com/sleimanx2/plastic/blob/3d855a1384b247a1e17986dcf90e78ec454d5798/src/Fillers/EloquentFiller.php#L87-L102 |
sleimanx2/plastic | src/Fillers/EloquentFiller.php | EloquentFiller.loadRelationsAttributesRecursive | protected function loadRelationsAttributesRecursive(Model $model)
{
$attributes = $model->getAttributes();
foreach ($attributes as $key => $value) {
if (method_exists($model, $key)) {
$reflection_method = new ReflectionMethod($model, $key);
if ($reflecti... | php | protected function loadRelationsAttributesRecursive(Model $model)
{
$attributes = $model->getAttributes();
foreach ($attributes as $key => $value) {
if (method_exists($model, $key)) {
$reflection_method = new ReflectionMethod($model, $key);
if ($reflecti... | [
"protected",
"function",
"loadRelationsAttributesRecursive",
"(",
"Model",
"$",
"model",
")",
"{",
"$",
"attributes",
"=",
"$",
"model",
"->",
"getAttributes",
"(",
")",
";",
"foreach",
"(",
"$",
"attributes",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{"... | Get the relations attributes from a model.
@param \Illuminate\Database\Eloquent\Model $model | [
"Get",
"the",
"relations",
"attributes",
"from",
"a",
"model",
"."
] | train | https://github.com/sleimanx2/plastic/blob/3d855a1384b247a1e17986dcf90e78ec454d5798/src/Fillers/EloquentFiller.php#L109-L148 |
sleimanx2/plastic | src/Console/Mapping/Install.php | Install.handle | public function handle()
{
$this->repository->setSource($this->option('database'));
$this->repository->createRepository();
$this->info('Mapping table created successfully');
} | php | public function handle()
{
$this->repository->setSource($this->option('database'));
$this->repository->createRepository();
$this->info('Mapping table created successfully');
} | [
"public",
"function",
"handle",
"(",
")",
"{",
"$",
"this",
"->",
"repository",
"->",
"setSource",
"(",
"$",
"this",
"->",
"option",
"(",
"'database'",
")",
")",
";",
"$",
"this",
"->",
"repository",
"->",
"createRepository",
"(",
")",
";",
"$",
"this"... | Execute the console command. | [
"Execute",
"the",
"console",
"command",
"."
] | train | https://github.com/sleimanx2/plastic/blob/3d855a1384b247a1e17986dcf90e78ec454d5798/src/Console/Mapping/Install.php#L39-L46 |
sleimanx2/plastic | src/Mappings/Mapping.php | Mapping.prepareModel | protected function prepareModel()
{
if (!$this->model) {
throw new MissingArgumentException('model property should be filled');
}
$this->model = new $this->model();
$traits = class_uses_recursive(get_class($this->model));
if (!isset($traits[Searchable::class]))... | php | protected function prepareModel()
{
if (!$this->model) {
throw new MissingArgumentException('model property should be filled');
}
$this->model = new $this->model();
$traits = class_uses_recursive(get_class($this->model));
if (!isset($traits[Searchable::class]))... | [
"protected",
"function",
"prepareModel",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"model",
")",
"{",
"throw",
"new",
"MissingArgumentException",
"(",
"'model property should be filled'",
")",
";",
"}",
"$",
"this",
"->",
"model",
"=",
"new",
"$",
... | Validate the given model and create a new instance. | [
"Validate",
"the",
"given",
"model",
"and",
"create",
"a",
"new",
"instance",
"."
] | train | https://github.com/sleimanx2/plastic/blob/3d855a1384b247a1e17986dcf90e78ec454d5798/src/Mappings/Mapping.php#L57-L70 |
sleimanx2/plastic | src/Console/Mapping/Reset.php | Reset.handle | public function handle()
{
if (!$this->confirmToProceed()) {
return;
}
$this->mappings->setSource($this->option('database'));
$this->mappings->reset();
$this->comment('Mapping repository reset successfully');
} | php | public function handle()
{
if (!$this->confirmToProceed()) {
return;
}
$this->mappings->setSource($this->option('database'));
$this->mappings->reset();
$this->comment('Mapping repository reset successfully');
} | [
"public",
"function",
"handle",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"confirmToProceed",
"(",
")",
")",
"{",
"return",
";",
"}",
"$",
"this",
"->",
"mappings",
"->",
"setSource",
"(",
"$",
"this",
"->",
"option",
"(",
"'database'",
")",
... | Execute the console command. | [
"Execute",
"the",
"console",
"command",
"."
] | train | https://github.com/sleimanx2/plastic/blob/3d855a1384b247a1e17986dcf90e78ec454d5798/src/Console/Mapping/Reset.php#L47-L58 |
sleimanx2/plastic | src/MappingServiceProvider.php | MappingServiceProvider.register | public function register()
{
$this->registerRepository();
$this->registerMapper();
$this->registerCreator();
$this->registerCommands();
$this->registerAlias();
} | php | public function register()
{
$this->registerRepository();
$this->registerMapper();
$this->registerCreator();
$this->registerCommands();
$this->registerAlias();
} | [
"public",
"function",
"register",
"(",
")",
"{",
"$",
"this",
"->",
"registerRepository",
"(",
")",
";",
"$",
"this",
"->",
"registerMapper",
"(",
")",
";",
"$",
"this",
"->",
"registerCreator",
"(",
")",
";",
"$",
"this",
"->",
"registerCommands",
"(",
... | Register the service provider. | [
"Register",
"the",
"service",
"provider",
"."
] | train | https://github.com/sleimanx2/plastic/blob/3d855a1384b247a1e17986dcf90e78ec454d5798/src/MappingServiceProvider.php#L32-L43 |
sleimanx2/plastic | src/MappingServiceProvider.php | MappingServiceProvider.registerRepository | protected function registerRepository()
{
$this->app->singleton('mapping.repository', function ($app) {
$table = $app['config']['plastic.mappings'];
return new Mappings($app['db'], $table);
});
} | php | protected function registerRepository()
{
$this->app->singleton('mapping.repository', function ($app) {
$table = $app['config']['plastic.mappings'];
return new Mappings($app['db'], $table);
});
} | [
"protected",
"function",
"registerRepository",
"(",
")",
"{",
"$",
"this",
"->",
"app",
"->",
"singleton",
"(",
"'mapping.repository'",
",",
"function",
"(",
"$",
"app",
")",
"{",
"$",
"table",
"=",
"$",
"app",
"[",
"'config'",
"]",
"[",
"'plastic.mappings... | Register the mapping repository service. | [
"Register",
"the",
"mapping",
"repository",
"service",
"."
] | train | https://github.com/sleimanx2/plastic/blob/3d855a1384b247a1e17986dcf90e78ec454d5798/src/MappingServiceProvider.php#L48-L55 |
sleimanx2/plastic | src/Mappings/Mappings.php | Mappings.getRan | public function getRan()
{
$result = $this->table()
->orderBy('batch', 'asc')
->orderBy('mapping', 'asc')
->pluck('mapping');
if (is_array($result)) {
return $result;
}
return $result->toArray();
} | php | public function getRan()
{
$result = $this->table()
->orderBy('batch', 'asc')
->orderBy('mapping', 'asc')
->pluck('mapping');
if (is_array($result)) {
return $result;
}
return $result->toArray();
} | [
"public",
"function",
"getRan",
"(",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"table",
"(",
")",
"->",
"orderBy",
"(",
"'batch'",
",",
"'asc'",
")",
"->",
"orderBy",
"(",
"'mapping'",
",",
"'asc'",
")",
"->",
"pluck",
"(",
"'mapping'",
")",
... | Get the ran mappings.
@return array | [
"Get",
"the",
"ran",
"mappings",
"."
] | train | https://github.com/sleimanx2/plastic/blob/3d855a1384b247a1e17986dcf90e78ec454d5798/src/Mappings/Mappings.php#L50-L62 |
sleimanx2/plastic | src/Mappings/Mappings.php | Mappings.getLast | public function getLast()
{
$result = $this->table()
->where('batch', $this->getLastBatchNumber())
->orderBy('mapping', 'desc')
->get();
if (is_array($result)) {
return $result;
}
return $result->toArray();
} | php | public function getLast()
{
$result = $this->table()
->where('batch', $this->getLastBatchNumber())
->orderBy('mapping', 'desc')
->get();
if (is_array($result)) {
return $result;
}
return $result->toArray();
} | [
"public",
"function",
"getLast",
"(",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"table",
"(",
")",
"->",
"where",
"(",
"'batch'",
",",
"$",
"this",
"->",
"getLastBatchNumber",
"(",
")",
")",
"->",
"orderBy",
"(",
"'mapping'",
",",
"'desc'",
")... | Get the last mapping batch.
@return array | [
"Get",
"the",
"last",
"mapping",
"batch",
"."
] | train | https://github.com/sleimanx2/plastic/blob/3d855a1384b247a1e17986dcf90e78ec454d5798/src/Mappings/Mappings.php#L69-L81 |
sleimanx2/plastic | src/Mappings/Mappings.php | Mappings.createRepository | public function createRepository()
{
$this->schema()->create($this->table, function ($table) {
// The mappings table is responsible for keeping track of which of the
// mappings have actually run for the application. We'll create the
// table to hold the mapping file's p... | php | public function createRepository()
{
$this->schema()->create($this->table, function ($table) {
// The mappings table is responsible for keeping track of which of the
// mappings have actually run for the application. We'll create the
// table to hold the mapping file's p... | [
"public",
"function",
"createRepository",
"(",
")",
"{",
"$",
"this",
"->",
"schema",
"(",
")",
"->",
"create",
"(",
"$",
"this",
"->",
"table",
",",
"function",
"(",
"$",
"table",
")",
"{",
"// The mappings table is responsible for keeping track of which of the",... | Create the mapping repository data store. | [
"Create",
"the",
"mapping",
"repository",
"data",
"store",
"."
] | train | https://github.com/sleimanx2/plastic/blob/3d855a1384b247a1e17986dcf90e78ec454d5798/src/Mappings/Mappings.php#L137-L150 |
sleimanx2/plastic | src/Console/Index/Populate.php | Populate.handle | public function handle()
{
$index = $this->index();
// Checks if the target index exists
if (!$this->existsStatement($index)) {
$this->error('Index « '.$index.' » does not exists.');
return;
}
// Runs the mappings
if ($this->option('mappings... | php | public function handle()
{
$index = $this->index();
// Checks if the target index exists
if (!$this->existsStatement($index)) {
$this->error('Index « '.$index.' » does not exists.');
return;
}
// Runs the mappings
if ($this->option('mappings... | [
"public",
"function",
"handle",
"(",
")",
"{",
"$",
"index",
"=",
"$",
"this",
"->",
"index",
"(",
")",
";",
"// Checks if the target index exists",
"if",
"(",
"!",
"$",
"this",
"->",
"existsStatement",
"(",
"$",
"index",
")",
")",
"{",
"$",
"this",
"-... | Execute the console command. | [
"Execute",
"the",
"console",
"command",
"."
] | train | https://github.com/sleimanx2/plastic/blob/3d855a1384b247a1e17986dcf90e78ec454d5798/src/Console/Index/Populate.php#L42-L70 |
sleimanx2/plastic | src/Console/Index/Populate.php | Populate.populateIndex | protected function populateIndex($index)
{
$this->line('Populating the index « '.$index.' » ...');
// Replaces the current default index by the one we want to populate
$defaultIndex = Plastic::getDefaultIndex();
Plastic::setDefaultIndex($index);
// Disables query logging to... | php | protected function populateIndex($index)
{
$this->line('Populating the index « '.$index.' » ...');
// Replaces the current default index by the one we want to populate
$defaultIndex = Plastic::getDefaultIndex();
Plastic::setDefaultIndex($index);
// Disables query logging to... | [
"protected",
"function",
"populateIndex",
"(",
"$",
"index",
")",
"{",
"$",
"this",
"->",
"line",
"(",
"'Populating the index « '.",
"$",
"i",
"ndex.",
"'",
" » ...');",
"",
"",
"// Replaces the current default index by the one we want to populate",
"$",
"defaultIndex",... | Populates the index.
@param string $index The index name
@throws \Exception | [
"Populates",
"the",
"index",
"."
] | train | https://github.com/sleimanx2/plastic/blob/3d855a1384b247a1e17986dcf90e78ec454d5798/src/Console/Index/Populate.php#L79-L109 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.