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 |
|---|---|---|---|---|---|---|---|---|---|---|
layershifter/TLDDatabase | src/Update.php | Update.run | public function run()
{
/*
* Fetching Public Suffix List and parse suffixes.
* */
$lines = $this->httpAdapter->get(Update::PUBLIC_SUFFIX_LIST_URL);
$parser = new Parser($lines);
$suffixes = $parser->parse();
/*
* Write file with exclusive file write lock.
* */
$handle = @fopen($this->outputFileName, 'w+');
if ($handle === false) {
throw new Exceptions\IOException(error_get_last()['message']);
}
if (!flock($handle, LOCK_EX)) {
throw new Exceptions\IOException(sprintf('Cannot obtain lock to output file (%s)', $this->outputFileName));
}
$suffixFile = '<?php' . PHP_EOL . 'return ' . var_export($suffixes, true) . ';';
$writtenBytes = fwrite($handle, $suffixFile);
if ($writtenBytes === false || $writtenBytes !== strlen($suffixFile)) {
throw new Exceptions\IOException(sprintf('Write to output file (%s) failed', $this->outputFileName));
}
flock($handle, LOCK_UN);
fclose($handle);
} | php | public function run()
{
/*
* Fetching Public Suffix List and parse suffixes.
* */
$lines = $this->httpAdapter->get(Update::PUBLIC_SUFFIX_LIST_URL);
$parser = new Parser($lines);
$suffixes = $parser->parse();
/*
* Write file with exclusive file write lock.
* */
$handle = @fopen($this->outputFileName, 'w+');
if ($handle === false) {
throw new Exceptions\IOException(error_get_last()['message']);
}
if (!flock($handle, LOCK_EX)) {
throw new Exceptions\IOException(sprintf('Cannot obtain lock to output file (%s)', $this->outputFileName));
}
$suffixFile = '<?php' . PHP_EOL . 'return ' . var_export($suffixes, true) . ';';
$writtenBytes = fwrite($handle, $suffixFile);
if ($writtenBytes === false || $writtenBytes !== strlen($suffixFile)) {
throw new Exceptions\IOException(sprintf('Write to output file (%s) failed', $this->outputFileName));
}
flock($handle, LOCK_UN);
fclose($handle);
} | [
"public",
"function",
"run",
"(",
")",
"{",
"/*\n * Fetching Public Suffix List and parse suffixes.\n * */",
"$",
"lines",
"=",
"$",
"this",
"->",
"httpAdapter",
"->",
"get",
"(",
"Update",
"::",
"PUBLIC_SUFFIX_LIST_URL",
")",
";",
"$",
"parser",
"=",
"new",
"Parser",
"(",
"$",
"lines",
")",
";",
"$",
"suffixes",
"=",
"$",
"parser",
"->",
"parse",
"(",
")",
";",
"/*\n * Write file with exclusive file write lock.\n * */",
"$",
"handle",
"=",
"@",
"fopen",
"(",
"$",
"this",
"->",
"outputFileName",
",",
"'w+'",
")",
";",
"if",
"(",
"$",
"handle",
"===",
"false",
")",
"{",
"throw",
"new",
"Exceptions",
"\\",
"IOException",
"(",
"error_get_last",
"(",
")",
"[",
"'message'",
"]",
")",
";",
"}",
"if",
"(",
"!",
"flock",
"(",
"$",
"handle",
",",
"LOCK_EX",
")",
")",
"{",
"throw",
"new",
"Exceptions",
"\\",
"IOException",
"(",
"sprintf",
"(",
"'Cannot obtain lock to output file (%s)'",
",",
"$",
"this",
"->",
"outputFileName",
")",
")",
";",
"}",
"$",
"suffixFile",
"=",
"'<?php'",
".",
"PHP_EOL",
".",
"'return '",
".",
"var_export",
"(",
"$",
"suffixes",
",",
"true",
")",
".",
"';'",
";",
"$",
"writtenBytes",
"=",
"fwrite",
"(",
"$",
"handle",
",",
"$",
"suffixFile",
")",
";",
"if",
"(",
"$",
"writtenBytes",
"===",
"false",
"||",
"$",
"writtenBytes",
"!==",
"strlen",
"(",
"$",
"suffixFile",
")",
")",
"{",
"throw",
"new",
"Exceptions",
"\\",
"IOException",
"(",
"sprintf",
"(",
"'Write to output file (%s) failed'",
",",
"$",
"this",
"->",
"outputFileName",
")",
")",
";",
"}",
"flock",
"(",
"$",
"handle",
",",
"LOCK_UN",
")",
";",
"fclose",
"(",
"$",
"handle",
")",
";",
"}"
] | Fetches actual Public Suffix List and writes obtained suffixes to target file.
@return void
@throws IOException | [
"Fetches",
"actual",
"Public",
"Suffix",
"List",
"and",
"writes",
"obtained",
"suffixes",
"to",
"target",
"file",
"."
] | train | https://github.com/layershifter/TLDDatabase/blob/50433a8705e3d7f3a584943c3aef09b5f561e2b7/src/Update.php#L84-L118 |
layershifter/TLDDatabase | src/Parser.php | Parser.parse | public function parse()
{
$suffixes = [];
foreach ($this->lines as $line) {
if (Str::startsWith($line, Parser::PRIVATE_DOMAINS_STRING)) {
$this->isICANNSuffix = false;
continue;
}
if (Str::startsWith($line, Parser::COMMENT_STRING_START)) {
continue;
}
$line = explode(' ', trim($line))[0];
if (Str::length($line) === 0) {
continue;
}
$suffixes[ $line ] = $this->isICANNSuffix ? Store::TYPE_ICANN : Store::TYPE_PRIVATE;
}
if (count($suffixes) === 0) {
throw new ParserException('Input array of lines does not have any valid suffix, check input');
}
return $suffixes;
} | php | public function parse()
{
$suffixes = [];
foreach ($this->lines as $line) {
if (Str::startsWith($line, Parser::PRIVATE_DOMAINS_STRING)) {
$this->isICANNSuffix = false;
continue;
}
if (Str::startsWith($line, Parser::COMMENT_STRING_START)) {
continue;
}
$line = explode(' ', trim($line))[0];
if (Str::length($line) === 0) {
continue;
}
$suffixes[ $line ] = $this->isICANNSuffix ? Store::TYPE_ICANN : Store::TYPE_PRIVATE;
}
if (count($suffixes) === 0) {
throw new ParserException('Input array of lines does not have any valid suffix, check input');
}
return $suffixes;
} | [
"public",
"function",
"parse",
"(",
")",
"{",
"$",
"suffixes",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"lines",
"as",
"$",
"line",
")",
"{",
"if",
"(",
"Str",
"::",
"startsWith",
"(",
"$",
"line",
",",
"Parser",
"::",
"PRIVATE_DOMAINS_STRING",
")",
")",
"{",
"$",
"this",
"->",
"isICANNSuffix",
"=",
"false",
";",
"continue",
";",
"}",
"if",
"(",
"Str",
"::",
"startsWith",
"(",
"$",
"line",
",",
"Parser",
"::",
"COMMENT_STRING_START",
")",
")",
"{",
"continue",
";",
"}",
"$",
"line",
"=",
"explode",
"(",
"' '",
",",
"trim",
"(",
"$",
"line",
")",
")",
"[",
"0",
"]",
";",
"if",
"(",
"Str",
"::",
"length",
"(",
"$",
"line",
")",
"===",
"0",
")",
"{",
"continue",
";",
"}",
"$",
"suffixes",
"[",
"$",
"line",
"]",
"=",
"$",
"this",
"->",
"isICANNSuffix",
"?",
"Store",
"::",
"TYPE_ICANN",
":",
"Store",
"::",
"TYPE_PRIVATE",
";",
"}",
"if",
"(",
"count",
"(",
"$",
"suffixes",
")",
"===",
"0",
")",
"{",
"throw",
"new",
"ParserException",
"(",
"'Input array of lines does not have any valid suffix, check input'",
")",
";",
"}",
"return",
"$",
"suffixes",
";",
"}"
] | Method that parses submitted strings and returns array from valid suffixes.
Parser features the following rules apply:
- the list is a set of rules, with one rule per line;
- each line is only read up to the first whitespace; entire lines can also be commented using //;
- each line which is not entirely whitespace or begins with a comment contains a rule;
@see https://publicsuffix.org/list/
@return array|string[]
@throws ParserException | [
"Method",
"that",
"parses",
"submitted",
"strings",
"and",
"returns",
"array",
"from",
"valid",
"suffixes",
"."
] | train | https://github.com/layershifter/TLDDatabase/blob/50433a8705e3d7f3a584943c3aef09b5f561e2b7/src/Parser.php#L69-L98 |
layershifter/TLDDatabase | src/Store.php | Store.getType | public function getType($suffix)
{
if (!array_key_exists($suffix, $this->suffixes)) {
throw new StoreException(sprintf(
'Provided suffix (%s) does not exists in database, check existence of entry with isExists() method ' .
'before',
$suffix
));
}
return $this->suffixes[ $suffix ];
} | php | public function getType($suffix)
{
if (!array_key_exists($suffix, $this->suffixes)) {
throw new StoreException(sprintf(
'Provided suffix (%s) does not exists in database, check existence of entry with isExists() method ' .
'before',
$suffix
));
}
return $this->suffixes[ $suffix ];
} | [
"public",
"function",
"getType",
"(",
"$",
"suffix",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"suffix",
",",
"$",
"this",
"->",
"suffixes",
")",
")",
"{",
"throw",
"new",
"StoreException",
"(",
"sprintf",
"(",
"'Provided suffix (%s) does not exists in database, check existence of entry with isExists() method '",
".",
"'before'",
",",
"$",
"suffix",
")",
")",
";",
"}",
"return",
"$",
"this",
"->",
"suffixes",
"[",
"$",
"suffix",
"]",
";",
"}"
] | Checks type of suffix entry. Returns true if suffix is ICANN TLD zone.
@param string $suffix Suffix which type will be checked.
@return int
@throws StoreException | [
"Checks",
"type",
"of",
"suffix",
"entry",
".",
"Returns",
"true",
"if",
"suffix",
"is",
"ICANN",
"TLD",
"zone",
"."
] | train | https://github.com/layershifter/TLDDatabase/blob/50433a8705e3d7f3a584943c3aef09b5f561e2b7/src/Store.php#L94-L105 |
SammyK/LaravelFacebookSdk | src/LaravelFacebookSdk/LaravelFacebookSdkServiceProvider.php | LaravelFacebookSdkServiceProvider.boot | public function boot()
{
if (! $this->app->runningInConsole()) {
return;
}
if ($this->isLumen()) {
return;
}
$this->publishes([
__DIR__.'/../config/laravel-facebook-sdk.php' => \config_path('laravel-facebook-sdk.php'),
], 'config');
} | php | public function boot()
{
if (! $this->app->runningInConsole()) {
return;
}
if ($this->isLumen()) {
return;
}
$this->publishes([
__DIR__.'/../config/laravel-facebook-sdk.php' => \config_path('laravel-facebook-sdk.php'),
], 'config');
} | [
"public",
"function",
"boot",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"app",
"->",
"runningInConsole",
"(",
")",
")",
"{",
"return",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"isLumen",
"(",
")",
")",
"{",
"return",
";",
"}",
"$",
"this",
"->",
"publishes",
"(",
"[",
"__DIR__",
".",
"'/../config/laravel-facebook-sdk.php'",
"=>",
"\\",
"config_path",
"(",
"'laravel-facebook-sdk.php'",
")",
",",
"]",
",",
"'config'",
")",
";",
"}"
] | Bootstrap the application events.
@return void | [
"Bootstrap",
"the",
"application",
"events",
"."
] | train | https://github.com/SammyK/LaravelFacebookSdk/blob/2213691019e87e589f2fcc4d0a494deade63973f/src/LaravelFacebookSdk/LaravelFacebookSdkServiceProvider.php#L19-L32 |
SammyK/LaravelFacebookSdk | src/LaravelFacebookSdk/LaravelFacebookSdkServiceProvider.php | LaravelFacebookSdkServiceProvider.register | public function register()
{
if ($this->isLumen()) {
$this->app->configure('laravel-facebook-sdk');
}
$this->mergeConfigFrom(__DIR__.'/../config/laravel-facebook-sdk.php', 'laravel-facebook-sdk');
// Main Service
$this->app->bind('SammyK\LaravelFacebookSdk\LaravelFacebookSdk', function ($app) {
$config = $app['config']->get('laravel-facebook-sdk.facebook_config');
if (! isset($config['persistent_data_handler']) && isset($app['session.store'])) {
$config['persistent_data_handler'] = new LaravelPersistentDataHandler($app['session.store']);
}
if (! isset($config['url_detection_handler'])) {
if ($this->isLumen()) {
$config['url_detection_handler'] = new LumenUrlDetectionHandler($app['url']);
} else {
$config['url_detection_handler'] = new LaravelUrlDetectionHandler($app['url']);
}
}
return new LaravelFacebookSdk($app['config'], $app['url'], $config);
});
} | php | public function register()
{
if ($this->isLumen()) {
$this->app->configure('laravel-facebook-sdk');
}
$this->mergeConfigFrom(__DIR__.'/../config/laravel-facebook-sdk.php', 'laravel-facebook-sdk');
// Main Service
$this->app->bind('SammyK\LaravelFacebookSdk\LaravelFacebookSdk', function ($app) {
$config = $app['config']->get('laravel-facebook-sdk.facebook_config');
if (! isset($config['persistent_data_handler']) && isset($app['session.store'])) {
$config['persistent_data_handler'] = new LaravelPersistentDataHandler($app['session.store']);
}
if (! isset($config['url_detection_handler'])) {
if ($this->isLumen()) {
$config['url_detection_handler'] = new LumenUrlDetectionHandler($app['url']);
} else {
$config['url_detection_handler'] = new LaravelUrlDetectionHandler($app['url']);
}
}
return new LaravelFacebookSdk($app['config'], $app['url'], $config);
});
} | [
"public",
"function",
"register",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isLumen",
"(",
")",
")",
"{",
"$",
"this",
"->",
"app",
"->",
"configure",
"(",
"'laravel-facebook-sdk'",
")",
";",
"}",
"$",
"this",
"->",
"mergeConfigFrom",
"(",
"__DIR__",
".",
"'/../config/laravel-facebook-sdk.php'",
",",
"'laravel-facebook-sdk'",
")",
";",
"// Main Service",
"$",
"this",
"->",
"app",
"->",
"bind",
"(",
"'SammyK\\LaravelFacebookSdk\\LaravelFacebookSdk'",
",",
"function",
"(",
"$",
"app",
")",
"{",
"$",
"config",
"=",
"$",
"app",
"[",
"'config'",
"]",
"->",
"get",
"(",
"'laravel-facebook-sdk.facebook_config'",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"config",
"[",
"'persistent_data_handler'",
"]",
")",
"&&",
"isset",
"(",
"$",
"app",
"[",
"'session.store'",
"]",
")",
")",
"{",
"$",
"config",
"[",
"'persistent_data_handler'",
"]",
"=",
"new",
"LaravelPersistentDataHandler",
"(",
"$",
"app",
"[",
"'session.store'",
"]",
")",
";",
"}",
"if",
"(",
"!",
"isset",
"(",
"$",
"config",
"[",
"'url_detection_handler'",
"]",
")",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isLumen",
"(",
")",
")",
"{",
"$",
"config",
"[",
"'url_detection_handler'",
"]",
"=",
"new",
"LumenUrlDetectionHandler",
"(",
"$",
"app",
"[",
"'url'",
"]",
")",
";",
"}",
"else",
"{",
"$",
"config",
"[",
"'url_detection_handler'",
"]",
"=",
"new",
"LaravelUrlDetectionHandler",
"(",
"$",
"app",
"[",
"'url'",
"]",
")",
";",
"}",
"}",
"return",
"new",
"LaravelFacebookSdk",
"(",
"$",
"app",
"[",
"'config'",
"]",
",",
"$",
"app",
"[",
"'url'",
"]",
",",
"$",
"config",
")",
";",
"}",
")",
";",
"}"
] | Register the service providers.
@return void | [
"Register",
"the",
"service",
"providers",
"."
] | train | https://github.com/SammyK/LaravelFacebookSdk/blob/2213691019e87e589f2fcc4d0a494deade63973f/src/LaravelFacebookSdk/LaravelFacebookSdkServiceProvider.php#L39-L64 |
SammyK/LaravelFacebookSdk | src/LaravelFacebookSdk/SyncableGraphNodeTrait.php | SyncableGraphNodeTrait.createOrUpdateGraphNode | public static function createOrUpdateGraphNode($data)
{
// @todo this will be GraphNode soon
if ($data instanceof GraphObject || $data instanceof GraphNode) {
$data = array_dot($data->asArray());
}
$data = static::convertGraphNodeDateTimesToStrings($data);
if (! isset($data['id'])) {
throw new \InvalidArgumentException('Graph node id is missing');
}
$attributes = [static::getGraphNodeKeyName() => $data['id']];
$graph_node = static::firstOrNewGraphNode($attributes);
static::mapGraphNodeFieldNamesToDatabaseColumnNames($graph_node, $data);
$graph_node->save();
return $graph_node;
} | php | public static function createOrUpdateGraphNode($data)
{
// @todo this will be GraphNode soon
if ($data instanceof GraphObject || $data instanceof GraphNode) {
$data = array_dot($data->asArray());
}
$data = static::convertGraphNodeDateTimesToStrings($data);
if (! isset($data['id'])) {
throw new \InvalidArgumentException('Graph node id is missing');
}
$attributes = [static::getGraphNodeKeyName() => $data['id']];
$graph_node = static::firstOrNewGraphNode($attributes);
static::mapGraphNodeFieldNamesToDatabaseColumnNames($graph_node, $data);
$graph_node->save();
return $graph_node;
} | [
"public",
"static",
"function",
"createOrUpdateGraphNode",
"(",
"$",
"data",
")",
"{",
"// @todo this will be GraphNode soon",
"if",
"(",
"$",
"data",
"instanceof",
"GraphObject",
"||",
"$",
"data",
"instanceof",
"GraphNode",
")",
"{",
"$",
"data",
"=",
"array_dot",
"(",
"$",
"data",
"->",
"asArray",
"(",
")",
")",
";",
"}",
"$",
"data",
"=",
"static",
"::",
"convertGraphNodeDateTimesToStrings",
"(",
"$",
"data",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"data",
"[",
"'id'",
"]",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'Graph node id is missing'",
")",
";",
"}",
"$",
"attributes",
"=",
"[",
"static",
"::",
"getGraphNodeKeyName",
"(",
")",
"=>",
"$",
"data",
"[",
"'id'",
"]",
"]",
";",
"$",
"graph_node",
"=",
"static",
"::",
"firstOrNewGraphNode",
"(",
"$",
"attributes",
")",
";",
"static",
"::",
"mapGraphNodeFieldNamesToDatabaseColumnNames",
"(",
"$",
"graph_node",
",",
"$",
"data",
")",
";",
"$",
"graph_node",
"->",
"save",
"(",
")",
";",
"return",
"$",
"graph_node",
";",
"}"
] | Inserts or updates the Graph node to the local database
@param array|GraphObject|GraphNode $data
@return Model
@throws \InvalidArgumentException | [
"Inserts",
"or",
"updates",
"the",
"Graph",
"node",
"to",
"the",
"local",
"database"
] | train | https://github.com/SammyK/LaravelFacebookSdk/blob/2213691019e87e589f2fcc4d0a494deade63973f/src/LaravelFacebookSdk/SyncableGraphNodeTrait.php#L39-L61 |
SammyK/LaravelFacebookSdk | src/LaravelFacebookSdk/SyncableGraphNodeTrait.php | SyncableGraphNodeTrait.fieldToColumnName | public static function fieldToColumnName($field)
{
$model_name = get_class(new static());
if (property_exists($model_name, 'graph_node_field_aliases')
&& isset(static::$graph_node_field_aliases[$field])) {
return static::$graph_node_field_aliases[$field];
}
return $field;
} | php | public static function fieldToColumnName($field)
{
$model_name = get_class(new static());
if (property_exists($model_name, 'graph_node_field_aliases')
&& isset(static::$graph_node_field_aliases[$field])) {
return static::$graph_node_field_aliases[$field];
}
return $field;
} | [
"public",
"static",
"function",
"fieldToColumnName",
"(",
"$",
"field",
")",
"{",
"$",
"model_name",
"=",
"get_class",
"(",
"new",
"static",
"(",
")",
")",
";",
"if",
"(",
"property_exists",
"(",
"$",
"model_name",
",",
"'graph_node_field_aliases'",
")",
"&&",
"isset",
"(",
"static",
"::",
"$",
"graph_node_field_aliases",
"[",
"$",
"field",
"]",
")",
")",
"{",
"return",
"static",
"::",
"$",
"graph_node_field_aliases",
"[",
"$",
"field",
"]",
";",
"}",
"return",
"$",
"field",
";",
"}"
] | Convert a Graph node field name to a database column name
@param string $field
@return string | [
"Convert",
"a",
"Graph",
"node",
"field",
"name",
"to",
"a",
"database",
"column",
"name"
] | train | https://github.com/SammyK/LaravelFacebookSdk/blob/2213691019e87e589f2fcc4d0a494deade63973f/src/LaravelFacebookSdk/SyncableGraphNodeTrait.php#L86-L95 |
SammyK/LaravelFacebookSdk | src/LaravelFacebookSdk/SyncableGraphNodeTrait.php | SyncableGraphNodeTrait.mapGraphNodeFieldNamesToDatabaseColumnNames | public static function mapGraphNodeFieldNamesToDatabaseColumnNames(Model $object, array $fields)
{
foreach ($fields as $field => $value) {
if (static::graphNodeFieldIsWhiteListed(static::fieldToColumnName($field))) {
$object->{static::fieldToColumnName($field)} = $value;
}
}
} | php | public static function mapGraphNodeFieldNamesToDatabaseColumnNames(Model $object, array $fields)
{
foreach ($fields as $field => $value) {
if (static::graphNodeFieldIsWhiteListed(static::fieldToColumnName($field))) {
$object->{static::fieldToColumnName($field)} = $value;
}
}
} | [
"public",
"static",
"function",
"mapGraphNodeFieldNamesToDatabaseColumnNames",
"(",
"Model",
"$",
"object",
",",
"array",
"$",
"fields",
")",
"{",
"foreach",
"(",
"$",
"fields",
"as",
"$",
"field",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"static",
"::",
"graphNodeFieldIsWhiteListed",
"(",
"static",
"::",
"fieldToColumnName",
"(",
"$",
"field",
")",
")",
")",
"{",
"$",
"object",
"->",
"{",
"static",
"::",
"fieldToColumnName",
"(",
"$",
"field",
")",
"}",
"=",
"$",
"value",
";",
"}",
"}",
"}"
] | Map Graph-node field names to local database column name
@param Model $object
@param array $fields | [
"Map",
"Graph",
"-",
"node",
"field",
"names",
"to",
"local",
"database",
"column",
"name"
] | train | https://github.com/SammyK/LaravelFacebookSdk/blob/2213691019e87e589f2fcc4d0a494deade63973f/src/LaravelFacebookSdk/SyncableGraphNodeTrait.php#L113-L120 |
SammyK/LaravelFacebookSdk | src/LaravelFacebookSdk/SyncableGraphNodeTrait.php | SyncableGraphNodeTrait.convertGraphNodeDateTimesToStrings | private static function convertGraphNodeDateTimesToStrings(array $data)
{
$date_format = 'Y-m-d H:i:s';
$model_name = get_class(new static());
if (property_exists($model_name, 'graph_node_date_time_to_string_format')) {
$date_format = static::$graph_node_date_time_to_string_format;
}
foreach ($data as $key => $value) {
if ($value instanceof \DateTime) {
$data[$key] = $value->format($date_format);
}
}
return $data;
} | php | private static function convertGraphNodeDateTimesToStrings(array $data)
{
$date_format = 'Y-m-d H:i:s';
$model_name = get_class(new static());
if (property_exists($model_name, 'graph_node_date_time_to_string_format')) {
$date_format = static::$graph_node_date_time_to_string_format;
}
foreach ($data as $key => $value) {
if ($value instanceof \DateTime) {
$data[$key] = $value->format($date_format);
}
}
return $data;
} | [
"private",
"static",
"function",
"convertGraphNodeDateTimesToStrings",
"(",
"array",
"$",
"data",
")",
"{",
"$",
"date_format",
"=",
"'Y-m-d H:i:s'",
";",
"$",
"model_name",
"=",
"get_class",
"(",
"new",
"static",
"(",
")",
")",
";",
"if",
"(",
"property_exists",
"(",
"$",
"model_name",
",",
"'graph_node_date_time_to_string_format'",
")",
")",
"{",
"$",
"date_format",
"=",
"static",
"::",
"$",
"graph_node_date_time_to_string_format",
";",
"}",
"foreach",
"(",
"$",
"data",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"value",
"instanceof",
"\\",
"DateTime",
")",
"{",
"$",
"data",
"[",
"$",
"key",
"]",
"=",
"$",
"value",
"->",
"format",
"(",
"$",
"date_format",
")",
";",
"}",
"}",
"return",
"$",
"data",
";",
"}"
] | Convert instances of \DateTime to string
@param array $data
@return array | [
"Convert",
"instances",
"of",
"\\",
"DateTime",
"to",
"string"
] | train | https://github.com/SammyK/LaravelFacebookSdk/blob/2213691019e87e589f2fcc4d0a494deade63973f/src/LaravelFacebookSdk/SyncableGraphNodeTrait.php#L128-L143 |
SammyK/LaravelFacebookSdk | src/LaravelFacebookSdk/SyncableGraphNodeTrait.php | SyncableGraphNodeTrait.graphNodeFieldIsWhiteListed | private static function graphNodeFieldIsWhiteListed($key)
{
$model_name = get_class(new static());
if (!property_exists($model_name, 'graph_node_fillable_fields')) {
return true;
}
return in_array($key, static::$graph_node_fillable_fields);
} | php | private static function graphNodeFieldIsWhiteListed($key)
{
$model_name = get_class(new static());
if (!property_exists($model_name, 'graph_node_fillable_fields')) {
return true;
}
return in_array($key, static::$graph_node_fillable_fields);
} | [
"private",
"static",
"function",
"graphNodeFieldIsWhiteListed",
"(",
"$",
"key",
")",
"{",
"$",
"model_name",
"=",
"get_class",
"(",
"new",
"static",
"(",
")",
")",
";",
"if",
"(",
"!",
"property_exists",
"(",
"$",
"model_name",
",",
"'graph_node_fillable_fields'",
")",
")",
"{",
"return",
"true",
";",
"}",
"return",
"in_array",
"(",
"$",
"key",
",",
"static",
"::",
"$",
"graph_node_fillable_fields",
")",
";",
"}"
] | Check a key for fillableness
@param string $key
@return boolean | [
"Check",
"a",
"key",
"for",
"fillableness"
] | train | https://github.com/SammyK/LaravelFacebookSdk/blob/2213691019e87e589f2fcc4d0a494deade63973f/src/LaravelFacebookSdk/SyncableGraphNodeTrait.php#L151-L159 |
SammyK/LaravelFacebookSdk | src/LaravelFacebookSdk/LaravelFacebookSdk.php | LaravelFacebookSdk.newInstance | public function newInstance(array $config)
{
$new_config = array_merge($this->default_config, $config);
return new static($this->config_handler, $this->url, $new_config);
} | php | public function newInstance(array $config)
{
$new_config = array_merge($this->default_config, $config);
return new static($this->config_handler, $this->url, $new_config);
} | [
"public",
"function",
"newInstance",
"(",
"array",
"$",
"config",
")",
"{",
"$",
"new_config",
"=",
"array_merge",
"(",
"$",
"this",
"->",
"default_config",
",",
"$",
"config",
")",
";",
"return",
"new",
"static",
"(",
"$",
"this",
"->",
"config_handler",
",",
"$",
"this",
"->",
"url",
",",
"$",
"new_config",
")",
";",
"}"
] | @param array $config
@return LaravelFacebookSdk | [
"@param",
"array",
"$config"
] | train | https://github.com/SammyK/LaravelFacebookSdk/blob/2213691019e87e589f2fcc4d0a494deade63973f/src/LaravelFacebookSdk/LaravelFacebookSdk.php#L46-L51 |
SammyK/LaravelFacebookSdk | src/LaravelFacebookSdk/LaravelFacebookSdk.php | LaravelFacebookSdk.getLoginUrl | public function getLoginUrl(array $scope = [], $callback_url = '')
{
$scope = $this->getScope($scope);
$callback_url = $this->getCallbackUrl($callback_url);
return $this->getRedirectLoginHelper()->getLoginUrl($callback_url, $scope);
} | php | public function getLoginUrl(array $scope = [], $callback_url = '')
{
$scope = $this->getScope($scope);
$callback_url = $this->getCallbackUrl($callback_url);
return $this->getRedirectLoginHelper()->getLoginUrl($callback_url, $scope);
} | [
"public",
"function",
"getLoginUrl",
"(",
"array",
"$",
"scope",
"=",
"[",
"]",
",",
"$",
"callback_url",
"=",
"''",
")",
"{",
"$",
"scope",
"=",
"$",
"this",
"->",
"getScope",
"(",
"$",
"scope",
")",
";",
"$",
"callback_url",
"=",
"$",
"this",
"->",
"getCallbackUrl",
"(",
"$",
"callback_url",
")",
";",
"return",
"$",
"this",
"->",
"getRedirectLoginHelper",
"(",
")",
"->",
"getLoginUrl",
"(",
"$",
"callback_url",
",",
"$",
"scope",
")",
";",
"}"
] | Generate an OAuth 2.0 authorization URL for authentication.
@param array $scope
@param string $callback_url
@return string | [
"Generate",
"an",
"OAuth",
"2",
".",
"0",
"authorization",
"URL",
"for",
"authentication",
"."
] | train | https://github.com/SammyK/LaravelFacebookSdk/blob/2213691019e87e589f2fcc4d0a494deade63973f/src/LaravelFacebookSdk/LaravelFacebookSdk.php#L61-L67 |
SammyK/LaravelFacebookSdk | src/LaravelFacebookSdk/LaravelFacebookSdk.php | LaravelFacebookSdk.getReRequestUrl | public function getReRequestUrl(array $scope, $callback_url = '')
{
$scope = $this->getScope($scope);
$callback_url = $this->getCallbackUrl($callback_url);
return $this->getRedirectLoginHelper()->getReRequestUrl($callback_url, $scope);
} | php | public function getReRequestUrl(array $scope, $callback_url = '')
{
$scope = $this->getScope($scope);
$callback_url = $this->getCallbackUrl($callback_url);
return $this->getRedirectLoginHelper()->getReRequestUrl($callback_url, $scope);
} | [
"public",
"function",
"getReRequestUrl",
"(",
"array",
"$",
"scope",
",",
"$",
"callback_url",
"=",
"''",
")",
"{",
"$",
"scope",
"=",
"$",
"this",
"->",
"getScope",
"(",
"$",
"scope",
")",
";",
"$",
"callback_url",
"=",
"$",
"this",
"->",
"getCallbackUrl",
"(",
"$",
"callback_url",
")",
";",
"return",
"$",
"this",
"->",
"getRedirectLoginHelper",
"(",
")",
"->",
"getReRequestUrl",
"(",
"$",
"callback_url",
",",
"$",
"scope",
")",
";",
"}"
] | Generate a re-request authorization URL.
@param array $scope
@param string $callback_url
@return string | [
"Generate",
"a",
"re",
"-",
"request",
"authorization",
"URL",
"."
] | train | https://github.com/SammyK/LaravelFacebookSdk/blob/2213691019e87e589f2fcc4d0a494deade63973f/src/LaravelFacebookSdk/LaravelFacebookSdk.php#L77-L83 |
SammyK/LaravelFacebookSdk | src/LaravelFacebookSdk/LaravelFacebookSdk.php | LaravelFacebookSdk.getReAuthenticationUrl | public function getReAuthenticationUrl(array $scope = [], $callback_url = '')
{
$scope = $this->getScope($scope);
$callback_url = $this->getCallbackUrl($callback_url);
return $this->getRedirectLoginHelper()->getReAuthenticationUrl($callback_url, $scope);
} | php | public function getReAuthenticationUrl(array $scope = [], $callback_url = '')
{
$scope = $this->getScope($scope);
$callback_url = $this->getCallbackUrl($callback_url);
return $this->getRedirectLoginHelper()->getReAuthenticationUrl($callback_url, $scope);
} | [
"public",
"function",
"getReAuthenticationUrl",
"(",
"array",
"$",
"scope",
"=",
"[",
"]",
",",
"$",
"callback_url",
"=",
"''",
")",
"{",
"$",
"scope",
"=",
"$",
"this",
"->",
"getScope",
"(",
"$",
"scope",
")",
";",
"$",
"callback_url",
"=",
"$",
"this",
"->",
"getCallbackUrl",
"(",
"$",
"callback_url",
")",
";",
"return",
"$",
"this",
"->",
"getRedirectLoginHelper",
"(",
")",
"->",
"getReAuthenticationUrl",
"(",
"$",
"callback_url",
",",
"$",
"scope",
")",
";",
"}"
] | Generate a re-authentication authorization URL.
@param array $scope
@param string $callback_url
@return string | [
"Generate",
"a",
"re",
"-",
"authentication",
"authorization",
"URL",
"."
] | train | https://github.com/SammyK/LaravelFacebookSdk/blob/2213691019e87e589f2fcc4d0a494deade63973f/src/LaravelFacebookSdk/LaravelFacebookSdk.php#L93-L99 |
SammyK/LaravelFacebookSdk | src/LaravelFacebookSdk/LaravelFacebookSdk.php | LaravelFacebookSdk.getAccessTokenFromRedirect | public function getAccessTokenFromRedirect($callback_url = '')
{
$callback_url = $this->getCallbackUrl($callback_url);
return $this->getRedirectLoginHelper()->getAccessToken($callback_url);
} | php | public function getAccessTokenFromRedirect($callback_url = '')
{
$callback_url = $this->getCallbackUrl($callback_url);
return $this->getRedirectLoginHelper()->getAccessToken($callback_url);
} | [
"public",
"function",
"getAccessTokenFromRedirect",
"(",
"$",
"callback_url",
"=",
"''",
")",
"{",
"$",
"callback_url",
"=",
"$",
"this",
"->",
"getCallbackUrl",
"(",
"$",
"callback_url",
")",
";",
"return",
"$",
"this",
"->",
"getRedirectLoginHelper",
"(",
")",
"->",
"getAccessToken",
"(",
"$",
"callback_url",
")",
";",
"}"
] | Get an access token from a redirect.
@param string $callback_url
@return \Facebook\Authentication\AccessToken|null | [
"Get",
"an",
"access",
"token",
"from",
"a",
"redirect",
"."
] | train | https://github.com/SammyK/LaravelFacebookSdk/blob/2213691019e87e589f2fcc4d0a494deade63973f/src/LaravelFacebookSdk/LaravelFacebookSdk.php#L107-L112 |
SammyK/LaravelFacebookSdk | src/LaravelFacebookSdk/LaravelFacebookSdk.php | LaravelFacebookSdk.getCallbackUrl | private function getCallbackUrl($callback_url)
{
$callback_url = $callback_url ?: $this->config_handler->get('laravel-facebook-sdk.default_redirect_uri');
return $this->url->to($callback_url);
} | php | private function getCallbackUrl($callback_url)
{
$callback_url = $callback_url ?: $this->config_handler->get('laravel-facebook-sdk.default_redirect_uri');
return $this->url->to($callback_url);
} | [
"private",
"function",
"getCallbackUrl",
"(",
"$",
"callback_url",
")",
"{",
"$",
"callback_url",
"=",
"$",
"callback_url",
"?",
":",
"$",
"this",
"->",
"config_handler",
"->",
"get",
"(",
"'laravel-facebook-sdk.default_redirect_uri'",
")",
";",
"return",
"$",
"this",
"->",
"url",
"->",
"to",
"(",
"$",
"callback_url",
")",
";",
"}"
] | Get the fallback callback redirect URL if none provided.
@param string $callback_url
@return string | [
"Get",
"the",
"fallback",
"callback",
"redirect",
"URL",
"if",
"none",
"provided",
"."
] | train | https://github.com/SammyK/LaravelFacebookSdk/blob/2213691019e87e589f2fcc4d0a494deade63973f/src/LaravelFacebookSdk/LaravelFacebookSdk.php#L133-L138 |
spryker-eco/akeneo-pim | src/SprykerEco/Service/AkeneoPim/Dependencies/External/Api/Adapter/Family/MeasureFamilyApiAdapter.php | MeasureFamilyApiAdapter.listPerPage | public function listPerPage($limit = 10, $withCount = false, array $queryParameters = []): AkeneoResourcePageInterface
{
$page = $this->akeneoPimClient
->getMeasureFamilyApi()
->listPerPage($limit, $withCount, $queryParameters);
return $this->wrapperFactory
->createAkeneoPage($page);
} | php | public function listPerPage($limit = 10, $withCount = false, array $queryParameters = []): AkeneoResourcePageInterface
{
$page = $this->akeneoPimClient
->getMeasureFamilyApi()
->listPerPage($limit, $withCount, $queryParameters);
return $this->wrapperFactory
->createAkeneoPage($page);
} | [
"public",
"function",
"listPerPage",
"(",
"$",
"limit",
"=",
"10",
",",
"$",
"withCount",
"=",
"false",
",",
"array",
"$",
"queryParameters",
"=",
"[",
"]",
")",
":",
"AkeneoResourcePageInterface",
"{",
"$",
"page",
"=",
"$",
"this",
"->",
"akeneoPimClient",
"->",
"getMeasureFamilyApi",
"(",
")",
"->",
"listPerPage",
"(",
"$",
"limit",
",",
"$",
"withCount",
",",
"$",
"queryParameters",
")",
";",
"return",
"$",
"this",
"->",
"wrapperFactory",
"->",
"createAkeneoPage",
"(",
"$",
"page",
")",
";",
"}"
] | {@inheritdoc}
@param int $limit The maximum number of resources to return.
Do note that the server has a maximum limit allowed.
@param bool $withCount Set to true to return the total count of resources.
This parameter could decrease drastically the performance when set to true.
@param array $queryParameters Additional query parameters to pass in the request.
@return \SprykerEco\Service\AkeneoPim\Dependencies\External\Api\Wrapper\AkeneoResourcePageInterface | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/spryker-eco/akeneo-pim/blob/c18fa3df62d28fdaf8611e24b42d0f22f1c9c216/src/SprykerEco/Service/AkeneoPim/Dependencies/External/Api/Adapter/Family/MeasureFamilyApiAdapter.php#L63-L71 |
spryker-eco/akeneo-pim | src/SprykerEco/Service/AkeneoPim/Dependencies/External/Api/Adapter/Family/MeasureFamilyApiAdapter.php | MeasureFamilyApiAdapter.all | public function all($pageSize = 10, array $queryParameters = []): AkeneoResourceCursorInterface
{
$resourceCursor = $this->akeneoPimClient
->getMeasureFamilyApi()
->all($pageSize, $queryParameters);
return $this->wrapperFactory
->createAkeneoResourceCursor($resourceCursor);
} | php | public function all($pageSize = 10, array $queryParameters = []): AkeneoResourceCursorInterface
{
$resourceCursor = $this->akeneoPimClient
->getMeasureFamilyApi()
->all($pageSize, $queryParameters);
return $this->wrapperFactory
->createAkeneoResourceCursor($resourceCursor);
} | [
"public",
"function",
"all",
"(",
"$",
"pageSize",
"=",
"10",
",",
"array",
"$",
"queryParameters",
"=",
"[",
"]",
")",
":",
"AkeneoResourceCursorInterface",
"{",
"$",
"resourceCursor",
"=",
"$",
"this",
"->",
"akeneoPimClient",
"->",
"getMeasureFamilyApi",
"(",
")",
"->",
"all",
"(",
"$",
"pageSize",
",",
"$",
"queryParameters",
")",
";",
"return",
"$",
"this",
"->",
"wrapperFactory",
"->",
"createAkeneoResourceCursor",
"(",
"$",
"resourceCursor",
")",
";",
"}"
] | {@inheritdoc}
@param int $pageSize The size of the page returned by the server.
Do note that the server has a maximum limit allowed.
@param array $queryParameters Additional query parameters to pass in the request
@return \SprykerEco\Service\AkeneoPim\Dependencies\External\Api\Wrapper\AkeneoResourceCursorInterface | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/spryker-eco/akeneo-pim/blob/c18fa3df62d28fdaf8611e24b42d0f22f1c9c216/src/SprykerEco/Service/AkeneoPim/Dependencies/External/Api/Adapter/Family/MeasureFamilyApiAdapter.php#L82-L90 |
spryker-eco/akeneo-pim | src/SprykerEco/Service/AkeneoPim/Dependencies/External/Api/Adapter/Sdk/AkeneoPimSdkFactory.php | AkeneoPimSdkFactory.createAkeneoPimClient | public function createAkeneoPimClient(AkeneoPimConfig $config): AkeneoPimClientInterface
{
$clientBuilder = new AkeneoPimClientBuilder(
$config->getHost()
);
$clientBuilder->setHttpClient(
$this->createHttpClient()
);
return $clientBuilder->buildAuthenticatedByPassword(
$config->getClientId(),
$config->getClientSecret(),
$config->getUsername(),
$config->getPassword()
);
} | php | public function createAkeneoPimClient(AkeneoPimConfig $config): AkeneoPimClientInterface
{
$clientBuilder = new AkeneoPimClientBuilder(
$config->getHost()
);
$clientBuilder->setHttpClient(
$this->createHttpClient()
);
return $clientBuilder->buildAuthenticatedByPassword(
$config->getClientId(),
$config->getClientSecret(),
$config->getUsername(),
$config->getPassword()
);
} | [
"public",
"function",
"createAkeneoPimClient",
"(",
"AkeneoPimConfig",
"$",
"config",
")",
":",
"AkeneoPimClientInterface",
"{",
"$",
"clientBuilder",
"=",
"new",
"AkeneoPimClientBuilder",
"(",
"$",
"config",
"->",
"getHost",
"(",
")",
")",
";",
"$",
"clientBuilder",
"->",
"setHttpClient",
"(",
"$",
"this",
"->",
"createHttpClient",
"(",
")",
")",
";",
"return",
"$",
"clientBuilder",
"->",
"buildAuthenticatedByPassword",
"(",
"$",
"config",
"->",
"getClientId",
"(",
")",
",",
"$",
"config",
"->",
"getClientSecret",
"(",
")",
",",
"$",
"config",
"->",
"getUsername",
"(",
")",
",",
"$",
"config",
"->",
"getPassword",
"(",
")",
")",
";",
"}"
] | @param \SprykerEco\Service\AkeneoPim\AkeneoPimConfig $config
@return \Akeneo\Pim\ApiClient\AkeneoPimClientInterface | [
"@param",
"\\",
"SprykerEco",
"\\",
"Service",
"\\",
"AkeneoPim",
"\\",
"AkeneoPimConfig",
"$config"
] | train | https://github.com/spryker-eco/akeneo-pim/blob/c18fa3df62d28fdaf8611e24b42d0f22f1c9c216/src/SprykerEco/Service/AkeneoPim/Dependencies/External/Api/Adapter/Sdk/AkeneoPimSdkFactory.php#L23-L38 |
spryker-eco/akeneo-pim | src/SprykerEco/Service/AkeneoPim/AkeneoPimService.php | AkeneoPimService.getAllProducts | public function getAllProducts($pageSize = 10, array $queryParameters = []): AkeneoResourceCursorInterface
{
return $this->getFactory()
->createAkeneoPimAdapterFactory()
->createProductApiAdapter()
->all($pageSize, $queryParameters);
} | php | public function getAllProducts($pageSize = 10, array $queryParameters = []): AkeneoResourceCursorInterface
{
return $this->getFactory()
->createAkeneoPimAdapterFactory()
->createProductApiAdapter()
->all($pageSize, $queryParameters);
} | [
"public",
"function",
"getAllProducts",
"(",
"$",
"pageSize",
"=",
"10",
",",
"array",
"$",
"queryParameters",
"=",
"[",
"]",
")",
":",
"AkeneoResourceCursorInterface",
"{",
"return",
"$",
"this",
"->",
"getFactory",
"(",
")",
"->",
"createAkeneoPimAdapterFactory",
"(",
")",
"->",
"createProductApiAdapter",
"(",
")",
"->",
"all",
"(",
"$",
"pageSize",
",",
"$",
"queryParameters",
")",
";",
"}"
] | {@inheritdoc}
@api
@param int $pageSize The size of the page returned by the server.
@param array $queryParameters Additional query parameters to pass in the request
@return \SprykerEco\Service\AkeneoPim\Dependencies\External\Api\Wrapper\AkeneoResourceCursorInterface | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/spryker-eco/akeneo-pim/blob/c18fa3df62d28fdaf8611e24b42d0f22f1c9c216/src/SprykerEco/Service/AkeneoPim/AkeneoPimService.php#L29-L35 |
spryker-eco/akeneo-pim | src/SprykerEco/Service/AkeneoPim/AkeneoPimService.php | AkeneoPimService.getAllCategories | public function getAllCategories($pageSize = 10, array $queryParameters = []): AkeneoResourceCursorInterface
{
return $this->getFactory()
->createAkeneoPimAdapterFactory()
->createCategoryApiAdapter()
->all($pageSize, $queryParameters);
} | php | public function getAllCategories($pageSize = 10, array $queryParameters = []): AkeneoResourceCursorInterface
{
return $this->getFactory()
->createAkeneoPimAdapterFactory()
->createCategoryApiAdapter()
->all($pageSize, $queryParameters);
} | [
"public",
"function",
"getAllCategories",
"(",
"$",
"pageSize",
"=",
"10",
",",
"array",
"$",
"queryParameters",
"=",
"[",
"]",
")",
":",
"AkeneoResourceCursorInterface",
"{",
"return",
"$",
"this",
"->",
"getFactory",
"(",
")",
"->",
"createAkeneoPimAdapterFactory",
"(",
")",
"->",
"createCategoryApiAdapter",
"(",
")",
"->",
"all",
"(",
"$",
"pageSize",
",",
"$",
"queryParameters",
")",
";",
"}"
] | {@inheritdoc}
@api
@param int $pageSize The size of the page returned by the server.
@param array $queryParameters Additional query parameters to pass in the request
@return \SprykerEco\Service\AkeneoPim\Dependencies\External\Api\Wrapper\AkeneoResourceCursorInterface | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/spryker-eco/akeneo-pim/blob/c18fa3df62d28fdaf8611e24b42d0f22f1c9c216/src/SprykerEco/Service/AkeneoPim/AkeneoPimService.php#L47-L53 |
spryker-eco/akeneo-pim | src/SprykerEco/Service/AkeneoPim/AkeneoPimService.php | AkeneoPimService.getAllAttributes | public function getAllAttributes($pageSize = 10, array $queryParameters = []): AkeneoResourceCursorInterface
{
return $this->getFactory()
->createAkeneoPimAdapterFactory()
->createAttributeApiAdapter()
->all($pageSize, $queryParameters);
} | php | public function getAllAttributes($pageSize = 10, array $queryParameters = []): AkeneoResourceCursorInterface
{
return $this->getFactory()
->createAkeneoPimAdapterFactory()
->createAttributeApiAdapter()
->all($pageSize, $queryParameters);
} | [
"public",
"function",
"getAllAttributes",
"(",
"$",
"pageSize",
"=",
"10",
",",
"array",
"$",
"queryParameters",
"=",
"[",
"]",
")",
":",
"AkeneoResourceCursorInterface",
"{",
"return",
"$",
"this",
"->",
"getFactory",
"(",
")",
"->",
"createAkeneoPimAdapterFactory",
"(",
")",
"->",
"createAttributeApiAdapter",
"(",
")",
"->",
"all",
"(",
"$",
"pageSize",
",",
"$",
"queryParameters",
")",
";",
"}"
] | {@inheritdoc}
@api
@param int $pageSize The size of the page returned by the server.
@param array $queryParameters Additional query parameters to pass in the request
@return \SprykerEco\Service\AkeneoPim\Dependencies\External\Api\Wrapper\AkeneoResourceCursorInterface | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/spryker-eco/akeneo-pim/blob/c18fa3df62d28fdaf8611e24b42d0f22f1c9c216/src/SprykerEco/Service/AkeneoPim/AkeneoPimService.php#L65-L71 |
spryker-eco/akeneo-pim | src/SprykerEco/Service/AkeneoPim/AkeneoPimService.php | AkeneoPimService.getAllAttributeOptions | public function getAllAttributeOptions($attributeCode, $pageSize = 10, array $queryParameters = []): AkeneoResourceCursorInterface
{
return $this->getFactory()
->createAkeneoPimAdapterFactory()
->createAttributeOptionApiAdapter()
->all($attributeCode, $pageSize, $queryParameters);
} | php | public function getAllAttributeOptions($attributeCode, $pageSize = 10, array $queryParameters = []): AkeneoResourceCursorInterface
{
return $this->getFactory()
->createAkeneoPimAdapterFactory()
->createAttributeOptionApiAdapter()
->all($attributeCode, $pageSize, $queryParameters);
} | [
"public",
"function",
"getAllAttributeOptions",
"(",
"$",
"attributeCode",
",",
"$",
"pageSize",
"=",
"10",
",",
"array",
"$",
"queryParameters",
"=",
"[",
"]",
")",
":",
"AkeneoResourceCursorInterface",
"{",
"return",
"$",
"this",
"->",
"getFactory",
"(",
")",
"->",
"createAkeneoPimAdapterFactory",
"(",
")",
"->",
"createAttributeOptionApiAdapter",
"(",
")",
"->",
"all",
"(",
"$",
"attributeCode",
",",
"$",
"pageSize",
",",
"$",
"queryParameters",
")",
";",
"}"
] | {@inheritdoc}
@api
@param string $attributeCode Code of the attribute
@param int $pageSize The size of the page returned by the server.
@param array $queryParameters Additional query parameters to pass in the request
@return \SprykerEco\Service\AkeneoPim\Dependencies\External\Api\Wrapper\AkeneoResourceCursorInterface | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/spryker-eco/akeneo-pim/blob/c18fa3df62d28fdaf8611e24b42d0f22f1c9c216/src/SprykerEco/Service/AkeneoPim/AkeneoPimService.php#L84-L90 |
spryker-eco/akeneo-pim | src/SprykerEco/Service/AkeneoPim/AkeneoPimService.php | AkeneoPimService.getAllAttributeGroups | public function getAllAttributeGroups($pageSize = 10, array $queryParameters = []): AkeneoResourceCursorInterface
{
return $this->getFactory()
->createAkeneoPimAdapterFactory()
->createAttributeGroupApiAdapter()
->all($pageSize, $queryParameters);
} | php | public function getAllAttributeGroups($pageSize = 10, array $queryParameters = []): AkeneoResourceCursorInterface
{
return $this->getFactory()
->createAkeneoPimAdapterFactory()
->createAttributeGroupApiAdapter()
->all($pageSize, $queryParameters);
} | [
"public",
"function",
"getAllAttributeGroups",
"(",
"$",
"pageSize",
"=",
"10",
",",
"array",
"$",
"queryParameters",
"=",
"[",
"]",
")",
":",
"AkeneoResourceCursorInterface",
"{",
"return",
"$",
"this",
"->",
"getFactory",
"(",
")",
"->",
"createAkeneoPimAdapterFactory",
"(",
")",
"->",
"createAttributeGroupApiAdapter",
"(",
")",
"->",
"all",
"(",
"$",
"pageSize",
",",
"$",
"queryParameters",
")",
";",
"}"
] | {@inheritdoc}
@api
@param int $pageSize The size of the page returned by the server.
@param array $queryParameters Additional query parameters to pass in the request
@return \SprykerEco\Service\AkeneoPim\Dependencies\External\Api\Wrapper\AkeneoResourceCursorInterface | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/spryker-eco/akeneo-pim/blob/c18fa3df62d28fdaf8611e24b42d0f22f1c9c216/src/SprykerEco/Service/AkeneoPim/AkeneoPimService.php#L102-L108 |
spryker-eco/akeneo-pim | src/SprykerEco/Service/AkeneoPim/AkeneoPimService.php | AkeneoPimService.getAllChannels | public function getAllChannels($pageSize = 10, array $queryParameters = []): AkeneoResourceCursorInterface
{
return $this->getFactory()
->createAkeneoPimAdapterFactory()
->createChannelApiAdapter()
->all($pageSize, $queryParameters);
} | php | public function getAllChannels($pageSize = 10, array $queryParameters = []): AkeneoResourceCursorInterface
{
return $this->getFactory()
->createAkeneoPimAdapterFactory()
->createChannelApiAdapter()
->all($pageSize, $queryParameters);
} | [
"public",
"function",
"getAllChannels",
"(",
"$",
"pageSize",
"=",
"10",
",",
"array",
"$",
"queryParameters",
"=",
"[",
"]",
")",
":",
"AkeneoResourceCursorInterface",
"{",
"return",
"$",
"this",
"->",
"getFactory",
"(",
")",
"->",
"createAkeneoPimAdapterFactory",
"(",
")",
"->",
"createChannelApiAdapter",
"(",
")",
"->",
"all",
"(",
"$",
"pageSize",
",",
"$",
"queryParameters",
")",
";",
"}"
] | {@inheritdoc}
@api
@param int $pageSize The size of the page returned by the server.
@param array $queryParameters Additional query parameters to pass in the request
@return \SprykerEco\Service\AkeneoPim\Dependencies\External\Api\Wrapper\AkeneoResourceCursorInterface | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/spryker-eco/akeneo-pim/blob/c18fa3df62d28fdaf8611e24b42d0f22f1c9c216/src/SprykerEco/Service/AkeneoPim/AkeneoPimService.php#L120-L126 |
spryker-eco/akeneo-pim | src/SprykerEco/Service/AkeneoPim/AkeneoPimService.php | AkeneoPimService.getAllCurrencies | public function getAllCurrencies($pageSize = 10, array $queryParameters = []): AkeneoResourceCursorInterface
{
return $this->getFactory()
->createAkeneoPimAdapterFactory()
->createCurrencyApiAdapter()
->all($pageSize, $queryParameters);
} | php | public function getAllCurrencies($pageSize = 10, array $queryParameters = []): AkeneoResourceCursorInterface
{
return $this->getFactory()
->createAkeneoPimAdapterFactory()
->createCurrencyApiAdapter()
->all($pageSize, $queryParameters);
} | [
"public",
"function",
"getAllCurrencies",
"(",
"$",
"pageSize",
"=",
"10",
",",
"array",
"$",
"queryParameters",
"=",
"[",
"]",
")",
":",
"AkeneoResourceCursorInterface",
"{",
"return",
"$",
"this",
"->",
"getFactory",
"(",
")",
"->",
"createAkeneoPimAdapterFactory",
"(",
")",
"->",
"createCurrencyApiAdapter",
"(",
")",
"->",
"all",
"(",
"$",
"pageSize",
",",
"$",
"queryParameters",
")",
";",
"}"
] | {@inheritdoc}
@api
@param int $pageSize The size of the page returned by the server.
@param array $queryParameters Additional query parameters to pass in the request
@return \SprykerEco\Service\AkeneoPim\Dependencies\External\Api\Wrapper\AkeneoResourceCursorInterface | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/spryker-eco/akeneo-pim/blob/c18fa3df62d28fdaf8611e24b42d0f22f1c9c216/src/SprykerEco/Service/AkeneoPim/AkeneoPimService.php#L138-L144 |
spryker-eco/akeneo-pim | src/SprykerEco/Service/AkeneoPim/AkeneoPimService.php | AkeneoPimService.getAllLocales | public function getAllLocales($pageSize = 10, array $queryParameters = []): AkeneoResourceCursorInterface
{
return $this->getFactory()
->createAkeneoPimAdapterFactory()
->createLocaleApiAdapter()
->all($pageSize, $queryParameters);
} | php | public function getAllLocales($pageSize = 10, array $queryParameters = []): AkeneoResourceCursorInterface
{
return $this->getFactory()
->createAkeneoPimAdapterFactory()
->createLocaleApiAdapter()
->all($pageSize, $queryParameters);
} | [
"public",
"function",
"getAllLocales",
"(",
"$",
"pageSize",
"=",
"10",
",",
"array",
"$",
"queryParameters",
"=",
"[",
"]",
")",
":",
"AkeneoResourceCursorInterface",
"{",
"return",
"$",
"this",
"->",
"getFactory",
"(",
")",
"->",
"createAkeneoPimAdapterFactory",
"(",
")",
"->",
"createLocaleApiAdapter",
"(",
")",
"->",
"all",
"(",
"$",
"pageSize",
",",
"$",
"queryParameters",
")",
";",
"}"
] | {@inheritdoc}
@api
@param int $pageSize The size of the page returned by the server.
@param array $queryParameters Additional query parameters to pass in the request
@return \SprykerEco\Service\AkeneoPim\Dependencies\External\Api\Wrapper\AkeneoResourceCursorInterface | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/spryker-eco/akeneo-pim/blob/c18fa3df62d28fdaf8611e24b42d0f22f1c9c216/src/SprykerEco/Service/AkeneoPim/AkeneoPimService.php#L156-L162 |
spryker-eco/akeneo-pim | src/SprykerEco/Service/AkeneoPim/AkeneoPimService.php | AkeneoPimService.getAllFamilies | public function getAllFamilies($pageSize = 10, array $queryParameters = []): AkeneoResourceCursorInterface
{
return $this->getFactory()
->createAkeneoPimAdapterFactory()
->createFamilyApiAdapter()
->all($pageSize, $queryParameters);
} | php | public function getAllFamilies($pageSize = 10, array $queryParameters = []): AkeneoResourceCursorInterface
{
return $this->getFactory()
->createAkeneoPimAdapterFactory()
->createFamilyApiAdapter()
->all($pageSize, $queryParameters);
} | [
"public",
"function",
"getAllFamilies",
"(",
"$",
"pageSize",
"=",
"10",
",",
"array",
"$",
"queryParameters",
"=",
"[",
"]",
")",
":",
"AkeneoResourceCursorInterface",
"{",
"return",
"$",
"this",
"->",
"getFactory",
"(",
")",
"->",
"createAkeneoPimAdapterFactory",
"(",
")",
"->",
"createFamilyApiAdapter",
"(",
")",
"->",
"all",
"(",
"$",
"pageSize",
",",
"$",
"queryParameters",
")",
";",
"}"
] | {@inheritdoc}
@api
@param int $pageSize The size of the page returned by the server.
@param array $queryParameters Additional query parameters to pass in the request
@return \SprykerEco\Service\AkeneoPim\Dependencies\External\Api\Wrapper\AkeneoResourceCursorInterface | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/spryker-eco/akeneo-pim/blob/c18fa3df62d28fdaf8611e24b42d0f22f1c9c216/src/SprykerEco/Service/AkeneoPim/AkeneoPimService.php#L174-L180 |
spryker-eco/akeneo-pim | src/SprykerEco/Service/AkeneoPim/AkeneoPimService.php | AkeneoPimService.getAllFamilyVariants | public function getAllFamilyVariants($familyCode, $pageSize = 10, array $queryParameters = []): AkeneoResourceCursorInterface
{
return $this->getFactory()
->createAkeneoPimAdapterFactory()
->createFamilyVariantApiAdapter()
->all($familyCode, $pageSize, $queryParameters);
} | php | public function getAllFamilyVariants($familyCode, $pageSize = 10, array $queryParameters = []): AkeneoResourceCursorInterface
{
return $this->getFactory()
->createAkeneoPimAdapterFactory()
->createFamilyVariantApiAdapter()
->all($familyCode, $pageSize, $queryParameters);
} | [
"public",
"function",
"getAllFamilyVariants",
"(",
"$",
"familyCode",
",",
"$",
"pageSize",
"=",
"10",
",",
"array",
"$",
"queryParameters",
"=",
"[",
"]",
")",
":",
"AkeneoResourceCursorInterface",
"{",
"return",
"$",
"this",
"->",
"getFactory",
"(",
")",
"->",
"createAkeneoPimAdapterFactory",
"(",
")",
"->",
"createFamilyVariantApiAdapter",
"(",
")",
"->",
"all",
"(",
"$",
"familyCode",
",",
"$",
"pageSize",
",",
"$",
"queryParameters",
")",
";",
"}"
] | {@inheritdoc}
@api
@param string $familyCode Family code from which you want to get a list of family variants.
@param int $pageSize The size of the page returned by the server.
@param array $queryParameters Additional query parameters to pass in the request
@return \SprykerEco\Service\AkeneoPim\Dependencies\External\Api\Wrapper\AkeneoResourceCursorInterface | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/spryker-eco/akeneo-pim/blob/c18fa3df62d28fdaf8611e24b42d0f22f1c9c216/src/SprykerEco/Service/AkeneoPim/AkeneoPimService.php#L193-L199 |
spryker-eco/akeneo-pim | src/SprykerEco/Service/AkeneoPim/AkeneoPimService.php | AkeneoPimService.getAllMeasureFamilies | public function getAllMeasureFamilies($pageSize = 10, array $queryParameters = []): AkeneoResourceCursorInterface
{
return $this->getFactory()
->createAkeneoPimAdapterFactory()
->createMeasureFamilyApiAdapter()
->all($pageSize, $queryParameters);
} | php | public function getAllMeasureFamilies($pageSize = 10, array $queryParameters = []): AkeneoResourceCursorInterface
{
return $this->getFactory()
->createAkeneoPimAdapterFactory()
->createMeasureFamilyApiAdapter()
->all($pageSize, $queryParameters);
} | [
"public",
"function",
"getAllMeasureFamilies",
"(",
"$",
"pageSize",
"=",
"10",
",",
"array",
"$",
"queryParameters",
"=",
"[",
"]",
")",
":",
"AkeneoResourceCursorInterface",
"{",
"return",
"$",
"this",
"->",
"getFactory",
"(",
")",
"->",
"createAkeneoPimAdapterFactory",
"(",
")",
"->",
"createMeasureFamilyApiAdapter",
"(",
")",
"->",
"all",
"(",
"$",
"pageSize",
",",
"$",
"queryParameters",
")",
";",
"}"
] | {@inheritdoc}
@api
@param int $pageSize The size of the page returned by the server.
@param array $queryParameters Additional query parameters to pass in the request
@return \SprykerEco\Service\AkeneoPim\Dependencies\External\Api\Wrapper\AkeneoResourceCursorInterface | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/spryker-eco/akeneo-pim/blob/c18fa3df62d28fdaf8611e24b42d0f22f1c9c216/src/SprykerEco/Service/AkeneoPim/AkeneoPimService.php#L211-L217 |
spryker-eco/akeneo-pim | src/SprykerEco/Service/AkeneoPim/AkeneoPimService.php | AkeneoPimService.getAllAssociationTypes | public function getAllAssociationTypes($pageSize = 10, array $queryParameters = []): AkeneoResourceCursorInterface
{
return $this->getFactory()
->createAkeneoPimAdapterFactory()
->createAssociationTypeApiAdapter()
->all($pageSize, $queryParameters);
} | php | public function getAllAssociationTypes($pageSize = 10, array $queryParameters = []): AkeneoResourceCursorInterface
{
return $this->getFactory()
->createAkeneoPimAdapterFactory()
->createAssociationTypeApiAdapter()
->all($pageSize, $queryParameters);
} | [
"public",
"function",
"getAllAssociationTypes",
"(",
"$",
"pageSize",
"=",
"10",
",",
"array",
"$",
"queryParameters",
"=",
"[",
"]",
")",
":",
"AkeneoResourceCursorInterface",
"{",
"return",
"$",
"this",
"->",
"getFactory",
"(",
")",
"->",
"createAkeneoPimAdapterFactory",
"(",
")",
"->",
"createAssociationTypeApiAdapter",
"(",
")",
"->",
"all",
"(",
"$",
"pageSize",
",",
"$",
"queryParameters",
")",
";",
"}"
] | {@inheritdoc}
@api
@param int $pageSize The size of the page returned by the server.
@param array $queryParameters Additional query parameters to pass in the request
@return \SprykerEco\Service\AkeneoPim\Dependencies\External\Api\Wrapper\AkeneoResourceCursorInterface | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/spryker-eco/akeneo-pim/blob/c18fa3df62d28fdaf8611e24b42d0f22f1c9c216/src/SprykerEco/Service/AkeneoPim/AkeneoPimService.php#L229-L235 |
spryker-eco/akeneo-pim | src/SprykerEco/Service/AkeneoPim/AkeneoPimService.php | AkeneoPimService.getAllProductMediaFiles | public function getAllProductMediaFiles($pageSize = 10, array $queryParameters = []): AkeneoResourceCursorInterface
{
return $this->getFactory()
->createAkeneoPimAdapterFactory()
->createProductMediaFileApiAdapter()
->all($pageSize, $queryParameters);
} | php | public function getAllProductMediaFiles($pageSize = 10, array $queryParameters = []): AkeneoResourceCursorInterface
{
return $this->getFactory()
->createAkeneoPimAdapterFactory()
->createProductMediaFileApiAdapter()
->all($pageSize, $queryParameters);
} | [
"public",
"function",
"getAllProductMediaFiles",
"(",
"$",
"pageSize",
"=",
"10",
",",
"array",
"$",
"queryParameters",
"=",
"[",
"]",
")",
":",
"AkeneoResourceCursorInterface",
"{",
"return",
"$",
"this",
"->",
"getFactory",
"(",
")",
"->",
"createAkeneoPimAdapterFactory",
"(",
")",
"->",
"createProductMediaFileApiAdapter",
"(",
")",
"->",
"all",
"(",
"$",
"pageSize",
",",
"$",
"queryParameters",
")",
";",
"}"
] | {@inheritdoc}
@api
@param int $pageSize The size of the page returned by the server.
@param array $queryParameters Additional query parameters to pass in the request
@return \SprykerEco\Service\AkeneoPim\Dependencies\External\Api\Wrapper\AkeneoResourceCursorInterface | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/spryker-eco/akeneo-pim/blob/c18fa3df62d28fdaf8611e24b42d0f22f1c9c216/src/SprykerEco/Service/AkeneoPim/AkeneoPimService.php#L247-L253 |
spryker-eco/akeneo-pim | src/SprykerEco/Service/AkeneoPim/AkeneoPimService.php | AkeneoPimService.getAllProductModels | public function getAllProductModels($pageSize = 10, array $queryParameters = []): AkeneoResourceCursorInterface
{
return $this->getFactory()
->createAkeneoPimAdapterFactory()
->createProductModelApiAdapter()
->all($pageSize, $queryParameters);
} | php | public function getAllProductModels($pageSize = 10, array $queryParameters = []): AkeneoResourceCursorInterface
{
return $this->getFactory()
->createAkeneoPimAdapterFactory()
->createProductModelApiAdapter()
->all($pageSize, $queryParameters);
} | [
"public",
"function",
"getAllProductModels",
"(",
"$",
"pageSize",
"=",
"10",
",",
"array",
"$",
"queryParameters",
"=",
"[",
"]",
")",
":",
"AkeneoResourceCursorInterface",
"{",
"return",
"$",
"this",
"->",
"getFactory",
"(",
")",
"->",
"createAkeneoPimAdapterFactory",
"(",
")",
"->",
"createProductModelApiAdapter",
"(",
")",
"->",
"all",
"(",
"$",
"pageSize",
",",
"$",
"queryParameters",
")",
";",
"}"
] | {@inheritdoc}
@api
@param int $pageSize The size of the page returned by the server.
@param array $queryParameters Additional query parameters to pass in the request
@return \SprykerEco\Service\AkeneoPim\Dependencies\External\Api\Wrapper\AkeneoResourceCursorInterface | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/spryker-eco/akeneo-pim/blob/c18fa3df62d28fdaf8611e24b42d0f22f1c9c216/src/SprykerEco/Service/AkeneoPim/AkeneoPimService.php#L265-L271 |
spryker-eco/akeneo-pim | src/SprykerEco/Service/AkeneoPim/AkeneoPimService.php | AkeneoPimService.getAttributeOption | public function getAttributeOption($attributeCode, $code): array
{
return $this->getFactory()
->createAkeneoPimAdapterFactory()
->createAttributeOptionApiAdapter()
->get($attributeCode, $code);
} | php | public function getAttributeOption($attributeCode, $code): array
{
return $this->getFactory()
->createAkeneoPimAdapterFactory()
->createAttributeOptionApiAdapter()
->get($attributeCode, $code);
} | [
"public",
"function",
"getAttributeOption",
"(",
"$",
"attributeCode",
",",
"$",
"code",
")",
":",
"array",
"{",
"return",
"$",
"this",
"->",
"getFactory",
"(",
")",
"->",
"createAkeneoPimAdapterFactory",
"(",
")",
"->",
"createAttributeOptionApiAdapter",
"(",
")",
"->",
"get",
"(",
"$",
"attributeCode",
",",
"$",
"code",
")",
";",
"}"
] | {@inheritdoc}
@api
@param string $attributeCode Code of the attribute
@param string $code Code of the attribute option
@return array | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/spryker-eco/akeneo-pim/blob/c18fa3df62d28fdaf8611e24b42d0f22f1c9c216/src/SprykerEco/Service/AkeneoPim/AkeneoPimService.php#L317-L323 |
spryker-eco/akeneo-pim | src/SprykerEco/Service/AkeneoPim/AkeneoPimService.php | AkeneoPimService.getFamilyVariant | public function getFamilyVariant($familyCode, $code): array
{
return $this->getFactory()
->createAkeneoPimAdapterFactory()
->createFamilyVariantApiAdapter()
->get($familyCode, $code);
} | php | public function getFamilyVariant($familyCode, $code): array
{
return $this->getFactory()
->createAkeneoPimAdapterFactory()
->createFamilyVariantApiAdapter()
->get($familyCode, $code);
} | [
"public",
"function",
"getFamilyVariant",
"(",
"$",
"familyCode",
",",
"$",
"code",
")",
":",
"array",
"{",
"return",
"$",
"this",
"->",
"getFactory",
"(",
")",
"->",
"createAkeneoPimAdapterFactory",
"(",
")",
"->",
"createFamilyVariantApiAdapter",
"(",
")",
"->",
"get",
"(",
"$",
"familyCode",
",",
"$",
"code",
")",
";",
"}"
] | {@inheritdoc}
@api
@param string $familyCode Code of the family
@param string $code Code of the family variant
@return array | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/spryker-eco/akeneo-pim/blob/c18fa3df62d28fdaf8611e24b42d0f22f1c9c216/src/SprykerEco/Service/AkeneoPim/AkeneoPimService.php#L420-L426 |
spryker-eco/akeneo-pim | src/SprykerEco/Service/AkeneoPim/AkeneoPimService.php | AkeneoPimService.getAttributesListPerPage | public function getAttributesListPerPage($limit = 10, $withCount = false, array $queryParameters = []): AkeneoResourcePageInterface
{
return $this->getFactory()
->createAkeneoPimAdapterFactory()
->createAttributeApiAdapter()
->listPerPage($limit, $withCount, $queryParameters);
} | php | public function getAttributesListPerPage($limit = 10, $withCount = false, array $queryParameters = []): AkeneoResourcePageInterface
{
return $this->getFactory()
->createAkeneoPimAdapterFactory()
->createAttributeApiAdapter()
->listPerPage($limit, $withCount, $queryParameters);
} | [
"public",
"function",
"getAttributesListPerPage",
"(",
"$",
"limit",
"=",
"10",
",",
"$",
"withCount",
"=",
"false",
",",
"array",
"$",
"queryParameters",
"=",
"[",
"]",
")",
":",
"AkeneoResourcePageInterface",
"{",
"return",
"$",
"this",
"->",
"getFactory",
"(",
")",
"->",
"createAkeneoPimAdapterFactory",
"(",
")",
"->",
"createAttributeApiAdapter",
"(",
")",
"->",
"listPerPage",
"(",
"$",
"limit",
",",
"$",
"withCount",
",",
"$",
"queryParameters",
")",
";",
"}"
] | {@inheritdoc}
@api
@param int $limit The maximum number of attributes to return.
@param bool $withCount Set to true to return the total count of attributes.
@param array $queryParameters Additional query parameters to pass in the request.
@return \SprykerEco\Service\AkeneoPim\Dependencies\External\Api\Wrapper\AkeneoResourcePageInterface | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/spryker-eco/akeneo-pim/blob/c18fa3df62d28fdaf8611e24b42d0f22f1c9c216/src/SprykerEco/Service/AkeneoPim/AkeneoPimService.php#L507-L513 |
spryker-eco/akeneo-pim | src/SprykerEco/Service/AkeneoPim/AkeneoPimService.php | AkeneoPimService.getAttributeOptionsListPerPage | public function getAttributeOptionsListPerPage($attributeCode, $limit = 10, $withCount = false, array $queryParameters = []): AkeneoResourcePageInterface
{
return $this->getFactory()
->createAkeneoPimAdapterFactory()
->createAttributeOptionApiAdapter()
->listPerPage($attributeCode, $limit, $withCount, $queryParameters);
} | php | public function getAttributeOptionsListPerPage($attributeCode, $limit = 10, $withCount = false, array $queryParameters = []): AkeneoResourcePageInterface
{
return $this->getFactory()
->createAkeneoPimAdapterFactory()
->createAttributeOptionApiAdapter()
->listPerPage($attributeCode, $limit, $withCount, $queryParameters);
} | [
"public",
"function",
"getAttributeOptionsListPerPage",
"(",
"$",
"attributeCode",
",",
"$",
"limit",
"=",
"10",
",",
"$",
"withCount",
"=",
"false",
",",
"array",
"$",
"queryParameters",
"=",
"[",
"]",
")",
":",
"AkeneoResourcePageInterface",
"{",
"return",
"$",
"this",
"->",
"getFactory",
"(",
")",
"->",
"createAkeneoPimAdapterFactory",
"(",
")",
"->",
"createAttributeOptionApiAdapter",
"(",
")",
"->",
"listPerPage",
"(",
"$",
"attributeCode",
",",
"$",
"limit",
",",
"$",
"withCount",
",",
"$",
"queryParameters",
")",
";",
"}"
] | {@inheritdoc}
@api
@param string $attributeCode Code of the attribute
@param int $limit The maximum number of resources to return.
@param bool $withCount Set to true to return the total count of resources.
@param array $queryParameters Additional query parameters to pass in the request.
@return \SprykerEco\Service\AkeneoPim\Dependencies\External\Api\Wrapper\AkeneoResourcePageInterface | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/spryker-eco/akeneo-pim/blob/c18fa3df62d28fdaf8611e24b42d0f22f1c9c216/src/SprykerEco/Service/AkeneoPim/AkeneoPimService.php#L546-L552 |
spryker-eco/akeneo-pim | src/SprykerEco/Service/AkeneoPim/AkeneoPimService.php | AkeneoPimService.getCategoriesListPerPage | public function getCategoriesListPerPage($limit = 10, $withCount = false, array $queryParameters = []): AkeneoResourcePageInterface
{
return $this->getFactory()
->createAkeneoPimAdapterFactory()
->createCategoryApiAdapter()
->listPerPage($limit, $withCount, $queryParameters);
} | php | public function getCategoriesListPerPage($limit = 10, $withCount = false, array $queryParameters = []): AkeneoResourcePageInterface
{
return $this->getFactory()
->createAkeneoPimAdapterFactory()
->createCategoryApiAdapter()
->listPerPage($limit, $withCount, $queryParameters);
} | [
"public",
"function",
"getCategoriesListPerPage",
"(",
"$",
"limit",
"=",
"10",
",",
"$",
"withCount",
"=",
"false",
",",
"array",
"$",
"queryParameters",
"=",
"[",
"]",
")",
":",
"AkeneoResourcePageInterface",
"{",
"return",
"$",
"this",
"->",
"getFactory",
"(",
")",
"->",
"createAkeneoPimAdapterFactory",
"(",
")",
"->",
"createCategoryApiAdapter",
"(",
")",
"->",
"listPerPage",
"(",
"$",
"limit",
",",
"$",
"withCount",
",",
"$",
"queryParameters",
")",
";",
"}"
] | {@inheritdoc}
@api
@param int $limit The maximum number of categories to return.
@param bool $withCount Set to true to return the total count of categories.
@param array $queryParameters Additional query parameters to pass in the request.
@return \SprykerEco\Service\AkeneoPim\Dependencies\External\Api\Wrapper\AkeneoResourcePageInterface | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/spryker-eco/akeneo-pim/blob/c18fa3df62d28fdaf8611e24b42d0f22f1c9c216/src/SprykerEco/Service/AkeneoPim/AkeneoPimService.php#L565-L571 |
spryker-eco/akeneo-pim | src/SprykerEco/Service/AkeneoPim/AkeneoPimService.php | AkeneoPimService.getChannelsListPerPage | public function getChannelsListPerPage($limit = 10, $withCount = false, array $queryParameters = []): AkeneoResourcePageInterface
{
return $this->getFactory()
->createAkeneoPimAdapterFactory()
->createChannelApiAdapter()
->listPerPage($limit, $withCount, $queryParameters);
} | php | public function getChannelsListPerPage($limit = 10, $withCount = false, array $queryParameters = []): AkeneoResourcePageInterface
{
return $this->getFactory()
->createAkeneoPimAdapterFactory()
->createChannelApiAdapter()
->listPerPage($limit, $withCount, $queryParameters);
} | [
"public",
"function",
"getChannelsListPerPage",
"(",
"$",
"limit",
"=",
"10",
",",
"$",
"withCount",
"=",
"false",
",",
"array",
"$",
"queryParameters",
"=",
"[",
"]",
")",
":",
"AkeneoResourcePageInterface",
"{",
"return",
"$",
"this",
"->",
"getFactory",
"(",
")",
"->",
"createAkeneoPimAdapterFactory",
"(",
")",
"->",
"createChannelApiAdapter",
"(",
")",
"->",
"listPerPage",
"(",
"$",
"limit",
",",
"$",
"withCount",
",",
"$",
"queryParameters",
")",
";",
"}"
] | {@inheritdoc}
@api
@param int $limit The maximum number of channels to return.
@param bool $withCount Set to true to return the total count of channels.
@param array $queryParameters Additional query parameters to pass in the request.
@return \SprykerEco\Service\AkeneoPim\Dependencies\External\Api\Wrapper\AkeneoResourcePageInterface | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/spryker-eco/akeneo-pim/blob/c18fa3df62d28fdaf8611e24b42d0f22f1c9c216/src/SprykerEco/Service/AkeneoPim/AkeneoPimService.php#L584-L590 |
spryker-eco/akeneo-pim | src/SprykerEco/Service/AkeneoPim/AkeneoPimService.php | AkeneoPimService.getCurrenciesListPerPage | public function getCurrenciesListPerPage($limit = 10, $withCount = false, array $queryParameters = []): AkeneoResourcePageInterface
{
return $this->getFactory()
->createAkeneoPimAdapterFactory()
->createCurrencyApiAdapter()
->listPerPage($limit, $withCount, $queryParameters);
} | php | public function getCurrenciesListPerPage($limit = 10, $withCount = false, array $queryParameters = []): AkeneoResourcePageInterface
{
return $this->getFactory()
->createAkeneoPimAdapterFactory()
->createCurrencyApiAdapter()
->listPerPage($limit, $withCount, $queryParameters);
} | [
"public",
"function",
"getCurrenciesListPerPage",
"(",
"$",
"limit",
"=",
"10",
",",
"$",
"withCount",
"=",
"false",
",",
"array",
"$",
"queryParameters",
"=",
"[",
"]",
")",
":",
"AkeneoResourcePageInterface",
"{",
"return",
"$",
"this",
"->",
"getFactory",
"(",
")",
"->",
"createAkeneoPimAdapterFactory",
"(",
")",
"->",
"createCurrencyApiAdapter",
"(",
")",
"->",
"listPerPage",
"(",
"$",
"limit",
",",
"$",
"withCount",
",",
"$",
"queryParameters",
")",
";",
"}"
] | {@inheritdoc}
@api
@param int $limit The maximum number of currencies to return.
@param bool $withCount Set to true to return the total count of currencies.
@param array $queryParameters Additional query parameters to pass in the request.
@return \SprykerEco\Service\AkeneoPim\Dependencies\External\Api\Wrapper\AkeneoResourcePageInterface | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/spryker-eco/akeneo-pim/blob/c18fa3df62d28fdaf8611e24b42d0f22f1c9c216/src/SprykerEco/Service/AkeneoPim/AkeneoPimService.php#L603-L609 |
spryker-eco/akeneo-pim | src/SprykerEco/Service/AkeneoPim/AkeneoPimService.php | AkeneoPimService.getLocalesListPerPage | public function getLocalesListPerPage($limit = 10, $withCount = false, array $queryParameters = []): AkeneoResourcePageInterface
{
return $this->getFactory()
->createAkeneoPimAdapterFactory()
->createAttributeGroupApiAdapter()
->listPerPage($limit, $withCount, $queryParameters);
} | php | public function getLocalesListPerPage($limit = 10, $withCount = false, array $queryParameters = []): AkeneoResourcePageInterface
{
return $this->getFactory()
->createAkeneoPimAdapterFactory()
->createAttributeGroupApiAdapter()
->listPerPage($limit, $withCount, $queryParameters);
} | [
"public",
"function",
"getLocalesListPerPage",
"(",
"$",
"limit",
"=",
"10",
",",
"$",
"withCount",
"=",
"false",
",",
"array",
"$",
"queryParameters",
"=",
"[",
"]",
")",
":",
"AkeneoResourcePageInterface",
"{",
"return",
"$",
"this",
"->",
"getFactory",
"(",
")",
"->",
"createAkeneoPimAdapterFactory",
"(",
")",
"->",
"createAttributeGroupApiAdapter",
"(",
")",
"->",
"listPerPage",
"(",
"$",
"limit",
",",
"$",
"withCount",
",",
"$",
"queryParameters",
")",
";",
"}"
] | {@inheritdoc}
@api
@param int $limit The maximum number of locales to return.
@param bool $withCount Set to true to return the total count of locales.
@param array $queryParameters Additional query parameters to pass in the request.
@return \SprykerEco\Service\AkeneoPim\Dependencies\External\Api\Wrapper\AkeneoResourcePageInterface | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/spryker-eco/akeneo-pim/blob/c18fa3df62d28fdaf8611e24b42d0f22f1c9c216/src/SprykerEco/Service/AkeneoPim/AkeneoPimService.php#L622-L628 |
spryker-eco/akeneo-pim | src/SprykerEco/Service/AkeneoPim/AkeneoPimService.php | AkeneoPimService.getFamiliesListPerPage | public function getFamiliesListPerPage($limit = 10, $withCount = false, array $queryParameters = []): AkeneoResourcePageInterface
{
return $this->getFactory()
->createAkeneoPimAdapterFactory()
->createFamilyApiAdapter()
->listPerPage($limit, $withCount, $queryParameters);
} | php | public function getFamiliesListPerPage($limit = 10, $withCount = false, array $queryParameters = []): AkeneoResourcePageInterface
{
return $this->getFactory()
->createAkeneoPimAdapterFactory()
->createFamilyApiAdapter()
->listPerPage($limit, $withCount, $queryParameters);
} | [
"public",
"function",
"getFamiliesListPerPage",
"(",
"$",
"limit",
"=",
"10",
",",
"$",
"withCount",
"=",
"false",
",",
"array",
"$",
"queryParameters",
"=",
"[",
"]",
")",
":",
"AkeneoResourcePageInterface",
"{",
"return",
"$",
"this",
"->",
"getFactory",
"(",
")",
"->",
"createAkeneoPimAdapterFactory",
"(",
")",
"->",
"createFamilyApiAdapter",
"(",
")",
"->",
"listPerPage",
"(",
"$",
"limit",
",",
"$",
"withCount",
",",
"$",
"queryParameters",
")",
";",
"}"
] | {@inheritdoc}
@api
@param int $limit The maximum number of families to return.
@param bool $withCount Set to true to return the total count of families.
@param array $queryParameters Additional query parameters to pass in the request.
@return \SprykerEco\Service\AkeneoPim\Dependencies\External\Api\Wrapper\AkeneoResourcePageInterface | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/spryker-eco/akeneo-pim/blob/c18fa3df62d28fdaf8611e24b42d0f22f1c9c216/src/SprykerEco/Service/AkeneoPim/AkeneoPimService.php#L641-L647 |
spryker-eco/akeneo-pim | src/SprykerEco/Service/AkeneoPim/AkeneoPimService.php | AkeneoPimService.getFamilyVariantsListPerPage | public function getFamilyVariantsListPerPage($familyCode, $limit = 10, $withCount = false, array $queryParameters = []): AkeneoResourcePageInterface
{
return $this->getFactory()
->createAkeneoPimAdapterFactory()
->createFamilyVariantApiAdapter()
->listPerPage($familyCode, $limit, $withCount, $queryParameters);
} | php | public function getFamilyVariantsListPerPage($familyCode, $limit = 10, $withCount = false, array $queryParameters = []): AkeneoResourcePageInterface
{
return $this->getFactory()
->createAkeneoPimAdapterFactory()
->createFamilyVariantApiAdapter()
->listPerPage($familyCode, $limit, $withCount, $queryParameters);
} | [
"public",
"function",
"getFamilyVariantsListPerPage",
"(",
"$",
"familyCode",
",",
"$",
"limit",
"=",
"10",
",",
"$",
"withCount",
"=",
"false",
",",
"array",
"$",
"queryParameters",
"=",
"[",
"]",
")",
":",
"AkeneoResourcePageInterface",
"{",
"return",
"$",
"this",
"->",
"getFactory",
"(",
")",
"->",
"createAkeneoPimAdapterFactory",
"(",
")",
"->",
"createFamilyVariantApiAdapter",
"(",
")",
"->",
"listPerPage",
"(",
"$",
"familyCode",
",",
"$",
"limit",
",",
"$",
"withCount",
",",
"$",
"queryParameters",
")",
";",
"}"
] | {@inheritdoc}
@api
@param string $familyCode Family code from which you want to get a list of family variants.
@param int $limit The maximum number of family variants to return.
@param bool $withCount Set to true to return the total count of family variants.
@param array $queryParameters Additional query parameters to pass in the request.
@return \SprykerEco\Service\AkeneoPim\Dependencies\External\Api\Wrapper\AkeneoResourcePageInterface | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/spryker-eco/akeneo-pim/blob/c18fa3df62d28fdaf8611e24b42d0f22f1c9c216/src/SprykerEco/Service/AkeneoPim/AkeneoPimService.php#L661-L667 |
spryker-eco/akeneo-pim | src/SprykerEco/Service/AkeneoPim/AkeneoPimService.php | AkeneoPimService.getMeasureFamilyListPerPage | public function getMeasureFamilyListPerPage($limit = 10, $withCount = false, array $queryParameters = []): AkeneoResourcePageInterface
{
return $this->getFactory()
->createAkeneoPimAdapterFactory()
->createMeasureFamilyApiAdapter()
->listPerPage($limit, $withCount, $queryParameters);
} | php | public function getMeasureFamilyListPerPage($limit = 10, $withCount = false, array $queryParameters = []): AkeneoResourcePageInterface
{
return $this->getFactory()
->createAkeneoPimAdapterFactory()
->createMeasureFamilyApiAdapter()
->listPerPage($limit, $withCount, $queryParameters);
} | [
"public",
"function",
"getMeasureFamilyListPerPage",
"(",
"$",
"limit",
"=",
"10",
",",
"$",
"withCount",
"=",
"false",
",",
"array",
"$",
"queryParameters",
"=",
"[",
"]",
")",
":",
"AkeneoResourcePageInterface",
"{",
"return",
"$",
"this",
"->",
"getFactory",
"(",
")",
"->",
"createAkeneoPimAdapterFactory",
"(",
")",
"->",
"createMeasureFamilyApiAdapter",
"(",
")",
"->",
"listPerPage",
"(",
"$",
"limit",
",",
"$",
"withCount",
",",
"$",
"queryParameters",
")",
";",
"}"
] | {@inheritdoc}
@api
@param int $limit The maximum number of measure families to return.
@param bool $withCount Set to true to return the total count of measure families.
@param array $queryParameters Additional query parameters to pass in the request.
@return \SprykerEco\Service\AkeneoPim\Dependencies\External\Api\Wrapper\AkeneoResourcePageInterface | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/spryker-eco/akeneo-pim/blob/c18fa3df62d28fdaf8611e24b42d0f22f1c9c216/src/SprykerEco/Service/AkeneoPim/AkeneoPimService.php#L680-L686 |
spryker-eco/akeneo-pim | src/SprykerEco/Service/AkeneoPim/AkeneoPimService.php | AkeneoPimService.getProductsListPerPage | public function getProductsListPerPage($limit = 10, $withCount = false, array $queryParameters = []): AkeneoResourcePageInterface
{
return $this->getFactory()
->createAkeneoPimAdapterFactory()
->createProductApiAdapter()
->listPerPage($limit, $withCount, $queryParameters);
} | php | public function getProductsListPerPage($limit = 10, $withCount = false, array $queryParameters = []): AkeneoResourcePageInterface
{
return $this->getFactory()
->createAkeneoPimAdapterFactory()
->createProductApiAdapter()
->listPerPage($limit, $withCount, $queryParameters);
} | [
"public",
"function",
"getProductsListPerPage",
"(",
"$",
"limit",
"=",
"10",
",",
"$",
"withCount",
"=",
"false",
",",
"array",
"$",
"queryParameters",
"=",
"[",
"]",
")",
":",
"AkeneoResourcePageInterface",
"{",
"return",
"$",
"this",
"->",
"getFactory",
"(",
")",
"->",
"createAkeneoPimAdapterFactory",
"(",
")",
"->",
"createProductApiAdapter",
"(",
")",
"->",
"listPerPage",
"(",
"$",
"limit",
",",
"$",
"withCount",
",",
"$",
"queryParameters",
")",
";",
"}"
] | {@inheritdoc}
@api
@param int $limit The maximum number of products to return.
@param bool $withCount Set to true to return the total count of products.
@param array $queryParameters Additional query parameters to pass in the request.
@return \SprykerEco\Service\AkeneoPim\Dependencies\External\Api\Wrapper\AkeneoResourcePageInterface | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/spryker-eco/akeneo-pim/blob/c18fa3df62d28fdaf8611e24b42d0f22f1c9c216/src/SprykerEco/Service/AkeneoPim/AkeneoPimService.php#L699-L705 |
spryker-eco/akeneo-pim | src/SprykerEco/Service/AkeneoPim/AkeneoPimService.php | AkeneoPimService.getProductMediaFilesListPerPage | public function getProductMediaFilesListPerPage($limit = 10, $withCount = false, array $queryParameters = []): AkeneoResourcePageInterface
{
return $this->getFactory()
->createAkeneoPimAdapterFactory()
->createProductMediaFileApiAdapter()
->listPerPage($limit, $withCount, $queryParameters);
} | php | public function getProductMediaFilesListPerPage($limit = 10, $withCount = false, array $queryParameters = []): AkeneoResourcePageInterface
{
return $this->getFactory()
->createAkeneoPimAdapterFactory()
->createProductMediaFileApiAdapter()
->listPerPage($limit, $withCount, $queryParameters);
} | [
"public",
"function",
"getProductMediaFilesListPerPage",
"(",
"$",
"limit",
"=",
"10",
",",
"$",
"withCount",
"=",
"false",
",",
"array",
"$",
"queryParameters",
"=",
"[",
"]",
")",
":",
"AkeneoResourcePageInterface",
"{",
"return",
"$",
"this",
"->",
"getFactory",
"(",
")",
"->",
"createAkeneoPimAdapterFactory",
"(",
")",
"->",
"createProductMediaFileApiAdapter",
"(",
")",
"->",
"listPerPage",
"(",
"$",
"limit",
",",
"$",
"withCount",
",",
"$",
"queryParameters",
")",
";",
"}"
] | {@inheritdoc}
@api
@param int $limit The maximum number of product media files to return.
@param bool $withCount Set to true to return the total count of product media files.
@param array $queryParameters Additional query parameters to pass in the request.
@return \SprykerEco\Service\AkeneoPim\Dependencies\External\Api\Wrapper\AkeneoResourcePageInterface | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/spryker-eco/akeneo-pim/blob/c18fa3df62d28fdaf8611e24b42d0f22f1c9c216/src/SprykerEco/Service/AkeneoPim/AkeneoPimService.php#L718-L724 |
spryker-eco/akeneo-pim | src/SprykerEco/Service/AkeneoPim/AkeneoPimService.php | AkeneoPimService.getProductModelsListPerPage | public function getProductModelsListPerPage($limit = 10, $withCount = false, array $queryParameters = []): AkeneoResourcePageInterface
{
return $this->getFactory()
->createAkeneoPimAdapterFactory()
->createProductModelApiAdapter()
->listPerPage($limit, $withCount, $queryParameters);
} | php | public function getProductModelsListPerPage($limit = 10, $withCount = false, array $queryParameters = []): AkeneoResourcePageInterface
{
return $this->getFactory()
->createAkeneoPimAdapterFactory()
->createProductModelApiAdapter()
->listPerPage($limit, $withCount, $queryParameters);
} | [
"public",
"function",
"getProductModelsListPerPage",
"(",
"$",
"limit",
"=",
"10",
",",
"$",
"withCount",
"=",
"false",
",",
"array",
"$",
"queryParameters",
"=",
"[",
"]",
")",
":",
"AkeneoResourcePageInterface",
"{",
"return",
"$",
"this",
"->",
"getFactory",
"(",
")",
"->",
"createAkeneoPimAdapterFactory",
"(",
")",
"->",
"createProductModelApiAdapter",
"(",
")",
"->",
"listPerPage",
"(",
"$",
"limit",
",",
"$",
"withCount",
",",
"$",
"queryParameters",
")",
";",
"}"
] | {@inheritdoc}
@api
@param int $limit The maximum number of product models to return.
@param bool $withCount Set to true to return the total count of product models.
@param array $queryParameters Additional query parameters to pass in the request.
@return \SprykerEco\Service\AkeneoPim\Dependencies\External\Api\Wrapper\AkeneoResourcePageInterface | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/spryker-eco/akeneo-pim/blob/c18fa3df62d28fdaf8611e24b42d0f22f1c9c216/src/SprykerEco/Service/AkeneoPim/AkeneoPimService.php#L737-L743 |
spryker-eco/akeneo-pim | src/SprykerEco/Service/AkeneoPim/Dependencies/External/Api/Adapter/Attributes/AttributeOptionApiAdapter.php | AttributeOptionApiAdapter.listPerPage | public function listPerPage($attributeCode, $limit = 10, $withCount = false, array $queryParameters = []): AkeneoResourcePageInterface
{
$page = $this->akeneoPimClient
->getAttributeOptionApi()
->listPerPage($attributeCode, $limit, $withCount, $queryParameters);
return $this->wrapperFactory
->createAkeneoPage($page);
} | php | public function listPerPage($attributeCode, $limit = 10, $withCount = false, array $queryParameters = []): AkeneoResourcePageInterface
{
$page = $this->akeneoPimClient
->getAttributeOptionApi()
->listPerPage($attributeCode, $limit, $withCount, $queryParameters);
return $this->wrapperFactory
->createAkeneoPage($page);
} | [
"public",
"function",
"listPerPage",
"(",
"$",
"attributeCode",
",",
"$",
"limit",
"=",
"10",
",",
"$",
"withCount",
"=",
"false",
",",
"array",
"$",
"queryParameters",
"=",
"[",
"]",
")",
":",
"AkeneoResourcePageInterface",
"{",
"$",
"page",
"=",
"$",
"this",
"->",
"akeneoPimClient",
"->",
"getAttributeOptionApi",
"(",
")",
"->",
"listPerPage",
"(",
"$",
"attributeCode",
",",
"$",
"limit",
",",
"$",
"withCount",
",",
"$",
"queryParameters",
")",
";",
"return",
"$",
"this",
"->",
"wrapperFactory",
"->",
"createAkeneoPage",
"(",
"$",
"page",
")",
";",
"}"
] | {@inheritdoc}
@param string $attributeCode
@param int $limit
@param bool $withCount
@param array $queryParameters
@return \SprykerEco\Service\AkeneoPim\Dependencies\External\Api\Wrapper\AkeneoResourcePageInterface | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/spryker-eco/akeneo-pim/blob/c18fa3df62d28fdaf8611e24b42d0f22f1c9c216/src/SprykerEco/Service/AkeneoPim/Dependencies/External/Api/Adapter/Attributes/AttributeOptionApiAdapter.php#L61-L69 |
spryker-eco/akeneo-pim | src/SprykerEco/Service/AkeneoPim/Dependencies/External/Api/Adapter/Attributes/AttributeOptionApiAdapter.php | AttributeOptionApiAdapter.all | public function all($attributeCode, $pageSize = 10, array $queryParameters = []): AkeneoResourceCursorInterface
{
$resourceCursor = $this->akeneoPimClient
->getAttributeOptionApi()
->all($attributeCode, $pageSize, $queryParameters);
return $this->wrapperFactory
->createAkeneoResourceCursor($resourceCursor);
} | php | public function all($attributeCode, $pageSize = 10, array $queryParameters = []): AkeneoResourceCursorInterface
{
$resourceCursor = $this->akeneoPimClient
->getAttributeOptionApi()
->all($attributeCode, $pageSize, $queryParameters);
return $this->wrapperFactory
->createAkeneoResourceCursor($resourceCursor);
} | [
"public",
"function",
"all",
"(",
"$",
"attributeCode",
",",
"$",
"pageSize",
"=",
"10",
",",
"array",
"$",
"queryParameters",
"=",
"[",
"]",
")",
":",
"AkeneoResourceCursorInterface",
"{",
"$",
"resourceCursor",
"=",
"$",
"this",
"->",
"akeneoPimClient",
"->",
"getAttributeOptionApi",
"(",
")",
"->",
"all",
"(",
"$",
"attributeCode",
",",
"$",
"pageSize",
",",
"$",
"queryParameters",
")",
";",
"return",
"$",
"this",
"->",
"wrapperFactory",
"->",
"createAkeneoResourceCursor",
"(",
"$",
"resourceCursor",
")",
";",
"}"
] | {@inheritdoc}
@param string $attributeCode
@param int $pageSize
@param array $queryParameters
@return \SprykerEco\Service\AkeneoPim\Dependencies\External\Api\Wrapper\AkeneoResourceCursorInterface | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/spryker-eco/akeneo-pim/blob/c18fa3df62d28fdaf8611e24b42d0f22f1c9c216/src/SprykerEco/Service/AkeneoPim/Dependencies/External/Api/Adapter/Attributes/AttributeOptionApiAdapter.php#L80-L88 |
spryker-eco/akeneo-pim | src/SprykerEco/Service/AkeneoPim/Dependencies/External/Api/Adapter/Family/FamilyVariantApiAdapter.php | FamilyVariantApiAdapter.listPerPage | public function listPerPage($familyCode, $limit = 10, $withCount = false, array $queryParameters = []): AkeneoResourcePageInterface
{
$page = $this->akeneoPimClient
->getFamilyVariantApi()
->listPerPage($familyCode, $limit, $withCount, $queryParameters);
return $this->wrapperFactory
->createAkeneoPage($page);
} | php | public function listPerPage($familyCode, $limit = 10, $withCount = false, array $queryParameters = []): AkeneoResourcePageInterface
{
$page = $this->akeneoPimClient
->getFamilyVariantApi()
->listPerPage($familyCode, $limit, $withCount, $queryParameters);
return $this->wrapperFactory
->createAkeneoPage($page);
} | [
"public",
"function",
"listPerPage",
"(",
"$",
"familyCode",
",",
"$",
"limit",
"=",
"10",
",",
"$",
"withCount",
"=",
"false",
",",
"array",
"$",
"queryParameters",
"=",
"[",
"]",
")",
":",
"AkeneoResourcePageInterface",
"{",
"$",
"page",
"=",
"$",
"this",
"->",
"akeneoPimClient",
"->",
"getFamilyVariantApi",
"(",
")",
"->",
"listPerPage",
"(",
"$",
"familyCode",
",",
"$",
"limit",
",",
"$",
"withCount",
",",
"$",
"queryParameters",
")",
";",
"return",
"$",
"this",
"->",
"wrapperFactory",
"->",
"createAkeneoPage",
"(",
"$",
"page",
")",
";",
"}"
] | {@inheritdoc}
@param string $familyCode
@param int $limit
@param bool $withCount
@param array $queryParameters
@return \SprykerEco\Service\AkeneoPim\Dependencies\External\Api\Wrapper\AkeneoResourcePageInterface | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/spryker-eco/akeneo-pim/blob/c18fa3df62d28fdaf8611e24b42d0f22f1c9c216/src/SprykerEco/Service/AkeneoPim/Dependencies/External/Api/Adapter/Family/FamilyVariantApiAdapter.php#L62-L70 |
spryker-eco/akeneo-pim | src/SprykerEco/Service/AkeneoPim/Dependencies/External/Api/Adapter/Family/FamilyVariantApiAdapter.php | FamilyVariantApiAdapter.all | public function all($familyCode, $pageSize = 10, array $queryParameters = []): AkeneoResourceCursorInterface
{
$resourceCursor = $this->akeneoPimClient
->getFamilyVariantApi()
->all($familyCode, $pageSize, $queryParameters);
return $this->wrapperFactory
->createAkeneoResourceCursor($resourceCursor);
} | php | public function all($familyCode, $pageSize = 10, array $queryParameters = []): AkeneoResourceCursorInterface
{
$resourceCursor = $this->akeneoPimClient
->getFamilyVariantApi()
->all($familyCode, $pageSize, $queryParameters);
return $this->wrapperFactory
->createAkeneoResourceCursor($resourceCursor);
} | [
"public",
"function",
"all",
"(",
"$",
"familyCode",
",",
"$",
"pageSize",
"=",
"10",
",",
"array",
"$",
"queryParameters",
"=",
"[",
"]",
")",
":",
"AkeneoResourceCursorInterface",
"{",
"$",
"resourceCursor",
"=",
"$",
"this",
"->",
"akeneoPimClient",
"->",
"getFamilyVariantApi",
"(",
")",
"->",
"all",
"(",
"$",
"familyCode",
",",
"$",
"pageSize",
",",
"$",
"queryParameters",
")",
";",
"return",
"$",
"this",
"->",
"wrapperFactory",
"->",
"createAkeneoResourceCursor",
"(",
"$",
"resourceCursor",
")",
";",
"}"
] | {@inheritdoc}
@param string $familyCode
@param int $pageSize
@param array $queryParameters
@return \SprykerEco\Service\AkeneoPim\Dependencies\External\Api\Wrapper\AkeneoResourceCursorInterface | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/spryker-eco/akeneo-pim/blob/c18fa3df62d28fdaf8611e24b42d0f22f1c9c216/src/SprykerEco/Service/AkeneoPim/Dependencies/External/Api/Adapter/Family/FamilyVariantApiAdapter.php#L81-L89 |
jonahgeorge/jaeger-client-php | src/Jaeger/Tracer.php | Tracer.startSpan | public function startSpan($operationName, $options = [])
{
if (!($options instanceof StartSpanOptions)) {
$options = StartSpanOptions::create($options);
}
$parent = $this->getParentSpanContext($options);
$tags = $options->getTags();
$rpcServer = ($tags[SPAN_KIND] ?? null) == SPAN_KIND_RPC_SERVER;
if ($parent == null || $parent->isDebugIdContainerOnly()) {
$traceId = $this->randomId();
$spanId = $traceId;
$parentId = null;
$flags = 0;
$baggage = null;
if ($parent == null) {
list($sampled, $samplerTags) = $this->sampler->isSampled($traceId, $operationName);
if ($sampled) {
$flags = SAMPLED_FLAG;
$tags = $tags ?? [];
foreach ($samplerTags as $key => $value) {
$tags[$key] = $value;
}
}
} else { // have debug id
$flags = SAMPLED_FLAG | DEBUG_FLAG;
$tags = $tags ?? [];
$tags[$this->debugIdHeader] = $parent->getDebugId();
}
} else {
$traceId = $parent->getTraceId();
if ($rpcServer && $this->oneSpanPerRpc) {
// Zipkin-style one-span-per-RPC
$spanId = $parent->getSpanId();
$parentId = $parent->getParentId();
} else {
$spanId = $this->randomId();
$parentId = $parent->getSpanId();
}
$flags = $parent->getFlags();
$baggage = $parent->getBaggage();
}
$spanContext = new SpanContext(
$traceId,
$spanId,
$parentId,
$flags,
$baggage
);
$span = new Span(
$spanContext,
$this,
$operationName,
$tags ?? [],
$options->getStartTime()
);
if (($rpcServer || $parentId === null) && ($flags & SAMPLED_FLAG)) {
// this is a first-in-process span, and is sampled
$span->setTags($this->tags);
}
return $span;
} | php | public function startSpan($operationName, $options = [])
{
if (!($options instanceof StartSpanOptions)) {
$options = StartSpanOptions::create($options);
}
$parent = $this->getParentSpanContext($options);
$tags = $options->getTags();
$rpcServer = ($tags[SPAN_KIND] ?? null) == SPAN_KIND_RPC_SERVER;
if ($parent == null || $parent->isDebugIdContainerOnly()) {
$traceId = $this->randomId();
$spanId = $traceId;
$parentId = null;
$flags = 0;
$baggage = null;
if ($parent == null) {
list($sampled, $samplerTags) = $this->sampler->isSampled($traceId, $operationName);
if ($sampled) {
$flags = SAMPLED_FLAG;
$tags = $tags ?? [];
foreach ($samplerTags as $key => $value) {
$tags[$key] = $value;
}
}
} else { // have debug id
$flags = SAMPLED_FLAG | DEBUG_FLAG;
$tags = $tags ?? [];
$tags[$this->debugIdHeader] = $parent->getDebugId();
}
} else {
$traceId = $parent->getTraceId();
if ($rpcServer && $this->oneSpanPerRpc) {
// Zipkin-style one-span-per-RPC
$spanId = $parent->getSpanId();
$parentId = $parent->getParentId();
} else {
$spanId = $this->randomId();
$parentId = $parent->getSpanId();
}
$flags = $parent->getFlags();
$baggage = $parent->getBaggage();
}
$spanContext = new SpanContext(
$traceId,
$spanId,
$parentId,
$flags,
$baggage
);
$span = new Span(
$spanContext,
$this,
$operationName,
$tags ?? [],
$options->getStartTime()
);
if (($rpcServer || $parentId === null) && ($flags & SAMPLED_FLAG)) {
// this is a first-in-process span, and is sampled
$span->setTags($this->tags);
}
return $span;
} | [
"public",
"function",
"startSpan",
"(",
"$",
"operationName",
",",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"(",
"$",
"options",
"instanceof",
"StartSpanOptions",
")",
")",
"{",
"$",
"options",
"=",
"StartSpanOptions",
"::",
"create",
"(",
"$",
"options",
")",
";",
"}",
"$",
"parent",
"=",
"$",
"this",
"->",
"getParentSpanContext",
"(",
"$",
"options",
")",
";",
"$",
"tags",
"=",
"$",
"options",
"->",
"getTags",
"(",
")",
";",
"$",
"rpcServer",
"=",
"(",
"$",
"tags",
"[",
"SPAN_KIND",
"]",
"??",
"null",
")",
"==",
"SPAN_KIND_RPC_SERVER",
";",
"if",
"(",
"$",
"parent",
"==",
"null",
"||",
"$",
"parent",
"->",
"isDebugIdContainerOnly",
"(",
")",
")",
"{",
"$",
"traceId",
"=",
"$",
"this",
"->",
"randomId",
"(",
")",
";",
"$",
"spanId",
"=",
"$",
"traceId",
";",
"$",
"parentId",
"=",
"null",
";",
"$",
"flags",
"=",
"0",
";",
"$",
"baggage",
"=",
"null",
";",
"if",
"(",
"$",
"parent",
"==",
"null",
")",
"{",
"list",
"(",
"$",
"sampled",
",",
"$",
"samplerTags",
")",
"=",
"$",
"this",
"->",
"sampler",
"->",
"isSampled",
"(",
"$",
"traceId",
",",
"$",
"operationName",
")",
";",
"if",
"(",
"$",
"sampled",
")",
"{",
"$",
"flags",
"=",
"SAMPLED_FLAG",
";",
"$",
"tags",
"=",
"$",
"tags",
"??",
"[",
"]",
";",
"foreach",
"(",
"$",
"samplerTags",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"tags",
"[",
"$",
"key",
"]",
"=",
"$",
"value",
";",
"}",
"}",
"}",
"else",
"{",
"// have debug id",
"$",
"flags",
"=",
"SAMPLED_FLAG",
"|",
"DEBUG_FLAG",
";",
"$",
"tags",
"=",
"$",
"tags",
"??",
"[",
"]",
";",
"$",
"tags",
"[",
"$",
"this",
"->",
"debugIdHeader",
"]",
"=",
"$",
"parent",
"->",
"getDebugId",
"(",
")",
";",
"}",
"}",
"else",
"{",
"$",
"traceId",
"=",
"$",
"parent",
"->",
"getTraceId",
"(",
")",
";",
"if",
"(",
"$",
"rpcServer",
"&&",
"$",
"this",
"->",
"oneSpanPerRpc",
")",
"{",
"// Zipkin-style one-span-per-RPC",
"$",
"spanId",
"=",
"$",
"parent",
"->",
"getSpanId",
"(",
")",
";",
"$",
"parentId",
"=",
"$",
"parent",
"->",
"getParentId",
"(",
")",
";",
"}",
"else",
"{",
"$",
"spanId",
"=",
"$",
"this",
"->",
"randomId",
"(",
")",
";",
"$",
"parentId",
"=",
"$",
"parent",
"->",
"getSpanId",
"(",
")",
";",
"}",
"$",
"flags",
"=",
"$",
"parent",
"->",
"getFlags",
"(",
")",
";",
"$",
"baggage",
"=",
"$",
"parent",
"->",
"getBaggage",
"(",
")",
";",
"}",
"$",
"spanContext",
"=",
"new",
"SpanContext",
"(",
"$",
"traceId",
",",
"$",
"spanId",
",",
"$",
"parentId",
",",
"$",
"flags",
",",
"$",
"baggage",
")",
";",
"$",
"span",
"=",
"new",
"Span",
"(",
"$",
"spanContext",
",",
"$",
"this",
",",
"$",
"operationName",
",",
"$",
"tags",
"??",
"[",
"]",
",",
"$",
"options",
"->",
"getStartTime",
"(",
")",
")",
";",
"if",
"(",
"(",
"$",
"rpcServer",
"||",
"$",
"parentId",
"===",
"null",
")",
"&&",
"(",
"$",
"flags",
"&",
"SAMPLED_FLAG",
")",
")",
"{",
"// this is a first-in-process span, and is sampled",
"$",
"span",
"->",
"setTags",
"(",
"$",
"this",
"->",
"tags",
")",
";",
"}",
"return",
"$",
"span",
";",
"}"
] | {@inheritdoc} | [
"{"
] | train | https://github.com/jonahgeorge/jaeger-client-php/blob/70965d835ad523f9b02b557c0c0e9413cd3d3a3d/src/Jaeger/Tracer.php#L144-L212 |
jonahgeorge/jaeger-client-php | src/Jaeger/Tracer.php | Tracer.inject | public function inject(OTSpanContext $spanContext, $format, &$carrier)
{
if ($spanContext instanceof SpanContext) {
$codec = $this->codecs[$format] ?? null;
if ($codec == null) {
throw UnsupportedFormat::forFormat(is_scalar($format) ? $format : gettype($format));
}
$codec->inject($spanContext, $carrier);
return;
}
$message = sprintf(
'Invalid span context. Expected Jaeger\SpanContext, got %s.',
is_object($spanContext) ? get_class($spanContext) : gettype($spanContext)
);
$this->logger->warning($message);
} | php | public function inject(OTSpanContext $spanContext, $format, &$carrier)
{
if ($spanContext instanceof SpanContext) {
$codec = $this->codecs[$format] ?? null;
if ($codec == null) {
throw UnsupportedFormat::forFormat(is_scalar($format) ? $format : gettype($format));
}
$codec->inject($spanContext, $carrier);
return;
}
$message = sprintf(
'Invalid span context. Expected Jaeger\SpanContext, got %s.',
is_object($spanContext) ? get_class($spanContext) : gettype($spanContext)
);
$this->logger->warning($message);
} | [
"public",
"function",
"inject",
"(",
"OTSpanContext",
"$",
"spanContext",
",",
"$",
"format",
",",
"&",
"$",
"carrier",
")",
"{",
"if",
"(",
"$",
"spanContext",
"instanceof",
"SpanContext",
")",
"{",
"$",
"codec",
"=",
"$",
"this",
"->",
"codecs",
"[",
"$",
"format",
"]",
"??",
"null",
";",
"if",
"(",
"$",
"codec",
"==",
"null",
")",
"{",
"throw",
"UnsupportedFormat",
"::",
"forFormat",
"(",
"is_scalar",
"(",
"$",
"format",
")",
"?",
"$",
"format",
":",
"gettype",
"(",
"$",
"format",
")",
")",
";",
"}",
"$",
"codec",
"->",
"inject",
"(",
"$",
"spanContext",
",",
"$",
"carrier",
")",
";",
"return",
";",
"}",
"$",
"message",
"=",
"sprintf",
"(",
"'Invalid span context. Expected Jaeger\\SpanContext, got %s.'",
",",
"is_object",
"(",
"$",
"spanContext",
")",
"?",
"get_class",
"(",
"$",
"spanContext",
")",
":",
"gettype",
"(",
"$",
"spanContext",
")",
")",
";",
"$",
"this",
"->",
"logger",
"->",
"warning",
"(",
"$",
"message",
")",
";",
"}"
] | {@inheritdoc}
@param SpanContext $spanContext
@param string $format
@param mixed $carrier
@return void
@throws UnsupportedFormat | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/jonahgeorge/jaeger-client-php/blob/70965d835ad523f9b02b557c0c0e9413cd3d3a3d/src/Jaeger/Tracer.php#L224-L244 |
jonahgeorge/jaeger-client-php | src/Jaeger/Tracer.php | Tracer.extract | public function extract($format, $carrier)
{
$codec = $this->codecs[$format] ?? null;
if ($codec == null) {
throw UnsupportedFormat::forFormat(is_scalar($format) ? $format : gettype($format));
}
try {
return $codec->extract($carrier);
} catch (\Throwable $e) {
$this->logger->warning($e->getMessage());
return null;
}
} | php | public function extract($format, $carrier)
{
$codec = $this->codecs[$format] ?? null;
if ($codec == null) {
throw UnsupportedFormat::forFormat(is_scalar($format) ? $format : gettype($format));
}
try {
return $codec->extract($carrier);
} catch (\Throwable $e) {
$this->logger->warning($e->getMessage());
return null;
}
} | [
"public",
"function",
"extract",
"(",
"$",
"format",
",",
"$",
"carrier",
")",
"{",
"$",
"codec",
"=",
"$",
"this",
"->",
"codecs",
"[",
"$",
"format",
"]",
"??",
"null",
";",
"if",
"(",
"$",
"codec",
"==",
"null",
")",
"{",
"throw",
"UnsupportedFormat",
"::",
"forFormat",
"(",
"is_scalar",
"(",
"$",
"format",
")",
"?",
"$",
"format",
":",
"gettype",
"(",
"$",
"format",
")",
")",
";",
"}",
"try",
"{",
"return",
"$",
"codec",
"->",
"extract",
"(",
"$",
"carrier",
")",
";",
"}",
"catch",
"(",
"\\",
"Throwable",
"$",
"e",
")",
"{",
"$",
"this",
"->",
"logger",
"->",
"warning",
"(",
"$",
"e",
"->",
"getMessage",
"(",
")",
")",
";",
"return",
"null",
";",
"}",
"}"
] | {@inheritdoc}
@param mixed $carrier
@return SpanContext|null
@throws UnsupportedFormat | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/jonahgeorge/jaeger-client-php/blob/70965d835ad523f9b02b557c0c0e9413cd3d3a3d/src/Jaeger/Tracer.php#L254-L269 |
jonahgeorge/jaeger-client-php | src/Jaeger/Tracer.php | Tracer.getActiveSpan | public function getActiveSpan()
{
$activeScope = $this->getScopeManager()->getActive();
if ($activeScope === null) {
return null;
}
return $activeScope->getSpan();
} | php | public function getActiveSpan()
{
$activeScope = $this->getScopeManager()->getActive();
if ($activeScope === null) {
return null;
}
return $activeScope->getSpan();
} | [
"public",
"function",
"getActiveSpan",
"(",
")",
"{",
"$",
"activeScope",
"=",
"$",
"this",
"->",
"getScopeManager",
"(",
")",
"->",
"getActive",
"(",
")",
";",
"if",
"(",
"$",
"activeScope",
"===",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"$",
"activeScope",
"->",
"getSpan",
"(",
")",
";",
"}"
] | {@inheritdoc} | [
"{"
] | train | https://github.com/jonahgeorge/jaeger-client-php/blob/70965d835ad523f9b02b557c0c0e9413cd3d3a3d/src/Jaeger/Tracer.php#L296-L304 |
jonahgeorge/jaeger-client-php | src/Jaeger/Tracer.php | Tracer.startActiveSpan | public function startActiveSpan($operationName, $options = [])
{
if (!$options instanceof StartSpanOptions) {
$options = StartSpanOptions::create($options);
}
if (!$this->getParentSpanContext($options) && $this->getActiveSpan() !== null) {
$parent = $this->getActiveSpan()->getContext();
$options = $options->withParent($parent);
}
$span = $this->startSpan($operationName, $options);
$scope = $this->scopeManager->activate($span, $options->shouldFinishSpanOnClose());
return $scope;
} | php | public function startActiveSpan($operationName, $options = [])
{
if (!$options instanceof StartSpanOptions) {
$options = StartSpanOptions::create($options);
}
if (!$this->getParentSpanContext($options) && $this->getActiveSpan() !== null) {
$parent = $this->getActiveSpan()->getContext();
$options = $options->withParent($parent);
}
$span = $this->startSpan($operationName, $options);
$scope = $this->scopeManager->activate($span, $options->shouldFinishSpanOnClose());
return $scope;
} | [
"public",
"function",
"startActiveSpan",
"(",
"$",
"operationName",
",",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"$",
"options",
"instanceof",
"StartSpanOptions",
")",
"{",
"$",
"options",
"=",
"StartSpanOptions",
"::",
"create",
"(",
"$",
"options",
")",
";",
"}",
"if",
"(",
"!",
"$",
"this",
"->",
"getParentSpanContext",
"(",
"$",
"options",
")",
"&&",
"$",
"this",
"->",
"getActiveSpan",
"(",
")",
"!==",
"null",
")",
"{",
"$",
"parent",
"=",
"$",
"this",
"->",
"getActiveSpan",
"(",
")",
"->",
"getContext",
"(",
")",
";",
"$",
"options",
"=",
"$",
"options",
"->",
"withParent",
"(",
"$",
"parent",
")",
";",
"}",
"$",
"span",
"=",
"$",
"this",
"->",
"startSpan",
"(",
"$",
"operationName",
",",
"$",
"options",
")",
";",
"$",
"scope",
"=",
"$",
"this",
"->",
"scopeManager",
"->",
"activate",
"(",
"$",
"span",
",",
"$",
"options",
"->",
"shouldFinishSpanOnClose",
"(",
")",
")",
";",
"return",
"$",
"scope",
";",
"}"
] | {@inheritdoc} | [
"{"
] | train | https://github.com/jonahgeorge/jaeger-client-php/blob/70965d835ad523f9b02b557c0c0e9413cd3d3a3d/src/Jaeger/Tracer.php#L309-L324 |
jonahgeorge/jaeger-client-php | src/Jaeger/Util/RateLimiter.php | RateLimiter.initialize | public function initialize(float $creditsPerNanosecond, float $maxBalance)
{
$this->creditsPerNanosecond = $creditsPerNanosecond;
$this->maxBalance = $maxBalance;
} | php | public function initialize(float $creditsPerNanosecond, float $maxBalance)
{
$this->creditsPerNanosecond = $creditsPerNanosecond;
$this->maxBalance = $maxBalance;
} | [
"public",
"function",
"initialize",
"(",
"float",
"$",
"creditsPerNanosecond",
",",
"float",
"$",
"maxBalance",
")",
"{",
"$",
"this",
"->",
"creditsPerNanosecond",
"=",
"$",
"creditsPerNanosecond",
";",
"$",
"this",
"->",
"maxBalance",
"=",
"$",
"maxBalance",
";",
"}"
] | Initializes limiter costs and boundaries
@param float $creditsPerNanosecond
@param float $maxBalance | [
"Initializes",
"limiter",
"costs",
"and",
"boundaries"
] | train | https://github.com/jonahgeorge/jaeger-client-php/blob/70965d835ad523f9b02b557c0c0e9413cd3d3a3d/src/Jaeger/Util/RateLimiter.php#L95-L99 |
jonahgeorge/jaeger-client-php | src/Jaeger/Util/RateLimiter.php | RateLimiter.saveState | private function saveState($lastTick, $balance)
{
$this->lastTick->set($lastTick);
$this->balance->set($balance);
$this->cache->saveDeferred($this->lastTick);
$this->cache->saveDeferred($this->balance);
$this->cache->commit();
} | php | private function saveState($lastTick, $balance)
{
$this->lastTick->set($lastTick);
$this->balance->set($balance);
$this->cache->saveDeferred($this->lastTick);
$this->cache->saveDeferred($this->balance);
$this->cache->commit();
} | [
"private",
"function",
"saveState",
"(",
"$",
"lastTick",
",",
"$",
"balance",
")",
"{",
"$",
"this",
"->",
"lastTick",
"->",
"set",
"(",
"$",
"lastTick",
")",
";",
"$",
"this",
"->",
"balance",
"->",
"set",
"(",
"$",
"balance",
")",
";",
"$",
"this",
"->",
"cache",
"->",
"saveDeferred",
"(",
"$",
"this",
"->",
"lastTick",
")",
";",
"$",
"this",
"->",
"cache",
"->",
"saveDeferred",
"(",
"$",
"this",
"->",
"balance",
")",
";",
"$",
"this",
"->",
"cache",
"->",
"commit",
"(",
")",
";",
"}"
] | Method saves last tick and current balance into cache
@param integer $lastTick
@param float $balance | [
"Method",
"saves",
"last",
"tick",
"and",
"current",
"balance",
"into",
"cache"
] | train | https://github.com/jonahgeorge/jaeger-client-php/blob/70965d835ad523f9b02b557c0c0e9413cd3d3a3d/src/Jaeger/Util/RateLimiter.php#L120-L127 |
jonahgeorge/jaeger-client-php | src/Jaeger/Scope.php | Scope.close | public function close()
{
if ($this->scopeManager->getActive() !== $this) {
// This shouldn't happen if users call methods in expected order
return;
}
if ($this->finishSpanOnClose) {
$this->wrapped->finish();
}
$this->scopeManager->setActive($this->toRestore);
} | php | public function close()
{
if ($this->scopeManager->getActive() !== $this) {
// This shouldn't happen if users call methods in expected order
return;
}
if ($this->finishSpanOnClose) {
$this->wrapped->finish();
}
$this->scopeManager->setActive($this->toRestore);
} | [
"public",
"function",
"close",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"scopeManager",
"->",
"getActive",
"(",
")",
"!==",
"$",
"this",
")",
"{",
"// This shouldn't happen if users call methods in expected order",
"return",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"finishSpanOnClose",
")",
"{",
"$",
"this",
"->",
"wrapped",
"->",
"finish",
"(",
")",
";",
"}",
"$",
"this",
"->",
"scopeManager",
"->",
"setActive",
"(",
"$",
"this",
"->",
"toRestore",
")",
";",
"}"
] | {@inheritdoc} | [
"{"
] | train | https://github.com/jonahgeorge/jaeger-client-php/blob/70965d835ad523f9b02b557c0c0e9413cd3d3a3d/src/Jaeger/Scope.php#L50-L62 |
jonahgeorge/jaeger-client-php | src/Jaeger/Codec/ZipkinCodec.php | ZipkinCodec.inject | public function inject(SpanContext $spanContext, &$carrier)
{
$carrier[self::TRACE_ID_NAME] = dechex($spanContext->getTraceId());
$carrier[self::SPAN_ID_NAME] = dechex($spanContext->getSpanId());
if ($spanContext->getParentId() != null) {
$carrier[self::PARENT_ID_NAME] = dechex($spanContext->getParentId());
}
$carrier[self::FLAGS_NAME] = (int) $spanContext->getFlags();
} | php | public function inject(SpanContext $spanContext, &$carrier)
{
$carrier[self::TRACE_ID_NAME] = dechex($spanContext->getTraceId());
$carrier[self::SPAN_ID_NAME] = dechex($spanContext->getSpanId());
if ($spanContext->getParentId() != null) {
$carrier[self::PARENT_ID_NAME] = dechex($spanContext->getParentId());
}
$carrier[self::FLAGS_NAME] = (int) $spanContext->getFlags();
} | [
"public",
"function",
"inject",
"(",
"SpanContext",
"$",
"spanContext",
",",
"&",
"$",
"carrier",
")",
"{",
"$",
"carrier",
"[",
"self",
"::",
"TRACE_ID_NAME",
"]",
"=",
"dechex",
"(",
"$",
"spanContext",
"->",
"getTraceId",
"(",
")",
")",
";",
"$",
"carrier",
"[",
"self",
"::",
"SPAN_ID_NAME",
"]",
"=",
"dechex",
"(",
"$",
"spanContext",
"->",
"getSpanId",
"(",
")",
")",
";",
"if",
"(",
"$",
"spanContext",
"->",
"getParentId",
"(",
")",
"!=",
"null",
")",
"{",
"$",
"carrier",
"[",
"self",
"::",
"PARENT_ID_NAME",
"]",
"=",
"dechex",
"(",
"$",
"spanContext",
"->",
"getParentId",
"(",
")",
")",
";",
"}",
"$",
"carrier",
"[",
"self",
"::",
"FLAGS_NAME",
"]",
"=",
"(",
"int",
")",
"$",
"spanContext",
"->",
"getFlags",
"(",
")",
";",
"}"
] | {@inheritdoc}
@see \Jaeger\Tracer::inject
@param SpanContext $spanContext
@param mixed $carrier
@return void | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/jonahgeorge/jaeger-client-php/blob/70965d835ad523f9b02b557c0c0e9413cd3d3a3d/src/Jaeger/Codec/ZipkinCodec.php#L30-L38 |
jonahgeorge/jaeger-client-php | src/Jaeger/Codec/ZipkinCodec.php | ZipkinCodec.extract | public function extract($carrier)
{
$traceId = "0";
$spanId = "0";
$parentId = "0";
$flags = 0;
if (isset($carrier[strtolower(self::SAMPLED_NAME)])) {
if ($carrier[strtolower(self::SAMPLED_NAME)] === "1" ||
strtolower($carrier[strtolower(self::SAMPLED_NAME)] === "true")
) {
$flags = $flags | SAMPLED_FLAG;
}
}
if (isset($carrier[strtolower(self::TRACE_ID_NAME)])) {
$traceId = CodecUtility::hexToInt64($carrier[strtolower(self::TRACE_ID_NAME)], 16, 10);
}
if (isset($carrier[strtolower(self::PARENT_ID_NAME)])) {
$parentId = CodecUtility::hexToInt64($carrier[strtolower(self::PARENT_ID_NAME)], 16, 10);
}
if (isset($carrier[strtolower(self::SPAN_ID_NAME)])) {
$spanId = CodecUtility::hexToInt64($carrier[strtolower(self::SPAN_ID_NAME)], 16, 10);
}
if (isset($carrier[strtolower(self::FLAGS_NAME)])) {
if ($carrier[strtolower(self::FLAGS_NAME)] === "1") {
$flags = $flags | DEBUG_FLAG;
}
}
if ($traceId != "0" && $spanId != "0") {
return new SpanContext($traceId, $spanId, $parentId, $flags);
}
return null;
} | php | public function extract($carrier)
{
$traceId = "0";
$spanId = "0";
$parentId = "0";
$flags = 0;
if (isset($carrier[strtolower(self::SAMPLED_NAME)])) {
if ($carrier[strtolower(self::SAMPLED_NAME)] === "1" ||
strtolower($carrier[strtolower(self::SAMPLED_NAME)] === "true")
) {
$flags = $flags | SAMPLED_FLAG;
}
}
if (isset($carrier[strtolower(self::TRACE_ID_NAME)])) {
$traceId = CodecUtility::hexToInt64($carrier[strtolower(self::TRACE_ID_NAME)], 16, 10);
}
if (isset($carrier[strtolower(self::PARENT_ID_NAME)])) {
$parentId = CodecUtility::hexToInt64($carrier[strtolower(self::PARENT_ID_NAME)], 16, 10);
}
if (isset($carrier[strtolower(self::SPAN_ID_NAME)])) {
$spanId = CodecUtility::hexToInt64($carrier[strtolower(self::SPAN_ID_NAME)], 16, 10);
}
if (isset($carrier[strtolower(self::FLAGS_NAME)])) {
if ($carrier[strtolower(self::FLAGS_NAME)] === "1") {
$flags = $flags | DEBUG_FLAG;
}
}
if ($traceId != "0" && $spanId != "0") {
return new SpanContext($traceId, $spanId, $parentId, $flags);
}
return null;
} | [
"public",
"function",
"extract",
"(",
"$",
"carrier",
")",
"{",
"$",
"traceId",
"=",
"\"0\"",
";",
"$",
"spanId",
"=",
"\"0\"",
";",
"$",
"parentId",
"=",
"\"0\"",
";",
"$",
"flags",
"=",
"0",
";",
"if",
"(",
"isset",
"(",
"$",
"carrier",
"[",
"strtolower",
"(",
"self",
"::",
"SAMPLED_NAME",
")",
"]",
")",
")",
"{",
"if",
"(",
"$",
"carrier",
"[",
"strtolower",
"(",
"self",
"::",
"SAMPLED_NAME",
")",
"]",
"===",
"\"1\"",
"||",
"strtolower",
"(",
"$",
"carrier",
"[",
"strtolower",
"(",
"self",
"::",
"SAMPLED_NAME",
")",
"]",
"===",
"\"true\"",
")",
")",
"{",
"$",
"flags",
"=",
"$",
"flags",
"|",
"SAMPLED_FLAG",
";",
"}",
"}",
"if",
"(",
"isset",
"(",
"$",
"carrier",
"[",
"strtolower",
"(",
"self",
"::",
"TRACE_ID_NAME",
")",
"]",
")",
")",
"{",
"$",
"traceId",
"=",
"CodecUtility",
"::",
"hexToInt64",
"(",
"$",
"carrier",
"[",
"strtolower",
"(",
"self",
"::",
"TRACE_ID_NAME",
")",
"]",
",",
"16",
",",
"10",
")",
";",
"}",
"if",
"(",
"isset",
"(",
"$",
"carrier",
"[",
"strtolower",
"(",
"self",
"::",
"PARENT_ID_NAME",
")",
"]",
")",
")",
"{",
"$",
"parentId",
"=",
"CodecUtility",
"::",
"hexToInt64",
"(",
"$",
"carrier",
"[",
"strtolower",
"(",
"self",
"::",
"PARENT_ID_NAME",
")",
"]",
",",
"16",
",",
"10",
")",
";",
"}",
"if",
"(",
"isset",
"(",
"$",
"carrier",
"[",
"strtolower",
"(",
"self",
"::",
"SPAN_ID_NAME",
")",
"]",
")",
")",
"{",
"$",
"spanId",
"=",
"CodecUtility",
"::",
"hexToInt64",
"(",
"$",
"carrier",
"[",
"strtolower",
"(",
"self",
"::",
"SPAN_ID_NAME",
")",
"]",
",",
"16",
",",
"10",
")",
";",
"}",
"if",
"(",
"isset",
"(",
"$",
"carrier",
"[",
"strtolower",
"(",
"self",
"::",
"FLAGS_NAME",
")",
"]",
")",
")",
"{",
"if",
"(",
"$",
"carrier",
"[",
"strtolower",
"(",
"self",
"::",
"FLAGS_NAME",
")",
"]",
"===",
"\"1\"",
")",
"{",
"$",
"flags",
"=",
"$",
"flags",
"|",
"DEBUG_FLAG",
";",
"}",
"}",
"if",
"(",
"$",
"traceId",
"!=",
"\"0\"",
"&&",
"$",
"spanId",
"!=",
"\"0\"",
")",
"{",
"return",
"new",
"SpanContext",
"(",
"$",
"traceId",
",",
"$",
"spanId",
",",
"$",
"parentId",
",",
"$",
"flags",
")",
";",
"}",
"return",
"null",
";",
"}"
] | {@inheritdoc}
@see \Jaeger\Tracer::extract
@param mixed $carrier
@return SpanContext|null | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/jonahgeorge/jaeger-client-php/blob/70965d835ad523f9b02b557c0c0e9413cd3d3a3d/src/Jaeger/Codec/ZipkinCodec.php#L48-L86 |
jonahgeorge/jaeger-client-php | src/Jaeger/ScopeManager.php | ScopeManager.activate | public function activate(OTSpan $span, $finishSpanOnClose)
{
$this->active = new Scope($this, $span, $finishSpanOnClose);
return $this->active;
} | php | public function activate(OTSpan $span, $finishSpanOnClose)
{
$this->active = new Scope($this, $span, $finishSpanOnClose);
return $this->active;
} | [
"public",
"function",
"activate",
"(",
"OTSpan",
"$",
"span",
",",
"$",
"finishSpanOnClose",
")",
"{",
"$",
"this",
"->",
"active",
"=",
"new",
"Scope",
"(",
"$",
"this",
",",
"$",
"span",
",",
"$",
"finishSpanOnClose",
")",
";",
"return",
"$",
"this",
"->",
"active",
";",
"}"
] | {@inheritdoc} | [
"{"
] | train | https://github.com/jonahgeorge/jaeger-client-php/blob/70965d835ad523f9b02b557c0c0e9413cd3d3a3d/src/Jaeger/ScopeManager.php#L22-L27 |
jonahgeorge/jaeger-client-php | src/Jaeger/Span.php | Span.microTime | protected function microTime($time): int
{
if ($time === null) {
return $this->timestampMicro();
}
if ($time instanceof \DateTimeInterface) {
return (int)round($time->format('U.u') * 1000000, 0);
}
if (is_int($time)) {
return $time;
}
if (is_float($time)) {
return (int)round($time * 1000000, 0);
}
throw new \InvalidArgumentException(sprintf(
'Time should be one of the types int|float|DateTime|null, got %s.',
gettype($time)
));
} | php | protected function microTime($time): int
{
if ($time === null) {
return $this->timestampMicro();
}
if ($time instanceof \DateTimeInterface) {
return (int)round($time->format('U.u') * 1000000, 0);
}
if (is_int($time)) {
return $time;
}
if (is_float($time)) {
return (int)round($time * 1000000, 0);
}
throw new \InvalidArgumentException(sprintf(
'Time should be one of the types int|float|DateTime|null, got %s.',
gettype($time)
));
} | [
"protected",
"function",
"microTime",
"(",
"$",
"time",
")",
":",
"int",
"{",
"if",
"(",
"$",
"time",
"===",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"timestampMicro",
"(",
")",
";",
"}",
"if",
"(",
"$",
"time",
"instanceof",
"\\",
"DateTimeInterface",
")",
"{",
"return",
"(",
"int",
")",
"round",
"(",
"$",
"time",
"->",
"format",
"(",
"'U.u'",
")",
"*",
"1000000",
",",
"0",
")",
";",
"}",
"if",
"(",
"is_int",
"(",
"$",
"time",
")",
")",
"{",
"return",
"$",
"time",
";",
"}",
"if",
"(",
"is_float",
"(",
"$",
"time",
")",
")",
"{",
"return",
"(",
"int",
")",
"round",
"(",
"$",
"time",
"*",
"1000000",
",",
"0",
")",
";",
"}",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"sprintf",
"(",
"'Time should be one of the types int|float|DateTime|null, got %s.'",
",",
"gettype",
"(",
"$",
"time",
")",
")",
")",
";",
"}"
] | Converts time to microtime int
- int represents microseconds
- float represents seconds
@param int|float|DateTime|null $time
@return int | [
"Converts",
"time",
"to",
"microtime",
"int",
"-",
"int",
"represents",
"microseconds",
"-",
"float",
"represents",
"seconds"
] | train | https://github.com/jonahgeorge/jaeger-client-php/blob/70965d835ad523f9b02b557c0c0e9413cd3d3a3d/src/Jaeger/Span.php#L115-L137 |
jonahgeorge/jaeger-client-php | src/Jaeger/Span.php | Span.finish | public function finish($finishTime = null, array $logRecords = [])
{
if (!$this->isSampled()) {
return;
}
foreach ($logRecords as $logRecord) {
$this->log($logRecord);
}
$this->endTime = $this->microTime($finishTime);
$this->tracer->reportSpan($this);
} | php | public function finish($finishTime = null, array $logRecords = [])
{
if (!$this->isSampled()) {
return;
}
foreach ($logRecords as $logRecord) {
$this->log($logRecord);
}
$this->endTime = $this->microTime($finishTime);
$this->tracer->reportSpan($this);
} | [
"public",
"function",
"finish",
"(",
"$",
"finishTime",
"=",
"null",
",",
"array",
"$",
"logRecords",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isSampled",
"(",
")",
")",
"{",
"return",
";",
"}",
"foreach",
"(",
"$",
"logRecords",
"as",
"$",
"logRecord",
")",
"{",
"$",
"this",
"->",
"log",
"(",
"$",
"logRecord",
")",
";",
"}",
"$",
"this",
"->",
"endTime",
"=",
"$",
"this",
"->",
"microTime",
"(",
"$",
"finishTime",
")",
";",
"$",
"this",
"->",
"tracer",
"->",
"reportSpan",
"(",
"$",
"this",
")",
";",
"}"
] | {@inheritdoc} | [
"{"
] | train | https://github.com/jonahgeorge/jaeger-client-php/blob/70965d835ad523f9b02b557c0c0e9413cd3d3a3d/src/Jaeger/Span.php#L201-L213 |
jonahgeorge/jaeger-client-php | src/Jaeger/Span.php | Span.setTags | public function setTags($tags)
{
foreach ($tags as $key => $value) {
$this->setTag($key, $value);
}
} | php | public function setTags($tags)
{
foreach ($tags as $key => $value) {
$this->setTag($key, $value);
}
} | [
"public",
"function",
"setTags",
"(",
"$",
"tags",
")",
"{",
"foreach",
"(",
"$",
"tags",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"setTag",
"(",
"$",
"key",
",",
"$",
"value",
")",
";",
"}",
"}"
] | {@inheritdoc}
@param array $tags
@return void | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/jonahgeorge/jaeger-client-php/blob/70965d835ad523f9b02b557c0c0e9413cd3d3a3d/src/Jaeger/Span.php#L242-L247 |
jonahgeorge/jaeger-client-php | src/Jaeger/Span.php | Span.setTag | public function setTag($key, $value)
{
if ($this->isSampled()) {
$special = self::SPECIAL_TAGS[$key] ?? null;
$handled = false;
if ($special !== null && is_callable([$this, $special])) {
$handled = $this->$special($value);
}
if (!$handled) {
$tag = $this->makeStringTag($key, (string) $value);
$this->tags[$key] = $tag;
}
}
return $this;
} | php | public function setTag($key, $value)
{
if ($this->isSampled()) {
$special = self::SPECIAL_TAGS[$key] ?? null;
$handled = false;
if ($special !== null && is_callable([$this, $special])) {
$handled = $this->$special($value);
}
if (!$handled) {
$tag = $this->makeStringTag($key, (string) $value);
$this->tags[$key] = $tag;
}
}
return $this;
} | [
"public",
"function",
"setTag",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isSampled",
"(",
")",
")",
"{",
"$",
"special",
"=",
"self",
"::",
"SPECIAL_TAGS",
"[",
"$",
"key",
"]",
"??",
"null",
";",
"$",
"handled",
"=",
"false",
";",
"if",
"(",
"$",
"special",
"!==",
"null",
"&&",
"is_callable",
"(",
"[",
"$",
"this",
",",
"$",
"special",
"]",
")",
")",
"{",
"$",
"handled",
"=",
"$",
"this",
"->",
"$",
"special",
"(",
"$",
"value",
")",
";",
"}",
"if",
"(",
"!",
"$",
"handled",
")",
"{",
"$",
"tag",
"=",
"$",
"this",
"->",
"makeStringTag",
"(",
"$",
"key",
",",
"(",
"string",
")",
"$",
"value",
")",
";",
"$",
"this",
"->",
"tags",
"[",
"$",
"key",
"]",
"=",
"$",
"tag",
";",
"}",
"}",
"return",
"$",
"this",
";",
"}"
] | {@inheritdoc} | [
"{"
] | train | https://github.com/jonahgeorge/jaeger-client-php/blob/70965d835ad523f9b02b557c0c0e9413cd3d3a3d/src/Jaeger/Span.php#L252-L269 |
jonahgeorge/jaeger-client-php | src/Jaeger/Span.php | Span.log | public function log(array $fields = [], $timestamp = null)
{
$timestamp = $this->microTime($timestamp);
if ($timestamp < $this->getStartTime()) {
$timestamp = $this->timestampMicro();
}
$this->logs[] = [
'fields' => $fields,
'timestamp' => $timestamp,
];
} | php | public function log(array $fields = [], $timestamp = null)
{
$timestamp = $this->microTime($timestamp);
if ($timestamp < $this->getStartTime()) {
$timestamp = $this->timestampMicro();
}
$this->logs[] = [
'fields' => $fields,
'timestamp' => $timestamp,
];
} | [
"public",
"function",
"log",
"(",
"array",
"$",
"fields",
"=",
"[",
"]",
",",
"$",
"timestamp",
"=",
"null",
")",
"{",
"$",
"timestamp",
"=",
"$",
"this",
"->",
"microTime",
"(",
"$",
"timestamp",
")",
";",
"if",
"(",
"$",
"timestamp",
"<",
"$",
"this",
"->",
"getStartTime",
"(",
")",
")",
"{",
"$",
"timestamp",
"=",
"$",
"this",
"->",
"timestampMicro",
"(",
")",
";",
"}",
"$",
"this",
"->",
"logs",
"[",
"]",
"=",
"[",
"'fields'",
"=>",
"$",
"fields",
",",
"'timestamp'",
"=>",
"$",
"timestamp",
",",
"]",
";",
"}"
] | {@inheritdoc} | [
"{"
] | train | https://github.com/jonahgeorge/jaeger-client-php/blob/70965d835ad523f9b02b557c0c0e9413cd3d3a3d/src/Jaeger/Span.php#L364-L375 |
jonahgeorge/jaeger-client-php | src/Jaeger/Sampler/RateLimitingSampler.php | RateLimitingSampler.isSampled | public function isSampled(string $traceId = '', string $operation = '')
{
return [$this->rateLimiter->checkCredit(1.0), $this->tags];
} | php | public function isSampled(string $traceId = '', string $operation = '')
{
return [$this->rateLimiter->checkCredit(1.0), $this->tags];
} | [
"public",
"function",
"isSampled",
"(",
"string",
"$",
"traceId",
"=",
"''",
",",
"string",
"$",
"operation",
"=",
"''",
")",
"{",
"return",
"[",
"$",
"this",
"->",
"rateLimiter",
"->",
"checkCredit",
"(",
"1.0",
")",
",",
"$",
"this",
"->",
"tags",
"]",
";",
"}"
] | Whether or not the new trace should be sampled.
Implementations should return an array in the format [$decision, $tags].
@param string $traceId The traceId on the span.
@param string $operation The operation name set on the span.
@return array | [
"Whether",
"or",
"not",
"the",
"new",
"trace",
"should",
"be",
"sampled",
"."
] | train | https://github.com/jonahgeorge/jaeger-client-php/blob/70965d835ad523f9b02b557c0c0e9413cd3d3a3d/src/Jaeger/Sampler/RateLimitingSampler.php#L46-L49 |
jonahgeorge/jaeger-client-php | src/Jaeger/ThriftUdpTransport.php | ThriftUdpTransport.open | public function open()
{
$ok = @socket_connect($this->socket, $this->host, $this->port);
if ($ok === false) {
throw new TTransportException('socket_connect failed');
}
} | php | public function open()
{
$ok = @socket_connect($this->socket, $this->host, $this->port);
if ($ok === false) {
throw new TTransportException('socket_connect failed');
}
} | [
"public",
"function",
"open",
"(",
")",
"{",
"$",
"ok",
"=",
"@",
"socket_connect",
"(",
"$",
"this",
"->",
"socket",
",",
"$",
"this",
"->",
"host",
",",
"$",
"this",
"->",
"port",
")",
";",
"if",
"(",
"$",
"ok",
"===",
"false",
")",
"{",
"throw",
"new",
"TTransportException",
"(",
"'socket_connect failed'",
")",
";",
"}",
"}"
] | Open the transport for reading/writing
@throws TTransportException if cannot open | [
"Open",
"the",
"transport",
"for",
"reading",
"/",
"writing"
] | train | https://github.com/jonahgeorge/jaeger-client-php/blob/70965d835ad523f9b02b557c0c0e9413cd3d3a3d/src/Jaeger/ThriftUdpTransport.php#L58-L64 |
jonahgeorge/jaeger-client-php | src/Jaeger/ThriftUdpTransport.php | ThriftUdpTransport.write | public function write($buf)
{
if (!$this->isOpen()) {
throw new TTransportException('transport is closed');
}
$ok = @socket_write($this->socket, $buf);
if ($ok === false) {
throw new TTransportException('socket_write failed');
}
} | php | public function write($buf)
{
if (!$this->isOpen()) {
throw new TTransportException('transport is closed');
}
$ok = @socket_write($this->socket, $buf);
if ($ok === false) {
throw new TTransportException('socket_write failed');
}
} | [
"public",
"function",
"write",
"(",
"$",
"buf",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isOpen",
"(",
")",
")",
"{",
"throw",
"new",
"TTransportException",
"(",
"'transport is closed'",
")",
";",
"}",
"$",
"ok",
"=",
"@",
"socket_write",
"(",
"$",
"this",
"->",
"socket",
",",
"$",
"buf",
")",
";",
"if",
"(",
"$",
"ok",
"===",
"false",
")",
"{",
"throw",
"new",
"TTransportException",
"(",
"'socket_write failed'",
")",
";",
"}",
"}"
] | Writes the given data out.
@param string $buf The data to write
@throws TTransportException if writing fails | [
"Writes",
"the",
"given",
"data",
"out",
"."
] | train | https://github.com/jonahgeorge/jaeger-client-php/blob/70965d835ad523f9b02b557c0c0e9413cd3d3a3d/src/Jaeger/ThriftUdpTransport.php#L93-L103 |
jonahgeorge/jaeger-client-php | src/Jaeger/Codec/TextCodec.php | TextCodec.inject | public function inject(SpanContext $spanContext, &$carrier)
{
$carrier[$this->traceIdHeader] = $this->spanContextToString(
$spanContext->getTraceId(),
$spanContext->getSpanId(),
$spanContext->getParentId(),
$spanContext->getFlags()
);
$baggage = $spanContext->getBaggage();
if (empty($baggage)) {
return;
}
foreach ($baggage as $key => $value) {
$encodedValue = $value;
if ($this->urlEncoding) {
$encodedValue = urlencode($value);
}
$carrier[$this->baggagePrefix . $key] = $encodedValue;
}
} | php | public function inject(SpanContext $spanContext, &$carrier)
{
$carrier[$this->traceIdHeader] = $this->spanContextToString(
$spanContext->getTraceId(),
$spanContext->getSpanId(),
$spanContext->getParentId(),
$spanContext->getFlags()
);
$baggage = $spanContext->getBaggage();
if (empty($baggage)) {
return;
}
foreach ($baggage as $key => $value) {
$encodedValue = $value;
if ($this->urlEncoding) {
$encodedValue = urlencode($value);
}
$carrier[$this->baggagePrefix . $key] = $encodedValue;
}
} | [
"public",
"function",
"inject",
"(",
"SpanContext",
"$",
"spanContext",
",",
"&",
"$",
"carrier",
")",
"{",
"$",
"carrier",
"[",
"$",
"this",
"->",
"traceIdHeader",
"]",
"=",
"$",
"this",
"->",
"spanContextToString",
"(",
"$",
"spanContext",
"->",
"getTraceId",
"(",
")",
",",
"$",
"spanContext",
"->",
"getSpanId",
"(",
")",
",",
"$",
"spanContext",
"->",
"getParentId",
"(",
")",
",",
"$",
"spanContext",
"->",
"getFlags",
"(",
")",
")",
";",
"$",
"baggage",
"=",
"$",
"spanContext",
"->",
"getBaggage",
"(",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"baggage",
")",
")",
"{",
"return",
";",
"}",
"foreach",
"(",
"$",
"baggage",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"encodedValue",
"=",
"$",
"value",
";",
"if",
"(",
"$",
"this",
"->",
"urlEncoding",
")",
"{",
"$",
"encodedValue",
"=",
"urlencode",
"(",
"$",
"value",
")",
";",
"}",
"$",
"carrier",
"[",
"$",
"this",
"->",
"baggagePrefix",
".",
"$",
"key",
"]",
"=",
"$",
"encodedValue",
";",
"}",
"}"
] | {@inheritdoc}
@see \Jaeger\Tracer::inject
@param SpanContext $spanContext
@param mixed $carrier
@return void | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/jonahgeorge/jaeger-client-php/blob/70965d835ad523f9b02b557c0c0e9413cd3d3a3d/src/Jaeger/Codec/TextCodec.php#L51-L74 |
jonahgeorge/jaeger-client-php | src/Jaeger/Codec/TextCodec.php | TextCodec.extract | public function extract($carrier)
{
$traceId = null;
$spanId = null;
$parentId = null;
$flags = null;
$baggage = null;
$debugId = null;
foreach ($carrier as $key => $value) {
$ucKey = strtolower($key);
if ($ucKey === $this->traceIdHeader) {
if ($this->urlEncoding) {
$value = urldecode($value);
}
list($traceId, $spanId, $parentId, $flags) =
$this->spanContextFromString($value);
} elseif ($this->startsWith($ucKey, $this->baggagePrefix)) {
if ($this->urlEncoding) {
$value = urldecode($value);
}
$attrKey = substr($key, $this->prefixLength);
if ($baggage === null) {
$baggage = [strtolower($attrKey) => $value];
} else {
$baggage[strtolower($attrKey)] = $value;
}
} elseif ($ucKey === $this->debugIdHeader) {
if ($this->urlEncoding) {
$value = urldecode($value);
}
$debugId = $value;
}
}
if ($traceId === null && $baggage !== null) {
throw new Exception('baggage without trace ctx');
}
if ($traceId === null) {
if ($debugId !== null) {
return new SpanContext(null, null, null, null, [], $debugId);
}
return null;
}
return new SpanContext($traceId, $spanId, $parentId, $flags, $baggage);
} | php | public function extract($carrier)
{
$traceId = null;
$spanId = null;
$parentId = null;
$flags = null;
$baggage = null;
$debugId = null;
foreach ($carrier as $key => $value) {
$ucKey = strtolower($key);
if ($ucKey === $this->traceIdHeader) {
if ($this->urlEncoding) {
$value = urldecode($value);
}
list($traceId, $spanId, $parentId, $flags) =
$this->spanContextFromString($value);
} elseif ($this->startsWith($ucKey, $this->baggagePrefix)) {
if ($this->urlEncoding) {
$value = urldecode($value);
}
$attrKey = substr($key, $this->prefixLength);
if ($baggage === null) {
$baggage = [strtolower($attrKey) => $value];
} else {
$baggage[strtolower($attrKey)] = $value;
}
} elseif ($ucKey === $this->debugIdHeader) {
if ($this->urlEncoding) {
$value = urldecode($value);
}
$debugId = $value;
}
}
if ($traceId === null && $baggage !== null) {
throw new Exception('baggage without trace ctx');
}
if ($traceId === null) {
if ($debugId !== null) {
return new SpanContext(null, null, null, null, [], $debugId);
}
return null;
}
return new SpanContext($traceId, $spanId, $parentId, $flags, $baggage);
} | [
"public",
"function",
"extract",
"(",
"$",
"carrier",
")",
"{",
"$",
"traceId",
"=",
"null",
";",
"$",
"spanId",
"=",
"null",
";",
"$",
"parentId",
"=",
"null",
";",
"$",
"flags",
"=",
"null",
";",
"$",
"baggage",
"=",
"null",
";",
"$",
"debugId",
"=",
"null",
";",
"foreach",
"(",
"$",
"carrier",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"ucKey",
"=",
"strtolower",
"(",
"$",
"key",
")",
";",
"if",
"(",
"$",
"ucKey",
"===",
"$",
"this",
"->",
"traceIdHeader",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"urlEncoding",
")",
"{",
"$",
"value",
"=",
"urldecode",
"(",
"$",
"value",
")",
";",
"}",
"list",
"(",
"$",
"traceId",
",",
"$",
"spanId",
",",
"$",
"parentId",
",",
"$",
"flags",
")",
"=",
"$",
"this",
"->",
"spanContextFromString",
"(",
"$",
"value",
")",
";",
"}",
"elseif",
"(",
"$",
"this",
"->",
"startsWith",
"(",
"$",
"ucKey",
",",
"$",
"this",
"->",
"baggagePrefix",
")",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"urlEncoding",
")",
"{",
"$",
"value",
"=",
"urldecode",
"(",
"$",
"value",
")",
";",
"}",
"$",
"attrKey",
"=",
"substr",
"(",
"$",
"key",
",",
"$",
"this",
"->",
"prefixLength",
")",
";",
"if",
"(",
"$",
"baggage",
"===",
"null",
")",
"{",
"$",
"baggage",
"=",
"[",
"strtolower",
"(",
"$",
"attrKey",
")",
"=>",
"$",
"value",
"]",
";",
"}",
"else",
"{",
"$",
"baggage",
"[",
"strtolower",
"(",
"$",
"attrKey",
")",
"]",
"=",
"$",
"value",
";",
"}",
"}",
"elseif",
"(",
"$",
"ucKey",
"===",
"$",
"this",
"->",
"debugIdHeader",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"urlEncoding",
")",
"{",
"$",
"value",
"=",
"urldecode",
"(",
"$",
"value",
")",
";",
"}",
"$",
"debugId",
"=",
"$",
"value",
";",
"}",
"}",
"if",
"(",
"$",
"traceId",
"===",
"null",
"&&",
"$",
"baggage",
"!==",
"null",
")",
"{",
"throw",
"new",
"Exception",
"(",
"'baggage without trace ctx'",
")",
";",
"}",
"if",
"(",
"$",
"traceId",
"===",
"null",
")",
"{",
"if",
"(",
"$",
"debugId",
"!==",
"null",
")",
"{",
"return",
"new",
"SpanContext",
"(",
"null",
",",
"null",
",",
"null",
",",
"null",
",",
"[",
"]",
",",
"$",
"debugId",
")",
";",
"}",
"return",
"null",
";",
"}",
"return",
"new",
"SpanContext",
"(",
"$",
"traceId",
",",
"$",
"spanId",
",",
"$",
"parentId",
",",
"$",
"flags",
",",
"$",
"baggage",
")",
";",
"}"
] | {@inheritdoc}
@see \Jaeger\Tracer::extract
@param mixed $carrier
@return SpanContext|null
@throws Exception | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/jonahgeorge/jaeger-client-php/blob/70965d835ad523f9b02b557c0c0e9413cd3d3a3d/src/Jaeger/Codec/TextCodec.php#L86-L134 |
jonahgeorge/jaeger-client-php | src/Jaeger/Codec/TextCodec.php | TextCodec.spanContextToString | private function spanContextToString($traceId, $spanId, $parentId, $flags)
{
$parentId = $parentId ?? 0;
return sprintf('%x:%x:%x:%x', $traceId, $spanId, $parentId, $flags);
} | php | private function spanContextToString($traceId, $spanId, $parentId, $flags)
{
$parentId = $parentId ?? 0;
return sprintf('%x:%x:%x:%x', $traceId, $spanId, $parentId, $flags);
} | [
"private",
"function",
"spanContextToString",
"(",
"$",
"traceId",
",",
"$",
"spanId",
",",
"$",
"parentId",
",",
"$",
"flags",
")",
"{",
"$",
"parentId",
"=",
"$",
"parentId",
"??",
"0",
";",
"return",
"sprintf",
"(",
"'%x:%x:%x:%x'",
",",
"$",
"traceId",
",",
"$",
"spanId",
",",
"$",
"parentId",
",",
"$",
"flags",
")",
";",
"}"
] | Store a span context to a string.
@param int $traceId
@param int $spanId
@param int $parentId
@param int $flags
@return string | [
"Store",
"a",
"span",
"context",
"to",
"a",
"string",
"."
] | train | https://github.com/jonahgeorge/jaeger-client-php/blob/70965d835ad523f9b02b557c0c0e9413cd3d3a3d/src/Jaeger/Codec/TextCodec.php#L145-L149 |
jonahgeorge/jaeger-client-php | src/Jaeger/Codec/TextCodec.php | TextCodec.spanContextFromString | private function spanContextFromString($value): array
{
$parts = explode(':', $value);
if (count($parts) != 4) {
throw new Exception('Malformed tracer state string.');
}
return [
CodecUtility::hexToInt64($parts[0]),
CodecUtility::hexToInt64($parts[1]),
CodecUtility::hexToInt64($parts[2]),
$parts[3],
];
} | php | private function spanContextFromString($value): array
{
$parts = explode(':', $value);
if (count($parts) != 4) {
throw new Exception('Malformed tracer state string.');
}
return [
CodecUtility::hexToInt64($parts[0]),
CodecUtility::hexToInt64($parts[1]),
CodecUtility::hexToInt64($parts[2]),
$parts[3],
];
} | [
"private",
"function",
"spanContextFromString",
"(",
"$",
"value",
")",
":",
"array",
"{",
"$",
"parts",
"=",
"explode",
"(",
"':'",
",",
"$",
"value",
")",
";",
"if",
"(",
"count",
"(",
"$",
"parts",
")",
"!=",
"4",
")",
"{",
"throw",
"new",
"Exception",
"(",
"'Malformed tracer state string.'",
")",
";",
"}",
"return",
"[",
"CodecUtility",
"::",
"hexToInt64",
"(",
"$",
"parts",
"[",
"0",
"]",
")",
",",
"CodecUtility",
"::",
"hexToInt64",
"(",
"$",
"parts",
"[",
"1",
"]",
")",
",",
"CodecUtility",
"::",
"hexToInt64",
"(",
"$",
"parts",
"[",
"2",
"]",
")",
",",
"$",
"parts",
"[",
"3",
"]",
",",
"]",
";",
"}"
] | Create a span context from a string.
@param string $value
@return array
@throws Exception | [
"Create",
"a",
"span",
"context",
"from",
"a",
"string",
"."
] | train | https://github.com/jonahgeorge/jaeger-client-php/blob/70965d835ad523f9b02b557c0c0e9413cd3d3a3d/src/Jaeger/Codec/TextCodec.php#L159-L173 |
jonahgeorge/jaeger-client-php | src/Jaeger/Sampler/ProbabilisticSampler.php | ProbabilisticSampler.isSampled | public function isSampled(string $traceId, string $operation = ''): array
{
return [($traceId < $this->boundary), $this->tags];
} | php | public function isSampled(string $traceId, string $operation = ''): array
{
return [($traceId < $this->boundary), $this->tags];
} | [
"public",
"function",
"isSampled",
"(",
"string",
"$",
"traceId",
",",
"string",
"$",
"operation",
"=",
"''",
")",
":",
"array",
"{",
"return",
"[",
"(",
"$",
"traceId",
"<",
"$",
"this",
"->",
"boundary",
")",
",",
"$",
"this",
"->",
"tags",
"]",
";",
"}"
] | {@inheritdoc}
@param string $traceId The traceId on the span.
@param string $operation The operation name set on the span.
@return array | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/jonahgeorge/jaeger-client-php/blob/70965d835ad523f9b02b557c0c0e9413cd3d3a3d/src/Jaeger/Sampler/ProbabilisticSampler.php#L72-L75 |
jonahgeorge/jaeger-client-php | src/Jaeger/Sender/UdpSender.php | UdpSender.send | private function send(array $thrifts)
{
foreach ($this->chunkSplit($thrifts) as $chunk) {
/* @var $chunk ThriftSpan[] */
$this->client->emitZipkinBatch($chunk);
}
} | php | private function send(array $thrifts)
{
foreach ($this->chunkSplit($thrifts) as $chunk) {
/* @var $chunk ThriftSpan[] */
$this->client->emitZipkinBatch($chunk);
}
} | [
"private",
"function",
"send",
"(",
"array",
"$",
"thrifts",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"chunkSplit",
"(",
"$",
"thrifts",
")",
"as",
"$",
"chunk",
")",
"{",
"/* @var $chunk ThriftSpan[] */",
"$",
"this",
"->",
"client",
"->",
"emitZipkinBatch",
"(",
"$",
"chunk",
")",
";",
"}",
"}"
] | Emits the thrift-objects.
@param array|ThriftSpan[]|TBase[] $thrifts | [
"Emits",
"the",
"thrift",
"-",
"objects",
"."
] | train | https://github.com/jonahgeorge/jaeger-client-php/blob/70965d835ad523f9b02b557c0c0e9413cd3d3a3d/src/Jaeger/Sender/UdpSender.php#L112-L118 |
jonahgeorge/jaeger-client-php | src/Jaeger/Sender/UdpSender.php | UdpSender.makePeerAddressTag | private function makePeerAddressTag(string $key, Endpoint $host): BinaryAnnotation
{
return new BinaryAnnotation([
"key" => $key,
"value" => '0x01',
"annotation_type" => AnnotationType::BOOL,
"host" => $host,
]);
} | php | private function makePeerAddressTag(string $key, Endpoint $host): BinaryAnnotation
{
return new BinaryAnnotation([
"key" => $key,
"value" => '0x01',
"annotation_type" => AnnotationType::BOOL,
"host" => $host,
]);
} | [
"private",
"function",
"makePeerAddressTag",
"(",
"string",
"$",
"key",
",",
"Endpoint",
"$",
"host",
")",
":",
"BinaryAnnotation",
"{",
"return",
"new",
"BinaryAnnotation",
"(",
"[",
"\"key\"",
"=>",
"$",
"key",
",",
"\"value\"",
"=>",
"'0x01'",
",",
"\"annotation_type\"",
"=>",
"AnnotationType",
"::",
"BOOL",
",",
"\"host\"",
"=>",
"$",
"host",
",",
"]",
")",
";",
"}"
] | They are modeled as Boolean type with '0x01' as the value. | [
"They",
"are",
"modeled",
"as",
"Boolean",
"type",
"with",
"0x01",
"as",
"the",
"value",
"."
] | train | https://github.com/jonahgeorge/jaeger-client-php/blob/70965d835ad523f9b02b557c0c0e9413cd3d3a3d/src/Jaeger/Sender/UdpSender.php#L224-L232 |
jonahgeorge/jaeger-client-php | src/Jaeger/Sender/UdpSender.php | UdpSender.chunkSplit | private function chunkSplit(array $thrifts): array
{
$actualBufferSize = $this->zipkinBatchOverheadLength;
$chunkId = 0;
$chunks = [];
foreach ($thrifts as $thrift) {
$spanBufferLength = $this->getBufferLength($thrift);
if (!empty($chunks[$chunkId]) && ($actualBufferSize + $spanBufferLength) > $this->maxBufferLength) {
// point to next chunk
++$chunkId;
// reset buffer size
$actualBufferSize = $this->zipkinBatchOverheadLength;
}
if (!isset($chunks[$chunkId])) {
$chunks[$chunkId] = [];
}
$chunks[$chunkId][] = $thrift;
$actualBufferSize += $spanBufferLength;
}
return $chunks;
} | php | private function chunkSplit(array $thrifts): array
{
$actualBufferSize = $this->zipkinBatchOverheadLength;
$chunkId = 0;
$chunks = [];
foreach ($thrifts as $thrift) {
$spanBufferLength = $this->getBufferLength($thrift);
if (!empty($chunks[$chunkId]) && ($actualBufferSize + $spanBufferLength) > $this->maxBufferLength) {
// point to next chunk
++$chunkId;
// reset buffer size
$actualBufferSize = $this->zipkinBatchOverheadLength;
}
if (!isset($chunks[$chunkId])) {
$chunks[$chunkId] = [];
}
$chunks[$chunkId][] = $thrift;
$actualBufferSize += $spanBufferLength;
}
return $chunks;
} | [
"private",
"function",
"chunkSplit",
"(",
"array",
"$",
"thrifts",
")",
":",
"array",
"{",
"$",
"actualBufferSize",
"=",
"$",
"this",
"->",
"zipkinBatchOverheadLength",
";",
"$",
"chunkId",
"=",
"0",
";",
"$",
"chunks",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"thrifts",
"as",
"$",
"thrift",
")",
"{",
"$",
"spanBufferLength",
"=",
"$",
"this",
"->",
"getBufferLength",
"(",
"$",
"thrift",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"chunks",
"[",
"$",
"chunkId",
"]",
")",
"&&",
"(",
"$",
"actualBufferSize",
"+",
"$",
"spanBufferLength",
")",
">",
"$",
"this",
"->",
"maxBufferLength",
")",
"{",
"// point to next chunk",
"++",
"$",
"chunkId",
";",
"// reset buffer size",
"$",
"actualBufferSize",
"=",
"$",
"this",
"->",
"zipkinBatchOverheadLength",
";",
"}",
"if",
"(",
"!",
"isset",
"(",
"$",
"chunks",
"[",
"$",
"chunkId",
"]",
")",
")",
"{",
"$",
"chunks",
"[",
"$",
"chunkId",
"]",
"=",
"[",
"]",
";",
"}",
"$",
"chunks",
"[",
"$",
"chunkId",
"]",
"[",
"]",
"=",
"$",
"thrift",
";",
"$",
"actualBufferSize",
"+=",
"$",
"spanBufferLength",
";",
"}",
"return",
"$",
"chunks",
";",
"}"
] | Splits an array of thrift-objects into several chunks when the buffer limit has been reached.
@param array|ThriftSpan[]|TBase[] $thrifts
@return array | [
"Splits",
"an",
"array",
"of",
"thrift",
"-",
"objects",
"into",
"several",
"chunks",
"when",
"the",
"buffer",
"limit",
"has",
"been",
"reached",
"."
] | train | https://github.com/jonahgeorge/jaeger-client-php/blob/70965d835ad523f9b02b557c0c0e9413cd3d3a3d/src/Jaeger/Sender/UdpSender.php#L241-L267 |
jonahgeorge/jaeger-client-php | src/Jaeger/Sender/UdpSender.php | UdpSender.getBufferLength | private function getBufferLength($thrift): int
{
$memoryBuffer = new TMemoryBuffer();
$thrift->write(new TCompactProtocol($memoryBuffer));
return $memoryBuffer->available();
} | php | private function getBufferLength($thrift): int
{
$memoryBuffer = new TMemoryBuffer();
$thrift->write(new TCompactProtocol($memoryBuffer));
return $memoryBuffer->available();
} | [
"private",
"function",
"getBufferLength",
"(",
"$",
"thrift",
")",
":",
"int",
"{",
"$",
"memoryBuffer",
"=",
"new",
"TMemoryBuffer",
"(",
")",
";",
"$",
"thrift",
"->",
"write",
"(",
"new",
"TCompactProtocol",
"(",
"$",
"memoryBuffer",
")",
")",
";",
"return",
"$",
"memoryBuffer",
"->",
"available",
"(",
")",
";",
"}"
] | Returns the length of a thrift-object.
@param ThriftSpan|TBase $thrift
@return int | [
"Returns",
"the",
"length",
"of",
"a",
"thrift",
"-",
"object",
"."
] | train | https://github.com/jonahgeorge/jaeger-client-php/blob/70965d835ad523f9b02b557c0c0e9413cd3d3a3d/src/Jaeger/Sender/UdpSender.php#L276-L283 |
jonahgeorge/jaeger-client-php | src/Jaeger/Sender/UdpSender.php | UdpSender.createAnnotations | private function createAnnotations(JaegerSpan $span, Endpoint $endpoint): array
{
$annotations = [];
foreach ($span->getLogs() as $values) {
$annotations[] = new Annotation([
'timestamp' => $values['timestamp'],
'value' => json_encode($values['fields']),
'host' => $endpoint,
]);
}
return $annotations;
} | php | private function createAnnotations(JaegerSpan $span, Endpoint $endpoint): array
{
$annotations = [];
foreach ($span->getLogs() as $values) {
$annotations[] = new Annotation([
'timestamp' => $values['timestamp'],
'value' => json_encode($values['fields']),
'host' => $endpoint,
]);
}
return $annotations;
} | [
"private",
"function",
"createAnnotations",
"(",
"JaegerSpan",
"$",
"span",
",",
"Endpoint",
"$",
"endpoint",
")",
":",
"array",
"{",
"$",
"annotations",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"span",
"->",
"getLogs",
"(",
")",
"as",
"$",
"values",
")",
"{",
"$",
"annotations",
"[",
"]",
"=",
"new",
"Annotation",
"(",
"[",
"'timestamp'",
"=>",
"$",
"values",
"[",
"'timestamp'",
"]",
",",
"'value'",
"=>",
"json_encode",
"(",
"$",
"values",
"[",
"'fields'",
"]",
")",
",",
"'host'",
"=>",
"$",
"endpoint",
",",
"]",
")",
";",
"}",
"return",
"$",
"annotations",
";",
"}"
] | /*
@param JaegerSpan $span
@param Endpoint $endpoint
@return array|Annotation[] | [
"/",
"*",
"@param",
"JaegerSpan",
"$span",
"@param",
"Endpoint",
"$endpoint"
] | train | https://github.com/jonahgeorge/jaeger-client-php/blob/70965d835ad523f9b02b557c0c0e9413cd3d3a3d/src/Jaeger/Sender/UdpSender.php#L291-L304 |
jonahgeorge/jaeger-client-php | src/Jaeger/Codec/CodecUtility.php | CodecUtility.hexToInt64 | public static function hexToInt64($hex)
{
// If we're on a 32-bit architecture, fall back to base_convert.
if (PHP_INT_SIZE === 4) {
return base_convert($hex, 16, 10);
}
$hi = intval(substr($hex, -16, -8), 16);
$lo = intval(substr($hex, -8, 8), 16);
return $hi << 32 | $lo;
} | php | public static function hexToInt64($hex)
{
// If we're on a 32-bit architecture, fall back to base_convert.
if (PHP_INT_SIZE === 4) {
return base_convert($hex, 16, 10);
}
$hi = intval(substr($hex, -16, -8), 16);
$lo = intval(substr($hex, -8, 8), 16);
return $hi << 32 | $lo;
} | [
"public",
"static",
"function",
"hexToInt64",
"(",
"$",
"hex",
")",
"{",
"// If we're on a 32-bit architecture, fall back to base_convert.",
"if",
"(",
"PHP_INT_SIZE",
"===",
"4",
")",
"{",
"return",
"base_convert",
"(",
"$",
"hex",
",",
"16",
",",
"10",
")",
";",
"}",
"$",
"hi",
"=",
"intval",
"(",
"substr",
"(",
"$",
"hex",
",",
"-",
"16",
",",
"-",
"8",
")",
",",
"16",
")",
";",
"$",
"lo",
"=",
"intval",
"(",
"substr",
"(",
"$",
"hex",
",",
"-",
"8",
",",
"8",
")",
",",
"16",
")",
";",
"return",
"$",
"hi",
"<<",
"32",
"|",
"$",
"lo",
";",
"}"
] | Incoming trace/span IDs are hex representations of 64-bit values. PHP
represents ints internally as signed 32- or 64-bit values, but base_convert
converts to string representations of arbitrarily large positive numbers.
This means at least half the incoming IDs will be larger than PHP_INT_MAX.
Thrift, while building a binary representation of the IDs, performs bitwise
operations on the string values, implicitly casting to int and capping them
at PHP_INT_MAX. So, incoming IDs larger than PHP_INT_MAX will be serialized
and sent to the agent as PHP_INT_MAX, breaking trace/span correlation.
This method therefore, on 64-bit architectures, splits the hex string into
high and low values, converts them separately to ints, and manually combines
them into a proper signed int. This int is then handled properly by the
Thrift package.
On 32-bit architectures, it falls back to base_convert.
@param string $hex
@return string|int | [
"Incoming",
"trace",
"/",
"span",
"IDs",
"are",
"hex",
"representations",
"of",
"64",
"-",
"bit",
"values",
".",
"PHP",
"represents",
"ints",
"internally",
"as",
"signed",
"32",
"-",
"or",
"64",
"-",
"bit",
"values",
"but",
"base_convert",
"converts",
"to",
"string",
"representations",
"of",
"arbitrarily",
"large",
"positive",
"numbers",
".",
"This",
"means",
"at",
"least",
"half",
"the",
"incoming",
"IDs",
"will",
"be",
"larger",
"than",
"PHP_INT_MAX",
"."
] | train | https://github.com/jonahgeorge/jaeger-client-php/blob/70965d835ad523f9b02b557c0c0e9413cd3d3a3d/src/Jaeger/Codec/CodecUtility.php#L29-L40 |
jonahgeorge/jaeger-client-php | src/Jaeger/SpanContext.php | SpanContext.getBaggageItem | public function getBaggageItem($key)
{
return array_key_exists($key, $this->baggage) ? $this->baggage[$key] : null;
} | php | public function getBaggageItem($key)
{
return array_key_exists($key, $this->baggage) ? $this->baggage[$key] : null;
} | [
"public",
"function",
"getBaggageItem",
"(",
"$",
"key",
")",
"{",
"return",
"array_key_exists",
"(",
"$",
"key",
",",
"$",
"this",
"->",
"baggage",
")",
"?",
"$",
"this",
"->",
"baggage",
"[",
"$",
"key",
"]",
":",
"null",
";",
"}"
] | {@inheritdoc} | [
"{"
] | train | https://github.com/jonahgeorge/jaeger-client-php/blob/70965d835ad523f9b02b557c0c0e9413cd3d3a3d/src/Jaeger/SpanContext.php#L56-L59 |
jonahgeorge/jaeger-client-php | src/Jaeger/SpanContext.php | SpanContext.withBaggageItem | public function withBaggageItem($key, $value)
{
return new self(
$this->traceId,
$this->spanId,
$this->parentId,
$this->flags,
[$key => $value] + $this->baggage
);
} | php | public function withBaggageItem($key, $value)
{
return new self(
$this->traceId,
$this->spanId,
$this->parentId,
$this->flags,
[$key => $value] + $this->baggage
);
} | [
"public",
"function",
"withBaggageItem",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"return",
"new",
"self",
"(",
"$",
"this",
"->",
"traceId",
",",
"$",
"this",
"->",
"spanId",
",",
"$",
"this",
"->",
"parentId",
",",
"$",
"this",
"->",
"flags",
",",
"[",
"$",
"key",
"=>",
"$",
"value",
"]",
"+",
"$",
"this",
"->",
"baggage",
")",
";",
"}"
] | {@inheritdoc}
@param string $key
@param string $value
@return SpanContext | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/jonahgeorge/jaeger-client-php/blob/70965d835ad523f9b02b557c0c0e9413cd3d3a3d/src/Jaeger/SpanContext.php#L68-L77 |
jonahgeorge/jaeger-client-php | src/Jaeger/Reporter/CompositeReporter.php | CompositeReporter.reportSpan | public function reportSpan(Span $span)
{
foreach ($this->reporters as $reporter) {
$reporter->reportSpan($span);
}
} | php | public function reportSpan(Span $span)
{
foreach ($this->reporters as $reporter) {
$reporter->reportSpan($span);
}
} | [
"public",
"function",
"reportSpan",
"(",
"Span",
"$",
"span",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"reporters",
"as",
"$",
"reporter",
")",
"{",
"$",
"reporter",
"->",
"reportSpan",
"(",
"$",
"span",
")",
";",
"}",
"}"
] | {@inheritdoc}
@param Span $span
@return void | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/jonahgeorge/jaeger-client-php/blob/70965d835ad523f9b02b557c0c0e9413cd3d3a3d/src/Jaeger/Reporter/CompositeReporter.php#L33-L38 |
drupalwxt/wxt | modules/custom/wxt_ext/wxt_ext_user/src/Plugin/Block/UserDropdownBlock.php | UserDropdownBlock.build | public function build() {
$block = [];
$links_cache_contexts = [];
// Display different links to depending on whether the user is logged in.
if ($this->user->isAnonymous()) {
// Create a 'person' icon that toggles a login form.
$markup = '';
$markup .= '<a class="login-dropdown-button standard-icon meta-icon-size left" data-toggle="user-login-wrapper" aria-controls="user-login-wrapper" aria-expanded="false">';
$markup .= '<i class="icon ion-person"></i>';
$markup .= '</a>';
$block['login'] = [
'#markup' => $markup,
];
// Wrap the login form with some required foundation classes/attributes.
$login_wrapper = [
'#type' => 'container',
'#attributes' => [
'class' => ['dropdown-pane', 'display-none'],
'id' => 'user-login-wrapper',
'data-dropdown' => '',
'aria-hidden' => 'true',
'aria-autoclose' => 'true',
'data-auto-focus' => 'true',
'tabindex' => '-1',
],
];
// Get the user login form.
$form = $this->formBuilder->getForm('\Drupal\user\Form\UserLoginForm');
// Remove default form descriptions.
unset($form['name']['#description']);
unset($form['name']['#attributes']['aria-describedby']);
unset($form['pass']['#description']);
unset($form['pass']['#attributes']['aria-describedby']);
$login_wrapper['form'] = $form;
$block['wrapper'] = $login_wrapper;
}
else {
$username = $this->user->getDisplayName();
$user_page_url = Url::fromRoute('user.page')->toString();
$user_logout_url = Url::fromRoute('user.logout')->toString();
// Create a 'person' icon that toggles user profile and log out links.
$markup = '';
$markup .= '<a class="login-dropdown-button standard-icon meta-icon-size left" data-toggle="user-logout-wrapper" aria-controls="user-logout-wrapper" aria-expanded="false">';
$markup .= '<i class="icon ion-person"></i>';
$markup .= '<span> ' . $username . '</span>';
$markup .= '</a>';
$markup .= '<div id="user-logout-wrapper" class="dropdown-pane f-dropdown" data-dropdown aria-hidden="true" aria-autoclose="false" data-auto-focus="false">';
$markup .= '<div class="user-links">';
$markup .= '<a class="" href="' . $user_page_url . '"><i class="icon ion-person"></i> ' . $username . '</a>';
$markup .= '<a class="logout-button" href="' . $user_logout_url . '"><i class="icon ion-log-out"></i> ' . $this->t('Log Out') . '</a>';
$markup .= '</div>';
$markup .= '</div>';
$block['login'] = [
'#markup' => $markup,
];
// The "Edit user account" link is per-user.
$links_cache_contexts[] = 'user';
}
// Cacheable per "authenticated or not", because the links to
// display depend on that.
$block['#cache']['contexts'] = Cache::mergeContexts(['user.roles:authenticated'], $links_cache_contexts);
return $block;
} | php | public function build() {
$block = [];
$links_cache_contexts = [];
// Display different links to depending on whether the user is logged in.
if ($this->user->isAnonymous()) {
// Create a 'person' icon that toggles a login form.
$markup = '';
$markup .= '<a class="login-dropdown-button standard-icon meta-icon-size left" data-toggle="user-login-wrapper" aria-controls="user-login-wrapper" aria-expanded="false">';
$markup .= '<i class="icon ion-person"></i>';
$markup .= '</a>';
$block['login'] = [
'#markup' => $markup,
];
// Wrap the login form with some required foundation classes/attributes.
$login_wrapper = [
'#type' => 'container',
'#attributes' => [
'class' => ['dropdown-pane', 'display-none'],
'id' => 'user-login-wrapper',
'data-dropdown' => '',
'aria-hidden' => 'true',
'aria-autoclose' => 'true',
'data-auto-focus' => 'true',
'tabindex' => '-1',
],
];
// Get the user login form.
$form = $this->formBuilder->getForm('\Drupal\user\Form\UserLoginForm');
// Remove default form descriptions.
unset($form['name']['#description']);
unset($form['name']['#attributes']['aria-describedby']);
unset($form['pass']['#description']);
unset($form['pass']['#attributes']['aria-describedby']);
$login_wrapper['form'] = $form;
$block['wrapper'] = $login_wrapper;
}
else {
$username = $this->user->getDisplayName();
$user_page_url = Url::fromRoute('user.page')->toString();
$user_logout_url = Url::fromRoute('user.logout')->toString();
// Create a 'person' icon that toggles user profile and log out links.
$markup = '';
$markup .= '<a class="login-dropdown-button standard-icon meta-icon-size left" data-toggle="user-logout-wrapper" aria-controls="user-logout-wrapper" aria-expanded="false">';
$markup .= '<i class="icon ion-person"></i>';
$markup .= '<span> ' . $username . '</span>';
$markup .= '</a>';
$markup .= '<div id="user-logout-wrapper" class="dropdown-pane f-dropdown" data-dropdown aria-hidden="true" aria-autoclose="false" data-auto-focus="false">';
$markup .= '<div class="user-links">';
$markup .= '<a class="" href="' . $user_page_url . '"><i class="icon ion-person"></i> ' . $username . '</a>';
$markup .= '<a class="logout-button" href="' . $user_logout_url . '"><i class="icon ion-log-out"></i> ' . $this->t('Log Out') . '</a>';
$markup .= '</div>';
$markup .= '</div>';
$block['login'] = [
'#markup' => $markup,
];
// The "Edit user account" link is per-user.
$links_cache_contexts[] = 'user';
}
// Cacheable per "authenticated or not", because the links to
// display depend on that.
$block['#cache']['contexts'] = Cache::mergeContexts(['user.roles:authenticated'], $links_cache_contexts);
return $block;
} | [
"public",
"function",
"build",
"(",
")",
"{",
"$",
"block",
"=",
"[",
"]",
";",
"$",
"links_cache_contexts",
"=",
"[",
"]",
";",
"// Display different links to depending on whether the user is logged in.",
"if",
"(",
"$",
"this",
"->",
"user",
"->",
"isAnonymous",
"(",
")",
")",
"{",
"// Create a 'person' icon that toggles a login form.",
"$",
"markup",
"=",
"''",
";",
"$",
"markup",
".=",
"'<a class=\"login-dropdown-button standard-icon meta-icon-size left\" data-toggle=\"user-login-wrapper\" aria-controls=\"user-login-wrapper\" aria-expanded=\"false\">'",
";",
"$",
"markup",
".=",
"'<i class=\"icon ion-person\"></i>'",
";",
"$",
"markup",
".=",
"'</a>'",
";",
"$",
"block",
"[",
"'login'",
"]",
"=",
"[",
"'#markup'",
"=>",
"$",
"markup",
",",
"]",
";",
"// Wrap the login form with some required foundation classes/attributes.",
"$",
"login_wrapper",
"=",
"[",
"'#type'",
"=>",
"'container'",
",",
"'#attributes'",
"=>",
"[",
"'class'",
"=>",
"[",
"'dropdown-pane'",
",",
"'display-none'",
"]",
",",
"'id'",
"=>",
"'user-login-wrapper'",
",",
"'data-dropdown'",
"=>",
"''",
",",
"'aria-hidden'",
"=>",
"'true'",
",",
"'aria-autoclose'",
"=>",
"'true'",
",",
"'data-auto-focus'",
"=>",
"'true'",
",",
"'tabindex'",
"=>",
"'-1'",
",",
"]",
",",
"]",
";",
"// Get the user login form.",
"$",
"form",
"=",
"$",
"this",
"->",
"formBuilder",
"->",
"getForm",
"(",
"'\\Drupal\\user\\Form\\UserLoginForm'",
")",
";",
"// Remove default form descriptions.",
"unset",
"(",
"$",
"form",
"[",
"'name'",
"]",
"[",
"'#description'",
"]",
")",
";",
"unset",
"(",
"$",
"form",
"[",
"'name'",
"]",
"[",
"'#attributes'",
"]",
"[",
"'aria-describedby'",
"]",
")",
";",
"unset",
"(",
"$",
"form",
"[",
"'pass'",
"]",
"[",
"'#description'",
"]",
")",
";",
"unset",
"(",
"$",
"form",
"[",
"'pass'",
"]",
"[",
"'#attributes'",
"]",
"[",
"'aria-describedby'",
"]",
")",
";",
"$",
"login_wrapper",
"[",
"'form'",
"]",
"=",
"$",
"form",
";",
"$",
"block",
"[",
"'wrapper'",
"]",
"=",
"$",
"login_wrapper",
";",
"}",
"else",
"{",
"$",
"username",
"=",
"$",
"this",
"->",
"user",
"->",
"getDisplayName",
"(",
")",
";",
"$",
"user_page_url",
"=",
"Url",
"::",
"fromRoute",
"(",
"'user.page'",
")",
"->",
"toString",
"(",
")",
";",
"$",
"user_logout_url",
"=",
"Url",
"::",
"fromRoute",
"(",
"'user.logout'",
")",
"->",
"toString",
"(",
")",
";",
"// Create a 'person' icon that toggles user profile and log out links.",
"$",
"markup",
"=",
"''",
";",
"$",
"markup",
".=",
"'<a class=\"login-dropdown-button standard-icon meta-icon-size left\" data-toggle=\"user-logout-wrapper\" aria-controls=\"user-logout-wrapper\" aria-expanded=\"false\">'",
";",
"$",
"markup",
".=",
"'<i class=\"icon ion-person\"></i>'",
";",
"$",
"markup",
".=",
"'<span> '",
".",
"$",
"username",
".",
"'</span>'",
";",
"$",
"markup",
".=",
"'</a>'",
";",
"$",
"markup",
".=",
"'<div id=\"user-logout-wrapper\" class=\"dropdown-pane f-dropdown\" data-dropdown aria-hidden=\"true\" aria-autoclose=\"false\" data-auto-focus=\"false\">'",
";",
"$",
"markup",
".=",
"'<div class=\"user-links\">'",
";",
"$",
"markup",
".=",
"'<a class=\"\" href=\"'",
".",
"$",
"user_page_url",
".",
"'\"><i class=\"icon ion-person\"></i> '",
".",
"$",
"username",
".",
"'</a>'",
";",
"$",
"markup",
".=",
"'<a class=\"logout-button\" href=\"'",
".",
"$",
"user_logout_url",
".",
"'\"><i class=\"icon ion-log-out\"></i> '",
".",
"$",
"this",
"->",
"t",
"(",
"'Log Out'",
")",
".",
"'</a>'",
";",
"$",
"markup",
".=",
"'</div>'",
";",
"$",
"markup",
".=",
"'</div>'",
";",
"$",
"block",
"[",
"'login'",
"]",
"=",
"[",
"'#markup'",
"=>",
"$",
"markup",
",",
"]",
";",
"// The \"Edit user account\" link is per-user.",
"$",
"links_cache_contexts",
"[",
"]",
"=",
"'user'",
";",
"}",
"// Cacheable per \"authenticated or not\", because the links to",
"// display depend on that.",
"$",
"block",
"[",
"'#cache'",
"]",
"[",
"'contexts'",
"]",
"=",
"Cache",
"::",
"mergeContexts",
"(",
"[",
"'user.roles:authenticated'",
"]",
",",
"$",
"links_cache_contexts",
")",
";",
"return",
"$",
"block",
";",
"}"
] | {@inheritdoc} | [
"{"
] | train | https://github.com/drupalwxt/wxt/blob/f0a3730065d9dba1ffb68237e329bf575da410d4/modules/custom/wxt_ext/wxt_ext_user/src/Plugin/Block/UserDropdownBlock.php#L60-L135 |
drupalwxt/wxt | modules/custom/wxt_ext/wxt_ext_breadcrumb/src/Breadcrumb/MainBreadcrumbBuilder.php | MainBreadcrumbBuilder.applies | public function applies(RouteMatchInterface $route_match) {
$parameters = $route_match->getParameters()->all();
$this->menuBreadcrumb = new MenuBasedBreadcrumbBuilder($this->configFactory, $this->menuActiveTrail, $this->menuLinkManager, $this->adminContext, $this->titleResolver, $this->requestStack, $this->languageManager, $this->entityTypeManager, $this->config);
return ((!empty($parameters['node'])) && (is_object($parameters['node'])) && (count($this->menuActiveTrail->getActiveTrailIds('main')) >= 1) && ($this->menuBreadcrumb->applies($route_match)));
} | php | public function applies(RouteMatchInterface $route_match) {
$parameters = $route_match->getParameters()->all();
$this->menuBreadcrumb = new MenuBasedBreadcrumbBuilder($this->configFactory, $this->menuActiveTrail, $this->menuLinkManager, $this->adminContext, $this->titleResolver, $this->requestStack, $this->languageManager, $this->entityTypeManager, $this->config);
return ((!empty($parameters['node'])) && (is_object($parameters['node'])) && (count($this->menuActiveTrail->getActiveTrailIds('main')) >= 1) && ($this->menuBreadcrumb->applies($route_match)));
} | [
"public",
"function",
"applies",
"(",
"RouteMatchInterface",
"$",
"route_match",
")",
"{",
"$",
"parameters",
"=",
"$",
"route_match",
"->",
"getParameters",
"(",
")",
"->",
"all",
"(",
")",
";",
"$",
"this",
"->",
"menuBreadcrumb",
"=",
"new",
"MenuBasedBreadcrumbBuilder",
"(",
"$",
"this",
"->",
"configFactory",
",",
"$",
"this",
"->",
"menuActiveTrail",
",",
"$",
"this",
"->",
"menuLinkManager",
",",
"$",
"this",
"->",
"adminContext",
",",
"$",
"this",
"->",
"titleResolver",
",",
"$",
"this",
"->",
"requestStack",
",",
"$",
"this",
"->",
"languageManager",
",",
"$",
"this",
"->",
"entityTypeManager",
",",
"$",
"this",
"->",
"config",
")",
";",
"return",
"(",
"(",
"!",
"empty",
"(",
"$",
"parameters",
"[",
"'node'",
"]",
")",
")",
"&&",
"(",
"is_object",
"(",
"$",
"parameters",
"[",
"'node'",
"]",
")",
")",
"&&",
"(",
"count",
"(",
"$",
"this",
"->",
"menuActiveTrail",
"->",
"getActiveTrailIds",
"(",
"'main'",
")",
")",
">=",
"1",
")",
"&&",
"(",
"$",
"this",
"->",
"menuBreadcrumb",
"->",
"applies",
"(",
"$",
"route_match",
")",
")",
")",
";",
"}"
] | {@inheritdoc} | [
"{"
] | train | https://github.com/drupalwxt/wxt/blob/f0a3730065d9dba1ffb68237e329bf575da410d4/modules/custom/wxt_ext/wxt_ext_breadcrumb/src/Breadcrumb/MainBreadcrumbBuilder.php#L181-L186 |
drupalwxt/wxt | modules/custom/wxt_ext/wxt_ext_breadcrumb/src/Breadcrumb/MainBreadcrumbBuilder.php | MainBreadcrumbBuilder.build | public function build(RouteMatchInterface $route_match) {
$breadcrumb = new Breadcrumb();
$links = [];
// Add the url.path.parent cache context. This code ignores the last path
// part so the result only depends on the path parents.
$breadcrumb->addCacheContexts(['url.path.parent']);
$links[] = Link::createFromRoute($this->t('Home'), '<front>');
$breadcrumb->setLinks(array_reverse($links));
$route = $route_match->getRouteObject();
if ($route && !$route->getOption('_admin_route')) {
$links = $breadcrumb->getLinks();
if (!empty($links) && $links[0]->getText() == $this->t('Home')) {
$url = 'https://www.canada.ca/en.html';
if ($this->languageManager->getCurrentLanguage()->getId() == 'fr') {
$url = 'https://www.canada.ca/fr.html';
}
$link = array_shift($links);
$link->setUrl(Url::fromUri($url));
array_unshift($links, $link);
}
$breadcrumb = new Breadcrumb();
$breadcrumb->addCacheContexts(['url.path.parent']);
$breadcrumb->setLinks($links);
}
return $breadcrumb;
} | php | public function build(RouteMatchInterface $route_match) {
$breadcrumb = new Breadcrumb();
$links = [];
// Add the url.path.parent cache context. This code ignores the last path
// part so the result only depends on the path parents.
$breadcrumb->addCacheContexts(['url.path.parent']);
$links[] = Link::createFromRoute($this->t('Home'), '<front>');
$breadcrumb->setLinks(array_reverse($links));
$route = $route_match->getRouteObject();
if ($route && !$route->getOption('_admin_route')) {
$links = $breadcrumb->getLinks();
if (!empty($links) && $links[0]->getText() == $this->t('Home')) {
$url = 'https://www.canada.ca/en.html';
if ($this->languageManager->getCurrentLanguage()->getId() == 'fr') {
$url = 'https://www.canada.ca/fr.html';
}
$link = array_shift($links);
$link->setUrl(Url::fromUri($url));
array_unshift($links, $link);
}
$breadcrumb = new Breadcrumb();
$breadcrumb->addCacheContexts(['url.path.parent']);
$breadcrumb->setLinks($links);
}
return $breadcrumb;
} | [
"public",
"function",
"build",
"(",
"RouteMatchInterface",
"$",
"route_match",
")",
"{",
"$",
"breadcrumb",
"=",
"new",
"Breadcrumb",
"(",
")",
";",
"$",
"links",
"=",
"[",
"]",
";",
"// Add the url.path.parent cache context. This code ignores the last path",
"// part so the result only depends on the path parents.",
"$",
"breadcrumb",
"->",
"addCacheContexts",
"(",
"[",
"'url.path.parent'",
"]",
")",
";",
"$",
"links",
"[",
"]",
"=",
"Link",
"::",
"createFromRoute",
"(",
"$",
"this",
"->",
"t",
"(",
"'Home'",
")",
",",
"'<front>'",
")",
";",
"$",
"breadcrumb",
"->",
"setLinks",
"(",
"array_reverse",
"(",
"$",
"links",
")",
")",
";",
"$",
"route",
"=",
"$",
"route_match",
"->",
"getRouteObject",
"(",
")",
";",
"if",
"(",
"$",
"route",
"&&",
"!",
"$",
"route",
"->",
"getOption",
"(",
"'_admin_route'",
")",
")",
"{",
"$",
"links",
"=",
"$",
"breadcrumb",
"->",
"getLinks",
"(",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"links",
")",
"&&",
"$",
"links",
"[",
"0",
"]",
"->",
"getText",
"(",
")",
"==",
"$",
"this",
"->",
"t",
"(",
"'Home'",
")",
")",
"{",
"$",
"url",
"=",
"'https://www.canada.ca/en.html'",
";",
"if",
"(",
"$",
"this",
"->",
"languageManager",
"->",
"getCurrentLanguage",
"(",
")",
"->",
"getId",
"(",
")",
"==",
"'fr'",
")",
"{",
"$",
"url",
"=",
"'https://www.canada.ca/fr.html'",
";",
"}",
"$",
"link",
"=",
"array_shift",
"(",
"$",
"links",
")",
";",
"$",
"link",
"->",
"setUrl",
"(",
"Url",
"::",
"fromUri",
"(",
"$",
"url",
")",
")",
";",
"array_unshift",
"(",
"$",
"links",
",",
"$",
"link",
")",
";",
"}",
"$",
"breadcrumb",
"=",
"new",
"Breadcrumb",
"(",
")",
";",
"$",
"breadcrumb",
"->",
"addCacheContexts",
"(",
"[",
"'url.path.parent'",
"]",
")",
";",
"$",
"breadcrumb",
"->",
"setLinks",
"(",
"$",
"links",
")",
";",
"}",
"return",
"$",
"breadcrumb",
";",
"}"
] | {@inheritdoc} | [
"{"
] | train | https://github.com/drupalwxt/wxt/blob/f0a3730065d9dba1ffb68237e329bf575da410d4/modules/custom/wxt_ext/wxt_ext_breadcrumb/src/Breadcrumb/MainBreadcrumbBuilder.php#L191-L224 |
drupalwxt/wxt | modules/custom/wxt_ext/wxt_ext_migration/src/Plugin/migrate/process/BlockPluginId.php | BlockPluginId.create | public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) {
$entity_manager = $container->get('entity.manager');
$migration_configuration = [
'migration' => [
'wxt_media',
],
];
// Handle any custom migrations leveraging this plugin.
$migration_dependencies = $migration->getMigrationDependencies();
if (isset($migration_dependencies['required'])) {
foreach ($migration_dependencies['required'] as $dependency) {
if (strpos($dependency, 'block') !== FALSE ||
strpos($dependency, 'media') !== FALSE ||
strpos($dependency, 'node') !== FALSE) {
$migration_configuration['migration'][] = $dependency;
}
}
}
return new static(
$configuration,
$plugin_id,
$plugin_definition,
$entity_manager->getDefinition('block_content') ? $entity_manager->getStorage('block_content') : NULL,
$container->get('plugin.manager.migrate.process')->createInstance('migration', $migration_configuration, $migration),
$container->get('uuid'),
$container->get('plugin.manager.block'),
$entity_manager->hasHandler('block', 'storage') ? $entity_manager->getStorage('block') : NULL
);
} | php | public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) {
$entity_manager = $container->get('entity.manager');
$migration_configuration = [
'migration' => [
'wxt_media',
],
];
// Handle any custom migrations leveraging this plugin.
$migration_dependencies = $migration->getMigrationDependencies();
if (isset($migration_dependencies['required'])) {
foreach ($migration_dependencies['required'] as $dependency) {
if (strpos($dependency, 'block') !== FALSE ||
strpos($dependency, 'media') !== FALSE ||
strpos($dependency, 'node') !== FALSE) {
$migration_configuration['migration'][] = $dependency;
}
}
}
return new static(
$configuration,
$plugin_id,
$plugin_definition,
$entity_manager->getDefinition('block_content') ? $entity_manager->getStorage('block_content') : NULL,
$container->get('plugin.manager.migrate.process')->createInstance('migration', $migration_configuration, $migration),
$container->get('uuid'),
$container->get('plugin.manager.block'),
$entity_manager->hasHandler('block', 'storage') ? $entity_manager->getStorage('block') : NULL
);
} | [
"public",
"static",
"function",
"create",
"(",
"ContainerInterface",
"$",
"container",
",",
"array",
"$",
"configuration",
",",
"$",
"plugin_id",
",",
"$",
"plugin_definition",
",",
"MigrationInterface",
"$",
"migration",
"=",
"NULL",
")",
"{",
"$",
"entity_manager",
"=",
"$",
"container",
"->",
"get",
"(",
"'entity.manager'",
")",
";",
"$",
"migration_configuration",
"=",
"[",
"'migration'",
"=>",
"[",
"'wxt_media'",
",",
"]",
",",
"]",
";",
"// Handle any custom migrations leveraging this plugin.",
"$",
"migration_dependencies",
"=",
"$",
"migration",
"->",
"getMigrationDependencies",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"migration_dependencies",
"[",
"'required'",
"]",
")",
")",
"{",
"foreach",
"(",
"$",
"migration_dependencies",
"[",
"'required'",
"]",
"as",
"$",
"dependency",
")",
"{",
"if",
"(",
"strpos",
"(",
"$",
"dependency",
",",
"'block'",
")",
"!==",
"FALSE",
"||",
"strpos",
"(",
"$",
"dependency",
",",
"'media'",
")",
"!==",
"FALSE",
"||",
"strpos",
"(",
"$",
"dependency",
",",
"'node'",
")",
"!==",
"FALSE",
")",
"{",
"$",
"migration_configuration",
"[",
"'migration'",
"]",
"[",
"]",
"=",
"$",
"dependency",
";",
"}",
"}",
"}",
"return",
"new",
"static",
"(",
"$",
"configuration",
",",
"$",
"plugin_id",
",",
"$",
"plugin_definition",
",",
"$",
"entity_manager",
"->",
"getDefinition",
"(",
"'block_content'",
")",
"?",
"$",
"entity_manager",
"->",
"getStorage",
"(",
"'block_content'",
")",
":",
"NULL",
",",
"$",
"container",
"->",
"get",
"(",
"'plugin.manager.migrate.process'",
")",
"->",
"createInstance",
"(",
"'migration'",
",",
"$",
"migration_configuration",
",",
"$",
"migration",
")",
",",
"$",
"container",
"->",
"get",
"(",
"'uuid'",
")",
",",
"$",
"container",
"->",
"get",
"(",
"'plugin.manager.block'",
")",
",",
"$",
"entity_manager",
"->",
"hasHandler",
"(",
"'block'",
",",
"'storage'",
")",
"?",
"$",
"entity_manager",
"->",
"getStorage",
"(",
"'block'",
")",
":",
"NULL",
")",
";",
"}"
] | {@inheritdoc} | [
"{"
] | train | https://github.com/drupalwxt/wxt/blob/f0a3730065d9dba1ffb68237e329bf575da410d4/modules/custom/wxt_ext/wxt_ext_migration/src/Plugin/migrate/process/BlockPluginId.php#L85-L115 |
drupalwxt/wxt | modules/custom/wxt_ext/wxt_ext_migration/src/Plugin/migrate/process/BlockPluginId.php | BlockPluginId.transform | public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {
$blocks = [];
foreach ($value as $tmp_block) {
$uuid = $this->uuidService->generate();
if (is_array($tmp_block)) {
list($module, $delta) = explode(":", $tmp_block['id'], 2);
switch ($module) {
case 'block_content':
$block_id = $this->migrationPlugin
->transform($delta, $migrate_executable, $row, $destination_property);
// Language Handling.
if (is_array($block_id)) {
$block_id = current($block_id);
}
if ($block_id) {
$block = [
'id' => $module . ':' . $this->blockContentStorage->load($block_id)->uuid(),
'status' => TRUE,
'info' => '',
'view_mode' => $tmp_block['view_mode'],
];
}
break;
case 'entity_block':
$block_id = $this->migrationPlugin
->transform($delta, $migrate_executable, $row, $destination_property);
if ($block_id) {
$block = [
'id' => $module . ':media',
'view_mode' => $tmp_block['view_mode'],
'entity' => $block_id,
];
}
break;
case 'entity_field':
$block = [
'id' => $module . ':' . $delta,
];
if ($delta == 'node:body') {
$block['formatter'] = [
'label' => 'hidden',
'type' => 'text_default',
'settings' => [],
'third_party_settings' => [],
];
}
break;
case 'facet_block':
$block = [
'id' => $module . ':' . $delta,
];
break;
case 'facets_summary_block':
$block = [
'id' => $module . ':' . $delta,
];
break;
case 'page_title_block':
$block = [
'id' => $module,
];
break;
case 'local_tasks_block':
$block = [
'id' => $module,
'primary' => TRUE,
'secondary' => TRUE,
];
break;
case 'views_block':
$block = [
'id' => $module . ':' . $delta,
'views_label' => '',
'items_per_page' => 'none',
];
break;
default:
break;
}
$block['label'] = $tmp_block['label'];
$block['label_display'] = $tmp_block['label_display'];
$block['region'] = $tmp_block['region'];
$block['weight'] = $tmp_block['weight'];
$block['uuid'] = $uuid;
$block['context_mapping'] = [];
try {
$definition = $this->blockManager->getDefinition($block['id']);
}
catch (PluginNotFoundException $e) {
continue;
}
if (isset($definition['provider'])) {
$block['provider'] = $definition['provider'];
}
if (isset($definition['context']['entity'])) {
$block['context_mapping']['entity'] = '@panelizer.entity_context:entity';
}
$blocks[$uuid] = $block;
}
}
return $blocks;
} | php | public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {
$blocks = [];
foreach ($value as $tmp_block) {
$uuid = $this->uuidService->generate();
if (is_array($tmp_block)) {
list($module, $delta) = explode(":", $tmp_block['id'], 2);
switch ($module) {
case 'block_content':
$block_id = $this->migrationPlugin
->transform($delta, $migrate_executable, $row, $destination_property);
// Language Handling.
if (is_array($block_id)) {
$block_id = current($block_id);
}
if ($block_id) {
$block = [
'id' => $module . ':' . $this->blockContentStorage->load($block_id)->uuid(),
'status' => TRUE,
'info' => '',
'view_mode' => $tmp_block['view_mode'],
];
}
break;
case 'entity_block':
$block_id = $this->migrationPlugin
->transform($delta, $migrate_executable, $row, $destination_property);
if ($block_id) {
$block = [
'id' => $module . ':media',
'view_mode' => $tmp_block['view_mode'],
'entity' => $block_id,
];
}
break;
case 'entity_field':
$block = [
'id' => $module . ':' . $delta,
];
if ($delta == 'node:body') {
$block['formatter'] = [
'label' => 'hidden',
'type' => 'text_default',
'settings' => [],
'third_party_settings' => [],
];
}
break;
case 'facet_block':
$block = [
'id' => $module . ':' . $delta,
];
break;
case 'facets_summary_block':
$block = [
'id' => $module . ':' . $delta,
];
break;
case 'page_title_block':
$block = [
'id' => $module,
];
break;
case 'local_tasks_block':
$block = [
'id' => $module,
'primary' => TRUE,
'secondary' => TRUE,
];
break;
case 'views_block':
$block = [
'id' => $module . ':' . $delta,
'views_label' => '',
'items_per_page' => 'none',
];
break;
default:
break;
}
$block['label'] = $tmp_block['label'];
$block['label_display'] = $tmp_block['label_display'];
$block['region'] = $tmp_block['region'];
$block['weight'] = $tmp_block['weight'];
$block['uuid'] = $uuid;
$block['context_mapping'] = [];
try {
$definition = $this->blockManager->getDefinition($block['id']);
}
catch (PluginNotFoundException $e) {
continue;
}
if (isset($definition['provider'])) {
$block['provider'] = $definition['provider'];
}
if (isset($definition['context']['entity'])) {
$block['context_mapping']['entity'] = '@panelizer.entity_context:entity';
}
$blocks[$uuid] = $block;
}
}
return $blocks;
} | [
"public",
"function",
"transform",
"(",
"$",
"value",
",",
"MigrateExecutableInterface",
"$",
"migrate_executable",
",",
"Row",
"$",
"row",
",",
"$",
"destination_property",
")",
"{",
"$",
"blocks",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"value",
"as",
"$",
"tmp_block",
")",
"{",
"$",
"uuid",
"=",
"$",
"this",
"->",
"uuidService",
"->",
"generate",
"(",
")",
";",
"if",
"(",
"is_array",
"(",
"$",
"tmp_block",
")",
")",
"{",
"list",
"(",
"$",
"module",
",",
"$",
"delta",
")",
"=",
"explode",
"(",
"\":\"",
",",
"$",
"tmp_block",
"[",
"'id'",
"]",
",",
"2",
")",
";",
"switch",
"(",
"$",
"module",
")",
"{",
"case",
"'block_content'",
":",
"$",
"block_id",
"=",
"$",
"this",
"->",
"migrationPlugin",
"->",
"transform",
"(",
"$",
"delta",
",",
"$",
"migrate_executable",
",",
"$",
"row",
",",
"$",
"destination_property",
")",
";",
"// Language Handling.",
"if",
"(",
"is_array",
"(",
"$",
"block_id",
")",
")",
"{",
"$",
"block_id",
"=",
"current",
"(",
"$",
"block_id",
")",
";",
"}",
"if",
"(",
"$",
"block_id",
")",
"{",
"$",
"block",
"=",
"[",
"'id'",
"=>",
"$",
"module",
".",
"':'",
".",
"$",
"this",
"->",
"blockContentStorage",
"->",
"load",
"(",
"$",
"block_id",
")",
"->",
"uuid",
"(",
")",
",",
"'status'",
"=>",
"TRUE",
",",
"'info'",
"=>",
"''",
",",
"'view_mode'",
"=>",
"$",
"tmp_block",
"[",
"'view_mode'",
"]",
",",
"]",
";",
"}",
"break",
";",
"case",
"'entity_block'",
":",
"$",
"block_id",
"=",
"$",
"this",
"->",
"migrationPlugin",
"->",
"transform",
"(",
"$",
"delta",
",",
"$",
"migrate_executable",
",",
"$",
"row",
",",
"$",
"destination_property",
")",
";",
"if",
"(",
"$",
"block_id",
")",
"{",
"$",
"block",
"=",
"[",
"'id'",
"=>",
"$",
"module",
".",
"':media'",
",",
"'view_mode'",
"=>",
"$",
"tmp_block",
"[",
"'view_mode'",
"]",
",",
"'entity'",
"=>",
"$",
"block_id",
",",
"]",
";",
"}",
"break",
";",
"case",
"'entity_field'",
":",
"$",
"block",
"=",
"[",
"'id'",
"=>",
"$",
"module",
".",
"':'",
".",
"$",
"delta",
",",
"]",
";",
"if",
"(",
"$",
"delta",
"==",
"'node:body'",
")",
"{",
"$",
"block",
"[",
"'formatter'",
"]",
"=",
"[",
"'label'",
"=>",
"'hidden'",
",",
"'type'",
"=>",
"'text_default'",
",",
"'settings'",
"=>",
"[",
"]",
",",
"'third_party_settings'",
"=>",
"[",
"]",
",",
"]",
";",
"}",
"break",
";",
"case",
"'facet_block'",
":",
"$",
"block",
"=",
"[",
"'id'",
"=>",
"$",
"module",
".",
"':'",
".",
"$",
"delta",
",",
"]",
";",
"break",
";",
"case",
"'facets_summary_block'",
":",
"$",
"block",
"=",
"[",
"'id'",
"=>",
"$",
"module",
".",
"':'",
".",
"$",
"delta",
",",
"]",
";",
"break",
";",
"case",
"'page_title_block'",
":",
"$",
"block",
"=",
"[",
"'id'",
"=>",
"$",
"module",
",",
"]",
";",
"break",
";",
"case",
"'local_tasks_block'",
":",
"$",
"block",
"=",
"[",
"'id'",
"=>",
"$",
"module",
",",
"'primary'",
"=>",
"TRUE",
",",
"'secondary'",
"=>",
"TRUE",
",",
"]",
";",
"break",
";",
"case",
"'views_block'",
":",
"$",
"block",
"=",
"[",
"'id'",
"=>",
"$",
"module",
".",
"':'",
".",
"$",
"delta",
",",
"'views_label'",
"=>",
"''",
",",
"'items_per_page'",
"=>",
"'none'",
",",
"]",
";",
"break",
";",
"default",
":",
"break",
";",
"}",
"$",
"block",
"[",
"'label'",
"]",
"=",
"$",
"tmp_block",
"[",
"'label'",
"]",
";",
"$",
"block",
"[",
"'label_display'",
"]",
"=",
"$",
"tmp_block",
"[",
"'label_display'",
"]",
";",
"$",
"block",
"[",
"'region'",
"]",
"=",
"$",
"tmp_block",
"[",
"'region'",
"]",
";",
"$",
"block",
"[",
"'weight'",
"]",
"=",
"$",
"tmp_block",
"[",
"'weight'",
"]",
";",
"$",
"block",
"[",
"'uuid'",
"]",
"=",
"$",
"uuid",
";",
"$",
"block",
"[",
"'context_mapping'",
"]",
"=",
"[",
"]",
";",
"try",
"{",
"$",
"definition",
"=",
"$",
"this",
"->",
"blockManager",
"->",
"getDefinition",
"(",
"$",
"block",
"[",
"'id'",
"]",
")",
";",
"}",
"catch",
"(",
"PluginNotFoundException",
"$",
"e",
")",
"{",
"continue",
";",
"}",
"if",
"(",
"isset",
"(",
"$",
"definition",
"[",
"'provider'",
"]",
")",
")",
"{",
"$",
"block",
"[",
"'provider'",
"]",
"=",
"$",
"definition",
"[",
"'provider'",
"]",
";",
"}",
"if",
"(",
"isset",
"(",
"$",
"definition",
"[",
"'context'",
"]",
"[",
"'entity'",
"]",
")",
")",
"{",
"$",
"block",
"[",
"'context_mapping'",
"]",
"[",
"'entity'",
"]",
"=",
"'@panelizer.entity_context:entity'",
";",
"}",
"$",
"blocks",
"[",
"$",
"uuid",
"]",
"=",
"$",
"block",
";",
"}",
"}",
"return",
"$",
"blocks",
";",
"}"
] | {@inheritdoc} | [
"{"
] | train | https://github.com/drupalwxt/wxt/blob/f0a3730065d9dba1ffb68237e329bf575da410d4/modules/custom/wxt_ext/wxt_ext_migration/src/Plugin/migrate/process/BlockPluginId.php#L120-L236 |
drupalwxt/wxt | modules/custom/wxt_ext/wxt_ext_breadcrumb/src/Breadcrumb/TaxonomyBreadcrumbBuilder.php | TaxonomyBreadcrumbBuilder.applies | public function applies(RouteMatchInterface $route_match) {
$parameters = $route_match->getParameters()->all();
$path = trim($this->context->getPathInfo(), '/');
$path_elements = explode('/', $path);
// Content type determination.
if (!empty($path_elements[1]) && $path_elements[1] == 'taxonomy') {
if (!empty($parameters['view_id']) &&
is_object($parameters['taxonomy_term']) &&
$parameters['taxonomy_term']->getEntityTypeId() == 'taxonomy_term') {
return TRUE;
}
}
} | php | public function applies(RouteMatchInterface $route_match) {
$parameters = $route_match->getParameters()->all();
$path = trim($this->context->getPathInfo(), '/');
$path_elements = explode('/', $path);
// Content type determination.
if (!empty($path_elements[1]) && $path_elements[1] == 'taxonomy') {
if (!empty($parameters['view_id']) &&
is_object($parameters['taxonomy_term']) &&
$parameters['taxonomy_term']->getEntityTypeId() == 'taxonomy_term') {
return TRUE;
}
}
} | [
"public",
"function",
"applies",
"(",
"RouteMatchInterface",
"$",
"route_match",
")",
"{",
"$",
"parameters",
"=",
"$",
"route_match",
"->",
"getParameters",
"(",
")",
"->",
"all",
"(",
")",
";",
"$",
"path",
"=",
"trim",
"(",
"$",
"this",
"->",
"context",
"->",
"getPathInfo",
"(",
")",
",",
"'/'",
")",
";",
"$",
"path_elements",
"=",
"explode",
"(",
"'/'",
",",
"$",
"path",
")",
";",
"// Content type determination.",
"if",
"(",
"!",
"empty",
"(",
"$",
"path_elements",
"[",
"1",
"]",
")",
"&&",
"$",
"path_elements",
"[",
"1",
"]",
"==",
"'taxonomy'",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"parameters",
"[",
"'view_id'",
"]",
")",
"&&",
"is_object",
"(",
"$",
"parameters",
"[",
"'taxonomy_term'",
"]",
")",
"&&",
"$",
"parameters",
"[",
"'taxonomy_term'",
"]",
"->",
"getEntityTypeId",
"(",
")",
"==",
"'taxonomy_term'",
")",
"{",
"return",
"TRUE",
";",
"}",
"}",
"}"
] | {@inheritdoc} | [
"{"
] | train | https://github.com/drupalwxt/wxt/blob/f0a3730065d9dba1ffb68237e329bf575da410d4/modules/custom/wxt_ext/wxt_ext_breadcrumb/src/Breadcrumb/TaxonomyBreadcrumbBuilder.php#L149-L162 |
drupalwxt/wxt | modules/custom/wxt_ext/wxt_ext_queue/src/Plugin/views/argument_default/SubTaxonomyQueue.php | SubTaxonomyQueue.getArgument | public function getArgument() {
// Load default argument from taxonomy page.
if (!empty($this->options['term_page'])) {
if (($taxonomy_term = $this->routeMatch->getParameter('taxonomy_term')) && $taxonomy_term instanceof TermInterface) {
return $taxonomy_term->id();
}
}
} | php | public function getArgument() {
// Load default argument from taxonomy page.
if (!empty($this->options['term_page'])) {
if (($taxonomy_term = $this->routeMatch->getParameter('taxonomy_term')) && $taxonomy_term instanceof TermInterface) {
return $taxonomy_term->id();
}
}
} | [
"public",
"function",
"getArgument",
"(",
")",
"{",
"// Load default argument from taxonomy page.",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"options",
"[",
"'term_page'",
"]",
")",
")",
"{",
"if",
"(",
"(",
"$",
"taxonomy_term",
"=",
"$",
"this",
"->",
"routeMatch",
"->",
"getParameter",
"(",
"'taxonomy_term'",
")",
")",
"&&",
"$",
"taxonomy_term",
"instanceof",
"TermInterface",
")",
"{",
"return",
"$",
"taxonomy_term",
"->",
"id",
"(",
")",
";",
"}",
"}",
"}"
] | {@inheritdoc} | [
"{"
] | train | https://github.com/drupalwxt/wxt/blob/f0a3730065d9dba1ffb68237e329bf575da410d4/modules/custom/wxt_ext/wxt_ext_queue/src/Plugin/views/argument_default/SubTaxonomyQueue.php#L57-L64 |
drupalwxt/wxt | src/ComponentDiscovery.php | ComponentDiscovery.getAll | public function getAll() {
if (is_null($this->components)) {
$base_path = $this->getBaseComponentPath();
$filter = function (Extension $module) use ($base_path) {
return strpos($module->getPath(), $base_path) === 0;
};
$this->components = array_filter($this->discovery->scan('module'), $filter);
}
return $this->components;
} | php | public function getAll() {
if (is_null($this->components)) {
$base_path = $this->getBaseComponentPath();
$filter = function (Extension $module) use ($base_path) {
return strpos($module->getPath(), $base_path) === 0;
};
$this->components = array_filter($this->discovery->scan('module'), $filter);
}
return $this->components;
} | [
"public",
"function",
"getAll",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"components",
")",
")",
"{",
"$",
"base_path",
"=",
"$",
"this",
"->",
"getBaseComponentPath",
"(",
")",
";",
"$",
"filter",
"=",
"function",
"(",
"Extension",
"$",
"module",
")",
"use",
"(",
"$",
"base_path",
")",
"{",
"return",
"strpos",
"(",
"$",
"module",
"->",
"getPath",
"(",
")",
",",
"$",
"base_path",
")",
"===",
"0",
";",
"}",
";",
"$",
"this",
"->",
"components",
"=",
"array_filter",
"(",
"$",
"this",
"->",
"discovery",
"->",
"scan",
"(",
"'module'",
")",
",",
"$",
"filter",
")",
";",
"}",
"return",
"$",
"this",
"->",
"components",
";",
"}"
] | Returns extension objects for all WxT components.
@return Extension[]
Array of extension objects for all WxT components. | [
"Returns",
"extension",
"objects",
"for",
"all",
"WxT",
"components",
"."
] | train | https://github.com/drupalwxt/wxt/blob/f0a3730065d9dba1ffb68237e329bf575da410d4/src/ComponentDiscovery.php#L81-L92 |
drupalwxt/wxt | src/ComponentDiscovery.php | ComponentDiscovery.getMainComponents | public function getMainComponents() {
$base_path = $this->getBaseComponentPath();
$filter = function (Extension $module) use ($base_path) {
return dirname($module->getPath()) == $base_path;
};
return array_filter($this->getAll(), $filter);
} | php | public function getMainComponents() {
$base_path = $this->getBaseComponentPath();
$filter = function (Extension $module) use ($base_path) {
return dirname($module->getPath()) == $base_path;
};
return array_filter($this->getAll(), $filter);
} | [
"public",
"function",
"getMainComponents",
"(",
")",
"{",
"$",
"base_path",
"=",
"$",
"this",
"->",
"getBaseComponentPath",
"(",
")",
";",
"$",
"filter",
"=",
"function",
"(",
"Extension",
"$",
"module",
")",
"use",
"(",
"$",
"base_path",
")",
"{",
"return",
"dirname",
"(",
"$",
"module",
"->",
"getPath",
"(",
")",
")",
"==",
"$",
"base_path",
";",
"}",
";",
"return",
"array_filter",
"(",
"$",
"this",
"->",
"getAll",
"(",
")",
",",
"$",
"filter",
")",
";",
"}"
] | Returns extension objects for all main WxT components.
@return Extension[]
Array of extension objects for top-level WxT components. | [
"Returns",
"extension",
"objects",
"for",
"all",
"main",
"WxT",
"components",
"."
] | train | https://github.com/drupalwxt/wxt/blob/f0a3730065d9dba1ffb68237e329bf575da410d4/src/ComponentDiscovery.php#L100-L108 |
drupalwxt/wxt | src/ComponentDiscovery.php | ComponentDiscovery.getSubComponents | public function getSubComponents() {
$base_path = $this->getBaseComponentPath();
$filter = function (Extension $module) use ($base_path) {
return strlen(dirname($module->getPath())) > strlen($base_path);
};
return array_filter($this->getAll(), $filter);
} | php | public function getSubComponents() {
$base_path = $this->getBaseComponentPath();
$filter = function (Extension $module) use ($base_path) {
return strlen(dirname($module->getPath())) > strlen($base_path);
};
return array_filter($this->getAll(), $filter);
} | [
"public",
"function",
"getSubComponents",
"(",
")",
"{",
"$",
"base_path",
"=",
"$",
"this",
"->",
"getBaseComponentPath",
"(",
")",
";",
"$",
"filter",
"=",
"function",
"(",
"Extension",
"$",
"module",
")",
"use",
"(",
"$",
"base_path",
")",
"{",
"return",
"strlen",
"(",
"dirname",
"(",
"$",
"module",
"->",
"getPath",
"(",
")",
")",
")",
">",
"strlen",
"(",
"$",
"base_path",
")",
";",
"}",
";",
"return",
"array_filter",
"(",
"$",
"this",
"->",
"getAll",
"(",
")",
",",
"$",
"filter",
")",
";",
"}"
] | Returns extension object for all WxT sub-components.
@return Extension[]
Array of extension objects for WxT sub-components. | [
"Returns",
"extension",
"object",
"for",
"all",
"WxT",
"sub",
"-",
"components",
"."
] | train | https://github.com/drupalwxt/wxt/blob/f0a3730065d9dba1ffb68237e329bf575da410d4/src/ComponentDiscovery.php#L116-L124 |
drupalwxt/wxt | modules/custom/wxt_ext/wxt_ext_migration/src/Plugin/migrate/process/UUIDLink.php | UUIDLink.create | public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) {
// Default required migration configuration.
$migration_configuration = [
'migration' => [
'wxt_ext_db_file',
],
];
// Handle any custom migrations leveraging this plugin.
$migration_dependencies = $migration->getMigrationDependencies();
if (isset($migration_dependencies['required'])) {
foreach ($migration_dependencies['required'] as $dependency) {
if (strpos($dependency, 'node') !== FALSE) {
$migration_configuration['migration'][] = $dependency;
}
}
}
return new static(
$configuration,
$plugin_id,
$plugin_definition,
$container->get('plugin.manager.migrate.process')->createInstance('migration', $migration_configuration, $migration)
);
} | php | public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) {
// Default required migration configuration.
$migration_configuration = [
'migration' => [
'wxt_ext_db_file',
],
];
// Handle any custom migrations leveraging this plugin.
$migration_dependencies = $migration->getMigrationDependencies();
if (isset($migration_dependencies['required'])) {
foreach ($migration_dependencies['required'] as $dependency) {
if (strpos($dependency, 'node') !== FALSE) {
$migration_configuration['migration'][] = $dependency;
}
}
}
return new static(
$configuration,
$plugin_id,
$plugin_definition,
$container->get('plugin.manager.migrate.process')->createInstance('migration', $migration_configuration, $migration)
);
} | [
"public",
"static",
"function",
"create",
"(",
"ContainerInterface",
"$",
"container",
",",
"array",
"$",
"configuration",
",",
"$",
"plugin_id",
",",
"$",
"plugin_definition",
",",
"MigrationInterface",
"$",
"migration",
"=",
"NULL",
")",
"{",
"// Default required migration configuration.",
"$",
"migration_configuration",
"=",
"[",
"'migration'",
"=>",
"[",
"'wxt_ext_db_file'",
",",
"]",
",",
"]",
";",
"// Handle any custom migrations leveraging this plugin.",
"$",
"migration_dependencies",
"=",
"$",
"migration",
"->",
"getMigrationDependencies",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"migration_dependencies",
"[",
"'required'",
"]",
")",
")",
"{",
"foreach",
"(",
"$",
"migration_dependencies",
"[",
"'required'",
"]",
"as",
"$",
"dependency",
")",
"{",
"if",
"(",
"strpos",
"(",
"$",
"dependency",
",",
"'node'",
")",
"!==",
"FALSE",
")",
"{",
"$",
"migration_configuration",
"[",
"'migration'",
"]",
"[",
"]",
"=",
"$",
"dependency",
";",
"}",
"}",
"}",
"return",
"new",
"static",
"(",
"$",
"configuration",
",",
"$",
"plugin_id",
",",
"$",
"plugin_definition",
",",
"$",
"container",
"->",
"get",
"(",
"'plugin.manager.migrate.process'",
")",
"->",
"createInstance",
"(",
"'migration'",
",",
"$",
"migration_configuration",
",",
"$",
"migration",
")",
")",
";",
"}"
] | {@inheritdoc} | [
"{"
] | train | https://github.com/drupalwxt/wxt/blob/f0a3730065d9dba1ffb68237e329bf575da410d4/modules/custom/wxt_ext/wxt_ext_migration/src/Plugin/migrate/process/UUIDLink.php#L44-L68 |
drupalwxt/wxt | modules/custom/wxt_ext/wxt_ext_migration/src/Plugin/migrate/process/UUIDLink.php | UUIDLink.transform | public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {
if (!$value) {
throw new MigrateSkipProcessException();
}
$value = ' ' . $value . ' ';
$value = preg_replace_callback(
"/<a(.*?)href=\"(\[uuid-link:.*?\])\"\s?(.*?)>/i",
function ($match) use ($migrate_executable, $row, $destination_property) {
return $this->replaceToken($match, $migrate_executable, $row, $destination_property);
},
$value
);
return $value;
} | php | public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {
if (!$value) {
throw new MigrateSkipProcessException();
}
$value = ' ' . $value . ' ';
$value = preg_replace_callback(
"/<a(.*?)href=\"(\[uuid-link:.*?\])\"\s?(.*?)>/i",
function ($match) use ($migrate_executable, $row, $destination_property) {
return $this->replaceToken($match, $migrate_executable, $row, $destination_property);
},
$value
);
return $value;
} | [
"public",
"function",
"transform",
"(",
"$",
"value",
",",
"MigrateExecutableInterface",
"$",
"migrate_executable",
",",
"Row",
"$",
"row",
",",
"$",
"destination_property",
")",
"{",
"if",
"(",
"!",
"$",
"value",
")",
"{",
"throw",
"new",
"MigrateSkipProcessException",
"(",
")",
";",
"}",
"$",
"value",
"=",
"' '",
".",
"$",
"value",
".",
"' '",
";",
"$",
"value",
"=",
"preg_replace_callback",
"(",
"\"/<a(.*?)href=\\\"(\\[uuid-link:.*?\\])\\\"\\s?(.*?)>/i\"",
",",
"function",
"(",
"$",
"match",
")",
"use",
"(",
"$",
"migrate_executable",
",",
"$",
"row",
",",
"$",
"destination_property",
")",
"{",
"return",
"$",
"this",
"->",
"replaceToken",
"(",
"$",
"match",
",",
"$",
"migrate_executable",
",",
"$",
"row",
",",
"$",
"destination_property",
")",
";",
"}",
",",
"$",
"value",
")",
";",
"return",
"$",
"value",
";",
"}"
] | {@inheritdoc} | [
"{"
] | train | https://github.com/drupalwxt/wxt/blob/f0a3730065d9dba1ffb68237e329bf575da410d4/modules/custom/wxt_ext/wxt_ext_migration/src/Plugin/migrate/process/UUIDLink.php#L73-L88 |
drupalwxt/wxt | modules/custom/wxt_ext/wxt_ext_migration/src/Plugin/migrate/process/UUIDLink.php | UUIDLink.replaceToken | private function replaceToken($match, $migrate_executable, $row, $destination_property) {
$tmp = str_replace("[", "", $match[2]);
$tmp = str_replace("]", "", $tmp);
$tmp = substr($tmp, 15);
$uuid = $tmp;
$output = '';
try {
if (!is_string($uuid)) {
throw new MigrateException('Unable to grab UUID Link');
}
Database::setActiveConnection('source_migration');
$db = Database::getConnection();
$query = $db->select('node', 'n')
->fields('n')
->condition('n.uuid', $uuid);
$nid = $query->execute()->fetchCol();
Database::setActiveConnection();
// Lookup the new Node.
$nid = $this->migrationPlugin
->transform($nid[0], $migrate_executable, $row, $destination_property);
if (is_array($nid)) {
$nid = current($nid);
}
$node = Node::load($nid);
if (!$node) {
throw new MigrateException('Could not load node object');
}
// New link format.
$attrBefore = !empty($match[1]) ? $match[1] : '';
$attrAfter = !empty($match[3]) ? $match[3] : '';
$output = '
<a
data-entity-substitution="canonical"
data-entity-type="node"
data-entity-uuid="' . $node->uuid() . '"
href="/node/' . $nid . '" ' . $attrAfter . ' ' . $attrBefore . '>';
}
catch (Exception $e) {
$msg = t('Unable to render link from %link. Error: %error', ['%link' => $uuid, '%error' => $e->getMessage()]);
\Drupal::logger('Migration')->error($msg);
return '';
}
return $output;
} | php | private function replaceToken($match, $migrate_executable, $row, $destination_property) {
$tmp = str_replace("[", "", $match[2]);
$tmp = str_replace("]", "", $tmp);
$tmp = substr($tmp, 15);
$uuid = $tmp;
$output = '';
try {
if (!is_string($uuid)) {
throw new MigrateException('Unable to grab UUID Link');
}
Database::setActiveConnection('source_migration');
$db = Database::getConnection();
$query = $db->select('node', 'n')
->fields('n')
->condition('n.uuid', $uuid);
$nid = $query->execute()->fetchCol();
Database::setActiveConnection();
// Lookup the new Node.
$nid = $this->migrationPlugin
->transform($nid[0], $migrate_executable, $row, $destination_property);
if (is_array($nid)) {
$nid = current($nid);
}
$node = Node::load($nid);
if (!$node) {
throw new MigrateException('Could not load node object');
}
// New link format.
$attrBefore = !empty($match[1]) ? $match[1] : '';
$attrAfter = !empty($match[3]) ? $match[3] : '';
$output = '
<a
data-entity-substitution="canonical"
data-entity-type="node"
data-entity-uuid="' . $node->uuid() . '"
href="/node/' . $nid . '" ' . $attrAfter . ' ' . $attrBefore . '>';
}
catch (Exception $e) {
$msg = t('Unable to render link from %link. Error: %error', ['%link' => $uuid, '%error' => $e->getMessage()]);
\Drupal::logger('Migration')->error($msg);
return '';
}
return $output;
} | [
"private",
"function",
"replaceToken",
"(",
"$",
"match",
",",
"$",
"migrate_executable",
",",
"$",
"row",
",",
"$",
"destination_property",
")",
"{",
"$",
"tmp",
"=",
"str_replace",
"(",
"\"[\"",
",",
"\"\"",
",",
"$",
"match",
"[",
"2",
"]",
")",
";",
"$",
"tmp",
"=",
"str_replace",
"(",
"\"]\"",
",",
"\"\"",
",",
"$",
"tmp",
")",
";",
"$",
"tmp",
"=",
"substr",
"(",
"$",
"tmp",
",",
"15",
")",
";",
"$",
"uuid",
"=",
"$",
"tmp",
";",
"$",
"output",
"=",
"''",
";",
"try",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"uuid",
")",
")",
"{",
"throw",
"new",
"MigrateException",
"(",
"'Unable to grab UUID Link'",
")",
";",
"}",
"Database",
"::",
"setActiveConnection",
"(",
"'source_migration'",
")",
";",
"$",
"db",
"=",
"Database",
"::",
"getConnection",
"(",
")",
";",
"$",
"query",
"=",
"$",
"db",
"->",
"select",
"(",
"'node'",
",",
"'n'",
")",
"->",
"fields",
"(",
"'n'",
")",
"->",
"condition",
"(",
"'n.uuid'",
",",
"$",
"uuid",
")",
";",
"$",
"nid",
"=",
"$",
"query",
"->",
"execute",
"(",
")",
"->",
"fetchCol",
"(",
")",
";",
"Database",
"::",
"setActiveConnection",
"(",
")",
";",
"// Lookup the new Node.",
"$",
"nid",
"=",
"$",
"this",
"->",
"migrationPlugin",
"->",
"transform",
"(",
"$",
"nid",
"[",
"0",
"]",
",",
"$",
"migrate_executable",
",",
"$",
"row",
",",
"$",
"destination_property",
")",
";",
"if",
"(",
"is_array",
"(",
"$",
"nid",
")",
")",
"{",
"$",
"nid",
"=",
"current",
"(",
"$",
"nid",
")",
";",
"}",
"$",
"node",
"=",
"Node",
"::",
"load",
"(",
"$",
"nid",
")",
";",
"if",
"(",
"!",
"$",
"node",
")",
"{",
"throw",
"new",
"MigrateException",
"(",
"'Could not load node object'",
")",
";",
"}",
"// New link format.",
"$",
"attrBefore",
"=",
"!",
"empty",
"(",
"$",
"match",
"[",
"1",
"]",
")",
"?",
"$",
"match",
"[",
"1",
"]",
":",
"''",
";",
"$",
"attrAfter",
"=",
"!",
"empty",
"(",
"$",
"match",
"[",
"3",
"]",
")",
"?",
"$",
"match",
"[",
"3",
"]",
":",
"''",
";",
"$",
"output",
"=",
"'\n <a\n data-entity-substitution=\"canonical\"\n data-entity-type=\"node\"\n data-entity-uuid=\"'",
".",
"$",
"node",
"->",
"uuid",
"(",
")",
".",
"'\"\n href=\"/node/'",
".",
"$",
"nid",
".",
"'\" '",
".",
"$",
"attrAfter",
".",
"' '",
".",
"$",
"attrBefore",
".",
"'>'",
";",
"}",
"catch",
"(",
"Exception",
"$",
"e",
")",
"{",
"$",
"msg",
"=",
"t",
"(",
"'Unable to render link from %link. Error: %error'",
",",
"[",
"'%link'",
"=>",
"$",
"uuid",
",",
"'%error'",
"=>",
"$",
"e",
"->",
"getMessage",
"(",
")",
"]",
")",
";",
"\\",
"Drupal",
"::",
"logger",
"(",
"'Migration'",
")",
"->",
"error",
"(",
"$",
"msg",
")",
";",
"return",
"''",
";",
"}",
"return",
"$",
"output",
";",
"}"
] | Replace callback to convert a Drupal 7 UUID link into a Drupal 8 UUID Link.
@param string $match
Takes a match of tag code
@param \Drupal\migrate\MigrateExecutableInterface $migrate_executable
The migrate executable helper class.
@param \Drupal\migrate\Row $row
The current row after processing.
@param string $destination_property
The destination propery. | [
"Replace",
"callback",
"to",
"convert",
"a",
"Drupal",
"7",
"UUID",
"link",
"into",
"a",
"Drupal",
"8",
"UUID",
"Link",
"."
] | train | https://github.com/drupalwxt/wxt/blob/f0a3730065d9dba1ffb68237e329bf575da410d4/modules/custom/wxt_ext/wxt_ext_migration/src/Plugin/migrate/process/UUIDLink.php#L102-L152 |
drupalwxt/wxt | modules/custom/wxt_core/src/Controller/WxTHttp4xxController.php | WxTHttp4xxController.on404 | public function on404() {
// 404 Fallback message.
$response = '
<div class="box">
<div class="row">
<div class="col-xs-3 col-sm-2 col-md-2 text-center mrgn-tp-md">
<span class="glyphicon glyphicon-warning-sign glyphicon-error"></span>
</div>
<div class="col-xs-9 col-sm-10 col-md-10">
<h2 class="mrgn-tp-md">' . $this->t('We couldn\'t find that Web page') . '</h2>
<p class="pagetag"><strong>' . $this->t('Error 404') . '</strong></p>
</div>
</div>
<p class="mrgn-tp-md">' . $this->t('We\'re sorry you ended up here. Sometimes a page gets moved or deleted.') . '</p>
</div>';
// Lookup our custom 404 content block.
$block_id = $this->blockContentStorage->loadByProperties([
'info' => '404',
'type' => 'basic',
]);
if (!empty($block_id)) {
$response = $this->blockViewBuilder->view(reset($block_id));
}
return [
'#type' => 'container',
'#markup' => render($response),
'#attributes' => [
'class' => '404 error',
],
'#weight' => 0,
];
} | php | public function on404() {
// 404 Fallback message.
$response = '
<div class="box">
<div class="row">
<div class="col-xs-3 col-sm-2 col-md-2 text-center mrgn-tp-md">
<span class="glyphicon glyphicon-warning-sign glyphicon-error"></span>
</div>
<div class="col-xs-9 col-sm-10 col-md-10">
<h2 class="mrgn-tp-md">' . $this->t('We couldn\'t find that Web page') . '</h2>
<p class="pagetag"><strong>' . $this->t('Error 404') . '</strong></p>
</div>
</div>
<p class="mrgn-tp-md">' . $this->t('We\'re sorry you ended up here. Sometimes a page gets moved or deleted.') . '</p>
</div>';
// Lookup our custom 404 content block.
$block_id = $this->blockContentStorage->loadByProperties([
'info' => '404',
'type' => 'basic',
]);
if (!empty($block_id)) {
$response = $this->blockViewBuilder->view(reset($block_id));
}
return [
'#type' => 'container',
'#markup' => render($response),
'#attributes' => [
'class' => '404 error',
],
'#weight' => 0,
];
} | [
"public",
"function",
"on404",
"(",
")",
"{",
"// 404 Fallback message.",
"$",
"response",
"=",
"'\n <div class=\"box\">\n <div class=\"row\">\n <div class=\"col-xs-3 col-sm-2 col-md-2 text-center mrgn-tp-md\">\n <span class=\"glyphicon glyphicon-warning-sign glyphicon-error\"></span>\n </div>\n <div class=\"col-xs-9 col-sm-10 col-md-10\">\n <h2 class=\"mrgn-tp-md\">'",
".",
"$",
"this",
"->",
"t",
"(",
"'We couldn\\'t find that Web page'",
")",
".",
"'</h2>\n <p class=\"pagetag\"><strong>'",
".",
"$",
"this",
"->",
"t",
"(",
"'Error 404'",
")",
".",
"'</strong></p>\n </div>\n </div>\n <p class=\"mrgn-tp-md\">'",
".",
"$",
"this",
"->",
"t",
"(",
"'We\\'re sorry you ended up here. Sometimes a page gets moved or deleted.'",
")",
".",
"'</p>\n </div>'",
";",
"// Lookup our custom 404 content block.",
"$",
"block_id",
"=",
"$",
"this",
"->",
"blockContentStorage",
"->",
"loadByProperties",
"(",
"[",
"'info'",
"=>",
"'404'",
",",
"'type'",
"=>",
"'basic'",
",",
"]",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"block_id",
")",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"blockViewBuilder",
"->",
"view",
"(",
"reset",
"(",
"$",
"block_id",
")",
")",
";",
"}",
"return",
"[",
"'#type'",
"=>",
"'container'",
",",
"'#markup'",
"=>",
"render",
"(",
"$",
"response",
")",
",",
"'#attributes'",
"=>",
"[",
"'class'",
"=>",
"'404 error'",
",",
"]",
",",
"'#weight'",
"=>",
"0",
",",
"]",
";",
"}"
] | The default 404 content.
@return array
A render array containing the message to display for 404 pages. | [
"The",
"default",
"404",
"content",
"."
] | train | https://github.com/drupalwxt/wxt/blob/f0a3730065d9dba1ffb68237e329bf575da410d4/modules/custom/wxt_core/src/Controller/WxTHttp4xxController.php#L59-L93 |
drupalwxt/wxt | modules/custom/wxt_ext/wxt_ext_queue/src/Plugin/views/argument_default/SubNodeQueue.php | SubNodeQueue.getArgument | public function getArgument() {
// Use the argument_default_node plugin to get the nid argument.
$nid = parent::getArgument();
if (!empty($nid)) {
$node = $this->nodeStorage->load($nid);
if ($node->hasField('field_queue')) {
return $node->get('field_queue')->getString();
}
}
} | php | public function getArgument() {
// Use the argument_default_node plugin to get the nid argument.
$nid = parent::getArgument();
if (!empty($nid)) {
$node = $this->nodeStorage->load($nid);
if ($node->hasField('field_queue')) {
return $node->get('field_queue')->getString();
}
}
} | [
"public",
"function",
"getArgument",
"(",
")",
"{",
"// Use the argument_default_node plugin to get the nid argument.",
"$",
"nid",
"=",
"parent",
"::",
"getArgument",
"(",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"nid",
")",
")",
"{",
"$",
"node",
"=",
"$",
"this",
"->",
"nodeStorage",
"->",
"load",
"(",
"$",
"nid",
")",
";",
"if",
"(",
"$",
"node",
"->",
"hasField",
"(",
"'field_queue'",
")",
")",
"{",
"return",
"$",
"node",
"->",
"get",
"(",
"'field_queue'",
")",
"->",
"getString",
"(",
")",
";",
"}",
"}",
"}"
] | {@inheritdoc} | [
"{"
] | train | https://github.com/drupalwxt/wxt/blob/f0a3730065d9dba1ffb68237e329bf575da410d4/modules/custom/wxt_ext/wxt_ext_queue/src/Plugin/views/argument_default/SubNodeQueue.php#L62-L71 |
drupalwxt/wxt | src/Composer/ReleaseVersion.php | ReleaseVersion.execute | public static function execute(Event $event) {
$arguments = $event->getArguments();
$version = reset($arguments);
static::updateMakeFile($version);
// Find all .info files in WxT...except in the installed code base.
$finder = (new Finder())
->name('*.info.yml')
->in('.')
->exclude('html');
/** @var \Symfony\Component\Finder\SplFileInfo $info_file */
foreach ($finder as $info_file) {
$info = Yaml::parse($info_file->getContents());
// Wrapping the version number in << and >> will cause the dumper to quote
// the string, which is necessary for compliance with the strict PECL
// parser.
$info['version'] = '<<' . $version . '>>';
$info = Yaml::dump($info, 2, 2);
// Now that the version number will be quoted, strip out the << and >>
// escape sequence.
$info = str_replace(['<<', '>>'], NULL, $info);
file_put_contents($info_file->getPathname(), $info);
}
} | php | public static function execute(Event $event) {
$arguments = $event->getArguments();
$version = reset($arguments);
static::updateMakeFile($version);
// Find all .info files in WxT...except in the installed code base.
$finder = (new Finder())
->name('*.info.yml')
->in('.')
->exclude('html');
/** @var \Symfony\Component\Finder\SplFileInfo $info_file */
foreach ($finder as $info_file) {
$info = Yaml::parse($info_file->getContents());
// Wrapping the version number in << and >> will cause the dumper to quote
// the string, which is necessary for compliance with the strict PECL
// parser.
$info['version'] = '<<' . $version . '>>';
$info = Yaml::dump($info, 2, 2);
// Now that the version number will be quoted, strip out the << and >>
// escape sequence.
$info = str_replace(['<<', '>>'], NULL, $info);
file_put_contents($info_file->getPathname(), $info);
}
} | [
"public",
"static",
"function",
"execute",
"(",
"Event",
"$",
"event",
")",
"{",
"$",
"arguments",
"=",
"$",
"event",
"->",
"getArguments",
"(",
")",
";",
"$",
"version",
"=",
"reset",
"(",
"$",
"arguments",
")",
";",
"static",
"::",
"updateMakeFile",
"(",
"$",
"version",
")",
";",
"// Find all .info files in WxT...except in the installed code base.",
"$",
"finder",
"=",
"(",
"new",
"Finder",
"(",
")",
")",
"->",
"name",
"(",
"'*.info.yml'",
")",
"->",
"in",
"(",
"'.'",
")",
"->",
"exclude",
"(",
"'html'",
")",
";",
"/** @var \\Symfony\\Component\\Finder\\SplFileInfo $info_file */",
"foreach",
"(",
"$",
"finder",
"as",
"$",
"info_file",
")",
"{",
"$",
"info",
"=",
"Yaml",
"::",
"parse",
"(",
"$",
"info_file",
"->",
"getContents",
"(",
")",
")",
";",
"// Wrapping the version number in << and >> will cause the dumper to quote",
"// the string, which is necessary for compliance with the strict PECL",
"// parser.",
"$",
"info",
"[",
"'version'",
"]",
"=",
"'<<'",
".",
"$",
"version",
".",
"'>>'",
";",
"$",
"info",
"=",
"Yaml",
"::",
"dump",
"(",
"$",
"info",
",",
"2",
",",
"2",
")",
";",
"// Now that the version number will be quoted, strip out the << and >>",
"// escape sequence.",
"$",
"info",
"=",
"str_replace",
"(",
"[",
"'<<'",
",",
"'>>'",
"]",
",",
"NULL",
",",
"$",
"info",
")",
";",
"file_put_contents",
"(",
"$",
"info_file",
"->",
"getPathname",
"(",
")",
",",
"$",
"info",
")",
";",
"}",
"}"
] | Script entry point.
@param \Composer\Script\Event $event
The script event. | [
"Script",
"entry",
"point",
"."
] | train | https://github.com/drupalwxt/wxt/blob/f0a3730065d9dba1ffb68237e329bf575da410d4/src/Composer/ReleaseVersion.php#L21-L48 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.