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 |
|---|---|---|---|---|---|---|---|---|---|---|
snc/SncRedisBundle | DependencyInjection/Compiler/ClientLocatorPass.php | ClientLocatorPass.createClientLocatorDefinition | private function createClientLocatorDefinition(ContainerBuilder $container, array $clients): Definition
{
$clientLocatorDefinition = new Definition(ServiceLocator::class, [$clients]);
$clientLocatorDefinition->setPrivate(true);
$container->addDefinitions([$clientLocatorDefinition]);
... | php | private function createClientLocatorDefinition(ContainerBuilder $container, array $clients): Definition
{
$clientLocatorDefinition = new Definition(ServiceLocator::class, [$clients]);
$clientLocatorDefinition->setPrivate(true);
$container->addDefinitions([$clientLocatorDefinition]);
... | [
"private",
"function",
"createClientLocatorDefinition",
"(",
"ContainerBuilder",
"$",
"container",
",",
"array",
"$",
"clients",
")",
":",
"Definition",
"{",
"$",
"clientLocatorDefinition",
"=",
"new",
"Definition",
"(",
"ServiceLocator",
"::",
"class",
",",
"[",
... | @param \Symfony\Component\DependencyInjection\ContainerBuilder $container
@param array $clients
@return \Symfony\Component\DependencyInjection\Definition | [
"@param",
"\\",
"Symfony",
"\\",
"Component",
"\\",
"DependencyInjection",
"\\",
"ContainerBuilder",
"$container",
"@param",
"array",
"$clients"
] | train | https://github.com/snc/SncRedisBundle/blob/19cd0192e4b68ddd0ba1e1be3113b98dcce8fcb2/DependencyInjection/Compiler/ClientLocatorPass.php#L94-L102 |
snc/SncRedisBundle | Factory/PhpredisClientFactory.php | PhpredisClientFactory.create | public function create($class, $dsn, $options, $alias)
{
if (!is_a($class, '\Redis', true)) {
throw new \RuntimeException(sprintf('The factory can only instantiate \Redis classes: %s asked', $class));
}
$client = $this->createClient($class, $alias);
$parsedDsn... | php | public function create($class, $dsn, $options, $alias)
{
if (!is_a($class, '\Redis', true)) {
throw new \RuntimeException(sprintf('The factory can only instantiate \Redis classes: %s asked', $class));
}
$client = $this->createClient($class, $alias);
$parsedDsn... | [
"public",
"function",
"create",
"(",
"$",
"class",
",",
"$",
"dsn",
",",
"$",
"options",
",",
"$",
"alias",
")",
"{",
"if",
"(",
"!",
"is_a",
"(",
"$",
"class",
",",
"'\\Redis'",
",",
"true",
")",
")",
"{",
"throw",
"new",
"\\",
"RuntimeException",... | @param string $class Redis class to instantiate
@param string $dsn One DSN string
@param array $options Options provided in bundle client config
@param string $alias Connection alias provided in bundle client config
@return \Redis|Client
@throws InvalidConfigurationException | [
"@param",
"string",
"$class",
"Redis",
"class",
"to",
"instantiate",
"@param",
"string",
"$dsn",
"One",
"DSN",
"string",
"@param",
"array",
"$options",
"Options",
"provided",
"in",
"bundle",
"client",
"config",
"@param",
"string",
"$alias",
"Connection",
"alias",
... | train | https://github.com/snc/SncRedisBundle/blob/19cd0192e4b68ddd0ba1e1be3113b98dcce8fcb2/Factory/PhpredisClientFactory.php#L34-L90 |
snc/SncRedisBundle | Factory/PhpredisClientFactory.php | PhpredisClientFactory.createClient | private function createClient($class, $alias)
{
if (is_a($class, '\Snc\RedisBundle\Client\Phpredis\Client', true)) {
$client = new $class(array('alias' => $alias), $this->logger);
} else {
$client = new $class();
}
return $client;
} | php | private function createClient($class, $alias)
{
if (is_a($class, '\Snc\RedisBundle\Client\Phpredis\Client', true)) {
$client = new $class(array('alias' => $alias), $this->logger);
} else {
$client = new $class();
}
return $client;
} | [
"private",
"function",
"createClient",
"(",
"$",
"class",
",",
"$",
"alias",
")",
"{",
"if",
"(",
"is_a",
"(",
"$",
"class",
",",
"'\\Snc\\RedisBundle\\Client\\Phpredis\\Client'",
",",
"true",
")",
")",
"{",
"$",
"client",
"=",
"new",
"$",
"class",
"(",
... | @param string $class Redis class to instantiate
@param string $alias Connection alias provided in bundle client config
@return \Redis|Client | [
"@param",
"string",
"$class",
"Redis",
"class",
"to",
"instantiate",
"@param",
"string",
"$alias",
"Connection",
"alias",
"provided",
"in",
"bundle",
"client",
"config"
] | train | https://github.com/snc/SncRedisBundle/blob/19cd0192e4b68ddd0ba1e1be3113b98dcce8fcb2/Factory/PhpredisClientFactory.php#L98-L107 |
snc/SncRedisBundle | Extra/RateLimit.php | RateLimit.increment | public function increment($subject)
{
$bucket = $this->getBucket();
$subject = $this->key.':'.$subject;
$multi = $this->client->transaction();
$this->addMultiExecIncrement($multi, $subject, $bucket);
$multi->exec();
} | php | public function increment($subject)
{
$bucket = $this->getBucket();
$subject = $this->key.':'.$subject;
$multi = $this->client->transaction();
$this->addMultiExecIncrement($multi, $subject, $bucket);
$multi->exec();
} | [
"public",
"function",
"increment",
"(",
"$",
"subject",
")",
"{",
"$",
"bucket",
"=",
"$",
"this",
"->",
"getBucket",
"(",
")",
";",
"$",
"subject",
"=",
"$",
"this",
"->",
"key",
".",
"':'",
".",
"$",
"subject",
";",
"$",
"multi",
"=",
"$",
"thi... | Increment the count for the specified subject.
@param string $subject A unique identifier, for example a session id or an IP | [
"Increment",
"the",
"count",
"for",
"the",
"specified",
"subject",
"."
] | train | https://github.com/snc/SncRedisBundle/blob/19cd0192e4b68ddd0ba1e1be3113b98dcce8fcb2/Extra/RateLimit.php#L91-L99 |
snc/SncRedisBundle | Extra/RateLimit.php | RateLimit.count | public function count($subject, $interval)
{
$bucket = $this->getBucket();
$subject = $this->key.':'.$subject;
$count = (int) floor($interval / $this->bucketInterval);
$multi = $this->client->transaction();
$this->addMultiExecCount($multi, $subject, $bucket, $count);
... | php | public function count($subject, $interval)
{
$bucket = $this->getBucket();
$subject = $this->key.':'.$subject;
$count = (int) floor($interval / $this->bucketInterval);
$multi = $this->client->transaction();
$this->addMultiExecCount($multi, $subject, $bucket, $count);
... | [
"public",
"function",
"count",
"(",
"$",
"subject",
",",
"$",
"interval",
")",
"{",
"$",
"bucket",
"=",
"$",
"this",
"->",
"getBucket",
"(",
")",
";",
"$",
"subject",
"=",
"$",
"this",
"->",
"key",
".",
"':'",
".",
"$",
"subject",
";",
"$",
"coun... | Count the number of times the subject has performed an action in the last `$interval` seconds.
@param string $subject A unique identifier, for example a session id or an IP
@param int $interval Interval in seconds
@return int | [
"Count",
"the",
"number",
"of",
"times",
"the",
"subject",
"has",
"performed",
"an",
"action",
"in",
"the",
"last",
"$interval",
"seconds",
"."
] | train | https://github.com/snc/SncRedisBundle/blob/19cd0192e4b68ddd0ba1e1be3113b98dcce8fcb2/Extra/RateLimit.php#L109-L118 |
snc/SncRedisBundle | Extra/RateLimit.php | RateLimit.reset | public function reset($subject)
{
$subject = $this->key.':'.$subject;
return (bool) $this->client->del($subject);
} | php | public function reset($subject)
{
$subject = $this->key.':'.$subject;
return (bool) $this->client->del($subject);
} | [
"public",
"function",
"reset",
"(",
"$",
"subject",
")",
"{",
"$",
"subject",
"=",
"$",
"this",
"->",
"key",
".",
"':'",
".",
"$",
"subject",
";",
"return",
"(",
"bool",
")",
"$",
"this",
"->",
"client",
"->",
"del",
"(",
"$",
"subject",
")",
";"... | Resets the counter for the specified subject.
@param string $subject A unique identifier, for example a session id or an IP
@return bool | [
"Resets",
"the",
"counter",
"for",
"the",
"specified",
"subject",
"."
] | train | https://github.com/snc/SncRedisBundle/blob/19cd0192e4b68ddd0ba1e1be3113b98dcce8fcb2/Extra/RateLimit.php#L147-L152 |
snc/SncRedisBundle | Extra/RateLimit.php | RateLimit.getBucket | private function getBucket($time = null)
{
$time = $time ?: time();
return (int) floor(($time % $this->bucketSpan) / $this->bucketInterval);
} | php | private function getBucket($time = null)
{
$time = $time ?: time();
return (int) floor(($time % $this->bucketSpan) / $this->bucketInterval);
} | [
"private",
"function",
"getBucket",
"(",
"$",
"time",
"=",
"null",
")",
"{",
"$",
"time",
"=",
"$",
"time",
"?",
":",
"time",
"(",
")",
";",
"return",
"(",
"int",
")",
"floor",
"(",
"(",
"$",
"time",
"%",
"$",
"this",
"->",
"bucketSpan",
")",
"... | Get the bucket associated with the current time.
@param int $time (optional) - default is the current time (seconds since epoch)
@return int bucket | [
"Get",
"the",
"bucket",
"associated",
"with",
"the",
"current",
"time",
"."
] | train | https://github.com/snc/SncRedisBundle/blob/19cd0192e4b68ddd0ba1e1be3113b98dcce8fcb2/Extra/RateLimit.php#L161-L166 |
snc/SncRedisBundle | Extra/RateLimit.php | RateLimit.addMultiExecIncrement | private function addMultiExecIncrement(MultiExec $multi, $subject, $bucket)
{
// Increment the current bucket
$multi->hincrby($subject, $bucket, 1);
// Clear the buckets ahead
$multi->hdel($subject, ($bucket + 1) % $this->bucketCount)->hdel($subject, ($bucket + 2) % $this->bucketCoun... | php | private function addMultiExecIncrement(MultiExec $multi, $subject, $bucket)
{
// Increment the current bucket
$multi->hincrby($subject, $bucket, 1);
// Clear the buckets ahead
$multi->hdel($subject, ($bucket + 1) % $this->bucketCount)->hdel($subject, ($bucket + 2) % $this->bucketCoun... | [
"private",
"function",
"addMultiExecIncrement",
"(",
"MultiExec",
"$",
"multi",
",",
"$",
"subject",
",",
"$",
"bucket",
")",
"{",
"// Increment the current bucket",
"$",
"multi",
"->",
"hincrby",
"(",
"$",
"subject",
",",
"$",
"bucket",
",",
"1",
")",
";",
... | Adds the commands needed for the increment function.
@param MultiExec $multi A MultiExec instance
@param string $subject A unique identifier, for example a session id or an IP
@param int $bucket Bucket | [
"Adds",
"the",
"commands",
"needed",
"for",
"the",
"increment",
"function",
"."
] | train | https://github.com/snc/SncRedisBundle/blob/19cd0192e4b68ddd0ba1e1be3113b98dcce8fcb2/Extra/RateLimit.php#L175-L183 |
snc/SncRedisBundle | Extra/RateLimit.php | RateLimit.addMultiExecCount | private function addMultiExecCount(MultiExec $multi, $subject, $bucket, $count)
{
// Get the counts from the previous `$count` buckets
$multi->hget($subject, $bucket);
while ($count--) {
$multi->hget($subject, (--$bucket + $this->bucketCount) % $this->bucketCount);
}
... | php | private function addMultiExecCount(MultiExec $multi, $subject, $bucket, $count)
{
// Get the counts from the previous `$count` buckets
$multi->hget($subject, $bucket);
while ($count--) {
$multi->hget($subject, (--$bucket + $this->bucketCount) % $this->bucketCount);
}
... | [
"private",
"function",
"addMultiExecCount",
"(",
"MultiExec",
"$",
"multi",
",",
"$",
"subject",
",",
"$",
"bucket",
",",
"$",
"count",
")",
"{",
"// Get the counts from the previous `$count` buckets",
"$",
"multi",
"->",
"hget",
"(",
"$",
"subject",
",",
"$",
... | Adds the commands needed for the count function.
@param MultiExec $multi A MultiExec instance
@param string $subject A unique identifier, for example a session id or an IP
@param int $bucket Bucket
@param int $count Count | [
"Adds",
"the",
"commands",
"needed",
"for",
"the",
"count",
"function",
"."
] | train | https://github.com/snc/SncRedisBundle/blob/19cd0192e4b68ddd0ba1e1be3113b98dcce8fcb2/Extra/RateLimit.php#L193-L200 |
snc/SncRedisBundle | DependencyInjection/Compiler/MonologPass.php | MonologPass.process | public function process(ContainerBuilder $container)
{
if ($container->hasDefinition(self::SERVICE_ID)) {
if (!$container->hasExtension('monolog')) {
throw new LogicException('SncRedisBundle Monolog integration needs the MonologBundle to be installed');
}
... | php | public function process(ContainerBuilder $container)
{
if ($container->hasDefinition(self::SERVICE_ID)) {
if (!$container->hasExtension('monolog')) {
throw new LogicException('SncRedisBundle Monolog integration needs the MonologBundle to be installed');
}
... | [
"public",
"function",
"process",
"(",
"ContainerBuilder",
"$",
"container",
")",
"{",
"if",
"(",
"$",
"container",
"->",
"hasDefinition",
"(",
"self",
"::",
"SERVICE_ID",
")",
")",
"{",
"if",
"(",
"!",
"$",
"container",
"->",
"hasExtension",
"(",
"'monolog... | {@inheritdoc} | [
"{"
] | train | https://github.com/snc/SncRedisBundle/blob/19cd0192e4b68ddd0ba1e1be3113b98dcce8fcb2/DependencyInjection/Compiler/MonologPass.php#L26-L51 |
snc/SncRedisBundle | Client/Predis/Connection/ConnectionFactory.php | ConnectionFactory.create | public function create($parameters)
{
if (isset($parameters->parameters)) {
$this->setDefaultParameters($parameters->parameters);
}
/** @var ConnectionWrapper $connection */
$connection = parent::create($parameters);
if ($connection->getParameters()->logging) {
... | php | public function create($parameters)
{
if (isset($parameters->parameters)) {
$this->setDefaultParameters($parameters->parameters);
}
/** @var ConnectionWrapper $connection */
$connection = parent::create($parameters);
if ($connection->getParameters()->logging) {
... | [
"public",
"function",
"create",
"(",
"$",
"parameters",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"parameters",
"->",
"parameters",
")",
")",
"{",
"$",
"this",
"->",
"setDefaultParameters",
"(",
"$",
"parameters",
"->",
"parameters",
")",
";",
"}",
"/** @v... | {@inheritdoc} | [
"{"
] | train | https://github.com/snc/SncRedisBundle/blob/19cd0192e4b68ddd0ba1e1be3113b98dcce8fcb2/Client/Predis/Connection/ConnectionFactory.php#L56-L73 |
snc/SncRedisBundle | SwiftMailer/RedisSpool6.php | RedisSpool6.queueMessage | public function queueMessage(\Swift_Mime_SimpleMessage $message)
{
$this->redis->rpush($this->key, serialize($message));
return true;
} | php | public function queueMessage(\Swift_Mime_SimpleMessage $message)
{
$this->redis->rpush($this->key, serialize($message));
return true;
} | [
"public",
"function",
"queueMessage",
"(",
"\\",
"Swift_Mime_SimpleMessage",
"$",
"message",
")",
"{",
"$",
"this",
"->",
"redis",
"->",
"rpush",
"(",
"$",
"this",
"->",
"key",
",",
"serialize",
"(",
"$",
"message",
")",
")",
";",
"return",
"true",
";",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/snc/SncRedisBundle/blob/19cd0192e4b68ddd0ba1e1be3113b98dcce8fcb2/SwiftMailer/RedisSpool6.php#L22-L27 |
snc/SncRedisBundle | DependencyInjection/Configuration/Configuration.php | Configuration.getConfigTreeBuilder | public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder('snc_redis');
if (method_exists($treeBuilder, 'getRootNode')) {
$rootNode = $treeBuilder->getRootNode();
} else {
// BC layer for symfony/config 4.1 and older
$rootNode = $treeBuilder... | php | public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder('snc_redis');
if (method_exists($treeBuilder, 'getRootNode')) {
$rootNode = $treeBuilder->getRootNode();
} else {
// BC layer for symfony/config 4.1 and older
$rootNode = $treeBuilder... | [
"public",
"function",
"getConfigTreeBuilder",
"(",
")",
"{",
"$",
"treeBuilder",
"=",
"new",
"TreeBuilder",
"(",
"'snc_redis'",
")",
";",
"if",
"(",
"method_exists",
"(",
"$",
"treeBuilder",
",",
"'getRootNode'",
")",
")",
"{",
"$",
"rootNode",
"=",
"$",
"... | Generates the configuration tree builder.
@return TreeBuilder The tree builder | [
"Generates",
"the",
"configuration",
"tree",
"builder",
"."
] | train | https://github.com/snc/SncRedisBundle/blob/19cd0192e4b68ddd0ba1e1be3113b98dcce8fcb2/DependencyInjection/Configuration/Configuration.php#L38-L79 |
snc/SncRedisBundle | DependencyInjection/Configuration/Configuration.php | Configuration.addClientsSection | private function addClientsSection(ArrayNodeDefinition $rootNode)
{
$loggingDefault = (version_compare(phpversion('redis'), '4.0.0') >= 0 ? false : $this->debug);
$rootNode
->fixXmlConfig('client')
->children()
->arrayNode('clients')
->use... | php | private function addClientsSection(ArrayNodeDefinition $rootNode)
{
$loggingDefault = (version_compare(phpversion('redis'), '4.0.0') >= 0 ? false : $this->debug);
$rootNode
->fixXmlConfig('client')
->children()
->arrayNode('clients')
->use... | [
"private",
"function",
"addClientsSection",
"(",
"ArrayNodeDefinition",
"$",
"rootNode",
")",
"{",
"$",
"loggingDefault",
"=",
"(",
"version_compare",
"(",
"phpversion",
"(",
"'redis'",
")",
",",
"'4.0.0'",
")",
">=",
"0",
"?",
"false",
":",
"$",
"this",
"->... | Adds the snc_redis.clients configuration
@param ArrayNodeDefinition $rootNode | [
"Adds",
"the",
"snc_redis",
".",
"clients",
"configuration"
] | train | https://github.com/snc/SncRedisBundle/blob/19cd0192e4b68ddd0ba1e1be3113b98dcce8fcb2/DependencyInjection/Configuration/Configuration.php#L86-L155 |
snc/SncRedisBundle | DependencyInjection/Configuration/Configuration.php | Configuration.addSessionSection | private function addSessionSection(ArrayNodeDefinition $rootNode)
{
$rootNode
->children()
->arrayNode('session')
->canBeUnset()
->children()
->scalarNode('client')->isRequired()->end()
->scal... | php | private function addSessionSection(ArrayNodeDefinition $rootNode)
{
$rootNode
->children()
->arrayNode('session')
->canBeUnset()
->children()
->scalarNode('client')->isRequired()->end()
->scal... | [
"private",
"function",
"addSessionSection",
"(",
"ArrayNodeDefinition",
"$",
"rootNode",
")",
"{",
"$",
"rootNode",
"->",
"children",
"(",
")",
"->",
"arrayNode",
"(",
"'session'",
")",
"->",
"canBeUnset",
"(",
")",
"->",
"children",
"(",
")",
"->",
"scalarN... | Adds the snc_redis.session configuration
@param ArrayNodeDefinition $rootNode | [
"Adds",
"the",
"snc_redis",
".",
"session",
"configuration"
] | train | https://github.com/snc/SncRedisBundle/blob/19cd0192e4b68ddd0ba1e1be3113b98dcce8fcb2/DependencyInjection/Configuration/Configuration.php#L162-L177 |
snc/SncRedisBundle | DependencyInjection/Configuration/Configuration.php | Configuration.addDoctrineSection | private function addDoctrineSection(ArrayNodeDefinition $rootNode)
{
$doctrineNode = $rootNode->children()->arrayNode('doctrine')->canBeUnset();
foreach (array('metadata_cache', 'result_cache', 'query_cache', 'second_level_cache') as $type) {
$doctrineNode
->children()
... | php | private function addDoctrineSection(ArrayNodeDefinition $rootNode)
{
$doctrineNode = $rootNode->children()->arrayNode('doctrine')->canBeUnset();
foreach (array('metadata_cache', 'result_cache', 'query_cache', 'second_level_cache') as $type) {
$doctrineNode
->children()
... | [
"private",
"function",
"addDoctrineSection",
"(",
"ArrayNodeDefinition",
"$",
"rootNode",
")",
"{",
"$",
"doctrineNode",
"=",
"$",
"rootNode",
"->",
"children",
"(",
")",
"->",
"arrayNode",
"(",
"'doctrine'",
")",
"->",
"canBeUnset",
"(",
")",
";",
"foreach",
... | Adds the snc_redis.doctrine configuration
@param ArrayNodeDefinition $rootNode | [
"Adds",
"the",
"snc_redis",
".",
"doctrine",
"configuration"
] | train | https://github.com/snc/SncRedisBundle/blob/19cd0192e4b68ddd0ba1e1be3113b98dcce8fcb2/DependencyInjection/Configuration/Configuration.php#L184-L215 |
snc/SncRedisBundle | DependencyInjection/Configuration/Configuration.php | Configuration.addMonologSection | private function addMonologSection(ArrayNodeDefinition $rootNode)
{
$rootNode
->children()
->arrayNode('monolog')
->canBeUnset()
->children()
->scalarNode('client')->isRequired()->end()
->scal... | php | private function addMonologSection(ArrayNodeDefinition $rootNode)
{
$rootNode
->children()
->arrayNode('monolog')
->canBeUnset()
->children()
->scalarNode('client')->isRequired()->end()
->scal... | [
"private",
"function",
"addMonologSection",
"(",
"ArrayNodeDefinition",
"$",
"rootNode",
")",
"{",
"$",
"rootNode",
"->",
"children",
"(",
")",
"->",
"arrayNode",
"(",
"'monolog'",
")",
"->",
"canBeUnset",
"(",
")",
"->",
"children",
"(",
")",
"->",
"scalarN... | Adds the snc_redis.monolog configuration
@param ArrayNodeDefinition $rootNode | [
"Adds",
"the",
"snc_redis",
".",
"monolog",
"configuration"
] | train | https://github.com/snc/SncRedisBundle/blob/19cd0192e4b68ddd0ba1e1be3113b98dcce8fcb2/DependencyInjection/Configuration/Configuration.php#L222-L235 |
snc/SncRedisBundle | Session/Storage/Handler/RedisSessionHandler.php | RedisSessionHandler.updateTimestamp | public function updateTimestamp($sessionId, $data)
{
if (0 < $this->ttl) {
$this->redis->expire($this->getRedisKey($sessionId), $this->ttl);
}
return true;
} | php | public function updateTimestamp($sessionId, $data)
{
if (0 < $this->ttl) {
$this->redis->expire($this->getRedisKey($sessionId), $this->ttl);
}
return true;
} | [
"public",
"function",
"updateTimestamp",
"(",
"$",
"sessionId",
",",
"$",
"data",
")",
"{",
"if",
"(",
"0",
"<",
"$",
"this",
"->",
"ttl",
")",
"{",
"$",
"this",
"->",
"redis",
"->",
"expire",
"(",
"$",
"this",
"->",
"getRedisKey",
"(",
"$",
"sessi... | {@inheritdoc} | [
"{"
] | train | https://github.com/snc/SncRedisBundle/blob/19cd0192e4b68ddd0ba1e1be3113b98dcce8fcb2/Session/Storage/Handler/RedisSessionHandler.php#L133-L140 |
snc/SncRedisBundle | Session/Storage/Handler/RedisSessionHandler.php | RedisSessionHandler.doRead | protected function doRead($sessionId)
{
if ($this->locking && !$this->locked && !$this->lockSession($sessionId)) {
return false;
}
return $this->redis->get($this->getRedisKey($sessionId)) ?: '';
} | php | protected function doRead($sessionId)
{
if ($this->locking && !$this->locked && !$this->lockSession($sessionId)) {
return false;
}
return $this->redis->get($this->getRedisKey($sessionId)) ?: '';
} | [
"protected",
"function",
"doRead",
"(",
"$",
"sessionId",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"locking",
"&&",
"!",
"$",
"this",
"->",
"locked",
"&&",
"!",
"$",
"this",
"->",
"lockSession",
"(",
"$",
"sessionId",
")",
")",
"{",
"return",
"false",... | {@inheritdoc} | [
"{"
] | train | https://github.com/snc/SncRedisBundle/blob/19cd0192e4b68ddd0ba1e1be3113b98dcce8fcb2/Session/Storage/Handler/RedisSessionHandler.php#L154-L161 |
snc/SncRedisBundle | Session/Storage/Handler/RedisSessionHandler.php | RedisSessionHandler.doWrite | protected function doWrite($sessionId, $data)
{
if (0 < $this->ttl) {
$this->redis->setex($this->getRedisKey($sessionId), $this->ttl, $data);
} else {
$this->redis->set($this->getRedisKey($sessionId), $data);
}
return true;
} | php | protected function doWrite($sessionId, $data)
{
if (0 < $this->ttl) {
$this->redis->setex($this->getRedisKey($sessionId), $this->ttl, $data);
} else {
$this->redis->set($this->getRedisKey($sessionId), $data);
}
return true;
} | [
"protected",
"function",
"doWrite",
"(",
"$",
"sessionId",
",",
"$",
"data",
")",
"{",
"if",
"(",
"0",
"<",
"$",
"this",
"->",
"ttl",
")",
"{",
"$",
"this",
"->",
"redis",
"->",
"setex",
"(",
"$",
"this",
"->",
"getRedisKey",
"(",
"$",
"sessionId",... | {@inheritdoc} | [
"{"
] | train | https://github.com/snc/SncRedisBundle/blob/19cd0192e4b68ddd0ba1e1be3113b98dcce8fcb2/Session/Storage/Handler/RedisSessionHandler.php#L166-L175 |
snc/SncRedisBundle | Session/Storage/Handler/RedisSessionHandler.php | RedisSessionHandler.doDestroy | protected function doDestroy($sessionId)
{
$this->redis->del($this->getRedisKey($sessionId));
$this->close();
return true;
} | php | protected function doDestroy($sessionId)
{
$this->redis->del($this->getRedisKey($sessionId));
$this->close();
return true;
} | [
"protected",
"function",
"doDestroy",
"(",
"$",
"sessionId",
")",
"{",
"$",
"this",
"->",
"redis",
"->",
"del",
"(",
"$",
"this",
"->",
"getRedisKey",
"(",
"$",
"sessionId",
")",
")",
";",
"$",
"this",
"->",
"close",
"(",
")",
";",
"return",
"true",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/snc/SncRedisBundle/blob/19cd0192e4b68ddd0ba1e1be3113b98dcce8fcb2/Session/Storage/Handler/RedisSessionHandler.php#L180-L186 |
snc/SncRedisBundle | Session/Storage/Handler/RedisSessionHandler.php | RedisSessionHandler.lockSession | protected function lockSession($sessionId)
{
$attempts = (1000000 / $this->spinLockWait) * $this->lockMaxWait;
$this->token = uniqid();
$this->lockKey = $this->getRedisKey($sessionId).'.lock';
$setFunction = function ($redis, $key, $token, $ttl) {
if ($redis instanceof ... | php | protected function lockSession($sessionId)
{
$attempts = (1000000 / $this->spinLockWait) * $this->lockMaxWait;
$this->token = uniqid();
$this->lockKey = $this->getRedisKey($sessionId).'.lock';
$setFunction = function ($redis, $key, $token, $ttl) {
if ($redis instanceof ... | [
"protected",
"function",
"lockSession",
"(",
"$",
"sessionId",
")",
"{",
"$",
"attempts",
"=",
"(",
"1000000",
"/",
"$",
"this",
"->",
"spinLockWait",
")",
"*",
"$",
"this",
"->",
"lockMaxWait",
";",
"$",
"this",
"->",
"token",
"=",
"uniqid",
"(",
")",... | Lock the session data. | [
"Lock",
"the",
"session",
"data",
"."
] | train | https://github.com/snc/SncRedisBundle/blob/19cd0192e4b68ddd0ba1e1be3113b98dcce8fcb2/Session/Storage/Handler/RedisSessionHandler.php#L191-L230 |
snc/SncRedisBundle | Session/Storage/Handler/RedisSessionHandler.php | RedisSessionHandler.unlockSession | private function unlockSession()
{
if ($this->redis instanceof \Redis) {
// If we have the right token, then delete the lock
$script = <<<LUA
if redis.call("GET", KEYS[1]) == ARGV[1] then
return redis.call("DEL", KEYS[1])
else
r... | php | private function unlockSession()
{
if ($this->redis instanceof \Redis) {
// If we have the right token, then delete the lock
$script = <<<LUA
if redis.call("GET", KEYS[1]) == ARGV[1] then
return redis.call("DEL", KEYS[1])
else
r... | [
"private",
"function",
"unlockSession",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"redis",
"instanceof",
"\\",
"Redis",
")",
"{",
"// If we have the right token, then delete the lock",
"$",
"script",
"=",
" <<<LUA\n if redis.call(\"GET\", KEYS[1]) == ARGV[1] t... | Unlock the session data. | [
"Unlock",
"the",
"session",
"data",
"."
] | train | https://github.com/snc/SncRedisBundle/blob/19cd0192e4b68ddd0ba1e1be3113b98dcce8fcb2/Session/Storage/Handler/RedisSessionHandler.php#L235-L255 |
snc/SncRedisBundle | DependencyInjection/Compiler/SwiftMailerPass.php | SwiftMailerPass.process | public function process(ContainerBuilder $container)
{
$serviceId = self::SERVICE_ID;
if ($container->hasDefinition($serviceId)) {
$handlerDefinition = $container->getDefinition($serviceId);
if (RedisSpool::class === $handlerDefinition->getClass()) {
if (!inte... | php | public function process(ContainerBuilder $container)
{
$serviceId = self::SERVICE_ID;
if ($container->hasDefinition($serviceId)) {
$handlerDefinition = $container->getDefinition($serviceId);
if (RedisSpool::class === $handlerDefinition->getClass()) {
if (!inte... | [
"public",
"function",
"process",
"(",
"ContainerBuilder",
"$",
"container",
")",
"{",
"$",
"serviceId",
"=",
"self",
"::",
"SERVICE_ID",
";",
"if",
"(",
"$",
"container",
"->",
"hasDefinition",
"(",
"$",
"serviceId",
")",
")",
"{",
"$",
"handlerDefinition",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/snc/SncRedisBundle/blob/19cd0192e4b68ddd0ba1e1be3113b98dcce8fcb2/DependencyInjection/Compiler/SwiftMailerPass.php#L26-L53 |
snc/SncRedisBundle | Profiler/Storage/RedisProfilerStorage.php | RedisProfilerStorage.find | public function find($ip, $url, $limit, $method, $start = null, $end = null)
{
$indexName = $this->getIndexName();
if (!$indexContent = $this->getValue($indexName, self::REDIS_SERIALIZER_NONE)) {
return array();
}
$profileList = array_reverse(explode("\n", $indexContent... | php | public function find($ip, $url, $limit, $method, $start = null, $end = null)
{
$indexName = $this->getIndexName();
if (!$indexContent = $this->getValue($indexName, self::REDIS_SERIALIZER_NONE)) {
return array();
}
$profileList = array_reverse(explode("\n", $indexContent... | [
"public",
"function",
"find",
"(",
"$",
"ip",
",",
"$",
"url",
",",
"$",
"limit",
",",
"$",
"method",
",",
"$",
"start",
"=",
"null",
",",
"$",
"end",
"=",
"null",
")",
"{",
"$",
"indexName",
"=",
"$",
"this",
"->",
"getIndexName",
"(",
")",
";... | {@inheritdoc} | [
"{"
] | train | https://github.com/snc/SncRedisBundle/blob/19cd0192e4b68ddd0ba1e1be3113b98dcce8fcb2/Profiler/Storage/RedisProfilerStorage.php#L75-L126 |
snc/SncRedisBundle | Profiler/Storage/RedisProfilerStorage.php | RedisProfilerStorage.purge | public function purge()
{
// delete only items from index
$indexName = $this->getIndexName();
$indexContent = $this->getValue($indexName, self::REDIS_SERIALIZER_NONE);
if (!$indexContent) {
return false;
}
$profileList = explode("\n", $indexContent);
... | php | public function purge()
{
// delete only items from index
$indexName = $this->getIndexName();
$indexContent = $this->getValue($indexName, self::REDIS_SERIALIZER_NONE);
if (!$indexContent) {
return false;
}
$profileList = explode("\n", $indexContent);
... | [
"public",
"function",
"purge",
"(",
")",
"{",
"// delete only items from index",
"$",
"indexName",
"=",
"$",
"this",
"->",
"getIndexName",
"(",
")",
";",
"$",
"indexContent",
"=",
"$",
"this",
"->",
"getValue",
"(",
"$",
"indexName",
",",
"self",
"::",
"RE... | {@inheritdoc} | [
"{"
] | train | https://github.com/snc/SncRedisBundle/blob/19cd0192e4b68ddd0ba1e1be3113b98dcce8fcb2/Profiler/Storage/RedisProfilerStorage.php#L131-L159 |
snc/SncRedisBundle | Profiler/Storage/RedisProfilerStorage.php | RedisProfilerStorage.read | public function read($token)
{
if (empty($token)) {
return false;
}
$profile = $this->getValue($this->getItemName($token), self::REDIS_SERIALIZER_PHP);
if ($profile) {
$profile = $this->createProfileFromData($token, $profile);
}
return $prof... | php | public function read($token)
{
if (empty($token)) {
return false;
}
$profile = $this->getValue($this->getItemName($token), self::REDIS_SERIALIZER_PHP);
if ($profile) {
$profile = $this->createProfileFromData($token, $profile);
}
return $prof... | [
"public",
"function",
"read",
"(",
"$",
"token",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"token",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"profile",
"=",
"$",
"this",
"->",
"getValue",
"(",
"$",
"this",
"->",
"getItemName",
"(",
"$",
"to... | {@inheritdoc} | [
"{"
] | train | https://github.com/snc/SncRedisBundle/blob/19cd0192e4b68ddd0ba1e1be3113b98dcce8fcb2/Profiler/Storage/RedisProfilerStorage.php#L164-L177 |
snc/SncRedisBundle | Profiler/Storage/RedisProfilerStorage.php | RedisProfilerStorage.write | public function write(Profile $profile)
{
$data = array(
'token' => $profile->getToken(),
'parent' => $profile->getParentToken(),
'children' => array_map(function ($p) { return $p->getToken(); }, $profile->getChildren()),
'data' => $profile->getCollectors(),
... | php | public function write(Profile $profile)
{
$data = array(
'token' => $profile->getToken(),
'parent' => $profile->getParentToken(),
'children' => array_map(function ($p) { return $p->getToken(); }, $profile->getChildren()),
'data' => $profile->getCollectors(),
... | [
"public",
"function",
"write",
"(",
"Profile",
"$",
"profile",
")",
"{",
"$",
"data",
"=",
"array",
"(",
"'token'",
"=>",
"$",
"profile",
"->",
"getToken",
"(",
")",
",",
"'parent'",
"=>",
"$",
"profile",
"->",
"getParentToken",
"(",
")",
",",
"'childr... | {@inheritdoc} | [
"{"
] | train | https://github.com/snc/SncRedisBundle/blob/19cd0192e4b68ddd0ba1e1be3113b98dcce8fcb2/Profiler/Storage/RedisProfilerStorage.php#L182-L219 |
snc/SncRedisBundle | Profiler/Storage/RedisProfilerStorage.php | RedisProfilerStorage.createProfileFromData | protected function createProfileFromData($token, $data, $parent = null)
{
$profile = new Profile($token);
$profile->setIp($data['ip']);
$profile->setMethod($data['method']);
$profile->setUrl($data['url']);
$profile->setTime($data['time']);
$profile->setCollectors($dat... | php | protected function createProfileFromData($token, $data, $parent = null)
{
$profile = new Profile($token);
$profile->setIp($data['ip']);
$profile->setMethod($data['method']);
$profile->setUrl($data['url']);
$profile->setTime($data['time']);
$profile->setCollectors($dat... | [
"protected",
"function",
"createProfileFromData",
"(",
"$",
"token",
",",
"$",
"data",
",",
"$",
"parent",
"=",
"null",
")",
"{",
"$",
"profile",
"=",
"new",
"Profile",
"(",
"$",
"token",
")",
";",
"$",
"profile",
"->",
"setIp",
"(",
"$",
"data",
"["... | Creates a Profile.
@param string $token
@param array $data
@param Profile $parent
@return Profile | [
"Creates",
"a",
"Profile",
"."
] | train | https://github.com/snc/SncRedisBundle/blob/19cd0192e4b68ddd0ba1e1be3113b98dcce8fcb2/Profiler/Storage/RedisProfilerStorage.php#L229-L259 |
snc/SncRedisBundle | Profiler/Storage/RedisProfilerStorage.php | RedisProfilerStorage.getItemName | protected function getItemName($token)
{
$name = $this->prefixKey($token);
if ($this->isItemNameValid($name)) {
return $name;
}
return false;
} | php | protected function getItemName($token)
{
$name = $this->prefixKey($token);
if ($this->isItemNameValid($name)) {
return $name;
}
return false;
} | [
"protected",
"function",
"getItemName",
"(",
"$",
"token",
")",
"{",
"$",
"name",
"=",
"$",
"this",
"->",
"prefixKey",
"(",
"$",
"token",
")",
";",
"if",
"(",
"$",
"this",
"->",
"isItemNameValid",
"(",
"$",
"name",
")",
")",
"{",
"return",
"$",
"na... | Gets the item name.
@param string $token
@return string | [
"Gets",
"the",
"item",
"name",
"."
] | train | https://github.com/snc/SncRedisBundle/blob/19cd0192e4b68ddd0ba1e1be3113b98dcce8fcb2/Profiler/Storage/RedisProfilerStorage.php#L268-L277 |
snc/SncRedisBundle | Profiler/Storage/RedisProfilerStorage.php | RedisProfilerStorage.getIndexName | protected function getIndexName()
{
$name = $this->prefixKey(self::INDEX_NAME);
if ($this->isItemNameValid($name)) {
return $name;
}
return false;
} | php | protected function getIndexName()
{
$name = $this->prefixKey(self::INDEX_NAME);
if ($this->isItemNameValid($name)) {
return $name;
}
return false;
} | [
"protected",
"function",
"getIndexName",
"(",
")",
"{",
"$",
"name",
"=",
"$",
"this",
"->",
"prefixKey",
"(",
"self",
"::",
"INDEX_NAME",
")",
";",
"if",
"(",
"$",
"this",
"->",
"isItemNameValid",
"(",
"$",
"name",
")",
")",
"{",
"return",
"$",
"nam... | Gets the name of the index.
@return string | [
"Gets",
"the",
"name",
"of",
"the",
"index",
"."
] | train | https://github.com/snc/SncRedisBundle/blob/19cd0192e4b68ddd0ba1e1be3113b98dcce8fcb2/Profiler/Storage/RedisProfilerStorage.php#L284-L293 |
snc/SncRedisBundle | Profiler/Storage/RedisProfilerStorage.php | RedisProfilerStorage.isItemNameValid | protected function isItemNameValid($name)
{
$length = strlen($name);
if ($length > 2147483648) {
throw new \RuntimeException(sprintf('The Redis item key "%s" is too long (%s bytes). Allowed maximum size is 2^31 bytes.', $name, $length));
}
return true;
} | php | protected function isItemNameValid($name)
{
$length = strlen($name);
if ($length > 2147483648) {
throw new \RuntimeException(sprintf('The Redis item key "%s" is too long (%s bytes). Allowed maximum size is 2^31 bytes.', $name, $length));
}
return true;
} | [
"protected",
"function",
"isItemNameValid",
"(",
"$",
"name",
")",
"{",
"$",
"length",
"=",
"strlen",
"(",
"$",
"name",
")",
";",
"if",
"(",
"$",
"length",
">",
"2147483648",
")",
"{",
"throw",
"new",
"\\",
"RuntimeException",
"(",
"sprintf",
"(",
"'Th... | Check if the item name is valid.
@param string $name
@throws \RuntimeException
@return bool | [
"Check",
"if",
"the",
"item",
"name",
"is",
"valid",
"."
] | train | https://github.com/snc/SncRedisBundle/blob/19cd0192e4b68ddd0ba1e1be3113b98dcce8fcb2/Profiler/Storage/RedisProfilerStorage.php#L302-L311 |
snc/SncRedisBundle | Profiler/Storage/RedisProfilerStorage.php | RedisProfilerStorage.getValue | protected function getValue($key, $serializer = self::REDIS_SERIALIZER_NONE)
{
$value = $this->redis->get($key);
if ($value && (self::REDIS_SERIALIZER_PHP === $serializer)) {
$value = unserialize($value);
}
return $value;
} | php | protected function getValue($key, $serializer = self::REDIS_SERIALIZER_NONE)
{
$value = $this->redis->get($key);
if ($value && (self::REDIS_SERIALIZER_PHP === $serializer)) {
$value = unserialize($value);
}
return $value;
} | [
"protected",
"function",
"getValue",
"(",
"$",
"key",
",",
"$",
"serializer",
"=",
"self",
"::",
"REDIS_SERIALIZER_NONE",
")",
"{",
"$",
"value",
"=",
"$",
"this",
"->",
"redis",
"->",
"get",
"(",
"$",
"key",
")",
";",
"if",
"(",
"$",
"value",
"&&",
... | Retrieves an item from the Redis server.
@param string $key
@param int $serializer
@return mixed | [
"Retrieves",
"an",
"item",
"from",
"the",
"Redis",
"server",
"."
] | train | https://github.com/snc/SncRedisBundle/blob/19cd0192e4b68ddd0ba1e1be3113b98dcce8fcb2/Profiler/Storage/RedisProfilerStorage.php#L321-L330 |
snc/SncRedisBundle | Profiler/Storage/RedisProfilerStorage.php | RedisProfilerStorage.setValue | protected function setValue($key, $value, $expiration = 0, $serializer = self::REDIS_SERIALIZER_NONE)
{
if (self::REDIS_SERIALIZER_PHP === $serializer) {
$value = serialize($value);
}
return $this->redis->setex($key, $expiration, $value);
} | php | protected function setValue($key, $value, $expiration = 0, $serializer = self::REDIS_SERIALIZER_NONE)
{
if (self::REDIS_SERIALIZER_PHP === $serializer) {
$value = serialize($value);
}
return $this->redis->setex($key, $expiration, $value);
} | [
"protected",
"function",
"setValue",
"(",
"$",
"key",
",",
"$",
"value",
",",
"$",
"expiration",
"=",
"0",
",",
"$",
"serializer",
"=",
"self",
"::",
"REDIS_SERIALIZER_NONE",
")",
"{",
"if",
"(",
"self",
"::",
"REDIS_SERIALIZER_PHP",
"===",
"$",
"serialize... | Stores an item on the Redis server under the specified key.
@param string $key
@param mixed $value
@param int $expiration
@param int $serializer
@return bool | [
"Stores",
"an",
"item",
"on",
"the",
"Redis",
"server",
"under",
"the",
"specified",
"key",
"."
] | train | https://github.com/snc/SncRedisBundle/blob/19cd0192e4b68ddd0ba1e1be3113b98dcce8fcb2/Profiler/Storage/RedisProfilerStorage.php#L342-L349 |
snc/SncRedisBundle | Profiler/Storage/RedisProfilerStorage.php | RedisProfilerStorage.appendValue | protected function appendValue($key, $value, $expiration = 0)
{
if ($this->redis->exists($key)) {
$this->redis->append($key, $value);
return $this->redis->expire($key, $expiration);
}
return $this->redis->setex($key, $expiration, $value);
} | php | protected function appendValue($key, $value, $expiration = 0)
{
if ($this->redis->exists($key)) {
$this->redis->append($key, $value);
return $this->redis->expire($key, $expiration);
}
return $this->redis->setex($key, $expiration, $value);
} | [
"protected",
"function",
"appendValue",
"(",
"$",
"key",
",",
"$",
"value",
",",
"$",
"expiration",
"=",
"0",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"redis",
"->",
"exists",
"(",
"$",
"key",
")",
")",
"{",
"$",
"this",
"->",
"redis",
"->",
"appe... | Appends data to an existing item on the Redis server.
@param string $key
@param string $value
@param int $expiration
@return bool | [
"Appends",
"data",
"to",
"an",
"existing",
"item",
"on",
"the",
"Redis",
"server",
"."
] | train | https://github.com/snc/SncRedisBundle/blob/19cd0192e4b68ddd0ba1e1be3113b98dcce8fcb2/Profiler/Storage/RedisProfilerStorage.php#L359-L368 |
snc/SncRedisBundle | DependencyInjection/Configuration/RedisDsn.php | RedisDsn.parseParameters | protected function parseParameters($matches)
{
parse_str($matches[1], $params);
foreach ($params as $key => $val) {
if (!$val) {
continue;
}
switch ($key) {
case 'weight':
$this->weight = (int) $val;
... | php | protected function parseParameters($matches)
{
parse_str($matches[1], $params);
foreach ($params as $key => $val) {
if (!$val) {
continue;
}
switch ($key) {
case 'weight':
$this->weight = (int) $val;
... | [
"protected",
"function",
"parseParameters",
"(",
"$",
"matches",
")",
"{",
"parse_str",
"(",
"$",
"matches",
"[",
"1",
"]",
",",
"$",
"params",
")",
";",
"foreach",
"(",
"$",
"params",
"as",
"$",
"key",
"=>",
"$",
"val",
")",
"{",
"if",
"(",
"!",
... | @param array $matches
@return string | [
"@param",
"array",
"$matches"
] | train | https://github.com/snc/SncRedisBundle/blob/19cd0192e4b68ddd0ba1e1be3113b98dcce8fcb2/DependencyInjection/Configuration/RedisDsn.php#L220-L239 |
snc/SncRedisBundle | SncRedisBundle.php | SncRedisBundle.shutdown | public function shutdown()
{
// Close session handler connection to avoid using up all available connection slots in tests
if ($this->container->has('snc_redis.session.handler')) {
if (!method_exists($this->container, 'initialized') || $this->container->initialized('snc_redis.session.han... | php | public function shutdown()
{
// Close session handler connection to avoid using up all available connection slots in tests
if ($this->container->has('snc_redis.session.handler')) {
if (!method_exists($this->container, 'initialized') || $this->container->initialized('snc_redis.session.han... | [
"public",
"function",
"shutdown",
"(",
")",
"{",
"// Close session handler connection to avoid using up all available connection slots in tests",
"if",
"(",
"$",
"this",
"->",
"container",
"->",
"has",
"(",
"'snc_redis.session.handler'",
")",
")",
"{",
"if",
"(",
"!",
"... | {@inheritDoc} | [
"{"
] | train | https://github.com/snc/SncRedisBundle/blob/19cd0192e4b68ddd0ba1e1be3113b98dcce8fcb2/SncRedisBundle.php#L41-L49 |
snc/SncRedisBundle | SwiftMailer/RedisSpool.php | RedisSpool.flushQueue | public function flushQueue(\Swift_Transport $transport, &$failedRecipients = null)
{
if (!$this->redis->llen($this->key)) {
return 0;
}
if (!$transport->isStarted()) {
$transport->start();
}
$failedRecipients = (array) $failedRecipients;
$cou... | php | public function flushQueue(\Swift_Transport $transport, &$failedRecipients = null)
{
if (!$this->redis->llen($this->key)) {
return 0;
}
if (!$transport->isStarted()) {
$transport->start();
}
$failedRecipients = (array) $failedRecipients;
$cou... | [
"public",
"function",
"flushQueue",
"(",
"\\",
"Swift_Transport",
"$",
"transport",
",",
"&",
"$",
"failedRecipients",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"redis",
"->",
"llen",
"(",
"$",
"this",
"->",
"key",
")",
")",
"{",
"ret... | {@inheritdoc} | [
"{"
] | train | https://github.com/snc/SncRedisBundle/blob/19cd0192e4b68ddd0ba1e1be3113b98dcce8fcb2/SwiftMailer/RedisSpool.php#L70-L97 |
snc/SncRedisBundle | Logger/RedisLogger.php | RedisLogger.logCommand | public function logCommand($command, $duration, $connection, $error = false)
{
++$this->nbCommands;
if (null !== $this->logger) {
$this->commands[] = array('cmd' => $command, 'executionMS' => $duration, 'conn' => $connection, 'error' => $error);
if ($error) {
... | php | public function logCommand($command, $duration, $connection, $error = false)
{
++$this->nbCommands;
if (null !== $this->logger) {
$this->commands[] = array('cmd' => $command, 'executionMS' => $duration, 'conn' => $connection, 'error' => $error);
if ($error) {
... | [
"public",
"function",
"logCommand",
"(",
"$",
"command",
",",
"$",
"duration",
",",
"$",
"connection",
",",
"$",
"error",
"=",
"false",
")",
"{",
"++",
"$",
"this",
"->",
"nbCommands",
";",
"if",
"(",
"null",
"!==",
"$",
"this",
"->",
"logger",
")",
... | Logs a command
@param string $command Redis command
@param float $duration Duration in milliseconds
@param string $connection Connection alias
@param bool|string $error Error message or false if command was successful | [
"Logs",
"a",
"command"
] | train | https://github.com/snc/SncRedisBundle/blob/19cd0192e4b68ddd0ba1e1be3113b98dcce8fcb2/Logger/RedisLogger.php#L47-L61 |
snc/SncRedisBundle | Client/Predis/Connection/ConnectionWrapper.php | ConnectionWrapper.writeRequest | public function writeRequest(CommandInterface $command)
{
if (null === $this->logger) {
$this->connection->writeRequest($command);
return;
}
$startTime = microtime(true);
$this->connection->writeRequest($command);
$duration = (microtime(true) - $start... | php | public function writeRequest(CommandInterface $command)
{
if (null === $this->logger) {
$this->connection->writeRequest($command);
return;
}
$startTime = microtime(true);
$this->connection->writeRequest($command);
$duration = (microtime(true) - $start... | [
"public",
"function",
"writeRequest",
"(",
"CommandInterface",
"$",
"command",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"logger",
")",
"{",
"$",
"this",
"->",
"connection",
"->",
"writeRequest",
"(",
"$",
"command",
")",
";",
"return",
";",... | {@inheritdoc} | [
"{"
] | train | https://github.com/snc/SncRedisBundle/blob/19cd0192e4b68ddd0ba1e1be3113b98dcce8fcb2/Client/Predis/Connection/ConnectionWrapper.php#L96-L108 |
snc/SncRedisBundle | Client/Predis/Connection/ConnectionWrapper.php | ConnectionWrapper.executeCommand | public function executeCommand(CommandInterface $command)
{
if (null === $this->logger) {
return $this->connection->executeCommand($command);
}
$startTime = microtime(true);
$result = $this->connection->executeCommand($command);
$duration = (microtime(true) - $st... | php | public function executeCommand(CommandInterface $command)
{
if (null === $this->logger) {
return $this->connection->executeCommand($command);
}
$startTime = microtime(true);
$result = $this->connection->executeCommand($command);
$duration = (microtime(true) - $st... | [
"public",
"function",
"executeCommand",
"(",
"CommandInterface",
"$",
"command",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"logger",
")",
"{",
"return",
"$",
"this",
"->",
"connection",
"->",
"executeCommand",
"(",
"$",
"command",
")",
";",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/snc/SncRedisBundle/blob/19cd0192e4b68ddd0ba1e1be3113b98dcce8fcb2/Client/Predis/Connection/ConnectionWrapper.php#L169-L183 |
snc/SncRedisBundle | Client/Predis/Connection/ConnectionWrapper.php | ConnectionWrapper.toStringArgumentReducer | private function toStringArgumentReducer($accumulator, $argument)
{
if (strlen($argument) > 10240) {
$argument = substr($argument, 0, 10240) . ' (truncated, complete string is '.strlen($argument).' bytes)';
}
$accumulator .= " $argument";
return $accumulator;
} | php | private function toStringArgumentReducer($accumulator, $argument)
{
if (strlen($argument) > 10240) {
$argument = substr($argument, 0, 10240) . ' (truncated, complete string is '.strlen($argument).' bytes)';
}
$accumulator .= " $argument";
return $accumulator;
} | [
"private",
"function",
"toStringArgumentReducer",
"(",
"$",
"accumulator",
",",
"$",
"argument",
")",
"{",
"if",
"(",
"strlen",
"(",
"$",
"argument",
")",
">",
"10240",
")",
"{",
"$",
"argument",
"=",
"substr",
"(",
"$",
"argument",
",",
"0",
",",
"102... | Helper function used to reduce a list of arguments to a string.
@param string $accumulator Temporary string.
@param string $argument Current argument.
@return string | [
"Helper",
"function",
"used",
"to",
"reduce",
"a",
"list",
"of",
"arguments",
"to",
"a",
"string",
"."
] | train | https://github.com/snc/SncRedisBundle/blob/19cd0192e4b68ddd0ba1e1be3113b98dcce8fcb2/Client/Predis/Connection/ConnectionWrapper.php#L201-L210 |
snc/SncRedisBundle | Client/Predis/Cluster/Distribution/RandomDistributionStrategy.php | RandomDistributionStrategy.remove | public function remove($node)
{
$this->_nodes = array_filter($this->_nodes, function($n) use($node) {
return $n !== $node;
});
$this->_nodesCount = count($this->_nodes);
} | php | public function remove($node)
{
$this->_nodes = array_filter($this->_nodes, function($n) use($node) {
return $n !== $node;
});
$this->_nodesCount = count($this->_nodes);
} | [
"public",
"function",
"remove",
"(",
"$",
"node",
")",
"{",
"$",
"this",
"->",
"_nodes",
"=",
"array_filter",
"(",
"$",
"this",
"->",
"_nodes",
",",
"function",
"(",
"$",
"n",
")",
"use",
"(",
"$",
"node",
")",
"{",
"return",
"$",
"n",
"!==",
"$"... | {@inheritDoc} | [
"{"
] | train | https://github.com/snc/SncRedisBundle/blob/19cd0192e4b68ddd0ba1e1be3113b98dcce8fcb2/Client/Predis/Cluster/Distribution/RandomDistributionStrategy.php#L53-L59 |
snc/SncRedisBundle | Client/Predis/Cluster/Distribution/RandomDistributionStrategy.php | RandomDistributionStrategy.get | public function get($key)
{
if (0 === $this->_nodesCount) {
throw new \OutOfBoundsException('No connections.');
}
return $this->_nodes[array_rand($this->_nodes)];
} | php | public function get($key)
{
if (0 === $this->_nodesCount) {
throw new \OutOfBoundsException('No connections.');
}
return $this->_nodes[array_rand($this->_nodes)];
} | [
"public",
"function",
"get",
"(",
"$",
"key",
")",
"{",
"if",
"(",
"0",
"===",
"$",
"this",
"->",
"_nodesCount",
")",
"{",
"throw",
"new",
"\\",
"OutOfBoundsException",
"(",
"'No connections.'",
")",
";",
"}",
"return",
"$",
"this",
"->",
"_nodes",
"["... | {@inheritDoc} | [
"{"
] | train | https://github.com/snc/SncRedisBundle/blob/19cd0192e4b68ddd0ba1e1be3113b98dcce8fcb2/Client/Predis/Cluster/Distribution/RandomDistributionStrategy.php#L64-L71 |
snc/SncRedisBundle | Factory/PredisParametersFactory.php | PredisParametersFactory.create | public static function create($options, $class, $dsn)
{
if (!is_a($class, '\Predis\Connection\ParametersInterface', true)) {
throw new \InvalidArgumentException(sprintf('%s::%s requires $class argument to implement %s', __CLASS__, __METHOD__, ParametersInterface::class));
}
$def... | php | public static function create($options, $class, $dsn)
{
if (!is_a($class, '\Predis\Connection\ParametersInterface', true)) {
throw new \InvalidArgumentException(sprintf('%s::%s requires $class argument to implement %s', __CLASS__, __METHOD__, ParametersInterface::class));
}
$def... | [
"public",
"static",
"function",
"create",
"(",
"$",
"options",
",",
"$",
"class",
",",
"$",
"dsn",
")",
"{",
"if",
"(",
"!",
"is_a",
"(",
"$",
"class",
",",
"'\\Predis\\Connection\\ParametersInterface'",
",",
"true",
")",
")",
"{",
"throw",
"new",
"\\",
... | @param array $options
@param string $class
@param string $dsn
@return ParametersInterface | [
"@param",
"array",
"$options",
"@param",
"string",
"$class",
"@param",
"string",
"$dsn"
] | train | https://github.com/snc/SncRedisBundle/blob/19cd0192e4b68ddd0ba1e1be3113b98dcce8fcb2/Factory/PredisParametersFactory.php#L17-L32 |
snc/SncRedisBundle | Factory/PredisParametersFactory.php | PredisParametersFactory.parseDsn | private static function parseDsn(RedisDsn $dsn)
{
if (null !== $dsn->getSocket()) {
$options['scheme'] = 'unix';
$options['path'] = $dsn->getSocket();
} else {
$options['scheme'] = $dsn->getTls() ? 'tls' : 'tcp';
$options['host'] = $dsn->getHost();
... | php | private static function parseDsn(RedisDsn $dsn)
{
if (null !== $dsn->getSocket()) {
$options['scheme'] = 'unix';
$options['path'] = $dsn->getSocket();
} else {
$options['scheme'] = $dsn->getTls() ? 'tls' : 'tcp';
$options['host'] = $dsn->getHost();
... | [
"private",
"static",
"function",
"parseDsn",
"(",
"RedisDsn",
"$",
"dsn",
")",
"{",
"if",
"(",
"null",
"!==",
"$",
"dsn",
"->",
"getSocket",
"(",
")",
")",
"{",
"$",
"options",
"[",
"'scheme'",
"]",
"=",
"'unix'",
";",
"$",
"options",
"[",
"'path'",
... | @param RedisDsn $dsn
@return array | [
"@param",
"RedisDsn",
"$dsn"
] | train | https://github.com/snc/SncRedisBundle/blob/19cd0192e4b68ddd0ba1e1be3113b98dcce8fcb2/Factory/PredisParametersFactory.php#L39-L65 |
snc/SncRedisBundle | DependencyInjection/Compiler/LoggingPass.php | LoggingPass.process | public function process(ContainerBuilder $container)
{
foreach ($container->findTaggedServiceIds('snc_redis.connection_parameters') as $id => $attr) {
$clientAlias = $attr[0]['clientAlias'];
$parameterDefinition = $container->getDefinition($id);
$parameters = $parameterDe... | php | public function process(ContainerBuilder $container)
{
foreach ($container->findTaggedServiceIds('snc_redis.connection_parameters') as $id => $attr) {
$clientAlias = $attr[0]['clientAlias'];
$parameterDefinition = $container->getDefinition($id);
$parameters = $parameterDe... | [
"public",
"function",
"process",
"(",
"ContainerBuilder",
"$",
"container",
")",
"{",
"foreach",
"(",
"$",
"container",
"->",
"findTaggedServiceIds",
"(",
"'snc_redis.connection_parameters'",
")",
"as",
"$",
"id",
"=>",
"$",
"attr",
")",
"{",
"$",
"clientAlias",... | {@inheritdoc} | [
"{"
] | train | https://github.com/snc/SncRedisBundle/blob/19cd0192e4b68ddd0ba1e1be3113b98dcce8fcb2/DependencyInjection/Compiler/LoggingPass.php#L25-L51 |
elibyy/tcpdf-laravel | src/ServiceProvider.php | ServiceProvider.register | public function register()
{
$configPath = dirname(__FILE__) . '/../config/tcpdf.php';
$this->mergeConfigFrom($configPath, 'tcpdf');
$this->app->singleton('tcpdf', function ($app) {
return new TCPDF($app);
});
} | php | public function register()
{
$configPath = dirname(__FILE__) . '/../config/tcpdf.php';
$this->mergeConfigFrom($configPath, 'tcpdf');
$this->app->singleton('tcpdf', function ($app) {
return new TCPDF($app);
});
} | [
"public",
"function",
"register",
"(",
")",
"{",
"$",
"configPath",
"=",
"dirname",
"(",
"__FILE__",
")",
".",
"'/../config/tcpdf.php'",
";",
"$",
"this",
"->",
"mergeConfigFrom",
"(",
"$",
"configPath",
",",
"'tcpdf'",
")",
";",
"$",
"this",
"->",
"app",
... | Register the service provider.
@return void | [
"Register",
"the",
"service",
"provider",
"."
] | train | https://github.com/elibyy/tcpdf-laravel/blob/1ab5166c8b4640ae3e6e9f49fcc24a5cd3a8e34a/src/ServiceProvider.php#L58-L65 |
brozot/Laravel-FCM | src/Request/Request.php | Request.buildBody | protected function buildBody()
{
$message = [
'to' => $this->getTo(),
'registration_ids' => $this->getRegistrationIds(),
'notification' => $this->getNotification(),
'data' => $this->getData(),
];
$message = array_merge($message, $this->getOpti... | php | protected function buildBody()
{
$message = [
'to' => $this->getTo(),
'registration_ids' => $this->getRegistrationIds(),
'notification' => $this->getNotification(),
'data' => $this->getData(),
];
$message = array_merge($message, $this->getOpti... | [
"protected",
"function",
"buildBody",
"(",
")",
"{",
"$",
"message",
"=",
"[",
"'to'",
"=>",
"$",
"this",
"->",
"getTo",
"(",
")",
",",
"'registration_ids'",
"=>",
"$",
"this",
"->",
"getRegistrationIds",
"(",
")",
",",
"'notification'",
"=>",
"$",
"this... | Build the body for the request.
@return array | [
"Build",
"the",
"body",
"for",
"the",
"request",
"."
] | train | https://github.com/brozot/Laravel-FCM/blob/248733c27bf4af3d259921d9664556f318d0bba4/src/Request/Request.php#L75-L88 |
brozot/Laravel-FCM | src/Request/Request.php | Request.getTo | protected function getTo()
{
$to = is_array($this->to) ? null : $this->to;
if ($this->topic && $this->topic->hasOnlyOneTopic()) {
$to = $this->topic->build();
}
return $to;
} | php | protected function getTo()
{
$to = is_array($this->to) ? null : $this->to;
if ($this->topic && $this->topic->hasOnlyOneTopic()) {
$to = $this->topic->build();
}
return $to;
} | [
"protected",
"function",
"getTo",
"(",
")",
"{",
"$",
"to",
"=",
"is_array",
"(",
"$",
"this",
"->",
"to",
")",
"?",
"null",
":",
"$",
"this",
"->",
"to",
";",
"if",
"(",
"$",
"this",
"->",
"topic",
"&&",
"$",
"this",
"->",
"topic",
"->",
"hasO... | get to key transformed.
@return array|null|string | [
"get",
"to",
"key",
"transformed",
"."
] | train | https://github.com/brozot/Laravel-FCM/blob/248733c27bf4af3d259921d9664556f318d0bba4/src/Request/Request.php#L95-L104 |
brozot/Laravel-FCM | src/Request/Request.php | Request.getOptions | protected function getOptions()
{
$options = $this->options ? $this->options->toArray() : [];
if ($this->topic && !$this->topic->hasOnlyOneTopic()) {
$options = array_merge($options, $this->topic->build());
}
return $options;
} | php | protected function getOptions()
{
$options = $this->options ? $this->options->toArray() : [];
if ($this->topic && !$this->topic->hasOnlyOneTopic()) {
$options = array_merge($options, $this->topic->build());
}
return $options;
} | [
"protected",
"function",
"getOptions",
"(",
")",
"{",
"$",
"options",
"=",
"$",
"this",
"->",
"options",
"?",
"$",
"this",
"->",
"options",
"->",
"toArray",
"(",
")",
":",
"[",
"]",
";",
"if",
"(",
"$",
"this",
"->",
"topic",
"&&",
"!",
"$",
"thi... | get Options transformed.
@return array | [
"get",
"Options",
"transformed",
"."
] | train | https://github.com/brozot/Laravel-FCM/blob/248733c27bf4af3d259921d9664556f318d0bba4/src/Request/Request.php#L121-L130 |
brozot/Laravel-FCM | src/Sender/FCMSender.php | FCMSender.sendTo | public function sendTo($to, Options $options = null, PayloadNotification $notification = null, PayloadData $data = null)
{
$response = null;
if (is_array($to) && !empty($to)) {
$partialTokens = array_chunk($to, self::MAX_TOKEN_PER_REQUEST, false);
foreach ($partialTokens as ... | php | public function sendTo($to, Options $options = null, PayloadNotification $notification = null, PayloadData $data = null)
{
$response = null;
if (is_array($to) && !empty($to)) {
$partialTokens = array_chunk($to, self::MAX_TOKEN_PER_REQUEST, false);
foreach ($partialTokens as ... | [
"public",
"function",
"sendTo",
"(",
"$",
"to",
",",
"Options",
"$",
"options",
"=",
"null",
",",
"PayloadNotification",
"$",
"notification",
"=",
"null",
",",
"PayloadData",
"$",
"data",
"=",
"null",
")",
"{",
"$",
"response",
"=",
"null",
";",
"if",
... | send a downstream message to.
- a unique device with is registration Token
- or to multiples devices with an array of registrationIds
@param string|array $to
@param Options|null $options
@param PayloadNotification|null $notification
@param PayloadData|null $data
@return DownstreamResp... | [
"send",
"a",
"downstream",
"message",
"to",
"."
] | train | https://github.com/brozot/Laravel-FCM/blob/248733c27bf4af3d259921d9664556f318d0bba4/src/Sender/FCMSender.php#L35-L61 |
brozot/Laravel-FCM | src/Sender/FCMSender.php | FCMSender.sendToGroup | public function sendToGroup($notificationKey, Options $options = null, PayloadNotification $notification = null, PayloadData $data = null)
{
$request = new Request($notificationKey, $options, $notification, $data);
$responseGuzzle = $this->post($request);
return new GroupResponse($response... | php | public function sendToGroup($notificationKey, Options $options = null, PayloadNotification $notification = null, PayloadData $data = null)
{
$request = new Request($notificationKey, $options, $notification, $data);
$responseGuzzle = $this->post($request);
return new GroupResponse($response... | [
"public",
"function",
"sendToGroup",
"(",
"$",
"notificationKey",
",",
"Options",
"$",
"options",
"=",
"null",
",",
"PayloadNotification",
"$",
"notification",
"=",
"null",
",",
"PayloadData",
"$",
"data",
"=",
"null",
")",
"{",
"$",
"request",
"=",
"new",
... | Send a message to a group of devices identified with them notification key.
@param $notificationKey
@param Options|null $options
@param PayloadNotification|null $notification
@param PayloadData|null $data
@return GroupResponse | [
"Send",
"a",
"message",
"to",
"a",
"group",
"of",
"devices",
"identified",
"with",
"them",
"notification",
"key",
"."
] | train | https://github.com/brozot/Laravel-FCM/blob/248733c27bf4af3d259921d9664556f318d0bba4/src/Sender/FCMSender.php#L73-L80 |
brozot/Laravel-FCM | src/Sender/FCMSender.php | FCMSender.sendToTopic | public function sendToTopic(Topics $topics, Options $options = null, PayloadNotification $notification = null, PayloadData $data = null)
{
$request = new Request(null, $options, $notification, $data, $topics);
$responseGuzzle = $this->post($request);
return new TopicResponse($responseGuzzl... | php | public function sendToTopic(Topics $topics, Options $options = null, PayloadNotification $notification = null, PayloadData $data = null)
{
$request = new Request(null, $options, $notification, $data, $topics);
$responseGuzzle = $this->post($request);
return new TopicResponse($responseGuzzl... | [
"public",
"function",
"sendToTopic",
"(",
"Topics",
"$",
"topics",
",",
"Options",
"$",
"options",
"=",
"null",
",",
"PayloadNotification",
"$",
"notification",
"=",
"null",
",",
"PayloadData",
"$",
"data",
"=",
"null",
")",
"{",
"$",
"request",
"=",
"new"... | Send message devices registered at a or more topics.
@param Topics $topics
@param Options|null $options
@param PayloadNotification|null $notification
@param PayloadData|null $data
@return TopicResponse | [
"Send",
"message",
"devices",
"registered",
"at",
"a",
"or",
"more",
"topics",
"."
] | train | https://github.com/brozot/Laravel-FCM/blob/248733c27bf4af3d259921d9664556f318d0bba4/src/Sender/FCMSender.php#L92-L99 |
brozot/Laravel-FCM | src/Sender/FCMSender.php | FCMSender.post | private function post($request)
{
try {
$responseGuzzle = $this->client->request('post', $this->url, $request->build());
} catch (ClientException $e) {
$responseGuzzle = $e->getResponse();
}
return $responseGuzzle;
} | php | private function post($request)
{
try {
$responseGuzzle = $this->client->request('post', $this->url, $request->build());
} catch (ClientException $e) {
$responseGuzzle = $e->getResponse();
}
return $responseGuzzle;
} | [
"private",
"function",
"post",
"(",
"$",
"request",
")",
"{",
"try",
"{",
"$",
"responseGuzzle",
"=",
"$",
"this",
"->",
"client",
"->",
"request",
"(",
"'post'",
",",
"$",
"this",
"->",
"url",
",",
"$",
"request",
"->",
"build",
"(",
")",
")",
";"... | @internal
@param \LaravelFCM\Request\Request $request
@return null|\Psr\Http\Message\ResponseInterface | [
"@internal"
] | train | https://github.com/brozot/Laravel-FCM/blob/248733c27bf4af3d259921d9664556f318d0bba4/src/Sender/FCMSender.php#L108-L117 |
brozot/Laravel-FCM | src/Response/BaseResponse.php | BaseResponse.isJsonResponse | private function isJsonResponse(ResponseInterface $response)
{
if ($response->getStatusCode() == 200) {
return;
}
if ($response->getStatusCode() == 400) {
throw new InvalidRequestException($response);
}
if ($response->getStatusCode() == 401) {
... | php | private function isJsonResponse(ResponseInterface $response)
{
if ($response->getStatusCode() == 200) {
return;
}
if ($response->getStatusCode() == 400) {
throw new InvalidRequestException($response);
}
if ($response->getStatusCode() == 401) {
... | [
"private",
"function",
"isJsonResponse",
"(",
"ResponseInterface",
"$",
"response",
")",
"{",
"if",
"(",
"$",
"response",
"->",
"getStatusCode",
"(",
")",
"==",
"200",
")",
"{",
"return",
";",
"}",
"if",
"(",
"$",
"response",
"->",
"getStatusCode",
"(",
... | Check if the response given by fcm is parsable.
@param \Psr\Http\Message\ResponseInterface $response
@throws InvalidRequestException
@throws ServerResponseException
@throws UnauthorizedRequestException | [
"Check",
"if",
"the",
"response",
"given",
"by",
"fcm",
"is",
"parsable",
"."
] | train | https://github.com/brozot/Laravel-FCM/blob/248733c27bf4af3d259921d9664556f318d0bba4/src/Response/BaseResponse.php#L47-L62 |
brozot/Laravel-FCM | src/Message/PayloadNotification.php | PayloadNotification.toArray | public function toArray()
{
$notification = [
'title' => $this->title,
'body' => $this->body,
'android_channel_id' => $this->channelId,
'icon' => $this->icon,
'sound' => $this->sound,
'badge' => $this->badge,
'tag' => $this-... | php | public function toArray()
{
$notification = [
'title' => $this->title,
'body' => $this->body,
'android_channel_id' => $this->channelId,
'icon' => $this->icon,
'sound' => $this->sound,
'badge' => $this->badge,
'tag' => $this-... | [
"public",
"function",
"toArray",
"(",
")",
"{",
"$",
"notification",
"=",
"[",
"'title'",
"=>",
"$",
"this",
"->",
"title",
",",
"'body'",
"=>",
"$",
"this",
"->",
"body",
",",
"'android_channel_id'",
"=>",
"$",
"this",
"->",
"channelId",
",",
"'icon'",
... | convert PayloadNotification to array.
@return array | [
"convert",
"PayloadNotification",
"to",
"array",
"."
] | train | https://github.com/brozot/Laravel-FCM/blob/248733c27bf4af3d259921d9664556f318d0bba4/src/Message/PayloadNotification.php#L130-L152 |
brozot/Laravel-FCM | src/Response/GroupResponse.php | GroupResponse.parseResponse | protected function parseResponse($responseInJson)
{
if ($this->parse($responseInJson)) {
$this->parseFailed($responseInJson);
}
if ($this->logEnabled) {
$this->logResponse();
}
} | php | protected function parseResponse($responseInJson)
{
if ($this->parse($responseInJson)) {
$this->parseFailed($responseInJson);
}
if ($this->logEnabled) {
$this->logResponse();
}
} | [
"protected",
"function",
"parseResponse",
"(",
"$",
"responseInJson",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"parse",
"(",
"$",
"responseInJson",
")",
")",
"{",
"$",
"this",
"->",
"parseFailed",
"(",
"$",
"responseInJson",
")",
";",
"}",
"if",
"(",
"$... | parse the response.
@param $responseInJson | [
"parse",
"the",
"response",
"."
] | train | https://github.com/brozot/Laravel-FCM/blob/248733c27bf4af3d259921d9664556f318d0bba4/src/Response/GroupResponse.php#L61-L70 |
brozot/Laravel-FCM | src/Response/GroupResponse.php | GroupResponse.logResponse | protected function logResponse()
{
$logger = new Logger('Laravel-FCM');
$logger->pushHandler(new StreamHandler(storage_path('logs/laravel-fcm.log')));
$logMessage = "notification send to group: $this->to";
$logMessage .= "with $this->numberTokensSuccess success and $this->numberToke... | php | protected function logResponse()
{
$logger = new Logger('Laravel-FCM');
$logger->pushHandler(new StreamHandler(storage_path('logs/laravel-fcm.log')));
$logMessage = "notification send to group: $this->to";
$logMessage .= "with $this->numberTokensSuccess success and $this->numberToke... | [
"protected",
"function",
"logResponse",
"(",
")",
"{",
"$",
"logger",
"=",
"new",
"Logger",
"(",
"'Laravel-FCM'",
")",
";",
"$",
"logger",
"->",
"pushHandler",
"(",
"new",
"StreamHandler",
"(",
"storage_path",
"(",
"'logs/laravel-fcm.log'",
")",
")",
")",
";... | Log the response. | [
"Log",
"the",
"response",
"."
] | train | https://github.com/brozot/Laravel-FCM/blob/248733c27bf4af3d259921d9664556f318d0bba4/src/Response/GroupResponse.php#L75-L84 |
brozot/Laravel-FCM | src/Response/GroupResponse.php | GroupResponse.parse | private function parse($responseInJson)
{
if (array_key_exists(self::SUCCESS, $responseInJson)) {
$this->numberTokensSuccess = $responseInJson[self::SUCCESS];
}
if (array_key_exists(self::FAILURE, $responseInJson)) {
$this->numberTokensFailure = $responseInJson[self::... | php | private function parse($responseInJson)
{
if (array_key_exists(self::SUCCESS, $responseInJson)) {
$this->numberTokensSuccess = $responseInJson[self::SUCCESS];
}
if (array_key_exists(self::FAILURE, $responseInJson)) {
$this->numberTokensFailure = $responseInJson[self::... | [
"private",
"function",
"parse",
"(",
"$",
"responseInJson",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"self",
"::",
"SUCCESS",
",",
"$",
"responseInJson",
")",
")",
"{",
"$",
"this",
"->",
"numberTokensSuccess",
"=",
"$",
"responseInJson",
"[",
"self",
... | @internal
@param $responseInJson
@return bool | [
"@internal"
] | train | https://github.com/brozot/Laravel-FCM/blob/248733c27bf4af3d259921d9664556f318d0bba4/src/Response/GroupResponse.php#L93-L103 |
brozot/Laravel-FCM | src/Response/GroupResponse.php | GroupResponse.parseFailed | private function parseFailed($responseInJson)
{
if (array_key_exists(self::FAILED_REGISTRATION_IDS, $responseInJson)) {
foreach ($responseInJson[self::FAILED_REGISTRATION_IDS] as $registrationId) {
$this->tokensFailed[] = $registrationId;
}
}
} | php | private function parseFailed($responseInJson)
{
if (array_key_exists(self::FAILED_REGISTRATION_IDS, $responseInJson)) {
foreach ($responseInJson[self::FAILED_REGISTRATION_IDS] as $registrationId) {
$this->tokensFailed[] = $registrationId;
}
}
} | [
"private",
"function",
"parseFailed",
"(",
"$",
"responseInJson",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"self",
"::",
"FAILED_REGISTRATION_IDS",
",",
"$",
"responseInJson",
")",
")",
"{",
"foreach",
"(",
"$",
"responseInJson",
"[",
"self",
"::",
"FAILE... | @internal
@param $responseInJson | [
"@internal"
] | train | https://github.com/brozot/Laravel-FCM/blob/248733c27bf4af3d259921d9664556f318d0bba4/src/Response/GroupResponse.php#L110-L117 |
brozot/Laravel-FCM | src/Response/DownstreamResponse.php | DownstreamResponse.parseResponse | protected function parseResponse($responseInJson)
{
$this->parse($responseInJson);
if ($this->needResultParsing($responseInJson)) {
$this->parseResult($responseInJson);
}
if ($this->logEnabled) {
$this->logResponse();
}
} | php | protected function parseResponse($responseInJson)
{
$this->parse($responseInJson);
if ($this->needResultParsing($responseInJson)) {
$this->parseResult($responseInJson);
}
if ($this->logEnabled) {
$this->logResponse();
}
} | [
"protected",
"function",
"parseResponse",
"(",
"$",
"responseInJson",
")",
"{",
"$",
"this",
"->",
"parse",
"(",
"$",
"responseInJson",
")",
";",
"if",
"(",
"$",
"this",
"->",
"needResultParsing",
"(",
"$",
"responseInJson",
")",
")",
"{",
"$",
"this",
"... | Parse the response.
@param $responseInJson | [
"Parse",
"the",
"response",
"."
] | train | https://github.com/brozot/Laravel-FCM/blob/248733c27bf4af3d259921d9664556f318d0bba4/src/Response/DownstreamResponse.php#L114-L125 |
brozot/Laravel-FCM | src/Response/DownstreamResponse.php | DownstreamResponse.parse | private function parse($responseInJson)
{
if (array_key_exists(self::MULTICAST_ID, $responseInJson)) {
$this->messageId;
}
if (array_key_exists(self::SUCCESS, $responseInJson)) {
$this->numberTokensSuccess = $responseInJson[self::SUCCESS];
}
if (arra... | php | private function parse($responseInJson)
{
if (array_key_exists(self::MULTICAST_ID, $responseInJson)) {
$this->messageId;
}
if (array_key_exists(self::SUCCESS, $responseInJson)) {
$this->numberTokensSuccess = $responseInJson[self::SUCCESS];
}
if (arra... | [
"private",
"function",
"parse",
"(",
"$",
"responseInJson",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"self",
"::",
"MULTICAST_ID",
",",
"$",
"responseInJson",
")",
")",
"{",
"$",
"this",
"->",
"messageId",
";",
"}",
"if",
"(",
"array_key_exists",
"(",... | @internal
@param $responseInJson | [
"@internal"
] | train | https://github.com/brozot/Laravel-FCM/blob/248733c27bf4af3d259921d9664556f318d0bba4/src/Response/DownstreamResponse.php#L132-L149 |
brozot/Laravel-FCM | src/Response/DownstreamResponse.php | DownstreamResponse.parseResult | private function parseResult($responseInJson)
{
foreach ($responseInJson[self::RESULTS] as $index => $result) {
if (!$this->isSent($result)) {
if (!$this->needToBeModify($index, $result)) {
if (!$this->needToBeDeleted($index, $result) && !$this->needToResend($... | php | private function parseResult($responseInJson)
{
foreach ($responseInJson[self::RESULTS] as $index => $result) {
if (!$this->isSent($result)) {
if (!$this->needToBeModify($index, $result)) {
if (!$this->needToBeDeleted($index, $result) && !$this->needToResend($... | [
"private",
"function",
"parseResult",
"(",
"$",
"responseInJson",
")",
"{",
"foreach",
"(",
"$",
"responseInJson",
"[",
"self",
"::",
"RESULTS",
"]",
"as",
"$",
"index",
"=>",
"$",
"result",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isSent",
"(",
... | @internal
@param $responseInJson | [
"@internal"
] | train | https://github.com/brozot/Laravel-FCM/blob/248733c27bf4af3d259921d9664556f318d0bba4/src/Response/DownstreamResponse.php#L156-L167 |
brozot/Laravel-FCM | src/Response/DownstreamResponse.php | DownstreamResponse.needResultParsing | private function needResultParsing($responseInJson)
{
return array_key_exists(self::RESULTS, $responseInJson) && ($this->numberTokensFailure > 0 || $this->numberTokenModify > 0);
} | php | private function needResultParsing($responseInJson)
{
return array_key_exists(self::RESULTS, $responseInJson) && ($this->numberTokensFailure > 0 || $this->numberTokenModify > 0);
} | [
"private",
"function",
"needResultParsing",
"(",
"$",
"responseInJson",
")",
"{",
"return",
"array_key_exists",
"(",
"self",
"::",
"RESULTS",
",",
"$",
"responseInJson",
")",
"&&",
"(",
"$",
"this",
"->",
"numberTokensFailure",
">",
"0",
"||",
"$",
"this",
"... | @internal
@param $responseInJson
@return bool | [
"@internal"
] | train | https://github.com/brozot/Laravel-FCM/blob/248733c27bf4af3d259921d9664556f318d0bba4/src/Response/DownstreamResponse.php#L176-L179 |
brozot/Laravel-FCM | src/Response/DownstreamResponse.php | DownstreamResponse.isSent | private function isSent($results)
{
return array_key_exists(self::MESSAGE_ID, $results) && !array_key_exists(self::REGISTRATION_ID, $results);
} | php | private function isSent($results)
{
return array_key_exists(self::MESSAGE_ID, $results) && !array_key_exists(self::REGISTRATION_ID, $results);
} | [
"private",
"function",
"isSent",
"(",
"$",
"results",
")",
"{",
"return",
"array_key_exists",
"(",
"self",
"::",
"MESSAGE_ID",
",",
"$",
"results",
")",
"&&",
"!",
"array_key_exists",
"(",
"self",
"::",
"REGISTRATION_ID",
",",
"$",
"results",
")",
";",
"}"... | @internal
@param $results
@return bool | [
"@internal"
] | train | https://github.com/brozot/Laravel-FCM/blob/248733c27bf4af3d259921d9664556f318d0bba4/src/Response/DownstreamResponse.php#L188-L191 |
brozot/Laravel-FCM | src/Response/DownstreamResponse.php | DownstreamResponse.needToBeModify | private function needToBeModify($index, $result)
{
if (array_key_exists(self::MESSAGE_ID, $result) && array_key_exists(self::REGISTRATION_ID, $result)) {
if ($this->tokens[$index]) {
$this->tokensToModify[$this->tokens[$index]] = $result[self::REGISTRATION_ID];
}
... | php | private function needToBeModify($index, $result)
{
if (array_key_exists(self::MESSAGE_ID, $result) && array_key_exists(self::REGISTRATION_ID, $result)) {
if ($this->tokens[$index]) {
$this->tokensToModify[$this->tokens[$index]] = $result[self::REGISTRATION_ID];
}
... | [
"private",
"function",
"needToBeModify",
"(",
"$",
"index",
",",
"$",
"result",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"self",
"::",
"MESSAGE_ID",
",",
"$",
"result",
")",
"&&",
"array_key_exists",
"(",
"self",
"::",
"REGISTRATION_ID",
",",
"$",
"re... | @internal
@param $index
@param $result
@return bool | [
"@internal"
] | train | https://github.com/brozot/Laravel-FCM/blob/248733c27bf4af3d259921d9664556f318d0bba4/src/Response/DownstreamResponse.php#L201-L212 |
brozot/Laravel-FCM | src/Response/DownstreamResponse.php | DownstreamResponse.needToBeDeleted | private function needToBeDeleted($index, $result)
{
if (array_key_exists(self::ERROR, $result) &&
(in_array(self::NOT_REGISTERED, $result) || in_array(self::INVALID_REGISTRATION, $result))) {
if ($this->tokens[$index]) {
$this->tokensToDelete[] = $this->tokens[$index]... | php | private function needToBeDeleted($index, $result)
{
if (array_key_exists(self::ERROR, $result) &&
(in_array(self::NOT_REGISTERED, $result) || in_array(self::INVALID_REGISTRATION, $result))) {
if ($this->tokens[$index]) {
$this->tokensToDelete[] = $this->tokens[$index]... | [
"private",
"function",
"needToBeDeleted",
"(",
"$",
"index",
",",
"$",
"result",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"self",
"::",
"ERROR",
",",
"$",
"result",
")",
"&&",
"(",
"in_array",
"(",
"self",
"::",
"NOT_REGISTERED",
",",
"$",
"result",... | @internal
@param $index
@param $result
@return bool | [
"@internal"
] | train | https://github.com/brozot/Laravel-FCM/blob/248733c27bf4af3d259921d9664556f318d0bba4/src/Response/DownstreamResponse.php#L222-L234 |
brozot/Laravel-FCM | src/Response/DownstreamResponse.php | DownstreamResponse.needToResend | private function needToResend($index, $result)
{
if (array_key_exists(self::ERROR, $result) && (in_array(self::UNAVAILABLE, $result) || in_array(self::DEVICE_MESSAGE_RATE_EXCEEDED, $result) || in_array(self::INTERNAL_SERVER_ERROR, $result))) {
if ($this->tokens[$index]) {
$this->... | php | private function needToResend($index, $result)
{
if (array_key_exists(self::ERROR, $result) && (in_array(self::UNAVAILABLE, $result) || in_array(self::DEVICE_MESSAGE_RATE_EXCEEDED, $result) || in_array(self::INTERNAL_SERVER_ERROR, $result))) {
if ($this->tokens[$index]) {
$this->... | [
"private",
"function",
"needToResend",
"(",
"$",
"index",
",",
"$",
"result",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"self",
"::",
"ERROR",
",",
"$",
"result",
")",
"&&",
"(",
"in_array",
"(",
"self",
"::",
"UNAVAILABLE",
",",
"$",
"result",
")"... | @internal
@param $index
@param $result
@return bool | [
"@internal"
] | train | https://github.com/brozot/Laravel-FCM/blob/248733c27bf4af3d259921d9664556f318d0bba4/src/Response/DownstreamResponse.php#L244-L255 |
brozot/Laravel-FCM | src/Response/DownstreamResponse.php | DownstreamResponse.checkMissingToken | private function checkMissingToken($result)
{
$hasMissingToken = (array_key_exists(self::ERROR, $result) && in_array(self::MISSING_REGISTRATION, $result));
$this->hasMissingToken = (bool) ($this->hasMissingToken | $hasMissingToken);
return $hasMissingToken;
} | php | private function checkMissingToken($result)
{
$hasMissingToken = (array_key_exists(self::ERROR, $result) && in_array(self::MISSING_REGISTRATION, $result));
$this->hasMissingToken = (bool) ($this->hasMissingToken | $hasMissingToken);
return $hasMissingToken;
} | [
"private",
"function",
"checkMissingToken",
"(",
"$",
"result",
")",
"{",
"$",
"hasMissingToken",
"=",
"(",
"array_key_exists",
"(",
"self",
"::",
"ERROR",
",",
"$",
"result",
")",
"&&",
"in_array",
"(",
"self",
"::",
"MISSING_REGISTRATION",
",",
"$",
"resul... | @internal
@param $result
@return bool | [
"@internal"
] | train | https://github.com/brozot/Laravel-FCM/blob/248733c27bf4af3d259921d9664556f318d0bba4/src/Response/DownstreamResponse.php#L264-L271 |
brozot/Laravel-FCM | src/Response/DownstreamResponse.php | DownstreamResponse.needToAddError | private function needToAddError($index, $result)
{
if (array_key_exists(self::ERROR, $result)) {
if ($this->tokens[$index]) {
$this->tokensWithError[$this->tokens[$index]] = $result[self::ERROR];
}
}
} | php | private function needToAddError($index, $result)
{
if (array_key_exists(self::ERROR, $result)) {
if ($this->tokens[$index]) {
$this->tokensWithError[$this->tokens[$index]] = $result[self::ERROR];
}
}
} | [
"private",
"function",
"needToAddError",
"(",
"$",
"index",
",",
"$",
"result",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"self",
"::",
"ERROR",
",",
"$",
"result",
")",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"tokens",
"[",
"$",
"index",
"]",
... | @internal
@param $index
@param $result | [
"@internal"
] | train | https://github.com/brozot/Laravel-FCM/blob/248733c27bf4af3d259921d9664556f318d0bba4/src/Response/DownstreamResponse.php#L279-L286 |
brozot/Laravel-FCM | src/Response/DownstreamResponse.php | DownstreamResponse.merge | public function merge(DownstreamResponse $response)
{
$this->numberTokensSuccess += $response->numberSuccess();
$this->numberTokensFailure += $response->numberFailure();
$this->numberTokenModify += $response->numberModification();
$this->tokensToDelete = array_merge($this->tokensToD... | php | public function merge(DownstreamResponse $response)
{
$this->numberTokensSuccess += $response->numberSuccess();
$this->numberTokensFailure += $response->numberFailure();
$this->numberTokenModify += $response->numberModification();
$this->tokensToDelete = array_merge($this->tokensToD... | [
"public",
"function",
"merge",
"(",
"DownstreamResponse",
"$",
"response",
")",
"{",
"$",
"this",
"->",
"numberTokensSuccess",
"+=",
"$",
"response",
"->",
"numberSuccess",
"(",
")",
";",
"$",
"this",
"->",
"numberTokensFailure",
"+=",
"$",
"response",
"->",
... | Merge two response.
@param DownstreamResponse $response | [
"Merge",
"two",
"response",
"."
] | train | https://github.com/brozot/Laravel-FCM/blob/248733c27bf4af3d259921d9664556f318d0bba4/src/Response/DownstreamResponse.php#L309-L319 |
brozot/Laravel-FCM | src/Response/TopicResponse.php | TopicResponse.parseResponse | protected function parseResponse($responseInJson)
{
if (!$this->parseSuccess($responseInJson)) {
$this->parseError($responseInJson);
}
if ($this->logEnabled) {
$this->logResponse();
}
} | php | protected function parseResponse($responseInJson)
{
if (!$this->parseSuccess($responseInJson)) {
$this->parseError($responseInJson);
}
if ($this->logEnabled) {
$this->logResponse();
}
} | [
"protected",
"function",
"parseResponse",
"(",
"$",
"responseInJson",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"parseSuccess",
"(",
"$",
"responseInJson",
")",
")",
"{",
"$",
"this",
"->",
"parseError",
"(",
"$",
"responseInJson",
")",
";",
"}",
"if"... | parse the response.
@param $responseInJson | [
"parse",
"the",
"response",
"."
] | train | https://github.com/brozot/Laravel-FCM/blob/248733c27bf4af3d259921d9664556f318d0bba4/src/Response/TopicResponse.php#L62-L71 |
brozot/Laravel-FCM | src/Response/TopicResponse.php | TopicResponse.parseSuccess | private function parseSuccess($responseInJson)
{
if (array_key_exists(self::MESSAGE_ID, $responseInJson)) {
$this->messageId = $responseInJson[ self::MESSAGE_ID ];
}
} | php | private function parseSuccess($responseInJson)
{
if (array_key_exists(self::MESSAGE_ID, $responseInJson)) {
$this->messageId = $responseInJson[ self::MESSAGE_ID ];
}
} | [
"private",
"function",
"parseSuccess",
"(",
"$",
"responseInJson",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"self",
"::",
"MESSAGE_ID",
",",
"$",
"responseInJson",
")",
")",
"{",
"$",
"this",
"->",
"messageId",
"=",
"$",
"responseInJson",
"[",
"self",
... | @internal
@param $responseInJson | [
"@internal"
] | train | https://github.com/brozot/Laravel-FCM/blob/248733c27bf4af3d259921d9664556f318d0bba4/src/Response/TopicResponse.php#L78-L83 |
brozot/Laravel-FCM | src/Response/TopicResponse.php | TopicResponse.parseError | private function parseError($responseInJson)
{
if (array_key_exists(self::ERROR, $responseInJson)) {
if (in_array(self::LIMIT_RATE_TOPICS_EXCEEDED, $responseInJson)) {
$this->needRetry = true;
}
$this->error = $responseInJson[ self::ERROR ];
}
... | php | private function parseError($responseInJson)
{
if (array_key_exists(self::ERROR, $responseInJson)) {
if (in_array(self::LIMIT_RATE_TOPICS_EXCEEDED, $responseInJson)) {
$this->needRetry = true;
}
$this->error = $responseInJson[ self::ERROR ];
}
... | [
"private",
"function",
"parseError",
"(",
"$",
"responseInJson",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"self",
"::",
"ERROR",
",",
"$",
"responseInJson",
")",
")",
"{",
"if",
"(",
"in_array",
"(",
"self",
"::",
"LIMIT_RATE_TOPICS_EXCEEDED",
",",
"$",... | @internal
@param $responseInJson | [
"@internal"
] | train | https://github.com/brozot/Laravel-FCM/blob/248733c27bf4af3d259921d9664556f318d0bba4/src/Response/TopicResponse.php#L90-L99 |
brozot/Laravel-FCM | src/Response/TopicResponse.php | TopicResponse.logResponse | protected function logResponse()
{
$logger = new Logger('Laravel-FCM');
$logger->pushHandler(new StreamHandler(storage_path('logs/laravel-fcm.log')));
$topic = $this->topic->build();
$logMessage = "notification send to topic: ".json_encode($topic);
if ($this->messageId) {
... | php | protected function logResponse()
{
$logger = new Logger('Laravel-FCM');
$logger->pushHandler(new StreamHandler(storage_path('logs/laravel-fcm.log')));
$topic = $this->topic->build();
$logMessage = "notification send to topic: ".json_encode($topic);
if ($this->messageId) {
... | [
"protected",
"function",
"logResponse",
"(",
")",
"{",
"$",
"logger",
"=",
"new",
"Logger",
"(",
"'Laravel-FCM'",
")",
";",
"$",
"logger",
"->",
"pushHandler",
"(",
"new",
"StreamHandler",
"(",
"storage_path",
"(",
"'logs/laravel-fcm.log'",
")",
")",
")",
";... | Log the response. | [
"Log",
"the",
"response",
"."
] | train | https://github.com/brozot/Laravel-FCM/blob/248733c27bf4af3d259921d9664556f318d0bba4/src/Response/TopicResponse.php#L104-L119 |
brozot/Laravel-FCM | src/Message/Topics.php | Topics.on | private function on($first, $condition)
{
if ($first instanceof Closure) {
return $this->nest($first, $condition);
}
$this->conditions[] = compact('condition', 'first');
return $this;
} | php | private function on($first, $condition)
{
if ($first instanceof Closure) {
return $this->nest($first, $condition);
}
$this->conditions[] = compact('condition', 'first');
return $this;
} | [
"private",
"function",
"on",
"(",
"$",
"first",
",",
"$",
"condition",
")",
"{",
"if",
"(",
"$",
"first",
"instanceof",
"Closure",
")",
"{",
"return",
"$",
"this",
"->",
"nest",
"(",
"$",
"first",
",",
"$",
"condition",
")",
";",
"}",
"$",
"this",
... | @internal
@param $first
@param $condition
@return $this|Topics | [
"@internal"
] | train | https://github.com/brozot/Laravel-FCM/blob/248733c27bf4af3d259921d9664556f318d0bba4/src/Message/Topics.php#L112-L121 |
brozot/Laravel-FCM | src/Message/Topics.php | Topics.nest | public function nest(Closure $callback, $condition)
{
$topic = new static();
$callback($topic);
if (count($topic->conditions)) {
$open_parenthesis = '(';
$topic = $topic->conditions;
$close_parenthesis = ')';
$this->conditions[] = compact('co... | php | public function nest(Closure $callback, $condition)
{
$topic = new static();
$callback($topic);
if (count($topic->conditions)) {
$open_parenthesis = '(';
$topic = $topic->conditions;
$close_parenthesis = ')';
$this->conditions[] = compact('co... | [
"public",
"function",
"nest",
"(",
"Closure",
"$",
"callback",
",",
"$",
"condition",
")",
"{",
"$",
"topic",
"=",
"new",
"static",
"(",
")",
";",
"$",
"callback",
"(",
"$",
"topic",
")",
";",
"if",
"(",
"count",
"(",
"$",
"topic",
"->",
"condition... | @internal
@param Closure $callback
@param $condition
@return $this | [
"@internal"
] | train | https://github.com/brozot/Laravel-FCM/blob/248733c27bf4af3d259921d9664556f318d0bba4/src/Message/Topics.php#L131-L145 |
brozot/Laravel-FCM | src/Message/Topics.php | Topics.build | public function build()
{
$this->checkIfOneTopicExist();
if ($this->hasOnlyOneTopic()) {
foreach ($this->conditions[0] as $topic) {
return '/topics/'.$topic;
}
}
return [
'condition' => $this->topicsForFcm($this->conditions),
... | php | public function build()
{
$this->checkIfOneTopicExist();
if ($this->hasOnlyOneTopic()) {
foreach ($this->conditions[0] as $topic) {
return '/topics/'.$topic;
}
}
return [
'condition' => $this->topicsForFcm($this->conditions),
... | [
"public",
"function",
"build",
"(",
")",
"{",
"$",
"this",
"->",
"checkIfOneTopicExist",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"hasOnlyOneTopic",
"(",
")",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"conditions",
"[",
"0",
"]",
"as",
"$",
... | Transform to array.
@return array|string
@throws NoTopicProvided | [
"Transform",
"to",
"array",
"."
] | train | https://github.com/brozot/Laravel-FCM/blob/248733c27bf4af3d259921d9664556f318d0bba4/src/Message/Topics.php#L154-L167 |
brozot/Laravel-FCM | src/Message/Topics.php | Topics.topicsForFcm | private function topicsForFcm($conditions)
{
$condition = '';
foreach ($conditions as $partial) {
if (array_key_exists('condition', $partial)) {
$condition .= $partial['condition'];
}
if (array_key_exists('first', $partial)) {
$top... | php | private function topicsForFcm($conditions)
{
$condition = '';
foreach ($conditions as $partial) {
if (array_key_exists('condition', $partial)) {
$condition .= $partial['condition'];
}
if (array_key_exists('first', $partial)) {
$top... | [
"private",
"function",
"topicsForFcm",
"(",
"$",
"conditions",
")",
"{",
"$",
"condition",
"=",
"''",
";",
"foreach",
"(",
"$",
"conditions",
"as",
"$",
"partial",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"'condition'",
",",
"$",
"partial",
")",
")"... | @internal
@param $conditions
@return string | [
"@internal"
] | train | https://github.com/brozot/Laravel-FCM/blob/248733c27bf4af3d259921d9664556f318d0bba4/src/Message/Topics.php#L176-L203 |
brozot/Laravel-FCM | src/Sender/FCMGroup.php | FCMGroup.createGroup | public function createGroup($notificationKeyName, array $registrationIds)
{
$request = new GroupRequest(self::CREATE, $notificationKeyName, null, $registrationIds);
$response = $this->client->request('post', $this->url, $request->build());
return $this->getNotificationToken($response);
... | php | public function createGroup($notificationKeyName, array $registrationIds)
{
$request = new GroupRequest(self::CREATE, $notificationKeyName, null, $registrationIds);
$response = $this->client->request('post', $this->url, $request->build());
return $this->getNotificationToken($response);
... | [
"public",
"function",
"createGroup",
"(",
"$",
"notificationKeyName",
",",
"array",
"$",
"registrationIds",
")",
"{",
"$",
"request",
"=",
"new",
"GroupRequest",
"(",
"self",
"::",
"CREATE",
",",
"$",
"notificationKeyName",
",",
"null",
",",
"$",
"registration... | Create a group.
@param $notificationKeyName
@param array $registrationIds
@return null|string notification_key | [
"Create",
"a",
"group",
"."
] | train | https://github.com/brozot/Laravel-FCM/blob/248733c27bf4af3d259921d9664556f318d0bba4/src/Sender/FCMGroup.php#L25-L32 |
brozot/Laravel-FCM | src/Sender/FCMGroup.php | FCMGroup.addToGroup | public function addToGroup($notificationKeyName, $notificationKey, array $registrationIds)
{
$request = new GroupRequest(self::ADD, $notificationKeyName, $notificationKey, $registrationIds);
$response = $this->client->request('post', $this->url, $request->build());
return $this->getNotifica... | php | public function addToGroup($notificationKeyName, $notificationKey, array $registrationIds)
{
$request = new GroupRequest(self::ADD, $notificationKeyName, $notificationKey, $registrationIds);
$response = $this->client->request('post', $this->url, $request->build());
return $this->getNotifica... | [
"public",
"function",
"addToGroup",
"(",
"$",
"notificationKeyName",
",",
"$",
"notificationKey",
",",
"array",
"$",
"registrationIds",
")",
"{",
"$",
"request",
"=",
"new",
"GroupRequest",
"(",
"self",
"::",
"ADD",
",",
"$",
"notificationKeyName",
",",
"$",
... | add registrationId to a existing group.
@param $notificationKeyName
@param $notificationKey
@param array $registrationIds registrationIds to add
@return null|string notification_key | [
"add",
"registrationId",
"to",
"a",
"existing",
"group",
"."
] | train | https://github.com/brozot/Laravel-FCM/blob/248733c27bf4af3d259921d9664556f318d0bba4/src/Sender/FCMGroup.php#L42-L48 |
brozot/Laravel-FCM | src/Sender/FCMGroup.php | FCMGroup.removeFromGroup | public function removeFromGroup($notificationKeyName, $notificationKey, array $registeredIds)
{
$request = new GroupRequest(self::REMOVE, $notificationKeyName, $notificationKey, $registeredIds);
$response = $this->client->request('post', $this->url, $request->build());
return $this->getNoti... | php | public function removeFromGroup($notificationKeyName, $notificationKey, array $registeredIds)
{
$request = new GroupRequest(self::REMOVE, $notificationKeyName, $notificationKey, $registeredIds);
$response = $this->client->request('post', $this->url, $request->build());
return $this->getNoti... | [
"public",
"function",
"removeFromGroup",
"(",
"$",
"notificationKeyName",
",",
"$",
"notificationKey",
",",
"array",
"$",
"registeredIds",
")",
"{",
"$",
"request",
"=",
"new",
"GroupRequest",
"(",
"self",
"::",
"REMOVE",
",",
"$",
"notificationKeyName",
",",
... | remove registrationId to a existing group.
>Note: if you remove all registrationIds the group is automatically deleted
@param $notificationKeyName
@param $notificationKey
@param array $registeredIds registrationIds to remove
@return null|string notification_key | [
"remove",
"registrationId",
"to",
"a",
"existing",
"group",
"."
] | train | https://github.com/brozot/Laravel-FCM/blob/248733c27bf4af3d259921d9664556f318d0bba4/src/Sender/FCMGroup.php#L60-L66 |
brozot/Laravel-FCM | src/Sender/FCMGroup.php | FCMGroup.getNotificationToken | private function getNotificationToken(ResponseInterface $response)
{
if (! $this->isValidResponse($response)) {
return null;
}
$json = json_decode($response->getBody()->getContents(), true);
return $json['notification_key'];
} | php | private function getNotificationToken(ResponseInterface $response)
{
if (! $this->isValidResponse($response)) {
return null;
}
$json = json_decode($response->getBody()->getContents(), true);
return $json['notification_key'];
} | [
"private",
"function",
"getNotificationToken",
"(",
"ResponseInterface",
"$",
"response",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isValidResponse",
"(",
"$",
"response",
")",
")",
"{",
"return",
"null",
";",
"}",
"$",
"json",
"=",
"json_decode",
"(",... | @internal
@param \Psr\Http\Message\ResponseInterface $response
@return null|string notification_key | [
"@internal"
] | train | https://github.com/brozot/Laravel-FCM/blob/248733c27bf4af3d259921d9664556f318d0bba4/src/Sender/FCMGroup.php#L74-L83 |
brozot/Laravel-FCM | src/Message/Options.php | Options.toArray | public function toArray()
{
$contentAvailable = $this->contentAvailable ? true : null;
$mutableContent = $this->isMutableContent ? true : null;
$delayWhileIdle = $this->delayWhileIdle ? true : null;
$dryRun = $this->isDryRun ? true : null;
$options = [
'collapse_... | php | public function toArray()
{
$contentAvailable = $this->contentAvailable ? true : null;
$mutableContent = $this->isMutableContent ? true : null;
$delayWhileIdle = $this->delayWhileIdle ? true : null;
$dryRun = $this->isDryRun ? true : null;
$options = [
'collapse_... | [
"public",
"function",
"toArray",
"(",
")",
"{",
"$",
"contentAvailable",
"=",
"$",
"this",
"->",
"contentAvailable",
"?",
"true",
":",
"null",
";",
"$",
"mutableContent",
"=",
"$",
"this",
"->",
"isMutableContent",
"?",
"true",
":",
"null",
";",
"$",
"de... | Transform Option to array.
@return array | [
"Transform",
"Option",
"to",
"array",
"."
] | train | https://github.com/brozot/Laravel-FCM/blob/248733c27bf4af3d259921d9664556f318d0bba4/src/Message/Options.php#L90-L109 |
brozot/Laravel-FCM | src/Message/OptionsBuilder.php | OptionsBuilder.setPriority | public function setPriority($priority)
{
if (!OptionsPriorities::isValid($priority)) {
throw new InvalidOptionsException('priority is not valid, please refer to the documentation or use the constants of the class "OptionsPriorities"');
}
$this->priority = $priority;
retu... | php | public function setPriority($priority)
{
if (!OptionsPriorities::isValid($priority)) {
throw new InvalidOptionsException('priority is not valid, please refer to the documentation or use the constants of the class "OptionsPriorities"');
}
$this->priority = $priority;
retu... | [
"public",
"function",
"setPriority",
"(",
"$",
"priority",
")",
"{",
"if",
"(",
"!",
"OptionsPriorities",
"::",
"isValid",
"(",
"$",
"priority",
")",
")",
"{",
"throw",
"new",
"InvalidOptionsException",
"(",
"'priority is not valid, please refer to the documentation o... | Sets the priority of the message. Valid values are "normal" and "high."
By default, messages are sent with normal priority.
@param string $priority
@return \LaravelFCM\Message\OptionsBuilder
@throws InvalidOptionsException | [
"Sets",
"the",
"priority",
"of",
"the",
"message",
".",
"Valid",
"values",
"are",
"normal",
"and",
"high",
".",
"By",
"default",
"messages",
"are",
"sent",
"with",
"normal",
"priority",
"."
] | train | https://github.com/brozot/Laravel-FCM/blob/248733c27bf4af3d259921d9664556f318d0bba4/src/Message/OptionsBuilder.php#L97-L105 |
rosell-dk/webp-convert | src/Serve/ServeFile.php | ServeFile.serve | public static function serve($filename, $contentType, $options)
{
$options = array_merge(self::$defaultOptions, $options);
if ($options['set-last-modified-header'] === true) {
Header::setHeader("Last-Modified: " . gmdate("D, d M Y H:i:s", @filemtime($filename)) ." GMT");
}
... | php | public static function serve($filename, $contentType, $options)
{
$options = array_merge(self::$defaultOptions, $options);
if ($options['set-last-modified-header'] === true) {
Header::setHeader("Last-Modified: " . gmdate("D, d M Y H:i:s", @filemtime($filename)) ." GMT");
}
... | [
"public",
"static",
"function",
"serve",
"(",
"$",
"filename",
",",
"$",
"contentType",
",",
"$",
"options",
")",
"{",
"$",
"options",
"=",
"array_merge",
"(",
"self",
"::",
"$",
"defaultOptions",
",",
"$",
"options",
")",
";",
"if",
"(",
"$",
"options... | Serve existing file
@throws ServeFailedException if serving failed
@return void | [
"Serve",
"existing",
"file"
] | train | https://github.com/rosell-dk/webp-convert/blob/d54b23dbce745cae7955ee1c7ba912731f679ee1/src/Serve/ServeFile.php#L32-L65 |
rosell-dk/webp-convert | src/Convert/Converters/Gmagick.php | Gmagick.checkOperationality | public function checkOperationality()
{
if (!extension_loaded('Gmagick')) {
throw new SystemRequirementsNotMetException('Required Gmagick extension is not available.');
}
if (!class_exists('Gmagick')) {
throw new SystemRequirementsNotMetException(
'Gm... | php | public function checkOperationality()
{
if (!extension_loaded('Gmagick')) {
throw new SystemRequirementsNotMetException('Required Gmagick extension is not available.');
}
if (!class_exists('Gmagick')) {
throw new SystemRequirementsNotMetException(
'Gm... | [
"public",
"function",
"checkOperationality",
"(",
")",
"{",
"if",
"(",
"!",
"extension_loaded",
"(",
"'Gmagick'",
")",
")",
"{",
"throw",
"new",
"SystemRequirementsNotMetException",
"(",
"'Required Gmagick extension is not available.'",
")",
";",
"}",
"if",
"(",
"!"... | Check (general) operationality of Gmagick converter.
Note:
It may be that Gd has been compiled without jpeg support or png support.
We do not check for this here, as the converter could still be used for the other.
@throws SystemRequirementsNotMetException if system requirements are not met | [
"Check",
"(",
"general",
")",
"operationality",
"of",
"Gmagick",
"converter",
"."
] | train | https://github.com/rosell-dk/webp-convert/blob/d54b23dbce745cae7955ee1c7ba912731f679ee1/src/Convert/Converters/Gmagick.php#L36-L53 |
rosell-dk/webp-convert | src/Convert/Converters/Gmagick.php | Gmagick.checkConvertability | public function checkConvertability()
{
$im = new \Gmagick();
$mimeType = $this->getMimeTypeOfSource();
switch ($mimeType) {
case 'image/png':
if (!in_array('PNG', $im->queryFormats())) {
throw new SystemRequirementsNotMetException(
... | php | public function checkConvertability()
{
$im = new \Gmagick();
$mimeType = $this->getMimeTypeOfSource();
switch ($mimeType) {
case 'image/png':
if (!in_array('PNG', $im->queryFormats())) {
throw new SystemRequirementsNotMetException(
... | [
"public",
"function",
"checkConvertability",
"(",
")",
"{",
"$",
"im",
"=",
"new",
"\\",
"Gmagick",
"(",
")",
";",
"$",
"mimeType",
"=",
"$",
"this",
"->",
"getMimeTypeOfSource",
"(",
")",
";",
"switch",
"(",
"$",
"mimeType",
")",
"{",
"case",
"'image/... | Check if specific file is convertable with current converter / converter settings.
@throws SystemRequirementsNotMetException if Gmagick does not support image type | [
"Check",
"if",
"specific",
"file",
"is",
"convertable",
"with",
"current",
"converter",
"/",
"converter",
"settings",
"."
] | train | https://github.com/rosell-dk/webp-convert/blob/d54b23dbce745cae7955ee1c7ba912731f679ee1/src/Convert/Converters/Gmagick.php#L60-L80 |
rosell-dk/webp-convert | src/Convert/Converters/Gmagick.php | Gmagick.doActualConvert | protected function doActualConvert()
{
$options = $this->options;
try {
$im = new \Gmagick($this->source);
} catch (\Exception $e) {
throw new ConversionFailedException(
'Failed creating Gmagick object of file',
'Failed creating Gmagi... | php | protected function doActualConvert()
{
$options = $this->options;
try {
$im = new \Gmagick($this->source);
} catch (\Exception $e) {
throw new ConversionFailedException(
'Failed creating Gmagick object of file',
'Failed creating Gmagi... | [
"protected",
"function",
"doActualConvert",
"(",
")",
"{",
"$",
"options",
"=",
"$",
"this",
"->",
"options",
";",
"try",
"{",
"$",
"im",
"=",
"new",
"\\",
"Gmagick",
"(",
"$",
"this",
"->",
"source",
")",
";",
"}",
"catch",
"(",
"\\",
"Exception",
... | takes care of preparing stuff before calling doConvert, and validating after. | [
"takes",
"care",
"of",
"preparing",
"stuff",
"before",
"calling",
"doConvert",
"and",
"validating",
"after",
"."
] | train | https://github.com/rosell-dk/webp-convert/blob/d54b23dbce745cae7955ee1c7ba912731f679ee1/src/Convert/Converters/Gmagick.php#L85-L155 |
rosell-dk/webp-convert | src/Serve/ServeConvertedWebP.php | ServeConvertedWebP.serveOriginal | public static function serveOriginal($source, $options)
{
$contentType = ImageMimeTypeGuesser::lenientGuess($source);
if (is_null($contentType)) {
throw new ServeFailedException('Rejecting to serve original (mime type cannot be determined)');
} elseif ($contentType === false) {
... | php | public static function serveOriginal($source, $options)
{
$contentType = ImageMimeTypeGuesser::lenientGuess($source);
if (is_null($contentType)) {
throw new ServeFailedException('Rejecting to serve original (mime type cannot be determined)');
} elseif ($contentType === false) {
... | [
"public",
"static",
"function",
"serveOriginal",
"(",
"$",
"source",
",",
"$",
"options",
")",
"{",
"$",
"contentType",
"=",
"ImageMimeTypeGuesser",
"::",
"lenientGuess",
"(",
"$",
"source",
")",
";",
"if",
"(",
"is_null",
"(",
"$",
"contentType",
")",
")"... | Serve original file (source).
@param string $source path to source file
@param array $options (optional) options for serving
@throws ServeFailedException if source is not an image or mime type cannot be determined | [
"Serve",
"original",
"file",
"(",
"source",
")",
"."
] | train | https://github.com/rosell-dk/webp-convert/blob/d54b23dbce745cae7955ee1c7ba912731f679ee1/src/Serve/ServeConvertedWebP.php#L56-L66 |
rosell-dk/webp-convert | src/Serve/ServeConvertedWebP.php | ServeConvertedWebP.serve | public static function serve($source, $destination, $options = [])
{
if (empty($source)) {
throw new ServeFailedException('Source argument missing');
}
if (empty($destination)) {
throw new ServeFailedException('Destination argument missing');
}
if (@!f... | php | public static function serve($source, $destination, $options = [])
{
if (empty($source)) {
throw new ServeFailedException('Source argument missing');
}
if (empty($destination)) {
throw new ServeFailedException('Destination argument missing');
}
if (@!f... | [
"public",
"static",
"function",
"serve",
"(",
"$",
"source",
",",
"$",
"destination",
",",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"source",
")",
")",
"{",
"throw",
"new",
"ServeFailedException",
"(",
"'Source argument miss... | Serve converted webp.
@param string $source path to source file
@param string $destination path to destination
@param array $options (optional) options for serving/converting
@throws ServeFailedException If an argument is invalid or source file does not exists
@return void | [
"Serve",
"converted",
"webp",
"."
] | train | https://github.com/rosell-dk/webp-convert/blob/d54b23dbce745cae7955ee1c7ba912731f679ee1/src/Serve/ServeConvertedWebP.php#L83-L116 |
rosell-dk/webp-convert | src/Convert/BaseConverters/AbstractExecConverter.php | AbstractExecConverter.hasNiceSupport | protected static function hasNiceSupport()
{
exec("nice 2>&1", $niceOutput);
if (is_array($niceOutput) && isset($niceOutput[0])) {
if (preg_match('/usage/', $niceOutput[0]) || (preg_match('/^\d+$/', $niceOutput[0]))) {
/*
* Nice is available - default ni... | php | protected static function hasNiceSupport()
{
exec("nice 2>&1", $niceOutput);
if (is_array($niceOutput) && isset($niceOutput[0])) {
if (preg_match('/usage/', $niceOutput[0]) || (preg_match('/^\d+$/', $niceOutput[0]))) {
/*
* Nice is available - default ni... | [
"protected",
"static",
"function",
"hasNiceSupport",
"(",
")",
"{",
"exec",
"(",
"\"nice 2>&1\"",
",",
"$",
"niceOutput",
")",
";",
"if",
"(",
"is_array",
"(",
"$",
"niceOutput",
")",
"&&",
"isset",
"(",
"$",
"niceOutput",
"[",
"0",
"]",
")",
")",
"{",... | Helper function for examining if "nice" command is available
@return boolean true if nice is available | [
"Helper",
"function",
"for",
"examining",
"if",
"nice",
"command",
"is",
"available"
] | train | https://github.com/rosell-dk/webp-convert/blob/d54b23dbce745cae7955ee1c7ba912731f679ee1/src/Convert/BaseConverters/AbstractExecConverter.php#L25-L41 |
rosell-dk/webp-convert | src/Convert/Converters/Gd.php | Gd.makeTrueColorUsingWorkaround | private function makeTrueColorUsingWorkaround(&$image)
{
//return $this->makeTrueColor($image);
/*
if (function_exists('imageistruecolor') && imageistruecolor($image)) {
return true;
}*/
if (self::functionsExist(['imagecreatetruecolor', 'imagealphablending', 'imag... | php | private function makeTrueColorUsingWorkaround(&$image)
{
//return $this->makeTrueColor($image);
/*
if (function_exists('imageistruecolor') && imageistruecolor($image)) {
return true;
}*/
if (self::functionsExist(['imagecreatetruecolor', 'imagealphablending', 'imag... | [
"private",
"function",
"makeTrueColorUsingWorkaround",
"(",
"&",
"$",
"image",
")",
"{",
"//return $this->makeTrueColor($image);",
"/*\n if (function_exists('imageistruecolor') && imageistruecolor($image)) {\n return true;\n }*/",
"if",
"(",
"self",
"::",
"func... | Try to convert image pallette to true color on older systems that does not have imagepalettetotruecolor().
The aim is to function as imagepalettetotruecolor, but for older systems.
So, if the image is already rgb, nothing will be done, and true will be returned
PS: Got the workaround here: https://secure.php.net/manua... | [
"Try",
"to",
"convert",
"image",
"pallette",
"to",
"true",
"color",
"on",
"older",
"systems",
"that",
"does",
"not",
"have",
"imagepalettetotruecolor",
"()",
"."
] | train | https://github.com/rosell-dk/webp-convert/blob/d54b23dbce745cae7955ee1c7ba912731f679ee1/src/Convert/Converters/Gd.php#L99-L147 |
rosell-dk/webp-convert | src/Convert/Converters/Gd.php | Gd.createImageResource | private function createImageResource()
{
// In case of failure, image will be false
$mimeType = $this->getMimeTypeOfSource();
if ($mimeType == 'image/png') {
$image = imagecreatefrompng($this->source);
if ($image === false) {
throw new ConversionFail... | php | private function createImageResource()
{
// In case of failure, image will be false
$mimeType = $this->getMimeTypeOfSource();
if ($mimeType == 'image/png') {
$image = imagecreatefrompng($this->source);
if ($image === false) {
throw new ConversionFail... | [
"private",
"function",
"createImageResource",
"(",
")",
"{",
"// In case of failure, image will be false",
"$",
"mimeType",
"=",
"$",
"this",
"->",
"getMimeTypeOfSource",
"(",
")",
";",
"if",
"(",
"$",
"mimeType",
"==",
"'image/png'",
")",
"{",
"$",
"image",
"="... | Create Gd image resource from source
@throws InvalidInputException if mime type is unsupported or could not be detected
@throws ConversionFailedException if imagecreatefrompng or imagecreatefromjpeg fails
@return resource $image The created image | [
"Create",
"Gd",
"image",
"resource",
"from",
"source"
] | train | https://github.com/rosell-dk/webp-convert/blob/d54b23dbce745cae7955ee1c7ba912731f679ee1/src/Convert/Converters/Gd.php#L176-L206 |
rosell-dk/webp-convert | src/Convert/Converters/Gd.php | Gd.tryToMakeTrueColorIfNot | protected function tryToMakeTrueColorIfNot(&$image)
{
$mustMakeTrueColor = false;
if (function_exists('imageistruecolor')) {
if (imageistruecolor($image)) {
$this->logLn('image is true color');
} else {
$this->logLn('image is not true color');
... | php | protected function tryToMakeTrueColorIfNot(&$image)
{
$mustMakeTrueColor = false;
if (function_exists('imageistruecolor')) {
if (imageistruecolor($image)) {
$this->logLn('image is true color');
} else {
$this->logLn('image is not true color');
... | [
"protected",
"function",
"tryToMakeTrueColorIfNot",
"(",
"&",
"$",
"image",
")",
"{",
"$",
"mustMakeTrueColor",
"=",
"false",
";",
"if",
"(",
"function_exists",
"(",
"'imageistruecolor'",
")",
")",
"{",
"if",
"(",
"imageistruecolor",
"(",
"$",
"image",
")",
... | Try to make image resource true color if it is not already.
@param resource $image The image to work on
@return void | [
"Try",
"to",
"make",
"image",
"resource",
"true",
"color",
"if",
"it",
"is",
"not",
"already",
"."
] | train | https://github.com/rosell-dk/webp-convert/blob/d54b23dbce745cae7955ee1c7ba912731f679ee1/src/Convert/Converters/Gd.php#L214-L239 |
rosell-dk/webp-convert | src/Convert/Converters/Gd.php | Gd.doActualConvert | protected function doActualConvert()
{
$this->logLn('GD Version: ' . gd_info()["GD Version"]);
// Btw: Check out processWebp here:
// https://github.com/Intervention/image/blob/master/src/Intervention/Image/Gd/Encoder.php
// Create image resource
$image = $this->createImag... | php | protected function doActualConvert()
{
$this->logLn('GD Version: ' . gd_info()["GD Version"]);
// Btw: Check out processWebp here:
// https://github.com/Intervention/image/blob/master/src/Intervention/Image/Gd/Encoder.php
// Create image resource
$image = $this->createImag... | [
"protected",
"function",
"doActualConvert",
"(",
")",
"{",
"$",
"this",
"->",
"logLn",
"(",
"'GD Version: '",
".",
"gd_info",
"(",
")",
"[",
"\"GD Version\"",
"]",
")",
";",
"// Btw: Check out processWebp here:",
"// https://github.com/Intervention/image/blob/master/src/I... | takes care of preparing stuff before calling doConvert, and validating after. | [
"takes",
"care",
"of",
"preparing",
"stuff",
"before",
"calling",
"doConvert",
"and",
"validating",
"after",
"."
] | train | https://github.com/rosell-dk/webp-convert/blob/d54b23dbce745cae7955ee1c7ba912731f679ee1/src/Convert/Converters/Gd.php#L421-L446 |
rosell-dk/webp-convert | src/Serve/DecideWhatToServe.php | DecideWhatToServe.decide | public static function decide($source, $destination, $options)
{
$options = array_merge(self::$defaultOptions, $options);
if ($options['show-report']) {
return ['report', 'explicitly-told-to', 'Serving report (explicitly told to)'];
}
if ($options['serve-original']) {
... | php | public static function decide($source, $destination, $options)
{
$options = array_merge(self::$defaultOptions, $options);
if ($options['show-report']) {
return ['report', 'explicitly-told-to', 'Serving report (explicitly told to)'];
}
if ($options['serve-original']) {
... | [
"public",
"static",
"function",
"decide",
"(",
"$",
"source",
",",
"$",
"destination",
",",
"$",
"options",
")",
"{",
"$",
"options",
"=",
"array_merge",
"(",
"self",
"::",
"$",
"defaultOptions",
",",
"$",
"options",
")",
";",
"if",
"(",
"$",
"options"... | Decides what to serve.
It both decides what to serve and supplies the reason behind.
The possible combinations are:
- "destination" (serve existing converted image at the destination path)
- "no-reason-not-to"
- "source"
- "explicitly-told-to"
- "source-lighter"
- "fresh-conversion" (note: this may still fail)
- "ex... | [
"Decides",
"what",
"to",
"serve",
"."
] | train | https://github.com/rosell-dk/webp-convert/blob/d54b23dbce745cae7955ee1c7ba912731f679ee1/src/Serve/DecideWhatToServe.php#L46-L97 |
rosell-dk/webp-convert | src/Convert/Converters/Wpc.php | Wpc.getApiKey | private function getApiKey()
{
if ($this->options['api-version'] == 0) {
if (!empty($this->options['secret'])) {
return $this->options['secret'];
}
} elseif ($this->options['api-version'] == 1) {
if (!empty($this->options['api-key'])) {
... | php | private function getApiKey()
{
if ($this->options['api-version'] == 0) {
if (!empty($this->options['secret'])) {
return $this->options['secret'];
}
} elseif ($this->options['api-version'] == 1) {
if (!empty($this->options['api-key'])) {
... | [
"private",
"function",
"getApiKey",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"options",
"[",
"'api-version'",
"]",
"==",
"0",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"options",
"[",
"'secret'",
"]",
")",
")",
"{",
"return",
... | Get api key from options or environment variable
@return string api key or empty string if none is set | [
"Get",
"api",
"key",
"from",
"options",
"or",
"environment",
"variable"
] | train | https://github.com/rosell-dk/webp-convert/blob/d54b23dbce745cae7955ee1c7ba912731f679ee1/src/Convert/Converters/Wpc.php#L55-L70 |
rosell-dk/webp-convert | src/Convert/Converters/Wpc.php | Wpc.checkOperationality | public function checkOperationality()
{
// First check for curl requirements
parent::checkOperationality();
$options = $this->options;
$apiVersion = $options['api-version'];
if ($apiVersion == 0) {
if (!empty($this->getApiKey())) {
// if secret ... | php | public function checkOperationality()
{
// First check for curl requirements
parent::checkOperationality();
$options = $this->options;
$apiVersion = $options['api-version'];
if ($apiVersion == 0) {
if (!empty($this->getApiKey())) {
// if secret ... | [
"public",
"function",
"checkOperationality",
"(",
")",
"{",
"// First check for curl requirements",
"parent",
"::",
"checkOperationality",
"(",
")",
";",
"$",
"options",
"=",
"$",
"this",
"->",
"options",
";",
"$",
"apiVersion",
"=",
"$",
"options",
"[",
"'api-v... | Check operationality of Wpc converter.
@throws SystemRequirementsNotMetException if system requirements are not met (curl)
@throws ConverterNotOperationalException if key is missing or invalid, or quota has exceeded | [
"Check",
"operationality",
"of",
"Wpc",
"converter",
"."
] | train | https://github.com/rosell-dk/webp-convert/blob/d54b23dbce745cae7955ee1c7ba912731f679ee1/src/Convert/Converters/Wpc.php#L95-L144 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.