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 |
|---|---|---|---|---|---|---|---|---|---|---|
zircote/AMQP | library/AMQP/Connection.php | Connection._close | protected function _close(Reader $args)
{
$replyCode = $args->readShort();
$replyText = $args->readShortstr();
$classId = $args->readShort();
$methodId = $args->readShort();
$this->xCloseOk();
throw new ConnectionException(
$replyCode, $replyText, array(... | php | protected function _close(Reader $args)
{
$replyCode = $args->readShort();
$replyText = $args->readShortstr();
$classId = $args->readShort();
$methodId = $args->readShort();
$this->xCloseOk();
throw new ConnectionException(
$replyCode, $replyText, array(... | [
"protected",
"function",
"_close",
"(",
"Reader",
"$",
"args",
")",
"{",
"$",
"replyCode",
"=",
"$",
"args",
"->",
"readShort",
"(",
")",
";",
"$",
"replyText",
"=",
"$",
"args",
"->",
"readShortstr",
"(",
")",
";",
"$",
"classId",
"=",
"$",
"args",
... | @param \AMQP\Wire\Reader $args
@throws \AMQP\Exception\ConnectionException | [
"@param",
"\\",
"AMQP",
"\\",
"Wire",
"\\",
"Reader",
"$args"
] | train | https://github.com/zircote/AMQP/blob/b96777b372f556797db4fd0ba02edb18d4bf4a1e/library/AMQP/Connection.php#L615-L630 |
zircote/AMQP | library/AMQP/Connection.php | Connection.xOpen | protected function xOpen($virtualHost, $capabilities = '', $insist = false)
{
$args = new Writer();
$args->writeShortStr($virtualHost);
$args->writeShortStr($capabilities);
$args->writeBit($insist);
$this->sendMethodFrame(array(10, 40), $args);
return $this->wait(
... | php | protected function xOpen($virtualHost, $capabilities = '', $insist = false)
{
$args = new Writer();
$args->writeShortStr($virtualHost);
$args->writeShortStr($capabilities);
$args->writeBit($insist);
$this->sendMethodFrame(array(10, 40), $args);
return $this->wait(
... | [
"protected",
"function",
"xOpen",
"(",
"$",
"virtualHost",
",",
"$",
"capabilities",
"=",
"''",
",",
"$",
"insist",
"=",
"false",
")",
"{",
"$",
"args",
"=",
"new",
"Writer",
"(",
")",
";",
"$",
"args",
"->",
"writeShortStr",
"(",
"$",
"virtualHost",
... | @param $virtualHost
@param string $capabilities
@param bool $insist
@return mixed|null | [
"@param",
"$virtualHost",
"@param",
"string",
"$capabilities",
"@param",
"bool",
"$insist"
] | train | https://github.com/zircote/AMQP/blob/b96777b372f556797db4fd0ba02edb18d4bf4a1e/library/AMQP/Connection.php#L657-L670 |
zircote/AMQP | library/AMQP/Connection.php | Connection.openOk | protected function openOk(Reader $args)
{
$this->knownHosts = $args->readShortstr();
if ($this->debug) {
Helper::debugMsg("Open OK! known_hosts: " . $this->knownHosts);
}
return null;
} | php | protected function openOk(Reader $args)
{
$this->knownHosts = $args->readShortstr();
if ($this->debug) {
Helper::debugMsg("Open OK! known_hosts: " . $this->knownHosts);
}
return null;
} | [
"protected",
"function",
"openOk",
"(",
"Reader",
"$",
"args",
")",
"{",
"$",
"this",
"->",
"knownHosts",
"=",
"$",
"args",
"->",
"readShortstr",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"debug",
")",
"{",
"Helper",
"::",
"debugMsg",
"(",
"\"Open... | signal that the connection is ready | [
"signal",
"that",
"the",
"connection",
"is",
"ready"
] | train | https://github.com/zircote/AMQP/blob/b96777b372f556797db4fd0ba02edb18d4bf4a1e/library/AMQP/Connection.php#L675-L683 |
zircote/AMQP | library/AMQP/Connection.php | Connection.redirect | protected function redirect(Reader $args)
{
$host = $args->readShortstr();
$this->knownHosts = $args->readShortstr();
if ($this->debug) {
Helper::debugMsg(
sprintf(
'Redirected to [%s], known_hosts [%s]',
$host, $this->known... | php | protected function redirect(Reader $args)
{
$host = $args->readShortstr();
$this->knownHosts = $args->readShortstr();
if ($this->debug) {
Helper::debugMsg(
sprintf(
'Redirected to [%s], known_hosts [%s]',
$host, $this->known... | [
"protected",
"function",
"redirect",
"(",
"Reader",
"$",
"args",
")",
"{",
"$",
"host",
"=",
"$",
"args",
"->",
"readShortstr",
"(",
")",
";",
"$",
"this",
"->",
"knownHosts",
"=",
"$",
"args",
"->",
"readShortstr",
"(",
")",
";",
"if",
"(",
"$",
"... | asks the client to use a different server
@param \AMQP\Wire\Reader $args
@return string | [
"asks",
"the",
"client",
"to",
"use",
"a",
"different",
"server"
] | train | https://github.com/zircote/AMQP/blob/b96777b372f556797db4fd0ba02edb18d4bf4a1e/library/AMQP/Connection.php#L692-L705 |
zircote/AMQP | library/AMQP/Connection.php | Connection._xSecureOk | protected function _xSecureOk($response)
{
$args = new Writer();
$args->writeLongStr($response);
$this->sendMethodFrame(array(10, 21), $args);
} | php | protected function _xSecureOk($response)
{
$args = new Writer();
$args->writeLongStr($response);
$this->sendMethodFrame(array(10, 21), $args);
} | [
"protected",
"function",
"_xSecureOk",
"(",
"$",
"response",
")",
"{",
"$",
"args",
"=",
"new",
"Writer",
"(",
")",
";",
"$",
"args",
"->",
"writeLongStr",
"(",
"$",
"response",
")",
";",
"$",
"this",
"->",
"sendMethodFrame",
"(",
"array",
"(",
"10",
... | security mechanism response
@param string $response | [
"security",
"mechanism",
"response"
] | train | https://github.com/zircote/AMQP/blob/b96777b372f556797db4fd0ba02edb18d4bf4a1e/library/AMQP/Connection.php#L722-L727 |
zircote/AMQP | library/AMQP/Connection.php | Connection.start | protected function start(Reader $args)
{
$this->versionMajor = $args->readOctet();
$this->versionMinor = $args->readOctet();
$this->serverProperties = $args->readTable();
$this->mechanisms = explode(" ", $args->readLongstr());
$this->locales = explode(" ", $args->readLongstr(... | php | protected function start(Reader $args)
{
$this->versionMajor = $args->readOctet();
$this->versionMinor = $args->readOctet();
$this->serverProperties = $args->readTable();
$this->mechanisms = explode(" ", $args->readLongstr());
$this->locales = explode(" ", $args->readLongstr(... | [
"protected",
"function",
"start",
"(",
"Reader",
"$",
"args",
")",
"{",
"$",
"this",
"->",
"versionMajor",
"=",
"$",
"args",
"->",
"readOctet",
"(",
")",
";",
"$",
"this",
"->",
"versionMinor",
"=",
"$",
"args",
"->",
"readOctet",
"(",
")",
";",
"$",... | start connection negotiation | [
"start",
"connection",
"negotiation"
] | train | https://github.com/zircote/AMQP/blob/b96777b372f556797db4fd0ba02edb18d4bf4a1e/library/AMQP/Connection.php#L732-L753 |
zircote/AMQP | library/AMQP/Connection.php | Connection.tune | protected function tune(Reader $args)
{
$v = $args->readShort();
if ($v) {
$this->channelMax = $v;
}
$v = $args->readLong();
if ($v) {
$this->frameMax = $v;
}
$this->heartbeat = $args->readShort();
$this->xTuneOk($this->chan... | php | protected function tune(Reader $args)
{
$v = $args->readShort();
if ($v) {
$this->channelMax = $v;
}
$v = $args->readLong();
if ($v) {
$this->frameMax = $v;
}
$this->heartbeat = $args->readShort();
$this->xTuneOk($this->chan... | [
"protected",
"function",
"tune",
"(",
"Reader",
"$",
"args",
")",
"{",
"$",
"v",
"=",
"$",
"args",
"->",
"readShort",
"(",
")",
";",
"if",
"(",
"$",
"v",
")",
"{",
"$",
"this",
"->",
"channelMax",
"=",
"$",
"v",
";",
"}",
"$",
"v",
"=",
"$",
... | propose connection tuning parameters
@param \AMQP\Wire\Reader $args | [
"propose",
"connection",
"tuning",
"parameters"
] | train | https://github.com/zircote/AMQP/blob/b96777b372f556797db4fd0ba02edb18d4bf4a1e/library/AMQP/Connection.php#L776-L792 |
zircote/AMQP | library/AMQP/Connection.php | Connection.xTuneOk | protected function xTuneOk($channelMax, $frameMax, $heartbeat)
{
$args = new Writer();
$args->writeShort($channelMax);
$args->writeLong($frameMax);
$args->writeShort($heartbeat);
$this->sendMethodFrame(array(10, 31), $args);
$this->waitTuneOk = False;
} | php | protected function xTuneOk($channelMax, $frameMax, $heartbeat)
{
$args = new Writer();
$args->writeShort($channelMax);
$args->writeLong($frameMax);
$args->writeShort($heartbeat);
$this->sendMethodFrame(array(10, 31), $args);
$this->waitTuneOk = False;
} | [
"protected",
"function",
"xTuneOk",
"(",
"$",
"channelMax",
",",
"$",
"frameMax",
",",
"$",
"heartbeat",
")",
"{",
"$",
"args",
"=",
"new",
"Writer",
"(",
")",
";",
"$",
"args",
"->",
"writeShort",
"(",
"$",
"channelMax",
")",
";",
"$",
"args",
"->",... | negotiate connection tuning parameters
@param $channelMax
@param $frameMax
@param $heartbeat | [
"negotiate",
"connection",
"tuning",
"parameters"
] | train | https://github.com/zircote/AMQP/blob/b96777b372f556797db4fd0ba02edb18d4bf4a1e/library/AMQP/Connection.php#L801-L809 |
zircote/AMQP | library/AMQP/Connection.php | Connection.dumpTable | public static function dumpTable($table)
{
$tokens = array();
foreach ($table as $name => $value) {
switch ($value[0]) {
case 'D':
$val = $value[1]->n . 'E' . $value[1]->e;
break;
case 'F':
$val =... | php | public static function dumpTable($table)
{
$tokens = array();
foreach ($table as $name => $value) {
switch ($value[0]) {
case 'D':
$val = $value[1]->n . 'E' . $value[1]->e;
break;
case 'F':
$val =... | [
"public",
"static",
"function",
"dumpTable",
"(",
"$",
"table",
")",
"{",
"$",
"tokens",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"table",
"as",
"$",
"name",
"=>",
"$",
"value",
")",
"{",
"switch",
"(",
"$",
"value",
"[",
"0",
"]",
")",
... | @static
@param $table
@return string | [
"@static"
] | train | https://github.com/zircote/AMQP/blob/b96777b372f556797db4fd0ba02edb18d4bf4a1e/library/AMQP/Connection.php#L848-L868 |
freearhey/sparql | src/QueryBuilder.php | QueryBuilder.service | public function service( $service, $subject, $predicate = null, $object = null ) {
$this->graphBuilder->service( $service, $subject, $predicate, $object );
return $this;
} | php | public function service( $service, $subject, $predicate = null, $object = null ) {
$this->graphBuilder->service( $service, $subject, $predicate, $object );
return $this;
} | [
"public",
"function",
"service",
"(",
"$",
"service",
",",
"$",
"subject",
",",
"$",
"predicate",
"=",
"null",
",",
"$",
"object",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"graphBuilder",
"->",
"service",
"(",
"$",
"service",
",",
"$",
"subject",
",... | Adds the given graph or triple as an service condition.
@param string|GraphBuilder $subject
@param string|null $predicate
@param string|null $object
@return self
@throws InvalidArgumentException | [
"Adds",
"the",
"given",
"graph",
"or",
"triple",
"as",
"an",
"service",
"condition",
"."
] | train | https://github.com/freearhey/sparql/blob/622a8ea661dc5939122b0e8b430a6a94b3bc49c7/src/QueryBuilder.php#L257-L260 |
spiral-modules/phpFastCache-bridge | source/PhpFastCache/SimpleCacheAdapter.php | SimpleCacheAdapter.get | public function get($key, $default = null)
{
try {
$value = $this->pool->getItem($key)->get();
if ($value !== null) {
return $value;
} else {
return $default;
}
} catch (\Throwable $e) {
throw new SpiralFastC... | php | public function get($key, $default = null)
{
try {
$value = $this->pool->getItem($key)->get();
if ($value !== null) {
return $value;
} else {
return $default;
}
} catch (\Throwable $e) {
throw new SpiralFastC... | [
"public",
"function",
"get",
"(",
"$",
"key",
",",
"$",
"default",
"=",
"null",
")",
"{",
"try",
"{",
"$",
"value",
"=",
"$",
"this",
"->",
"pool",
"->",
"getItem",
"(",
"$",
"key",
")",
"->",
"get",
"(",
")",
";",
"if",
"(",
"$",
"value",
"!... | {@inheritdoc} | [
"{"
] | train | https://github.com/spiral-modules/phpFastCache-bridge/blob/d4ffa95daf9e04b79f50486cba6c9857918c2b79/source/PhpFastCache/SimpleCacheAdapter.php#L30-L42 |
spiral-modules/phpFastCache-bridge | source/PhpFastCache/SimpleCacheAdapter.php | SimpleCacheAdapter.set | public function set($key, $value, $ttl = null)
{
try {
$item = $this->pool
->getItem($key)
->set($value);
if (is_int($ttl) || $ttl instanceof \DateInterval) {
$item->expiresAfter($ttl);
}
return $this->pool->sav... | php | public function set($key, $value, $ttl = null)
{
try {
$item = $this->pool
->getItem($key)
->set($value);
if (is_int($ttl) || $ttl instanceof \DateInterval) {
$item->expiresAfter($ttl);
}
return $this->pool->sav... | [
"public",
"function",
"set",
"(",
"$",
"key",
",",
"$",
"value",
",",
"$",
"ttl",
"=",
"null",
")",
"{",
"try",
"{",
"$",
"item",
"=",
"$",
"this",
"->",
"pool",
"->",
"getItem",
"(",
"$",
"key",
")",
"->",
"set",
"(",
"$",
"value",
")",
";",... | {@inheritdoc} | [
"{"
] | train | https://github.com/spiral-modules/phpFastCache-bridge/blob/d4ffa95daf9e04b79f50486cba6c9857918c2b79/source/PhpFastCache/SimpleCacheAdapter.php#L47-L61 |
spiral-modules/phpFastCache-bridge | source/PhpFastCache/SimpleCacheAdapter.php | SimpleCacheAdapter.delete | public function delete($key)
{
try {
return $this->pool->deleteItem($key);
} catch (\Throwable $e) {
throw new SpiralFastCacheException($e->getMessage(), $e->getMessage(), $e);
}
} | php | public function delete($key)
{
try {
return $this->pool->deleteItem($key);
} catch (\Throwable $e) {
throw new SpiralFastCacheException($e->getMessage(), $e->getMessage(), $e);
}
} | [
"public",
"function",
"delete",
"(",
"$",
"key",
")",
"{",
"try",
"{",
"return",
"$",
"this",
"->",
"pool",
"->",
"deleteItem",
"(",
"$",
"key",
")",
";",
"}",
"catch",
"(",
"\\",
"Throwable",
"$",
"e",
")",
"{",
"throw",
"new",
"SpiralFastCacheExcep... | {@inheritdoc} | [
"{"
] | train | https://github.com/spiral-modules/phpFastCache-bridge/blob/d4ffa95daf9e04b79f50486cba6c9857918c2b79/source/PhpFastCache/SimpleCacheAdapter.php#L66-L73 |
spiral-modules/phpFastCache-bridge | source/PhpFastCache/SimpleCacheAdapter.php | SimpleCacheAdapter.clear | public function clear()
{
try {
return $this->pool->clear();
} catch (\Throwable $e) {
throw new SpiralFastCacheException($e->getMessage(), $e->getMessage(), $e);
}
} | php | public function clear()
{
try {
return $this->pool->clear();
} catch (\Throwable $e) {
throw new SpiralFastCacheException($e->getMessage(), $e->getMessage(), $e);
}
} | [
"public",
"function",
"clear",
"(",
")",
"{",
"try",
"{",
"return",
"$",
"this",
"->",
"pool",
"->",
"clear",
"(",
")",
";",
"}",
"catch",
"(",
"\\",
"Throwable",
"$",
"e",
")",
"{",
"throw",
"new",
"SpiralFastCacheException",
"(",
"$",
"e",
"->",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/spiral-modules/phpFastCache-bridge/blob/d4ffa95daf9e04b79f50486cba6c9857918c2b79/source/PhpFastCache/SimpleCacheAdapter.php#L78-L85 |
spiral-modules/phpFastCache-bridge | source/PhpFastCache/SimpleCacheAdapter.php | SimpleCacheAdapter.getMultiple | public function getMultiple($keys, $default = null)
{
try {
return array_map(function (ExtendedCacheItemInterface $item) {
return $item->get();
}, $this->pool->getItems($keys));
} catch (\Throwable $e) {
throw new SpiralFastCacheException($e->getMe... | php | public function getMultiple($keys, $default = null)
{
try {
return array_map(function (ExtendedCacheItemInterface $item) {
return $item->get();
}, $this->pool->getItems($keys));
} catch (\Throwable $e) {
throw new SpiralFastCacheException($e->getMe... | [
"public",
"function",
"getMultiple",
"(",
"$",
"keys",
",",
"$",
"default",
"=",
"null",
")",
"{",
"try",
"{",
"return",
"array_map",
"(",
"function",
"(",
"ExtendedCacheItemInterface",
"$",
"item",
")",
"{",
"return",
"$",
"item",
"->",
"get",
"(",
")",... | {@inheritdoc} | [
"{"
] | train | https://github.com/spiral-modules/phpFastCache-bridge/blob/d4ffa95daf9e04b79f50486cba6c9857918c2b79/source/PhpFastCache/SimpleCacheAdapter.php#L90-L99 |
spiral-modules/phpFastCache-bridge | source/PhpFastCache/SimpleCacheAdapter.php | SimpleCacheAdapter.setMultiple | public function setMultiple($values, $ttl = null)
{
try {
foreach ($values as $key => $value) {
$item = $this->pool->getItem($key)->set($value);
$this->pool->saveDeferred($item);
unset($item);
}
return $this->pool->commit()... | php | public function setMultiple($values, $ttl = null)
{
try {
foreach ($values as $key => $value) {
$item = $this->pool->getItem($key)->set($value);
$this->pool->saveDeferred($item);
unset($item);
}
return $this->pool->commit()... | [
"public",
"function",
"setMultiple",
"(",
"$",
"values",
",",
"$",
"ttl",
"=",
"null",
")",
"{",
"try",
"{",
"foreach",
"(",
"$",
"values",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"item",
"=",
"$",
"this",
"->",
"pool",
"->",
"getIte... | {@inheritdoc} | [
"{"
] | train | https://github.com/spiral-modules/phpFastCache-bridge/blob/d4ffa95daf9e04b79f50486cba6c9857918c2b79/source/PhpFastCache/SimpleCacheAdapter.php#L104-L117 |
spiral-modules/phpFastCache-bridge | source/PhpFastCache/SimpleCacheAdapter.php | SimpleCacheAdapter.deleteMultiple | public function deleteMultiple($keys)
{
try {
return $this->pool->deleteItems($keys);
} catch (\Throwable $e) {
throw new SpiralFastCacheException($e->getMessage(), $e->getMessage(), $e);
}
} | php | public function deleteMultiple($keys)
{
try {
return $this->pool->deleteItems($keys);
} catch (\Throwable $e) {
throw new SpiralFastCacheException($e->getMessage(), $e->getMessage(), $e);
}
} | [
"public",
"function",
"deleteMultiple",
"(",
"$",
"keys",
")",
"{",
"try",
"{",
"return",
"$",
"this",
"->",
"pool",
"->",
"deleteItems",
"(",
"$",
"keys",
")",
";",
"}",
"catch",
"(",
"\\",
"Throwable",
"$",
"e",
")",
"{",
"throw",
"new",
"SpiralFas... | {@inheritdoc} | [
"{"
] | train | https://github.com/spiral-modules/phpFastCache-bridge/blob/d4ffa95daf9e04b79f50486cba6c9857918c2b79/source/PhpFastCache/SimpleCacheAdapter.php#L122-L129 |
spiral-modules/phpFastCache-bridge | source/PhpFastCache/SimpleCacheAdapter.php | SimpleCacheAdapter.has | public function has($key)
{
try {
return $this->pool->getItem($key)->isHit();
} catch (\Throwable $e) {
throw new SpiralFastCacheException($e->getMessage(), $e->getMessage(), $e);
}
} | php | public function has($key)
{
try {
return $this->pool->getItem($key)->isHit();
} catch (\Throwable $e) {
throw new SpiralFastCacheException($e->getMessage(), $e->getMessage(), $e);
}
} | [
"public",
"function",
"has",
"(",
"$",
"key",
")",
"{",
"try",
"{",
"return",
"$",
"this",
"->",
"pool",
"->",
"getItem",
"(",
"$",
"key",
")",
"->",
"isHit",
"(",
")",
";",
"}",
"catch",
"(",
"\\",
"Throwable",
"$",
"e",
")",
"{",
"throw",
"ne... | {@inheritdoc} | [
"{"
] | train | https://github.com/spiral-modules/phpFastCache-bridge/blob/d4ffa95daf9e04b79f50486cba6c9857918c2b79/source/PhpFastCache/SimpleCacheAdapter.php#L134-L141 |
phpmob/changmin | src/PhpMob/MediaBundle/Controller/ImageController.php | ImageController.filterRuntimeAction | public function filterRuntimeAction($path, $sizing, $mode = 'inset', $filter = 'strip')
{
if ($path instanceof ImageInterface) {
$path = $path->getPath();
}
$runtimeConfig = [
'thumbnail' => [
'size' => explode('x', strtolower($sizing)),
... | php | public function filterRuntimeAction($path, $sizing, $mode = 'inset', $filter = 'strip')
{
if ($path instanceof ImageInterface) {
$path = $path->getPath();
}
$runtimeConfig = [
'thumbnail' => [
'size' => explode('x', strtolower($sizing)),
... | [
"public",
"function",
"filterRuntimeAction",
"(",
"$",
"path",
",",
"$",
"sizing",
",",
"$",
"mode",
"=",
"'inset'",
",",
"$",
"filter",
"=",
"'strip'",
")",
"{",
"if",
"(",
"$",
"path",
"instanceof",
"ImageInterface",
")",
"{",
"$",
"path",
"=",
"$",
... | @param string $path
@param string $sizing
@param string $mode
@param string $filter
@return \Symfony\Component\HttpFoundation\RedirectResponse | [
"@param",
"string",
"$path",
"@param",
"string",
"$sizing",
"@param",
"string",
"$mode",
"@param",
"string",
"$filter"
] | train | https://github.com/phpmob/changmin/blob/bfebb1561229094d1c138574abab75f2f1d17d66/src/PhpMob/MediaBundle/Controller/ImageController.php#L27-L43 |
thienhungho/yii2-order-management | src/modules/MyOrder/search/OrderSearch.php | OrderSearch.search | public function search($params)
{
$query = Order::find();
$dataProvider = new ActiveDataProvider([
'query' => $query,
]);
$this->load($params);
if (!$this->validate()) {
// uncomment the following line if you do not want to return any rec... | php | public function search($params)
{
$query = Order::find();
$dataProvider = new ActiveDataProvider([
'query' => $query,
]);
$this->load($params);
if (!$this->validate()) {
// uncomment the following line if you do not want to return any rec... | [
"public",
"function",
"search",
"(",
"$",
"params",
")",
"{",
"$",
"query",
"=",
"Order",
"::",
"find",
"(",
")",
";",
"$",
"dataProvider",
"=",
"new",
"ActiveDataProvider",
"(",
"[",
"'query'",
"=>",
"$",
"query",
",",
"]",
")",
";",
"$",
"this",
... | Creates data provider instance with search query applied
@param array $params
@return ActiveDataProvider | [
"Creates",
"data",
"provider",
"instance",
"with",
"search",
"query",
"applied"
] | train | https://github.com/thienhungho/yii2-order-management/blob/f263f0b2168d6f5e99cee2e20a5878d09d4e81c0/src/modules/MyOrder/search/OrderSearch.php#L42-L84 |
gries/rcon | src/Message.php | Message.convertToRconData | public function convertToRconData($id)
{
$idAndTypePacked = pack('VV', $id, $this->type);
$endOfMessage = chr(0) . chr(0);
$message = $idAndTypePacked . $this->body . $endOfMessage;
$data = pack("V", strlen($message)) . $message;
return $data;
} | php | public function convertToRconData($id)
{
$idAndTypePacked = pack('VV', $id, $this->type);
$endOfMessage = chr(0) . chr(0);
$message = $idAndTypePacked . $this->body . $endOfMessage;
$data = pack("V", strlen($message)) . $message;
return $data;
} | [
"public",
"function",
"convertToRconData",
"(",
"$",
"id",
")",
"{",
"$",
"idAndTypePacked",
"=",
"pack",
"(",
"'VV'",
",",
"$",
"id",
",",
"$",
"this",
"->",
"type",
")",
";",
"$",
"endOfMessage",
"=",
"chr",
"(",
"0",
")",
".",
"chr",
"(",
"0",
... | The message id used for this message.
This will be encoded in the RconData.
@param int $id
@return string | [
"The",
"message",
"id",
"used",
"for",
"this",
"message",
".",
"This",
"will",
"be",
"encoded",
"in",
"the",
"RconData",
"."
] | train | https://github.com/gries/rcon/blob/7fada05b329d89542692af00ab80db02ad59d45d/src/Message.php#L82-L92 |
gries/rcon | src/Message.php | Message.initializeFromRconData | public function initializeFromRconData($data, $fragmented = false)
{
if ($fragmented) {
$packet = unpack("V1id/a*body", $data);
$packet['type'] = static::TYPE_RESPONSE_VALUE;
} else {
// 8 byte for id + type and atleast 2 byte if the body is empty
if ... | php | public function initializeFromRconData($data, $fragmented = false)
{
if ($fragmented) {
$packet = unpack("V1id/a*body", $data);
$packet['type'] = static::TYPE_RESPONSE_VALUE;
} else {
// 8 byte for id + type and atleast 2 byte if the body is empty
if ... | [
"public",
"function",
"initializeFromRconData",
"(",
"$",
"data",
",",
"$",
"fragmented",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"fragmented",
")",
"{",
"$",
"packet",
"=",
"unpack",
"(",
"\"V1id/a*body\"",
",",
"$",
"data",
")",
";",
"$",
"packet",
"... | Parses data from a RCON Response.
Note: the first 4 bytes that indicate the size of the packet MUST not be included.
@param $data
@param bool|$fragmented If the data comes from a fragmented response only the id and body will be present.
@throws InvalidPacketException | [
"Parses",
"data",
"from",
"a",
"RCON",
"Response",
".",
"Note",
":",
"the",
"first",
"4",
"bytes",
"that",
"indicate",
"the",
"size",
"of",
"the",
"packet",
"MUST",
"not",
"be",
"included",
"."
] | train | https://github.com/gries/rcon/blob/7fada05b329d89542692af00ab80db02ad59d45d/src/Message.php#L113-L138 |
titon/db | src/Titon/Db/Driver/Type/BlobType.php | BlobType.from | public function from($value) {
if ($value === null) {
return null;
}
if (is_string($value)) {
$value = fopen('data://text/plain;base64,' . base64_encode($value), 'rb');
}
if (!is_resource($value)) {
throw new ConversionFailureException('Faile... | php | public function from($value) {
if ($value === null) {
return null;
}
if (is_string($value)) {
$value = fopen('data://text/plain;base64,' . base64_encode($value), 'rb');
}
if (!is_resource($value)) {
throw new ConversionFailureException('Faile... | [
"public",
"function",
"from",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"value",
"===",
"null",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"is_string",
"(",
"$",
"value",
")",
")",
"{",
"$",
"value",
"=",
"fopen",
"(",
"'data://text/plain;... | {@inheritdoc}
@throws \Titon\Db\Exception\ConversionFailureException | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Driver/Type/BlobType.php#L26-L40 |
steeffeen/FancyManiaLinks | FML/Script/Features/GraphCurve.php | GraphCurve.addPoint | public function addPoint($coordX, $coordY = null)
{
if (is_array($coordX)) {
$coordY = (isset($coordX[1]) ? $coordX[1] : 0.);
$coordX = (isset($coordX[0]) ? $coordX[0] : 0.);
}
array_push($this->points, array($coordX, $coordY));
return $this;
} | php | public function addPoint($coordX, $coordY = null)
{
if (is_array($coordX)) {
$coordY = (isset($coordX[1]) ? $coordX[1] : 0.);
$coordX = (isset($coordX[0]) ? $coordX[0] : 0.);
}
array_push($this->points, array($coordX, $coordY));
return $this;
} | [
"public",
"function",
"addPoint",
"(",
"$",
"coordX",
",",
"$",
"coordY",
"=",
"null",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"coordX",
")",
")",
"{",
"$",
"coordY",
"=",
"(",
"isset",
"(",
"$",
"coordX",
"[",
"1",
"]",
")",
"?",
"$",
"coor... | Add point
@api
@param float|float[] $coordX X-coordinate or point
@param float $coordY (optional) Y-coordinate
@return static | [
"Add",
"point"
] | train | https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/Script/Features/GraphCurve.php#L111-L119 |
steeffeen/FancyManiaLinks | FML/Script/Features/GraphCurve.php | GraphCurve.getScriptText | protected function getScriptText()
{
$graphId = Builder::escapeText($this->graph->getId(), false);
$scriptText = "
declare Graph <=> (Page.GetFirstChild(\"{$graphId}\") as CMlGraph);
if (Graph != Null) {
declare GraphCurve <=> Graph.AddCurve();
";
foreach ($this->points as $point) {
... | php | protected function getScriptText()
{
$graphId = Builder::escapeText($this->graph->getId(), false);
$scriptText = "
declare Graph <=> (Page.GetFirstChild(\"{$graphId}\") as CMlGraph);
if (Graph != Null) {
declare GraphCurve <=> Graph.AddCurve();
";
foreach ($this->points as $point) {
... | [
"protected",
"function",
"getScriptText",
"(",
")",
"{",
"$",
"graphId",
"=",
"Builder",
"::",
"escapeText",
"(",
"$",
"this",
"->",
"graph",
"->",
"getId",
"(",
")",
",",
"false",
")",
";",
"$",
"scriptText",
"=",
"\"\ndeclare Graph <=> (Page.GetFirstChild(\\... | Get the script text
@return string | [
"Get",
"the",
"script",
"text"
] | train | https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/Script/Features/GraphCurve.php#L269-L301 |
mustardandrew/muan-laravel-comments | app/Traits/CanComment.php | CanComment.addComment | public function addComment(Model $model, string $comment) : Comment
{
return $model->comments()->create([
'user_id' => $this->id,
'comment' => $comment,
]);
} | php | public function addComment(Model $model, string $comment) : Comment
{
return $model->comments()->create([
'user_id' => $this->id,
'comment' => $comment,
]);
} | [
"public",
"function",
"addComment",
"(",
"Model",
"$",
"model",
",",
"string",
"$",
"comment",
")",
":",
"Comment",
"{",
"return",
"$",
"model",
"->",
"comments",
"(",
")",
"->",
"create",
"(",
"[",
"'user_id'",
"=>",
"$",
"this",
"->",
"id",
",",
"'... | Add comment
@param Model $model
@param string $comment
@return Comment | [
"Add",
"comment"
] | train | https://github.com/mustardandrew/muan-laravel-comments/blob/4dea64e6a2269f6a780df110a382acf9c97fa9b3/app/Traits/CanComment.php#L32-L38 |
inc2734/wp-seo | src/App/Controller/Posts.php | Posts._add_meta_boxes | public function _add_meta_boxes( $post_type, $post ) {
$post_type_object = get_post_type_object( $post_type );
if ( empty( $post_type_object ) || empty( $post_type_object->public ) ) {
return;
}
add_meta_box(
'wp-seo',
__( 'SEO', 'inc2734-wp-seo' ),
array( $this, '_wp_seo_meta_box' ),
$post_type... | php | public function _add_meta_boxes( $post_type, $post ) {
$post_type_object = get_post_type_object( $post_type );
if ( empty( $post_type_object ) || empty( $post_type_object->public ) ) {
return;
}
add_meta_box(
'wp-seo',
__( 'SEO', 'inc2734-wp-seo' ),
array( $this, '_wp_seo_meta_box' ),
$post_type... | [
"public",
"function",
"_add_meta_boxes",
"(",
"$",
"post_type",
",",
"$",
"post",
")",
"{",
"$",
"post_type_object",
"=",
"get_post_type_object",
"(",
"$",
"post_type",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"post_type_object",
")",
"||",
"empty",
"(",
"$... | Add meta box in pages of public post type
@param [string] $post_type
@param [WP_Post] $post
@return void | [
"Add",
"meta",
"box",
"in",
"pages",
"of",
"public",
"post",
"type"
] | train | https://github.com/inc2734/wp-seo/blob/d08f3fad346751232859c335d289237a82f9eef3/src/App/Controller/Posts.php#L25-L38 |
inc2734/wp-seo | src/App/Controller/Posts.php | Posts._wp_seo_meta_box | public function _wp_seo_meta_box( $post ) {
?>
<?php wp_nonce_field( 'wp-seo-meta-box-action', 'wp-seo-meta-box-nonce' ); ?>
<p>
<label for="wp-seo-meta-description">
<b><?php esc_html_e( 'Meta description', 'inc2734-wp-seo' ); ?></b>
</label><br />
<input
type="text"
name="wp-seo-meta-descri... | php | public function _wp_seo_meta_box( $post ) {
?>
<?php wp_nonce_field( 'wp-seo-meta-box-action', 'wp-seo-meta-box-nonce' ); ?>
<p>
<label for="wp-seo-meta-description">
<b><?php esc_html_e( 'Meta description', 'inc2734-wp-seo' ); ?></b>
</label><br />
<input
type="text"
name="wp-seo-meta-descri... | [
"public",
"function",
"_wp_seo_meta_box",
"(",
"$",
"post",
")",
"{",
"?>\n\t\t<?php",
"wp_nonce_field",
"(",
"'wp-seo-meta-box-action'",
",",
"'wp-seo-meta-box-nonce'",
")",
";",
"?>\n\t\t<p>\n\t\t\t<label for=\"wp-seo-meta-description\">\n\t\t\t\t<b><?php",
"esc_html_e",
"(",
... | Display meta box
@param [WP_Post] $post
@return void | [
"Display",
"meta",
"box"
] | train | https://github.com/inc2734/wp-seo/blob/d08f3fad346751232859c335d289237a82f9eef3/src/App/Controller/Posts.php#L46-L84 |
inc2734/wp-seo | src/App/Controller/Posts.php | Posts._save_meta_description | public function _save_meta_description( $post_id ) {
if ( empty( $_POST['wp-seo-meta-box-nonce'] ) ) {
return;
}
if ( ! wp_verify_nonce( wp_unslash( filter_input( INPUT_POST, 'wp-seo-meta-box-nonce' ) ), 'wp-seo-meta-box-action' ) ) {
return;
}
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
... | php | public function _save_meta_description( $post_id ) {
if ( empty( $_POST['wp-seo-meta-box-nonce'] ) ) {
return;
}
if ( ! wp_verify_nonce( wp_unslash( filter_input( INPUT_POST, 'wp-seo-meta-box-nonce' ) ), 'wp-seo-meta-box-action' ) ) {
return;
}
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
... | [
"public",
"function",
"_save_meta_description",
"(",
"$",
"post_id",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"_POST",
"[",
"'wp-seo-meta-box-nonce'",
"]",
")",
")",
"{",
"return",
";",
"}",
"if",
"(",
"!",
"wp_verify_nonce",
"(",
"wp_unslash",
"(",
"filter... | Save meta description
@param [int] $post_id
@return void | [
"Save",
"meta",
"description"
] | train | https://github.com/inc2734/wp-seo/blob/d08f3fad346751232859c335d289237a82f9eef3/src/App/Controller/Posts.php#L92-L119 |
inc2734/wp-seo | src/App/Controller/Posts.php | Posts._save_meta_robots | public function _save_meta_robots( $post_id ) {
if ( empty( $_POST['wp-seo-meta-box-nonce'] ) ) {
return;
}
if ( ! wp_verify_nonce( wp_unslash( filter_input( INPUT_POST, 'wp-seo-meta-box-nonce' ) ), 'wp-seo-meta-box-action' ) ) {
return;
}
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
retu... | php | public function _save_meta_robots( $post_id ) {
if ( empty( $_POST['wp-seo-meta-box-nonce'] ) ) {
return;
}
if ( ! wp_verify_nonce( wp_unslash( filter_input( INPUT_POST, 'wp-seo-meta-box-nonce' ) ), 'wp-seo-meta-box-action' ) ) {
return;
}
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
retu... | [
"public",
"function",
"_save_meta_robots",
"(",
"$",
"post_id",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"_POST",
"[",
"'wp-seo-meta-box-nonce'",
"]",
")",
")",
"{",
"return",
";",
"}",
"if",
"(",
"!",
"wp_verify_nonce",
"(",
"wp_unslash",
"(",
"filter_inpu... | Save meta robots
@param [int] $post_id
@return void | [
"Save",
"meta",
"robots"
] | train | https://github.com/inc2734/wp-seo/blob/d08f3fad346751232859c335d289237a82f9eef3/src/App/Controller/Posts.php#L127-L151 |
ruvents/ruwork-upload-bundle | Metadata/CachedMetadataFactory.php | CachedMetadataFactory.getMetadata | public function getMetadata(string $class): Metadata
{
$item = $this->cache->getItem(str_replace('\\', '.', $class));
if ($item->isHit()) {
[$mTime, $metadata] = $item->get();
if (!$this->debug || $mTime >= $classMTime = $this->getClassMTime($class)) {
retur... | php | public function getMetadata(string $class): Metadata
{
$item = $this->cache->getItem(str_replace('\\', '.', $class));
if ($item->isHit()) {
[$mTime, $metadata] = $item->get();
if (!$this->debug || $mTime >= $classMTime = $this->getClassMTime($class)) {
retur... | [
"public",
"function",
"getMetadata",
"(",
"string",
"$",
"class",
")",
":",
"Metadata",
"{",
"$",
"item",
"=",
"$",
"this",
"->",
"cache",
"->",
"getItem",
"(",
"str_replace",
"(",
"'\\\\'",
",",
"'.'",
",",
"$",
"class",
")",
")",
";",
"if",
"(",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/ruvents/ruwork-upload-bundle/blob/8ad09cc2dce6ab389105c440d791346696da43af/Metadata/CachedMetadataFactory.php#L28-L45 |
jfusion/org.jfusion.framework | src/Api/Platform.php | Platform.getTypeInstance | public static function getTypeInstance($type)
{
$type = ucfirst(strtolower($type));
if (!isset(self::$instances[$type])) {
$class = 'JFusion\\Api\\Platform\\' . $type;
self::$instances[$type] = new $class();
}
return self::$instances[$type];
} | php | public static function getTypeInstance($type)
{
$type = ucfirst(strtolower($type));
if (!isset(self::$instances[$type])) {
$class = 'JFusion\\Api\\Platform\\' . $type;
self::$instances[$type] = new $class();
}
return self::$instances[$type];
} | [
"public",
"static",
"function",
"getTypeInstance",
"(",
"$",
"type",
")",
"{",
"$",
"type",
"=",
"ucfirst",
"(",
"strtolower",
"(",
"$",
"type",
")",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"self",
"::",
"$",
"instances",
"[",
"$",
"type",
"]",
")"... | Get a platform type object.
@param string $type
@return Platform | [
"Get",
"a",
"platform",
"type",
"object",
"."
] | train | https://github.com/jfusion/org.jfusion.framework/blob/65771963f23ccabcf1f867eb17c9452299cfe683/src/Api/Platform.php#L43-L51 |
jfusion/org.jfusion.framework | src/Api/Platform.php | Platform.login | public function login($username, $password, $remember = 1)
{
$event = new Event('onPlatformLogin');
$event->addArgument('username', $username);
$event->addArgument('password', $password);
$event->addArgument('remember', $remember);
$event->addArgument('activePlugin', $this->activePlugin);
Factory::getDisp... | php | public function login($username, $password, $remember = 1)
{
$event = new Event('onPlatformLogin');
$event->addArgument('username', $username);
$event->addArgument('password', $password);
$event->addArgument('remember', $remember);
$event->addArgument('activePlugin', $this->activePlugin);
Factory::getDisp... | [
"public",
"function",
"login",
"(",
"$",
"username",
",",
"$",
"password",
",",
"$",
"remember",
"=",
"1",
")",
"{",
"$",
"event",
"=",
"new",
"Event",
"(",
"'onPlatformLogin'",
")",
";",
"$",
"event",
"->",
"addArgument",
"(",
"'username'",
",",
"$",
... | @param string $username
@param string $password
@param int $remember
@return void | [
"@param",
"string",
"$username",
"@param",
"string",
"$password",
"@param",
"int",
"$remember"
] | train | https://github.com/jfusion/org.jfusion.framework/blob/65771963f23ccabcf1f867eb17c9452299cfe683/src/Api/Platform.php#L103-L112 |
jfusion/org.jfusion.framework | src/Api/Platform.php | Platform.logout | public function logout($username = null)
{
$event = new Event('onPlatformLogout');
$event->addArgument('username', $username);
$event->addArgument('activePlugin', $this->activePlugin);
Factory::getDispatcher()->triggerEvent($event);
} | php | public function logout($username = null)
{
$event = new Event('onPlatformLogout');
$event->addArgument('username', $username);
$event->addArgument('activePlugin', $this->activePlugin);
Factory::getDispatcher()->triggerEvent($event);
} | [
"public",
"function",
"logout",
"(",
"$",
"username",
"=",
"null",
")",
"{",
"$",
"event",
"=",
"new",
"Event",
"(",
"'onPlatformLogout'",
")",
";",
"$",
"event",
"->",
"addArgument",
"(",
"'username'",
",",
"$",
"username",
")",
";",
"$",
"event",
"->... | @param null|string $username
@return void | [
"@param",
"null|string",
"$username"
] | train | https://github.com/jfusion/org.jfusion.framework/blob/65771963f23ccabcf1f867eb17c9452299cfe683/src/Api/Platform.php#L119-L126 |
jfusion/org.jfusion.framework | src/Api/Platform.php | Platform.register | public function register(Userinfo $userinfo)
{
$event = new Event('onPlatformUserRegister');
$event->addArgument('userinfo', $userinfo);
$event->addArgument('activePlugin', $this->activePlugin);
Factory::getDispatcher()->triggerEvent($event);
$debug = $event->getArgument('debug', null);
if ($debug) {
... | php | public function register(Userinfo $userinfo)
{
$event = new Event('onPlatformUserRegister');
$event->addArgument('userinfo', $userinfo);
$event->addArgument('activePlugin', $this->activePlugin);
Factory::getDispatcher()->triggerEvent($event);
$debug = $event->getArgument('debug', null);
if ($debug) {
... | [
"public",
"function",
"register",
"(",
"Userinfo",
"$",
"userinfo",
")",
"{",
"$",
"event",
"=",
"new",
"Event",
"(",
"'onPlatformUserRegister'",
")",
";",
"$",
"event",
"->",
"addArgument",
"(",
"'userinfo'",
",",
"$",
"userinfo",
")",
";",
"$",
"event",
... | @param Userinfo $userinfo
@return void | [
"@param",
"Userinfo",
"$userinfo"
] | train | https://github.com/jfusion/org.jfusion.framework/blob/65771963f23ccabcf1f867eb17c9452299cfe683/src/Api/Platform.php#L133-L150 |
jfusion/org.jfusion.framework | src/Api/Platform.php | Platform.update | public function update($userinfo, $overwrite)
{
$event = new Event('onPlatformUserUpdate');
$event->addArgument('userinfo', $userinfo);
$event->addArgument('overwrite', $overwrite);
$event->addArgument('activePlugin', $this->activePlugin);
Factory::getDispatcher()->triggerEvent($event);
$debug = $event->... | php | public function update($userinfo, $overwrite)
{
$event = new Event('onPlatformUserUpdate');
$event->addArgument('userinfo', $userinfo);
$event->addArgument('overwrite', $overwrite);
$event->addArgument('activePlugin', $this->activePlugin);
Factory::getDispatcher()->triggerEvent($event);
$debug = $event->... | [
"public",
"function",
"update",
"(",
"$",
"userinfo",
",",
"$",
"overwrite",
")",
"{",
"$",
"event",
"=",
"new",
"Event",
"(",
"'onPlatformUserUpdate'",
")",
";",
"$",
"event",
"->",
"addArgument",
"(",
"'userinfo'",
",",
"$",
"userinfo",
")",
";",
"$",
... | @param array $userinfo
@param $overwrite
@return void | [
"@param",
"array",
"$userinfo",
"@param",
"$overwrite"
] | train | https://github.com/jfusion/org.jfusion.framework/blob/65771963f23ccabcf1f867eb17c9452299cfe683/src/Api/Platform.php#L158-L176 |
jfusion/org.jfusion.framework | src/Api/Platform.php | Platform.delete | public function delete($userid)
{
$event = new Event('onPlatformUserDelete');
$event->addArgument('userid', $userid);
$event->addArgument('activePlugin', $this->activePlugin);
Factory::getDispatcher()->triggerEvent($event);
$debug = $event->getArgument('debug', null);
if ($debug) {
$this->debug[] = $d... | php | public function delete($userid)
{
$event = new Event('onPlatformUserDelete');
$event->addArgument('userid', $userid);
$event->addArgument('activePlugin', $this->activePlugin);
Factory::getDispatcher()->triggerEvent($event);
$debug = $event->getArgument('debug', null);
if ($debug) {
$this->debug[] = $d... | [
"public",
"function",
"delete",
"(",
"$",
"userid",
")",
"{",
"$",
"event",
"=",
"new",
"Event",
"(",
"'onPlatformUserDelete'",
")",
";",
"$",
"event",
"->",
"addArgument",
"(",
"'userid'",
",",
"$",
"userid",
")",
";",
"$",
"event",
"->",
"addArgument",... | @param int $userid
@return void | [
"@param",
"int",
"$userid"
] | train | https://github.com/jfusion/org.jfusion.framework/blob/65771963f23ccabcf1f867eb17c9452299cfe683/src/Api/Platform.php#L183-L200 |
netgen/metadata-bundle | bundle/Core/FieldType/Metadata/Value.php | Value.offsetGet | public function offsetGet($offset)
{
if (is_array($this->{$offset})) {
return implode(',', $this->{$offset});
}
return $this->{$offset};
} | php | public function offsetGet($offset)
{
if (is_array($this->{$offset})) {
return implode(',', $this->{$offset});
}
return $this->{$offset};
} | [
"public",
"function",
"offsetGet",
"(",
"$",
"offset",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"this",
"->",
"{",
"$",
"offset",
"}",
")",
")",
"{",
"return",
"implode",
"(",
"','",
",",
"$",
"this",
"->",
"{",
"$",
"offset",
"}",
")",
";",
... | Offset to retrieve.
@param mixed $offset The offset to retrieve
@return mixed | [
"Offset",
"to",
"retrieve",
"."
] | train | https://github.com/netgen/metadata-bundle/blob/12bfca68e8e8f4be409c7151f99dff665c53755b/bundle/Core/FieldType/Metadata/Value.php#L101-L108 |
phossa2/config | src/Config/Delegator.php | Delegator.set | public function set(/*# string */ $id, $value)/*# : bool */
{
if ($this->isWritable()) {
$this->writable->set($id, $value);
return $this->writable->has($id);
} else {
throw new LogicException(
Message::get(Message::CONFIG_NOT_WRITABLE, $id),
... | php | public function set(/*# string */ $id, $value)/*# : bool */
{
if ($this->isWritable()) {
$this->writable->set($id, $value);
return $this->writable->has($id);
} else {
throw new LogicException(
Message::get(Message::CONFIG_NOT_WRITABLE, $id),
... | [
"public",
"function",
"set",
"(",
"/*# string */",
"$",
"id",
",",
"$",
"value",
")",
"/*# : bool */",
"{",
"if",
"(",
"$",
"this",
"->",
"isWritable",
"(",
")",
")",
"{",
"$",
"this",
"->",
"writable",
"->",
"set",
"(",
"$",
"id",
",",
"$",
"value... | @since 2.0.12 changed return value
{@inheritDoc} | [
"@since",
"2",
".",
"0",
".",
"12",
"changed",
"return",
"value"
] | train | https://github.com/phossa2/config/blob/7c046fd2c97633b69545b4745d8bffe28e19b1df/src/Config/Delegator.php#L81-L92 |
lode/fem | src/text.php | text.generate_token | public static function generate_token($length) {
$byte_length = ($length / 2);
$new_token = bin2hex(openssl_random_pseudo_bytes($byte_length, $strong_enough));
if ($strong_enough == false || empty($new_token)) {
$exception = bootstrap::get_library('exception');
throw new $exception('can not generate cryptographi... | php | public static function generate_token($length) {
$byte_length = ($length / 2);
$new_token = bin2hex(openssl_random_pseudo_bytes($byte_length, $strong_enough));
if ($strong_enough == false || empty($new_token)) {
$exception = bootstrap::get_library('exception');
throw new $exception('can not generate cryptographi... | [
"public",
"static",
"function",
"generate_token",
"(",
"$",
"length",
")",
"{",
"$",
"byte_length",
"=",
"(",
"$",
"length",
"/",
"2",
")",
";",
"$",
"new_token",
"=",
"bin2hex",
"(",
"openssl_random_pseudo_bytes",
"(",
"$",
"byte_length",
",",
"$",
"stron... | generates cryptographically strong tokens
@param int $length of the returned string
@return string | [
"generates",
"cryptographically",
"strong",
"tokens"
] | train | https://github.com/lode/fem/blob/c1c466c1a904d99452b341c5ae7cbc3e22b106e1/src/text.php#L13-L22 |
lode/fem | src/text.php | text.slugify | public static function slugify($data) {
// flatten the data
$data = self::normalize($data);
$data = mb_strtolower($data);
// remove certain chars
$data = str_replace(['"', "'"], '', $data);
// replace most chars
$data = preg_replace('/[^a-z0-9]/', '-', $data);
// cleanup
$data = trim($data, '-');
retu... | php | public static function slugify($data) {
// flatten the data
$data = self::normalize($data);
$data = mb_strtolower($data);
// remove certain chars
$data = str_replace(['"', "'"], '', $data);
// replace most chars
$data = preg_replace('/[^a-z0-9]/', '-', $data);
// cleanup
$data = trim($data, '-');
retu... | [
"public",
"static",
"function",
"slugify",
"(",
"$",
"data",
")",
"{",
"// flatten the data",
"$",
"data",
"=",
"self",
"::",
"normalize",
"(",
"$",
"data",
")",
";",
"$",
"data",
"=",
"mb_strtolower",
"(",
"$",
"data",
")",
";",
"// remove certain chars",... | slugify strings for usage in urls
- normalizes and lowers the string
- replaces non-ascii chars with a dash (-)
- some chars (i.e. quotes) are plain removed
@note uses ::normalize, see notes there
@param string $data utf-8 encoded
@return string | [
"slugify",
"strings",
"for",
"usage",
"in",
"urls",
"-",
"normalizes",
"and",
"lowers",
"the",
"string",
"-",
"replaces",
"non",
"-",
"ascii",
"chars",
"with",
"a",
"dash",
"(",
"-",
")",
"-",
"some",
"chars",
"(",
"i",
".",
"e",
".",
"quotes",
")",
... | train | https://github.com/lode/fem/blob/c1c466c1a904d99452b341c5ae7cbc3e22b106e1/src/text.php#L61-L76 |
factorio-item-browser/export-data | src/Entity/Icon.php | Icon.setLayers | public function setLayers(array $layers)
{
$this->layers = array_values(array_filter($layers, function ($layer): bool {
return $layer instanceof Layer;
}));
return $this;
} | php | public function setLayers(array $layers)
{
$this->layers = array_values(array_filter($layers, function ($layer): bool {
return $layer instanceof Layer;
}));
return $this;
} | [
"public",
"function",
"setLayers",
"(",
"array",
"$",
"layers",
")",
"{",
"$",
"this",
"->",
"layers",
"=",
"array_values",
"(",
"array_filter",
"(",
"$",
"layers",
",",
"function",
"(",
"$",
"layer",
")",
":",
"bool",
"{",
"return",
"$",
"layer",
"ins... | Sets the layers of the icon.
@param array|Layer[] $layers
@return $this Implementing fluent interface. | [
"Sets",
"the",
"layers",
"of",
"the",
"icon",
"."
] | train | https://github.com/factorio-item-browser/export-data/blob/1413b2eed0fbfed0521457ac7ef0d668ac30c212/src/Entity/Icon.php#L98-L104 |
factorio-item-browser/export-data | src/Entity/Icon.php | Icon.writeData | public function writeData(): array
{
$dataBuilder = new DataBuilder();
$dataBuilder->setInteger('s', $this->size, self::DEFAULT_SIZE)
->setInteger('r', $this->renderedSize, self::DEFAULT_SIZE)
->setArray('l', $this->layers, function (Layer $layer): array {
... | php | public function writeData(): array
{
$dataBuilder = new DataBuilder();
$dataBuilder->setInteger('s', $this->size, self::DEFAULT_SIZE)
->setInteger('r', $this->renderedSize, self::DEFAULT_SIZE)
->setArray('l', $this->layers, function (Layer $layer): array {
... | [
"public",
"function",
"writeData",
"(",
")",
":",
"array",
"{",
"$",
"dataBuilder",
"=",
"new",
"DataBuilder",
"(",
")",
";",
"$",
"dataBuilder",
"->",
"setInteger",
"(",
"'s'",
",",
"$",
"this",
"->",
"size",
",",
"self",
"::",
"DEFAULT_SIZE",
")",
"-... | Writes the entity data to an array.
@return array | [
"Writes",
"the",
"entity",
"data",
"to",
"an",
"array",
"."
] | train | https://github.com/factorio-item-browser/export-data/blob/1413b2eed0fbfed0521457ac7ef0d668ac30c212/src/Entity/Icon.php#L130-L139 |
factorio-item-browser/export-data | src/Entity/Icon.php | Icon.readData | public function readData(DataContainer $data)
{
$this->size = $data->getInteger('s', self::DEFAULT_SIZE);
$this->renderedSize = $data->getInteger('r', self::DEFAULT_SIZE);
$this->layers = array_map(function (DataContainer $data): Layer {
return (new Layer())->readData($data);
... | php | public function readData(DataContainer $data)
{
$this->size = $data->getInteger('s', self::DEFAULT_SIZE);
$this->renderedSize = $data->getInteger('r', self::DEFAULT_SIZE);
$this->layers = array_map(function (DataContainer $data): Layer {
return (new Layer())->readData($data);
... | [
"public",
"function",
"readData",
"(",
"DataContainer",
"$",
"data",
")",
"{",
"$",
"this",
"->",
"size",
"=",
"$",
"data",
"->",
"getInteger",
"(",
"'s'",
",",
"self",
"::",
"DEFAULT_SIZE",
")",
";",
"$",
"this",
"->",
"renderedSize",
"=",
"$",
"data"... | Reads the entity data.
@param DataContainer $data
@return $this | [
"Reads",
"the",
"entity",
"data",
"."
] | train | https://github.com/factorio-item-browser/export-data/blob/1413b2eed0fbfed0521457ac7ef0d668ac30c212/src/Entity/Icon.php#L146-L154 |
factorio-item-browser/export-data | src/Entity/Icon.php | Icon.calculateHash | public function calculateHash(): string
{
return EntityUtils::calculateHashOfArray([
$this->size,
$this->renderedSize,
array_map(function (Layer $layer): string {
return $layer->calculateHash();
}, $this->layers)
]);
} | php | public function calculateHash(): string
{
return EntityUtils::calculateHashOfArray([
$this->size,
$this->renderedSize,
array_map(function (Layer $layer): string {
return $layer->calculateHash();
}, $this->layers)
]);
} | [
"public",
"function",
"calculateHash",
"(",
")",
":",
"string",
"{",
"return",
"EntityUtils",
"::",
"calculateHashOfArray",
"(",
"[",
"$",
"this",
"->",
"size",
",",
"$",
"this",
"->",
"renderedSize",
",",
"array_map",
"(",
"function",
"(",
"Layer",
"$",
"... | Calculates a hash value representing the entity.
@return string | [
"Calculates",
"a",
"hash",
"value",
"representing",
"the",
"entity",
"."
] | train | https://github.com/factorio-item-browser/export-data/blob/1413b2eed0fbfed0521457ac7ef0d668ac30c212/src/Entity/Icon.php#L160-L169 |
askupasoftware/amarkal | Loaders/AssetLoader.php | AssetLoader.register_asset | public function register_asset( \Amarkal\Assets\AbstractAsset $new_asset )
{
if( NULL == $this->assets ) {
$this->assets = array();
$this->assets[] = $new_asset;
}
else {
foreach( $this->assets as $asset ) {
if( $asset->handle == $new_asset... | php | public function register_asset( \Amarkal\Assets\AbstractAsset $new_asset )
{
if( NULL == $this->assets ) {
$this->assets = array();
$this->assets[] = $new_asset;
}
else {
foreach( $this->assets as $asset ) {
if( $asset->handle == $new_asset... | [
"public",
"function",
"register_asset",
"(",
"\\",
"Amarkal",
"\\",
"Assets",
"\\",
"AbstractAsset",
"$",
"new_asset",
")",
"{",
"if",
"(",
"NULL",
"==",
"$",
"this",
"->",
"assets",
")",
"{",
"$",
"this",
"->",
"assets",
"=",
"array",
"(",
")",
";",
... | Register a single asset
@param \Amarkal\Assets\AbstractAsset $new_asset The asset to enqueue
@throws DuplicateAssetException If the a duplicated asset handle exists | [
"Register",
"a",
"single",
"asset"
] | train | https://github.com/askupasoftware/amarkal/blob/fe8283e2d6847ef697abec832da7ee741a85058c/Loaders/AssetLoader.php#L79-L93 |
yuncms/framework | src/filters/BackendAccessControl.php | BackendAccessControl.getUser | public function getUser(): User
{
if (!$this->_user instanceof User) {
$this->_user = Instance::ensure($this->_user, User::class);
}
return $this->_user;
} | php | public function getUser(): User
{
if (!$this->_user instanceof User) {
$this->_user = Instance::ensure($this->_user, User::class);
}
return $this->_user;
} | [
"public",
"function",
"getUser",
"(",
")",
":",
"User",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"_user",
"instanceof",
"User",
")",
"{",
"$",
"this",
"->",
"_user",
"=",
"Instance",
"::",
"ensure",
"(",
"$",
"this",
"->",
"_user",
",",
"User",
"::"... | Get user
@return User
@throws \yii\base\InvalidConfigException | [
"Get",
"user"
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/filters/BackendAccessControl.php#L54-L60 |
latrell/AliyunOss | src/AliyunOssServiceProvider.php | AliyunOssServiceProvider.register | public function register()
{
$this->app->singleton('aliyun.oss', function ($app) {
$config = $app->config->get('latrell-aliyun-oss');
$access_key_id = array_get($config, 'access_key_id', '');
$access_key_secret = array_get($config, 'access_key_secret', '');
$endpoint = array_get($config, 'endpoint', '');... | php | public function register()
{
$this->app->singleton('aliyun.oss', function ($app) {
$config = $app->config->get('latrell-aliyun-oss');
$access_key_id = array_get($config, 'access_key_id', '');
$access_key_secret = array_get($config, 'access_key_secret', '');
$endpoint = array_get($config, 'endpoint', '');... | [
"public",
"function",
"register",
"(",
")",
"{",
"$",
"this",
"->",
"app",
"->",
"singleton",
"(",
"'aliyun.oss'",
",",
"function",
"(",
"$",
"app",
")",
"{",
"$",
"config",
"=",
"$",
"app",
"->",
"config",
"->",
"get",
"(",
"'latrell-aliyun-oss'",
")"... | Register the service provider.
@return void | [
"Register",
"the",
"service",
"provider",
"."
] | train | https://github.com/latrell/AliyunOss/blob/a50a796fdf7754af3128fbf68405e7ca589c43f9/src/AliyunOssServiceProvider.php#L32-L43 |
AydinHassan/cli-md-renderer | src/InlineRenderer/NewlineRenderer.php | NewlineRenderer.render | public function render(AbstractInline $inline, CliRenderer $renderer)
{
if (!($inline instanceof Newline)) {
throw new \InvalidArgumentException(sprintf('Incompatible inline type: "%s"', get_class($inline)));
}
return "\n";
} | php | public function render(AbstractInline $inline, CliRenderer $renderer)
{
if (!($inline instanceof Newline)) {
throw new \InvalidArgumentException(sprintf('Incompatible inline type: "%s"', get_class($inline)));
}
return "\n";
} | [
"public",
"function",
"render",
"(",
"AbstractInline",
"$",
"inline",
",",
"CliRenderer",
"$",
"renderer",
")",
"{",
"if",
"(",
"!",
"(",
"$",
"inline",
"instanceof",
"Newline",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"sprintf",... | @param AbstractInline $inline
@param CliRenderer $renderer
@return string | [
"@param",
"AbstractInline",
"$inline",
"@param",
"CliRenderer",
"$renderer"
] | train | https://github.com/AydinHassan/cli-md-renderer/blob/521f9ace2aeadd58bf8a3910704be8360f5bd7b2/src/InlineRenderer/NewlineRenderer.php#L23-L30 |
webforge-labs/psc-cms | lib/Psc/Code/Code.php | Code.value | public static function value($value) {
$values = func_get_args();
array_shift($values); // value entfernen
if (!in_array($value,$values)) {
throw new \Psc\Code\WrongValueException('Wert: "'.$value.'" ist unbekannt / nicht erlaubt. Erlaubt sind: ('.implode('|',$values).')');
}
return $value;
... | php | public static function value($value) {
$values = func_get_args();
array_shift($values); // value entfernen
if (!in_array($value,$values)) {
throw new \Psc\Code\WrongValueException('Wert: "'.$value.'" ist unbekannt / nicht erlaubt. Erlaubt sind: ('.implode('|',$values).')');
}
return $value;
... | [
"public",
"static",
"function",
"value",
"(",
"$",
"value",
")",
"{",
"$",
"values",
"=",
"func_get_args",
"(",
")",
";",
"array_shift",
"(",
"$",
"values",
")",
";",
"// value entfernen",
"if",
"(",
"!",
"in_array",
"(",
"$",
"value",
",",
"$",
"value... | Überprüft ob $value ein Wert aus den angegebenen erlaubten Werten ist
ist dies nicht der Fall wird eine Psc\Code\WrongValueException geworfen
ist dies der Fall wird $value zurückgegeben
@param mixed $value
@param mixed $value1,... | [
"Überprüft",
"ob",
"$value",
"ein",
"Wert",
"aus",
"den",
"angegebenen",
"erlaubten",
"Werten",
"ist"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/Code/Code.php#L34-L43 |
webforge-labs/psc-cms | lib/Psc/Code/Code.php | Code.dvalue | public static function dvalue(&$value, $defaultValue = NULL) {
$values = func_get_args();
array_shift($values); // value entfernen
if (!in_array($value,$values)) {
$value = array_shift($values);
}
return $value;
} | php | public static function dvalue(&$value, $defaultValue = NULL) {
$values = func_get_args();
array_shift($values); // value entfernen
if (!in_array($value,$values)) {
$value = array_shift($values);
}
return $value;
} | [
"public",
"static",
"function",
"dvalue",
"(",
"&",
"$",
"value",
",",
"$",
"defaultValue",
"=",
"NULL",
")",
"{",
"$",
"values",
"=",
"func_get_args",
"(",
")",
";",
"array_shift",
"(",
"$",
"values",
")",
";",
"// value entfernen",
"if",
"(",
"!",
"i... | Überprüft ob $value ein Wert aus den angegebenen erlaubten Werten ist, gibt einen Default zurück
ist $value nicht mit einem der angegeben Values identisch, wird keine Psc\Code\WrongValueException geworfen, sondern die erste angegeben Value auf $value gesetzt
diese Funktion modifiziert für den defaultFall also $value ... | [
"Überprüft",
"ob",
"$value",
"ein",
"Wert",
"aus",
"den",
"angegebenen",
"erlaubten",
"Werten",
"ist",
"gibt",
"einen",
"Default",
"zurück"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/Code/Code.php#L55-L64 |
webforge-labs/psc-cms | lib/Psc/Code/Code.php | Code.castId | public static function castId($id, $default = NULL) {
if (is_integer($id) && $id > 0) return $id;
if (ctype_digit($id) && ($id = (int) $id) && $id > 0) {
return $id;
} else {
return $default;
}
} | php | public static function castId($id, $default = NULL) {
if (is_integer($id) && $id > 0) return $id;
if (ctype_digit($id) && ($id = (int) $id) && $id > 0) {
return $id;
} else {
return $default;
}
} | [
"public",
"static",
"function",
"castId",
"(",
"$",
"id",
",",
"$",
"default",
"=",
"NULL",
")",
"{",
"if",
"(",
"is_integer",
"(",
"$",
"id",
")",
"&&",
"$",
"id",
">",
"0",
")",
"return",
"$",
"id",
";",
"if",
"(",
"ctype_digit",
"(",
"$",
"i... | Gibt die id als int zurück wenn $id > 0 ist ansonsten $default
sieht blöd aus, macht aber total viel Schreibarbeit wett
ist äquivalent zu:
self::cast($id, function ($id) { return $id > 0; }, 'integer', $default); | [
"Gibt",
"die",
"id",
"als",
"int",
"zurück",
"wenn",
"$id",
">",
"0",
"ist",
"ansonsten",
"$default"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/Code/Code.php#L149-L156 |
webforge-labs/psc-cms | lib/Psc/Code/Code.php | Code.cast | public static function cast($value, Closure $condition, $type, $default = NULL) {
return $condition($value) == TRUE ? settype($value, $type) : $default;
} | php | public static function cast($value, Closure $condition, $type, $default = NULL) {
return $condition($value) == TRUE ? settype($value, $type) : $default;
} | [
"public",
"static",
"function",
"cast",
"(",
"$",
"value",
",",
"Closure",
"$",
"condition",
",",
"$",
"type",
",",
"$",
"default",
"=",
"NULL",
")",
"{",
"return",
"$",
"condition",
"(",
"$",
"value",
")",
"==",
"TRUE",
"?",
"settype",
"(",
"$",
"... | Gibt die $value als $type zurück wenn die $condition($value) TRUE ergibt, ansonsten $default
@param string $type object|array|bool|integer|null|string|float | [
"Gibt",
"die",
"$value",
"als",
"$type",
"zurück",
"wenn",
"die",
"$condition",
"(",
"$value",
")",
"TRUE",
"ergibt",
"ansonsten",
"$default"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/Code/Code.php#L162-L164 |
webforge-labs/psc-cms | lib/Psc/Code/Code.php | Code.getClass | public static function getClass($object) {
if (!is_object($object))
throw new \Psc\Exception('Cannot get Class from non-object value. '.self::varInfo($object));
return get_class($object);
} | php | public static function getClass($object) {
if (!is_object($object))
throw new \Psc\Exception('Cannot get Class from non-object value. '.self::varInfo($object));
return get_class($object);
} | [
"public",
"static",
"function",
"getClass",
"(",
"$",
"object",
")",
"{",
"if",
"(",
"!",
"is_object",
"(",
"$",
"object",
")",
")",
"throw",
"new",
"\\",
"Psc",
"\\",
"Exception",
"(",
"'Cannot get Class from non-object value. '",
".",
"self",
"::",
"varInf... | Gibt die Klasse des Objektes zurück
@throws Exception wenn $object kein Objekt ist
@param mixed $object
@return string | [
"Gibt",
"die",
"Klasse",
"des",
"Objektes",
"zurück"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/Code/Code.php#L173-L178 |
webforge-labs/psc-cms | lib/Psc/Code/Code.php | Code.getNamespace | public static function getNamespace($className) {
$ns = NULL;
if (($p = mb_strrpos($className,'\\')) !== FALSE) {
$ns = mb_substr($className,0,$p);
}
if ($ns == '')
return NULL;
if (mb_strpos($className,'\\') !== 0) {
$ns = '\\'.$ns;
}
return $ns;
} | php | public static function getNamespace($className) {
$ns = NULL;
if (($p = mb_strrpos($className,'\\')) !== FALSE) {
$ns = mb_substr($className,0,$p);
}
if ($ns == '')
return NULL;
if (mb_strpos($className,'\\') !== 0) {
$ns = '\\'.$ns;
}
return $ns;
} | [
"public",
"static",
"function",
"getNamespace",
"(",
"$",
"className",
")",
"{",
"$",
"ns",
"=",
"NULL",
";",
"if",
"(",
"(",
"$",
"p",
"=",
"mb_strrpos",
"(",
"$",
"className",
",",
"'\\\\'",
")",
")",
"!==",
"FALSE",
")",
"{",
"$",
"ns",
"=",
"... | Gibt den Namespace der Klasse zurück
gibt NULL zurück für Klassen die im Root-Namespace sind
deshalb ist es hiermit schwierig zu unterscheiden, ob ein nicht-FQN einen Namespace hat
getNamespace('\stdClass') === NULL // true
getNamespace('stdClass') === NULL // auch true
es kommt also jeweils auf den Kontext an in de... | [
"Gibt",
"den",
"Namespace",
"der",
"Klasse",
"zurück"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/Code/Code.php#L200-L213 |
webforge-labs/psc-cms | lib/Psc/Code/Code.php | Code.expandNamespace | public static function expandNamespace($classOrClassName, $expandNamespace) {
if (mb_strpos($classOrClassName, '\\') !== 0 && self::getNamespace($classOrClassName) === NULL) {
return $expandNamespace.'\\'.ltrim($classOrClassName,'\\');
}
return $classOrClassName;
} | php | public static function expandNamespace($classOrClassName, $expandNamespace) {
if (mb_strpos($classOrClassName, '\\') !== 0 && self::getNamespace($classOrClassName) === NULL) {
return $expandNamespace.'\\'.ltrim($classOrClassName,'\\');
}
return $classOrClassName;
} | [
"public",
"static",
"function",
"expandNamespace",
"(",
"$",
"classOrClassName",
",",
"$",
"expandNamespace",
")",
"{",
"if",
"(",
"mb_strpos",
"(",
"$",
"classOrClassName",
",",
"'\\\\'",
")",
"!==",
"0",
"&&",
"self",
"::",
"getNamespace",
"(",
"$",
"class... | Erweitert einen nicht qualifzierten Klassenamen mit einem Namespace
nicht qualifizierte Klassenamen sind diese ohne \ am Anfang und ohne self::getNamespace()
wird root als leer übergeben, ist nicht gewährleistet, dass für alle parameter ein \ vor der Klasse steht:
z. B. (blubb\className) wird nicht \blubb\className d... | [
"Erweitert",
"einen",
"nicht",
"qualifzierten",
"Klassenamen",
"mit",
"einem",
"Namespace"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/Code/Code.php#L223-L229 |
webforge-labs/psc-cms | lib/Psc/Code/Code.php | Code.getClassName | public static function getClassName($className) {
if (is_object($className)) $className = self::getClass($className);
$c = $className;
if (mb_strpos($className,'\\') !== FALSE) {
$p = explode('\\',$className);
$c = array_pop($p);
}
return $c;
} | php | public static function getClassName($className) {
if (is_object($className)) $className = self::getClass($className);
$c = $className;
if (mb_strpos($className,'\\') !== FALSE) {
$p = explode('\\',$className);
$c = array_pop($p);
}
return $c;
} | [
"public",
"static",
"function",
"getClassName",
"(",
"$",
"className",
")",
"{",
"if",
"(",
"is_object",
"(",
"$",
"className",
")",
")",
"$",
"className",
"=",
"self",
"::",
"getClass",
"(",
"$",
"className",
")",
";",
"$",
"c",
"=",
"$",
"className",... | Gibt nur den Namen (ohne Namespace) ohne \ davor zurück
@param string|object $className | [
"Gibt",
"nur",
"den",
"Namen",
"(",
"ohne",
"Namespace",
")",
"ohne",
"\\",
"davor",
"zurück"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/Code/Code.php#L235-L244 |
webforge-labs/psc-cms | lib/Psc/Code/Code.php | Code.namespaceToPath | public static function namespaceToPath($namespace, Dir $classPath = NULL) {
// end und anfangs backslashs weg
$namespace = trim($namespace,'\\');
if (!isset($classPath)) {
$classPath = new Dir('.'.DIRECTORY_SEPARATOR);
}
return $classPath->sub(str_replace('\\','/',$namespace).'/');
... | php | public static function namespaceToPath($namespace, Dir $classPath = NULL) {
// end und anfangs backslashs weg
$namespace = trim($namespace,'\\');
if (!isset($classPath)) {
$classPath = new Dir('.'.DIRECTORY_SEPARATOR);
}
return $classPath->sub(str_replace('\\','/',$namespace).'/');
... | [
"public",
"static",
"function",
"namespaceToPath",
"(",
"$",
"namespace",
",",
"Dir",
"$",
"classPath",
"=",
"NULL",
")",
"{",
"// end und anfangs backslashs weg",
"$",
"namespace",
"=",
"trim",
"(",
"$",
"namespace",
",",
"'\\\\'",
")",
";",
"if",
"(",
"!",... | Gibt das Verzeichnis eines Namespaces in einem Verzeichnis zurück
dies nimmt einfach den Namespace
@return Dir absolute im angebenen $classPath oder relatives Verzeichnis | [
"Gibt",
"das",
"Verzeichnis",
"eines",
"Namespaces",
"in",
"einem",
"Verzeichnis",
"zurück"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/Code/Code.php#L253-L262 |
webforge-labs/psc-cms | lib/Psc/Code/Code.php | Code.mapClassToFile | public static function mapClassToFile($classFQN, Dir $root = NULL) {
$ns = self::getNamespace($classFQN);
$c = self::getClassName($classFQN);
if (!isset($root)) {
$root = new Dir('.'.DIRECTORY_SEPARATOR);
}
return new File(self::namespaceToPath($ns, $root), $c.'.php');
} | php | public static function mapClassToFile($classFQN, Dir $root = NULL) {
$ns = self::getNamespace($classFQN);
$c = self::getClassName($classFQN);
if (!isset($root)) {
$root = new Dir('.'.DIRECTORY_SEPARATOR);
}
return new File(self::namespaceToPath($ns, $root), $c.'.php');
} | [
"public",
"static",
"function",
"mapClassToFile",
"(",
"$",
"classFQN",
",",
"Dir",
"$",
"root",
"=",
"NULL",
")",
"{",
"$",
"ns",
"=",
"self",
"::",
"getNamespace",
"(",
"$",
"classFQN",
")",
";",
"$",
"c",
"=",
"self",
"::",
"getClassName",
"(",
"$... | Gibt den Dateinamen zu einer Klasse zurück
Konvention: der relative Pfad zur Datei der Namespace wird mit Verzeichnissen abgebildet der Klassenname als php-Datei
@return File wenn $root gesetzt ist dies der absolute pfad, sonst relativ | [
"Gibt",
"den",
"Dateinamen",
"zu",
"einer",
"Klasse",
"zurück"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/Code/Code.php#L270-L279 |
webforge-labs/psc-cms | lib/Psc/Code/Code.php | Code.mapFileToClass | public static function mapFileToClass(File $classFile, Dir $root = NULL, $style = '\\') {
$classDir = clone $classFile->getDirectory();
if (isset($root))
$classDir->makeRelativeTo($root);
$pa = $classDir->getPathArray();
if ($style === '\\') {
$ns = (count($pa) > 1) ? '\\'.implode(... | php | public static function mapFileToClass(File $classFile, Dir $root = NULL, $style = '\\') {
$classDir = clone $classFile->getDirectory();
if (isset($root))
$classDir->makeRelativeTo($root);
$pa = $classDir->getPathArray();
if ($style === '\\') {
$ns = (count($pa) > 1) ? '\\'.implode(... | [
"public",
"static",
"function",
"mapFileToClass",
"(",
"File",
"$",
"classFile",
",",
"Dir",
"$",
"root",
"=",
"NULL",
",",
"$",
"style",
"=",
"'\\\\'",
")",
"{",
"$",
"classDir",
"=",
"clone",
"$",
"classFile",
"->",
"getDirectory",
"(",
")",
";",
"if... | Gibt den Namen der Klasse für eine Datei zurück
beruht auf der Konvention, dass jedes Verzeichnis ein Namespace ist und der Dateiname der Klassename ist
Beispiel siehe Test
@param Dir $root darf nicht das verzeichnis des Namespaces sein. also nicht base\src\SerienLoader sondern base\src\
@param string $style wird _... | [
"Gibt",
"den",
"Namen",
"der",
"Klasse",
"für",
"eine",
"Datei",
"zurück"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/Code/Code.php#L293-L312 |
Chill-project/Main | Security/Authorization/AuthorizationHelper.php | AuthorizationHelper.userCanReachCenter | public function userCanReachCenter(User $user, Center $center)
{
foreach ($user->getGroupCenters() as $groupCenter) {
if ($center->getId() === $groupCenter->getCenter()->getId()) {
return true;
}
}
return false;
} | php | public function userCanReachCenter(User $user, Center $center)
{
foreach ($user->getGroupCenters() as $groupCenter) {
if ($center->getId() === $groupCenter->getCenter()->getId()) {
return true;
}
}
return false;
} | [
"public",
"function",
"userCanReachCenter",
"(",
"User",
"$",
"user",
",",
"Center",
"$",
"center",
")",
"{",
"foreach",
"(",
"$",
"user",
"->",
"getGroupCenters",
"(",
")",
"as",
"$",
"groupCenter",
")",
"{",
"if",
"(",
"$",
"center",
"->",
"getId",
"... | Determines if a user is active on this center
@param User $user
@param Center $center
@return bool | [
"Determines",
"if",
"a",
"user",
"is",
"active",
"on",
"this",
"center"
] | train | https://github.com/Chill-project/Main/blob/384cb6c793072a4f1047dc5cafc2157ee2419f60/Security/Authorization/AuthorizationHelper.php#L60-L70 |
Chill-project/Main | Security/Authorization/AuthorizationHelper.php | AuthorizationHelper.getReachableCenters | public function getReachableCenters(User $user, Role $role, Scope $scope = null)
{
$centers = array();
foreach ($user->getGroupCenters() as $groupCenter){
$permissionGroup = $groupCenter->getPermissionsGroup();
//iterate on roleScopes
foreach($permissionG... | php | public function getReachableCenters(User $user, Role $role, Scope $scope = null)
{
$centers = array();
foreach ($user->getGroupCenters() as $groupCenter){
$permissionGroup = $groupCenter->getPermissionsGroup();
//iterate on roleScopes
foreach($permissionG... | [
"public",
"function",
"getReachableCenters",
"(",
"User",
"$",
"user",
",",
"Role",
"$",
"role",
",",
"Scope",
"$",
"scope",
"=",
"null",
")",
"{",
"$",
"centers",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"user",
"->",
"getGroupCenters",
"(",
... | Get reachable Centers for the given user, role,
and optionnaly Scope
@param User $user
@param Role $role
@param null|Scope $scope
@return Center[] | [
"Get",
"reachable",
"Centers",
"for",
"the",
"given",
"user",
"role",
"and",
"optionnaly",
"Scope"
] | train | https://github.com/Chill-project/Main/blob/384cb6c793072a4f1047dc5cafc2157ee2419f60/Security/Authorization/AuthorizationHelper.php#L136-L162 |
Chill-project/Main | Security/Authorization/AuthorizationHelper.php | AuthorizationHelper.getReachableScopes | public function getReachableScopes(User $user, Role $role, Center $center)
{
return $this->getReachableCircles($user, $role, $center);
} | php | public function getReachableScopes(User $user, Role $role, Center $center)
{
return $this->getReachableCircles($user, $role, $center);
} | [
"public",
"function",
"getReachableScopes",
"(",
"User",
"$",
"user",
",",
"Role",
"$",
"role",
",",
"Center",
"$",
"center",
")",
"{",
"return",
"$",
"this",
"->",
"getReachableCircles",
"(",
"$",
"user",
",",
"$",
"role",
",",
"$",
"center",
")",
";"... | Return all reachable scope for a given user, center and role
@deprecated Use getReachableCircles
@param User $user
@param Role $role
@param Center $center
@return Scope[] | [
"Return",
"all",
"reachable",
"scope",
"for",
"a",
"given",
"user",
"center",
"and",
"role"
] | train | https://github.com/Chill-project/Main/blob/384cb6c793072a4f1047dc5cafc2157ee2419f60/Security/Authorization/AuthorizationHelper.php#L174-L177 |
Chill-project/Main | Security/Authorization/AuthorizationHelper.php | AuthorizationHelper.getReachableCircles | public function getReachableCircles(User $user, Role $role, Center $center)
{
$scopes = array();
foreach ($user->getGroupCenters() as $groupCenter){
if ($center->getId() === $groupCenter->getCenter()->getId()) {
//iterate on permissionGroup
$permi... | php | public function getReachableCircles(User $user, Role $role, Center $center)
{
$scopes = array();
foreach ($user->getGroupCenters() as $groupCenter){
if ($center->getId() === $groupCenter->getCenter()->getId()) {
//iterate on permissionGroup
$permi... | [
"public",
"function",
"getReachableCircles",
"(",
"User",
"$",
"user",
",",
"Role",
"$",
"role",
",",
"Center",
"$",
"center",
")",
"{",
"$",
"scopes",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"user",
"->",
"getGroupCenters",
"(",
")",
"as",
... | Return all reachable circle for a given user, center and role
@param User $user
@param Role $role
@param Center $center
@return Scope[] | [
"Return",
"all",
"reachable",
"circle",
"for",
"a",
"given",
"user",
"center",
"and",
"role"
] | train | https://github.com/Chill-project/Main/blob/384cb6c793072a4f1047dc5cafc2157ee2419f60/Security/Authorization/AuthorizationHelper.php#L187-L208 |
Chill-project/Main | Security/Authorization/AuthorizationHelper.php | AuthorizationHelper.isRoleReached | protected function isRoleReached(Role $childRole, Role $parentRole)
{
$reachableRoles = $this->roleHierarchy
->getReachableRoles([$parentRole]);
return in_array($childRole, $reachableRoles);
} | php | protected function isRoleReached(Role $childRole, Role $parentRole)
{
$reachableRoles = $this->roleHierarchy
->getReachableRoles([$parentRole]);
return in_array($childRole, $reachableRoles);
} | [
"protected",
"function",
"isRoleReached",
"(",
"Role",
"$",
"childRole",
",",
"Role",
"$",
"parentRole",
")",
"{",
"$",
"reachableRoles",
"=",
"$",
"this",
"->",
"roleHierarchy",
"->",
"getReachableRoles",
"(",
"[",
"$",
"parentRole",
"]",
")",
";",
"return"... | Test if a parent role may give access to a given child role
@param Role $childRole The role we want to test if he is reachable
@param Role $parentRole The role which should give access to $childRole
@return boolean true if the child role is granted by parent role | [
"Test",
"if",
"a",
"parent",
"role",
"may",
"give",
"access",
"to",
"a",
"given",
"child",
"role"
] | train | https://github.com/Chill-project/Main/blob/384cb6c793072a4f1047dc5cafc2157ee2419f60/Security/Authorization/AuthorizationHelper.php#L219-L225 |
vi-kon/laravel-auth | src/database/migrations/2014_08_27_000003_create_user_password_reminders_table.php | CreateUserPasswordRemindersTable.up | public function up()
{
$schema = app()->make('db')->connection()->getSchemaBuilder();
$schema->create(config('vi-kon.auth.table.user_password_reminders'), function (Blueprint $table) {
$table->engine = 'InnoDB';
$table->increments('id');
$table->unsignedInteger(... | php | public function up()
{
$schema = app()->make('db')->connection()->getSchemaBuilder();
$schema->create(config('vi-kon.auth.table.user_password_reminders'), function (Blueprint $table) {
$table->engine = 'InnoDB';
$table->increments('id');
$table->unsignedInteger(... | [
"public",
"function",
"up",
"(",
")",
"{",
"$",
"schema",
"=",
"app",
"(",
")",
"->",
"make",
"(",
"'db'",
")",
"->",
"connection",
"(",
")",
"->",
"getSchemaBuilder",
"(",
")",
";",
"$",
"schema",
"->",
"create",
"(",
"config",
"(",
"'vi-kon.auth.ta... | Run the migrations.
@return void | [
"Run",
"the",
"migrations",
"."
] | train | https://github.com/vi-kon/laravel-auth/blob/501c20128f43347a2ca271a53435297f9ef7f567/src/database/migrations/2014_08_27_000003_create_user_password_reminders_table.php#L18-L35 |
aedart/laravel-helpers | src/Traits/Cache/CacheStoreTrait.php | CacheStoreTrait.getCacheStore | public function getCacheStore(): ?Store
{
if (!$this->hasCacheStore()) {
$this->setCacheStore($this->getDefaultCacheStore());
}
return $this->cacheStore;
} | php | public function getCacheStore(): ?Store
{
if (!$this->hasCacheStore()) {
$this->setCacheStore($this->getDefaultCacheStore());
}
return $this->cacheStore;
} | [
"public",
"function",
"getCacheStore",
"(",
")",
":",
"?",
"Store",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasCacheStore",
"(",
")",
")",
"{",
"$",
"this",
"->",
"setCacheStore",
"(",
"$",
"this",
"->",
"getDefaultCacheStore",
"(",
")",
")",
";",
"... | Get cache store
If no cache store has been set, this method will
set and return a default cache store, if any such
value is available
@see getDefaultCacheStore()
@return Store|null cache store or null if none cache store has been set | [
"Get",
"cache",
"store"
] | train | https://github.com/aedart/laravel-helpers/blob/8b81a2d6658f3f8cb62b6be2c34773aaa2df219a/src/Traits/Cache/CacheStoreTrait.php#L54-L60 |
aedart/laravel-helpers | src/Traits/Cache/CacheStoreTrait.php | CacheStoreTrait.getDefaultCacheStore | public function getDefaultCacheStore(): ?Store
{
// We do not know what store is desired. Therefore,
// the safest bet is to obtain the default
$manager = Cache::getFacadeRoot();
if (isset($manager)) {
/** @var Repository $repository */
$repository = $manager-... | php | public function getDefaultCacheStore(): ?Store
{
// We do not know what store is desired. Therefore,
// the safest bet is to obtain the default
$manager = Cache::getFacadeRoot();
if (isset($manager)) {
/** @var Repository $repository */
$repository = $manager-... | [
"public",
"function",
"getDefaultCacheStore",
"(",
")",
":",
"?",
"Store",
"{",
"// We do not know what store is desired. Therefore,",
"// the safest bet is to obtain the default",
"$",
"manager",
"=",
"Cache",
"::",
"getFacadeRoot",
"(",
")",
";",
"if",
"(",
"isset",
"... | Get a default cache store value, if any is available
@return Store|null A default cache store value or Null if no default value is available | [
"Get",
"a",
"default",
"cache",
"store",
"value",
"if",
"any",
"is",
"available"
] | train | https://github.com/aedart/laravel-helpers/blob/8b81a2d6658f3f8cb62b6be2c34773aaa2df219a/src/Traits/Cache/CacheStoreTrait.php#L77-L88 |
prolic/Concurrent-PHP-Utils | src/ConcurrentPhpUtils/CasThreadedMemberTrait.php | CasThreadedMemberTrait.casMember | public function casMember($member, $oldValue, $newValue)
{
$set = false;
$this->lock();
if ($this[$member] == $oldValue) {
$this[$member] = $newValue;
$set = true;
}
$this->unlock();
return $set;
} | php | public function casMember($member, $oldValue, $newValue)
{
$set = false;
$this->lock();
if ($this[$member] == $oldValue) {
$this[$member] = $newValue;
$set = true;
}
$this->unlock();
return $set;
} | [
"public",
"function",
"casMember",
"(",
"$",
"member",
",",
"$",
"oldValue",
",",
"$",
"newValue",
")",
"{",
"$",
"set",
"=",
"false",
";",
"$",
"this",
"->",
"lock",
"(",
")",
";",
"if",
"(",
"$",
"this",
"[",
"$",
"member",
"]",
"==",
"$",
"o... | Performs a compare and swap operation on a class member
@param string $member
@param mixed $oldValue
@param mixed $newValue
@return bool | [
"Performs",
"a",
"compare",
"and",
"swap",
"operation",
"on",
"a",
"class",
"member"
] | train | https://github.com/prolic/Concurrent-PHP-Utils/blob/771b55b3ef79d9a7443c4f6d95373f41b9f34c4a/src/ConcurrentPhpUtils/CasThreadedMemberTrait.php#L20-L33 |
dunkelfrosch/phpcoverfish | src/PHPCoverFish/Validator/ValidatorClassName.php | ValidatorClassName.getMapping | public function getMapping(CoverFishPHPUnitFile $phpUnitFile)
{
$class = $this->getResult()['class'];
// fqn detected? fully qualified classNames will be used directly without any kind of counterCheck
// against use statement(s) - otherwise classFQN will be taken from use statement directly.... | php | public function getMapping(CoverFishPHPUnitFile $phpUnitFile)
{
$class = $this->getResult()['class'];
// fqn detected? fully qualified classNames will be used directly without any kind of counterCheck
// against use statement(s) - otherwise classFQN will be taken from use statement directly.... | [
"public",
"function",
"getMapping",
"(",
"CoverFishPHPUnitFile",
"$",
"phpUnitFile",
")",
"{",
"$",
"class",
"=",
"$",
"this",
"->",
"getResult",
"(",
")",
"[",
"'class'",
"]",
";",
"// fqn detected? fully qualified classNames will be used directly without any kind of cou... | @param CoverFishPHPUnitFile $phpUnitFile
@return array | [
"@param",
"CoverFishPHPUnitFile",
"$phpUnitFile"
] | train | https://github.com/dunkelfrosch/phpcoverfish/blob/779bd399ec8f4cadb3b7854200695c5eb3f5a8ad/src/PHPCoverFish/Validator/ValidatorClassName.php#L52-L74 |
slashworks/control-bundle | src/Slashworks/AppBundle/Controller/NotificationCenterController.php | NotificationCenterController.indexAction | public function indexAction()
{
$id = $this->getUser()->getId();
/** @var User $oUser */
$oUser = UserQuery::create()->findOneById($id);
$form = $this->createFormBuilder($oUser)
->setAction($this->generateUrl("notification_center_update"))
... | php | public function indexAction()
{
$id = $this->getUser()->getId();
/** @var User $oUser */
$oUser = UserQuery::create()->findOneById($id);
$form = $this->createFormBuilder($oUser)
->setAction($this->generateUrl("notification_center_update"))
... | [
"public",
"function",
"indexAction",
"(",
")",
"{",
"$",
"id",
"=",
"$",
"this",
"->",
"getUser",
"(",
")",
"->",
"getId",
"(",
")",
";",
"/** @var User $oUser */",
"$",
"oUser",
"=",
"UserQuery",
"::",
"create",
"(",
")",
"->",
"findOneById",
"(",
"$"... | Display form for notification settings
@return \Symfony\Component\HttpFoundation\Response | [
"Display",
"form",
"for",
"notification",
"settings"
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Controller/NotificationCenterController.php#L41-L61 |
slashworks/control-bundle | src/Slashworks/AppBundle/Controller/NotificationCenterController.php | NotificationCenterController.updateAction | public function updateAction(Request $request)
{
try {
$id = $this->getUser()->getId();
/** @var User $oUser */
$oUser = UserQuery::create()->findOneById($id);
if ($oUser === null) {
throw $this->createNotFoundExc... | php | public function updateAction(Request $request)
{
try {
$id = $this->getUser()->getId();
/** @var User $oUser */
$oUser = UserQuery::create()->findOneById($id);
if ($oUser === null) {
throw $this->createNotFoundExc... | [
"public",
"function",
"updateAction",
"(",
"Request",
"$",
"request",
")",
"{",
"try",
"{",
"$",
"id",
"=",
"$",
"this",
"->",
"getUser",
"(",
")",
"->",
"getId",
"(",
")",
";",
"/** @var User $oUser */",
"$",
"oUser",
"=",
"UserQuery",
"::",
"create",
... | Update notification settings
@param \Symfony\Component\HttpFoundation\Request $request
@return \Symfony\Component\HttpFoundation\Response | [
"Update",
"notification",
"settings"
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Controller/NotificationCenterController.php#L71-L110 |
jenwachter/html-form | src/Elements/Parents/Option.php | Option.compile | public function compile($value = "")
{
$html = $this->compiledLabel;
if (!empty($this->help)) {
$html .= "<div class='help'>{$this->help}</div>";
}
$html .= "<div class=\"elements\">";
$hasOptionValue = $this->hasOptionValue($this->options);
foreach ($this->options as $k => $v) {
$html .= "<div ... | php | public function compile($value = "")
{
$html = $this->compiledLabel;
if (!empty($this->help)) {
$html .= "<div class='help'>{$this->help}</div>";
}
$html .= "<div class=\"elements\">";
$hasOptionValue = $this->hasOptionValue($this->options);
foreach ($this->options as $k => $v) {
$html .= "<div ... | [
"public",
"function",
"compile",
"(",
"$",
"value",
"=",
"\"\"",
")",
"{",
"$",
"html",
"=",
"$",
"this",
"->",
"compiledLabel",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"help",
")",
")",
"{",
"$",
"html",
".=",
"\"<div class='help'>{$th... | Builds the HTML of the form field.
@param string $value Value of the form field
@return null | [
"Builds",
"the",
"HTML",
"of",
"the",
"form",
"field",
"."
] | train | https://github.com/jenwachter/html-form/blob/eaece87d474f7da5c25679548fb8f1608a94303c/src/Elements/Parents/Option.php#L59-L102 |
afrittella/back-project | src/app/Http/Requests/AccountStore.php | AccountStore.rules | public function rules()
{
$user = $this->users->findBy('id', \Auth::user()->id);
return [
'username' => 'required|max:255|unique:users,username,'.$user->id,
'email' => 'required|email|max:255|unique:users,email,'.$user->id,
'password' => 'sometimes|required|min:6... | php | public function rules()
{
$user = $this->users->findBy('id', \Auth::user()->id);
return [
'username' => 'required|max:255|unique:users,username,'.$user->id,
'email' => 'required|email|max:255|unique:users,email,'.$user->id,
'password' => 'sometimes|required|min:6... | [
"public",
"function",
"rules",
"(",
")",
"{",
"$",
"user",
"=",
"$",
"this",
"->",
"users",
"->",
"findBy",
"(",
"'id'",
",",
"\\",
"Auth",
"::",
"user",
"(",
")",
"->",
"id",
")",
";",
"return",
"[",
"'username'",
"=>",
"'required|max:255|unique:users... | Get the validation rules that apply to the request.
@return array | [
"Get",
"the",
"validation",
"rules",
"that",
"apply",
"to",
"the",
"request",
"."
] | train | https://github.com/afrittella/back-project/blob/e1aa2e3ee03d453033f75a4b16f073c60b5f32d1/src/app/Http/Requests/AccountStore.php#L32-L41 |
inpsyde/inpsyde-filter | src/WordPress/SanitizePostField.php | SanitizePostField.filter | public function filter( $value ) {
if ( ! is_scalar( $value ) || empty( $value ) ) {
do_action( 'inpsyde.filter.error', 'The given value is not scalar or empty.', [ 'method' => __METHOD__, 'value' => $value ] );
return $value;
}
if ( ! isset( $this->options[ 'field' ] ) ) {
return $value;
}
$con... | php | public function filter( $value ) {
if ( ! is_scalar( $value ) || empty( $value ) ) {
do_action( 'inpsyde.filter.error', 'The given value is not scalar or empty.', [ 'method' => __METHOD__, 'value' => $value ] );
return $value;
}
if ( ! isset( $this->options[ 'field' ] ) ) {
return $value;
}
$con... | [
"public",
"function",
"filter",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"is_scalar",
"(",
"$",
"value",
")",
"||",
"empty",
"(",
"$",
"value",
")",
")",
"{",
"do_action",
"(",
"'inpsyde.filter.error'",
",",
"'The given value is not scalar or empty.'",
"... | {@inheritdoc} | [
"{"
] | train | https://github.com/inpsyde/inpsyde-filter/blob/777a6208ea4dfbeed89e6d0712a35dc25eab498b/src/WordPress/SanitizePostField.php#L26-L43 |
CakeCMS/Core | src/Event/CoreEventHandler.php | CoreEventHandler.onControllerSetup | public function onControllerSetup(Event $event)
{
/** @var AppController $controller */
$controller = $event->getSubject();
$isAdmin = ($controller->request->getParam('prefix') === 'admin');
$plugins = Plugin::loaded();
foreach ($plugins as $plugin) {
$path ... | php | public function onControllerSetup(Event $event)
{
/** @var AppController $controller */
$controller = $event->getSubject();
$isAdmin = ($controller->request->getParam('prefix') === 'admin');
$plugins = Plugin::loaded();
foreach ($plugins as $plugin) {
$path ... | [
"public",
"function",
"onControllerSetup",
"(",
"Event",
"$",
"event",
")",
"{",
"/** @var AppController $controller */",
"$",
"controller",
"=",
"$",
"event",
"->",
"getSubject",
"(",
")",
";",
"$",
"isAdmin",
"=",
"(",
"$",
"controller",
"->",
"request",
"->... | On controller setup.
@param Event $event
@return void | [
"On",
"controller",
"setup",
"."
] | train | https://github.com/CakeCMS/Core/blob/f9cba7aa0043a10e5c35bd45fbad158688a09a96/src/Event/CoreEventHandler.php#L50-L67 |
webforge-labs/psc-cms | lib/Psc/CMS/EntityMeta.php | EntityMeta.setPropertiesHints | public function setPropertiesHints(Array $hints) {
foreach ($hints as $propertyName => $hint) {
$this->getPropertyMeta($propertyName)
->setHint($hint);
}
return $this;
} | php | public function setPropertiesHints(Array $hints) {
foreach ($hints as $propertyName => $hint) {
$this->getPropertyMeta($propertyName)
->setHint($hint);
}
return $this;
} | [
"public",
"function",
"setPropertiesHints",
"(",
"Array",
"$",
"hints",
")",
"{",
"foreach",
"(",
"$",
"hints",
"as",
"$",
"propertyName",
"=>",
"$",
"hint",
")",
"{",
"$",
"this",
"->",
"getPropertyMeta",
"(",
"$",
"propertyName",
")",
"->",
"setHint",
... | Setzt die Hints für mehrere Properties
(werden unter der Komponente angezeigt)
@param array $hints string $propertyName => string $propertyHint | [
"Setzt",
"die",
"Hints",
"für",
"mehrere",
"Properties"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/CMS/EntityMeta.php#L209-L215 |
webforge-labs/psc-cms | lib/Psc/CMS/EntityMeta.php | EntityMeta.getNewRequestMeta | public function getNewRequestMeta($clone = TRUE, $subResource = NULL) {
if (!isset($this->newRequestMeta)) {
$this->newRequestMeta = new RequestMeta(\Psc\Net\HTTP\Request::POST,
$this->constructUrl(array($this->getEntityNamePlural()))
... | php | public function getNewRequestMeta($clone = TRUE, $subResource = NULL) {
if (!isset($this->newRequestMeta)) {
$this->newRequestMeta = new RequestMeta(\Psc\Net\HTTP\Request::POST,
$this->constructUrl(array($this->getEntityNamePlural()))
... | [
"public",
"function",
"getNewRequestMeta",
"(",
"$",
"clone",
"=",
"TRUE",
",",
"$",
"subResource",
"=",
"NULL",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"newRequestMeta",
")",
")",
"{",
"$",
"this",
"->",
"newRequestMeta",
"=",
"new"... | Neues Entity Erstellen (POST)
@param Psc\CMS\RequestMeta $NewRequestMeta
@chainable | [
"Neues",
"Entity",
"Erstellen",
"(",
"POST",
")"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/CMS/EntityMeta.php#L486-L500 |
webforge-labs/psc-cms | lib/Psc/CMS/EntityMeta.php | EntityMeta.getSaveRequestMeta | public function getSaveRequestMeta(Entity $entity = NULL, $subResource = NULL) {
$idIsInt = ($type = $this->getIdentifier()->getType()) instanceof IntegerType;
// custom save request
if ($subResource != NULL) {
$requestMeta = new RequestMeta(\Psc\Net\HTTP\Request::PUT,
... | php | public function getSaveRequestMeta(Entity $entity = NULL, $subResource = NULL) {
$idIsInt = ($type = $this->getIdentifier()->getType()) instanceof IntegerType;
// custom save request
if ($subResource != NULL) {
$requestMeta = new RequestMeta(\Psc\Net\HTTP\Request::PUT,
... | [
"public",
"function",
"getSaveRequestMeta",
"(",
"Entity",
"$",
"entity",
"=",
"NULL",
",",
"$",
"subResource",
"=",
"NULL",
")",
"{",
"$",
"idIsInt",
"=",
"(",
"$",
"type",
"=",
"$",
"this",
"->",
"getIdentifier",
"(",
")",
"->",
"getType",
"(",
")",
... | "Formular" Speichern (PUT)
@return Psc\CMS\RequestMeta | [
"Formular",
"Speichern",
"(",
"PUT",
")"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/CMS/EntityMeta.php#L507-L536 |
webforge-labs/psc-cms | lib/Psc/CMS/EntityMeta.php | EntityMeta.getGridRequestMeta | public function getGridRequestMeta($clone = TRUE, $save = FALSE) {
if ($save) {
return new RequestMeta(\Psc\Net\HTTP\Request::PUT,
$this->constructUrl(array($this->getEntityNamePlural(), 'grid'))
);
}
if (!isset($this->gridRequestMeta)) {
... | php | public function getGridRequestMeta($clone = TRUE, $save = FALSE) {
if ($save) {
return new RequestMeta(\Psc\Net\HTTP\Request::PUT,
$this->constructUrl(array($this->getEntityNamePlural(), 'grid'))
);
}
if (!isset($this->gridRequestMeta)) {
... | [
"public",
"function",
"getGridRequestMeta",
"(",
"$",
"clone",
"=",
"TRUE",
",",
"$",
"save",
"=",
"FALSE",
")",
"{",
"if",
"(",
"$",
"save",
")",
"{",
"return",
"new",
"RequestMeta",
"(",
"\\",
"Psc",
"\\",
"Net",
"\\",
"HTTP",
"\\",
"Request",
"::"... | Zeigt die Tabellen-Übersicht für ein Entity an
@return Psc\CMS\RequestMeta | [
"Zeigt",
"die",
"Tabellen",
"-",
"Übersicht",
"für",
"ein",
"Entity",
"an"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/CMS/EntityMeta.php#L565-L583 |
webforge-labs/psc-cms | lib/Psc/CMS/EntityMeta.php | EntityMeta.getActionRequestMeta | public function getActionRequestMeta($action, Entity $entity = NULL, $method = \Psc\Net\HTTP\Request::GET) {
if (!array_key_exists($action, $this->actionsRequestMeta)) {
$idIsInt = ($identifierType = $this->getIdentifier()->getType()) instanceof IntegerType;
$this->actionsRequestMeta[$action] = new Requ... | php | public function getActionRequestMeta($action, Entity $entity = NULL, $method = \Psc\Net\HTTP\Request::GET) {
if (!array_key_exists($action, $this->actionsRequestMeta)) {
$idIsInt = ($identifierType = $this->getIdentifier()->getType()) instanceof IntegerType;
$this->actionsRequestMeta[$action] = new Requ... | [
"public",
"function",
"getActionRequestMeta",
"(",
"$",
"action",
",",
"Entity",
"$",
"entity",
"=",
"NULL",
",",
"$",
"method",
"=",
"\\",
"Psc",
"\\",
"Net",
"\\",
"HTTP",
"\\",
"Request",
"::",
"GET",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(... | Gibt die Custom-Action zu einem Entity zurück
also sowas wie entities/<entityName>/<identifier>/$action
@return requestMeta | [
"Gibt",
"die",
"Custom",
"-",
"Action",
"zu",
"einem",
"Entity",
"zurück"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/CMS/EntityMeta.php#L592-L607 |
webforge-labs/psc-cms | lib/Psc/CMS/EntityMeta.php | EntityMeta.getNewFormRequestMeta | public function getNewFormRequestMeta($clone = TRUE) {
if (!isset($this->newFormRequestMeta)) {
$this->newFormRequestMeta = new RequestMeta(\Psc\Net\HTTP\Request::GET,
$this->constructUrl(array($this->getEntityNamePlural(), 'form'))
... | php | public function getNewFormRequestMeta($clone = TRUE) {
if (!isset($this->newFormRequestMeta)) {
$this->newFormRequestMeta = new RequestMeta(\Psc\Net\HTTP\Request::GET,
$this->constructUrl(array($this->getEntityNamePlural(), 'form'))
... | [
"public",
"function",
"getNewFormRequestMeta",
"(",
"$",
"clone",
"=",
"TRUE",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"newFormRequestMeta",
")",
")",
"{",
"$",
"this",
"->",
"newFormRequestMeta",
"=",
"new",
"RequestMeta",
"(",
"\\",
... | Zeigt das "Entity erstellen" Formular an
@return Psc\CMS\RequestMeta | [
"Zeigt",
"das",
"Entity",
"erstellen",
"Formular",
"an"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/CMS/EntityMeta.php#L614-L626 |
webforge-labs/psc-cms | lib/Psc/CMS/EntityMeta.php | EntityMeta.getSearchRequestMeta | public function getSearchRequestMeta(Array $query = NULL) {
if (!isset($this->searchRequestMeta)) {
$this->searchRequestMeta = new RequestMeta(\Psc\Net\HTTP\Request::GET,
$this->constructUrl(array($this->getEntityNamePlural(), '%s')),
... | php | public function getSearchRequestMeta(Array $query = NULL) {
if (!isset($this->searchRequestMeta)) {
$this->searchRequestMeta = new RequestMeta(\Psc\Net\HTTP\Request::GET,
$this->constructUrl(array($this->getEntityNamePlural(), '%s')),
... | [
"public",
"function",
"getSearchRequestMeta",
"(",
"Array",
"$",
"query",
"=",
"NULL",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"searchRequestMeta",
")",
")",
"{",
"$",
"this",
"->",
"searchRequestMeta",
"=",
"new",
"RequestMeta",
"(",
... | Request zum Suchen von Entities und zur LowLevel Ausgabe
@return Psc\CMS\RequestMeta | [
"Request",
"zum",
"Suchen",
"von",
"Entities",
"und",
"zur",
"LowLevel",
"Ausgabe"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/CMS/EntityMeta.php#L633-L646 |
webforge-labs/psc-cms | lib/Psc/CMS/Controller/GPCController.php | GPCController.initTodo | public function initTodo() {
$todo = $this->getVar(array('todo'),'GP');
$this->assertTodo($todo);
$this->setTodo($todo);
if (!isset($this->todo))
$this->todo = $this->defaultTodo;
} | php | public function initTodo() {
$todo = $this->getVar(array('todo'),'GP');
$this->assertTodo($todo);
$this->setTodo($todo);
if (!isset($this->todo))
$this->todo = $this->defaultTodo;
} | [
"public",
"function",
"initTodo",
"(",
")",
"{",
"$",
"todo",
"=",
"$",
"this",
"->",
"getVar",
"(",
"array",
"(",
"'todo'",
")",
",",
"'GP'",
")",
";",
"$",
"this",
"->",
"assertTodo",
"(",
"$",
"todo",
")",
";",
"$",
"this",
"->",
"setTodo",
"(... | Initialisiert das Todo des Controllers
der Schlüssel 'todo' muss in $this->vars gesetzt sein, damit ein todo aus der Map genommen wird
ist der Schlüssel gesetzt, aber der Wert nicht in der todoMap wird eine Exception geworfen
ist der Schlüssel nicht gesetzt, wird $this->todo auf $this->defaultTodo gessetzt
$_POST['to... | [
"Initialisiert",
"das",
"Todo",
"des",
"Controllers"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/CMS/Controller/GPCController.php#L52-L59 |
webforge-labs/psc-cms | lib/Psc/CMS/Controller/GPCController.php | GPCController.getVar | public function getVar($keys, $precendence = 'GP') {
/* Performance Tweak */
if ($precendence == 'GP') {
if (($p = $this->post->get($keys, self::RETURN_NULL)) != NULL) return $p;
if (($g = $this->get->get($keys, self::RETURN_NULL)) != NULL) return $g;
}
if ($precendence == 'PG') {
... | php | public function getVar($keys, $precendence = 'GP') {
/* Performance Tweak */
if ($precendence == 'GP') {
if (($p = $this->post->get($keys, self::RETURN_NULL)) != NULL) return $p;
if (($g = $this->get->get($keys, self::RETURN_NULL)) != NULL) return $g;
}
if ($precendence == 'PG') {
... | [
"public",
"function",
"getVar",
"(",
"$",
"keys",
",",
"$",
"precendence",
"=",
"'GP'",
")",
"{",
"/* Performance Tweak */",
"if",
"(",
"$",
"precendence",
"==",
"'GP'",
")",
"{",
"if",
"(",
"(",
"$",
"p",
"=",
"$",
"this",
"->",
"post",
"->",
"get",... | Gibt eine Variable zurück
die Precendence gibt an welche Variable gewinnt, wenn beide definiert sind
@param mixed $keys wenn $keys NULL ist wird angenommen, dass es array($varname) ist
@param array $precendence
@return mixed|NULL gibt NULL zurück wenn die Variable nicht gesetzt, oder nicht gefunden wurde | [
"Gibt",
"eine",
"Variable",
"zurück"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/CMS/Controller/GPCController.php#L70-L96 |
webforge-labs/psc-cms | lib/Psc/CMS/Service/MetadataGenerator.php | MetadataGenerator.entity | public function entity(Entity $entity, Array $linkRelations = array()) {
if (!isset($this->meta['links']))
$this->meta['links'] = array();
foreach ($linkRelations as $linkRelation) {
$this->meta['links'][] = (object) array(
'rel'=>$linkRelation->getName(),
'href'=>$linkRelatio... | php | public function entity(Entity $entity, Array $linkRelations = array()) {
if (!isset($this->meta['links']))
$this->meta['links'] = array();
foreach ($linkRelations as $linkRelation) {
$this->meta['links'][] = (object) array(
'rel'=>$linkRelation->getName(),
'href'=>$linkRelatio... | [
"public",
"function",
"entity",
"(",
"Entity",
"$",
"entity",
",",
"Array",
"$",
"linkRelations",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"meta",
"[",
"'links'",
"]",
")",
")",
"$",
"this",
"->",
"meta",
... | Adds metadata for the reponse from an Entity
@param Psc\Net\Service\LinkRelation[] $linkRelations | [
"Adds",
"metadata",
"for",
"the",
"reponse",
"from",
"an",
"Entity"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/CMS/Service/MetadataGenerator.php#L47-L59 |
phpmob/changmin | src/PhpMob/CoreBundle/OAuth/UserProvider.php | UserProvider.createUserByOAuthUserResponse | private function createUserByOAuthUserResponse(UserResponseInterface $response): WebUserInterface
{
/** @var WebUserInterface $user */
$user = $this->userFactory->createNew();
if (!$canonicalEmail = $this->canonicalizer->canonicalize($response->getEmail())) {
throw new Authoriza... | php | private function createUserByOAuthUserResponse(UserResponseInterface $response): WebUserInterface
{
/** @var WebUserInterface $user */
$user = $this->userFactory->createNew();
if (!$canonicalEmail = $this->canonicalizer->canonicalize($response->getEmail())) {
throw new Authoriza... | [
"private",
"function",
"createUserByOAuthUserResponse",
"(",
"UserResponseInterface",
"$",
"response",
")",
":",
"WebUserInterface",
"{",
"/** @var WebUserInterface $user */",
"$",
"user",
"=",
"$",
"this",
"->",
"userFactory",
"->",
"createNew",
"(",
")",
";",
"if",
... | Ad-hoc creation of user.
@param UserResponseInterface $response
@return WebUserInterface|UserInterface | [
"Ad",
"-",
"hoc",
"creation",
"of",
"user",
"."
] | train | https://github.com/phpmob/changmin/blob/bfebb1561229094d1c138574abab75f2f1d17d66/src/PhpMob/CoreBundle/OAuth/UserProvider.php#L118-L146 |
danrevah/shortify-punit | src/Mock/MockTrait.php | MockTrait.generateResponse | protected static function generateResponse(&$mockResponse, $arguments)
{
self::updateCallCounter($mockResponse);
list($action, $value) = self::extractResponseValues($mockResponse);
if ($action == MockAction::THROWS) {
throw is_object($value) ? $value : new $value;
}
... | php | protected static function generateResponse(&$mockResponse, $arguments)
{
self::updateCallCounter($mockResponse);
list($action, $value) = self::extractResponseValues($mockResponse);
if ($action == MockAction::THROWS) {
throw is_object($value) ? $value : new $value;
}
... | [
"protected",
"static",
"function",
"generateResponse",
"(",
"&",
"$",
"mockResponse",
",",
"$",
"arguments",
")",
"{",
"self",
"::",
"updateCallCounter",
"(",
"$",
"mockResponse",
")",
";",
"list",
"(",
"$",
"action",
",",
"$",
"value",
")",
"=",
"self",
... | Creating response by response options (Return/Throw/Callback)
@param $mockResponse
@param $arguments
@return mixed | [
"Creating",
"response",
"by",
"response",
"options",
"(",
"Return",
"/",
"Throw",
"/",
"Callback",
")"
] | train | https://github.com/danrevah/shortify-punit/blob/cedd08f31de8e7409a07d2630701ef4e924cc5f0/src/Mock/MockTrait.php#L179-L193 |
xtcommerce/shop-appstore-lib | src/XTCommerce/ShopAppstoreLib/Logger.php | Logger.log | public function log($level, $message, array $context = array())
{
if(defined("XTCOMMERCE_DEBUG")) {
$status = XTCOMMERCE_DEBUG;
}else{
$status = false;
}
if($level == LogLevel::DEBUG){
if(!in_array($level, array(
LogLevel::ERROR,
... | php | public function log($level, $message, array $context = array())
{
if(defined("XTCOMMERCE_DEBUG")) {
$status = XTCOMMERCE_DEBUG;
}else{
$status = false;
}
if($level == LogLevel::DEBUG){
if(!in_array($level, array(
LogLevel::ERROR,
... | [
"public",
"function",
"log",
"(",
"$",
"level",
",",
"$",
"message",
",",
"array",
"$",
"context",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"defined",
"(",
"\"XTCOMMERCE_DEBUG\"",
")",
")",
"{",
"$",
"status",
"=",
"XTCOMMERCE_DEBUG",
";",
"}",
"... | {@inheritDoc} | [
"{"
] | train | https://github.com/xtcommerce/shop-appstore-lib/blob/b12637502f74e8d1288cf47817e4c02b7f507c3b/src/XTCommerce/ShopAppstoreLib/Logger.php#L12-L41 |
hametuha/gapiwp | src/Hametuha/GapiWP/Service/Analytics.php | Analytics.admin_menu | public function admin_menu(){
$title = __('Google Analytics設定', 'gapiwp');
$menu = __('Analytics設定', 'gapiwp');
add_options_page($title, $menu, 'manage_options', 'gapiwp-analytics', array($this, 'admin_render'));
} | php | public function admin_menu(){
$title = __('Google Analytics設定', 'gapiwp');
$menu = __('Analytics設定', 'gapiwp');
add_options_page($title, $menu, 'manage_options', 'gapiwp-analytics', array($this, 'admin_render'));
} | [
"public",
"function",
"admin_menu",
"(",
")",
"{",
"$",
"title",
"=",
"__",
"(",
"'Google Analytics設定', 'g",
"a",
"iwp');",
"",
"",
"$",
"menu",
"=",
"__",
"(",
"'Analytics設定', 'g",
"a",
"iwp');",
"",
"",
"add_options_page",
"(",
"$",
"title",
",",
"$",
... | Register admin screen | [
"Register",
"admin",
"screen"
] | train | https://github.com/hametuha/gapiwp/blob/7b9716d0ebd54c4ab79cca94a4c5aef099a54266/src/Hametuha/GapiWP/Service/Analytics.php#L52-L56 |
hametuha/gapiwp | src/Hametuha/GapiWP/Service/Analytics.php | Analytics.admin_init | public function admin_init(){
if( !defined('DOING_AJAX') || !DOING_AJAX ){
if( 'gapiwp-analytics' == $this->input->get('page') ){
// Load assets
$css = $this->asset_url.'/css/admin-analytics.css';
$css_path = $this->base_dir.'/assets/css/admin-analytics.css';
add_action('admin_enqueue_scripts', fun... | php | public function admin_init(){
if( !defined('DOING_AJAX') || !DOING_AJAX ){
if( 'gapiwp-analytics' == $this->input->get('page') ){
// Load assets
$css = $this->asset_url.'/css/admin-analytics.css';
$css_path = $this->base_dir.'/assets/css/admin-analytics.css';
add_action('admin_enqueue_scripts', fun... | [
"public",
"function",
"admin_init",
"(",
")",
"{",
"if",
"(",
"!",
"defined",
"(",
"'DOING_AJAX'",
")",
"||",
"!",
"DOING_AJAX",
")",
"{",
"if",
"(",
"'gapiwp-analytics'",
"==",
"$",
"this",
"->",
"input",
"->",
"get",
"(",
"'page'",
")",
")",
"{",
"... | Parse Token | [
"Parse",
"Token"
] | train | https://github.com/hametuha/gapiwp/blob/7b9716d0ebd54c4ab79cca94a4c5aef099a54266/src/Hametuha/GapiWP/Service/Analytics.php#L62-L112 |
hametuha/gapiwp | src/Hametuha/GapiWP/Service/Analytics.php | Analytics.get_accounts | public function get_accounts(){
static $ga_accounts = null;
if( !is_null($ga_accounts) ){
return $ga_accounts;
}
$ga_accounts = array();
if( $this->ga ){
try{
$accounts = $this->ga->management_accounts->listManagementAccounts();
if( count($accounts->getItems()) > 0 ){
$ga_accounts = $accoun... | php | public function get_accounts(){
static $ga_accounts = null;
if( !is_null($ga_accounts) ){
return $ga_accounts;
}
$ga_accounts = array();
if( $this->ga ){
try{
$accounts = $this->ga->management_accounts->listManagementAccounts();
if( count($accounts->getItems()) > 0 ){
$ga_accounts = $accoun... | [
"public",
"function",
"get_accounts",
"(",
")",
"{",
"static",
"$",
"ga_accounts",
"=",
"null",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"ga_accounts",
")",
")",
"{",
"return",
"$",
"ga_accounts",
";",
"}",
"$",
"ga_accounts",
"=",
"array",
"(",
")",
... | Get account list
@return array|\Google_Service_Analytics_Accounts | [
"Get",
"account",
"list"
] | train | https://github.com/hametuha/gapiwp/blob/7b9716d0ebd54c4ab79cca94a4c5aef099a54266/src/Hametuha/GapiWP/Service/Analytics.php#L127-L145 |
hametuha/gapiwp | src/Hametuha/GapiWP/Service/Analytics.php | Analytics.get_properties | public function get_properties($account_id) {
$result = array();
try {
if ( $this->ga ) {
$properties = $this->ga
->management_webproperties
->listManagementWebproperties( $account_id );
$result = $properties->getItems();
}
} catch ( \Exception $e ) {
// Do nothing.
error_log($e-... | php | public function get_properties($account_id) {
$result = array();
try {
if ( $this->ga ) {
$properties = $this->ga
->management_webproperties
->listManagementWebproperties( $account_id );
$result = $properties->getItems();
}
} catch ( \Exception $e ) {
// Do nothing.
error_log($e-... | [
"public",
"function",
"get_properties",
"(",
"$",
"account_id",
")",
"{",
"$",
"result",
"=",
"array",
"(",
")",
";",
"try",
"{",
"if",
"(",
"$",
"this",
"->",
"ga",
")",
"{",
"$",
"properties",
"=",
"$",
"this",
"->",
"ga",
"->",
"management_webprop... | Get Web Properties
@param $account_id
@return array | [
"Get",
"Web",
"Properties"
] | train | https://github.com/hametuha/gapiwp/blob/7b9716d0ebd54c4ab79cca94a4c5aef099a54266/src/Hametuha/GapiWP/Service/Analytics.php#L153-L167 |
hametuha/gapiwp | src/Hametuha/GapiWP/Service/Analytics.php | Analytics.get_views | public function get_views($account_id, $profile_id){
$result = array();
try{
$views = $this->ga
->management_profiles
->listManagementProfiles($account_id, $profile_id);
$result =$views->getItems();
}catch ( \Exception $e ){
// Do nothing.
error_log($e... | php | public function get_views($account_id, $profile_id){
$result = array();
try{
$views = $this->ga
->management_profiles
->listManagementProfiles($account_id, $profile_id);
$result =$views->getItems();
}catch ( \Exception $e ){
// Do nothing.
error_log($e... | [
"public",
"function",
"get_views",
"(",
"$",
"account_id",
",",
"$",
"profile_id",
")",
"{",
"$",
"result",
"=",
"array",
"(",
")",
";",
"try",
"{",
"$",
"views",
"=",
"$",
"this",
"->",
"ga",
"->",
"management_profiles",
"->",
"listManagementProfiles",
... | Get Views
@param $account_id
@param $profile_id
@return array | [
"Get",
"Views"
] | train | https://github.com/hametuha/gapiwp/blob/7b9716d0ebd54c4ab79cca94a4c5aef099a54266/src/Hametuha/GapiWP/Service/Analytics.php#L176-L188 |
hametuha/gapiwp | src/Hametuha/GapiWP/Service/Analytics.php | Analytics.fetch | public function fetch($from, $to, $metrics, array $args, $view_id = null ){
if( !$this->ga ){
return new \WP_Error(500, __('Google Analtyisとの連携が完了していません。', 'gapiwp'));
}
if( is_null($view_id) ){
$view_id = $this->view_id;
}
try{
$result = $this->ga->data_ga->get('ga:'.$view_id, $from, $to, $metrics, ... | php | public function fetch($from, $to, $metrics, array $args, $view_id = null ){
if( !$this->ga ){
return new \WP_Error(500, __('Google Analtyisとの連携が完了していません。', 'gapiwp'));
}
if( is_null($view_id) ){
$view_id = $this->view_id;
}
try{
$result = $this->ga->data_ga->get('ga:'.$view_id, $from, $to, $metrics, ... | [
"public",
"function",
"fetch",
"(",
"$",
"from",
",",
"$",
"to",
",",
"$",
"metrics",
",",
"array",
"$",
"args",
",",
"$",
"view_id",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"ga",
")",
"{",
"return",
"new",
"\\",
"WP_Error",
"... | Fetch data
@param string $from
@param string $to
@param string $metrics
@param array $args
@return \Google_Service_Analytics_GaData|\WP_Error | [
"Fetch",
"data"
] | train | https://github.com/hametuha/gapiwp/blob/7b9716d0ebd54c4ab79cca94a4c5aef099a54266/src/Hametuha/GapiWP/Service/Analytics.php#L200-L213 |
fond-of/spryker-brand | src/FondOfSpryker/Zed/Brand/Business/Brand/Brand.php | Brand.add | public function add(BrandTransfer $brandTransfer): BrandResponseTransfer
{
$brandEntity = $this->createFosBrandEntity($brandTransfer);
$brandEntity->save();
$brandTransfer->setIdBrand($brandEntity->getPrimaryKey());
$brandResponseTransfer = new BrandResponseTransfer();
$bra... | php | public function add(BrandTransfer $brandTransfer): BrandResponseTransfer
{
$brandEntity = $this->createFosBrandEntity($brandTransfer);
$brandEntity->save();
$brandTransfer->setIdBrand($brandEntity->getPrimaryKey());
$brandResponseTransfer = new BrandResponseTransfer();
$bra... | [
"public",
"function",
"add",
"(",
"BrandTransfer",
"$",
"brandTransfer",
")",
":",
"BrandResponseTransfer",
"{",
"$",
"brandEntity",
"=",
"$",
"this",
"->",
"createFosBrandEntity",
"(",
"$",
"brandTransfer",
")",
";",
"$",
"brandEntity",
"->",
"save",
"(",
")"... | @param \Generated\Shared\Transfer\BrandTransfer $brandTransfer
@return \Generated\Shared\Transfer\BrandResponseTransfer | [
"@param",
"\\",
"Generated",
"\\",
"Shared",
"\\",
"Transfer",
"\\",
"BrandTransfer",
"$brandTransfer"
] | train | https://github.com/fond-of/spryker-brand/blob/0ae25c381649b70845016606de9cf4e7dfdccffa/src/FondOfSpryker/Zed/Brand/Business/Brand/Brand.php#L50-L63 |
fond-of/spryker-brand | src/FondOfSpryker/Zed/Brand/Business/Brand/Brand.php | Brand.createFosBrandEntity | protected function createFosBrandEntity(BrandTransfer $brandTransfer): FosBrand
{
$brandEntity = new FosBrand();
$brandEntity->fromArray($brandTransfer->toArray());
return $brandEntity;
} | php | protected function createFosBrandEntity(BrandTransfer $brandTransfer): FosBrand
{
$brandEntity = new FosBrand();
$brandEntity->fromArray($brandTransfer->toArray());
return $brandEntity;
} | [
"protected",
"function",
"createFosBrandEntity",
"(",
"BrandTransfer",
"$",
"brandTransfer",
")",
":",
"FosBrand",
"{",
"$",
"brandEntity",
"=",
"new",
"FosBrand",
"(",
")",
";",
"$",
"brandEntity",
"->",
"fromArray",
"(",
"$",
"brandTransfer",
"->",
"toArray",
... | @param \Generated\Shared\Transfer\BrandTransfer $brandTransfer
@return \Orm\Zed\Brand\Persistence\FosBrand | [
"@param",
"\\",
"Generated",
"\\",
"Shared",
"\\",
"Transfer",
"\\",
"BrandTransfer",
"$brandTransfer"
] | train | https://github.com/fond-of/spryker-brand/blob/0ae25c381649b70845016606de9cf4e7dfdccffa/src/FondOfSpryker/Zed/Brand/Business/Brand/Brand.php#L70-L76 |
fond-of/spryker-brand | src/FondOfSpryker/Zed/Brand/Business/Brand/Brand.php | Brand.createBrandResponseTransfer | protected function createBrandResponseTransfer($isSuccess = true): BrandResponseTransfer
{
$brandResponseTransfer = new BrandResponseTransfer();
$brandResponseTransfer->setIsSuccess($isSuccess);
return $brandResponseTransfer;
} | php | protected function createBrandResponseTransfer($isSuccess = true): BrandResponseTransfer
{
$brandResponseTransfer = new BrandResponseTransfer();
$brandResponseTransfer->setIsSuccess($isSuccess);
return $brandResponseTransfer;
} | [
"protected",
"function",
"createBrandResponseTransfer",
"(",
"$",
"isSuccess",
"=",
"true",
")",
":",
"BrandResponseTransfer",
"{",
"$",
"brandResponseTransfer",
"=",
"new",
"BrandResponseTransfer",
"(",
")",
";",
"$",
"brandResponseTransfer",
"->",
"setIsSuccess",
"(... | @param bool $isSuccess
@return \Generated\Shared\Transfer\BrandResponseTransfer | [
"@param",
"bool",
"$isSuccess"
] | train | https://github.com/fond-of/spryker-brand/blob/0ae25c381649b70845016606de9cf4e7dfdccffa/src/FondOfSpryker/Zed/Brand/Business/Brand/Brand.php#L83-L89 |
fond-of/spryker-brand | src/FondOfSpryker/Zed/Brand/Business/Brand/Brand.php | Brand.delete | public function delete(BrandTransfer $brandTransfer): bool
{
$brandEntity = $this->getBrand($brandTransfer);
$brandEntity->delete();
return true;
} | php | public function delete(BrandTransfer $brandTransfer): bool
{
$brandEntity = $this->getBrand($brandTransfer);
$brandEntity->delete();
return true;
} | [
"public",
"function",
"delete",
"(",
"BrandTransfer",
"$",
"brandTransfer",
")",
":",
"bool",
"{",
"$",
"brandEntity",
"=",
"$",
"this",
"->",
"getBrand",
"(",
"$",
"brandTransfer",
")",
";",
"$",
"brandEntity",
"->",
"delete",
"(",
")",
";",
"return",
"... | @param \Generated\Shared\Transfer\BrandTransfer $brandTransfer
@return bool | [
"@param",
"\\",
"Generated",
"\\",
"Shared",
"\\",
"Transfer",
"\\",
"BrandTransfer",
"$brandTransfer"
] | train | https://github.com/fond-of/spryker-brand/blob/0ae25c381649b70845016606de9cf4e7dfdccffa/src/FondOfSpryker/Zed/Brand/Business/Brand/Brand.php#L96-L102 |
fond-of/spryker-brand | src/FondOfSpryker/Zed/Brand/Business/Brand/Brand.php | Brand.get | public function get(BrandTransfer $brandTransfer): BrandTransfer
{
$brandEntity = $this->getBrand($brandTransfer);
$brandTransfer->fromArray($brandEntity->toArray(), true);
$brandTransfer = $this->brandExpander->expand($brandTransfer);
return $brandTransfer;
} | php | public function get(BrandTransfer $brandTransfer): BrandTransfer
{
$brandEntity = $this->getBrand($brandTransfer);
$brandTransfer->fromArray($brandEntity->toArray(), true);
$brandTransfer = $this->brandExpander->expand($brandTransfer);
return $brandTransfer;
} | [
"public",
"function",
"get",
"(",
"BrandTransfer",
"$",
"brandTransfer",
")",
":",
"BrandTransfer",
"{",
"$",
"brandEntity",
"=",
"$",
"this",
"->",
"getBrand",
"(",
"$",
"brandTransfer",
")",
";",
"$",
"brandTransfer",
"->",
"fromArray",
"(",
"$",
"brandEnt... | @param \Generated\Shared\Transfer\BrandTransfer $brandTransfer
@return \Generated\Shared\Transfer\BrandTransfer | [
"@param",
"\\",
"Generated",
"\\",
"Shared",
"\\",
"Transfer",
"\\",
"BrandTransfer",
"$brandTransfer"
] | train | https://github.com/fond-of/spryker-brand/blob/0ae25c381649b70845016606de9cf4e7dfdccffa/src/FondOfSpryker/Zed/Brand/Business/Brand/Brand.php#L109-L116 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.