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 |
|---|---|---|---|---|---|---|---|---|---|---|
Vinelab/NeoEloquent | src/Schema/Grammars/CypherGrammar.php | CypherGrammar.compileRenameLabel | public function compileRenameLabel(Blueprint $blueprint, Fluent $command)
{
$match = $this->compileFrom($blueprint);
$from = $this->prepareLabels(array($blueprint));
$to = $this->prepareLabels(array($command->to));
return $match . " REMOVE n$from SET n$to";
} | php | public function compileRenameLabel(Blueprint $blueprint, Fluent $command)
{
$match = $this->compileFrom($blueprint);
$from = $this->prepareLabels(array($blueprint));
$to = $this->prepareLabels(array($command->to));
return $match . " REMOVE n$from SET n$to";
} | [
"public",
"function",
"compileRenameLabel",
"(",
"Blueprint",
"$",
"blueprint",
",",
"Fluent",
"$",
"command",
")",
"{",
"$",
"match",
"=",
"$",
"this",
"->",
"compileFrom",
"(",
"$",
"blueprint",
")",
";",
"$",
"from",
"=",
"$",
"this",
"->",
"prepareLa... | Compile a rename label command.
@param Blueprint $blueprint
@param Fluent $command
@return string | [
"Compile",
"a",
"rename",
"label",
"command",
"."
] | train | https://github.com/Vinelab/NeoEloquent/blob/b9fc12d19122b2022116d95f9537ca4f5e9ca70c/src/Schema/Grammars/CypherGrammar.php#L70-L77 |
Vinelab/NeoEloquent | src/Schema/Grammars/CypherGrammar.php | CypherGrammar.compileIndexKey | protected function compileIndexKey($operation, Blueprint $blueprint, Fluent $command)
{
$label = $this->wrapLabel($blueprint);
$property = $this->propertize($command->property);
return "$operation INDEX ON $label($property)";
} | php | protected function compileIndexKey($operation, Blueprint $blueprint, Fluent $command)
{
$label = $this->wrapLabel($blueprint);
$property = $this->propertize($command->property);
return "$operation INDEX ON $label($property)";
} | [
"protected",
"function",
"compileIndexKey",
"(",
"$",
"operation",
",",
"Blueprint",
"$",
"blueprint",
",",
"Fluent",
"$",
"command",
")",
"{",
"$",
"label",
"=",
"$",
"this",
"->",
"wrapLabel",
"(",
"$",
"blueprint",
")",
";",
"$",
"property",
"=",
"$",... | Compiles index operation.
@param string $operation
@param Blueprint $blueprint
@param Fluent $command
@return string | [
"Compiles",
"index",
"operation",
"."
] | train | https://github.com/Vinelab/NeoEloquent/blob/b9fc12d19122b2022116d95f9537ca4f5e9ca70c/src/Schema/Grammars/CypherGrammar.php#L136-L142 |
Vinelab/NeoEloquent | src/Schema/Grammars/CypherGrammar.php | CypherGrammar.compileFrom | public function compileFrom($labels)
{
// first we will check whether we need
// to reformat the labels from an array
if (is_array($labels))
{
$labels = $this->prepareLabels($labels);
}
// every label must begin with a ':' so we need to check
// a... | php | public function compileFrom($labels)
{
// first we will check whether we need
// to reformat the labels from an array
if (is_array($labels))
{
$labels = $this->prepareLabels($labels);
}
// every label must begin with a ':' so we need to check
// a... | [
"public",
"function",
"compileFrom",
"(",
"$",
"labels",
")",
"{",
"// first we will check whether we need",
"// to reformat the labels from an array",
"if",
"(",
"is_array",
"(",
"$",
"labels",
")",
")",
"{",
"$",
"labels",
"=",
"$",
"this",
"->",
"prepareLabels",
... | Compile the "from" portion of the query
which in cypher represents the nodes we're MATCHing
@param string $labels
@return string | [
"Compile",
"the",
"from",
"portion",
"of",
"the",
"query",
"which",
"in",
"cypher",
"represents",
"the",
"nodes",
"we",
"re",
"MATCHing"
] | train | https://github.com/Vinelab/NeoEloquent/blob/b9fc12d19122b2022116d95f9537ca4f5e9ca70c/src/Schema/Grammars/CypherGrammar.php#L167-L184 |
Vinelab/NeoEloquent | src/Query/Processors/Processor.php | Processor.processInsertGetId | public function processInsertGetId(IlluminateBuilder $query, $sql, $values, $sequence = NULL)
{
$query->getConnection()->insert($sql, $values);
$id = $query->getConnection()->lastInsertedId();
return is_numeric($id) ? (int) $id : $id;
} | php | public function processInsertGetId(IlluminateBuilder $query, $sql, $values, $sequence = NULL)
{
$query->getConnection()->insert($sql, $values);
$id = $query->getConnection()->lastInsertedId();
return is_numeric($id) ? (int) $id : $id;
} | [
"public",
"function",
"processInsertGetId",
"(",
"IlluminateBuilder",
"$",
"query",
",",
"$",
"sql",
",",
"$",
"values",
",",
"$",
"sequence",
"=",
"NULL",
")",
"{",
"$",
"query",
"->",
"getConnection",
"(",
")",
"->",
"insert",
"(",
"$",
"sql",
",",
"... | Process an "insert get ID" query.
@param \Illuminate\Database\Query\Builder $query
@param string $sql
@param array $values
@param string $sequence
@return int | [
"Process",
"an",
"insert",
"get",
"ID",
"query",
"."
] | train | https://github.com/Vinelab/NeoEloquent/blob/b9fc12d19122b2022116d95f9537ca4f5e9ca70c/src/Query/Processors/Processor.php#L19-L25 |
Vinelab/NeoEloquent | src/Eloquent/Concerns/QueriesRelationships.php | QueriesRelationships.has | public function has($relation, $operator = '>=', $count = 1, $boolean = 'and', \Closure $callback = null)
{
$relation = $this->getRelationWithoutConstraints($relation);
$query = $relation->getRelated()->newQuery();
// This will make sure that any query we add here will consider the related
... | php | public function has($relation, $operator = '>=', $count = 1, $boolean = 'and', \Closure $callback = null)
{
$relation = $this->getRelationWithoutConstraints($relation);
$query = $relation->getRelated()->newQuery();
// This will make sure that any query we add here will consider the related
... | [
"public",
"function",
"has",
"(",
"$",
"relation",
",",
"$",
"operator",
"=",
"'>='",
",",
"$",
"count",
"=",
"1",
",",
"$",
"boolean",
"=",
"'and'",
",",
"\\",
"Closure",
"$",
"callback",
"=",
"null",
")",
"{",
"$",
"relation",
"=",
"$",
"this",
... | Add a relationship query condition.
@param string $relation
@param string $operator
@param int $count
@param string $boolean
@param \Closure $callback
@return \Illuminate\Database\Eloquent\Builder|static | [
"Add",
"a",
"relationship",
"query",
"condition",
"."
] | train | https://github.com/Vinelab/NeoEloquent/blob/b9fc12d19122b2022116d95f9537ca4f5e9ca70c/src/Eloquent/Concerns/QueriesRelationships.php#L26-L91 |
Vinelab/NeoEloquent | src/QueryException.php | QueryException.formatMessage | protected function formatMessage(Neo4jException $exception)
{
$data = $exception->getData();
$exceptionName = isset($data['exception']) ? $data['exception'] .': ' : '';
$message = isset($data['message']) ? $data['message'] : $exception->getMessage();
return $exceptionName.$message;
... | php | protected function formatMessage(Neo4jException $exception)
{
$data = $exception->getData();
$exceptionName = isset($data['exception']) ? $data['exception'] .': ' : '';
$message = isset($data['message']) ? $data['message'] : $exception->getMessage();
return $exceptionName.$message;
... | [
"protected",
"function",
"formatMessage",
"(",
"Neo4jException",
"$",
"exception",
")",
"{",
"$",
"data",
"=",
"$",
"exception",
"->",
"getData",
"(",
")",
";",
"$",
"exceptionName",
"=",
"isset",
"(",
"$",
"data",
"[",
"'exception'",
"]",
")",
"?",
"$",... | Format the message that should be printed out for devs.
@param \Everyman\Neo4j\Exception $exception
@return string | [
"Format",
"the",
"message",
"that",
"should",
"be",
"printed",
"out",
"for",
"devs",
"."
] | train | https://github.com/Vinelab/NeoEloquent/blob/b9fc12d19122b2022116d95f9537ca4f5e9ca70c/src/QueryException.php#L36-L42 |
Vinelab/NeoEloquent | src/Console/Migrations/BaseCommand.php | BaseCommand.getMigrationPaths | protected function getMigrationPaths()
{
// Here, we will check to see if a path option has been defined. If it has we will
// use the path relative to the root of the installation folder so our database
// migrations may be run for any customized path from within the application.
if... | php | protected function getMigrationPaths()
{
// Here, we will check to see if a path option has been defined. If it has we will
// use the path relative to the root of the installation folder so our database
// migrations may be run for any customized path from within the application.
if... | [
"protected",
"function",
"getMigrationPaths",
"(",
")",
"{",
"// Here, we will check to see if a path option has been defined. If it has we will",
"// use the path relative to the root of the installation folder so our database",
"// migrations may be run for any customized path from within the appl... | Get the path to the migration directory.
@return array | [
"Get",
"the",
"path",
"to",
"the",
"migration",
"directory",
"."
] | train | https://github.com/Vinelab/NeoEloquent/blob/b9fc12d19122b2022116d95f9537ca4f5e9ca70c/src/Console/Migrations/BaseCommand.php#L22-L34 |
Vinelab/NeoEloquent | src/Query/Grammars/Grammar.php | Grammar.parameter | public function parameter($value)
{
// Validate whether the requested field is the
// node id, in that case id(n) doesn't work as
// a placeholder so we transform it to the id replacement instead.
// When coming from a WHERE statement we'll have to pluck out the column
// f... | php | public function parameter($value)
{
// Validate whether the requested field is the
// node id, in that case id(n) doesn't work as
// a placeholder so we transform it to the id replacement instead.
// When coming from a WHERE statement we'll have to pluck out the column
// f... | [
"public",
"function",
"parameter",
"(",
"$",
"value",
")",
"{",
"// Validate whether the requested field is the",
"// node id, in that case id(n) doesn't work as",
"// a placeholder so we transform it to the id replacement instead.",
"// When coming from a WHERE statement we'll have to pluck o... | Get the appropriate query parameter place-holder for a value.
@param mixed $value
@return string | [
"Get",
"the",
"appropriate",
"query",
"parameter",
"place",
"-",
"holder",
"for",
"a",
"value",
"."
] | train | https://github.com/Vinelab/NeoEloquent/blob/b9fc12d19122b2022116d95f9537ca4f5e9ca70c/src/Query/Grammars/Grammar.php#L24-L51 |
Vinelab/NeoEloquent | src/Query/Grammars/Grammar.php | Grammar.wrap | public function wrap($value, $prefixAlias = false)
{
// We will only wrap the value unless it has parentheses
// in it which is the case where we're matching a node by id, or an *
// and last whether this is a pre-formatted key.
if (preg_match('/[(|)]/', $value) || $value == '*' || s... | php | public function wrap($value, $prefixAlias = false)
{
// We will only wrap the value unless it has parentheses
// in it which is the case where we're matching a node by id, or an *
// and last whether this is a pre-formatted key.
if (preg_match('/[(|)]/', $value) || $value == '*' || s... | [
"public",
"function",
"wrap",
"(",
"$",
"value",
",",
"$",
"prefixAlias",
"=",
"false",
")",
"{",
"// We will only wrap the value unless it has parentheses",
"// in it which is the case where we're matching a node by id, or an *",
"// and last whether this is a pre-formatted key.",
"... | Wrap a value in keyword identifiers.
@param string $value
@return string | [
"Wrap",
"a",
"value",
"in",
"keyword",
"identifiers",
"."
] | train | https://github.com/Vinelab/NeoEloquent/blob/b9fc12d19122b2022116d95f9537ca4f5e9ca70c/src/Query/Grammars/Grammar.php#L108-L125 |
Vinelab/NeoEloquent | src/Query/Grammars/Grammar.php | Grammar.valufy | public function valufy($values)
{
// we'll only deal with arrays so let's turn it into one if it isn't
if ( ! is_array($values)) $values = [$values];
// escape and wrap them with a quote.
$values = array_map(function ($value)
{
// First, we check whether we have ... | php | public function valufy($values)
{
// we'll only deal with arrays so let's turn it into one if it isn't
if ( ! is_array($values)) $values = [$values];
// escape and wrap them with a quote.
$values = array_map(function ($value)
{
// First, we check whether we have ... | [
"public",
"function",
"valufy",
"(",
"$",
"values",
")",
"{",
"// we'll only deal with arrays so let's turn it into one if it isn't",
"if",
"(",
"!",
"is_array",
"(",
"$",
"values",
")",
")",
"$",
"values",
"=",
"[",
"$",
"values",
"]",
";",
"// escape and wrap th... | Turn an array of values into a comma separated string of values
that are escaped and ready to be passed as values in a query
@param array $values
@return string | [
"Turn",
"an",
"array",
"of",
"values",
"into",
"a",
"comma",
"separated",
"string",
"of",
"values",
"that",
"are",
"escaped",
"and",
"ready",
"to",
"be",
"passed",
"as",
"values",
"in",
"a",
"query"
] | train | https://github.com/Vinelab/NeoEloquent/blob/b9fc12d19122b2022116d95f9537ca4f5e9ca70c/src/Query/Grammars/Grammar.php#L134-L169 |
Vinelab/NeoEloquent | src/Query/Grammars/Grammar.php | Grammar.modelAsNode | public function modelAsNode($labels = null, $relation = null)
{
if (is_null($labels))
{
return 'n';
} elseif (is_array($labels))
{
$labels = reset($labels);
}
// When this is a related node we'll just prepend it with 'with_' that way we avoid
... | php | public function modelAsNode($labels = null, $relation = null)
{
if (is_null($labels))
{
return 'n';
} elseif (is_array($labels))
{
$labels = reset($labels);
}
// When this is a related node we'll just prepend it with 'with_' that way we avoid
... | [
"public",
"function",
"modelAsNode",
"(",
"$",
"labels",
"=",
"null",
",",
"$",
"relation",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"labels",
")",
")",
"{",
"return",
"'n'",
";",
"}",
"elseif",
"(",
"is_array",
"(",
"$",
"labels",
")... | Get a model's name as a Node placeholder
Downcases first letter in labels - i.e. in "MATCH (user:`User`)"... "user"
if $relation != null then 'with_' is appended to labels
@param string|array $labels The labels we're choosing from
@param boolean $relation Tells whether this is a related node so that we append a 'wi... | [
"Get",
"a",
"model",
"s",
"name",
"as",
"a",
"Node",
"placeholder"
] | train | https://github.com/Vinelab/NeoEloquent/blob/b9fc12d19122b2022116d95f9537ca4f5e9ca70c/src/Query/Grammars/Grammar.php#L181-L211 |
Vinelab/NeoEloquent | src/Query/Grammars/Grammar.php | Grammar.getIdReplacement | public function getIdReplacement($column)
{
// If we have id(n) we're removing () and keeping idn
$column = preg_replace('/[(|)]/', '', $column);
// Check whether the column is still id so that we transform it to the form id(n) and then
// recursively calling ourself to reformat acco... | php | public function getIdReplacement($column)
{
// If we have id(n) we're removing () and keeping idn
$column = preg_replace('/[(|)]/', '', $column);
// Check whether the column is still id so that we transform it to the form id(n) and then
// recursively calling ourself to reformat acco... | [
"public",
"function",
"getIdReplacement",
"(",
"$",
"column",
")",
"{",
"// If we have id(n) we're removing () and keeping idn",
"$",
"column",
"=",
"preg_replace",
"(",
"'/[(|)]/'",
",",
"''",
",",
"$",
"column",
")",
";",
"// Check whether the column is still id so that... | Get the replacement of an id property.
@return string | [
"Get",
"the",
"replacement",
"of",
"an",
"id",
"property",
"."
] | train | https://github.com/Vinelab/NeoEloquent/blob/b9fc12d19122b2022116d95f9537ca4f5e9ca70c/src/Query/Grammars/Grammar.php#L228-L247 |
Vinelab/NeoEloquent | src/Query/Grammars/Grammar.php | Grammar.prepareEntity | protected function prepareEntity($entity, $identifier = false)
{
$label = (is_array($entity['label'])) ? $this->prepareLabels($entity['label']) : $entity['label'];
if ($identifier)
{
// when the $identifier is used as a flag, we'll take care of generating it.
if ($id... | php | protected function prepareEntity($entity, $identifier = false)
{
$label = (is_array($entity['label'])) ? $this->prepareLabels($entity['label']) : $entity['label'];
if ($identifier)
{
// when the $identifier is used as a flag, we'll take care of generating it.
if ($id... | [
"protected",
"function",
"prepareEntity",
"(",
"$",
"entity",
",",
"$",
"identifier",
"=",
"false",
")",
"{",
"$",
"label",
"=",
"(",
"is_array",
"(",
"$",
"entity",
"[",
"'label'",
"]",
")",
")",
"?",
"$",
"this",
"->",
"prepareLabels",
"(",
"$",
"e... | Prepare an entity's values to be used in a query, performs sanitization and reformatting.
@param array $entity
@return string | [
"Prepare",
"an",
"entity",
"s",
"values",
"to",
"be",
"used",
"in",
"a",
"query",
"performs",
"sanitization",
"and",
"reformatting",
"."
] | train | https://github.com/Vinelab/NeoEloquent/blob/b9fc12d19122b2022116d95f9537ca4f5e9ca70c/src/Query/Grammars/Grammar.php#L266-L294 |
Vinelab/NeoEloquent | src/Eloquent/Relations/HasOneOrMany.php | HasOneOrMany.initRelation | public function initRelation(array $models, $relation)
{
foreach ($models as $model)
{
// In the case of fetching nested relations, we will get an array
// with the first key being the model we need, and the other being
// the related model so we'll just take the ... | php | public function initRelation(array $models, $relation)
{
foreach ($models as $model)
{
// In the case of fetching nested relations, we will get an array
// with the first key being the model we need, and the other being
// the related model so we'll just take the ... | [
"public",
"function",
"initRelation",
"(",
"array",
"$",
"models",
",",
"$",
"relation",
")",
"{",
"foreach",
"(",
"$",
"models",
"as",
"$",
"model",
")",
"{",
"// In the case of fetching nested relations, we will get an array",
"// with the first key being the model we n... | Initialize the relation on a set of models.
@param array $models
@param string $relation
@return array | [
"Initialize",
"the",
"relation",
"on",
"a",
"set",
"of",
"models",
"."
] | train | https://github.com/Vinelab/NeoEloquent/blob/b9fc12d19122b2022116d95f9537ca4f5e9ca70c/src/Eloquent/Relations/HasOneOrMany.php#L61-L74 |
Vinelab/NeoEloquent | src/Eloquent/Relations/HasOneOrMany.php | HasOneOrMany.getKeys | protected function getKeys(array $models, $key = null)
{
return array_unique(array_values(array_map(function($value) use ($key)
{
if (is_array($value)) $value = reset($value);
return $key ? $value->getAttribute($key) : $value->getKey();
}, $models)));
} | php | protected function getKeys(array $models, $key = null)
{
return array_unique(array_values(array_map(function($value) use ($key)
{
if (is_array($value)) $value = reset($value);
return $key ? $value->getAttribute($key) : $value->getKey();
}, $models)));
} | [
"protected",
"function",
"getKeys",
"(",
"array",
"$",
"models",
",",
"$",
"key",
"=",
"null",
")",
"{",
"return",
"array_unique",
"(",
"array_values",
"(",
"array_map",
"(",
"function",
"(",
"$",
"value",
")",
"use",
"(",
"$",
"key",
")",
"{",
"if",
... | Get all of the primary keys for an array of models.
@param array $models
@param string $key
@return array | [
"Get",
"all",
"of",
"the",
"primary",
"keys",
"for",
"an",
"array",
"of",
"models",
"."
] | train | https://github.com/Vinelab/NeoEloquent/blob/b9fc12d19122b2022116d95f9537ca4f5e9ca70c/src/Eloquent/Relations/HasOneOrMany.php#L83-L92 |
Vinelab/NeoEloquent | src/Eloquent/Relations/HasOneOrMany.php | HasOneOrMany.edges | public function edges()
{
return $this->finder->get($this->parent, $this->related, $this->type);
} | php | public function edges()
{
return $this->finder->get($this->parent, $this->related, $this->type);
} | [
"public",
"function",
"edges",
"(",
")",
"{",
"return",
"$",
"this",
"->",
"finder",
"->",
"get",
"(",
"$",
"this",
"->",
"parent",
",",
"$",
"this",
"->",
"related",
",",
"$",
"this",
"->",
"type",
")",
";",
"}"
] | Get all the edges of the given type and direction.
@return \Vinelab\NeoEloquent\Eloquent\Edges\Edge[In|Out] | [
"Get",
"all",
"the",
"edges",
"of",
"the",
"given",
"type",
"and",
"direction",
"."
] | train | https://github.com/Vinelab/NeoEloquent/blob/b9fc12d19122b2022116d95f9537ca4f5e9ca70c/src/Eloquent/Relations/HasOneOrMany.php#L120-L123 |
Vinelab/NeoEloquent | src/Eloquent/Relations/HasOneOrMany.php | HasOneOrMany.save | public function save(EloquentModel $model, array $properties = array())
{
$model->save() ? $model : false;
// Create a new edge relationship for both models
$edge = $this->getEdge($model, $properties);
// Save the edge
$edge->save();
return $edge;
} | php | public function save(EloquentModel $model, array $properties = array())
{
$model->save() ? $model : false;
// Create a new edge relationship for both models
$edge = $this->getEdge($model, $properties);
// Save the edge
$edge->save();
return $edge;
} | [
"public",
"function",
"save",
"(",
"EloquentModel",
"$",
"model",
",",
"array",
"$",
"properties",
"=",
"array",
"(",
")",
")",
"{",
"$",
"model",
"->",
"save",
"(",
")",
"?",
"$",
"model",
":",
"false",
";",
"// Create a new edge relationship for both model... | Attach a model instance to the parent model.
@param \Illuminate\Database\Eloquent\Model $model
@param array $properties The relationship properites
@return \Vinelab\NeoEloquent\Eloquent\Edges\Edge[In, Out, etc.] | [
"Attach",
"a",
"model",
"instance",
"to",
"the",
"parent",
"model",
"."
] | train | https://github.com/Vinelab/NeoEloquent/blob/b9fc12d19122b2022116d95f9537ca4f5e9ca70c/src/Eloquent/Relations/HasOneOrMany.php#L191-L200 |
Vinelab/NeoEloquent | src/Eloquent/Relations/HasOneOrMany.php | HasOneOrMany.create | public function create(array $attributes = [], array $properties = array())
{
// Here we will set the raw attributes to avoid hitting the "fill" method so
// that we do not have to worry about a mass accessor rules blocking sets
// on the models. Otherwise, some of these attributes will not ... | php | public function create(array $attributes = [], array $properties = array())
{
// Here we will set the raw attributes to avoid hitting the "fill" method so
// that we do not have to worry about a mass accessor rules blocking sets
// on the models. Otherwise, some of these attributes will not ... | [
"public",
"function",
"create",
"(",
"array",
"$",
"attributes",
"=",
"[",
"]",
",",
"array",
"$",
"properties",
"=",
"array",
"(",
")",
")",
"{",
"// Here we will set the raw attributes to avoid hitting the \"fill\" method so",
"// that we do not have to worry about a mass... | Create a new instance of the related model.
@param array $attributes
@param array $properties The relationship properites
@return \Vinelab\NeoEloquent\Eloquent\Model | [
"Create",
"a",
"new",
"instance",
"of",
"the",
"related",
"model",
"."
] | train | https://github.com/Vinelab/NeoEloquent/blob/b9fc12d19122b2022116d95f9537ca4f5e9ca70c/src/Eloquent/Relations/HasOneOrMany.php#L230-L238 |
Vinelab/NeoEloquent | src/Eloquent/Relations/HasOneOrMany.php | HasOneOrMany.createMany | public function createMany(array $records, array $properties = array())
{
$instances = new Collection;
foreach ($records as $record)
{
$instances->push($this->create($record, $properties));
}
return $instances;
} | php | public function createMany(array $records, array $properties = array())
{
$instances = new Collection;
foreach ($records as $record)
{
$instances->push($this->create($record, $properties));
}
return $instances;
} | [
"public",
"function",
"createMany",
"(",
"array",
"$",
"records",
",",
"array",
"$",
"properties",
"=",
"array",
"(",
")",
")",
"{",
"$",
"instances",
"=",
"new",
"Collection",
";",
"foreach",
"(",
"$",
"records",
"as",
"$",
"record",
")",
"{",
"$",
... | Create an array of new instances of the related model.
@param array $records
@param array $properties The relationship properites
@return array | [
"Create",
"an",
"array",
"of",
"new",
"instances",
"of",
"the",
"related",
"model",
"."
] | train | https://github.com/Vinelab/NeoEloquent/blob/b9fc12d19122b2022116d95f9537ca4f5e9ca70c/src/Eloquent/Relations/HasOneOrMany.php#L247-L257 |
Vinelab/NeoEloquent | src/Eloquent/Relations/HasOneOrMany.php | HasOneOrMany.attach | public function attach($id, array $attributes = array(), $touch = true)
{
$models = $id;
if ($id instanceof Model)
{
$models = [$id];
} elseif ($id instanceof Collection)
{
$models = $id->all();
} elseif ( ! $this->isArrayOfModels($id))
... | php | public function attach($id, array $attributes = array(), $touch = true)
{
$models = $id;
if ($id instanceof Model)
{
$models = [$id];
} elseif ($id instanceof Collection)
{
$models = $id->all();
} elseif ( ! $this->isArrayOfModels($id))
... | [
"public",
"function",
"attach",
"(",
"$",
"id",
",",
"array",
"$",
"attributes",
"=",
"array",
"(",
")",
",",
"$",
"touch",
"=",
"true",
")",
"{",
"$",
"models",
"=",
"$",
"id",
";",
"if",
"(",
"$",
"id",
"instanceof",
"Model",
")",
"{",
"$",
"... | Attach a model to the parent.
@param mixed $id
@param array $attributes
@param bool $touch
@return void | [
"Attach",
"a",
"model",
"to",
"the",
"parent",
"."
] | train | https://github.com/Vinelab/NeoEloquent/blob/b9fc12d19122b2022116d95f9537ca4f5e9ca70c/src/Eloquent/Relations/HasOneOrMany.php#L314-L341 |
Vinelab/NeoEloquent | src/Eloquent/Relations/HasOneOrMany.php | HasOneOrMany.sync | public function sync($ids, $detaching = true)
{
$changes = array(
'attached' => array(), 'detached' => array(), 'updated' => array()
);
// get them as collection
if ($ids instanceof Collection) $ids = $ids->modelKeys();
// First we need to attach the relationshi... | php | public function sync($ids, $detaching = true)
{
$changes = array(
'attached' => array(), 'detached' => array(), 'updated' => array()
);
// get them as collection
if ($ids instanceof Collection) $ids = $ids->modelKeys();
// First we need to attach the relationshi... | [
"public",
"function",
"sync",
"(",
"$",
"ids",
",",
"$",
"detaching",
"=",
"true",
")",
"{",
"$",
"changes",
"=",
"array",
"(",
"'attached'",
"=>",
"array",
"(",
")",
",",
"'detached'",
"=>",
"array",
"(",
")",
",",
"'updated'",
"=>",
"array",
"(",
... | Sync the intermediate tables with a list of IDs or collection of models.
@param $ids
@param bool $detaching
@return array | [
"Sync",
"the",
"intermediate",
"tables",
"with",
"a",
"list",
"of",
"IDs",
"or",
"collection",
"of",
"models",
"."
] | train | https://github.com/Vinelab/NeoEloquent/blob/b9fc12d19122b2022116d95f9537ca4f5e9ca70c/src/Eloquent/Relations/HasOneOrMany.php#L384-L433 |
Vinelab/NeoEloquent | src/Eloquent/Relations/HasOneOrMany.php | HasOneOrMany.updateEdge | public function updateEdge($id, array $properties)
{
$edge = $this->finder->first($this->parent, $this->related->findOrFail($id), $this->type);
$edge->fill($properties);
return $edge->save();
} | php | public function updateEdge($id, array $properties)
{
$edge = $this->finder->first($this->parent, $this->related->findOrFail($id), $this->type);
$edge->fill($properties);
return $edge->save();
} | [
"public",
"function",
"updateEdge",
"(",
"$",
"id",
",",
"array",
"$",
"properties",
")",
"{",
"$",
"edge",
"=",
"$",
"this",
"->",
"finder",
"->",
"first",
"(",
"$",
"this",
"->",
"parent",
",",
"$",
"this",
"->",
"related",
"->",
"findOrFail",
"(",... | Update an edge's properties.
@param int $id
@param array $properties
@return boolean | [
"Update",
"an",
"edge",
"s",
"properties",
"."
] | train | https://github.com/Vinelab/NeoEloquent/blob/b9fc12d19122b2022116d95f9537ca4f5e9ca70c/src/Eloquent/Relations/HasOneOrMany.php#L468-L473 |
Vinelab/NeoEloquent | src/Eloquent/Relations/HasOneOrMany.php | HasOneOrMany.formatSyncList | protected function formatSyncList(array $records)
{
$results = array();
foreach ($records as $id => $attributes)
{
if ( ! is_array($attributes))
{
list($id, $attributes) = array($attributes, array());
}
$results[$id] = $attrib... | php | protected function formatSyncList(array $records)
{
$results = array();
foreach ($records as $id => $attributes)
{
if ( ! is_array($attributes))
{
list($id, $attributes) = array($attributes, array());
}
$results[$id] = $attrib... | [
"protected",
"function",
"formatSyncList",
"(",
"array",
"$",
"records",
")",
"{",
"$",
"results",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"records",
"as",
"$",
"id",
"=>",
"$",
"attributes",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
... | Format the sync list so that it is keyed by ID.
@param array $records
@return array | [
"Format",
"the",
"sync",
"list",
"so",
"that",
"it",
"is",
"keyed",
"by",
"ID",
"."
] | train | https://github.com/Vinelab/NeoEloquent/blob/b9fc12d19122b2022116d95f9537ca4f5e9ca70c/src/Eloquent/Relations/HasOneOrMany.php#L481-L496 |
Vinelab/NeoEloquent | src/Eloquent/Relations/HasOneOrMany.php | HasOneOrMany.touchIfTouching | public function touchIfTouching()
{
if ($this->touchingParent()) $this->getParent()->touch();
if ($this->getParent()->touches($this->relation)) $this->touch();
} | php | public function touchIfTouching()
{
if ($this->touchingParent()) $this->getParent()->touch();
if ($this->getParent()->touches($this->relation)) $this->touch();
} | [
"public",
"function",
"touchIfTouching",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"touchingParent",
"(",
")",
")",
"$",
"this",
"->",
"getParent",
"(",
")",
"->",
"touch",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"getParent",
"(",
")",
"->"... | If we're touching the parent model, touch.
@return void | [
"If",
"we",
"re",
"touching",
"the",
"parent",
"model",
"touch",
"."
] | train | https://github.com/Vinelab/NeoEloquent/blob/b9fc12d19122b2022116d95f9537ca4f5e9ca70c/src/Eloquent/Relations/HasOneOrMany.php#L503-L508 |
Vinelab/NeoEloquent | src/Eloquent/Relations/HasOneOrMany.php | HasOneOrMany.modelsFromIds | public function modelsFromIds($ids)
{
// We need a Model in order to save this relationship so we try
// to whereIn the given id(s) through the related model.
return $this->related->whereIn($this->related->getKeyName(), (array) $ids)->get();
} | php | public function modelsFromIds($ids)
{
// We need a Model in order to save this relationship so we try
// to whereIn the given id(s) through the related model.
return $this->related->whereIn($this->related->getKeyName(), (array) $ids)->get();
} | [
"public",
"function",
"modelsFromIds",
"(",
"$",
"ids",
")",
"{",
"// We need a Model in order to save this relationship so we try",
"// to whereIn the given id(s) through the related model.",
"return",
"$",
"this",
"->",
"related",
"->",
"whereIn",
"(",
"$",
"this",
"->",
... | Get the related models out of their Ids.
@param array $ids
@return \Illuminate\Database\Eloquent\Collection | [
"Get",
"the",
"related",
"models",
"out",
"of",
"their",
"Ids",
"."
] | train | https://github.com/Vinelab/NeoEloquent/blob/b9fc12d19122b2022116d95f9537ca4f5e9ca70c/src/Eloquent/Relations/HasOneOrMany.php#L536-L541 |
Vinelab/NeoEloquent | src/Eloquent/Relations/HasOneOrMany.php | HasOneOrMany.isArrayOfModels | public function isArrayOfModels($models)
{
if ( ! is_array($models)) return false;
$notModels = array_filter($models, function($model)
{
return ! $model instanceof Model;
});
return empty($notModels);
} | php | public function isArrayOfModels($models)
{
if ( ! is_array($models)) return false;
$notModels = array_filter($models, function($model)
{
return ! $model instanceof Model;
});
return empty($notModels);
} | [
"public",
"function",
"isArrayOfModels",
"(",
"$",
"models",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"models",
")",
")",
"return",
"false",
";",
"$",
"notModels",
"=",
"array_filter",
"(",
"$",
"models",
",",
"function",
"(",
"$",
"model",
")",... | Determine whether the given array of models is actually
an array containing model instances. In case at least one
of the elements is not a Model this will return false.
@param array $models
@return boolean | [
"Determine",
"whether",
"the",
"given",
"array",
"of",
"models",
"is",
"actually",
"an",
"array",
"containing",
"model",
"instances",
".",
"In",
"case",
"at",
"least",
"one",
"of",
"the",
"elements",
"is",
"not",
"a",
"Model",
"this",
"will",
"return",
"fa... | train | https://github.com/Vinelab/NeoEloquent/blob/b9fc12d19122b2022116d95f9537ca4f5e9ca70c/src/Eloquent/Relations/HasOneOrMany.php#L551-L561 |
Vinelab/NeoEloquent | src/Query/Grammars/CypherGrammar.php | CypherGrammar.compileSelect | public function compileSelect(Builder $query)
{
if (is_null($query->columns)) $query->columns = array('*');
return trim($this->concatenate($this->compileComponents($query)));
} | php | public function compileSelect(Builder $query)
{
if (is_null($query->columns)) $query->columns = array('*');
return trim($this->concatenate($this->compileComponents($query)));
} | [
"public",
"function",
"compileSelect",
"(",
"Builder",
"$",
"query",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"query",
"->",
"columns",
")",
")",
"$",
"query",
"->",
"columns",
"=",
"array",
"(",
"'*'",
")",
";",
"return",
"trim",
"(",
"$",
"this",
... | Get the Cypher representation of the query.
@return string | [
"Get",
"the",
"Cypher",
"representation",
"of",
"the",
"query",
"."
] | train | https://github.com/Vinelab/NeoEloquent/blob/b9fc12d19122b2022116d95f9537ca4f5e9ca70c/src/Query/Grammars/CypherGrammar.php#L25-L30 |
Vinelab/NeoEloquent | src/Query/Grammars/CypherGrammar.php | CypherGrammar.compileComponents | protected function compileComponents(Builder $query, $specified = null)
{
$cypher = array();
$components = array();
// Setup the components that we need to compile
if ($specified)
{
// We support passing a string as well
// by turning it into an arra... | php | protected function compileComponents(Builder $query, $specified = null)
{
$cypher = array();
$components = array();
// Setup the components that we need to compile
if ($specified)
{
// We support passing a string as well
// by turning it into an arra... | [
"protected",
"function",
"compileComponents",
"(",
"Builder",
"$",
"query",
",",
"$",
"specified",
"=",
"null",
")",
"{",
"$",
"cypher",
"=",
"array",
"(",
")",
";",
"$",
"components",
"=",
"array",
"(",
")",
";",
"// Setup the components that we need to compi... | Compile the components necessary for a select clause.
@param \Vinelab\NeoEloquent\Query\Builder
@param array|string $specified You may specify a component to compile
@return array | [
"Compile",
"the",
"components",
"necessary",
"for",
"a",
"select",
"clause",
"."
] | train | https://github.com/Vinelab/NeoEloquent/blob/b9fc12d19122b2022116d95f9537ca4f5e9ca70c/src/Query/Grammars/CypherGrammar.php#L40-L76 |
Vinelab/NeoEloquent | src/Query/Grammars/CypherGrammar.php | CypherGrammar.compileComponent | protected function compileComponent(Builder $query, $components, $component)
{
$cypher = '';
// Let's make sure this is a proprietary component that we support
if ( ! in_array($component, $components))
{
throw new InvalidCypherGrammarComponentException($component);
... | php | protected function compileComponent(Builder $query, $components, $component)
{
$cypher = '';
// Let's make sure this is a proprietary component that we support
if ( ! in_array($component, $components))
{
throw new InvalidCypherGrammarComponentException($component);
... | [
"protected",
"function",
"compileComponent",
"(",
"Builder",
"$",
"query",
",",
"$",
"components",
",",
"$",
"component",
")",
"{",
"$",
"cypher",
"=",
"''",
";",
"// Let's make sure this is a proprietary component that we support",
"if",
"(",
"!",
"in_array",
"(",
... | Compile a single component.
@param \Illuminate\Database\Query\Builder $query
@param array $components
@param string $component
@return string | [
"Compile",
"a",
"single",
"component",
"."
] | train | https://github.com/Vinelab/NeoEloquent/blob/b9fc12d19122b2022116d95f9537ca4f5e9ca70c/src/Query/Grammars/CypherGrammar.php#L86-L107 |
Vinelab/NeoEloquent | src/Query/Grammars/CypherGrammar.php | CypherGrammar.compileMatches | public function compileMatches(Builder $query, $matches)
{
if ( ! is_array($matches) || empty($matches)) return '';
$prepared = array();
foreach ($matches as $match)
{
$method = 'prepareMatch'. ucfirst($match['type']);
$prepared[] = $this->$method($match);
... | php | public function compileMatches(Builder $query, $matches)
{
if ( ! is_array($matches) || empty($matches)) return '';
$prepared = array();
foreach ($matches as $match)
{
$method = 'prepareMatch'. ucfirst($match['type']);
$prepared[] = $this->$method($match);
... | [
"public",
"function",
"compileMatches",
"(",
"Builder",
"$",
"query",
",",
"$",
"matches",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"matches",
")",
"||",
"empty",
"(",
"$",
"matches",
")",
")",
"return",
"''",
";",
"$",
"prepared",
"=",
"array... | Compile the MATCH for a query with relationships.
@param \Illuminate\Database\Query\Builder $query
@param array $matches
@return string | [
"Compile",
"the",
"MATCH",
"for",
"a",
"query",
"with",
"relationships",
"."
] | train | https://github.com/Vinelab/NeoEloquent/blob/b9fc12d19122b2022116d95f9537ca4f5e9ca70c/src/Query/Grammars/CypherGrammar.php#L116-L129 |
Vinelab/NeoEloquent | src/Query/Grammars/CypherGrammar.php | CypherGrammar.prepareMatchRelation | public function prepareMatchRelation(array $match)
{
$parent = $match['parent'];
$related = $match['related'];
$property = $match['property'];
$direction = $match['direction'];
$relationship = $match['relationship'];
// Prepare labels for query... | php | public function prepareMatchRelation(array $match)
{
$parent = $match['parent'];
$related = $match['related'];
$property = $match['property'];
$direction = $match['direction'];
$relationship = $match['relationship'];
// Prepare labels for query... | [
"public",
"function",
"prepareMatchRelation",
"(",
"array",
"$",
"match",
")",
"{",
"$",
"parent",
"=",
"$",
"match",
"[",
"'parent'",
"]",
";",
"$",
"related",
"=",
"$",
"match",
"[",
"'related'",
"]",
";",
"$",
"property",
"=",
"$",
"match",
"[",
"... | Prepare a query for MATCH using
collected $matches of type Relation
@param array $match
@return string | [
"Prepare",
"a",
"query",
"for",
"MATCH",
"using",
"collected",
"$matches",
"of",
"type",
"Relation"
] | train | https://github.com/Vinelab/NeoEloquent/blob/b9fc12d19122b2022116d95f9537ca4f5e9ca70c/src/Query/Grammars/CypherGrammar.php#L138-L159 |
Vinelab/NeoEloquent | src/Query/Grammars/CypherGrammar.php | CypherGrammar.prepareMatchMorphTo | public function prepareMatchMorphTo(array $match)
{
$parent = $match['parent'];
$related = $match['related'];
$property = $match['property'];
$direction = $match['direction'];
// Prepare labels and node for query
$relatedNode = $related['node'];... | php | public function prepareMatchMorphTo(array $match)
{
$parent = $match['parent'];
$related = $match['related'];
$property = $match['property'];
$direction = $match['direction'];
// Prepare labels and node for query
$relatedNode = $related['node'];... | [
"public",
"function",
"prepareMatchMorphTo",
"(",
"array",
"$",
"match",
")",
"{",
"$",
"parent",
"=",
"$",
"match",
"[",
"'parent'",
"]",
";",
"$",
"related",
"=",
"$",
"match",
"[",
"'related'",
"]",
";",
"$",
"property",
"=",
"$",
"match",
"[",
"'... | Prepare a query for MATCH using
collected $matches of Type MorphTo
@param array $match
@return string | [
"Prepare",
"a",
"query",
"for",
"MATCH",
"using",
"collected",
"$matches",
"of",
"Type",
"MorphTo"
] | train | https://github.com/Vinelab/NeoEloquent/blob/b9fc12d19122b2022116d95f9537ca4f5e9ca70c/src/Query/Grammars/CypherGrammar.php#L168-L185 |
Vinelab/NeoEloquent | src/Query/Grammars/CypherGrammar.php | CypherGrammar.craftRelation | public function craftRelation($parentNode, $relationLabel, $relatedNode, $relatedLabels, $direction, $bare = false)
{
switch($direction)
{
case 'out':
default:
$relation = '(%s)-[%s]->%s';
break;
case 'in':
$relation = ... | php | public function craftRelation($parentNode, $relationLabel, $relatedNode, $relatedLabels, $direction, $bare = false)
{
switch($direction)
{
case 'out':
default:
$relation = '(%s)-[%s]->%s';
break;
case 'in':
$relation = ... | [
"public",
"function",
"craftRelation",
"(",
"$",
"parentNode",
",",
"$",
"relationLabel",
",",
"$",
"relatedNode",
",",
"$",
"relatedLabels",
",",
"$",
"direction",
",",
"$",
"bare",
"=",
"false",
")",
"{",
"switch",
"(",
"$",
"direction",
")",
"{",
"cas... | Craft a Cypher relationship of any type:
INCOMING, OUTGOING or BIDIRECTIONAL
examples:
---------
OUTGOING
[user:User]-[:POSTED]->[post:Post]
INCOMING
[phone:Phone]<-[:PHONE]-[owner:User]
BIDIRECTIONAL
[user:User]<-(:FOLLOWS)->[follower:User]
@param string $parentNode The parent Model's node placeholder
@param ... | [
"Craft",
"a",
"Cypher",
"relationship",
"of",
"any",
"type",
":",
"INCOMING",
"OUTGOING",
"or",
"BIDIRECTIONAL"
] | train | https://github.com/Vinelab/NeoEloquent/blob/b9fc12d19122b2022116d95f9537ca4f5e9ca70c/src/Query/Grammars/CypherGrammar.php#L209-L229 |
Vinelab/NeoEloquent | src/Query/Grammars/CypherGrammar.php | CypherGrammar.compileFrom | public function compileFrom(Builder $query, $labels)
{
// Only compile when no relational matches are specified,
// mostly used for simple queries.
if ( ! empty($query->matches)) return '';
// first we will check whether we need
// to reformat the labels from an array
... | php | public function compileFrom(Builder $query, $labels)
{
// Only compile when no relational matches are specified,
// mostly used for simple queries.
if ( ! empty($query->matches)) return '';
// first we will check whether we need
// to reformat the labels from an array
... | [
"public",
"function",
"compileFrom",
"(",
"Builder",
"$",
"query",
",",
"$",
"labels",
")",
"{",
"// Only compile when no relational matches are specified,",
"// mostly used for simple queries.",
"if",
"(",
"!",
"empty",
"(",
"$",
"query",
"->",
"matches",
")",
")",
... | Compile the "from" portion of the query
which in cypher represents the nodes we're MATCHing
@param \Vinelab\NeoEloquent\Query\Builder $query
@param string $labels
@return string | [
"Compile",
"the",
"from",
"portion",
"of",
"the",
"query",
"which",
"in",
"cypher",
"represents",
"the",
"nodes",
"we",
"re",
"MATCHing"
] | train | https://github.com/Vinelab/NeoEloquent/blob/b9fc12d19122b2022116d95f9537ca4f5e9ca70c/src/Query/Grammars/CypherGrammar.php#L240-L261 |
Vinelab/NeoEloquent | src/Query/Grammars/CypherGrammar.php | CypherGrammar.compileWheres | protected function compileWheres(Builder $query)
{
$cypher = array();
if (is_null($query->wheres)) return '';
// Each type of where clauses has its own compiler function which is responsible
// for actually creating the where clauses Cypher. This helps keep the code nice
//... | php | protected function compileWheres(Builder $query)
{
$cypher = array();
if (is_null($query->wheres)) return '';
// Each type of where clauses has its own compiler function which is responsible
// for actually creating the where clauses Cypher. This helps keep the code nice
//... | [
"protected",
"function",
"compileWheres",
"(",
"Builder",
"$",
"query",
")",
"{",
"$",
"cypher",
"=",
"array",
"(",
")",
";",
"if",
"(",
"is_null",
"(",
"$",
"query",
"->",
"wheres",
")",
")",
"return",
"''",
";",
"// Each type of where clauses has its own c... | Compile the "where" portions of the query.
@param \Vinelab\NeoEloquent\Query\Builder $query
@return string | [
"Compile",
"the",
"where",
"portions",
"of",
"the",
"query",
"."
] | train | https://github.com/Vinelab/NeoEloquent/blob/b9fc12d19122b2022116d95f9537ca4f5e9ca70c/src/Query/Grammars/CypherGrammar.php#L288-L315 |
Vinelab/NeoEloquent | src/Query/Grammars/CypherGrammar.php | CypherGrammar.whereBasic | protected function whereBasic(Builder $query, $where)
{
$value = $this->parameter($where);
return $this->wrap($where['column']).' '.$where['operator'].' '.$value;
} | php | protected function whereBasic(Builder $query, $where)
{
$value = $this->parameter($where);
return $this->wrap($where['column']).' '.$where['operator'].' '.$value;
} | [
"protected",
"function",
"whereBasic",
"(",
"Builder",
"$",
"query",
",",
"$",
"where",
")",
"{",
"$",
"value",
"=",
"$",
"this",
"->",
"parameter",
"(",
"$",
"where",
")",
";",
"return",
"$",
"this",
"->",
"wrap",
"(",
"$",
"where",
"[",
"'column'",... | Compile a basic where clause.
@param \Illuminate\Database\Query\Builder $query
@param array $where
@return string | [
"Compile",
"a",
"basic",
"where",
"clause",
"."
] | train | https://github.com/Vinelab/NeoEloquent/blob/b9fc12d19122b2022116d95f9537ca4f5e9ca70c/src/Query/Grammars/CypherGrammar.php#L324-L329 |
Vinelab/NeoEloquent | src/Query/Grammars/CypherGrammar.php | CypherGrammar.compileColumns | protected function compileColumns(Builder $query, $properties)
{
// When we have an aggregate we will have to return it instead of the plain columns
// since aggregates for Cypher are not calculated at the beginning of the query like SQL
// instead we'll have to return in a form such as: RET... | php | protected function compileColumns(Builder $query, $properties)
{
// When we have an aggregate we will have to return it instead of the plain columns
// since aggregates for Cypher are not calculated at the beginning of the query like SQL
// instead we'll have to return in a form such as: RET... | [
"protected",
"function",
"compileColumns",
"(",
"Builder",
"$",
"query",
",",
"$",
"properties",
")",
"{",
"// When we have an aggregate we will have to return it instead of the plain columns",
"// since aggregates for Cypher are not calculated at the beginning of the query like SQL",
"/... | Compile the "RETURN *" portion of the query.
@param \Vinelab\NeoEloquent\Query\Builder $query
@param array $columns
@return string | [
"Compile",
"the",
"RETURN",
"*",
"portion",
"of",
"the",
"query",
"."
] | train | https://github.com/Vinelab/NeoEloquent/blob/b9fc12d19122b2022116d95f9537ca4f5e9ca70c/src/Query/Grammars/CypherGrammar.php#L374-L395 |
Vinelab/NeoEloquent | src/Query/Grammars/CypherGrammar.php | CypherGrammar.compileUpdate | public function compileUpdate(Builder $query, $values)
{
// Each one of the columns in the update statements needs to be wrapped in the
// keyword identifiers, also a place-holder needs to be created for each of
// the values in the list of bindings so we can make the sets statements.
... | php | public function compileUpdate(Builder $query, $values)
{
// Each one of the columns in the update statements needs to be wrapped in the
// keyword identifiers, also a place-holder needs to be created for each of
// the values in the list of bindings so we can make the sets statements.
... | [
"public",
"function",
"compileUpdate",
"(",
"Builder",
"$",
"query",
",",
"$",
"values",
")",
"{",
"// Each one of the columns in the update statements needs to be wrapped in the",
"// keyword identifiers, also a place-holder needs to be created for each of",
"// the values in the list o... | Compile an update statement into SQL.
@param \Vinelab\NeoEloquent\Query\Builder $query
@param array $values
@return string | [
"Compile",
"an",
"update",
"statement",
"into",
"SQL",
"."
] | train | https://github.com/Vinelab/NeoEloquent/blob/b9fc12d19122b2022116d95f9537ca4f5e9ca70c/src/Query/Grammars/CypherGrammar.php#L418-L448 |
Vinelab/NeoEloquent | src/Query/Grammars/CypherGrammar.php | CypherGrammar.whereIn | protected function whereIn(Builder $query, $where)
{
$values = $this->valufy($where['values']);
return $this->wrap($where['column']).' IN ['.$values.']';
} | php | protected function whereIn(Builder $query, $where)
{
$values = $this->valufy($where['values']);
return $this->wrap($where['column']).' IN ['.$values.']';
} | [
"protected",
"function",
"whereIn",
"(",
"Builder",
"$",
"query",
",",
"$",
"where",
")",
"{",
"$",
"values",
"=",
"$",
"this",
"->",
"valufy",
"(",
"$",
"where",
"[",
"'values'",
"]",
")",
";",
"return",
"$",
"this",
"->",
"wrap",
"(",
"$",
"where... | Compile a "where in" clause.
@param \Illuminate\Database\Query\Builder $query
@param array $where
@return string | [
"Compile",
"a",
"where",
"in",
"clause",
"."
] | train | https://github.com/Vinelab/NeoEloquent/blob/b9fc12d19122b2022116d95f9537ca4f5e9ca70c/src/Query/Grammars/CypherGrammar.php#L457-L462 |
Vinelab/NeoEloquent | src/Query/Grammars/CypherGrammar.php | CypherGrammar.compileDelete | public function compileDelete(Builder $query)
{
// We always need the MATCH clause in our Cypher which
// is the responsibility of compiling the From component.
$match = $this->compileComponents($query, array('from'));
$match = $match['from'];
$where = is_array($query->where... | php | public function compileDelete(Builder $query)
{
// We always need the MATCH clause in our Cypher which
// is the responsibility of compiling the From component.
$match = $this->compileComponents($query, array('from'));
$match = $match['from'];
$where = is_array($query->where... | [
"public",
"function",
"compileDelete",
"(",
"Builder",
"$",
"query",
")",
"{",
"// We always need the MATCH clause in our Cypher which",
"// is the responsibility of compiling the From component.",
"$",
"match",
"=",
"$",
"this",
"->",
"compileComponents",
"(",
"$",
"query",
... | Compile a delete statement into Cypher.
@param \Illuminate\Database\Query\Builder $query
@return string | [
"Compile",
"a",
"delete",
"statement",
"into",
"Cypher",
"."
] | train | https://github.com/Vinelab/NeoEloquent/blob/b9fc12d19122b2022116d95f9537ca4f5e9ca70c/src/Query/Grammars/CypherGrammar.php#L470-L482 |
Vinelab/NeoEloquent | src/Query/Grammars/CypherGrammar.php | CypherGrammar.compileInsert | public function compileInsert(Builder $query, array $values)
{
/**
* Essentially we will force every insert to be treated as a batch insert which
* simply makes creating the Cypher easier for us since we can utilize the same
* basic routine regardless of an amount of records give... | php | public function compileInsert(Builder $query, array $values)
{
/**
* Essentially we will force every insert to be treated as a batch insert which
* simply makes creating the Cypher easier for us since we can utilize the same
* basic routine regardless of an amount of records give... | [
"public",
"function",
"compileInsert",
"(",
"Builder",
"$",
"query",
",",
"array",
"$",
"values",
")",
"{",
"/**\n * Essentially we will force every insert to be treated as a batch insert which\n * simply makes creating the Cypher easier for us since we can utilize the sam... | Compile an insert statement into Cypher.
@param \Illuminate\Database\Query\Builder $query
@param array $values
@return string | [
"Compile",
"an",
"insert",
"statement",
"into",
"Cypher",
"."
] | train | https://github.com/Vinelab/NeoEloquent/blob/b9fc12d19122b2022116d95f9537ca4f5e9ca70c/src/Query/Grammars/CypherGrammar.php#L506-L537 |
Vinelab/NeoEloquent | src/Query/Grammars/CypherGrammar.php | CypherGrammar.compileCreateWith | public function compileCreateWith(Builder $query, $create)
{
$model = $create['model'];
$related = $create['related'];
$identifier = true; // indicates that we this entity requires an identifier for prepareEntity.
// Prepare the parent model as a query entity with an identifier to... | php | public function compileCreateWith(Builder $query, $create)
{
$model = $create['model'];
$related = $create['related'];
$identifier = true; // indicates that we this entity requires an identifier for prepareEntity.
// Prepare the parent model as a query entity with an identifier to... | [
"public",
"function",
"compileCreateWith",
"(",
"Builder",
"$",
"query",
",",
"$",
"create",
")",
"{",
"$",
"model",
"=",
"$",
"create",
"[",
"'model'",
"]",
";",
"$",
"related",
"=",
"$",
"create",
"[",
"'related'",
"]",
";",
"$",
"identifier",
"=",
... | Compile a query that creates multiple nodes of multiple model types related all together.
@param \Vinelab\NeoEloquent\Query\Builder $query
@param array $create
@return string | [
"Compile",
"a",
"query",
"that",
"creates",
"multiple",
"nodes",
"of",
"multiple",
"model",
"types",
"related",
"all",
"together",
"."
] | train | https://github.com/Vinelab/NeoEloquent/blob/b9fc12d19122b2022116d95f9537ca4f5e9ca70c/src/Query/Grammars/CypherGrammar.php#L546-L655 |
Vinelab/NeoEloquent | src/Query/Grammars/CypherGrammar.php | CypherGrammar.compileUpdateLabels | public function compileUpdateLabels(Builder $query, $labels, $operation = 'add' )
{
if(trim(strtolower($operation)) == 'add')
{
$updateType = 'SET';
} else
{
$updateType = 'REMOVE';
}
// Each one of the columns in the update statements needs to... | php | public function compileUpdateLabels(Builder $query, $labels, $operation = 'add' )
{
if(trim(strtolower($operation)) == 'add')
{
$updateType = 'SET';
} else
{
$updateType = 'REMOVE';
}
// Each one of the columns in the update statements needs to... | [
"public",
"function",
"compileUpdateLabels",
"(",
"Builder",
"$",
"query",
",",
"$",
"labels",
",",
"$",
"operation",
"=",
"'add'",
")",
"{",
"if",
"(",
"trim",
"(",
"strtolower",
"(",
"$",
"operation",
")",
")",
"==",
"'add'",
")",
"{",
"$",
"updateTy... | Compile an statement to add or drop node labels
@param \Vinelab\NeoEloquent\Query\Builder $query
@param array $labels labels as string like :label1:label2 etc
@param array $operation type of operation 'add' or 'drop'
@return string | [
"Compile",
"an",
"statement",
"to",
"add",
"or",
"drop",
"node",
"labels"
] | train | https://github.com/Vinelab/NeoEloquent/blob/b9fc12d19122b2022116d95f9537ca4f5e9ca70c/src/Query/Grammars/CypherGrammar.php#L692-L718 |
Vinelab/NeoEloquent | src/Eloquent/Relations/MorphTo.php | MorphTo.addConstraints | public function addConstraints()
{
if (static::$constraints)
{
// Get the parent node's placeholder.
$parentNode = $this->query->getQuery()->modelAsNode($this->parent->getTable());
// Tell the query that we need the morph model and the relationship represented by ... | php | public function addConstraints()
{
if (static::$constraints)
{
// Get the parent node's placeholder.
$parentNode = $this->query->getQuery()->modelAsNode($this->parent->getTable());
// Tell the query that we need the morph model and the relationship represented by ... | [
"public",
"function",
"addConstraints",
"(",
")",
"{",
"if",
"(",
"static",
"::",
"$",
"constraints",
")",
"{",
"// Get the parent node's placeholder.",
"$",
"parentNode",
"=",
"$",
"this",
"->",
"query",
"->",
"getQuery",
"(",
")",
"->",
"modelAsNode",
"(",
... | Set the base constraints on the relation query.
@return void | [
"Set",
"the",
"base",
"constraints",
"on",
"the",
"relation",
"query",
"."
] | train | https://github.com/Vinelab/NeoEloquent/blob/b9fc12d19122b2022116d95f9537ca4f5e9ca70c/src/Eloquent/Relations/MorphTo.php#L37-L57 |
Vinelab/NeoEloquent | src/Eloquent/Relations/MorphTo.php | MorphTo.addEagerConstraints | public function addEagerConstraints(array $models)
{
// Get the parent node's placeholder.
$parentNode = $this->query->getQuery()->modelAsNode($this->parent->getTable());
// Tell the query that we need the morph model and the relationship represented by CypherGrammar
// statically wi... | php | public function addEagerConstraints(array $models)
{
// Get the parent node's placeholder.
$parentNode = $this->query->getQuery()->modelAsNode($this->parent->getTable());
// Tell the query that we need the morph model and the relationship represented by CypherGrammar
// statically wi... | [
"public",
"function",
"addEagerConstraints",
"(",
"array",
"$",
"models",
")",
"{",
"// Get the parent node's placeholder.",
"$",
"parentNode",
"=",
"$",
"this",
"->",
"query",
"->",
"getQuery",
"(",
")",
"->",
"modelAsNode",
"(",
"$",
"this",
"->",
"parent",
... | Set the constraints for an eager load of the relation.
@param array $models
@return void | [
"Set",
"the",
"constraints",
"for",
"an",
"eager",
"load",
"of",
"the",
"relation",
"."
] | train | https://github.com/Vinelab/NeoEloquent/blob/b9fc12d19122b2022116d95f9537ca4f5e9ca70c/src/Eloquent/Relations/MorphTo.php#L65-L83 |
Vinelab/NeoEloquent | src/Eloquent/Relations/MorphTo.php | MorphTo.match | public function match(array $models, Collection $results, $relation)
{
// This relationship deals with a One-To-One morph type so we'll just extract
// the first model out of the results and return it.
$matched = parent::match($models, $results, $relation);
return array_map(function... | php | public function match(array $models, Collection $results, $relation)
{
// This relationship deals with a One-To-One morph type so we'll just extract
// the first model out of the results and return it.
$matched = parent::match($models, $results, $relation);
return array_map(function... | [
"public",
"function",
"match",
"(",
"array",
"$",
"models",
",",
"Collection",
"$",
"results",
",",
"$",
"relation",
")",
"{",
"// This relationship deals with a One-To-One morph type so we'll just extract",
"// the first model out of the results and return it.",
"$",
"matched"... | Match the eagerly loaded results to their parents.
@param array $models
@param \Illuminate\Database\Eloquent\Collection $results
@param string $relation
@return array | [
"Match",
"the",
"eagerly",
"loaded",
"results",
"to",
"their",
"parents",
"."
] | train | https://github.com/Vinelab/NeoEloquent/blob/b9fc12d19122b2022116d95f9537ca4f5e9ca70c/src/Eloquent/Relations/MorphTo.php#L93-L109 |
creof/doctrine2-spatial | lib/CrEOF/Spatial/DBAL/Platform/PostgreSql.php | PostgreSql.getSQLDeclaration | public function getSQLDeclaration(array $fieldDeclaration)
{
$typeFamily = $fieldDeclaration['type']->getTypeFamily();
$sqlType = $fieldDeclaration['type']->getSQLType();
if ($typeFamily === $sqlType) {
return $sqlType;
}
if (isset($fieldDeclaration['srid']))... | php | public function getSQLDeclaration(array $fieldDeclaration)
{
$typeFamily = $fieldDeclaration['type']->getTypeFamily();
$sqlType = $fieldDeclaration['type']->getSQLType();
if ($typeFamily === $sqlType) {
return $sqlType;
}
if (isset($fieldDeclaration['srid']))... | [
"public",
"function",
"getSQLDeclaration",
"(",
"array",
"$",
"fieldDeclaration",
")",
"{",
"$",
"typeFamily",
"=",
"$",
"fieldDeclaration",
"[",
"'type'",
"]",
"->",
"getTypeFamily",
"(",
")",
";",
"$",
"sqlType",
"=",
"$",
"fieldDeclaration",
"[",
"'type'",
... | Gets the SQL declaration snippet for a field of this type.
@param array $fieldDeclaration
@return string | [
"Gets",
"the",
"SQL",
"declaration",
"snippet",
"for",
"a",
"field",
"of",
"this",
"type",
"."
] | train | https://github.com/creof/doctrine2-spatial/blob/58ea5fae1c1b450ee08d7dac25cd9e8f5e6fdebd/lib/CrEOF/Spatial/DBAL/Platform/PostgreSql.php#L48-L62 |
creof/doctrine2-spatial | lib/CrEOF/Spatial/DBAL/Platform/PostgreSql.php | PostgreSql.convertToPHPValueSQL | public function convertToPHPValueSQL(AbstractSpatialType $type, $sqlExpr)
{
if ($type instanceof GeographyType) {
return sprintf('ST_AsEWKT(%s)', $sqlExpr);
}
return sprintf('ST_AsEWKB(%s)', $sqlExpr);
} | php | public function convertToPHPValueSQL(AbstractSpatialType $type, $sqlExpr)
{
if ($type instanceof GeographyType) {
return sprintf('ST_AsEWKT(%s)', $sqlExpr);
}
return sprintf('ST_AsEWKB(%s)', $sqlExpr);
} | [
"public",
"function",
"convertToPHPValueSQL",
"(",
"AbstractSpatialType",
"$",
"type",
",",
"$",
"sqlExpr",
")",
"{",
"if",
"(",
"$",
"type",
"instanceof",
"GeographyType",
")",
"{",
"return",
"sprintf",
"(",
"'ST_AsEWKT(%s)'",
",",
"$",
"sqlExpr",
")",
";",
... | @param AbstractSpatialType $type
@param string $sqlExpr
@return string | [
"@param",
"AbstractSpatialType",
"$type",
"@param",
"string",
"$sqlExpr"
] | train | https://github.com/creof/doctrine2-spatial/blob/58ea5fae1c1b450ee08d7dac25cd9e8f5e6fdebd/lib/CrEOF/Spatial/DBAL/Platform/PostgreSql.php#L70-L77 |
creof/doctrine2-spatial | lib/CrEOF/Spatial/DBAL/Platform/PostgreSql.php | PostgreSql.convertToDatabaseValueSQL | public function convertToDatabaseValueSQL(AbstractSpatialType $type, $sqlExpr)
{
if ($type instanceof GeographyType) {
return sprintf('ST_GeographyFromText(%s)', $sqlExpr);
}
return sprintf('ST_GeomFromEWKT(%s)', $sqlExpr);
} | php | public function convertToDatabaseValueSQL(AbstractSpatialType $type, $sqlExpr)
{
if ($type instanceof GeographyType) {
return sprintf('ST_GeographyFromText(%s)', $sqlExpr);
}
return sprintf('ST_GeomFromEWKT(%s)', $sqlExpr);
} | [
"public",
"function",
"convertToDatabaseValueSQL",
"(",
"AbstractSpatialType",
"$",
"type",
",",
"$",
"sqlExpr",
")",
"{",
"if",
"(",
"$",
"type",
"instanceof",
"GeographyType",
")",
"{",
"return",
"sprintf",
"(",
"'ST_GeographyFromText(%s)'",
",",
"$",
"sqlExpr",... | @param AbstractSpatialType $type
@param string $sqlExpr
@return string | [
"@param",
"AbstractSpatialType",
"$type",
"@param",
"string",
"$sqlExpr"
] | train | https://github.com/creof/doctrine2-spatial/blob/58ea5fae1c1b450ee08d7dac25cd9e8f5e6fdebd/lib/CrEOF/Spatial/DBAL/Platform/PostgreSql.php#L85-L92 |
creof/doctrine2-spatial | lib/CrEOF/Spatial/DBAL/Platform/PostgreSql.php | PostgreSql.convertBinaryToPHPValue | public function convertBinaryToPHPValue(AbstractSpatialType $type, $sqlExpr)
{
if (! is_resource($sqlExpr)) {
throw new InvalidValueException(sprintf('Invalid resource value "%s"', $sqlExpr));
}
$sqlExpr = stream_get_contents($sqlExpr);
return parent::convertBinaryToPHP... | php | public function convertBinaryToPHPValue(AbstractSpatialType $type, $sqlExpr)
{
if (! is_resource($sqlExpr)) {
throw new InvalidValueException(sprintf('Invalid resource value "%s"', $sqlExpr));
}
$sqlExpr = stream_get_contents($sqlExpr);
return parent::convertBinaryToPHP... | [
"public",
"function",
"convertBinaryToPHPValue",
"(",
"AbstractSpatialType",
"$",
"type",
",",
"$",
"sqlExpr",
")",
"{",
"if",
"(",
"!",
"is_resource",
"(",
"$",
"sqlExpr",
")",
")",
"{",
"throw",
"new",
"InvalidValueException",
"(",
"sprintf",
"(",
"'Invalid ... | @param AbstractSpatialType $type
@param string $sqlExpr
@return GeometryInterface
@throws InvalidValueException | [
"@param",
"AbstractSpatialType",
"$type",
"@param",
"string",
"$sqlExpr"
] | train | https://github.com/creof/doctrine2-spatial/blob/58ea5fae1c1b450ee08d7dac25cd9e8f5e6fdebd/lib/CrEOF/Spatial/DBAL/Platform/PostgreSql.php#L101-L110 |
creof/doctrine2-spatial | lib/CrEOF/Spatial/DBAL/Platform/PostgreSql.php | PostgreSql.convertToDatabaseValue | public function convertToDatabaseValue(AbstractSpatialType $type, GeometryInterface $value)
{
$sridSQL = null;
if ($type instanceof GeographyType && null === $value->getSrid()) {
$value->setSrid(self::DEFAULT_SRID);
}
if (($srid = $value->getSrid()) !== null || $type in... | php | public function convertToDatabaseValue(AbstractSpatialType $type, GeometryInterface $value)
{
$sridSQL = null;
if ($type instanceof GeographyType && null === $value->getSrid()) {
$value->setSrid(self::DEFAULT_SRID);
}
if (($srid = $value->getSrid()) !== null || $type in... | [
"public",
"function",
"convertToDatabaseValue",
"(",
"AbstractSpatialType",
"$",
"type",
",",
"GeometryInterface",
"$",
"value",
")",
"{",
"$",
"sridSQL",
"=",
"null",
";",
"if",
"(",
"$",
"type",
"instanceof",
"GeographyType",
"&&",
"null",
"===",
"$",
"value... | @param AbstractSpatialType $type
@param GeometryInterface $value
@return string | [
"@param",
"AbstractSpatialType",
"$type",
"@param",
"GeometryInterface",
"$value"
] | train | https://github.com/creof/doctrine2-spatial/blob/58ea5fae1c1b450ee08d7dac25cd9e8f5e6fdebd/lib/CrEOF/Spatial/DBAL/Platform/PostgreSql.php#L118-L131 |
creof/doctrine2-spatial | lib/CrEOF/Spatial/ORM/Query/AST/Functions/AbstractSpatialDQLFunction.php | AbstractSpatialDQLFunction.getSql | public function getSql(SqlWalker $sqlWalker)
{
$this->validatePlatform($sqlWalker->getConnection()->getDatabasePlatform());
$arguments = array();
foreach ($this->geomExpr as $expression) {
$arguments[] = $expression->dispatch($sqlWalker);
}
return sprintf('%s(%s... | php | public function getSql(SqlWalker $sqlWalker)
{
$this->validatePlatform($sqlWalker->getConnection()->getDatabasePlatform());
$arguments = array();
foreach ($this->geomExpr as $expression) {
$arguments[] = $expression->dispatch($sqlWalker);
}
return sprintf('%s(%s... | [
"public",
"function",
"getSql",
"(",
"SqlWalker",
"$",
"sqlWalker",
")",
"{",
"$",
"this",
"->",
"validatePlatform",
"(",
"$",
"sqlWalker",
"->",
"getConnection",
"(",
")",
"->",
"getDatabasePlatform",
"(",
")",
")",
";",
"$",
"arguments",
"=",
"array",
"(... | @param SqlWalker $sqlWalker
@return string | [
"@param",
"SqlWalker",
"$sqlWalker"
] | train | https://github.com/creof/doctrine2-spatial/blob/58ea5fae1c1b450ee08d7dac25cd9e8f5e6fdebd/lib/CrEOF/Spatial/ORM/Query/AST/Functions/AbstractSpatialDQLFunction.php#L93-L103 |
creof/doctrine2-spatial | lib/CrEOF/Spatial/ORM/Query/AST/Functions/AbstractSpatialDQLFunction.php | AbstractSpatialDQLFunction.validatePlatform | protected function validatePlatform(AbstractPlatform $platform)
{
$platformName = $platform->getName();
if (isset($this->platforms) && !in_array($platformName, $this->platforms)) {
throw new UnsupportedPlatformException(
sprintf('DBAL platform "%s" is not currently suppo... | php | protected function validatePlatform(AbstractPlatform $platform)
{
$platformName = $platform->getName();
if (isset($this->platforms) && !in_array($platformName, $this->platforms)) {
throw new UnsupportedPlatformException(
sprintf('DBAL platform "%s" is not currently suppo... | [
"protected",
"function",
"validatePlatform",
"(",
"AbstractPlatform",
"$",
"platform",
")",
"{",
"$",
"platformName",
"=",
"$",
"platform",
"->",
"getName",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"platforms",
")",
"&&",
"!",
"in_array",... | @param AbstractPlatform $platform
@throws UnsupportedPlatformException | [
"@param",
"AbstractPlatform",
"$platform"
] | train | https://github.com/creof/doctrine2-spatial/blob/58ea5fae1c1b450ee08d7dac25cd9e8f5e6fdebd/lib/CrEOF/Spatial/ORM/Query/AST/Functions/AbstractSpatialDQLFunction.php#L110-L119 |
creof/doctrine2-spatial | lib/CrEOF/Spatial/PHP/Types/AbstractPoint.php | AbstractPoint.validateArguments | protected function validateArguments(array $argv = null)
{
$argc = count($argv);
if (1 == $argc && is_array($argv[0])) {
return $argv[0];
}
if (2 == $argc) {
if (is_array($argv[0]) && (is_numeric($argv[1]) || is_null($argv[1]) || is_string($argv[1]))) {
... | php | protected function validateArguments(array $argv = null)
{
$argc = count($argv);
if (1 == $argc && is_array($argv[0])) {
return $argv[0];
}
if (2 == $argc) {
if (is_array($argv[0]) && (is_numeric($argv[1]) || is_null($argv[1]) || is_string($argv[1]))) {
... | [
"protected",
"function",
"validateArguments",
"(",
"array",
"$",
"argv",
"=",
"null",
")",
"{",
"$",
"argc",
"=",
"count",
"(",
"$",
"argv",
")",
";",
"if",
"(",
"1",
"==",
"$",
"argc",
"&&",
"is_array",
"(",
"$",
"argv",
"[",
"0",
"]",
")",
")",... | @param array $argv
@return array
@throws InvalidValueException | [
"@param",
"array",
"$argv"
] | train | https://github.com/creof/doctrine2-spatial/blob/58ea5fae1c1b450ee08d7dac25cd9e8f5e6fdebd/lib/CrEOF/Spatial/PHP/Types/AbstractPoint.php#L176-L211 |
creof/doctrine2-spatial | lib/CrEOF/Spatial/PHP/Types/AbstractMultiPoint.php | AbstractMultiPoint.getPoint | public function getPoint($index)
{
switch ($index) {
case -1:
$point = $this->points[count($this->points) - 1];
break;
default:
$point = $this->points[$index];
break;
}
$pointClass = $this->getNamespace(... | php | public function getPoint($index)
{
switch ($index) {
case -1:
$point = $this->points[count($this->points) - 1];
break;
default:
$point = $this->points[$index];
break;
}
$pointClass = $this->getNamespace(... | [
"public",
"function",
"getPoint",
"(",
"$",
"index",
")",
"{",
"switch",
"(",
"$",
"index",
")",
"{",
"case",
"-",
"1",
":",
"$",
"point",
"=",
"$",
"this",
"->",
"points",
"[",
"count",
"(",
"$",
"this",
"->",
"points",
")",
"-",
"1",
"]",
";"... | @param int $index
@return AbstractPoint | [
"@param",
"int",
"$index"
] | train | https://github.com/creof/doctrine2-spatial/blob/58ea5fae1c1b450ee08d7dac25cd9e8f5e6fdebd/lib/CrEOF/Spatial/PHP/Types/AbstractMultiPoint.php#L95-L109 |
creof/doctrine2-spatial | lib/CrEOF/Spatial/DBAL/Types/AbstractSpatialType.php | AbstractSpatialType.getSQLType | public function getSQLType()
{
$class = get_class($this);
$start = strrpos($class, '\\') + 1;
$len = strlen($class) - $start - 4;
return substr($class, strrpos($class, '\\') + 1, $len);
} | php | public function getSQLType()
{
$class = get_class($this);
$start = strrpos($class, '\\') + 1;
$len = strlen($class) - $start - 4;
return substr($class, strrpos($class, '\\') + 1, $len);
} | [
"public",
"function",
"getSQLType",
"(",
")",
"{",
"$",
"class",
"=",
"get_class",
"(",
"$",
"this",
")",
";",
"$",
"start",
"=",
"strrpos",
"(",
"$",
"class",
",",
"'\\\\'",
")",
"+",
"1",
";",
"$",
"len",
"=",
"strlen",
"(",
"$",
"class",
")",
... | Gets the SQL name of this type.
@return string | [
"Gets",
"the",
"SQL",
"name",
"of",
"this",
"type",
"."
] | train | https://github.com/creof/doctrine2-spatial/blob/58ea5fae1c1b450ee08d7dac25cd9e8f5e6fdebd/lib/CrEOF/Spatial/DBAL/Types/AbstractSpatialType.php#L58-L65 |
creof/doctrine2-spatial | lib/CrEOF/Spatial/DBAL/Types/AbstractSpatialType.php | AbstractSpatialType.convertToDatabaseValue | public function convertToDatabaseValue($value, AbstractPlatform $platform)
{
if ($value === null) {
return $value;
}
if (! ($value instanceof GeometryInterface)) {
throw new InvalidValueException('Geometry column values must implement GeometryInterface');
}
... | php | public function convertToDatabaseValue($value, AbstractPlatform $platform)
{
if ($value === null) {
return $value;
}
if (! ($value instanceof GeometryInterface)) {
throw new InvalidValueException('Geometry column values must implement GeometryInterface');
}
... | [
"public",
"function",
"convertToDatabaseValue",
"(",
"$",
"value",
",",
"AbstractPlatform",
"$",
"platform",
")",
"{",
"if",
"(",
"$",
"value",
"===",
"null",
")",
"{",
"return",
"$",
"value",
";",
"}",
"if",
"(",
"!",
"(",
"$",
"value",
"instanceof",
... | Converts a value from its PHP representation to its database representation of this type.
@param mixed $value
@param AbstractPlatform $platform
@return mixed
@throws InvalidValueException
@throws UnsupportedPlatformException | [
"Converts",
"a",
"value",
"from",
"its",
"PHP",
"representation",
"to",
"its",
"database",
"representation",
"of",
"this",
"type",
"."
] | train | https://github.com/creof/doctrine2-spatial/blob/58ea5fae1c1b450ee08d7dac25cd9e8f5e6fdebd/lib/CrEOF/Spatial/DBAL/Types/AbstractSpatialType.php#L85-L96 |
creof/doctrine2-spatial | lib/CrEOF/Spatial/DBAL/Types/AbstractSpatialType.php | AbstractSpatialType.convertToDatabaseValueSQL | public function convertToDatabaseValueSQL($sqlExpr, AbstractPlatform $platform)
{
return $this->getSpatialPlatform($platform)->convertToDatabaseValueSQL($this, $sqlExpr);
} | php | public function convertToDatabaseValueSQL($sqlExpr, AbstractPlatform $platform)
{
return $this->getSpatialPlatform($platform)->convertToDatabaseValueSQL($this, $sqlExpr);
} | [
"public",
"function",
"convertToDatabaseValueSQL",
"(",
"$",
"sqlExpr",
",",
"AbstractPlatform",
"$",
"platform",
")",
"{",
"return",
"$",
"this",
"->",
"getSpatialPlatform",
"(",
"$",
"platform",
")",
"->",
"convertToDatabaseValueSQL",
"(",
"$",
"this",
",",
"$... | Modifies the SQL expression (identifier, parameter) to convert to a database value.
@param string $sqlExpr
@param AbstractPlatform $platform
@return string | [
"Modifies",
"the",
"SQL",
"expression",
"(",
"identifier",
"parameter",
")",
"to",
"convert",
"to",
"a",
"database",
"value",
"."
] | train | https://github.com/creof/doctrine2-spatial/blob/58ea5fae1c1b450ee08d7dac25cd9e8f5e6fdebd/lib/CrEOF/Spatial/DBAL/Types/AbstractSpatialType.php#L119-L122 |
creof/doctrine2-spatial | lib/CrEOF/Spatial/DBAL/Types/AbstractSpatialType.php | AbstractSpatialType.convertToPHPValue | public function convertToPHPValue($value, AbstractPlatform $platform)
{
if (null === $value) {
return null;
}
if (ctype_alpha($value[0])) {
return $this->getSpatialPlatform($platform)->convertStringToPHPValue($this, $value);
}
return $this->getSpatia... | php | public function convertToPHPValue($value, AbstractPlatform $platform)
{
if (null === $value) {
return null;
}
if (ctype_alpha($value[0])) {
return $this->getSpatialPlatform($platform)->convertStringToPHPValue($this, $value);
}
return $this->getSpatia... | [
"public",
"function",
"convertToPHPValue",
"(",
"$",
"value",
",",
"AbstractPlatform",
"$",
"platform",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"value",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"ctype_alpha",
"(",
"$",
"value",
"[",
"0",
"]",
... | Converts a value from its database representation to its PHP representation of this type.
@param mixed $value
@param AbstractPlatform $platform
@return mixed | [
"Converts",
"a",
"value",
"from",
"its",
"database",
"representation",
"to",
"its",
"PHP",
"representation",
"of",
"this",
"type",
"."
] | train | https://github.com/creof/doctrine2-spatial/blob/58ea5fae1c1b450ee08d7dac25cd9e8f5e6fdebd/lib/CrEOF/Spatial/DBAL/Types/AbstractSpatialType.php#L132-L143 |
creof/doctrine2-spatial | lib/CrEOF/Spatial/DBAL/Types/AbstractSpatialType.php | AbstractSpatialType.getSpatialPlatform | private function getSpatialPlatform(AbstractPlatform $platform)
{
$const = sprintf('self::PLATFORM_%s', strtoupper($platform->getName()));
if (! defined($const)) {
throw new UnsupportedPlatformException(sprintf('DBAL platform "%s" is not currently supported.', $platform->getName()));
... | php | private function getSpatialPlatform(AbstractPlatform $platform)
{
$const = sprintf('self::PLATFORM_%s', strtoupper($platform->getName()));
if (! defined($const)) {
throw new UnsupportedPlatformException(sprintf('DBAL platform "%s" is not currently supported.', $platform->getName()));
... | [
"private",
"function",
"getSpatialPlatform",
"(",
"AbstractPlatform",
"$",
"platform",
")",
"{",
"$",
"const",
"=",
"sprintf",
"(",
"'self::PLATFORM_%s'",
",",
"strtoupper",
"(",
"$",
"platform",
"->",
"getName",
"(",
")",
")",
")",
";",
"if",
"(",
"!",
"d... | @param AbstractPlatform $platform
@return PlatformInterface
@throws UnsupportedPlatformException | [
"@param",
"AbstractPlatform",
"$platform"
] | train | https://github.com/creof/doctrine2-spatial/blob/58ea5fae1c1b450ee08d7dac25cd9e8f5e6fdebd/lib/CrEOF/Spatial/DBAL/Types/AbstractSpatialType.php#L202-L213 |
creof/doctrine2-spatial | lib/CrEOF/Spatial/PHP/Types/AbstractPolygon.php | AbstractPolygon.getRing | public function getRing($index)
{
if (-1 == $index) {
$index = count($this->rings) - 1;
}
$lineStringClass = $this->getNamespace() . '\LineString';
return new $lineStringClass($this->rings[$index], $this->srid);
} | php | public function getRing($index)
{
if (-1 == $index) {
$index = count($this->rings) - 1;
}
$lineStringClass = $this->getNamespace() . '\LineString';
return new $lineStringClass($this->rings[$index], $this->srid);
} | [
"public",
"function",
"getRing",
"(",
"$",
"index",
")",
"{",
"if",
"(",
"-",
"1",
"==",
"$",
"index",
")",
"{",
"$",
"index",
"=",
"count",
"(",
"$",
"this",
"->",
"rings",
")",
"-",
"1",
";",
"}",
"$",
"lineStringClass",
"=",
"$",
"this",
"->... | @param int $index
@return AbstractLineString | [
"@param",
"int",
"$index"
] | train | https://github.com/creof/doctrine2-spatial/blob/58ea5fae1c1b450ee08d7dac25cd9e8f5e6fdebd/lib/CrEOF/Spatial/PHP/Types/AbstractPolygon.php#L80-L89 |
creof/doctrine2-spatial | lib/CrEOF/Spatial/ORM/Query/GeometryWalker.php | GeometryWalker.walkSelectExpression | public function walkSelectExpression($selectExpression)
{
$expr = $selectExpression->expression;
$sql = parent::walkSelectExpression($selectExpression);
if ($expr instanceof ReturnsGeometryInterface && !$selectExpression->hiddenAliasResultVariable) {
$alias = trim(strrchr($sql,... | php | public function walkSelectExpression($selectExpression)
{
$expr = $selectExpression->expression;
$sql = parent::walkSelectExpression($selectExpression);
if ($expr instanceof ReturnsGeometryInterface && !$selectExpression->hiddenAliasResultVariable) {
$alias = trim(strrchr($sql,... | [
"public",
"function",
"walkSelectExpression",
"(",
"$",
"selectExpression",
")",
"{",
"$",
"expr",
"=",
"$",
"selectExpression",
"->",
"expression",
";",
"$",
"sql",
"=",
"parent",
"::",
"walkSelectExpression",
"(",
"$",
"selectExpression",
")",
";",
"if",
"("... | Walks down a SelectExpression AST node and generates the corresponding SQL.
@param SelectExpression $selectExpression
@return string The SQL. | [
"Walks",
"down",
"a",
"SelectExpression",
"AST",
"node",
"and",
"generates",
"the",
"corresponding",
"SQL",
"."
] | train | https://github.com/creof/doctrine2-spatial/blob/58ea5fae1c1b450ee08d7dac25cd9e8f5e6fdebd/lib/CrEOF/Spatial/ORM/Query/GeometryWalker.php#L63-L74 |
creof/doctrine2-spatial | lib/CrEOF/Spatial/DBAL/Platform/AbstractPlatform.php | AbstractPlatform.convertStringToPHPValue | public function convertStringToPHPValue(AbstractSpatialType $type, $sqlExpr)
{
$parser = new StringParser($sqlExpr);
return $this->newObjectFromValue($type, $parser->parse());
} | php | public function convertStringToPHPValue(AbstractSpatialType $type, $sqlExpr)
{
$parser = new StringParser($sqlExpr);
return $this->newObjectFromValue($type, $parser->parse());
} | [
"public",
"function",
"convertStringToPHPValue",
"(",
"AbstractSpatialType",
"$",
"type",
",",
"$",
"sqlExpr",
")",
"{",
"$",
"parser",
"=",
"new",
"StringParser",
"(",
"$",
"sqlExpr",
")",
";",
"return",
"$",
"this",
"->",
"newObjectFromValue",
"(",
"$",
"t... | @param AbstractSpatialType $type
@param string $sqlExpr
@return GeometryInterface | [
"@param",
"AbstractSpatialType",
"$type",
"@param",
"string",
"$sqlExpr"
] | train | https://github.com/creof/doctrine2-spatial/blob/58ea5fae1c1b450ee08d7dac25cd9e8f5e6fdebd/lib/CrEOF/Spatial/DBAL/Platform/AbstractPlatform.php#L47-L52 |
creof/doctrine2-spatial | lib/CrEOF/Spatial/DBAL/Platform/AbstractPlatform.php | AbstractPlatform.convertBinaryToPHPValue | public function convertBinaryToPHPValue(AbstractSpatialType $type, $sqlExpr)
{
$parser = new BinaryParser($sqlExpr);
return $this->newObjectFromValue($type, $parser->parse());
} | php | public function convertBinaryToPHPValue(AbstractSpatialType $type, $sqlExpr)
{
$parser = new BinaryParser($sqlExpr);
return $this->newObjectFromValue($type, $parser->parse());
} | [
"public",
"function",
"convertBinaryToPHPValue",
"(",
"AbstractSpatialType",
"$",
"type",
",",
"$",
"sqlExpr",
")",
"{",
"$",
"parser",
"=",
"new",
"BinaryParser",
"(",
"$",
"sqlExpr",
")",
";",
"return",
"$",
"this",
"->",
"newObjectFromValue",
"(",
"$",
"t... | @param AbstractSpatialType $type
@param string $sqlExpr
@return GeometryInterface | [
"@param",
"AbstractSpatialType",
"$type",
"@param",
"string",
"$sqlExpr"
] | train | https://github.com/creof/doctrine2-spatial/blob/58ea5fae1c1b450ee08d7dac25cd9e8f5e6fdebd/lib/CrEOF/Spatial/DBAL/Platform/AbstractPlatform.php#L60-L65 |
creof/doctrine2-spatial | lib/CrEOF/Spatial/DBAL/Platform/AbstractPlatform.php | AbstractPlatform.convertToDatabaseValue | public function convertToDatabaseValue(AbstractSpatialType $type, GeometryInterface $value)
{
return sprintf('%s(%s)', strtoupper($value->getType()), $value);
} | php | public function convertToDatabaseValue(AbstractSpatialType $type, GeometryInterface $value)
{
return sprintf('%s(%s)', strtoupper($value->getType()), $value);
} | [
"public",
"function",
"convertToDatabaseValue",
"(",
"AbstractSpatialType",
"$",
"type",
",",
"GeometryInterface",
"$",
"value",
")",
"{",
"return",
"sprintf",
"(",
"'%s(%s)'",
",",
"strtoupper",
"(",
"$",
"value",
"->",
"getType",
"(",
")",
")",
",",
"$",
"... | @param AbstractSpatialType $type
@param GeometryInterface $value
@return string | [
"@param",
"AbstractSpatialType",
"$type",
"@param",
"GeometryInterface",
"$value"
] | train | https://github.com/creof/doctrine2-spatial/blob/58ea5fae1c1b450ee08d7dac25cd9e8f5e6fdebd/lib/CrEOF/Spatial/DBAL/Platform/AbstractPlatform.php#L73-L76 |
creof/doctrine2-spatial | lib/CrEOF/Spatial/DBAL/Platform/AbstractPlatform.php | AbstractPlatform.getMappedDatabaseTypes | public function getMappedDatabaseTypes(AbstractSpatialType $type)
{
$sqlType = strtolower($type->getSQLType());
if ($type instanceof GeographyType && $sqlType !== 'geography') {
$sqlType = sprintf('geography(%s)', $sqlType);
}
return array($sqlType);
} | php | public function getMappedDatabaseTypes(AbstractSpatialType $type)
{
$sqlType = strtolower($type->getSQLType());
if ($type instanceof GeographyType && $sqlType !== 'geography') {
$sqlType = sprintf('geography(%s)', $sqlType);
}
return array($sqlType);
} | [
"public",
"function",
"getMappedDatabaseTypes",
"(",
"AbstractSpatialType",
"$",
"type",
")",
"{",
"$",
"sqlType",
"=",
"strtolower",
"(",
"$",
"type",
"->",
"getSQLType",
"(",
")",
")",
";",
"if",
"(",
"$",
"type",
"instanceof",
"GeographyType",
"&&",
"$",
... | Get an array of database types that map to this Doctrine type.
@param AbstractSpatialType $type
@return string[] | [
"Get",
"an",
"array",
"of",
"database",
"types",
"that",
"map",
"to",
"this",
"Doctrine",
"type",
"."
] | train | https://github.com/creof/doctrine2-spatial/blob/58ea5fae1c1b450ee08d7dac25cd9e8f5e6fdebd/lib/CrEOF/Spatial/DBAL/Platform/AbstractPlatform.php#L85-L94 |
creof/doctrine2-spatial | lib/CrEOF/Spatial/DBAL/Platform/AbstractPlatform.php | AbstractPlatform.newObjectFromValue | private function newObjectFromValue(AbstractSpatialType $type, $value)
{
$typeFamily = $type->getTypeFamily();
$typeName = strtoupper($value['type']);
$constName = sprintf('CrEOF\Spatial\PHP\Types\Geometry\GeometryInterface::%s', $typeName);
if (! defined($constName)) {
... | php | private function newObjectFromValue(AbstractSpatialType $type, $value)
{
$typeFamily = $type->getTypeFamily();
$typeName = strtoupper($value['type']);
$constName = sprintf('CrEOF\Spatial\PHP\Types\Geometry\GeometryInterface::%s', $typeName);
if (! defined($constName)) {
... | [
"private",
"function",
"newObjectFromValue",
"(",
"AbstractSpatialType",
"$",
"type",
",",
"$",
"value",
")",
"{",
"$",
"typeFamily",
"=",
"$",
"type",
"->",
"getTypeFamily",
"(",
")",
";",
"$",
"typeName",
"=",
"strtoupper",
"(",
"$",
"value",
"[",
"'type... | Create spatial object from parsed value
@param AbstractSpatialType $type
@param array $value
@return GeometryInterface
@throws \CrEOF\Spatial\Exception\InvalidValueException | [
"Create",
"spatial",
"object",
"from",
"parsed",
"value"
] | train | https://github.com/creof/doctrine2-spatial/blob/58ea5fae1c1b450ee08d7dac25cd9e8f5e6fdebd/lib/CrEOF/Spatial/DBAL/Platform/AbstractPlatform.php#L105-L121 |
creof/doctrine2-spatial | lib/CrEOF/Spatial/PHP/Types/AbstractMultiLineString.php | AbstractMultiLineString.getLineString | public function getLineString($index)
{
if ($index == -1) {
$index = count($this->lineStrings) - 1;
}
$lineStringClass = $this->getNamespace() . '\LineString';
return new $lineStringClass($this->lineStrings[$index], $this->srid);
} | php | public function getLineString($index)
{
if ($index == -1) {
$index = count($this->lineStrings) - 1;
}
$lineStringClass = $this->getNamespace() . '\LineString';
return new $lineStringClass($this->lineStrings[$index], $this->srid);
} | [
"public",
"function",
"getLineString",
"(",
"$",
"index",
")",
"{",
"if",
"(",
"$",
"index",
"==",
"-",
"1",
")",
"{",
"$",
"index",
"=",
"count",
"(",
"$",
"this",
"->",
"lineStrings",
")",
"-",
"1",
";",
"}",
"$",
"lineStringClass",
"=",
"$",
"... | @param int $index
@return AbstractLineString | [
"@param",
"int",
"$index"
] | train | https://github.com/creof/doctrine2-spatial/blob/58ea5fae1c1b450ee08d7dac25cd9e8f5e6fdebd/lib/CrEOF/Spatial/PHP/Types/AbstractMultiLineString.php#L80-L89 |
creof/doctrine2-spatial | lib/CrEOF/Spatial/PHP/Types/Geography/Point.php | Point.setX | public function setX($x)
{
$parser = new Parser($x);
try {
$x = (float) $parser->parse();
} catch (RangeException $e) {
throw new InvalidValueException($e->getMessage(), $e->getCode(), $e->getPrevious());
} catch (UnexpectedValueException $e) {
th... | php | public function setX($x)
{
$parser = new Parser($x);
try {
$x = (float) $parser->parse();
} catch (RangeException $e) {
throw new InvalidValueException($e->getMessage(), $e->getCode(), $e->getPrevious());
} catch (UnexpectedValueException $e) {
th... | [
"public",
"function",
"setX",
"(",
"$",
"x",
")",
"{",
"$",
"parser",
"=",
"new",
"Parser",
"(",
"$",
"x",
")",
";",
"try",
"{",
"$",
"x",
"=",
"(",
"float",
")",
"$",
"parser",
"->",
"parse",
"(",
")",
";",
"}",
"catch",
"(",
"RangeException",... | @param mixed $x
@return self
@throws InvalidValueException | [
"@param",
"mixed",
"$x"
] | train | https://github.com/creof/doctrine2-spatial/blob/58ea5fae1c1b450ee08d7dac25cd9e8f5e6fdebd/lib/CrEOF/Spatial/PHP/Types/Geography/Point.php#L46-L65 |
creof/doctrine2-spatial | lib/CrEOF/Spatial/PHP/Types/Geography/Point.php | Point.setY | public function setY($y)
{
$parser = new Parser($y);
try {
$y = (float) $parser->parse();
} catch (RangeException $e) {
throw new InvalidValueException($e->getMessage(), $e->getCode(), $e->getPrevious());
} catch (UnexpectedValueException $e) {
th... | php | public function setY($y)
{
$parser = new Parser($y);
try {
$y = (float) $parser->parse();
} catch (RangeException $e) {
throw new InvalidValueException($e->getMessage(), $e->getCode(), $e->getPrevious());
} catch (UnexpectedValueException $e) {
th... | [
"public",
"function",
"setY",
"(",
"$",
"y",
")",
"{",
"$",
"parser",
"=",
"new",
"Parser",
"(",
"$",
"y",
")",
";",
"try",
"{",
"$",
"y",
"=",
"(",
"float",
")",
"$",
"parser",
"->",
"parse",
"(",
")",
";",
"}",
"catch",
"(",
"RangeException",... | @param mixed $y
@return self
@throws InvalidValueException | [
"@param",
"mixed",
"$y"
] | train | https://github.com/creof/doctrine2-spatial/blob/58ea5fae1c1b450ee08d7dac25cd9e8f5e6fdebd/lib/CrEOF/Spatial/PHP/Types/Geography/Point.php#L73-L92 |
creof/doctrine2-spatial | lib/CrEOF/Spatial/PHP/Types/AbstractMultiPolygon.php | AbstractMultiPolygon.getPolygon | public function getPolygon($index)
{
if (-1 == $index) {
$index = count($this->polygons) - 1;
}
$polygonClass = $this->getNamespace() . '\Polygon';
return new $polygonClass($this->polygons[$index], $this->srid);
} | php | public function getPolygon($index)
{
if (-1 == $index) {
$index = count($this->polygons) - 1;
}
$polygonClass = $this->getNamespace() . '\Polygon';
return new $polygonClass($this->polygons[$index], $this->srid);
} | [
"public",
"function",
"getPolygon",
"(",
"$",
"index",
")",
"{",
"if",
"(",
"-",
"1",
"==",
"$",
"index",
")",
"{",
"$",
"index",
"=",
"count",
"(",
"$",
"this",
"->",
"polygons",
")",
"-",
"1",
";",
"}",
"$",
"polygonClass",
"=",
"$",
"this",
... | @param int $index
@return AbstractPolygon | [
"@param",
"int",
"$index"
] | train | https://github.com/creof/doctrine2-spatial/blob/58ea5fae1c1b450ee08d7dac25cd9e8f5e6fdebd/lib/CrEOF/Spatial/PHP/Types/AbstractMultiPolygon.php#L80-L89 |
creof/doctrine2-spatial | lib/CrEOF/Spatial/PHP/Types/AbstractGeometry.php | AbstractGeometry.validatePointValue | protected function validatePointValue($point)
{
switch (true) {
case ($point instanceof AbstractPoint):
return $point->toArray();
break;
case (is_array($point) && count($point) == 2 && is_numeric($point[0]) && is_numeric($point[1])):
re... | php | protected function validatePointValue($point)
{
switch (true) {
case ($point instanceof AbstractPoint):
return $point->toArray();
break;
case (is_array($point) && count($point) == 2 && is_numeric($point[0]) && is_numeric($point[1])):
re... | [
"protected",
"function",
"validatePointValue",
"(",
"$",
"point",
")",
"{",
"switch",
"(",
"true",
")",
"{",
"case",
"(",
"$",
"point",
"instanceof",
"AbstractPoint",
")",
":",
"return",
"$",
"point",
"->",
"toArray",
"(",
")",
";",
"break",
";",
"case",... | @param AbstractPoint|array $point
@return array
@throws InvalidValueException | [
"@param",
"AbstractPoint|array",
"$point"
] | train | https://github.com/creof/doctrine2-spatial/blob/58ea5fae1c1b450ee08d7dac25cd9e8f5e6fdebd/lib/CrEOF/Spatial/PHP/Types/AbstractGeometry.php#L96-L108 |
creof/doctrine2-spatial | lib/CrEOF/Spatial/PHP/Types/AbstractGeometry.php | AbstractGeometry.validateRingValue | protected function validateRingValue($ring)
{
switch (true) {
case ($ring instanceof AbstractLineString):
$ring = $ring->toArray();
break;
case (is_array($ring)):
break;
default:
throw new InvalidValueExcepti... | php | protected function validateRingValue($ring)
{
switch (true) {
case ($ring instanceof AbstractLineString):
$ring = $ring->toArray();
break;
case (is_array($ring)):
break;
default:
throw new InvalidValueExcepti... | [
"protected",
"function",
"validateRingValue",
"(",
"$",
"ring",
")",
"{",
"switch",
"(",
"true",
")",
"{",
"case",
"(",
"$",
"ring",
"instanceof",
"AbstractLineString",
")",
":",
"$",
"ring",
"=",
"$",
"ring",
"->",
"toArray",
"(",
")",
";",
"break",
"... | @param AbstractLineString|array[] $ring
@return array[]
@throws InvalidValueException | [
"@param",
"AbstractLineString|array",
"[]",
"$ring"
] | train | https://github.com/creof/doctrine2-spatial/blob/58ea5fae1c1b450ee08d7dac25cd9e8f5e6fdebd/lib/CrEOF/Spatial/PHP/Types/AbstractGeometry.php#L116-L135 |
creof/doctrine2-spatial | lib/CrEOF/Spatial/PHP/Types/AbstractGeometry.php | AbstractGeometry.validateMultiPointValue | protected function validateMultiPointValue($points)
{
if ($points instanceof GeometryInterface) {
$points = $points->toArray();
}
foreach ($points as &$point) {
$point = $this->validatePointValue($point);
}
return $points;
} | php | protected function validateMultiPointValue($points)
{
if ($points instanceof GeometryInterface) {
$points = $points->toArray();
}
foreach ($points as &$point) {
$point = $this->validatePointValue($point);
}
return $points;
} | [
"protected",
"function",
"validateMultiPointValue",
"(",
"$",
"points",
")",
"{",
"if",
"(",
"$",
"points",
"instanceof",
"GeometryInterface",
")",
"{",
"$",
"points",
"=",
"$",
"points",
"->",
"toArray",
"(",
")",
";",
"}",
"foreach",
"(",
"$",
"points",
... | @param AbstractLineString|AbstractPoint[]|array[] $points
@return array[] | [
"@param",
"AbstractLineString|AbstractPoint",
"[]",
"|array",
"[]",
"$points"
] | train | https://github.com/creof/doctrine2-spatial/blob/58ea5fae1c1b450ee08d7dac25cd9e8f5e6fdebd/lib/CrEOF/Spatial/PHP/Types/AbstractGeometry.php#L142-L153 |
creof/doctrine2-spatial | lib/CrEOF/Spatial/PHP/Types/AbstractGeometry.php | AbstractGeometry.validatePolygonValue | protected function validatePolygonValue(array $rings)
{
foreach ($rings as &$ring) {
$ring = $this->validateRingValue($ring);
}
return $rings;
} | php | protected function validatePolygonValue(array $rings)
{
foreach ($rings as &$ring) {
$ring = $this->validateRingValue($ring);
}
return $rings;
} | [
"protected",
"function",
"validatePolygonValue",
"(",
"array",
"$",
"rings",
")",
"{",
"foreach",
"(",
"$",
"rings",
"as",
"&",
"$",
"ring",
")",
"{",
"$",
"ring",
"=",
"$",
"this",
"->",
"validateRingValue",
"(",
"$",
"ring",
")",
";",
"}",
"return",
... | @param AbstractLineString[] $rings
@return array | [
"@param",
"AbstractLineString",
"[]",
"$rings"
] | train | https://github.com/creof/doctrine2-spatial/blob/58ea5fae1c1b450ee08d7dac25cd9e8f5e6fdebd/lib/CrEOF/Spatial/PHP/Types/AbstractGeometry.php#L170-L177 |
creof/doctrine2-spatial | lib/CrEOF/Spatial/PHP/Types/AbstractGeometry.php | AbstractGeometry.validateMultiPolygonValue | protected function validateMultiPolygonValue(array $polygons)
{
foreach ($polygons as &$polygon) {
if ($polygon instanceof GeometryInterface) {
$polygon = $polygon->toArray();
}
$polygon = $this->validatePolygonValue($polygon);
}
return $p... | php | protected function validateMultiPolygonValue(array $polygons)
{
foreach ($polygons as &$polygon) {
if ($polygon instanceof GeometryInterface) {
$polygon = $polygon->toArray();
}
$polygon = $this->validatePolygonValue($polygon);
}
return $p... | [
"protected",
"function",
"validateMultiPolygonValue",
"(",
"array",
"$",
"polygons",
")",
"{",
"foreach",
"(",
"$",
"polygons",
"as",
"&",
"$",
"polygon",
")",
"{",
"if",
"(",
"$",
"polygon",
"instanceof",
"GeometryInterface",
")",
"{",
"$",
"polygon",
"=",
... | @param AbstractPolygon[] $polygons
@return array | [
"@param",
"AbstractPolygon",
"[]",
"$polygons"
] | train | https://github.com/creof/doctrine2-spatial/blob/58ea5fae1c1b450ee08d7dac25cd9e8f5e6fdebd/lib/CrEOF/Spatial/PHP/Types/AbstractGeometry.php#L184-L194 |
creof/doctrine2-spatial | lib/CrEOF/Spatial/PHP/Types/AbstractGeometry.php | AbstractGeometry.validateMultiLineStringValue | protected function validateMultiLineStringValue(array $lineStrings)
{
foreach ($lineStrings as &$lineString) {
$lineString = $this->validateLineStringValue($lineString);
}
return $lineStrings;
} | php | protected function validateMultiLineStringValue(array $lineStrings)
{
foreach ($lineStrings as &$lineString) {
$lineString = $this->validateLineStringValue($lineString);
}
return $lineStrings;
} | [
"protected",
"function",
"validateMultiLineStringValue",
"(",
"array",
"$",
"lineStrings",
")",
"{",
"foreach",
"(",
"$",
"lineStrings",
"as",
"&",
"$",
"lineString",
")",
"{",
"$",
"lineString",
"=",
"$",
"this",
"->",
"validateLineStringValue",
"(",
"$",
"li... | @param AbstractLineString[] $lineStrings
@return array | [
"@param",
"AbstractLineString",
"[]",
"$lineStrings"
] | train | https://github.com/creof/doctrine2-spatial/blob/58ea5fae1c1b450ee08d7dac25cd9e8f5e6fdebd/lib/CrEOF/Spatial/PHP/Types/AbstractGeometry.php#L201-L208 |
creof/doctrine2-spatial | lib/CrEOF/Spatial/PHP/Types/AbstractGeometry.php | AbstractGeometry.toStringMultiPoint | private function toStringMultiPoint(array $multiPoint)
{
$strings = array();
foreach ($multiPoint as $point) {
$strings[] = $this->toStringPoint($point);
}
return implode(',', $strings);
} | php | private function toStringMultiPoint(array $multiPoint)
{
$strings = array();
foreach ($multiPoint as $point) {
$strings[] = $this->toStringPoint($point);
}
return implode(',', $strings);
} | [
"private",
"function",
"toStringMultiPoint",
"(",
"array",
"$",
"multiPoint",
")",
"{",
"$",
"strings",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"multiPoint",
"as",
"$",
"point",
")",
"{",
"$",
"strings",
"[",
"]",
"=",
"$",
"this",
"->",
"t... | @param array[] $multiPoint
@return string | [
"@param",
"array",
"[]",
"$multiPoint"
] | train | https://github.com/creof/doctrine2-spatial/blob/58ea5fae1c1b450ee08d7dac25cd9e8f5e6fdebd/lib/CrEOF/Spatial/PHP/Types/AbstractGeometry.php#L235-L244 |
creof/doctrine2-spatial | lib/CrEOF/Spatial/PHP/Types/AbstractGeometry.php | AbstractGeometry.toStringMultiLineString | private function toStringMultiLineString(array $multiLineString)
{
$strings = null;
foreach ($multiLineString as $lineString) {
$strings[] = '(' . $this->toStringLineString($lineString) . ')';
}
return implode(',', $strings);
} | php | private function toStringMultiLineString(array $multiLineString)
{
$strings = null;
foreach ($multiLineString as $lineString) {
$strings[] = '(' . $this->toStringLineString($lineString) . ')';
}
return implode(',', $strings);
} | [
"private",
"function",
"toStringMultiLineString",
"(",
"array",
"$",
"multiLineString",
")",
"{",
"$",
"strings",
"=",
"null",
";",
"foreach",
"(",
"$",
"multiLineString",
"as",
"$",
"lineString",
")",
"{",
"$",
"strings",
"[",
"]",
"=",
"'('",
".",
"$",
... | @param array[] $multiLineString
@return string | [
"@param",
"array",
"[]",
"$multiLineString"
] | train | https://github.com/creof/doctrine2-spatial/blob/58ea5fae1c1b450ee08d7dac25cd9e8f5e6fdebd/lib/CrEOF/Spatial/PHP/Types/AbstractGeometry.php#L261-L270 |
creof/doctrine2-spatial | lib/CrEOF/Spatial/PHP/Types/AbstractGeometry.php | AbstractGeometry.toStringMultiPolygon | private function toStringMultiPolygon(array $multiPolygon)
{
$strings = null;
foreach ($multiPolygon as $polygon) {
$strings[] = '(' . $this->toStringPolygon($polygon) . ')';
}
return implode(',', $strings);
} | php | private function toStringMultiPolygon(array $multiPolygon)
{
$strings = null;
foreach ($multiPolygon as $polygon) {
$strings[] = '(' . $this->toStringPolygon($polygon) . ')';
}
return implode(',', $strings);
} | [
"private",
"function",
"toStringMultiPolygon",
"(",
"array",
"$",
"multiPolygon",
")",
"{",
"$",
"strings",
"=",
"null",
";",
"foreach",
"(",
"$",
"multiPolygon",
"as",
"$",
"polygon",
")",
"{",
"$",
"strings",
"[",
"]",
"=",
"'('",
".",
"$",
"this",
"... | @param array[] $multiPolygon
@return string | [
"@param",
"array",
"[]",
"$multiPolygon"
] | train | https://github.com/creof/doctrine2-spatial/blob/58ea5fae1c1b450ee08d7dac25cd9e8f5e6fdebd/lib/CrEOF/Spatial/PHP/Types/AbstractGeometry.php#L287-L296 |
dotzero/amocrm-php | src/Models/AbstractModel.php | AbstractModel.offsetGet | public function offsetGet($offset)
{
if (isset($this->values[$offset])) {
return $this->values[$offset];
}
return null;
} | php | public function offsetGet($offset)
{
if (isset($this->values[$offset])) {
return $this->values[$offset];
}
return null;
} | [
"public",
"function",
"offsetGet",
"(",
"$",
"offset",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"values",
"[",
"$",
"offset",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"values",
"[",
"$",
"offset",
"]",
";",
"}",
"return",
"nu... | Возвращает заданное поле модели
@link http://php.net/manual/en/arrayaccess.offsetget.php
@param mixed $offset Название поля для возврата
@return mixed Значение поля | [
"Возвращает",
"заданное",
"поле",
"модели"
] | train | https://github.com/dotzero/amocrm-php/blob/d9f818acaf010fffdfe095f15c5e0ee4587a9385/src/Models/AbstractModel.php#L64-L71 |
dotzero/amocrm-php | src/Models/AbstractModel.php | AbstractModel.offsetSet | public function offsetSet($offset, $value)
{
$setter = 'set' . Format::camelCase($offset);
if (method_exists($this, $setter)) {
return $this->$setter($value);
} elseif (in_array($offset, $this->fields)) {
$this->values[$offset] = $value;
}
} | php | public function offsetSet($offset, $value)
{
$setter = 'set' . Format::camelCase($offset);
if (method_exists($this, $setter)) {
return $this->$setter($value);
} elseif (in_array($offset, $this->fields)) {
$this->values[$offset] = $value;
}
} | [
"public",
"function",
"offsetSet",
"(",
"$",
"offset",
",",
"$",
"value",
")",
"{",
"$",
"setter",
"=",
"'set'",
".",
"Format",
"::",
"camelCase",
"(",
"$",
"offset",
")",
";",
"if",
"(",
"method_exists",
"(",
"$",
"this",
",",
"$",
"setter",
")",
... | Устанавливает заданное поле модели
Если есть сеттер модели, то будет использовать сеттер
@link http://php.net/manual/en/arrayaccess.offsetset.php
@param mixed $offset Название поля, которому будет присваиваться значение
@param mixed $value Значение для присвоения | [
"Устанавливает",
"заданное",
"поле",
"модели"
] | train | https://github.com/dotzero/amocrm-php/blob/d9f818acaf010fffdfe095f15c5e0ee4587a9385/src/Models/AbstractModel.php#L82-L91 |
dotzero/amocrm-php | src/Models/AbstractModel.php | AbstractModel.addCustomField | public function addCustomField($id, $value, $enum = false, $subtype = false)
{
$field = [
'id' => $id,
'values' => [],
];
if (!is_array($value)) {
$values = [[$value, $enum]];
} else {
$values = $value;
}
foreach ($val... | php | public function addCustomField($id, $value, $enum = false, $subtype = false)
{
$field = [
'id' => $id,
'values' => [],
];
if (!is_array($value)) {
$values = [[$value, $enum]];
} else {
$values = $value;
}
foreach ($val... | [
"public",
"function",
"addCustomField",
"(",
"$",
"id",
",",
"$",
"value",
",",
"$",
"enum",
"=",
"false",
",",
"$",
"subtype",
"=",
"false",
")",
"{",
"$",
"field",
"=",
"[",
"'id'",
"=>",
"$",
"id",
",",
"'values'",
"=>",
"[",
"]",
",",
"]",
... | Добавление кастомного поля модели
@param int $id Уникальный идентификатор заполняемого дополнительного поля
@param mixed $value Значение заполняемого дополнительного поля
@param mixed $enum Тип дополнительного поля
@param mixed $subtype Тип подтипа поля
@return $this | [
"Добавление",
"кастомного",
"поля",
"модели"
] | train | https://github.com/dotzero/amocrm-php/blob/d9f818acaf010fffdfe095f15c5e0ee4587a9385/src/Models/AbstractModel.php#L125-L159 |
dotzero/amocrm-php | src/Models/AbstractModel.php | AbstractModel.addCustomMultiField | public function addCustomMultiField($id, $values)
{
$field = [
'id' => $id,
'values' => [],
];
if (!is_array($values)) {
$values = [$values];
}
$field['values'] = $values;
$this->values['custom_fields'][] = $field;
retur... | php | public function addCustomMultiField($id, $values)
{
$field = [
'id' => $id,
'values' => [],
];
if (!is_array($values)) {
$values = [$values];
}
$field['values'] = $values;
$this->values['custom_fields'][] = $field;
retur... | [
"public",
"function",
"addCustomMultiField",
"(",
"$",
"id",
",",
"$",
"values",
")",
"{",
"$",
"field",
"=",
"[",
"'id'",
"=>",
"$",
"id",
",",
"'values'",
"=>",
"[",
"]",
",",
"]",
";",
"if",
"(",
"!",
"is_array",
"(",
"$",
"values",
")",
")",
... | Добавление кастомного поля типа мультиселект модели
@param int $id Уникальный идентификатор заполняемого дополнительного поля
@param mixed $values Значения заполняемого дополнительного поля типа мультиселект
@return $this | [
"Добавление",
"кастомного",
"поля",
"типа",
"мультиселект",
"модели"
] | train | https://github.com/dotzero/amocrm-php/blob/d9f818acaf010fffdfe095f15c5e0ee4587a9385/src/Models/AbstractModel.php#L168-L184 |
dotzero/amocrm-php | src/Models/Traits/SetLinkedLeadsId.php | SetLinkedLeadsId.setLinkedLeadsId | public function setLinkedLeadsId($value)
{
if (!is_array($value)) {
$value = [$value];
}
$this->values['linked_leads_id'] = $value;
return $this;
} | php | public function setLinkedLeadsId($value)
{
if (!is_array($value)) {
$value = [$value];
}
$this->values['linked_leads_id'] = $value;
return $this;
} | [
"public",
"function",
"setLinkedLeadsId",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"value",
")",
")",
"{",
"$",
"value",
"=",
"[",
"$",
"value",
"]",
";",
"}",
"$",
"this",
"->",
"values",
"[",
"'linked_leads_id'",
"]",
"=... | Сеттер для списка связанных сделок
@param int|array $value Номер связанной сделки или список сделок
@return $this | [
"Сеттер",
"для",
"списка",
"связанных",
"сделок"
] | train | https://github.com/dotzero/amocrm-php/blob/d9f818acaf010fffdfe095f15c5e0ee4587a9385/src/Models/Traits/SetLinkedLeadsId.php#L13-L22 |
dotzero/amocrm-php | src/Request/CurlHandle.php | CurlHandle.open | public function open()
{
if ($this->handle !== null) {
return $this->handle;
}
if (!function_exists('curl_init')) {
throw new NetworkException('The cURL PHP extension was not loaded.');
}
$this->handle = curl_init();
return $this->handle;
... | php | public function open()
{
if ($this->handle !== null) {
return $this->handle;
}
if (!function_exists('curl_init')) {
throw new NetworkException('The cURL PHP extension was not loaded.');
}
$this->handle = curl_init();
return $this->handle;
... | [
"public",
"function",
"open",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"handle",
"!==",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"handle",
";",
"}",
"if",
"(",
"!",
"function_exists",
"(",
"'curl_init'",
")",
")",
"{",
"throw",
"new",
"Ne... | Возвращает повторно используемый обработчик cURL или создает новый
@return resource
@throws NetworkException | [
"Возвращает",
"повторно",
"используемый",
"обработчик",
"cURL",
"или",
"создает",
"новый"
] | train | https://github.com/dotzero/amocrm-php/blob/d9f818acaf010fffdfe095f15c5e0ee4587a9385/src/Request/CurlHandle.php#L43-L55 |
dotzero/amocrm-php | src/Request/CurlHandle.php | CurlHandle.close | public function close()
{
if ($this->handle === null) {
return;
}
curl_setopt($this->handle, CURLOPT_HEADERFUNCTION, null);
curl_setopt($this->handle, CURLOPT_READFUNCTION, null);
curl_setopt($this->handle, CURLOPT_WRITEFUNCTION, null);
curl_setopt($this-... | php | public function close()
{
if ($this->handle === null) {
return;
}
curl_setopt($this->handle, CURLOPT_HEADERFUNCTION, null);
curl_setopt($this->handle, CURLOPT_READFUNCTION, null);
curl_setopt($this->handle, CURLOPT_WRITEFUNCTION, null);
curl_setopt($this-... | [
"public",
"function",
"close",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"handle",
"===",
"null",
")",
"{",
"return",
";",
"}",
"curl_setopt",
"(",
"$",
"this",
"->",
"handle",
",",
"CURLOPT_HEADERFUNCTION",
",",
"null",
")",
";",
"curl_setopt",
"("... | Сбрасывает настройки обработчика cURL | [
"Сбрасывает",
"настройки",
"обработчика",
"cURL"
] | train | https://github.com/dotzero/amocrm-php/blob/d9f818acaf010fffdfe095f15c5e0ee4587a9385/src/Request/CurlHandle.php#L60-L71 |
dotzero/amocrm-php | src/Models/Traits/SetNote.php | SetNote.setNotes | public function setNotes($value)
{
$this->values['notes'] = [];
if ($value instanceof Note) {
$value = [$value];
}
foreach ($value as $note) {
if ($note instanceof Note) {
$note = $note->getValues();
}
$this->values['... | php | public function setNotes($value)
{
$this->values['notes'] = [];
if ($value instanceof Note) {
$value = [$value];
}
foreach ($value as $note) {
if ($note instanceof Note) {
$note = $note->getValues();
}
$this->values['... | [
"public",
"function",
"setNotes",
"(",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"values",
"[",
"'notes'",
"]",
"=",
"[",
"]",
";",
"if",
"(",
"$",
"value",
"instanceof",
"Note",
")",
"{",
"$",
"value",
"=",
"[",
"$",
"value",
"]",
";",
"}",
"... | Сеттер для списка примечаний, которые появятся
после принятия неразобранного
@param array|Note $value Примечание или массив примечаний
@return $this | [
"Сеттер",
"для",
"списка",
"примечаний",
"которые",
"появятся",
"после",
"принятия",
"неразобранного"
] | train | https://github.com/dotzero/amocrm-php/blob/d9f818acaf010fffdfe095f15c5e0ee4587a9385/src/Models/Traits/SetNote.php#L16-L33 |
dotzero/amocrm-php | src/Models/Webhooks.php | Webhooks.setEvents | public function setEvents($value)
{
if (empty($value)) {
$value = $this->events_list;
} elseif (!is_array($value)) {
$value = [$value];
}
$this->values['events'] = $value;
return $this;
} | php | public function setEvents($value)
{
if (empty($value)) {
$value = $this->events_list;
} elseif (!is_array($value)) {
$value = [$value];
}
$this->values['events'] = $value;
return $this;
} | [
"public",
"function",
"setEvents",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"value",
")",
")",
"{",
"$",
"value",
"=",
"$",
"this",
"->",
"events_list",
";",
"}",
"elseif",
"(",
"!",
"is_array",
"(",
"$",
"value",
")",
")",
"{",... | Сеттер для списка событий
@param string|array $value Название события или массив событий
@return $this | [
"Сеттер",
"для",
"списка",
"событий"
] | train | https://github.com/dotzero/amocrm-php/blob/d9f818acaf010fffdfe095f15c5e0ee4587a9385/src/Models/Webhooks.php#L61-L72 |
dotzero/amocrm-php | src/Models/Webhooks.php | Webhooks.apiSubscribe | public function apiSubscribe($url = null, $events = [])
{
$parameters = [
'url' => $url,
'events' => $events,
];
if ($url === null) {
$parameters = $this->getValues();
} elseif (!is_array($parameters['events'])) {
$parameters['events']... | php | public function apiSubscribe($url = null, $events = [])
{
$parameters = [
'url' => $url,
'events' => $events,
];
if ($url === null) {
$parameters = $this->getValues();
} elseif (!is_array($parameters['events'])) {
$parameters['events']... | [
"public",
"function",
"apiSubscribe",
"(",
"$",
"url",
"=",
"null",
",",
"$",
"events",
"=",
"[",
"]",
")",
"{",
"$",
"parameters",
"=",
"[",
"'url'",
"=>",
"$",
"url",
",",
"'events'",
"=>",
"$",
"events",
",",
"]",
";",
"if",
"(",
"$",
"url",
... | Добавление Webhooks
Метод для добавления Webhooks.
@link https://developers.amocrm.ru/rest_api/webhooks/subscribe.php
@param null|string $url URL на который необходимо присылать уведомления, должен соответствовать стандарту RFC 2396
@param array|string $events Список событий, при которых должны отправляться Webhooks
... | [
"Добавление",
"Webhooks"
] | train | https://github.com/dotzero/amocrm-php/blob/d9f818acaf010fffdfe095f15c5e0ee4587a9385/src/Models/Webhooks.php#L100-L128 |
dotzero/amocrm-php | src/Models/Widgets.php | Widgets.apiInstall | public function apiInstall($parameters)
{
$parameters = [
'widgets' => [
'install' => $parameters,
],
];
$response = $this->postRequest('/private/api/v2/json/widgets/set', $parameters);
return isset($response['widgets']['install']) ? $respons... | php | public function apiInstall($parameters)
{
$parameters = [
'widgets' => [
'install' => $parameters,
],
];
$response = $this->postRequest('/private/api/v2/json/widgets/set', $parameters);
return isset($response['widgets']['install']) ? $respons... | [
"public",
"function",
"apiInstall",
"(",
"$",
"parameters",
")",
"{",
"$",
"parameters",
"=",
"[",
"'widgets'",
"=>",
"[",
"'install'",
"=>",
"$",
"parameters",
",",
"]",
",",
"]",
";",
"$",
"response",
"=",
"$",
"this",
"->",
"postRequest",
"(",
"'/pr... | Включение виджетов
Метод позволяет включать виджеты по одному или пакетно,
а также обновлять данные включённых и выключенных виджетов.
@link https://developers.amocrm.ru/rest_api/widgets/set.php
@param array $parameters Массив параметров к amoCRM API
@return array Ответ amoCRM API
@throws \AmoCRM\Exception | [
"Включение",
"виджетов"
] | train | https://github.com/dotzero/amocrm-php/blob/d9f818acaf010fffdfe095f15c5e0ee4587a9385/src/Models/Widgets.php#L47-L58 |
dotzero/amocrm-php | src/Models/Widgets.php | Widgets.apiUninstall | public function apiUninstall($parameters)
{
$parameters = [
'widgets' => [
'uninstall' => $parameters,
],
];
$response = $this->postRequest('/private/api/v2/json/widgets/set', $parameters);
return isset($response['widgets']['uninstall']) ? $r... | php | public function apiUninstall($parameters)
{
$parameters = [
'widgets' => [
'uninstall' => $parameters,
],
];
$response = $this->postRequest('/private/api/v2/json/widgets/set', $parameters);
return isset($response['widgets']['uninstall']) ? $r... | [
"public",
"function",
"apiUninstall",
"(",
"$",
"parameters",
")",
"{",
"$",
"parameters",
"=",
"[",
"'widgets'",
"=>",
"[",
"'uninstall'",
"=>",
"$",
"parameters",
",",
"]",
",",
"]",
";",
"$",
"response",
"=",
"$",
"this",
"->",
"postRequest",
"(",
"... | Выключение виджетов
Метод позволяет выключать виджеты по одному или пакетно,
а также обновлять данные включённых и выключенных виджетов.
@link https://developers.amocrm.ru/rest_api/widgets/set.php
@param array $parameters Массив параметров к amoCRM API
@return array Ответ amoCRM API
@throws \AmoCRM\Exception | [
"Выключение",
"виджетов"
] | train | https://github.com/dotzero/amocrm-php/blob/d9f818acaf010fffdfe095f15c5e0ee4587a9385/src/Models/Widgets.php#L71-L82 |
dotzero/amocrm-php | src/Request/Request.php | Request.getRequest | protected function getRequest($url, $parameters = [], $modified = null)
{
if (!empty($parameters)) {
$this->parameters->addGet($parameters);
}
return $this->request($url, $modified);
} | php | protected function getRequest($url, $parameters = [], $modified = null)
{
if (!empty($parameters)) {
$this->parameters->addGet($parameters);
}
return $this->request($url, $modified);
} | [
"protected",
"function",
"getRequest",
"(",
"$",
"url",
",",
"$",
"parameters",
"=",
"[",
"]",
",",
"$",
"modified",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"parameters",
")",
")",
"{",
"$",
"this",
"->",
"parameters",
"->",
"addG... | Выполнить HTTP GET запрос и вернуть тело ответа
@param string $url Запрашиваемый URL
@param array $parameters Список GET параметров
@param null|string $modified Значение заголовка IF-MODIFIED-SINCE
@return mixed
@throws Exception
@throws NetworkException | [
"Выполнить",
"HTTP",
"GET",
"запрос",
"и",
"вернуть",
"тело",
"ответа"
] | train | https://github.com/dotzero/amocrm-php/blob/d9f818acaf010fffdfe095f15c5e0ee4587a9385/src/Request/Request.php#L119-L126 |
dotzero/amocrm-php | src/Request/Request.php | Request.postRequest | protected function postRequest($url, $parameters = [])
{
if (!empty($parameters)) {
$this->parameters->addPost($parameters);
}
return $this->request($url);
} | php | protected function postRequest($url, $parameters = [])
{
if (!empty($parameters)) {
$this->parameters->addPost($parameters);
}
return $this->request($url);
} | [
"protected",
"function",
"postRequest",
"(",
"$",
"url",
",",
"$",
"parameters",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"parameters",
")",
")",
"{",
"$",
"this",
"->",
"parameters",
"->",
"addPost",
"(",
"$",
"parameters",
")",
... | Выполнить HTTP POST запрос и вернуть тело ответа
@param string $url Запрашиваемый URL
@param array $parameters Список POST параметров
@return mixed
@throws Exception
@throws NetworkException | [
"Выполнить",
"HTTP",
"POST",
"запрос",
"и",
"вернуть",
"тело",
"ответа"
] | train | https://github.com/dotzero/amocrm-php/blob/d9f818acaf010fffdfe095f15c5e0ee4587a9385/src/Request/Request.php#L137-L144 |
dotzero/amocrm-php | src/Request/Request.php | Request.prepareHeaders | protected function prepareHeaders($modified = null)
{
$headers = [
'Connection: keep-alive',
'Content-Type: application/json',
];
if ($modified !== null) {
if (is_int($modified)) {
$headers[] = 'IF-MODIFIED-SINCE: ' . $modified;
... | php | protected function prepareHeaders($modified = null)
{
$headers = [
'Connection: keep-alive',
'Content-Type: application/json',
];
if ($modified !== null) {
if (is_int($modified)) {
$headers[] = 'IF-MODIFIED-SINCE: ' . $modified;
... | [
"protected",
"function",
"prepareHeaders",
"(",
"$",
"modified",
"=",
"null",
")",
"{",
"$",
"headers",
"=",
"[",
"'Connection: keep-alive'",
",",
"'Content-Type: application/json'",
",",
"]",
";",
"if",
"(",
"$",
"modified",
"!==",
"null",
")",
"{",
"if",
"... | Подготавливает список заголовков HTTP
@param mixed $modified Значение заголовка IF-MODIFIED-SINCE
@return array | [
"Подготавливает",
"список",
"заголовков",
"HTTP"
] | train | https://github.com/dotzero/amocrm-php/blob/d9f818acaf010fffdfe095f15c5e0ee4587a9385/src/Request/Request.php#L152-L168 |
dotzero/amocrm-php | src/Request/Request.php | Request.prepareEndpoint | protected function prepareEndpoint($url)
{
if ($this->v1 === false) {
$query = http_build_query(array_merge($this->parameters->getGet(), [
'USER_LOGIN' => $this->parameters->getAuth('login'),
'USER_HASH' => $this->parameters->getAuth('apikey'),
]), nul... | php | protected function prepareEndpoint($url)
{
if ($this->v1 === false) {
$query = http_build_query(array_merge($this->parameters->getGet(), [
'USER_LOGIN' => $this->parameters->getAuth('login'),
'USER_HASH' => $this->parameters->getAuth('apikey'),
]), nul... | [
"protected",
"function",
"prepareEndpoint",
"(",
"$",
"url",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"v1",
"===",
"false",
")",
"{",
"$",
"query",
"=",
"http_build_query",
"(",
"array_merge",
"(",
"$",
"this",
"->",
"parameters",
"->",
"getGet",
"(",
"... | Подготавливает URL для HTTP запроса
@param string $url Запрашиваемый URL
@return string | [
"Подготавливает",
"URL",
"для",
"HTTP",
"запроса"
] | train | https://github.com/dotzero/amocrm-php/blob/d9f818acaf010fffdfe095f15c5e0ee4587a9385/src/Request/Request.php#L176-L191 |
dotzero/amocrm-php | src/Request/Request.php | Request.request | protected function request($url, $modified = null)
{
$headers = $this->prepareHeaders($modified);
$endpoint = $this->prepareEndpoint($url);
$this->printDebug('url', $endpoint);
$this->printDebug('headers', $headers);
$ch = $this->curlHandle->open();
curl_setopt($ch... | php | protected function request($url, $modified = null)
{
$headers = $this->prepareHeaders($modified);
$endpoint = $this->prepareEndpoint($url);
$this->printDebug('url', $endpoint);
$this->printDebug('headers', $headers);
$ch = $this->curlHandle->open();
curl_setopt($ch... | [
"protected",
"function",
"request",
"(",
"$",
"url",
",",
"$",
"modified",
"=",
"null",
")",
"{",
"$",
"headers",
"=",
"$",
"this",
"->",
"prepareHeaders",
"(",
"$",
"modified",
")",
";",
"$",
"endpoint",
"=",
"$",
"this",
"->",
"prepareEndpoint",
"(",... | Выполнить HTTP запрос и вернуть тело ответа
@param string $url Запрашиваемый URL
@param null|string $modified Значение заголовка IF-MODIFIED-SINCE
@return mixed
@throws Exception
@throws NetworkException | [
"Выполнить",
"HTTP",
"запрос",
"и",
"вернуть",
"тело",
"ответа"
] | train | https://github.com/dotzero/amocrm-php/blob/d9f818acaf010fffdfe095f15c5e0ee4587a9385/src/Request/Request.php#L202-L252 |
dotzero/amocrm-php | src/Request/Request.php | Request.parseResponse | protected function parseResponse($response, $info)
{
$result = json_decode($response, true);
if (floor($info['http_code'] / 100) >= 3) {
if (isset($result['response']['error_code']) && $result['response']['error_code'] > 0) {
$code = $result['response']['error_code'];
... | php | protected function parseResponse($response, $info)
{
$result = json_decode($response, true);
if (floor($info['http_code'] / 100) >= 3) {
if (isset($result['response']['error_code']) && $result['response']['error_code'] > 0) {
$code = $result['response']['error_code'];
... | [
"protected",
"function",
"parseResponse",
"(",
"$",
"response",
",",
"$",
"info",
")",
"{",
"$",
"result",
"=",
"json_decode",
"(",
"$",
"response",
",",
"true",
")",
";",
"if",
"(",
"floor",
"(",
"$",
"info",
"[",
"'http_code'",
"]",
"/",
"100",
")"... | Парсит HTTP ответ, проверяет на наличие ошибок и возвращает тело ответа
@param string $response HTTP ответ
@param array $info Результат функции curl_getinfo
@return mixed
@throws Exception | [
"Парсит",
"HTTP",
"ответ",
"проверяет",
"на",
"наличие",
"ошибок",
"и",
"возвращает",
"тело",
"ответа"
] | train | https://github.com/dotzero/amocrm-php/blob/d9f818acaf010fffdfe095f15c5e0ee4587a9385/src/Request/Request.php#L262-L286 |
dotzero/amocrm-php | src/Request/Request.php | Request.printDebug | protected function printDebug($key = '', $value = null, $return = false)
{
if ($this->debug !== true) {
return false;
}
if (!is_string($value)) {
$value = print_r($value, true);
}
$line = sprintf('[DEBUG] %s: %s', $key, $value);
if ($return ... | php | protected function printDebug($key = '', $value = null, $return = false)
{
if ($this->debug !== true) {
return false;
}
if (!is_string($value)) {
$value = print_r($value, true);
}
$line = sprintf('[DEBUG] %s: %s', $key, $value);
if ($return ... | [
"protected",
"function",
"printDebug",
"(",
"$",
"key",
"=",
"''",
",",
"$",
"value",
"=",
"null",
",",
"$",
"return",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"debug",
"!==",
"true",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",... | Вывода отладочной информации
@param string $key Заголовок отладочной информации
@param mixed $value Значение отладочной информации
@param bool $return Возврат строки вместо вывода
@return mixed | [
"Вывода",
"отладочной",
"информации"
] | train | https://github.com/dotzero/amocrm-php/blob/d9f818acaf010fffdfe095f15c5e0ee4587a9385/src/Request/Request.php#L296-L313 |
dotzero/amocrm-php | src/Request/ParamsBag.php | ParamsBag.getAuth | public function getAuth($name = null)
{
if ($name !== null) {
return isset($this->authParams[$name]) ? $this->authParams[$name] : null;
}
return $this->authParams;
} | php | public function getAuth($name = null)
{
if ($name !== null) {
return isset($this->authParams[$name]) ? $this->authParams[$name] : null;
}
return $this->authParams;
} | [
"public",
"function",
"getAuth",
"(",
"$",
"name",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"name",
"!==",
"null",
")",
"{",
"return",
"isset",
"(",
"$",
"this",
"->",
"authParams",
"[",
"$",
"name",
"]",
")",
"?",
"$",
"this",
"->",
"authParams",
... | Получение параметра для авторизации по ключу или список параметров
@param string $name Название параметра
@return array|null Значение параметра или список параметров | [
"Получение",
"параметра",
"для",
"авторизации",
"по",
"ключу",
"или",
"список",
"параметров"
] | train | https://github.com/dotzero/amocrm-php/blob/d9f818acaf010fffdfe095f15c5e0ee4587a9385/src/Request/ParamsBag.php#L74-L81 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.