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 |
|---|---|---|---|---|---|---|---|---|---|---|
Torann/json-ld | src/ContextTypes/Product.php | Product.setIsSimilarToAttribute | protected function setIsSimilarToAttribute($values)
{
if (is_array($values)) {
foreach ($values as $key => $value) {
$product = new self($value);
$properties = $product->getProperties();
unset($properties['@context']);
$properties = array_filter($properties, 'strlen');
$values[$key] = $properties;
}
}
return $values;
} | php | protected function setIsSimilarToAttribute($values)
{
if (is_array($values)) {
foreach ($values as $key => $value) {
$product = new self($value);
$properties = $product->getProperties();
unset($properties['@context']);
$properties = array_filter($properties, 'strlen');
$values[$key] = $properties;
}
}
return $values;
} | [
"protected",
"function",
"setIsSimilarToAttribute",
"(",
"$",
"values",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"values",
")",
")",
"{",
"foreach",
"(",
"$",
"values",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"product",
"=",
"new",
"se... | Set isSimilarTo attributes.
@param mixed $values
@return array | [
"Set",
"isSimilarTo",
"attributes",
"."
] | train | https://github.com/Torann/json-ld/blob/4d439220cb012df2705e2ad6472d2426fcb14b4c/src/ContextTypes/Product.php#L41-L58 |
Torann/json-ld | src/ContextTypes/AbstractContext.php | AbstractContext.fill | public function fill($attributes)
{
// Some context types have varying types
if ($this->hasGetMutator('type')) {
$this->type = $this->mutateAttribute('type', $this->getArrValue($attributes, 'type', $this->type));
}
// Set properties
$properties = array_merge([
'@context' => 'http://schema.org',
'@type' => $this->type,
'sameAs' => null
], $this->structure, $this->extendStructure);
// Set properties from attributes
foreach ($properties as $key => $property) {
$this->setProperty($key, $property, $this->getArrValue($attributes, $key, ''));
}
// After fill event
$this->afterFill($attributes);
} | php | public function fill($attributes)
{
// Some context types have varying types
if ($this->hasGetMutator('type')) {
$this->type = $this->mutateAttribute('type', $this->getArrValue($attributes, 'type', $this->type));
}
// Set properties
$properties = array_merge([
'@context' => 'http://schema.org',
'@type' => $this->type,
'sameAs' => null
], $this->structure, $this->extendStructure);
// Set properties from attributes
foreach ($properties as $key => $property) {
$this->setProperty($key, $property, $this->getArrValue($attributes, $key, ''));
}
// After fill event
$this->afterFill($attributes);
} | [
"public",
"function",
"fill",
"(",
"$",
"attributes",
")",
"{",
"// Some context types have varying types",
"if",
"(",
"$",
"this",
"->",
"hasGetMutator",
"(",
"'type'",
")",
")",
"{",
"$",
"this",
"->",
"type",
"=",
"$",
"this",
"->",
"mutateAttribute",
"("... | Creates an array of schema.org attribute from attributes.
@param array $attributes | [
"Creates",
"an",
"array",
"of",
"schema",
".",
"org",
"attribute",
"from",
"attributes",
"."
] | train | https://github.com/Torann/json-ld/blob/4d439220cb012df2705e2ad6472d2426fcb14b4c/src/ContextTypes/AbstractContext.php#L78-L99 |
Torann/json-ld | src/ContextTypes/AbstractContext.php | AbstractContext.setProperty | protected function setProperty($key, $property, $value = null)
{
// Can't be changed
if ($key[0] === '@') {
return $this->properties[$key] = $property;
}
// If the attribute has a get mutator, we will call that
// then return what it returns as the value.
if ($this->hasGetMutator($key)) {
return $this->properties[$key] = $this->mutateAttribute($key, $value);
}
// Format date and time to UTC
if ($value instanceof DateTime) {
return $this->properties[$key] = $value->format('Y-m-d\TH:i:s');
}
// Set nested context
if ($value instanceof Context) {
return $this->properties[$key] = $this->filterNestedContext($value->getProperties());
}
// Set nested context from class
if ($property && class_exists($property)) {
return $this->properties[$key] = $this->getNestedContext($property, $value);
}
// Map properties to object
if ($property !== null && is_array($property) && is_array($value)) {
return $this->properties[$key] = $this->mapProperty($property, $value);
}
// Set value
return $this->properties[$key] = $value;
} | php | protected function setProperty($key, $property, $value = null)
{
// Can't be changed
if ($key[0] === '@') {
return $this->properties[$key] = $property;
}
// If the attribute has a get mutator, we will call that
// then return what it returns as the value.
if ($this->hasGetMutator($key)) {
return $this->properties[$key] = $this->mutateAttribute($key, $value);
}
// Format date and time to UTC
if ($value instanceof DateTime) {
return $this->properties[$key] = $value->format('Y-m-d\TH:i:s');
}
// Set nested context
if ($value instanceof Context) {
return $this->properties[$key] = $this->filterNestedContext($value->getProperties());
}
// Set nested context from class
if ($property && class_exists($property)) {
return $this->properties[$key] = $this->getNestedContext($property, $value);
}
// Map properties to object
if ($property !== null && is_array($property) && is_array($value)) {
return $this->properties[$key] = $this->mapProperty($property, $value);
}
// Set value
return $this->properties[$key] = $value;
} | [
"protected",
"function",
"setProperty",
"(",
"$",
"key",
",",
"$",
"property",
",",
"$",
"value",
"=",
"null",
")",
"{",
"// Can't be changed",
"if",
"(",
"$",
"key",
"[",
"0",
"]",
"===",
"'@'",
")",
"{",
"return",
"$",
"this",
"->",
"properties",
"... | Set property value in attributes.
@param string $key
@param mixed $property
@param mixed $value
@return mixed | [
"Set",
"property",
"value",
"in",
"attributes",
"."
] | train | https://github.com/Torann/json-ld/blob/4d439220cb012df2705e2ad6472d2426fcb14b4c/src/ContextTypes/AbstractContext.php#L142-L177 |
Torann/json-ld | src/ContextTypes/AbstractContext.php | AbstractContext.getNestedContext | protected function getNestedContext($class, $attributes = null)
{
// Must be an array
if (is_array($attributes) === false) return $attributes;
// Create nested context
$context = new $class($attributes);
// Return context attributes
return $this->filterNestedContext($context->getProperties());
} | php | protected function getNestedContext($class, $attributes = null)
{
// Must be an array
if (is_array($attributes) === false) return $attributes;
// Create nested context
$context = new $class($attributes);
// Return context attributes
return $this->filterNestedContext($context->getProperties());
} | [
"protected",
"function",
"getNestedContext",
"(",
"$",
"class",
",",
"$",
"attributes",
"=",
"null",
")",
"{",
"// Must be an array",
"if",
"(",
"is_array",
"(",
"$",
"attributes",
")",
"===",
"false",
")",
"return",
"$",
"attributes",
";",
"// Create nested c... | Get nested context array.
@param string $class
@param array $attributes
@return array | [
"Get",
"nested",
"context",
"array",
"."
] | train | https://github.com/Torann/json-ld/blob/4d439220cb012df2705e2ad6472d2426fcb14b4c/src/ContextTypes/AbstractContext.php#L197-L207 |
Torann/json-ld | src/ContextTypes/AbstractContext.php | AbstractContext.filterNestedContext | protected function filterNestedContext(array $properties = [])
{
$func = function($value, $key) {
return ($value && $key !== '@context');
};
if (!defined('ARRAY_FILTER_USE_BOTH')) {
$return = [];
foreach ($properties as $k => $v) {
if (call_user_func($func, $v, $k)) {
$return[$k] = $v;
}
}
return $return;
}
return array_filter($properties, $func, ARRAY_FILTER_USE_BOTH);
} | php | protected function filterNestedContext(array $properties = [])
{
$func = function($value, $key) {
return ($value && $key !== '@context');
};
if (!defined('ARRAY_FILTER_USE_BOTH')) {
$return = [];
foreach ($properties as $k => $v) {
if (call_user_func($func, $v, $k)) {
$return[$k] = $v;
}
}
return $return;
}
return array_filter($properties, $func, ARRAY_FILTER_USE_BOTH);
} | [
"protected",
"function",
"filterNestedContext",
"(",
"array",
"$",
"properties",
"=",
"[",
"]",
")",
"{",
"$",
"func",
"=",
"function",
"(",
"$",
"value",
",",
"$",
"key",
")",
"{",
"return",
"(",
"$",
"value",
"&&",
"$",
"key",
"!==",
"'@context'",
... | Filter nested context array.
@param array $properties
@return array | [
"Filter",
"nested",
"context",
"array",
"."
] | train | https://github.com/Torann/json-ld/blob/4d439220cb012df2705e2ad6472d2426fcb14b4c/src/ContextTypes/AbstractContext.php#L215-L233 |
Torann/json-ld | src/ContextTypes/AbstractContext.php | AbstractContext.mapProperty | protected function mapProperty(array $template = [], $props = [])
{
// No values set
if (is_array($props) === false) {
return null;
}
foreach($template as $key => $value) {
if ($key[0] !== '@') {
$template[$key] = $this->getArrValue($props, $key, '');
}
}
return array_filter($template);
} | php | protected function mapProperty(array $template = [], $props = [])
{
// No values set
if (is_array($props) === false) {
return null;
}
foreach($template as $key => $value) {
if ($key[0] !== '@') {
$template[$key] = $this->getArrValue($props, $key, '');
}
}
return array_filter($template);
} | [
"protected",
"function",
"mapProperty",
"(",
"array",
"$",
"template",
"=",
"[",
"]",
",",
"$",
"props",
"=",
"[",
"]",
")",
"{",
"// No values set",
"if",
"(",
"is_array",
"(",
"$",
"props",
")",
"===",
"false",
")",
"{",
"return",
"null",
";",
"}",... | Get property value from attributes.
@param array $template
@param array $props
@return mixed | [
"Get",
"property",
"value",
"from",
"attributes",
"."
] | train | https://github.com/Torann/json-ld/blob/4d439220cb012df2705e2ad6472d2426fcb14b4c/src/ContextTypes/AbstractContext.php#L278-L292 |
Torann/json-ld | src/ContextTypes/AbstractContext.php | AbstractContext.truncate | protected function truncate($string, $limit, $pad = '...', $break = ' ')
{
// return with no change if string is shorter than $limit
if(strlen($string) <= $limit) return $string;
// is $break present between $limit and the end of the string?
if(false !== ($breakpoint = strpos($string, $break, $limit))) {
if($breakpoint < strlen($string) - 1) {
$string = substr($string, 0, $breakpoint) . $pad;
}
}
return $string;
} | php | protected function truncate($string, $limit, $pad = '...', $break = ' ')
{
// return with no change if string is shorter than $limit
if(strlen($string) <= $limit) return $string;
// is $break present between $limit and the end of the string?
if(false !== ($breakpoint = strpos($string, $break, $limit))) {
if($breakpoint < strlen($string) - 1) {
$string = substr($string, 0, $breakpoint) . $pad;
}
}
return $string;
} | [
"protected",
"function",
"truncate",
"(",
"$",
"string",
",",
"$",
"limit",
",",
"$",
"pad",
"=",
"'...'",
",",
"$",
"break",
"=",
"' '",
")",
"{",
"// return with no change if string is shorter than $limit",
"if",
"(",
"strlen",
"(",
"$",
"string",
")",
"<=... | Trim a string to a given number of words
@param string $string
@param int $limit
@param string $pad
@param string $break
@return string | [
"Trim",
"a",
"string",
"to",
"a",
"given",
"number",
"of",
"words"
] | train | https://github.com/Torann/json-ld/blob/4d439220cb012df2705e2ad6472d2426fcb14b4c/src/ContextTypes/AbstractContext.php#L303-L316 |
Torann/json-ld | src/ContextTypes/MusicRecording.php | MusicRecording.setInAlbumAttribute | protected function setInAlbumAttribute($items)
{
if ( ! is_array($items))
{
return $items;
}
//Check if not multidimensional array (for backward compatibility)
if((count($items) == count($items, COUNT_RECURSIVE)))
{
return $this->getNestedContext(MusicAlbum::class, $items);
}
//multiple albums
return array_map(function ($item) {
return $this->getNestedContext(MusicAlbum::class, $item);
}, $items);
} | php | protected function setInAlbumAttribute($items)
{
if ( ! is_array($items))
{
return $items;
}
//Check if not multidimensional array (for backward compatibility)
if((count($items) == count($items, COUNT_RECURSIVE)))
{
return $this->getNestedContext(MusicAlbum::class, $items);
}
//multiple albums
return array_map(function ($item) {
return $this->getNestedContext(MusicAlbum::class, $item);
}, $items);
} | [
"protected",
"function",
"setInAlbumAttribute",
"(",
"$",
"items",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"items",
")",
")",
"{",
"return",
"$",
"items",
";",
"}",
"//Check if not multidimensional array (for backward compatibility)",
"if",
"(",
"(",
"co... | Set in album attribute
@param array|string $items
@return array | [
"Set",
"in",
"album",
"attribute"
] | train | https://github.com/Torann/json-ld/blob/4d439220cb012df2705e2ad6472d2426fcb14b4c/src/ContextTypes/MusicRecording.php#L32-L49 |
Torann/json-ld | src/ContextTypes/MusicAbstractContext.php | MusicAbstractContext.setByArtistAttribute | protected function setByArtistAttribute($items)
{
if ( ! is_array($items))
{
return $items;
}
//Check if not multidimensional array (for backward compatibility)
if((count($items) == count($items, COUNT_RECURSIVE)))
{
return $this->getNestedContext(MusicGroup::class, $items);
}
//multiple artists
return array_map(function ($item) {
return $this->getNestedContext(MusicGroup::class, $item);
}, $items);
} | php | protected function setByArtistAttribute($items)
{
if ( ! is_array($items))
{
return $items;
}
//Check if not multidimensional array (for backward compatibility)
if((count($items) == count($items, COUNT_RECURSIVE)))
{
return $this->getNestedContext(MusicGroup::class, $items);
}
//multiple artists
return array_map(function ($item) {
return $this->getNestedContext(MusicGroup::class, $item);
}, $items);
} | [
"protected",
"function",
"setByArtistAttribute",
"(",
"$",
"items",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"items",
")",
")",
"{",
"return",
"$",
"items",
";",
"}",
"//Check if not multidimensional array (for backward compatibility)",
"if",
"(",
"(",
"c... | Set artist attribute
@param array|string $items
@return array | [
"Set",
"artist",
"attribute"
] | train | https://github.com/Torann/json-ld/blob/4d439220cb012df2705e2ad6472d2426fcb14b4c/src/ContextTypes/MusicAbstractContext.php#L44-L61 |
Torann/json-ld | src/ContextTypes/MusicAbstractContext.php | MusicAbstractContext.setTrackAttribute | protected function setTrackAttribute($items)
{
if ( ! is_array($items))
{
return $items;
}
return array_map(function ($item) {
return $this->getNestedContext(MusicRecording::class, $item);
}, $items);
} | php | protected function setTrackAttribute($items)
{
if ( ! is_array($items))
{
return $items;
}
return array_map(function ($item) {
return $this->getNestedContext(MusicRecording::class, $item);
}, $items);
} | [
"protected",
"function",
"setTrackAttribute",
"(",
"$",
"items",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"items",
")",
")",
"{",
"return",
"$",
"items",
";",
"}",
"return",
"array_map",
"(",
"function",
"(",
"$",
"item",
")",
"{",
"return",
"... | Set the tracks for a music group
@param array $items
@return array | [
"Set",
"the",
"tracks",
"for",
"a",
"music",
"group"
] | train | https://github.com/Torann/json-ld/blob/4d439220cb012df2705e2ad6472d2426fcb14b4c/src/ContextTypes/MusicAbstractContext.php#L69-L79 |
Torann/json-ld | src/ContextTypes/Person.php | Person.setAddressAttribute | protected function setAddressAttribute($items)
{
if (is_array($items) === false) {
return $items;
}
return $this->getNestedContext(PostalAddress::class, $items);
} | php | protected function setAddressAttribute($items)
{
if (is_array($items) === false) {
return $items;
}
return $this->getNestedContext(PostalAddress::class, $items);
} | [
"protected",
"function",
"setAddressAttribute",
"(",
"$",
"items",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"items",
")",
"===",
"false",
")",
"{",
"return",
"$",
"items",
";",
"}",
"return",
"$",
"this",
"->",
"getNestedContext",
"(",
"PostalAddress",
... | Set the address
@param array $items
@return array | [
"Set",
"the",
"address"
] | train | https://github.com/Torann/json-ld/blob/4d439220cb012df2705e2ad6472d2426fcb14b4c/src/ContextTypes/Person.php#L57-L64 |
Torann/json-ld | src/ContextTypes/Event.php | Event.setOffersAttribute | protected function setOffersAttribute($values)
{
if (is_array($values)) {
foreach($values as $key => $value) {
$values[$key] = $this->mapProperty([
'name' => '',
'price' => '',
'url' => '',
], $value);
}
}
return $values;
} | php | protected function setOffersAttribute($values)
{
if (is_array($values)) {
foreach($values as $key => $value) {
$values[$key] = $this->mapProperty([
'name' => '',
'price' => '',
'url' => '',
], $value);
}
}
return $values;
} | [
"protected",
"function",
"setOffersAttribute",
"(",
"$",
"values",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"values",
")",
")",
"{",
"foreach",
"(",
"$",
"values",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"values",
"[",
"$",
"key",
"]... | Set offers attributes.
@param mixed $values
@return array | [
"Set",
"offers",
"attributes",
"."
] | train | https://github.com/Torann/json-ld/blob/4d439220cb012df2705e2ad6472d2426fcb14b4c/src/ContextTypes/Event.php#L27-L40 |
Torann/json-ld | src/ContextTypes/BreadcrumbList.php | BreadcrumbList.setItemListElementAttribute | protected function setItemListElementAttribute($items)
{
foreach($items as $pos=>$item) {
$items[$pos] = $this->getNestedContext(ListItem::class, [
'position' => $pos + 1,
'item' => $item
]);
}
return $items;
} | php | protected function setItemListElementAttribute($items)
{
foreach($items as $pos=>$item) {
$items[$pos] = $this->getNestedContext(ListItem::class, [
'position' => $pos + 1,
'item' => $item
]);
}
return $items;
} | [
"protected",
"function",
"setItemListElementAttribute",
"(",
"$",
"items",
")",
"{",
"foreach",
"(",
"$",
"items",
"as",
"$",
"pos",
"=>",
"$",
"item",
")",
"{",
"$",
"items",
"[",
"$",
"pos",
"]",
"=",
"$",
"this",
"->",
"getNestedContext",
"(",
"List... | Set the canonical URL of the article page.
@param array $items
@return array | [
"Set",
"the",
"canonical",
"URL",
"of",
"the",
"article",
"page",
"."
] | train | https://github.com/Torann/json-ld/blob/4d439220cb012df2705e2ad6472d2426fcb14b4c/src/ContextTypes/BreadcrumbList.php#L22-L32 |
sebdesign/laravel-state-machine | src/Event/Dispatcher.php | Dispatcher.dispatch | public function dispatch($eventName, Event $event = null)
{
if (is_null($event)) {
$event = new Event();
}
if (method_exists($this->dispatcher, 'fire')) {
$this->dispatcher->fire($eventName, $event);
} else {
$this->dispatcher->dispatch($eventName, $event);
}
return $event;
} | php | public function dispatch($eventName, Event $event = null)
{
if (is_null($event)) {
$event = new Event();
}
if (method_exists($this->dispatcher, 'fire')) {
$this->dispatcher->fire($eventName, $event);
} else {
$this->dispatcher->dispatch($eventName, $event);
}
return $event;
} | [
"public",
"function",
"dispatch",
"(",
"$",
"eventName",
",",
"Event",
"$",
"event",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"event",
")",
")",
"{",
"$",
"event",
"=",
"new",
"Event",
"(",
")",
";",
"}",
"if",
"(",
"method_exists",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/sebdesign/laravel-state-machine/blob/24d41d1d1ada237bfcabd76b8931e256068ac267/src/Event/Dispatcher.php#L33-L46 |
sebdesign/laravel-state-machine | src/Commands/Debug.php | Debug.handle | public function handle()
{
if (empty($this->config)) {
$this->error('There are no state machines configured.');
return 1;
}
if (! $this->argument('graph')) {
$this->askForGraph();
}
$graph = $this->argument('graph');
if (! array_key_exists($graph, $this->config)) {
$this->error('The provided state machine graph is not configured.');
return 1;
}
$config = $this->config[$graph];
$this->printStates($config['states']);
$this->printTransitions($config['transitions']);
if (isset($config['callbacks'])) {
$this->printCallbacks($config['callbacks']);
}
return 0;
} | php | public function handle()
{
if (empty($this->config)) {
$this->error('There are no state machines configured.');
return 1;
}
if (! $this->argument('graph')) {
$this->askForGraph();
}
$graph = $this->argument('graph');
if (! array_key_exists($graph, $this->config)) {
$this->error('The provided state machine graph is not configured.');
return 1;
}
$config = $this->config[$graph];
$this->printStates($config['states']);
$this->printTransitions($config['transitions']);
if (isset($config['callbacks'])) {
$this->printCallbacks($config['callbacks']);
}
return 0;
} | [
"public",
"function",
"handle",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"config",
")",
")",
"{",
"$",
"this",
"->",
"error",
"(",
"'There are no state machines configured.'",
")",
";",
"return",
"1",
";",
"}",
"if",
"(",
"!",
"$",
... | Execute the console command.
@return mixed | [
"Execute",
"the",
"console",
"command",
"."
] | train | https://github.com/sebdesign/laravel-state-machine/blob/24d41d1d1ada237bfcabd76b8931e256068ac267/src/Commands/Debug.php#L43-L73 |
sebdesign/laravel-state-machine | src/Commands/Debug.php | Debug.askForGraph | protected function askForGraph()
{
$choices = array_map(function ($name, $config) {
return $name."\t(".$config['class'].' - '.$config['graph'].')';
}, array_keys($this->config), $this->config);
$choice = $this->choice('Which state machine would you like to know about?', $choices, 0);
$choice = substr($choice, 0, strpos($choice, "\t"));
$this->info('You have just selected: '.$choice);
$this->input->setArgument('graph', $choice);
} | php | protected function askForGraph()
{
$choices = array_map(function ($name, $config) {
return $name."\t(".$config['class'].' - '.$config['graph'].')';
}, array_keys($this->config), $this->config);
$choice = $this->choice('Which state machine would you like to know about?', $choices, 0);
$choice = substr($choice, 0, strpos($choice, "\t"));
$this->info('You have just selected: '.$choice);
$this->input->setArgument('graph', $choice);
} | [
"protected",
"function",
"askForGraph",
"(",
")",
"{",
"$",
"choices",
"=",
"array_map",
"(",
"function",
"(",
"$",
"name",
",",
"$",
"config",
")",
"{",
"return",
"$",
"name",
".",
"\"\\t(\"",
".",
"$",
"config",
"[",
"'class'",
"]",
".",
"' - '",
"... | Ask for a graph name if one was not provided as argument. | [
"Ask",
"for",
"a",
"graph",
"name",
"if",
"one",
"was",
"not",
"provided",
"as",
"argument",
"."
] | train | https://github.com/sebdesign/laravel-state-machine/blob/24d41d1d1ada237bfcabd76b8931e256068ac267/src/Commands/Debug.php#L78-L91 |
sebdesign/laravel-state-machine | src/Commands/Debug.php | Debug.printTransitions | protected function printTransitions(array $transitions)
{
end($transitions);
$lastTransition = key($transitions);
reset($transitions);
$rows = [];
foreach ($transitions as $name => $transition) {
$rows[] = [$name, implode(PHP_EOL, $transition['from']), $transition['to']];
if ($name !== $lastTransition) {
$rows[] = new TableSeparator();
}
}
$this->table(['Transition', 'From(s)', 'To'], $rows);
} | php | protected function printTransitions(array $transitions)
{
end($transitions);
$lastTransition = key($transitions);
reset($transitions);
$rows = [];
foreach ($transitions as $name => $transition) {
$rows[] = [$name, implode(PHP_EOL, $transition['from']), $transition['to']];
if ($name !== $lastTransition) {
$rows[] = new TableSeparator();
}
}
$this->table(['Transition', 'From(s)', 'To'], $rows);
} | [
"protected",
"function",
"printTransitions",
"(",
"array",
"$",
"transitions",
")",
"{",
"end",
"(",
"$",
"transitions",
")",
";",
"$",
"lastTransition",
"=",
"key",
"(",
"$",
"transitions",
")",
";",
"reset",
"(",
"$",
"transitions",
")",
";",
"$",
"row... | Display the graph transitions on a table.
@param array $transitions | [
"Display",
"the",
"graph",
"transitions",
"on",
"a",
"table",
"."
] | train | https://github.com/sebdesign/laravel-state-machine/blob/24d41d1d1ada237bfcabd76b8931e256068ac267/src/Commands/Debug.php#L110-L129 |
sebdesign/laravel-state-machine | src/Commands/Debug.php | Debug.printCallbacks | protected function printCallbacks(array $allCallbacks)
{
foreach ($allCallbacks as $position => $callbacks) {
$rows = [];
foreach ($callbacks as $name => $specs) {
$rows[] = [
$name,
$this->formatSatisfies($specs),
$this->formatCallable($specs),
$this->formatClause($specs, 'args'),
];
}
$this->table([ucfirst($position).' Callbacks', 'Satisfies', 'Do', 'Args'], $rows);
}
} | php | protected function printCallbacks(array $allCallbacks)
{
foreach ($allCallbacks as $position => $callbacks) {
$rows = [];
foreach ($callbacks as $name => $specs) {
$rows[] = [
$name,
$this->formatSatisfies($specs),
$this->formatCallable($specs),
$this->formatClause($specs, 'args'),
];
}
$this->table([ucfirst($position).' Callbacks', 'Satisfies', 'Do', 'Args'], $rows);
}
} | [
"protected",
"function",
"printCallbacks",
"(",
"array",
"$",
"allCallbacks",
")",
"{",
"foreach",
"(",
"$",
"allCallbacks",
"as",
"$",
"position",
"=>",
"$",
"callbacks",
")",
"{",
"$",
"rows",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"callbacks",
"as",... | Display the graph callbacks on a table.
@param array $allCallbacks | [
"Display",
"the",
"graph",
"callbacks",
"on",
"a",
"table",
"."
] | train | https://github.com/sebdesign/laravel-state-machine/blob/24d41d1d1ada237bfcabd76b8931e256068ac267/src/Commands/Debug.php#L136-L151 |
sebdesign/laravel-state-machine | src/Commands/Debug.php | Debug.formatSatisfies | protected function formatSatisfies(array $specs)
{
$clauses = array_map(function ($clause) use ($specs) {
if ($result = $this->formatClause($specs, $clause)) {
return vsprintf('%s: %s', [
ucfirst(str_replace('_', ' ', $clause)),
$result,
]);
}
}, ['from', 'excluded_from', 'on', 'excluded_on', 'to', 'excluded_to']);
return implode(PHP_EOL, array_filter($clauses));
} | php | protected function formatSatisfies(array $specs)
{
$clauses = array_map(function ($clause) use ($specs) {
if ($result = $this->formatClause($specs, $clause)) {
return vsprintf('%s: %s', [
ucfirst(str_replace('_', ' ', $clause)),
$result,
]);
}
}, ['from', 'excluded_from', 'on', 'excluded_on', 'to', 'excluded_to']);
return implode(PHP_EOL, array_filter($clauses));
} | [
"protected",
"function",
"formatSatisfies",
"(",
"array",
"$",
"specs",
")",
"{",
"$",
"clauses",
"=",
"array_map",
"(",
"function",
"(",
"$",
"clause",
")",
"use",
"(",
"$",
"specs",
")",
"{",
"if",
"(",
"$",
"result",
"=",
"$",
"this",
"->",
"forma... | Format the clauses that satisfy the callback.
@param array $specs
@return string | [
"Format",
"the",
"clauses",
"that",
"satisfy",
"the",
"callback",
"."
] | train | https://github.com/sebdesign/laravel-state-machine/blob/24d41d1d1ada237bfcabd76b8931e256068ac267/src/Commands/Debug.php#L159-L171 |
sebdesign/laravel-state-machine | src/Commands/Debug.php | Debug.formatCallable | protected function formatCallable(array $specs)
{
if (isset($specs['can'])) {
$callback = json_encode($specs['can']);
return "Gate::check({$callback})";
}
if (! isset($specs['do'])) {
return '';
}
$callback = $specs['do'];
if ($callback instanceof \Closure) {
return 'Closure';
}
if (is_string($callback)) {
if (strpos($callback, '@') !== false) {
$callback = explode('@', $callback);
} else {
return $callback.'()';
}
}
if (is_array($callback)) {
return implode('::', $callback).'()';
}
return $callback;
} | php | protected function formatCallable(array $specs)
{
if (isset($specs['can'])) {
$callback = json_encode($specs['can']);
return "Gate::check({$callback})";
}
if (! isset($specs['do'])) {
return '';
}
$callback = $specs['do'];
if ($callback instanceof \Closure) {
return 'Closure';
}
if (is_string($callback)) {
if (strpos($callback, '@') !== false) {
$callback = explode('@', $callback);
} else {
return $callback.'()';
}
}
if (is_array($callback)) {
return implode('::', $callback).'()';
}
return $callback;
} | [
"protected",
"function",
"formatCallable",
"(",
"array",
"$",
"specs",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"specs",
"[",
"'can'",
"]",
")",
")",
"{",
"$",
"callback",
"=",
"json_encode",
"(",
"$",
"specs",
"[",
"'can'",
"]",
")",
";",
"return",
... | Format the callable callable.
@param array $specs
@return string | [
"Format",
"the",
"callable",
"callable",
"."
] | train | https://github.com/sebdesign/laravel-state-machine/blob/24d41d1d1ada237bfcabd76b8931e256068ac267/src/Commands/Debug.php#L195-L226 |
sebdesign/laravel-state-machine | src/ServiceProvider.php | ServiceProvider.register | public function register()
{
$this->registerCallbackFactory();
$this->registerEventDispatcher();
$this->registerFactory();
$this->registerCascadeTransitionCallback();
$this->registerCommands();
} | php | public function register()
{
$this->registerCallbackFactory();
$this->registerEventDispatcher();
$this->registerFactory();
$this->registerCascadeTransitionCallback();
$this->registerCommands();
} | [
"public",
"function",
"register",
"(",
")",
"{",
"$",
"this",
"->",
"registerCallbackFactory",
"(",
")",
";",
"$",
"this",
"->",
"registerEventDispatcher",
"(",
")",
";",
"$",
"this",
"->",
"registerFactory",
"(",
")",
";",
"$",
"this",
"->",
"registerCasc... | Register the application services. | [
"Register",
"the",
"application",
"services",
"."
] | train | https://github.com/sebdesign/laravel-state-machine/blob/24d41d1d1ada237bfcabd76b8931e256068ac267/src/ServiceProvider.php#L40-L47 |
sebdesign/laravel-state-machine | src/Callback/ContainerAwareCallbackFactory.php | ContainerAwareCallbackFactory.get | public function get(array $specs)
{
if (isset($specs['can'])) {
return new GateCallback($specs, $this->container->make(Gate::class));
}
if (! isset($specs['do'])) {
throw new SMException(sprintf(
'CallbackFactory::get needs the index "do" to be able to build a callback, array %s given.',
json_encode($specs)
));
}
$class = $this->class;
return new $class($specs, $specs['do'], $this->container);
} | php | public function get(array $specs)
{
if (isset($specs['can'])) {
return new GateCallback($specs, $this->container->make(Gate::class));
}
if (! isset($specs['do'])) {
throw new SMException(sprintf(
'CallbackFactory::get needs the index "do" to be able to build a callback, array %s given.',
json_encode($specs)
));
}
$class = $this->class;
return new $class($specs, $specs['do'], $this->container);
} | [
"public",
"function",
"get",
"(",
"array",
"$",
"specs",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"specs",
"[",
"'can'",
"]",
")",
")",
"{",
"return",
"new",
"GateCallback",
"(",
"$",
"specs",
",",
"$",
"this",
"->",
"container",
"->",
"make",
"(",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/sebdesign/laravel-state-machine/blob/24d41d1d1ada237bfcabd76b8931e256068ac267/src/Callback/ContainerAwareCallbackFactory.php#L42-L58 |
sebdesign/laravel-state-machine | src/Callback/ContainerAwareCallback.php | ContainerAwareCallback.call | public function call(TransitionEvent $event)
{
// Load the services only now (when the callback is actually called)
// Resolve 'Class@method' callables
if ($this->isCallableWithAtSign()) {
$this->callable = explode('@', $this->callable);
}
// Resolve ['Class', 'method'] callables from the container
if (is_array($this->callable) && is_string($this->callable[0])) {
$id = $this->callable[0];
// If the class has no bindings in the container, call method statically.
if (! $this->container->bound($id)) {
return parent::call($event);
}
$this->callable[0] = $this->container->make($id);
}
return parent::call($event);
} | php | public function call(TransitionEvent $event)
{
// Load the services only now (when the callback is actually called)
// Resolve 'Class@method' callables
if ($this->isCallableWithAtSign()) {
$this->callable = explode('@', $this->callable);
}
// Resolve ['Class', 'method'] callables from the container
if (is_array($this->callable) && is_string($this->callable[0])) {
$id = $this->callable[0];
// If the class has no bindings in the container, call method statically.
if (! $this->container->bound($id)) {
return parent::call($event);
}
$this->callable[0] = $this->container->make($id);
}
return parent::call($event);
} | [
"public",
"function",
"call",
"(",
"TransitionEvent",
"$",
"event",
")",
"{",
"// Load the services only now (when the callback is actually called)",
"// Resolve 'Class@method' callables",
"if",
"(",
"$",
"this",
"->",
"isCallableWithAtSign",
"(",
")",
")",
"{",
"$",
"thi... | {@inheritdoc} | [
"{"
] | train | https://github.com/sebdesign/laravel-state-machine/blob/24d41d1d1ada237bfcabd76b8931e256068ac267/src/Callback/ContainerAwareCallback.php#L40-L62 |
vkovic/laravel-custom-casts | src/package/HasCustomCasts.php | HasCustomCasts.bootHasCustomCasts | public static function bootHasCustomCasts()
{
// Enable custom cast classes to listen to model events
\Event::listen('eloquent.*: ' . get_called_class(), function ($event, $data) {
$eventName = explode('.', explode(':', $event)[0])[1];
/** @var self $model */
$model = $data[0];
// Array
// - key: model attribute (field name)
// - value: custom cast class name
$customCasts = $model->filterCustomCasts();
// Inject null in case attribute is not set on model instance
if ($eventName == 'saving') {
foreach (array_diff(array_keys($customCasts), array_keys($model->attributes)) as $attribute) {
$model->attributes[$attribute] = null;
}
}
foreach ($customCasts as $attribute => $customCastClass) {
$customCastObject = $model->getCustomCastObject($attribute);
if (method_exists($customCastObject, $eventName)) {
$customCastObject->$eventName();
}
}
});
} | php | public static function bootHasCustomCasts()
{
// Enable custom cast classes to listen to model events
\Event::listen('eloquent.*: ' . get_called_class(), function ($event, $data) {
$eventName = explode('.', explode(':', $event)[0])[1];
/** @var self $model */
$model = $data[0];
// Array
// - key: model attribute (field name)
// - value: custom cast class name
$customCasts = $model->filterCustomCasts();
// Inject null in case attribute is not set on model instance
if ($eventName == 'saving') {
foreach (array_diff(array_keys($customCasts), array_keys($model->attributes)) as $attribute) {
$model->attributes[$attribute] = null;
}
}
foreach ($customCasts as $attribute => $customCastClass) {
$customCastObject = $model->getCustomCastObject($attribute);
if (method_exists($customCastObject, $eventName)) {
$customCastObject->$eventName();
}
}
});
} | [
"public",
"static",
"function",
"bootHasCustomCasts",
"(",
")",
"{",
"// Enable custom cast classes to listen to model events",
"\\",
"Event",
"::",
"listen",
"(",
"'eloquent.*: '",
".",
"get_called_class",
"(",
")",
",",
"function",
"(",
"$",
"event",
",",
"$",
"da... | Boot trait | [
"Boot",
"trait"
] | train | https://github.com/vkovic/laravel-custom-casts/blob/c25188e17fda9a8e95a2034cc6275b16b5027fed/src/package/HasCustomCasts.php#L18-L47 |
vkovic/laravel-custom-casts | src/package/HasCustomCasts.php | HasCustomCasts.setAttribute | public function setAttribute($attribute, $value)
{
// Give mutator priority over custom casts
if ($this->hasSetMutator($attribute)) {
$method = 'set' . studly_case($attribute) . 'Attribute';
return $this->{$method}($value);
}
if (array_key_exists($attribute, $this->filterCustomCasts())) {
/** @var $customCastObject CustomCastBase */
$customCastObject = $this->getCustomCastObject($attribute);
$this->attributes[$attribute] = $customCastObject->setAttribute($value);
return $this;
}
parent::setAttribute($attribute, $value);
} | php | public function setAttribute($attribute, $value)
{
// Give mutator priority over custom casts
if ($this->hasSetMutator($attribute)) {
$method = 'set' . studly_case($attribute) . 'Attribute';
return $this->{$method}($value);
}
if (array_key_exists($attribute, $this->filterCustomCasts())) {
/** @var $customCastObject CustomCastBase */
$customCastObject = $this->getCustomCastObject($attribute);
$this->attributes[$attribute] = $customCastObject->setAttribute($value);
return $this;
}
parent::setAttribute($attribute, $value);
} | [
"public",
"function",
"setAttribute",
"(",
"$",
"attribute",
",",
"$",
"value",
")",
"{",
"// Give mutator priority over custom casts",
"if",
"(",
"$",
"this",
"->",
"hasSetMutator",
"(",
"$",
"attribute",
")",
")",
"{",
"$",
"method",
"=",
"'set'",
".",
"st... | Hook into setAttribute logic and enable our custom cast do the job.
This method is will override method in HasAttributes trait.
@param $attribute
@param $value
@throws \Exception
@return mixed | [
"Hook",
"into",
"setAttribute",
"logic",
"and",
"enable",
"our",
"custom",
"cast",
"do",
"the",
"job",
"."
] | train | https://github.com/vkovic/laravel-custom-casts/blob/c25188e17fda9a8e95a2034cc6275b16b5027fed/src/package/HasCustomCasts.php#L61-L80 |
vkovic/laravel-custom-casts | src/package/HasCustomCasts.php | HasCustomCasts.castAttribute | protected function castAttribute($attribute, $value)
{
if (array_key_exists($attribute, $this->filterCustomCasts())) {
$customCastObject = $this->getCustomCastObject($attribute);
return $customCastObject->castAttribute($value);
}
return parent::castAttribute($attribute, $value);
} | php | protected function castAttribute($attribute, $value)
{
if (array_key_exists($attribute, $this->filterCustomCasts())) {
$customCastObject = $this->getCustomCastObject($attribute);
return $customCastObject->castAttribute($value);
}
return parent::castAttribute($attribute, $value);
} | [
"protected",
"function",
"castAttribute",
"(",
"$",
"attribute",
",",
"$",
"value",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"$",
"attribute",
",",
"$",
"this",
"->",
"filterCustomCasts",
"(",
")",
")",
")",
"{",
"$",
"customCastObject",
"=",
"$",
"... | Cast attribute (from db value to our custom format)
@param $attribute
@param $value
@return mixed|null | [
"Cast",
"attribute",
"(",
"from",
"db",
"value",
"to",
"our",
"custom",
"format",
")"
] | train | https://github.com/vkovic/laravel-custom-casts/blob/c25188e17fda9a8e95a2034cc6275b16b5027fed/src/package/HasCustomCasts.php#L91-L100 |
vkovic/laravel-custom-casts | src/package/HasCustomCasts.php | HasCustomCasts.getCustomCastObject | protected function getCustomCastObject($attribute)
{
// Check if custom cast object already been set
if (isset($this->customCastObjects[$attribute])) {
return $this->customCastObjects[$attribute];
}
$customCastClass = $this->casts[$attribute];
$customCastObject = new $customCastClass($this, $attribute);
return $this->customCastObjects[$attribute] = $customCastObject;
} | php | protected function getCustomCastObject($attribute)
{
// Check if custom cast object already been set
if (isset($this->customCastObjects[$attribute])) {
return $this->customCastObjects[$attribute];
}
$customCastClass = $this->casts[$attribute];
$customCastObject = new $customCastClass($this, $attribute);
return $this->customCastObjects[$attribute] = $customCastObject;
} | [
"protected",
"function",
"getCustomCastObject",
"(",
"$",
"attribute",
")",
"{",
"// Check if custom cast object already been set",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"customCastObjects",
"[",
"$",
"attribute",
"]",
")",
")",
"{",
"return",
"$",
"this",
... | Lazy load custom cast object and return it
@param $attribute
@return CustomCastBase | [
"Lazy",
"load",
"custom",
"cast",
"object",
"and",
"return",
"it"
] | train | https://github.com/vkovic/laravel-custom-casts/blob/c25188e17fda9a8e95a2034cc6275b16b5027fed/src/package/HasCustomCasts.php#L109-L120 |
vkovic/laravel-custom-casts | src/package/HasCustomCasts.php | HasCustomCasts.filterCustomCasts | protected function filterCustomCasts()
{
$customCasts = [];
foreach ($this->casts as $attribute => $castClass) {
if (is_subclass_of($castClass, CustomCastBase::class)) {
$customCasts[$attribute] = $castClass;
}
}
return $customCasts;
} | php | protected function filterCustomCasts()
{
$customCasts = [];
foreach ($this->casts as $attribute => $castClass) {
if (is_subclass_of($castClass, CustomCastBase::class)) {
$customCasts[$attribute] = $castClass;
}
}
return $customCasts;
} | [
"protected",
"function",
"filterCustomCasts",
"(",
")",
"{",
"$",
"customCasts",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"casts",
"as",
"$",
"attribute",
"=>",
"$",
"castClass",
")",
"{",
"if",
"(",
"is_subclass_of",
"(",
"$",
"castClass",... | Filter valid custom casts out of Model::$casts array
@return array - key: model attribute (field name)
- value: custom cast class name | [
"Filter",
"valid",
"custom",
"casts",
"out",
"of",
"Model",
"::",
"$casts",
"array"
] | train | https://github.com/vkovic/laravel-custom-casts/blob/c25188e17fda9a8e95a2034cc6275b16b5027fed/src/package/HasCustomCasts.php#L128-L138 |
egeloen/ivory-google-map | src/Helper/Renderer/LoaderRenderer.php | LoaderRenderer.render | public function render(
$name,
$callback,
array $libraries = [],
$newLine = true
) {
$formatter = $this->getFormatter();
$jsonBuilder = $this->getJsonBuilder();
$parameters = ['language' => $this->language];
if ($this->hasKey()) {
$parameters['key'] = $this->key;
}
if (!empty($libraries)) {
$parameters['libraries'] = implode(',', $libraries);
}
$jsonBuilder
->setValue('[other_params]', urldecode(http_build_query($parameters, '', '&')))
->setValue('[callback]', $callback, false);
return $formatter->renderClosure($formatter->renderCall($formatter->renderProperty('google', 'load'), [
$formatter->renderEscape('maps'),
$formatter->renderEscape('3'),
$jsonBuilder->build(),
]), [], $name, true, $newLine);
} | php | public function render(
$name,
$callback,
array $libraries = [],
$newLine = true
) {
$formatter = $this->getFormatter();
$jsonBuilder = $this->getJsonBuilder();
$parameters = ['language' => $this->language];
if ($this->hasKey()) {
$parameters['key'] = $this->key;
}
if (!empty($libraries)) {
$parameters['libraries'] = implode(',', $libraries);
}
$jsonBuilder
->setValue('[other_params]', urldecode(http_build_query($parameters, '', '&')))
->setValue('[callback]', $callback, false);
return $formatter->renderClosure($formatter->renderCall($formatter->renderProperty('google', 'load'), [
$formatter->renderEscape('maps'),
$formatter->renderEscape('3'),
$jsonBuilder->build(),
]), [], $name, true, $newLine);
} | [
"public",
"function",
"render",
"(",
"$",
"name",
",",
"$",
"callback",
",",
"array",
"$",
"libraries",
"=",
"[",
"]",
",",
"$",
"newLine",
"=",
"true",
")",
"{",
"$",
"formatter",
"=",
"$",
"this",
"->",
"getFormatter",
"(",
")",
";",
"$",
"jsonBu... | @param string $name
@param string $callback
@param string[] $libraries
@param bool $newLine
@return string | [
"@param",
"string",
"$name",
"@param",
"string",
"$callback",
"@param",
"string",
"[]",
"$libraries",
"@param",
"bool",
"$newLine"
] | train | https://github.com/egeloen/ivory-google-map/blob/bed66932ec35bda79d96cf04d91bb485875aa920/src/Helper/Renderer/LoaderRenderer.php#L94-L122 |
egeloen/ivory-google-map | src/Helper/Renderer/Layer/KmlLayerRenderer.php | KmlLayerRenderer.render | public function render(KmlLayer $kmlLayer, Map $map)
{
$formatter = $this->getFormatter();
$jsonBuilder = $this->getJsonBuilder()
->setValue('[map]', $map->getVariable(), false)
->setValues($kmlLayer->getOptions());
return $formatter->renderObjectAssignment($kmlLayer, $formatter->renderObject('KmlLayer', [
$formatter->renderEscape($kmlLayer->getUrl()),
$jsonBuilder->build(),
]));
} | php | public function render(KmlLayer $kmlLayer, Map $map)
{
$formatter = $this->getFormatter();
$jsonBuilder = $this->getJsonBuilder()
->setValue('[map]', $map->getVariable(), false)
->setValues($kmlLayer->getOptions());
return $formatter->renderObjectAssignment($kmlLayer, $formatter->renderObject('KmlLayer', [
$formatter->renderEscape($kmlLayer->getUrl()),
$jsonBuilder->build(),
]));
} | [
"public",
"function",
"render",
"(",
"KmlLayer",
"$",
"kmlLayer",
",",
"Map",
"$",
"map",
")",
"{",
"$",
"formatter",
"=",
"$",
"this",
"->",
"getFormatter",
"(",
")",
";",
"$",
"jsonBuilder",
"=",
"$",
"this",
"->",
"getJsonBuilder",
"(",
")",
"->",
... | @param KmlLayer $kmlLayer
@param Map $map
@return string | [
"@param",
"KmlLayer",
"$kmlLayer",
"@param",
"Map",
"$map"
] | train | https://github.com/egeloen/ivory-google-map/blob/bed66932ec35bda79d96cf04d91bb485875aa920/src/Helper/Renderer/Layer/KmlLayerRenderer.php#L29-L40 |
egeloen/ivory-google-map | src/Helper/Collector/Layer/KmlLayerCollector.php | KmlLayerCollector.collect | public function collect(Map $map, array $kmlLayers = [])
{
return $this->collectValues($map->getLayerManager()->getKmlLayers(), $kmlLayers);
} | php | public function collect(Map $map, array $kmlLayers = [])
{
return $this->collectValues($map->getLayerManager()->getKmlLayers(), $kmlLayers);
} | [
"public",
"function",
"collect",
"(",
"Map",
"$",
"map",
",",
"array",
"$",
"kmlLayers",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"collectValues",
"(",
"$",
"map",
"->",
"getLayerManager",
"(",
")",
"->",
"getKmlLayers",
"(",
")",
",",
"... | @param Map $map
@param KmlLayer[] $kmlLayers
@return KmlLayer[] | [
"@param",
"Map",
"$map",
"@param",
"KmlLayer",
"[]",
"$kmlLayers"
] | train | https://github.com/egeloen/ivory-google-map/blob/bed66932ec35bda79d96cf04d91bb485875aa920/src/Helper/Collector/Layer/KmlLayerCollector.php#L29-L32 |
egeloen/ivory-google-map | src/Helper/Renderer/Place/AutocompleteRenderer.php | AutocompleteRenderer.render | public function render(Autocomplete $autocomplete)
{
$formatter = $this->getFormatter();
$jsonBuilder = $this->getJsonBuilder();
if ($autocomplete->hasTypes()) {
$jsonBuilder->setValue('[types]', $autocomplete->getTypes());
}
if ($autocomplete->hasBound()) {
$jsonBuilder->setValue('[bounds]', $autocomplete->getBound()->getVariable(), false);
}
if ($autocomplete->hasComponents()) {
$jsonBuilder->setValue('[componentRestrictions]', $autocomplete->getComponents());
}
if (!$jsonBuilder->hasValues()) {
$jsonBuilder->setJsonEncodeOptions(JSON_FORCE_OBJECT);
}
return $formatter->renderObjectAssignment($autocomplete, $formatter->renderObject('Autocomplete', [
$formatter->renderCall($formatter->renderProperty('document', 'getElementById'), [
$formatter->renderEscape($autocomplete->getHtmlId()),
]),
$jsonBuilder->build(),
], $formatter->renderClass('places')));
} | php | public function render(Autocomplete $autocomplete)
{
$formatter = $this->getFormatter();
$jsonBuilder = $this->getJsonBuilder();
if ($autocomplete->hasTypes()) {
$jsonBuilder->setValue('[types]', $autocomplete->getTypes());
}
if ($autocomplete->hasBound()) {
$jsonBuilder->setValue('[bounds]', $autocomplete->getBound()->getVariable(), false);
}
if ($autocomplete->hasComponents()) {
$jsonBuilder->setValue('[componentRestrictions]', $autocomplete->getComponents());
}
if (!$jsonBuilder->hasValues()) {
$jsonBuilder->setJsonEncodeOptions(JSON_FORCE_OBJECT);
}
return $formatter->renderObjectAssignment($autocomplete, $formatter->renderObject('Autocomplete', [
$formatter->renderCall($formatter->renderProperty('document', 'getElementById'), [
$formatter->renderEscape($autocomplete->getHtmlId()),
]),
$jsonBuilder->build(),
], $formatter->renderClass('places')));
} | [
"public",
"function",
"render",
"(",
"Autocomplete",
"$",
"autocomplete",
")",
"{",
"$",
"formatter",
"=",
"$",
"this",
"->",
"getFormatter",
"(",
")",
";",
"$",
"jsonBuilder",
"=",
"$",
"this",
"->",
"getJsonBuilder",
"(",
")",
";",
"if",
"(",
"$",
"a... | @param Autocomplete $autocomplete
@return string | [
"@param",
"Autocomplete",
"$autocomplete"
] | train | https://github.com/egeloen/ivory-google-map/blob/bed66932ec35bda79d96cf04d91bb485875aa920/src/Helper/Renderer/Place/AutocompleteRenderer.php#L66-L93 |
egeloen/ivory-google-map | src/Helper/Renderer/Base/PointRenderer.php | PointRenderer.render | public function render(Point $point)
{
$formatter = $this->getFormatter();
return $formatter->renderObjectAssignment($point, $formatter->renderObject('Point', [
$point->getX(),
$point->getY(),
]));
} | php | public function render(Point $point)
{
$formatter = $this->getFormatter();
return $formatter->renderObjectAssignment($point, $formatter->renderObject('Point', [
$point->getX(),
$point->getY(),
]));
} | [
"public",
"function",
"render",
"(",
"Point",
"$",
"point",
")",
"{",
"$",
"formatter",
"=",
"$",
"this",
"->",
"getFormatter",
"(",
")",
";",
"return",
"$",
"formatter",
"->",
"renderObjectAssignment",
"(",
"$",
"point",
",",
"$",
"formatter",
"->",
"re... | @param Point $point
@return string | [
"@param",
"Point",
"$point"
] | train | https://github.com/egeloen/ivory-google-map/blob/bed66932ec35bda79d96cf04d91bb485875aa920/src/Helper/Renderer/Base/PointRenderer.php#L27-L35 |
egeloen/ivory-google-map | src/Helper/Renderer/Base/CoordinateRenderer.php | CoordinateRenderer.render | public function render(Coordinate $coordinate)
{
$formatter = $this->getFormatter();
return $formatter->renderObjectAssignment($coordinate, $formatter->renderObject('LatLng', [
$coordinate->getLatitude(),
$coordinate->getLongitude(),
$formatter->renderEscape($coordinate->isNoWrap()),
]));
} | php | public function render(Coordinate $coordinate)
{
$formatter = $this->getFormatter();
return $formatter->renderObjectAssignment($coordinate, $formatter->renderObject('LatLng', [
$coordinate->getLatitude(),
$coordinate->getLongitude(),
$formatter->renderEscape($coordinate->isNoWrap()),
]));
} | [
"public",
"function",
"render",
"(",
"Coordinate",
"$",
"coordinate",
")",
"{",
"$",
"formatter",
"=",
"$",
"this",
"->",
"getFormatter",
"(",
")",
";",
"return",
"$",
"formatter",
"->",
"renderObjectAssignment",
"(",
"$",
"coordinate",
",",
"$",
"formatter"... | @param Coordinate $coordinate
@return string | [
"@param",
"Coordinate",
"$coordinate"
] | train | https://github.com/egeloen/ivory-google-map/blob/bed66932ec35bda79d96cf04d91bb485875aa920/src/Helper/Renderer/Base/CoordinateRenderer.php#L27-L36 |
egeloen/ivory-google-map | src/Helper/Renderer/Geometry/EncodingRenderer.php | EncodingRenderer.renderDecodePath | public function renderDecodePath($encodedPath)
{
$formatter = $this->getFormatter();
return $formatter->renderCall(
$formatter->renderProperty($formatter->renderClass('geometry.encoding'), 'decodePath'),
[$formatter->renderEscape($encodedPath)]
);
} | php | public function renderDecodePath($encodedPath)
{
$formatter = $this->getFormatter();
return $formatter->renderCall(
$formatter->renderProperty($formatter->renderClass('geometry.encoding'), 'decodePath'),
[$formatter->renderEscape($encodedPath)]
);
} | [
"public",
"function",
"renderDecodePath",
"(",
"$",
"encodedPath",
")",
"{",
"$",
"formatter",
"=",
"$",
"this",
"->",
"getFormatter",
"(",
")",
";",
"return",
"$",
"formatter",
"->",
"renderCall",
"(",
"$",
"formatter",
"->",
"renderProperty",
"(",
"$",
"... | @param string $encodedPath
@return string | [
"@param",
"string",
"$encodedPath"
] | train | https://github.com/egeloen/ivory-google-map/blob/bed66932ec35bda79d96cf04d91bb485875aa920/src/Helper/Renderer/Geometry/EncodingRenderer.php#L28-L36 |
egeloen/ivory-google-map | src/Helper/Renderer/Control/ZoomControlRenderer.php | ZoomControlRenderer.render | public function render($control)
{
if (!$control instanceof ZoomControl) {
throw new \InvalidArgumentException(sprintf(
'Expected a "%s", got "%s".',
ZoomControl::class,
is_object($control) ? get_class($control) : gettype($control)
));
}
return $this->getJsonBuilder()
->setValue('[position]', $this->controlPositionRenderer->render($control->getPosition()), false)
->setValue('[style]', $this->zoomControlStyleRenderer->render($control->getStyle()), false)
->build();
} | php | public function render($control)
{
if (!$control instanceof ZoomControl) {
throw new \InvalidArgumentException(sprintf(
'Expected a "%s", got "%s".',
ZoomControl::class,
is_object($control) ? get_class($control) : gettype($control)
));
}
return $this->getJsonBuilder()
->setValue('[position]', $this->controlPositionRenderer->render($control->getPosition()), false)
->setValue('[style]', $this->zoomControlStyleRenderer->render($control->getStyle()), false)
->build();
} | [
"public",
"function",
"render",
"(",
"$",
"control",
")",
"{",
"if",
"(",
"!",
"$",
"control",
"instanceof",
"ZoomControl",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"sprintf",
"(",
"'Expected a \"%s\", got \"%s\".'",
",",
"ZoomControl",
"... | {@inheritdoc} | [
"{"
] | train | https://github.com/egeloen/ivory-google-map/blob/bed66932ec35bda79d96cf04d91bb485875aa920/src/Helper/Renderer/Control/ZoomControlRenderer.php#L87-L101 |
egeloen/ivory-google-map | src/Helper/Collector/Overlay/MarkerCollector.php | MarkerCollector.collect | public function collect(Map $map, array $markers = [])
{
return $this->collectValues($map->getOverlayManager()->getMarkers(), $markers);
} | php | public function collect(Map $map, array $markers = [])
{
return $this->collectValues($map->getOverlayManager()->getMarkers(), $markers);
} | [
"public",
"function",
"collect",
"(",
"Map",
"$",
"map",
",",
"array",
"$",
"markers",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"collectValues",
"(",
"$",
"map",
"->",
"getOverlayManager",
"(",
")",
"->",
"getMarkers",
"(",
")",
",",
"$"... | @param Map $map
@param Marker[] $markers
@return Marker[] | [
"@param",
"Map",
"$map",
"@param",
"Marker",
"[]",
"$markers"
] | train | https://github.com/egeloen/ivory-google-map/blob/bed66932ec35bda79d96cf04d91bb485875aa920/src/Helper/Collector/Overlay/MarkerCollector.php#L29-L32 |
egeloen/ivory-google-map | src/Helper/Subscriber/Overlay/MarkerClustererSubscriber.php | MarkerClustererSubscriber.getMarkerCluster | private function getMarkerCluster(Map $map)
{
$markerCluster = $map->getOverlayManager()->getMarkerCluster();
if ($markerCluster->getType() === MarkerClusterType::MARKER_CLUSTERER) {
return $markerCluster;
}
} | php | private function getMarkerCluster(Map $map)
{
$markerCluster = $map->getOverlayManager()->getMarkerCluster();
if ($markerCluster->getType() === MarkerClusterType::MARKER_CLUSTERER) {
return $markerCluster;
}
} | [
"private",
"function",
"getMarkerCluster",
"(",
"Map",
"$",
"map",
")",
"{",
"$",
"markerCluster",
"=",
"$",
"map",
"->",
"getOverlayManager",
"(",
")",
"->",
"getMarkerCluster",
"(",
")",
";",
"if",
"(",
"$",
"markerCluster",
"->",
"getType",
"(",
")",
... | @param Map $map
@return MarkerCluster|null | [
"@param",
"Map",
"$map"
] | train | https://github.com/egeloen/ivory-google-map/blob/bed66932ec35bda79d96cf04d91bb485875aa920/src/Helper/Subscriber/Overlay/MarkerClustererSubscriber.php#L113-L120 |
egeloen/ivory-google-map | src/Helper/Renderer/Image/Overlay/MarkerRenderer.php | MarkerRenderer.render | public function render(array $markers)
{
$result = [];
$marker = current($markers);
$style = $this->markerStyleRenderer->render($marker);
if (!empty($style)) {
$result[] = $style;
}
foreach ($markers as $marker) {
$result[] = $this->markerLocationRenderer->render($marker);
}
return implode('|', $result);
} | php | public function render(array $markers)
{
$result = [];
$marker = current($markers);
$style = $this->markerStyleRenderer->render($marker);
if (!empty($style)) {
$result[] = $style;
}
foreach ($markers as $marker) {
$result[] = $this->markerLocationRenderer->render($marker);
}
return implode('|', $result);
} | [
"public",
"function",
"render",
"(",
"array",
"$",
"markers",
")",
"{",
"$",
"result",
"=",
"[",
"]",
";",
"$",
"marker",
"=",
"current",
"(",
"$",
"markers",
")",
";",
"$",
"style",
"=",
"$",
"this",
"->",
"markerStyleRenderer",
"->",
"render",
"(",... | @param Marker[] $markers
@return string | [
"@param",
"Marker",
"[]",
"$markers"
] | train | https://github.com/egeloen/ivory-google-map/blob/bed66932ec35bda79d96cf04d91bb485875aa920/src/Helper/Renderer/Image/Overlay/MarkerRenderer.php#L48-L63 |
egeloen/ivory-google-map | src/Helper/Renderer/Overlay/PolygonRenderer.php | PolygonRenderer.render | public function render(Polygon $polygon, Map $map)
{
$formatter = $this->getFormatter();
$jsonBuilder = $this->getJsonBuilder()
->setValue('[map]', $map->getVariable(), false)
->setValue('[paths]', []);
foreach ($polygon->getCoordinates() as $index => $coordinate) {
$jsonBuilder->setValue('[paths]['.$index.']', $coordinate->getVariable(), false);
}
$jsonBuilder->setValues($polygon->getOptions());
return $formatter->renderObjectAssignment($polygon, $formatter->renderObject('Polygon', [
$jsonBuilder->build(),
]));
} | php | public function render(Polygon $polygon, Map $map)
{
$formatter = $this->getFormatter();
$jsonBuilder = $this->getJsonBuilder()
->setValue('[map]', $map->getVariable(), false)
->setValue('[paths]', []);
foreach ($polygon->getCoordinates() as $index => $coordinate) {
$jsonBuilder->setValue('[paths]['.$index.']', $coordinate->getVariable(), false);
}
$jsonBuilder->setValues($polygon->getOptions());
return $formatter->renderObjectAssignment($polygon, $formatter->renderObject('Polygon', [
$jsonBuilder->build(),
]));
} | [
"public",
"function",
"render",
"(",
"Polygon",
"$",
"polygon",
",",
"Map",
"$",
"map",
")",
"{",
"$",
"formatter",
"=",
"$",
"this",
"->",
"getFormatter",
"(",
")",
";",
"$",
"jsonBuilder",
"=",
"$",
"this",
"->",
"getJsonBuilder",
"(",
")",
"->",
"... | @param Polygon $polygon
@param Map $map
@return string | [
"@param",
"Polygon",
"$polygon",
"@param",
"Map",
"$map"
] | train | https://github.com/egeloen/ivory-google-map/blob/bed66932ec35bda79d96cf04d91bb485875aa920/src/Helper/Renderer/Overlay/PolygonRenderer.php#L29-L45 |
egeloen/ivory-google-map | src/Helper/Renderer/Event/AbstractEventRenderer.php | AbstractEventRenderer.render | public function render(Event $event)
{
$formatter = $this->getFormatter();
$arguments = [
$event->getInstance(),
$formatter->renderEscape($event->getTrigger()),
$event->getHandle(),
];
if ($this->hasCapture()) {
$arguments[] = $formatter->renderEscape($event->isCapture());
}
return $formatter->renderObjectAssignment($event, $formatter->renderCall(
$formatter->renderProperty($formatter->renderClass('event'), $this->getMethod()),
$arguments
));
} | php | public function render(Event $event)
{
$formatter = $this->getFormatter();
$arguments = [
$event->getInstance(),
$formatter->renderEscape($event->getTrigger()),
$event->getHandle(),
];
if ($this->hasCapture()) {
$arguments[] = $formatter->renderEscape($event->isCapture());
}
return $formatter->renderObjectAssignment($event, $formatter->renderCall(
$formatter->renderProperty($formatter->renderClass('event'), $this->getMethod()),
$arguments
));
} | [
"public",
"function",
"render",
"(",
"Event",
"$",
"event",
")",
"{",
"$",
"formatter",
"=",
"$",
"this",
"->",
"getFormatter",
"(",
")",
";",
"$",
"arguments",
"=",
"[",
"$",
"event",
"->",
"getInstance",
"(",
")",
",",
"$",
"formatter",
"->",
"rend... | @param Event $event
@return string | [
"@param",
"Event",
"$event"
] | train | https://github.com/egeloen/ivory-google-map/blob/bed66932ec35bda79d96cf04d91bb485875aa920/src/Helper/Renderer/Event/AbstractEventRenderer.php#L27-L45 |
egeloen/ivory-google-map | src/Helper/Subscriber/Overlay/OverlaySubscriber.php | OverlaySubscriber.getDelegatedSubscribedEvents | public static function getDelegatedSubscribedEvents()
{
return [
MapEvents::JAVASCRIPT_OVERLAY => [
MapEvents::JAVASCRIPT_OVERLAY_ICON,
MapEvents::JAVASCRIPT_OVERLAY_SYMBOL,
MapEvents::JAVASCRIPT_OVERLAY_ICON_SEQUENCE,
MapEvents::JAVASCRIPT_OVERLAY_CIRCLE,
MapEvents::JAVASCRIPT_OVERLAY_ENCODED_POLYLINE,
MapEvents::JAVASCRIPT_OVERLAY_GROUND_OVERLAY,
MapEvents::JAVASCRIPT_OVERLAY_POLYGON,
MapEvents::JAVASCRIPT_OVERLAY_POLYLINE,
MapEvents::JAVASCRIPT_OVERLAY_RECTANGLE,
MapEvents::JAVASCRIPT_OVERLAY_INFO_WINDOW,
MapEvents::JAVASCRIPT_OVERLAY_MARKER_SHAPE,
MapEvents::JAVASCRIPT_OVERLAY_MARKER,
MapEvents::JAVASCRIPT_OVERLAY_MARKER_CLUSTER,
],
];
} | php | public static function getDelegatedSubscribedEvents()
{
return [
MapEvents::JAVASCRIPT_OVERLAY => [
MapEvents::JAVASCRIPT_OVERLAY_ICON,
MapEvents::JAVASCRIPT_OVERLAY_SYMBOL,
MapEvents::JAVASCRIPT_OVERLAY_ICON_SEQUENCE,
MapEvents::JAVASCRIPT_OVERLAY_CIRCLE,
MapEvents::JAVASCRIPT_OVERLAY_ENCODED_POLYLINE,
MapEvents::JAVASCRIPT_OVERLAY_GROUND_OVERLAY,
MapEvents::JAVASCRIPT_OVERLAY_POLYGON,
MapEvents::JAVASCRIPT_OVERLAY_POLYLINE,
MapEvents::JAVASCRIPT_OVERLAY_RECTANGLE,
MapEvents::JAVASCRIPT_OVERLAY_INFO_WINDOW,
MapEvents::JAVASCRIPT_OVERLAY_MARKER_SHAPE,
MapEvents::JAVASCRIPT_OVERLAY_MARKER,
MapEvents::JAVASCRIPT_OVERLAY_MARKER_CLUSTER,
],
];
} | [
"public",
"static",
"function",
"getDelegatedSubscribedEvents",
"(",
")",
"{",
"return",
"[",
"MapEvents",
"::",
"JAVASCRIPT_OVERLAY",
"=>",
"[",
"MapEvents",
"::",
"JAVASCRIPT_OVERLAY_ICON",
",",
"MapEvents",
"::",
"JAVASCRIPT_OVERLAY_SYMBOL",
",",
"MapEvents",
"::",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/egeloen/ivory-google-map/blob/bed66932ec35bda79d96cf04d91bb485875aa920/src/Helper/Subscriber/Overlay/OverlaySubscriber.php#L25-L44 |
egeloen/ivory-google-map | src/Helper/Collector/Overlay/RectangleCollector.php | RectangleCollector.collect | public function collect(Map $map, array $rectangles = [])
{
return $this->collectValues($map->getOverlayManager()->getRectangles(), $rectangles);
} | php | public function collect(Map $map, array $rectangles = [])
{
return $this->collectValues($map->getOverlayManager()->getRectangles(), $rectangles);
} | [
"public",
"function",
"collect",
"(",
"Map",
"$",
"map",
",",
"array",
"$",
"rectangles",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"collectValues",
"(",
"$",
"map",
"->",
"getOverlayManager",
"(",
")",
"->",
"getRectangles",
"(",
")",
",",... | @param Map $map
@param Rectangle[] $rectangles
@return Rectangle[] | [
"@param",
"Map",
"$map",
"@param",
"Rectangle",
"[]",
"$rectangles"
] | train | https://github.com/egeloen/ivory-google-map/blob/bed66932ec35bda79d96cf04d91bb485875aa920/src/Helper/Collector/Overlay/RectangleCollector.php#L29-L32 |
egeloen/ivory-google-map | src/Helper/Collector/Event/EventCollector.php | EventCollector.collect | public function collect(Map $map, array $events = [])
{
return $this->collectValues($map->getEventManager()->getEvents(), $events);
} | php | public function collect(Map $map, array $events = [])
{
return $this->collectValues($map->getEventManager()->getEvents(), $events);
} | [
"public",
"function",
"collect",
"(",
"Map",
"$",
"map",
",",
"array",
"$",
"events",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"collectValues",
"(",
"$",
"map",
"->",
"getEventManager",
"(",
")",
"->",
"getEvents",
"(",
")",
",",
"$",
... | @param Map $map
@param Event[] $events
@return Event[] | [
"@param",
"Map",
"$map",
"@param",
"Event",
"[]",
"$events"
] | train | https://github.com/egeloen/ivory-google-map/blob/bed66932ec35bda79d96cf04d91bb485875aa920/src/Helper/Collector/Event/EventCollector.php#L29-L32 |
egeloen/ivory-google-map | src/Helper/Renderer/Overlay/SymbolRenderer.php | SymbolRenderer.render | public function render(Symbol $symbol)
{
$jsonBuilder = $this->getJsonBuilder()
->setValue('[path]', $this->symbolPathRenderer->render($symbol->getPath()), false);
if ($symbol->hasAnchor()) {
$jsonBuilder->setValue('[anchor]', $symbol->getAnchor()->getVariable(), false);
}
if ($symbol->hasLabelOrigin()) {
$jsonBuilder->setValue('[labelOrigin]', $symbol->getLabelOrigin()->getVariable(), false);
}
$jsonBuilder->setValues($symbol->getOptions());
return $this->getFormatter()->renderObjectAssignment($symbol, $jsonBuilder->build());
} | php | public function render(Symbol $symbol)
{
$jsonBuilder = $this->getJsonBuilder()
->setValue('[path]', $this->symbolPathRenderer->render($symbol->getPath()), false);
if ($symbol->hasAnchor()) {
$jsonBuilder->setValue('[anchor]', $symbol->getAnchor()->getVariable(), false);
}
if ($symbol->hasLabelOrigin()) {
$jsonBuilder->setValue('[labelOrigin]', $symbol->getLabelOrigin()->getVariable(), false);
}
$jsonBuilder->setValues($symbol->getOptions());
return $this->getFormatter()->renderObjectAssignment($symbol, $jsonBuilder->build());
} | [
"public",
"function",
"render",
"(",
"Symbol",
"$",
"symbol",
")",
"{",
"$",
"jsonBuilder",
"=",
"$",
"this",
"->",
"getJsonBuilder",
"(",
")",
"->",
"setValue",
"(",
"'[path]'",
",",
"$",
"this",
"->",
"symbolPathRenderer",
"->",
"render",
"(",
"$",
"sy... | @param Symbol $symbol
@return string | [
"@param",
"Symbol",
"$symbol"
] | train | https://github.com/egeloen/ivory-google-map/blob/bed66932ec35bda79d96cf04d91bb485875aa920/src/Helper/Renderer/Overlay/SymbolRenderer.php#L62-L78 |
egeloen/ivory-google-map | src/Helper/Renderer/Image/Overlay/AbstractStyleRenderer.php | AbstractStyleRenderer.renderStyle | public function renderStyle(array $styles)
{
if (empty($styles)) {
return;
}
$result = [];
ksort($styles);
foreach ($styles as $style => $value) {
$result[] = $style.':'.$value;
}
return implode('|', $result);
} | php | public function renderStyle(array $styles)
{
if (empty($styles)) {
return;
}
$result = [];
ksort($styles);
foreach ($styles as $style => $value) {
$result[] = $style.':'.$value;
}
return implode('|', $result);
} | [
"public",
"function",
"renderStyle",
"(",
"array",
"$",
"styles",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"styles",
")",
")",
"{",
"return",
";",
"}",
"$",
"result",
"=",
"[",
"]",
";",
"ksort",
"(",
"$",
"styles",
")",
";",
"foreach",
"(",
"$",
... | @param mixed[] $styles
@return string | [
"@param",
"mixed",
"[]",
"$styles"
] | train | https://github.com/egeloen/ivory-google-map/blob/bed66932ec35bda79d96cf04d91bb485875aa920/src/Helper/Renderer/Image/Overlay/AbstractStyleRenderer.php#L24-L38 |
egeloen/ivory-google-map | src/Service/BusinessAccount.php | BusinessAccount.signUrl | public function signUrl($url)
{
return UrlSigner::sign($url, $this->secret, $this->clientId, $this->channel);
} | php | public function signUrl($url)
{
return UrlSigner::sign($url, $this->secret, $this->clientId, $this->channel);
} | [
"public",
"function",
"signUrl",
"(",
"$",
"url",
")",
"{",
"return",
"UrlSigner",
"::",
"sign",
"(",
"$",
"url",
",",
"$",
"this",
"->",
"secret",
",",
"$",
"this",
"->",
"clientId",
",",
"$",
"this",
"->",
"channel",
")",
";",
"}"
] | @param string $url
@return string | [
"@param",
"string",
"$url"
] | train | https://github.com/egeloen/ivory-google-map/blob/bed66932ec35bda79d96cf04d91bb485875aa920/src/Service/BusinessAccount.php#L107-L110 |
egeloen/ivory-google-map | src/Helper/Renderer/Overlay/GroundOverlayRenderer.php | GroundOverlayRenderer.render | public function render(GroundOverlay $groundOverlay, Map $map)
{
$formatter = $this->getFormatter();
$jsonBuilder = $this->getJsonBuilder()
->setValue('[map]', $map->getVariable(), false)
->setValues($groundOverlay->getOptions());
return $formatter->renderObjectAssignment($groundOverlay, $formatter->renderObject('GroundOverlay', [
$formatter->renderEscape($groundOverlay->getUrl()),
$groundOverlay->getBound()->getVariable(),
$jsonBuilder->build(),
]));
} | php | public function render(GroundOverlay $groundOverlay, Map $map)
{
$formatter = $this->getFormatter();
$jsonBuilder = $this->getJsonBuilder()
->setValue('[map]', $map->getVariable(), false)
->setValues($groundOverlay->getOptions());
return $formatter->renderObjectAssignment($groundOverlay, $formatter->renderObject('GroundOverlay', [
$formatter->renderEscape($groundOverlay->getUrl()),
$groundOverlay->getBound()->getVariable(),
$jsonBuilder->build(),
]));
} | [
"public",
"function",
"render",
"(",
"GroundOverlay",
"$",
"groundOverlay",
",",
"Map",
"$",
"map",
")",
"{",
"$",
"formatter",
"=",
"$",
"this",
"->",
"getFormatter",
"(",
")",
";",
"$",
"jsonBuilder",
"=",
"$",
"this",
"->",
"getJsonBuilder",
"(",
")",... | @param GroundOverlay $groundOverlay
@param Map $map
@return string | [
"@param",
"GroundOverlay",
"$groundOverlay",
"@param",
"Map",
"$map"
] | train | https://github.com/egeloen/ivory-google-map/blob/bed66932ec35bda79d96cf04d91bb485875aa920/src/Helper/Renderer/Overlay/GroundOverlayRenderer.php#L29-L41 |
egeloen/ivory-google-map | src/Helper/Renderer/Base/SizeRenderer.php | SizeRenderer.render | public function render(Size $size)
{
$formatter = $this->getFormatter();
$arguments = [
$size->getWidth(),
$size->getHeight(),
];
if ($size->hasUnits()) {
$arguments[] = $formatter->renderEscape($size->getWidthUnit());
$arguments[] = $formatter->renderEscape($size->getHeightUnit());
}
return $formatter->renderObjectAssignment($size, $formatter->renderObject('Size', $arguments));
} | php | public function render(Size $size)
{
$formatter = $this->getFormatter();
$arguments = [
$size->getWidth(),
$size->getHeight(),
];
if ($size->hasUnits()) {
$arguments[] = $formatter->renderEscape($size->getWidthUnit());
$arguments[] = $formatter->renderEscape($size->getHeightUnit());
}
return $formatter->renderObjectAssignment($size, $formatter->renderObject('Size', $arguments));
} | [
"public",
"function",
"render",
"(",
"Size",
"$",
"size",
")",
"{",
"$",
"formatter",
"=",
"$",
"this",
"->",
"getFormatter",
"(",
")",
";",
"$",
"arguments",
"=",
"[",
"$",
"size",
"->",
"getWidth",
"(",
")",
",",
"$",
"size",
"->",
"getHeight",
"... | @param Size $size
@return string | [
"@param",
"Size",
"$size"
] | train | https://github.com/egeloen/ivory-google-map/blob/bed66932ec35bda79d96cf04d91bb485875aa920/src/Helper/Renderer/Base/SizeRenderer.php#L27-L41 |
egeloen/ivory-google-map | src/Helper/Renderer/Html/JavascriptTagRenderer.php | JavascriptTagRenderer.render | public function render($code = null, array $attributes = [], $newLine = true)
{
return $this->getTagRenderer()->render(
'script',
$code,
array_merge(['type' => 'text/javascript'], $attributes),
$newLine
);
} | php | public function render($code = null, array $attributes = [], $newLine = true)
{
return $this->getTagRenderer()->render(
'script',
$code,
array_merge(['type' => 'text/javascript'], $attributes),
$newLine
);
} | [
"public",
"function",
"render",
"(",
"$",
"code",
"=",
"null",
",",
"array",
"$",
"attributes",
"=",
"[",
"]",
",",
"$",
"newLine",
"=",
"true",
")",
"{",
"return",
"$",
"this",
"->",
"getTagRenderer",
"(",
")",
"->",
"render",
"(",
"'script'",
",",
... | @param string|null $code
@param string[] $attributes
@param bool $newLine
@return string | [
"@param",
"string|null",
"$code",
"@param",
"string",
"[]",
"$attributes",
"@param",
"bool",
"$newLine"
] | train | https://github.com/egeloen/ivory-google-map/blob/bed66932ec35bda79d96cf04d91bb485875aa920/src/Helper/Renderer/Html/JavascriptTagRenderer.php#L26-L34 |
egeloen/ivory-google-map | src/Helper/StaticMapHelper.php | StaticMapHelper.render | public function render(Map $map)
{
$this->getEventDispatcher()->dispatch(StaticMapEvents::HTML, $event = new StaticMapEvent($map));
$query = preg_replace('/(%5B[0-9]+%5D)+=/', '=', http_build_query($event->getParameters(), '', '&'));
$url = 'https://maps.googleapis.com/maps/api/staticmap?'.$query;
if ($this->hasSecret()) {
$url = UrlSigner::sign($url, $this->secret, $this->clientId, $this->channel);
}
return $url;
} | php | public function render(Map $map)
{
$this->getEventDispatcher()->dispatch(StaticMapEvents::HTML, $event = new StaticMapEvent($map));
$query = preg_replace('/(%5B[0-9]+%5D)+=/', '=', http_build_query($event->getParameters(), '', '&'));
$url = 'https://maps.googleapis.com/maps/api/staticmap?'.$query;
if ($this->hasSecret()) {
$url = UrlSigner::sign($url, $this->secret, $this->clientId, $this->channel);
}
return $url;
} | [
"public",
"function",
"render",
"(",
"Map",
"$",
"map",
")",
"{",
"$",
"this",
"->",
"getEventDispatcher",
"(",
")",
"->",
"dispatch",
"(",
"StaticMapEvents",
"::",
"HTML",
",",
"$",
"event",
"=",
"new",
"StaticMapEvent",
"(",
"$",
"map",
")",
")",
";"... | @param Map $map
@return string | [
"@param",
"Map",
"$map"
] | train | https://github.com/egeloen/ivory-google-map/blob/bed66932ec35bda79d96cf04d91bb485875aa920/src/Helper/StaticMapHelper.php#L136-L148 |
egeloen/ivory-google-map | src/Helper/Collector/Base/PointCollector.php | PointCollector.collect | public function collect(Map $map, array $points = [])
{
foreach ($this->markerCollector->collect($map) as $marker) {
if ($marker->hasIcon()) {
$icon = $marker->getIcon();
if ($icon->hasAnchor()) {
$points = $this->collectValue($icon->getAnchor(), $points);
}
if ($icon->hasOrigin()) {
$points = $this->collectValue($icon->getOrigin(), $points);
}
}
}
return $points;
} | php | public function collect(Map $map, array $points = [])
{
foreach ($this->markerCollector->collect($map) as $marker) {
if ($marker->hasIcon()) {
$icon = $marker->getIcon();
if ($icon->hasAnchor()) {
$points = $this->collectValue($icon->getAnchor(), $points);
}
if ($icon->hasOrigin()) {
$points = $this->collectValue($icon->getOrigin(), $points);
}
}
}
return $points;
} | [
"public",
"function",
"collect",
"(",
"Map",
"$",
"map",
",",
"array",
"$",
"points",
"=",
"[",
"]",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"markerCollector",
"->",
"collect",
"(",
"$",
"map",
")",
"as",
"$",
"marker",
")",
"{",
"if",
"(",
... | @param Map $map
@param Point[] $points
@return Point[] | [
"@param",
"Map",
"$map",
"@param",
"Point",
"[]",
"$points"
] | train | https://github.com/egeloen/ivory-google-map/blob/bed66932ec35bda79d96cf04d91bb485875aa920/src/Helper/Collector/Base/PointCollector.php#L59-L76 |
egeloen/ivory-google-map | src/Helper/Collector/Overlay/InfoWindowCollector.php | InfoWindowCollector.collect | public function collect(Map $map, array $infoWindows = [], $strategy = null)
{
if ($strategy === null) {
$strategy = self::STRATEGY_MAP | self::STRATEGY_MARKER;
}
if ($strategy & self::STRATEGY_MAP) {
$infoWindows = $this->collectValues($map->getOverlayManager()->getInfoWindows(), $infoWindows);
}
if ($strategy & self::STRATEGY_MARKER) {
foreach ($this->markerCollector->collect($map) as $marker) {
if ($marker->hasInfoWindow()) {
$infoWindows = $this->collectValue($marker->getInfoWindow(), $infoWindows);
}
}
}
return $infoWindows;
} | php | public function collect(Map $map, array $infoWindows = [], $strategy = null)
{
if ($strategy === null) {
$strategy = self::STRATEGY_MAP | self::STRATEGY_MARKER;
}
if ($strategy & self::STRATEGY_MAP) {
$infoWindows = $this->collectValues($map->getOverlayManager()->getInfoWindows(), $infoWindows);
}
if ($strategy & self::STRATEGY_MARKER) {
foreach ($this->markerCollector->collect($map) as $marker) {
if ($marker->hasInfoWindow()) {
$infoWindows = $this->collectValue($marker->getInfoWindow(), $infoWindows);
}
}
}
return $infoWindows;
} | [
"public",
"function",
"collect",
"(",
"Map",
"$",
"map",
",",
"array",
"$",
"infoWindows",
"=",
"[",
"]",
",",
"$",
"strategy",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"strategy",
"===",
"null",
")",
"{",
"$",
"strategy",
"=",
"self",
"::",
"STRATEG... | @param Map $map
@param InfoWindow[] $infoWindows
@param int|null $strategy
@return InfoWindow[] | [
"@param",
"Map",
"$map",
"@param",
"InfoWindow",
"[]",
"$infoWindows",
"@param",
"int|null",
"$strategy"
] | train | https://github.com/egeloen/ivory-google-map/blob/bed66932ec35bda79d96cf04d91bb485875aa920/src/Helper/Collector/Overlay/InfoWindowCollector.php#L85-L104 |
egeloen/ivory-google-map | src/Helper/Collector/Overlay/InfoWindowCollector.php | InfoWindowCollector.collectValue | protected function collectValue($value, array $defaults = [])
{
if ($this->type !== null && $value->getType() !== $this->type) {
return $defaults;
}
return parent::collectValue($value, $defaults);
} | php | protected function collectValue($value, array $defaults = [])
{
if ($this->type !== null && $value->getType() !== $this->type) {
return $defaults;
}
return parent::collectValue($value, $defaults);
} | [
"protected",
"function",
"collectValue",
"(",
"$",
"value",
",",
"array",
"$",
"defaults",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"type",
"!==",
"null",
"&&",
"$",
"value",
"->",
"getType",
"(",
")",
"!==",
"$",
"this",
"->",
"type"... | {@inheritdoc} | [
"{"
] | train | https://github.com/egeloen/ivory-google-map/blob/bed66932ec35bda79d96cf04d91bb485875aa920/src/Helper/Collector/Overlay/InfoWindowCollector.php#L109-L116 |
egeloen/ivory-google-map | src/Helper/Renderer/Image/Overlay/PolylineStyleRenderer.php | PolylineStyleRenderer.render | public function render(Polyline $polyline)
{
return $this->renderPolylineStyle(
$polyline->hasStaticOption('styles') ? $polyline->getStaticOption('styles') : [],
$polyline
);
} | php | public function render(Polyline $polyline)
{
return $this->renderPolylineStyle(
$polyline->hasStaticOption('styles') ? $polyline->getStaticOption('styles') : [],
$polyline
);
} | [
"public",
"function",
"render",
"(",
"Polyline",
"$",
"polyline",
")",
"{",
"return",
"$",
"this",
"->",
"renderPolylineStyle",
"(",
"$",
"polyline",
"->",
"hasStaticOption",
"(",
"'styles'",
")",
"?",
"$",
"polyline",
"->",
"getStaticOption",
"(",
"'styles'",... | @param Polyline $polyline
@return string | [
"@param",
"Polyline",
"$polyline"
] | train | https://github.com/egeloen/ivory-google-map/blob/bed66932ec35bda79d96cf04d91bb485875aa920/src/Helper/Renderer/Image/Overlay/PolylineStyleRenderer.php#L26-L32 |
egeloen/ivory-google-map | src/Helper/Collector/Event/DomEventOnceCollector.php | DomEventOnceCollector.collect | public function collect(Map $map, array $domEventsOnce = [])
{
return $this->collectValues($map->getEventManager()->getDomEventsOnce(), $domEventsOnce);
} | php | public function collect(Map $map, array $domEventsOnce = [])
{
return $this->collectValues($map->getEventManager()->getDomEventsOnce(), $domEventsOnce);
} | [
"public",
"function",
"collect",
"(",
"Map",
"$",
"map",
",",
"array",
"$",
"domEventsOnce",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"collectValues",
"(",
"$",
"map",
"->",
"getEventManager",
"(",
")",
"->",
"getDomEventsOnce",
"(",
")",
... | @param Map $map
@param Event[] $domEventsOnce
@return Event[] | [
"@param",
"Map",
"$map",
"@param",
"Event",
"[]",
"$domEventsOnce"
] | train | https://github.com/egeloen/ivory-google-map/blob/bed66932ec35bda79d96cf04d91bb485875aa920/src/Helper/Collector/Event/DomEventOnceCollector.php#L29-L32 |
egeloen/ivory-google-map | src/Helper/Renderer/Overlay/RectangleRenderer.php | RectangleRenderer.render | public function render(Rectangle $rectangle, Map $map)
{
$formatter = $this->getFormatter();
$jsonBuilder = $this->getJsonBuilder()
->setValue('[map]', $map->getVariable(), false)
->setValue('[bounds]', $rectangle->getBound()->getVariable(), false)
->setValues($rectangle->getOptions());
return $formatter->renderObjectAssignment($rectangle, $formatter->renderObject('Rectangle', [
$jsonBuilder->build(),
]));
} | php | public function render(Rectangle $rectangle, Map $map)
{
$formatter = $this->getFormatter();
$jsonBuilder = $this->getJsonBuilder()
->setValue('[map]', $map->getVariable(), false)
->setValue('[bounds]', $rectangle->getBound()->getVariable(), false)
->setValues($rectangle->getOptions());
return $formatter->renderObjectAssignment($rectangle, $formatter->renderObject('Rectangle', [
$jsonBuilder->build(),
]));
} | [
"public",
"function",
"render",
"(",
"Rectangle",
"$",
"rectangle",
",",
"Map",
"$",
"map",
")",
"{",
"$",
"formatter",
"=",
"$",
"this",
"->",
"getFormatter",
"(",
")",
";",
"$",
"jsonBuilder",
"=",
"$",
"this",
"->",
"getJsonBuilder",
"(",
")",
"->",... | @param Rectangle $rectangle
@param Map $map
@return string | [
"@param",
"Rectangle",
"$rectangle",
"@param",
"Map",
"$map"
] | train | https://github.com/egeloen/ivory-google-map/blob/bed66932ec35bda79d96cf04d91bb485875aa920/src/Helper/Renderer/Overlay/RectangleRenderer.php#L29-L40 |
egeloen/ivory-google-map | src/Helper/Renderer/Utility/RequirementLoaderRenderer.php | RequirementLoaderRenderer.render | public function render(
$name,
$intervalVariable = null,
$callbackVariable = null,
$requirementVariable = null,
$interval = 10,
$newLine = true
) {
$formatter = $this->getFormatter();
$intervalVariable = $intervalVariable ?: 'i';
$callbackVariable = $callbackVariable ?: 'c';
$requirementVariable = $requirementVariable ?: 'r';
return $formatter->renderClosure($this->renderRequirement(
$intervalVariable,
$callbackVariable,
$requirementVariable,
$formatter->renderStatement('else', $formatter->renderAssignment(
'var '.$intervalVariable,
$formatter->renderCall('setInterval', [
$formatter->renderClosure($this->renderRequirement(
$intervalVariable,
$callbackVariable,
$requirementVariable
)),
$interval,
], true)
), null, null, false)
), [$callbackVariable, $requirementVariable], $name, true, $newLine);
} | php | public function render(
$name,
$intervalVariable = null,
$callbackVariable = null,
$requirementVariable = null,
$interval = 10,
$newLine = true
) {
$formatter = $this->getFormatter();
$intervalVariable = $intervalVariable ?: 'i';
$callbackVariable = $callbackVariable ?: 'c';
$requirementVariable = $requirementVariable ?: 'r';
return $formatter->renderClosure($this->renderRequirement(
$intervalVariable,
$callbackVariable,
$requirementVariable,
$formatter->renderStatement('else', $formatter->renderAssignment(
'var '.$intervalVariable,
$formatter->renderCall('setInterval', [
$formatter->renderClosure($this->renderRequirement(
$intervalVariable,
$callbackVariable,
$requirementVariable
)),
$interval,
], true)
), null, null, false)
), [$callbackVariable, $requirementVariable], $name, true, $newLine);
} | [
"public",
"function",
"render",
"(",
"$",
"name",
",",
"$",
"intervalVariable",
"=",
"null",
",",
"$",
"callbackVariable",
"=",
"null",
",",
"$",
"requirementVariable",
"=",
"null",
",",
"$",
"interval",
"=",
"10",
",",
"$",
"newLine",
"=",
"true",
")",
... | @param string $name
@param string|null $intervalVariable
@param string|null $callbackVariable
@param string|null $requirementVariable
@param int $interval
@param bool $newLine
@return string | [
"@param",
"string",
"$name",
"@param",
"string|null",
"$intervalVariable",
"@param",
"string|null",
"$callbackVariable",
"@param",
"string|null",
"$requirementVariable",
"@param",
"int",
"$interval",
"@param",
"bool",
"$newLine"
] | train | https://github.com/egeloen/ivory-google-map/blob/bed66932ec35bda79d96cf04d91bb485875aa920/src/Helper/Renderer/Utility/RequirementLoaderRenderer.php#L31-L61 |
egeloen/ivory-google-map | src/Helper/Renderer/Utility/RequirementLoaderRenderer.php | RequirementLoaderRenderer.renderRequirement | private function renderRequirement(
$intervalVariable,
$callbackVariable,
$requirementVariable,
$nextStatement = null
) {
$formatter = $this->getFormatter();
$codes = [$formatter->renderCall($callbackVariable, [], true)];
if (empty($nextStatement)) {
array_unshift($codes, $formatter->renderCall('clearInterval', [$intervalVariable], true));
}
return $formatter->renderStatement(
'if',
$formatter->renderLines($codes, true, false),
$formatter->renderCall($requirementVariable),
$nextStatement,
false
);
} | php | private function renderRequirement(
$intervalVariable,
$callbackVariable,
$requirementVariable,
$nextStatement = null
) {
$formatter = $this->getFormatter();
$codes = [$formatter->renderCall($callbackVariable, [], true)];
if (empty($nextStatement)) {
array_unshift($codes, $formatter->renderCall('clearInterval', [$intervalVariable], true));
}
return $formatter->renderStatement(
'if',
$formatter->renderLines($codes, true, false),
$formatter->renderCall($requirementVariable),
$nextStatement,
false
);
} | [
"private",
"function",
"renderRequirement",
"(",
"$",
"intervalVariable",
",",
"$",
"callbackVariable",
",",
"$",
"requirementVariable",
",",
"$",
"nextStatement",
"=",
"null",
")",
"{",
"$",
"formatter",
"=",
"$",
"this",
"->",
"getFormatter",
"(",
")",
";",
... | @param string $intervalVariable
@param string $callbackVariable
@param string $requirementVariable
@param string|null $nextStatement
@return string | [
"@param",
"string",
"$intervalVariable",
"@param",
"string",
"$callbackVariable",
"@param",
"string",
"$requirementVariable",
"@param",
"string|null",
"$nextStatement"
] | train | https://github.com/egeloen/ivory-google-map/blob/bed66932ec35bda79d96cf04d91bb485875aa920/src/Helper/Renderer/Utility/RequirementLoaderRenderer.php#L71-L91 |
egeloen/ivory-google-map | src/Helper/Renderer/Overlay/IconSequenceRenderer.php | IconSequenceRenderer.render | public function render(IconSequence $icon)
{
$jsonBuilder = $this->getJsonBuilder()
->setValue('[icon]', $icon->getSymbol()->getVariable(), false)
->setValues($icon->getOptions());
return $this->getFormatter()->renderObjectAssignment($icon, $jsonBuilder->build());
} | php | public function render(IconSequence $icon)
{
$jsonBuilder = $this->getJsonBuilder()
->setValue('[icon]', $icon->getSymbol()->getVariable(), false)
->setValues($icon->getOptions());
return $this->getFormatter()->renderObjectAssignment($icon, $jsonBuilder->build());
} | [
"public",
"function",
"render",
"(",
"IconSequence",
"$",
"icon",
")",
"{",
"$",
"jsonBuilder",
"=",
"$",
"this",
"->",
"getJsonBuilder",
"(",
")",
"->",
"setValue",
"(",
"'[icon]'",
",",
"$",
"icon",
"->",
"getSymbol",
"(",
")",
"->",
"getVariable",
"("... | @param IconSequence $icon
@return string | [
"@param",
"IconSequence",
"$icon"
] | train | https://github.com/egeloen/ivory-google-map/blob/bed66932ec35bda79d96cf04d91bb485875aa920/src/Helper/Renderer/Overlay/IconSequenceRenderer.php#L28-L35 |
egeloen/ivory-google-map | src/Service/Geocoder/GeocoderService.php | GeocoderService.geocode | public function geocode(GeocoderRequestInterface $request)
{
$httpRequest = $this->createRequest($request);
$httpResponse = $this->getClient()->sendRequest($httpRequest);
$response = $this->deserialize(
$httpResponse,
GeocoderResponse::class,
(new Context())->setNamingStrategy(new SnakeCaseNamingStrategy())
);
$response->setRequest($request);
return $response;
} | php | public function geocode(GeocoderRequestInterface $request)
{
$httpRequest = $this->createRequest($request);
$httpResponse = $this->getClient()->sendRequest($httpRequest);
$response = $this->deserialize(
$httpResponse,
GeocoderResponse::class,
(new Context())->setNamingStrategy(new SnakeCaseNamingStrategy())
);
$response->setRequest($request);
return $response;
} | [
"public",
"function",
"geocode",
"(",
"GeocoderRequestInterface",
"$",
"request",
")",
"{",
"$",
"httpRequest",
"=",
"$",
"this",
"->",
"createRequest",
"(",
"$",
"request",
")",
";",
"$",
"httpResponse",
"=",
"$",
"this",
"->",
"getClient",
"(",
")",
"->"... | @param GeocoderRequestInterface $request
@return GeocoderResponse | [
"@param",
"GeocoderRequestInterface",
"$request"
] | train | https://github.com/egeloen/ivory-google-map/blob/bed66932ec35bda79d96cf04d91bb485875aa920/src/Service/Geocoder/GeocoderService.php#L51-L65 |
egeloen/ivory-google-map | src/Helper/Renderer/Image/Overlay/AbstractPolylineStyleRenderer.php | AbstractPolylineStyleRenderer.renderPolylineStyle | public function renderPolylineStyle(array $styles, OptionsAwareInterface $polyline)
{
if (!isset($styles['geodesic']) && $polyline->hasOption('geodisc')) {
$styles['geodesic'] = $polyline->getOption('geodisc');
}
if (!isset($styles['color']) && $polyline->hasOption('strokeColor')) {
$styles['color'] = $polyline->getOption('strokeColor');
}
if (!isset($styles['weight']) && $polyline->hasOption('strokeWeight')) {
$styles['weight'] = $polyline->getOption('strokeWeight');
}
return $this->renderStyle($styles);
} | php | public function renderPolylineStyle(array $styles, OptionsAwareInterface $polyline)
{
if (!isset($styles['geodesic']) && $polyline->hasOption('geodisc')) {
$styles['geodesic'] = $polyline->getOption('geodisc');
}
if (!isset($styles['color']) && $polyline->hasOption('strokeColor')) {
$styles['color'] = $polyline->getOption('strokeColor');
}
if (!isset($styles['weight']) && $polyline->hasOption('strokeWeight')) {
$styles['weight'] = $polyline->getOption('strokeWeight');
}
return $this->renderStyle($styles);
} | [
"public",
"function",
"renderPolylineStyle",
"(",
"array",
"$",
"styles",
",",
"OptionsAwareInterface",
"$",
"polyline",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"styles",
"[",
"'geodesic'",
"]",
")",
"&&",
"$",
"polyline",
"->",
"hasOption",
"(",
"'ge... | @param mixed[] $styles
@param OptionsAwareInterface $polyline
@return string | [
"@param",
"mixed",
"[]",
"$styles",
"@param",
"OptionsAwareInterface",
"$polyline"
] | train | https://github.com/egeloen/ivory-google-map/blob/bed66932ec35bda79d96cf04d91bb485875aa920/src/Helper/Renderer/Image/Overlay/AbstractPolylineStyleRenderer.php#L27-L42 |
egeloen/ivory-google-map | src/Helper/Renderer/Overlay/PolylineRenderer.php | PolylineRenderer.render | public function render(Polyline $polyline, Map $map)
{
$formatter = $this->getFormatter();
$jsonBuilder = $this->getJsonBuilder()
->setValue('[map]', $map->getVariable(), false)
->setValue('[path]', []);
foreach ($polyline->getCoordinates() as $index => $coordinate) {
$jsonBuilder->setValue('[path]['.$index.']', $coordinate->getVariable(), false);
}
foreach ($polyline->getIconSequences() as $index => $icon) {
$jsonBuilder->setValue('[icons]['.$index.']', $icon->getVariable(), false);
}
$jsonBuilder->setValues($polyline->getOptions());
return $formatter->renderObjectAssignment($polyline, $formatter->renderObject('Polyline', [
$jsonBuilder->build(),
]));
} | php | public function render(Polyline $polyline, Map $map)
{
$formatter = $this->getFormatter();
$jsonBuilder = $this->getJsonBuilder()
->setValue('[map]', $map->getVariable(), false)
->setValue('[path]', []);
foreach ($polyline->getCoordinates() as $index => $coordinate) {
$jsonBuilder->setValue('[path]['.$index.']', $coordinate->getVariable(), false);
}
foreach ($polyline->getIconSequences() as $index => $icon) {
$jsonBuilder->setValue('[icons]['.$index.']', $icon->getVariable(), false);
}
$jsonBuilder->setValues($polyline->getOptions());
return $formatter->renderObjectAssignment($polyline, $formatter->renderObject('Polyline', [
$jsonBuilder->build(),
]));
} | [
"public",
"function",
"render",
"(",
"Polyline",
"$",
"polyline",
",",
"Map",
"$",
"map",
")",
"{",
"$",
"formatter",
"=",
"$",
"this",
"->",
"getFormatter",
"(",
")",
";",
"$",
"jsonBuilder",
"=",
"$",
"this",
"->",
"getJsonBuilder",
"(",
")",
"->",
... | @param Polyline $polyline
@param Map $map
@return string | [
"@param",
"Polyline",
"$polyline",
"@param",
"Map",
"$map"
] | train | https://github.com/egeloen/ivory-google-map/blob/bed66932ec35bda79d96cf04d91bb485875aa920/src/Helper/Renderer/Overlay/PolylineRenderer.php#L29-L49 |
egeloen/ivory-google-map | src/Helper/Renderer/Image/Overlay/ExtendableRenderer.php | ExtendableRenderer.render | public function render(array $extendables)
{
$result = [];
foreach ($extendables as $value) {
if ($value instanceof Coordinate) {
$result[] = $this->coordinateRenderer->render($value);
} elseif ($value instanceof Marker) {
$result[] = $this->markerLocationRenderer->render($value);
} elseif ($value instanceof Polyline) {
$result[] = $this->polylineLocationRenderer->render($value);
} else {
$result[] = $value;
}
}
return implode('|', $result);
} | php | public function render(array $extendables)
{
$result = [];
foreach ($extendables as $value) {
if ($value instanceof Coordinate) {
$result[] = $this->coordinateRenderer->render($value);
} elseif ($value instanceof Marker) {
$result[] = $this->markerLocationRenderer->render($value);
} elseif ($value instanceof Polyline) {
$result[] = $this->polylineLocationRenderer->render($value);
} else {
$result[] = $value;
}
}
return implode('|', $result);
} | [
"public",
"function",
"render",
"(",
"array",
"$",
"extendables",
")",
"{",
"$",
"result",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"extendables",
"as",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"value",
"instanceof",
"Coordinate",
")",
"{",
"$",
"resu... | @param mixed[] $extendables
@return string | [
"@param",
"mixed",
"[]",
"$extendables"
] | train | https://github.com/egeloen/ivory-google-map/blob/bed66932ec35bda79d96cf04d91bb485875aa920/src/Helper/Renderer/Image/Overlay/ExtendableRenderer.php#L59-L76 |
egeloen/ivory-google-map | src/Helper/Renderer/Control/MapTypeControlRenderer.php | MapTypeControlRenderer.render | public function render($control)
{
if (!$control instanceof MapTypeControl) {
throw new \InvalidArgumentException(sprintf(
'Expected a "%s", got "%s".',
MapTypeControl::class,
is_object($control) ? get_class($control) : gettype($control)
));
}
$jsonBuilder = $this->getJsonBuilder();
foreach ($control->getIds() as $index => $id) {
$jsonBuilder->setValue('[mapTypeIds]['.$index.']', $this->mapTypeIdRenderer->render($id), false);
}
return $jsonBuilder
->setValue('[position]', $this->controlPositionRenderer->render($control->getPosition()), false)
->setValue('[style]', $this->mapTypeControlStyleRenderer->render($control->getStyle()), false)
->build();
} | php | public function render($control)
{
if (!$control instanceof MapTypeControl) {
throw new \InvalidArgumentException(sprintf(
'Expected a "%s", got "%s".',
MapTypeControl::class,
is_object($control) ? get_class($control) : gettype($control)
));
}
$jsonBuilder = $this->getJsonBuilder();
foreach ($control->getIds() as $index => $id) {
$jsonBuilder->setValue('[mapTypeIds]['.$index.']', $this->mapTypeIdRenderer->render($id), false);
}
return $jsonBuilder
->setValue('[position]', $this->controlPositionRenderer->render($control->getPosition()), false)
->setValue('[style]', $this->mapTypeControlStyleRenderer->render($control->getStyle()), false)
->build();
} | [
"public",
"function",
"render",
"(",
"$",
"control",
")",
"{",
"if",
"(",
"!",
"$",
"control",
"instanceof",
"MapTypeControl",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"sprintf",
"(",
"'Expected a \"%s\", got \"%s\".'",
",",
"MapTypeControl... | {@inheritdoc} | [
"{"
] | train | https://github.com/egeloen/ivory-google-map/blob/bed66932ec35bda79d96cf04d91bb485875aa920/src/Helper/Renderer/Control/MapTypeControlRenderer.php#L112-L132 |
egeloen/ivory-google-map | src/Helper/Collector/Place/Event/AutocompleteDomEventOnceCollector.php | AutocompleteDomEventOnceCollector.collect | public function collect(Autocomplete $autocomplete, array $domEventsOnce = [])
{
return $this->collectValues($autocomplete->getEventManager()->getDomEventsOnce(), $domEventsOnce);
} | php | public function collect(Autocomplete $autocomplete, array $domEventsOnce = [])
{
return $this->collectValues($autocomplete->getEventManager()->getDomEventsOnce(), $domEventsOnce);
} | [
"public",
"function",
"collect",
"(",
"Autocomplete",
"$",
"autocomplete",
",",
"array",
"$",
"domEventsOnce",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"collectValues",
"(",
"$",
"autocomplete",
"->",
"getEventManager",
"(",
")",
"->",
"getDomEv... | @param Autocomplete $autocomplete
@param Event[] $domEventsOnce
@return Event[] | [
"@param",
"Autocomplete",
"$autocomplete",
"@param",
"Event",
"[]",
"$domEventsOnce"
] | train | https://github.com/egeloen/ivory-google-map/blob/bed66932ec35bda79d96cf04d91bb485875aa920/src/Helper/Collector/Place/Event/AutocompleteDomEventOnceCollector.php#L29-L32 |
egeloen/ivory-google-map | src/Helper/Renderer/Overlay/CircleRenderer.php | CircleRenderer.render | public function render(Circle $circle, Map $map)
{
$formatter = $this->getFormatter();
$jsonBuilder = $this->getJsonBuilder()
->setValue('[map]', $map->getVariable(), false)
->setValue('[center]', $circle->getCenter()->getVariable(), false)
->setValue('[radius]', $circle->getRadius())
->setValues($circle->getOptions());
return $formatter->renderObjectAssignment($circle, $formatter->renderObject('Circle', [
$jsonBuilder->build(),
]));
} | php | public function render(Circle $circle, Map $map)
{
$formatter = $this->getFormatter();
$jsonBuilder = $this->getJsonBuilder()
->setValue('[map]', $map->getVariable(), false)
->setValue('[center]', $circle->getCenter()->getVariable(), false)
->setValue('[radius]', $circle->getRadius())
->setValues($circle->getOptions());
return $formatter->renderObjectAssignment($circle, $formatter->renderObject('Circle', [
$jsonBuilder->build(),
]));
} | [
"public",
"function",
"render",
"(",
"Circle",
"$",
"circle",
",",
"Map",
"$",
"map",
")",
"{",
"$",
"formatter",
"=",
"$",
"this",
"->",
"getFormatter",
"(",
")",
";",
"$",
"jsonBuilder",
"=",
"$",
"this",
"->",
"getJsonBuilder",
"(",
")",
"->",
"se... | @param Circle $circle
@param Map $map
@return string | [
"@param",
"Circle",
"$circle",
"@param",
"Map",
"$map"
] | train | https://github.com/egeloen/ivory-google-map/blob/bed66932ec35bda79d96cf04d91bb485875aa920/src/Helper/Renderer/Overlay/CircleRenderer.php#L29-L41 |
egeloen/ivory-google-map | src/Helper/Collector/Base/BoundCollector.php | BoundCollector.collect | public function collect(Map $map, array $bounds = [])
{
if ($map->isAutoZoom()) {
$bounds = $this->collectValue($map->getBound(), $bounds);
}
foreach ($this->groundOverlayCollector->collect($map) as $groundOverlay) {
$bounds = $this->collectValue($groundOverlay->getBound(), $bounds);
}
foreach ($this->rectangleCollector->collect($map) as $rectangle) {
$bounds = $this->collectValue($rectangle->getBound(), $bounds);
}
return $bounds;
} | php | public function collect(Map $map, array $bounds = [])
{
if ($map->isAutoZoom()) {
$bounds = $this->collectValue($map->getBound(), $bounds);
}
foreach ($this->groundOverlayCollector->collect($map) as $groundOverlay) {
$bounds = $this->collectValue($groundOverlay->getBound(), $bounds);
}
foreach ($this->rectangleCollector->collect($map) as $rectangle) {
$bounds = $this->collectValue($rectangle->getBound(), $bounds);
}
return $bounds;
} | [
"public",
"function",
"collect",
"(",
"Map",
"$",
"map",
",",
"array",
"$",
"bounds",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"$",
"map",
"->",
"isAutoZoom",
"(",
")",
")",
"{",
"$",
"bounds",
"=",
"$",
"this",
"->",
"collectValue",
"(",
"$",
"map",
... | @param Map $map
@param Bound[] $bounds
@return Bound[] | [
"@param",
"Map",
"$map",
"@param",
"Bound",
"[]",
"$bounds"
] | train | https://github.com/egeloen/ivory-google-map/blob/bed66932ec35bda79d96cf04d91bb485875aa920/src/Helper/Collector/Base/BoundCollector.php#L83-L98 |
egeloen/ivory-google-map | src/Helper/Renderer/Image/StyleRenderer.php | StyleRenderer.render | public function render(array $style)
{
$result = [];
if (isset($style['feature'])) {
$result[] = $this->renderStyle('feature', $style['feature']);
}
if (isset($style['element'])) {
$result[] = $this->renderStyle('element', $style['element']);
}
foreach ($style['rules'] as $rule => $value) {
$result[] = $this->renderStyle($rule, $value);
}
return implode('|', $result);
} | php | public function render(array $style)
{
$result = [];
if (isset($style['feature'])) {
$result[] = $this->renderStyle('feature', $style['feature']);
}
if (isset($style['element'])) {
$result[] = $this->renderStyle('element', $style['element']);
}
foreach ($style['rules'] as $rule => $value) {
$result[] = $this->renderStyle($rule, $value);
}
return implode('|', $result);
} | [
"public",
"function",
"render",
"(",
"array",
"$",
"style",
")",
"{",
"$",
"result",
"=",
"[",
"]",
";",
"if",
"(",
"isset",
"(",
"$",
"style",
"[",
"'feature'",
"]",
")",
")",
"{",
"$",
"result",
"[",
"]",
"=",
"$",
"this",
"->",
"renderStyle",
... | @param mixed[] $style
@return string | [
"@param",
"mixed",
"[]",
"$style"
] | train | https://github.com/egeloen/ivory-google-map/blob/bed66932ec35bda79d96cf04d91bb485875aa920/src/Helper/Renderer/Image/StyleRenderer.php#L24-L41 |
egeloen/ivory-google-map | src/Helper/Renderer/Html/StylesheetRenderer.php | StylesheetRenderer.render | public function render($stylesheet, $value)
{
$formatter = $this->getFormatter();
return $formatter->renderCode($stylesheet.':'.$formatter->renderSeparator().$value, true, false);
} | php | public function render($stylesheet, $value)
{
$formatter = $this->getFormatter();
return $formatter->renderCode($stylesheet.':'.$formatter->renderSeparator().$value, true, false);
} | [
"public",
"function",
"render",
"(",
"$",
"stylesheet",
",",
"$",
"value",
")",
"{",
"$",
"formatter",
"=",
"$",
"this",
"->",
"getFormatter",
"(",
")",
";",
"return",
"$",
"formatter",
"->",
"renderCode",
"(",
"$",
"stylesheet",
".",
"':'",
".",
"$",
... | @param string $stylesheet
@param string $value
@return string | [
"@param",
"string",
"$stylesheet",
"@param",
"string",
"$value"
] | train | https://github.com/egeloen/ivory-google-map/blob/bed66932ec35bda79d96cf04d91bb485875aa920/src/Helper/Renderer/Html/StylesheetRenderer.php#L27-L32 |
egeloen/ivory-google-map | src/Helper/Renderer/MapBoundRenderer.php | MapBoundRenderer.render | public function render(Map $map)
{
return $this->getFormatter()->renderObjectCall(
$map,
'fitBounds',
[$map->getBound()->getVariable()]
);
} | php | public function render(Map $map)
{
return $this->getFormatter()->renderObjectCall(
$map,
'fitBounds',
[$map->getBound()->getVariable()]
);
} | [
"public",
"function",
"render",
"(",
"Map",
"$",
"map",
")",
"{",
"return",
"$",
"this",
"->",
"getFormatter",
"(",
")",
"->",
"renderObjectCall",
"(",
"$",
"map",
",",
"'fitBounds'",
",",
"[",
"$",
"map",
"->",
"getBound",
"(",
")",
"->",
"getVariable... | @param Map $map
@return string | [
"@param",
"Map",
"$map"
] | train | https://github.com/egeloen/ivory-google-map/blob/bed66932ec35bda79d96cf04d91bb485875aa920/src/Helper/Renderer/MapBoundRenderer.php#L26-L33 |
egeloen/ivory-google-map | src/Service/DistanceMatrix/Request/DistanceMatrixRequest.php | DistanceMatrixRequest.buildQuery | public function buildQuery()
{
$locationBuilder = function (LocationInterface $location) {
$result = $location->buildQuery();
if ($location instanceof EncodedPolylineLocation) {
$result .= ':';
}
return $result;
};
$query = [
'origins' => implode('|', array_map($locationBuilder, $this->origins)),
'destinations' => implode('|', array_map($locationBuilder, $this->destinations)),
];
if ($this->hasDepartureTime()) {
$query['departure_time'] = $this->departureTime->getTimestamp();
}
if ($this->hasArrivalTime()) {
$query['arrival_time'] = $this->arrivalTime->getTimestamp();
}
if ($this->hasTravelMode()) {
$query['mode'] = strtolower($this->travelMode);
}
if ($this->hasAvoid()) {
$query['avoid'] = $this->avoid;
}
if ($this->hasTrafficModel()) {
$query['traffic_model'] = $this->trafficModel;
}
if ($this->hasTransitModes()) {
$query['transit_mode'] = implode('|', $this->transitModes);
}
if ($this->hasTransitRoutingPreference()) {
$query['transit_routing_preference'] = $this->transitRoutingPreference;
}
if ($this->hasUnitSystem()) {
$query['units'] = strtolower($this->unitSystem);
}
if ($this->hasRegion()) {
$query['region'] = $this->region;
}
if ($this->hasLanguage()) {
$query['language'] = $this->language;
}
return $query;
} | php | public function buildQuery()
{
$locationBuilder = function (LocationInterface $location) {
$result = $location->buildQuery();
if ($location instanceof EncodedPolylineLocation) {
$result .= ':';
}
return $result;
};
$query = [
'origins' => implode('|', array_map($locationBuilder, $this->origins)),
'destinations' => implode('|', array_map($locationBuilder, $this->destinations)),
];
if ($this->hasDepartureTime()) {
$query['departure_time'] = $this->departureTime->getTimestamp();
}
if ($this->hasArrivalTime()) {
$query['arrival_time'] = $this->arrivalTime->getTimestamp();
}
if ($this->hasTravelMode()) {
$query['mode'] = strtolower($this->travelMode);
}
if ($this->hasAvoid()) {
$query['avoid'] = $this->avoid;
}
if ($this->hasTrafficModel()) {
$query['traffic_model'] = $this->trafficModel;
}
if ($this->hasTransitModes()) {
$query['transit_mode'] = implode('|', $this->transitModes);
}
if ($this->hasTransitRoutingPreference()) {
$query['transit_routing_preference'] = $this->transitRoutingPreference;
}
if ($this->hasUnitSystem()) {
$query['units'] = strtolower($this->unitSystem);
}
if ($this->hasRegion()) {
$query['region'] = $this->region;
}
if ($this->hasLanguage()) {
$query['language'] = $this->language;
}
return $query;
} | [
"public",
"function",
"buildQuery",
"(",
")",
"{",
"$",
"locationBuilder",
"=",
"function",
"(",
"LocationInterface",
"$",
"location",
")",
"{",
"$",
"result",
"=",
"$",
"location",
"->",
"buildQuery",
"(",
")",
";",
"if",
"(",
"$",
"location",
"instanceof... | {@inheritdoc} | [
"{"
] | train | https://github.com/egeloen/ivory-google-map/blob/bed66932ec35bda79d96cf04d91bb485875aa920/src/Service/DistanceMatrix/Request/DistanceMatrixRequest.php#L505-L563 |
egeloen/ivory-google-map | src/Helper/Renderer/Image/Overlay/EncodedPolylineStyleRenderer.php | EncodedPolylineStyleRenderer.render | public function render(EncodedPolyline $encodedPolyline)
{
return $this->renderPolylineStyle(
$encodedPolyline->hasStaticOption('styles') ? $encodedPolyline->getStaticOption('styles') : [],
$encodedPolyline
);
} | php | public function render(EncodedPolyline $encodedPolyline)
{
return $this->renderPolylineStyle(
$encodedPolyline->hasStaticOption('styles') ? $encodedPolyline->getStaticOption('styles') : [],
$encodedPolyline
);
} | [
"public",
"function",
"render",
"(",
"EncodedPolyline",
"$",
"encodedPolyline",
")",
"{",
"return",
"$",
"this",
"->",
"renderPolylineStyle",
"(",
"$",
"encodedPolyline",
"->",
"hasStaticOption",
"(",
"'styles'",
")",
"?",
"$",
"encodedPolyline",
"->",
"getStaticO... | @param EncodedPolyline $encodedPolyline
@return string | [
"@param",
"EncodedPolyline",
"$encodedPolyline"
] | train | https://github.com/egeloen/ivory-google-map/blob/bed66932ec35bda79d96cf04d91bb485875aa920/src/Helper/Renderer/Image/Overlay/EncodedPolylineStyleRenderer.php#L26-L32 |
egeloen/ivory-google-map | src/Helper/Collector/Base/SizeCollector.php | SizeCollector.collect | public function collect(Map $map, array $sizes = [])
{
foreach ($this->infoWindowCollector->collect($map) as $infoWindow) {
if ($infoWindow->hasPixelOffset()) {
$sizes = $this->collectValue($infoWindow->getPixelOffset(), $sizes);
}
}
foreach ($this->iconCollector->collect($map) as $icon) {
if ($icon->hasSize()) {
$sizes = $this->collectValue($icon->getSize(), $sizes);
}
if ($icon->hasScaledSize()) {
$sizes = $this->collectValue($icon->getScaledSize(), $sizes);
}
}
return $sizes;
} | php | public function collect(Map $map, array $sizes = [])
{
foreach ($this->infoWindowCollector->collect($map) as $infoWindow) {
if ($infoWindow->hasPixelOffset()) {
$sizes = $this->collectValue($infoWindow->getPixelOffset(), $sizes);
}
}
foreach ($this->iconCollector->collect($map) as $icon) {
if ($icon->hasSize()) {
$sizes = $this->collectValue($icon->getSize(), $sizes);
}
if ($icon->hasScaledSize()) {
$sizes = $this->collectValue($icon->getScaledSize(), $sizes);
}
}
return $sizes;
} | [
"public",
"function",
"collect",
"(",
"Map",
"$",
"map",
",",
"array",
"$",
"sizes",
"=",
"[",
"]",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"infoWindowCollector",
"->",
"collect",
"(",
"$",
"map",
")",
"as",
"$",
"infoWindow",
")",
"{",
"if",
... | @param Map $map
@param Size[] $sizes
@return Size[] | [
"@param",
"Map",
"$map",
"@param",
"Size",
"[]",
"$sizes"
] | train | https://github.com/egeloen/ivory-google-map/blob/bed66932ec35bda79d96cf04d91bb485875aa920/src/Helper/Collector/Base/SizeCollector.php#L83-L102 |
egeloen/ivory-google-map | src/Service/Place/Search/Request/AbstractTextualPlaceSearchRequest.php | AbstractTextualPlaceSearchRequest.buildQuery | public function buildQuery()
{
$query = parent::buildQuery();
if ($this->hasKeyword()) {
$query['keyword'] = $this->keyword;
}
return $query;
} | php | public function buildQuery()
{
$query = parent::buildQuery();
if ($this->hasKeyword()) {
$query['keyword'] = $this->keyword;
}
return $query;
} | [
"public",
"function",
"buildQuery",
"(",
")",
"{",
"$",
"query",
"=",
"parent",
"::",
"buildQuery",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"hasKeyword",
"(",
")",
")",
"{",
"$",
"query",
"[",
"'keyword'",
"]",
"=",
"$",
"this",
"->",
"keyword... | {@inheritdoc} | [
"{"
] | train | https://github.com/egeloen/ivory-google-map/blob/bed66932ec35bda79d96cf04d91bb485875aa920/src/Service/Place/Search/Request/AbstractTextualPlaceSearchRequest.php#L51-L60 |
egeloen/ivory-google-map | src/Helper/Collector/AbstractCollector.php | AbstractCollector.collectValues | protected function collectValues(array $values, array $defaults = [])
{
foreach ($values as $value) {
$defaults = $this->collectValue($value, $defaults);
}
return $defaults;
} | php | protected function collectValues(array $values, array $defaults = [])
{
foreach ($values as $value) {
$defaults = $this->collectValue($value, $defaults);
}
return $defaults;
} | [
"protected",
"function",
"collectValues",
"(",
"array",
"$",
"values",
",",
"array",
"$",
"defaults",
"=",
"[",
"]",
")",
"{",
"foreach",
"(",
"$",
"values",
"as",
"$",
"value",
")",
"{",
"$",
"defaults",
"=",
"$",
"this",
"->",
"collectValue",
"(",
... | @param mixed[] $values
@param mixed[] $defaults
@return mixed[] | [
"@param",
"mixed",
"[]",
"$values",
"@param",
"mixed",
"[]",
"$defaults"
] | train | https://github.com/egeloen/ivory-google-map/blob/bed66932ec35bda79d96cf04d91bb485875aa920/src/Helper/Collector/AbstractCollector.php#L25-L32 |
egeloen/ivory-google-map | src/Helper/Collector/AbstractCollector.php | AbstractCollector.collectValue | protected function collectValue($value, array $defaults = [])
{
if (!in_array($value, $defaults, true)) {
$defaults[] = $value;
}
return $defaults;
} | php | protected function collectValue($value, array $defaults = [])
{
if (!in_array($value, $defaults, true)) {
$defaults[] = $value;
}
return $defaults;
} | [
"protected",
"function",
"collectValue",
"(",
"$",
"value",
",",
"array",
"$",
"defaults",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"in_array",
"(",
"$",
"value",
",",
"$",
"defaults",
",",
"true",
")",
")",
"{",
"$",
"defaults",
"[",
"]",
"=",
"... | @param object $value
@param object[] $defaults
@return object[] | [
"@param",
"object",
"$value",
"@param",
"object",
"[]",
"$defaults"
] | train | https://github.com/egeloen/ivory-google-map/blob/bed66932ec35bda79d96cf04d91bb485875aa920/src/Helper/Collector/AbstractCollector.php#L40-L47 |
egeloen/ivory-google-map | src/Helper/Renderer/Image/Overlay/PolylineRenderer.php | PolylineRenderer.render | public function render(Polyline $polyline)
{
$result = [];
$style = $this->polylineStyleRenderer->render($polyline);
if (!empty($style)) {
$result[] = $style;
}
$result[] = $this->polylineLocationRenderer->render($polyline);
return implode('|', $result);
} | php | public function render(Polyline $polyline)
{
$result = [];
$style = $this->polylineStyleRenderer->render($polyline);
if (!empty($style)) {
$result[] = $style;
}
$result[] = $this->polylineLocationRenderer->render($polyline);
return implode('|', $result);
} | [
"public",
"function",
"render",
"(",
"Polyline",
"$",
"polyline",
")",
"{",
"$",
"result",
"=",
"[",
"]",
";",
"$",
"style",
"=",
"$",
"this",
"->",
"polylineStyleRenderer",
"->",
"render",
"(",
"$",
"polyline",
")",
";",
"if",
"(",
"!",
"empty",
"("... | @param Polyline $polyline
@return string | [
"@param",
"Polyline",
"$polyline"
] | train | https://github.com/egeloen/ivory-google-map/blob/bed66932ec35bda79d96cf04d91bb485875aa920/src/Helper/Renderer/Image/Overlay/PolylineRenderer.php#L48-L60 |
egeloen/ivory-google-map | src/Helper/Renderer/Image/Overlay/PolylineLocationRenderer.php | PolylineLocationRenderer.render | public function render(Polyline $polyline)
{
if ($polyline->hasStaticOption('locations')) {
$locations = $polyline->getStaticOption('locations');
} else {
$locations = $polyline->getCoordinates();
}
return implode('|', array_map(function ($location) {
return $location instanceof Coordinate ? $this->coordinateRenderer->render($location) : $location;
}, $locations));
} | php | public function render(Polyline $polyline)
{
if ($polyline->hasStaticOption('locations')) {
$locations = $polyline->getStaticOption('locations');
} else {
$locations = $polyline->getCoordinates();
}
return implode('|', array_map(function ($location) {
return $location instanceof Coordinate ? $this->coordinateRenderer->render($location) : $location;
}, $locations));
} | [
"public",
"function",
"render",
"(",
"Polyline",
"$",
"polyline",
")",
"{",
"if",
"(",
"$",
"polyline",
"->",
"hasStaticOption",
"(",
"'locations'",
")",
")",
"{",
"$",
"locations",
"=",
"$",
"polyline",
"->",
"getStaticOption",
"(",
"'locations'",
")",
";... | @param Polyline $polyline
@return string | [
"@param",
"Polyline",
"$polyline"
] | train | https://github.com/egeloen/ivory-google-map/blob/bed66932ec35bda79d96cf04d91bb485875aa920/src/Helper/Renderer/Image/Overlay/PolylineLocationRenderer.php#L41-L52 |
egeloen/ivory-google-map | src/Service/Elevation/Request/PathElevationRequest.php | PathElevationRequest.buildQuery | public function buildQuery()
{
return [
'path' => implode('|', array_map(function (LocationInterface $path) {
return $path->buildQuery();
}, $this->paths)),
'samples' => $this->samples,
];
} | php | public function buildQuery()
{
return [
'path' => implode('|', array_map(function (LocationInterface $path) {
return $path->buildQuery();
}, $this->paths)),
'samples' => $this->samples,
];
} | [
"public",
"function",
"buildQuery",
"(",
")",
"{",
"return",
"[",
"'path'",
"=>",
"implode",
"(",
"'|'",
",",
"array_map",
"(",
"function",
"(",
"LocationInterface",
"$",
"path",
")",
"{",
"return",
"$",
"path",
"->",
"buildQuery",
"(",
")",
";",
"}",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/egeloen/ivory-google-map/blob/bed66932ec35bda79d96cf04d91bb485875aa920/src/Service/Elevation/Request/PathElevationRequest.php#L124-L132 |
egeloen/ivory-google-map | src/Helper/Renderer/Layer/GeoJsonLayerRenderer.php | GeoJsonLayerRenderer.render | public function render(GeoJsonLayer $geoJsonLayer, Map $map)
{
$formatter = $this->getFormatter();
$jsonBuilder = $this->getJsonBuilder()->setValues($geoJsonLayer->getOptions());
return $formatter->renderObjectCall($map, $formatter->renderProperty('data', 'loadGeoJson'), [
$formatter->renderEscape($geoJsonLayer->getUrl()),
$jsonBuilder->build(),
]);
} | php | public function render(GeoJsonLayer $geoJsonLayer, Map $map)
{
$formatter = $this->getFormatter();
$jsonBuilder = $this->getJsonBuilder()->setValues($geoJsonLayer->getOptions());
return $formatter->renderObjectCall($map, $formatter->renderProperty('data', 'loadGeoJson'), [
$formatter->renderEscape($geoJsonLayer->getUrl()),
$jsonBuilder->build(),
]);
} | [
"public",
"function",
"render",
"(",
"GeoJsonLayer",
"$",
"geoJsonLayer",
",",
"Map",
"$",
"map",
")",
"{",
"$",
"formatter",
"=",
"$",
"this",
"->",
"getFormatter",
"(",
")",
";",
"$",
"jsonBuilder",
"=",
"$",
"this",
"->",
"getJsonBuilder",
"(",
")",
... | @param GeoJsonLayer $geoJsonLayer
@param Map $map
@return string | [
"@param",
"GeoJsonLayer",
"$geoJsonLayer",
"@param",
"Map",
"$map"
] | train | https://github.com/egeloen/ivory-google-map/blob/bed66932ec35bda79d96cf04d91bb485875aa920/src/Helper/Renderer/Layer/GeoJsonLayerRenderer.php#L29-L38 |
egeloen/ivory-google-map | src/Helper/Renderer/MapHtmlRenderer.php | MapHtmlRenderer.render | public function render(Map $map)
{
$styles = [];
$stylesheets = [
'width' => $map->hasStylesheetOption('width') ? $map->getStylesheetOption('width') : '300px',
'height' => $map->hasStylesheetOption('height') ? $map->getStylesheetOption('height') : '300px',
];
foreach ($stylesheets as $stylesheet => $value) {
$styles[] = $this->stylesheetRenderer->render($stylesheet, $value);
}
return $this->getTagRenderer()->render('div', null, array_merge($map->getHtmlAttributes(), [
'id' => $map->getHtmlId(),
'style' => implode('', $styles),
]));
} | php | public function render(Map $map)
{
$styles = [];
$stylesheets = [
'width' => $map->hasStylesheetOption('width') ? $map->getStylesheetOption('width') : '300px',
'height' => $map->hasStylesheetOption('height') ? $map->getStylesheetOption('height') : '300px',
];
foreach ($stylesheets as $stylesheet => $value) {
$styles[] = $this->stylesheetRenderer->render($stylesheet, $value);
}
return $this->getTagRenderer()->render('div', null, array_merge($map->getHtmlAttributes(), [
'id' => $map->getHtmlId(),
'style' => implode('', $styles),
]));
} | [
"public",
"function",
"render",
"(",
"Map",
"$",
"map",
")",
"{",
"$",
"styles",
"=",
"[",
"]",
";",
"$",
"stylesheets",
"=",
"[",
"'width'",
"=>",
"$",
"map",
"->",
"hasStylesheetOption",
"(",
"'width'",
")",
"?",
"$",
"map",
"->",
"getStylesheetOptio... | @param Map $map
@return string | [
"@param",
"Map",
"$map"
] | train | https://github.com/egeloen/ivory-google-map/blob/bed66932ec35bda79d96cf04d91bb485875aa920/src/Helper/Renderer/MapHtmlRenderer.php#L63-L79 |
egeloen/ivory-google-map | src/Helper/Collector/Overlay/IconSequenceCollector.php | IconSequenceCollector.collect | public function collect(Map $map, array $icons = [])
{
foreach ($this->polylineCollector->collect($map) as $polyline) {
if ($polyline->hasIconSequences()) {
$icons = $this->collectValues($polyline->getIconSequences());
}
}
return $icons;
} | php | public function collect(Map $map, array $icons = [])
{
foreach ($this->polylineCollector->collect($map) as $polyline) {
if ($polyline->hasIconSequences()) {
$icons = $this->collectValues($polyline->getIconSequences());
}
}
return $icons;
} | [
"public",
"function",
"collect",
"(",
"Map",
"$",
"map",
",",
"array",
"$",
"icons",
"=",
"[",
"]",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"polylineCollector",
"->",
"collect",
"(",
"$",
"map",
")",
"as",
"$",
"polyline",
")",
"{",
"if",
"(",... | @param Map $map
@param IconSequence[] $icons
@return IconSequence[] | [
"@param",
"Map",
"$map",
"@param",
"IconSequence",
"[]",
"$icons"
] | train | https://github.com/egeloen/ivory-google-map/blob/bed66932ec35bda79d96cf04d91bb485875aa920/src/Helper/Collector/Overlay/IconSequenceCollector.php#L58-L67 |
egeloen/ivory-google-map | src/Service/Place/Search/PlaceSearchService.php | PlaceSearchService.process | public function process(PlaceSearchRequestInterface $request)
{
$httpRequest = $this->createRequest($request);
$httpResponse = $this->getClient()->sendRequest($httpRequest);
$response = $this->deserialize(
$httpResponse,
PlaceSearchResponse::class,
(new Context())->setNamingStrategy(new SnakeCaseNamingStrategy())
);
$response->setRequest($request);
return new PlaceSearchResponseIterator($this, $response);
} | php | public function process(PlaceSearchRequestInterface $request)
{
$httpRequest = $this->createRequest($request);
$httpResponse = $this->getClient()->sendRequest($httpRequest);
$response = $this->deserialize(
$httpResponse,
PlaceSearchResponse::class,
(new Context())->setNamingStrategy(new SnakeCaseNamingStrategy())
);
$response->setRequest($request);
return new PlaceSearchResponseIterator($this, $response);
} | [
"public",
"function",
"process",
"(",
"PlaceSearchRequestInterface",
"$",
"request",
")",
"{",
"$",
"httpRequest",
"=",
"$",
"this",
"->",
"createRequest",
"(",
"$",
"request",
")",
";",
"$",
"httpResponse",
"=",
"$",
"this",
"->",
"getClient",
"(",
")",
"... | @param PlaceSearchRequestInterface $request
@return PlaceSearchResponseIterator | [
"@param",
"PlaceSearchRequestInterface",
"$request"
] | train | https://github.com/egeloen/ivory-google-map/blob/bed66932ec35bda79d96cf04d91bb485875aa920/src/Service/Place/Search/PlaceSearchService.php#L31-L45 |
egeloen/ivory-google-map | src/Helper/Formatter/Formatter.php | Formatter.renderClass | public function renderClass($name = null, $namespace = null)
{
if ($namespace === null) {
$namespace = $this->renderProperty('google', 'maps');
}
if (empty($namespace)) {
return $name;
}
return $this->renderProperty($namespace, $name);
} | php | public function renderClass($name = null, $namespace = null)
{
if ($namespace === null) {
$namespace = $this->renderProperty('google', 'maps');
}
if (empty($namespace)) {
return $name;
}
return $this->renderProperty($namespace, $name);
} | [
"public",
"function",
"renderClass",
"(",
"$",
"name",
"=",
"null",
",",
"$",
"namespace",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"namespace",
"===",
"null",
")",
"{",
"$",
"namespace",
"=",
"$",
"this",
"->",
"renderProperty",
"(",
"'google'",
",",
... | @param string|null $name
@param string|false|null $namespace
@return string | [
"@param",
"string|null",
"$name",
"@param",
"string|false|null",
"$namespace"
] | train | https://github.com/egeloen/ivory-google-map/blob/bed66932ec35bda79d96cf04d91bb485875aa920/src/Helper/Formatter/Formatter.php#L79-L90 |
egeloen/ivory-google-map | src/Helper/Formatter/Formatter.php | Formatter.renderObject | public function renderObject(
$class,
array $arguments = [],
$namespace = null,
$semicolon = false,
$newLine = false
) {
return $this->renderCall(
'new '.$this->renderClass($class, $namespace),
$arguments,
$semicolon,
$newLine
);
} | php | public function renderObject(
$class,
array $arguments = [],
$namespace = null,
$semicolon = false,
$newLine = false
) {
return $this->renderCall(
'new '.$this->renderClass($class, $namespace),
$arguments,
$semicolon,
$newLine
);
} | [
"public",
"function",
"renderObject",
"(",
"$",
"class",
",",
"array",
"$",
"arguments",
"=",
"[",
"]",
",",
"$",
"namespace",
"=",
"null",
",",
"$",
"semicolon",
"=",
"false",
",",
"$",
"newLine",
"=",
"false",
")",
"{",
"return",
"$",
"this",
"->",... | @param string $class
@param string[] $arguments
@param string|false|null $namespace
@param bool $semicolon
@param bool $newLine
@return string | [
"@param",
"string",
"$class",
"@param",
"string",
"[]",
"$arguments",
"@param",
"string|false|null",
"$namespace",
"@param",
"bool",
"$semicolon",
"@param",
"bool",
"$newLine"
] | train | https://github.com/egeloen/ivory-google-map/blob/bed66932ec35bda79d96cf04d91bb485875aa920/src/Helper/Formatter/Formatter.php#L113-L126 |
egeloen/ivory-google-map | src/Helper/Formatter/Formatter.php | Formatter.renderProperty | public function renderProperty($object, $property = null)
{
if (!empty($property)) {
$property = '.'.$property;
}
return $object.$property;
} | php | public function renderProperty($object, $property = null)
{
if (!empty($property)) {
$property = '.'.$property;
}
return $object.$property;
} | [
"public",
"function",
"renderProperty",
"(",
"$",
"object",
",",
"$",
"property",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"property",
")",
")",
"{",
"$",
"property",
"=",
"'.'",
".",
"$",
"property",
";",
"}",
"return",
"$",
"obje... | @param string $object
@param string|null $property
@return string | [
"@param",
"string",
"$object",
"@param",
"string|null",
"$property"
] | train | https://github.com/egeloen/ivory-google-map/blob/bed66932ec35bda79d96cf04d91bb485875aa920/src/Helper/Formatter/Formatter.php#L134-L141 |
egeloen/ivory-google-map | src/Helper/Formatter/Formatter.php | Formatter.renderObjectCall | public function renderObjectCall(
VariableAwareInterface $object,
$method,
array $arguments = [],
$semicolon = false,
$newLine = false
) {
return $this->renderCall(
$this->renderProperty($object->getVariable(), $method),
$arguments,
$semicolon,
$newLine
);
} | php | public function renderObjectCall(
VariableAwareInterface $object,
$method,
array $arguments = [],
$semicolon = false,
$newLine = false
) {
return $this->renderCall(
$this->renderProperty($object->getVariable(), $method),
$arguments,
$semicolon,
$newLine
);
} | [
"public",
"function",
"renderObjectCall",
"(",
"VariableAwareInterface",
"$",
"object",
",",
"$",
"method",
",",
"array",
"$",
"arguments",
"=",
"[",
"]",
",",
"$",
"semicolon",
"=",
"false",
",",
"$",
"newLine",
"=",
"false",
")",
"{",
"return",
"$",
"t... | @param VariableAwareInterface $object
@param string $method
@param string[] $arguments
@param bool $semicolon
@param bool $newLine
@return string | [
"@param",
"VariableAwareInterface",
"$object",
"@param",
"string",
"$method",
"@param",
"string",
"[]",
"$arguments",
"@param",
"bool",
"$semicolon",
"@param",
"bool",
"$newLine"
] | train | https://github.com/egeloen/ivory-google-map/blob/bed66932ec35bda79d96cf04d91bb485875aa920/src/Helper/Formatter/Formatter.php#L152-L165 |
egeloen/ivory-google-map | src/Helper/Formatter/Formatter.php | Formatter.renderCall | public function renderCall($method, array $arguments = [], $semicolon = false, $newLine = false)
{
return $this->renderCode(
$method.$this->renderArguments($arguments),
$semicolon,
$newLine
);
} | php | public function renderCall($method, array $arguments = [], $semicolon = false, $newLine = false)
{
return $this->renderCode(
$method.$this->renderArguments($arguments),
$semicolon,
$newLine
);
} | [
"public",
"function",
"renderCall",
"(",
"$",
"method",
",",
"array",
"$",
"arguments",
"=",
"[",
"]",
",",
"$",
"semicolon",
"=",
"false",
",",
"$",
"newLine",
"=",
"false",
")",
"{",
"return",
"$",
"this",
"->",
"renderCode",
"(",
"$",
"method",
".... | @param string|null $method
@param string[] $arguments
@param bool $semicolon
@param bool $newLine
@return string | [
"@param",
"string|null",
"$method",
"@param",
"string",
"[]",
"$arguments",
"@param",
"bool",
"$semicolon",
"@param",
"bool",
"$newLine"
] | train | https://github.com/egeloen/ivory-google-map/blob/bed66932ec35bda79d96cf04d91bb485875aa920/src/Helper/Formatter/Formatter.php#L175-L182 |
egeloen/ivory-google-map | src/Helper/Formatter/Formatter.php | Formatter.renderClosure | public function renderClosure(
$code = null,
array $arguments = [],
$name = null,
$semicolon = false,
$newLine = false
) {
$separator = $this->renderSeparator();
if ($name !== null) {
$name = ' '.$name;
}
return $this->renderCode($this->renderLines([
'function'.$name.$separator.$this->renderArguments($arguments).$separator.'{',
$this->renderIndentation($code),
'}',
], !empty($code), $newLine && !$semicolon), $semicolon, $newLine && $semicolon);
} | php | public function renderClosure(
$code = null,
array $arguments = [],
$name = null,
$semicolon = false,
$newLine = false
) {
$separator = $this->renderSeparator();
if ($name !== null) {
$name = ' '.$name;
}
return $this->renderCode($this->renderLines([
'function'.$name.$separator.$this->renderArguments($arguments).$separator.'{',
$this->renderIndentation($code),
'}',
], !empty($code), $newLine && !$semicolon), $semicolon, $newLine && $semicolon);
} | [
"public",
"function",
"renderClosure",
"(",
"$",
"code",
"=",
"null",
",",
"array",
"$",
"arguments",
"=",
"[",
"]",
",",
"$",
"name",
"=",
"null",
",",
"$",
"semicolon",
"=",
"false",
",",
"$",
"newLine",
"=",
"false",
")",
"{",
"$",
"separator",
... | @param string|null $code
@param string[] $arguments
@param string|null $name
@param bool $semicolon
@param bool $newLine
@return string | [
"@param",
"string|null",
"$code",
"@param",
"string",
"[]",
"$arguments",
"@param",
"string|null",
"$name",
"@param",
"bool",
"$semicolon",
"@param",
"bool",
"$newLine"
] | train | https://github.com/egeloen/ivory-google-map/blob/bed66932ec35bda79d96cf04d91bb485875aa920/src/Helper/Formatter/Formatter.php#L193-L211 |
egeloen/ivory-google-map | src/Helper/Formatter/Formatter.php | Formatter.renderObjectAssignment | public function renderObjectAssignment(
VariableAwareInterface $object,
$declaration,
$semicolon = false,
$newLine = false
) {
return $this->renderAssignment($object->getVariable(), $declaration, $semicolon, $newLine);
} | php | public function renderObjectAssignment(
VariableAwareInterface $object,
$declaration,
$semicolon = false,
$newLine = false
) {
return $this->renderAssignment($object->getVariable(), $declaration, $semicolon, $newLine);
} | [
"public",
"function",
"renderObjectAssignment",
"(",
"VariableAwareInterface",
"$",
"object",
",",
"$",
"declaration",
",",
"$",
"semicolon",
"=",
"false",
",",
"$",
"newLine",
"=",
"false",
")",
"{",
"return",
"$",
"this",
"->",
"renderAssignment",
"(",
"$",
... | @param VariableAwareInterface $object
@param string $declaration
@param bool $semicolon
@param bool $newLine
@return string | [
"@param",
"VariableAwareInterface",
"$object",
"@param",
"string",
"$declaration",
"@param",
"bool",
"$semicolon",
"@param",
"bool",
"$newLine"
] | train | https://github.com/egeloen/ivory-google-map/blob/bed66932ec35bda79d96cf04d91bb485875aa920/src/Helper/Formatter/Formatter.php#L221-L228 |
egeloen/ivory-google-map | src/Helper/Formatter/Formatter.php | Formatter.renderContainerAssignment | public function renderContainerAssignment(
VariableAwareInterface $root,
$declaration,
$propertyPath = null,
VariableAwareInterface $object = null,
$semicolon = true,
$newLine = true
) {
return $this->renderAssignment(
$this->renderContainerVariable($root, $propertyPath, $object),
$declaration,
$semicolon,
$newLine
);
} | php | public function renderContainerAssignment(
VariableAwareInterface $root,
$declaration,
$propertyPath = null,
VariableAwareInterface $object = null,
$semicolon = true,
$newLine = true
) {
return $this->renderAssignment(
$this->renderContainerVariable($root, $propertyPath, $object),
$declaration,
$semicolon,
$newLine
);
} | [
"public",
"function",
"renderContainerAssignment",
"(",
"VariableAwareInterface",
"$",
"root",
",",
"$",
"declaration",
",",
"$",
"propertyPath",
"=",
"null",
",",
"VariableAwareInterface",
"$",
"object",
"=",
"null",
",",
"$",
"semicolon",
"=",
"true",
",",
"$"... | @param VariableAwareInterface $root
@param string $declaration
@param string|null $propertyPath
@param VariableAwareInterface|null $object
@param bool $semicolon
@param bool $newLine
@return string | [
"@param",
"VariableAwareInterface",
"$root",
"@param",
"string",
"$declaration",
"@param",
"string|null",
"$propertyPath",
"@param",
"VariableAwareInterface|null",
"$object",
"@param",
"bool",
"$semicolon",
"@param",
"bool",
"$newLine"
] | train | https://github.com/egeloen/ivory-google-map/blob/bed66932ec35bda79d96cf04d91bb485875aa920/src/Helper/Formatter/Formatter.php#L240-L254 |
egeloen/ivory-google-map | src/Helper/Formatter/Formatter.php | Formatter.renderContainerVariable | public function renderContainerVariable(
VariableAwareInterface $root,
$propertyPath = null,
VariableAwareInterface $object = null
) {
$variable = $root->getVariable().'_container';
if ($propertyPath !== null) {
$variable = $this->renderProperty($variable, $propertyPath);
}
if ($object !== null) {
$variable = $this->renderProperty($variable, $object->getVariable());
}
return $variable;
} | php | public function renderContainerVariable(
VariableAwareInterface $root,
$propertyPath = null,
VariableAwareInterface $object = null
) {
$variable = $root->getVariable().'_container';
if ($propertyPath !== null) {
$variable = $this->renderProperty($variable, $propertyPath);
}
if ($object !== null) {
$variable = $this->renderProperty($variable, $object->getVariable());
}
return $variable;
} | [
"public",
"function",
"renderContainerVariable",
"(",
"VariableAwareInterface",
"$",
"root",
",",
"$",
"propertyPath",
"=",
"null",
",",
"VariableAwareInterface",
"$",
"object",
"=",
"null",
")",
"{",
"$",
"variable",
"=",
"$",
"root",
"->",
"getVariable",
"(",
... | @param VariableAwareInterface $root
@param string|null $propertyPath
@param VariableAwareInterface|null $object
@return string | [
"@param",
"VariableAwareInterface",
"$root",
"@param",
"string|null",
"$propertyPath",
"@param",
"VariableAwareInterface|null",
"$object"
] | train | https://github.com/egeloen/ivory-google-map/blob/bed66932ec35bda79d96cf04d91bb485875aa920/src/Helper/Formatter/Formatter.php#L263-L279 |
egeloen/ivory-google-map | src/Helper/Formatter/Formatter.php | Formatter.renderAssignment | public function renderAssignment($variable, $declaration, $semicolon = false, $newLine = false)
{
$separator = $this->renderSeparator();
return $this->renderCode($variable.$separator.'='.$separator.$declaration, $semicolon, $newLine);
} | php | public function renderAssignment($variable, $declaration, $semicolon = false, $newLine = false)
{
$separator = $this->renderSeparator();
return $this->renderCode($variable.$separator.'='.$separator.$declaration, $semicolon, $newLine);
} | [
"public",
"function",
"renderAssignment",
"(",
"$",
"variable",
",",
"$",
"declaration",
",",
"$",
"semicolon",
"=",
"false",
",",
"$",
"newLine",
"=",
"false",
")",
"{",
"$",
"separator",
"=",
"$",
"this",
"->",
"renderSeparator",
"(",
")",
";",
"return... | @param string $variable
@param string $declaration
@param bool $semicolon
@param bool $newLine
@return string | [
"@param",
"string",
"$variable",
"@param",
"string",
"$declaration",
"@param",
"bool",
"$semicolon",
"@param",
"bool",
"$newLine"
] | train | https://github.com/egeloen/ivory-google-map/blob/bed66932ec35bda79d96cf04d91bb485875aa920/src/Helper/Formatter/Formatter.php#L289-L294 |
egeloen/ivory-google-map | src/Helper/Formatter/Formatter.php | Formatter.renderStatement | public function renderStatement($statement, $code, $condition = null, $next = null, $newLine = true)
{
$separator = $this->renderSeparator();
$statement .= $separator;
if (!empty($condition)) {
$statement .= $this->renderArguments([$condition]).$separator;
}
if (!empty($next)) {
$next = $separator.$next;
}
return $this->renderLines([
$statement.'{',
$this->renderIndentation($code),
'}'.$next,
], true, $newLine);
} | php | public function renderStatement($statement, $code, $condition = null, $next = null, $newLine = true)
{
$separator = $this->renderSeparator();
$statement .= $separator;
if (!empty($condition)) {
$statement .= $this->renderArguments([$condition]).$separator;
}
if (!empty($next)) {
$next = $separator.$next;
}
return $this->renderLines([
$statement.'{',
$this->renderIndentation($code),
'}'.$next,
], true, $newLine);
} | [
"public",
"function",
"renderStatement",
"(",
"$",
"statement",
",",
"$",
"code",
",",
"$",
"condition",
"=",
"null",
",",
"$",
"next",
"=",
"null",
",",
"$",
"newLine",
"=",
"true",
")",
"{",
"$",
"separator",
"=",
"$",
"this",
"->",
"renderSeparator"... | @param string $statement
@param string $code
@param string|null $condition
@param string|null $next
@param bool $newLine
@return string | [
"@param",
"string",
"$statement",
"@param",
"string",
"$code",
"@param",
"string|null",
"$condition",
"@param",
"string|null",
"$next",
"@param",
"bool",
"$newLine"
] | train | https://github.com/egeloen/ivory-google-map/blob/bed66932ec35bda79d96cf04d91bb485875aa920/src/Helper/Formatter/Formatter.php#L305-L323 |
egeloen/ivory-google-map | src/Helper/Formatter/Formatter.php | Formatter.renderCode | public function renderCode($code, $semicolon = true, $newLine = true)
{
if ($semicolon) {
$code .= ';';
}
return $this->renderLine($code, $newLine);
} | php | public function renderCode($code, $semicolon = true, $newLine = true)
{
if ($semicolon) {
$code .= ';';
}
return $this->renderLine($code, $newLine);
} | [
"public",
"function",
"renderCode",
"(",
"$",
"code",
",",
"$",
"semicolon",
"=",
"true",
",",
"$",
"newLine",
"=",
"true",
")",
"{",
"if",
"(",
"$",
"semicolon",
")",
"{",
"$",
"code",
".=",
"';'",
";",
"}",
"return",
"$",
"this",
"->",
"renderLin... | @param string $code
@param bool $semicolon
@param bool $newLine
@return string | [
"@param",
"string",
"$code",
"@param",
"bool",
"$semicolon",
"@param",
"bool",
"$newLine"
] | train | https://github.com/egeloen/ivory-google-map/blob/bed66932ec35bda79d96cf04d91bb485875aa920/src/Helper/Formatter/Formatter.php#L332-L339 |
egeloen/ivory-google-map | src/Helper/Formatter/Formatter.php | Formatter.renderIndentation | public function renderIndentation($code = null)
{
if ($this->debug && !empty($code)) {
$indentation = str_repeat(' ', $this->indentationStep);
$code = $indentation.str_replace("\n", "\n".$indentation, $code);
}
return (string) $code;
} | php | public function renderIndentation($code = null)
{
if ($this->debug && !empty($code)) {
$indentation = str_repeat(' ', $this->indentationStep);
$code = $indentation.str_replace("\n", "\n".$indentation, $code);
}
return (string) $code;
} | [
"public",
"function",
"renderIndentation",
"(",
"$",
"code",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"debug",
"&&",
"!",
"empty",
"(",
"$",
"code",
")",
")",
"{",
"$",
"indentation",
"=",
"str_repeat",
"(",
"' '",
",",
"$",
"this",
"->... | @param string|null $code
@return string | [
"@param",
"string|null",
"$code"
] | train | https://github.com/egeloen/ivory-google-map/blob/bed66932ec35bda79d96cf04d91bb485875aa920/src/Helper/Formatter/Formatter.php#L346-L354 |
egeloen/ivory-google-map | src/Helper/Formatter/Formatter.php | Formatter.renderLines | public function renderLines(array $codes, $newLine = true, $eolLine = true)
{
$result = '';
$count = count($codes);
for ($index = 0; $index < $count; ++$index) {
$result .= $this->renderLine($codes[$index], $newLine && $index !== $count - 1);
}
return $this->renderLine($result, $eolLine);
} | php | public function renderLines(array $codes, $newLine = true, $eolLine = true)
{
$result = '';
$count = count($codes);
for ($index = 0; $index < $count; ++$index) {
$result .= $this->renderLine($codes[$index], $newLine && $index !== $count - 1);
}
return $this->renderLine($result, $eolLine);
} | [
"public",
"function",
"renderLines",
"(",
"array",
"$",
"codes",
",",
"$",
"newLine",
"=",
"true",
",",
"$",
"eolLine",
"=",
"true",
")",
"{",
"$",
"result",
"=",
"''",
";",
"$",
"count",
"=",
"count",
"(",
"$",
"codes",
")",
";",
"for",
"(",
"$"... | @param string[] $codes
@param bool $newLine
@param bool $eolLine
@return string | [
"@param",
"string",
"[]",
"$codes",
"@param",
"bool",
"$newLine",
"@param",
"bool",
"$eolLine"
] | train | https://github.com/egeloen/ivory-google-map/blob/bed66932ec35bda79d96cf04d91bb485875aa920/src/Helper/Formatter/Formatter.php#L363-L373 |
egeloen/ivory-google-map | src/Helper/Formatter/Formatter.php | Formatter.renderLine | public function renderLine($code = null, $newLine = true)
{
if ($newLine && !empty($code) && $this->debug) {
$code .= "\n";
}
return (string) $code;
} | php | public function renderLine($code = null, $newLine = true)
{
if ($newLine && !empty($code) && $this->debug) {
$code .= "\n";
}
return (string) $code;
} | [
"public",
"function",
"renderLine",
"(",
"$",
"code",
"=",
"null",
",",
"$",
"newLine",
"=",
"true",
")",
"{",
"if",
"(",
"$",
"newLine",
"&&",
"!",
"empty",
"(",
"$",
"code",
")",
"&&",
"$",
"this",
"->",
"debug",
")",
"{",
"$",
"code",
".=",
... | @param string|null $code
@param bool $newLine
@return string | [
"@param",
"string|null",
"$code",
"@param",
"bool",
"$newLine"
] | train | https://github.com/egeloen/ivory-google-map/blob/bed66932ec35bda79d96cf04d91bb485875aa920/src/Helper/Formatter/Formatter.php#L381-L388 |
egeloen/ivory-google-map | src/Helper/Builder/ApiHelperBuilder.php | ApiHelperBuilder.createSubscribers | protected function createSubscribers()
{
$formatter = $this->getFormatter();
$jsonBuilder = $this->getJsonBuilder();
// Layer collectors
$heatmapLayerCollector = new HeatmapLayerCollector();
// Overlay collectors
$encodedPolylineCollector = new EncodedPolylineCollector();
$markerCollector = new MarkerCollector();
$infoBoxCollector = new InfoBoxCollector($markerCollector);
// Control renderers
$controlManagerRenderer = new ControlManagerRenderer();
// Layer renderers
$heatmapLayerRenderer = new HeatmapLayerRenderer($formatter, $jsonBuilder);
// Utility renderers
$callbackRenderer = new CallbackRenderer($formatter);
$loaderRenderer = new LoaderRenderer($formatter, $jsonBuilder, $this->language, $this->key);
$requirementLoaderRenderer = new RequirementLoaderRenderer($formatter);
$requirementRenderer = new RequirementRenderer($formatter);
$sourceRenderer = new SourceRenderer($formatter);
// Map renderers
$mapTypeIdRenderer = new MapTypeIdRenderer($formatter);
$mapRenderer = new MapRenderer(
$formatter,
$jsonBuilder,
$mapTypeIdRenderer,
$controlManagerRenderer,
$requirementRenderer
);
// Overlay renderers
$encodingRenderer = new EncodingRenderer($formatter);
$encodedPolylineRenderer = new EncodedPolylineRenderer($formatter, $jsonBuilder, $encodingRenderer);
$infoBoxRenderer = new InfoBoxRenderer($formatter, $jsonBuilder, $requirementRenderer);
$markerClustererRenderer = new MarkerClustererRenderer($formatter, $jsonBuilder, $requirementRenderer);
// Place renderers
$autocompleteRenderer = new AutocompleteRenderer($formatter, $jsonBuilder, $requirementRenderer);
// Html renderers
$tagRenderer = new TagRenderer($formatter);
$javascriptTagRenderer = new JavascriptTagRenderer($formatter, $tagRenderer);
// Api renderers
$apiInitRenderer = new ApiInitRenderer($formatter);
$apiRenderer = new ApiRenderer(
$formatter,
$apiInitRenderer,
$loaderRenderer,
$requirementLoaderRenderer,
$sourceRenderer
);
return array_merge([
new ApiJavascriptSubscriber($formatter, $apiRenderer, $javascriptTagRenderer),
new AutocompleteJavascriptSubscriber(
$formatter,
$autocompleteRenderer,
$callbackRenderer,
$javascriptTagRenderer
),
new EncodedPolylineSubscriber($formatter, $encodedPolylineCollector, $encodedPolylineRenderer),
new HeatmapLayerSubscriber($formatter, $heatmapLayerCollector, $heatmapLayerRenderer),
new InfoBoxSubscriber($formatter, $infoBoxCollector, $infoBoxRenderer),
new MapJavascriptSubscriber($formatter, $mapRenderer, $callbackRenderer, $javascriptTagRenderer),
new MarkerClustererSubscriber($formatter, $markerClustererRenderer),
], parent::createSubscribers());
} | php | protected function createSubscribers()
{
$formatter = $this->getFormatter();
$jsonBuilder = $this->getJsonBuilder();
// Layer collectors
$heatmapLayerCollector = new HeatmapLayerCollector();
// Overlay collectors
$encodedPolylineCollector = new EncodedPolylineCollector();
$markerCollector = new MarkerCollector();
$infoBoxCollector = new InfoBoxCollector($markerCollector);
// Control renderers
$controlManagerRenderer = new ControlManagerRenderer();
// Layer renderers
$heatmapLayerRenderer = new HeatmapLayerRenderer($formatter, $jsonBuilder);
// Utility renderers
$callbackRenderer = new CallbackRenderer($formatter);
$loaderRenderer = new LoaderRenderer($formatter, $jsonBuilder, $this->language, $this->key);
$requirementLoaderRenderer = new RequirementLoaderRenderer($formatter);
$requirementRenderer = new RequirementRenderer($formatter);
$sourceRenderer = new SourceRenderer($formatter);
// Map renderers
$mapTypeIdRenderer = new MapTypeIdRenderer($formatter);
$mapRenderer = new MapRenderer(
$formatter,
$jsonBuilder,
$mapTypeIdRenderer,
$controlManagerRenderer,
$requirementRenderer
);
// Overlay renderers
$encodingRenderer = new EncodingRenderer($formatter);
$encodedPolylineRenderer = new EncodedPolylineRenderer($formatter, $jsonBuilder, $encodingRenderer);
$infoBoxRenderer = new InfoBoxRenderer($formatter, $jsonBuilder, $requirementRenderer);
$markerClustererRenderer = new MarkerClustererRenderer($formatter, $jsonBuilder, $requirementRenderer);
// Place renderers
$autocompleteRenderer = new AutocompleteRenderer($formatter, $jsonBuilder, $requirementRenderer);
// Html renderers
$tagRenderer = new TagRenderer($formatter);
$javascriptTagRenderer = new JavascriptTagRenderer($formatter, $tagRenderer);
// Api renderers
$apiInitRenderer = new ApiInitRenderer($formatter);
$apiRenderer = new ApiRenderer(
$formatter,
$apiInitRenderer,
$loaderRenderer,
$requirementLoaderRenderer,
$sourceRenderer
);
return array_merge([
new ApiJavascriptSubscriber($formatter, $apiRenderer, $javascriptTagRenderer),
new AutocompleteJavascriptSubscriber(
$formatter,
$autocompleteRenderer,
$callbackRenderer,
$javascriptTagRenderer
),
new EncodedPolylineSubscriber($formatter, $encodedPolylineCollector, $encodedPolylineRenderer),
new HeatmapLayerSubscriber($formatter, $heatmapLayerCollector, $heatmapLayerRenderer),
new InfoBoxSubscriber($formatter, $infoBoxCollector, $infoBoxRenderer),
new MapJavascriptSubscriber($formatter, $mapRenderer, $callbackRenderer, $javascriptTagRenderer),
new MarkerClustererSubscriber($formatter, $markerClustererRenderer),
], parent::createSubscribers());
} | [
"protected",
"function",
"createSubscribers",
"(",
")",
"{",
"$",
"formatter",
"=",
"$",
"this",
"->",
"getFormatter",
"(",
")",
";",
"$",
"jsonBuilder",
"=",
"$",
"this",
"->",
"getJsonBuilder",
"(",
")",
";",
"// Layer collectors",
"$",
"heatmapLayerCollecto... | {@inheritdoc} | [
"{"
] | train | https://github.com/egeloen/ivory-google-map/blob/bed66932ec35bda79d96cf04d91bb485875aa920/src/Helper/Builder/ApiHelperBuilder.php#L138-L211 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.