repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1
value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
horntell/php-sdk | lib/guzzle/GuzzleHttp/QueryParser.php | QueryParser.parseInto | public function parseInto(Query $query, $str, $urlEncoding = true)
{
if ($str === '') {
return;
}
$result = [];
$this->duplicates = false;
$this->numericIndices = true;
$decoder = self::getDecoder($urlEncoding);
foreach (explode('&', $str) as $kv... | php | public function parseInto(Query $query, $str, $urlEncoding = true)
{
if ($str === '') {
return;
}
$result = [];
$this->duplicates = false;
$this->numericIndices = true;
$decoder = self::getDecoder($urlEncoding);
foreach (explode('&', $str) as $kv... | [
"public",
"function",
"parseInto",
"(",
"Query",
"$",
"query",
",",
"$",
"str",
",",
"$",
"urlEncoding",
"=",
"true",
")",
"{",
"if",
"(",
"$",
"str",
"===",
"''",
")",
"{",
"return",
";",
"}",
"$",
"result",
"=",
"[",
"]",
";",
"$",
"this",
"-... | Parse a query string into a Query object.
@param Query $query Query object to populate
@param string $str Query string to parse
@param bool|string $urlEncoding How the query string is encoded | [
"Parse",
"a",
"query",
"string",
"into",
"a",
"Query",
"object",
"."
] | e5205e9396a21b754d5651a8aa5898da5922a1b7 | https://github.com/horntell/php-sdk/blob/e5205e9396a21b754d5651a8aa5898da5922a1b7/lib/guzzle/GuzzleHttp/QueryParser.php#L26-L67 | train |
horntell/php-sdk | lib/guzzle/GuzzleHttp/QueryParser.php | QueryParser.getDecoder | private static function getDecoder($type)
{
if ($type === true) {
return function ($value) {
return rawurldecode(str_replace('+', ' ', $value));
};
} elseif ($type == Query::RFC3986) {
return 'rawurldecode';
} elseif ($type == Query::RFC173... | php | private static function getDecoder($type)
{
if ($type === true) {
return function ($value) {
return rawurldecode(str_replace('+', ' ', $value));
};
} elseif ($type == Query::RFC3986) {
return 'rawurldecode';
} elseif ($type == Query::RFC173... | [
"private",
"static",
"function",
"getDecoder",
"(",
"$",
"type",
")",
"{",
"if",
"(",
"$",
"type",
"===",
"true",
")",
"{",
"return",
"function",
"(",
"$",
"value",
")",
"{",
"return",
"rawurldecode",
"(",
"str_replace",
"(",
"'+'",
",",
"' '",
",",
... | Returns a callable that is used to URL decode query keys and values.
@param string|bool $type One of true, false, RFC3986, and RFC1738
@return callable|string | [
"Returns",
"a",
"callable",
"that",
"is",
"used",
"to",
"URL",
"decode",
"query",
"keys",
"and",
"values",
"."
] | e5205e9396a21b754d5651a8aa5898da5922a1b7 | https://github.com/horntell/php-sdk/blob/e5205e9396a21b754d5651a8aa5898da5922a1b7/lib/guzzle/GuzzleHttp/QueryParser.php#L76-L89 | train |
horntell/php-sdk | lib/guzzle/GuzzleHttp/QueryParser.php | QueryParser.parsePhpValue | private function parsePhpValue($key, $value, array &$result)
{
$node =& $result;
$keyBuffer = '';
for ($i = 0, $t = strlen($key); $i < $t; $i++) {
switch ($key[$i]) {
case '[':
if ($keyBuffer) {
$this->prepareNode($node... | php | private function parsePhpValue($key, $value, array &$result)
{
$node =& $result;
$keyBuffer = '';
for ($i = 0, $t = strlen($key); $i < $t; $i++) {
switch ($key[$i]) {
case '[':
if ($keyBuffer) {
$this->prepareNode($node... | [
"private",
"function",
"parsePhpValue",
"(",
"$",
"key",
",",
"$",
"value",
",",
"array",
"&",
"$",
"result",
")",
"{",
"$",
"node",
"=",
"&",
"$",
"result",
";",
"$",
"keyBuffer",
"=",
"''",
";",
"for",
"(",
"$",
"i",
"=",
"0",
",",
"$",
"t",
... | Parses a PHP style key value pair.
@param string $key Key to parse (e.g., "foo[a][b]")
@param string|null $value Value to set
@param array $result Result to modify by reference | [
"Parses",
"a",
"PHP",
"style",
"key",
"value",
"pair",
"."
] | e5205e9396a21b754d5651a8aa5898da5922a1b7 | https://github.com/horntell/php-sdk/blob/e5205e9396a21b754d5651a8aa5898da5922a1b7/lib/guzzle/GuzzleHttp/QueryParser.php#L98-L130 | train |
horntell/php-sdk | lib/guzzle/GuzzleHttp/QueryParser.php | QueryParser.prepareNode | private function prepareNode(&$node, $key)
{
if (!isset($node[$key])) {
$node[$key] = null;
} elseif (!is_array($node[$key])) {
$node[$key] = [$node[$key]];
}
} | php | private function prepareNode(&$node, $key)
{
if (!isset($node[$key])) {
$node[$key] = null;
} elseif (!is_array($node[$key])) {
$node[$key] = [$node[$key]];
}
} | [
"private",
"function",
"prepareNode",
"(",
"&",
"$",
"node",
",",
"$",
"key",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"node",
"[",
"$",
"key",
"]",
")",
")",
"{",
"$",
"node",
"[",
"$",
"key",
"]",
"=",
"null",
";",
"}",
"elseif",
"(",
... | Prepares a value in the array at the given key.
If the key already exists, the key value is converted into an array.
@param array $node Result node to modify
@param string $key Key to add or modify in the node | [
"Prepares",
"a",
"value",
"in",
"the",
"array",
"at",
"the",
"given",
"key",
"."
] | e5205e9396a21b754d5651a8aa5898da5922a1b7 | https://github.com/horntell/php-sdk/blob/e5205e9396a21b754d5651a8aa5898da5922a1b7/lib/guzzle/GuzzleHttp/QueryParser.php#L140-L147 | train |
horntell/php-sdk | lib/guzzle/GuzzleHttp/QueryParser.php | QueryParser.cleanKey | private function cleanKey($node, $key)
{
if ($key === '') {
$key = $node ? (string) count($node) : 0;
// Found a [] key, so track this to ensure that we disable numeric
// indexing of keys in the resolved query aggregator.
$this->numericIndices = false;
... | php | private function cleanKey($node, $key)
{
if ($key === '') {
$key = $node ? (string) count($node) : 0;
// Found a [] key, so track this to ensure that we disable numeric
// indexing of keys in the resolved query aggregator.
$this->numericIndices = false;
... | [
"private",
"function",
"cleanKey",
"(",
"$",
"node",
",",
"$",
"key",
")",
"{",
"if",
"(",
"$",
"key",
"===",
"''",
")",
"{",
"$",
"key",
"=",
"$",
"node",
"?",
"(",
"string",
")",
"count",
"(",
"$",
"node",
")",
":",
"0",
";",
"// Found a [] k... | Returns the appropriate key based on the node and key. | [
"Returns",
"the",
"appropriate",
"key",
"based",
"on",
"the",
"node",
"and",
"key",
"."
] | e5205e9396a21b754d5651a8aa5898da5922a1b7 | https://github.com/horntell/php-sdk/blob/e5205e9396a21b754d5651a8aa5898da5922a1b7/lib/guzzle/GuzzleHttp/QueryParser.php#L152-L162 | train |
zhaoxianfang/tools | src/Symfony/Component/Config/Definition/Builder/NodeBuilder.php | NodeBuilder.append | public function append(NodeDefinition $node)
{
if ($node instanceof ParentNodeDefinitionInterface) {
$builder = clone $this;
$builder->setParent(null);
$node->setBuilder($builder);
}
if (null !== $this->parent) {
$this->parent->append($node);
... | php | public function append(NodeDefinition $node)
{
if ($node instanceof ParentNodeDefinitionInterface) {
$builder = clone $this;
$builder->setParent(null);
$node->setBuilder($builder);
}
if (null !== $this->parent) {
$this->parent->append($node);
... | [
"public",
"function",
"append",
"(",
"NodeDefinition",
"$",
"node",
")",
"{",
"if",
"(",
"$",
"node",
"instanceof",
"ParentNodeDefinitionInterface",
")",
"{",
"$",
"builder",
"=",
"clone",
"$",
"this",
";",
"$",
"builder",
"->",
"setParent",
"(",
"null",
"... | Appends a node definition.
Usage:
$node = new ArrayNodeDefinition('name')
->children()
->scalarNode('foo')->end()
->scalarNode('baz')->end()
->append($this->getBarNodeDefinition())
->end()
;
@return $this | [
"Appends",
"a",
"node",
"definition",
"."
] | d8fc8a9ecd75b5ce4236f0a2e9fdc055108573e7 | https://github.com/zhaoxianfang/tools/blob/d8fc8a9ecd75b5ce4236f0a2e9fdc055108573e7/src/Symfony/Component/Config/Definition/Builder/NodeBuilder.php#L180-L195 | train |
anime-db/catalog-bundle | src/Form/Type/Entity/Item.php | Item.getRefillAttr | protected function getRefillAttr($field, ItemEntity $item = null)
{
// item exists and can be refilled
if ($item instanceof ItemEntity && $item->getName() &&
($plugins = $this->chain->getPluginsThatCanFillItem($item, $field))
) {
/* @var $plugin RefillerInterface */
... | php | protected function getRefillAttr($field, ItemEntity $item = null)
{
// item exists and can be refilled
if ($item instanceof ItemEntity && $item->getName() &&
($plugins = $this->chain->getPluginsThatCanFillItem($item, $field))
) {
/* @var $plugin RefillerInterface */
... | [
"protected",
"function",
"getRefillAttr",
"(",
"$",
"field",
",",
"ItemEntity",
"$",
"item",
"=",
"null",
")",
"{",
"// item exists and can be refilled",
"if",
"(",
"$",
"item",
"instanceof",
"ItemEntity",
"&&",
"$",
"item",
"->",
"getName",
"(",
")",
"&&",
... | Get the field refill attributes.
@param string $field
@param ItemEntity|null $item
@return array | [
"Get",
"the",
"field",
"refill",
"attributes",
"."
] | 631b6f92a654e91bee84f46218c52cf42bdb8606 | https://github.com/anime-db/catalog-bundle/blob/631b6f92a654e91bee84f46218c52cf42bdb8606/src/Form/Type/Entity/Item.php#L259-L288 | train |
romm/configuration_object | Classes/Validation/Validator/IconExistsValidator.php | IconExistsValidator.isValid | public function isValid($value)
{
if (version_compare(VersionNumberUtility::getCurrentTypo3Version(), '7.6.0', '<')) {
throw new UnsupportedVersionException(
'The validator "' . self::class . '" cannot be used in TYPO3 versions anterior to `7.6.0`.',
1506281412
... | php | public function isValid($value)
{
if (version_compare(VersionNumberUtility::getCurrentTypo3Version(), '7.6.0', '<')) {
throw new UnsupportedVersionException(
'The validator "' . self::class . '" cannot be used in TYPO3 versions anterior to `7.6.0`.',
1506281412
... | [
"public",
"function",
"isValid",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"version_compare",
"(",
"VersionNumberUtility",
"::",
"getCurrentTypo3Version",
"(",
")",
",",
"'7.6.0'",
",",
"'<'",
")",
")",
"{",
"throw",
"new",
"UnsupportedVersionException",
"(",
"'... | Checks that the given icon identifier exists in the TYPO3 icon registry.
@param mixed $value
@throws UnsupportedVersionException | [
"Checks",
"that",
"the",
"given",
"icon",
"identifier",
"exists",
"in",
"the",
"TYPO3",
"icon",
"registry",
"."
] | d3a40903386c2e0766bd8279337fe6da45cf5ce3 | https://github.com/romm/configuration_object/blob/d3a40903386c2e0766bd8279337fe6da45cf5ce3/Classes/Validation/Validator/IconExistsValidator.php#L30-L45 | train |
ekyna/MediaBundle | Controller/MediaController.php | MediaController.findMedia | private function findMedia($path)
{
/** @var \Ekyna\Bundle\MediaBundle\Model\MediaInterface $media */
$media = $this
->get('ekyna_media.media.repository')
->findOneBy(['path' => $path])
;
if (null === $media) {
throw new NotFoundHttpException('Medi... | php | private function findMedia($path)
{
/** @var \Ekyna\Bundle\MediaBundle\Model\MediaInterface $media */
$media = $this
->get('ekyna_media.media.repository')
->findOneBy(['path' => $path])
;
if (null === $media) {
throw new NotFoundHttpException('Medi... | [
"private",
"function",
"findMedia",
"(",
"$",
"path",
")",
"{",
"/** @var \\Ekyna\\Bundle\\MediaBundle\\Model\\MediaInterface $media */",
"$",
"media",
"=",
"$",
"this",
"->",
"get",
"(",
"'ekyna_media.media.repository'",
")",
"->",
"findOneBy",
"(",
"[",
"'path'",
"=... | Finds the media by his path.
@param string $path
@return array
@throws NotFoundHttpException | [
"Finds",
"the",
"media",
"by",
"his",
"path",
"."
] | 512cf86c801a130a9f17eba8b48d646d23acdbab | https://github.com/ekyna/MediaBundle/blob/512cf86c801a130a9f17eba8b48d646d23acdbab/Controller/MediaController.php#L123-L141 | train |
lightwerk/SurfCaptain | Classes/Lightwerk/SurfCaptain/Package.php | Package.boot | public function boot(\TYPO3\Flow\Core\Bootstrap $bootstrap)
{
$dispatcher = $bootstrap->getSignalSlotDispatcher();
$dispatcher->connect(
'Lightwerk\SurfCaptain\GitApi\ApiRequest',
'apiCall',
'Lightwerk\SurfCaptain\GitApi\RequestListener',
'saveApiCall'... | php | public function boot(\TYPO3\Flow\Core\Bootstrap $bootstrap)
{
$dispatcher = $bootstrap->getSignalSlotDispatcher();
$dispatcher->connect(
'Lightwerk\SurfCaptain\GitApi\ApiRequest',
'apiCall',
'Lightwerk\SurfCaptain\GitApi\RequestListener',
'saveApiCall'... | [
"public",
"function",
"boot",
"(",
"\\",
"TYPO3",
"\\",
"Flow",
"\\",
"Core",
"\\",
"Bootstrap",
"$",
"bootstrap",
")",
"{",
"$",
"dispatcher",
"=",
"$",
"bootstrap",
"->",
"getSignalSlotDispatcher",
"(",
")",
";",
"$",
"dispatcher",
"->",
"connect",
"(",
... | Boot the package. We wire some signals to slots here.
@param \TYPO3\Flow\Core\Bootstrap $bootstrap The current bootstrap
@return void | [
"Boot",
"the",
"package",
".",
"We",
"wire",
"some",
"signals",
"to",
"slots",
"here",
"."
] | 2865e963fd634504d8923902cf422873749a0940 | https://github.com/lightwerk/SurfCaptain/blob/2865e963fd634504d8923902cf422873749a0940/Classes/Lightwerk/SurfCaptain/Package.php#L24-L45 | train |
TeknooSoftware/east-foundation | src/symfony/Listener/KernelListener.php | KernelListener.getPsrRequest | private function getPsrRequest(Request $symfonyRequest): ServerRequestInterface
{
$psrRequest = $this->diactorosFactory->createRequest($symfonyRequest);
$psrRequest = $psrRequest->withAttribute('request', $symfonyRequest);
return $psrRequest;
} | php | private function getPsrRequest(Request $symfonyRequest): ServerRequestInterface
{
$psrRequest = $this->diactorosFactory->createRequest($symfonyRequest);
$psrRequest = $psrRequest->withAttribute('request', $symfonyRequest);
return $psrRequest;
} | [
"private",
"function",
"getPsrRequest",
"(",
"Request",
"$",
"symfonyRequest",
")",
":",
"ServerRequestInterface",
"{",
"$",
"psrRequest",
"=",
"$",
"this",
"->",
"diactorosFactory",
"->",
"createRequest",
"(",
"$",
"symfonyRequest",
")",
";",
"$",
"psrRequest",
... | To transform a symfony request as a psr request and inject the symfony request as attribute if the endpoint need
the symfony request.
@param Request $symfonyRequest
@return ServerRequestInterface | [
"To",
"transform",
"a",
"symfony",
"request",
"as",
"a",
"psr",
"request",
"and",
"inject",
"the",
"symfony",
"request",
"as",
"attribute",
"if",
"the",
"endpoint",
"need",
"the",
"symfony",
"request",
"."
] | 45ca97c83ba08b973877a472c731f27ca1e82cdf | https://github.com/TeknooSoftware/east-foundation/blob/45ca97c83ba08b973877a472c731f27ca1e82cdf/src/symfony/Listener/KernelListener.php#L88-L94 | train |
wb-crowdfusion/crowdfusion | system/core/classes/mvc/deployment/AbstractFileDeploymentService.php | AbstractFileDeploymentService.deploy | public function deploy()
{
if (empty($this->context) || empty($this->siteDomain) || empty($this->deviceView) || empty($this->design))
return;
$files = null;
$md5 = null;
$contents = null;
$aggregatePath = $this->getAggregatePath();
$this->Logger->debug(... | php | public function deploy()
{
if (empty($this->context) || empty($this->siteDomain) || empty($this->deviceView) || empty($this->design))
return;
$files = null;
$md5 = null;
$contents = null;
$aggregatePath = $this->getAggregatePath();
$this->Logger->debug(... | [
"public",
"function",
"deploy",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"context",
")",
"||",
"empty",
"(",
"$",
"this",
"->",
"siteDomain",
")",
"||",
"empty",
"(",
"$",
"this",
"->",
"deviceView",
")",
"||",
"empty",
"(",
"$",
... | Aggregates the files if necessary.
@return void | [
"Aggregates",
"the",
"files",
"if",
"necessary",
"."
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/mvc/deployment/AbstractFileDeploymentService.php#L47-L85 | train |
wb-crowdfusion/crowdfusion | system/core/classes/mvc/deployment/AbstractFileDeploymentService.php | AbstractFileDeploymentService.resolveFile | public function resolveFile($name)
{
$resolvedFilename = $this->getBaseDeployDirectory().$this->subject.'/'.ltrim($name, '/');
return new StorageFacilityFile('/'.ltrim($name, '/'), $resolvedFilename);
} | php | public function resolveFile($name)
{
$resolvedFilename = $this->getBaseDeployDirectory().$this->subject.'/'.ltrim($name, '/');
return new StorageFacilityFile('/'.ltrim($name, '/'), $resolvedFilename);
} | [
"public",
"function",
"resolveFile",
"(",
"$",
"name",
")",
"{",
"$",
"resolvedFilename",
"=",
"$",
"this",
"->",
"getBaseDeployDirectory",
"(",
")",
".",
"$",
"this",
"->",
"subject",
".",
"'/'",
".",
"ltrim",
"(",
"$",
"name",
",",
"'/'",
")",
";",
... | Returns the full filename of an existing deployed file with the name specified.
If the file does not exist, it returns null.
@param string $name The filename to expand (full path)
@return StorageFacilityFile | [
"Returns",
"the",
"full",
"filename",
"of",
"an",
"existing",
"deployed",
"file",
"with",
"the",
"name",
"specified",
"."
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/mvc/deployment/AbstractFileDeploymentService.php#L208-L212 | train |
wb-crowdfusion/crowdfusion | system/core/classes/mvc/deployment/AbstractFileDeploymentService.php | AbstractFileDeploymentService.getFiles | protected function getFiles()
{
if ($this->isSiteDeployment) {
if ($this->deviceView != 'main' && !is_dir("{$this->viewDirectory}/{$this->context}/{$this->siteDomain}/{$this->deviceView}")) {
$this->deviceView = 'main';
}
if ($this->design != 'default' &&... | php | protected function getFiles()
{
if ($this->isSiteDeployment) {
if ($this->deviceView != 'main' && !is_dir("{$this->viewDirectory}/{$this->context}/{$this->siteDomain}/{$this->deviceView}")) {
$this->deviceView = 'main';
}
if ($this->design != 'default' &&... | [
"protected",
"function",
"getFiles",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isSiteDeployment",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"deviceView",
"!=",
"'main'",
"&&",
"!",
"is_dir",
"(",
"\"{$this->viewDirectory}/{$this->context}/{$this->siteDomain}/{$t... | Returns a list of all the files in the theme directory combined with all the asset files of all installed plugins
@return array Contains 2 items, the first being an array of all the files, the second is a unique md5 identifier of the fileset | [
"Returns",
"a",
"list",
"of",
"all",
"the",
"files",
"in",
"the",
"theme",
"directory",
"combined",
"with",
"all",
"the",
"asset",
"files",
"of",
"all",
"installed",
"plugins"
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/mvc/deployment/AbstractFileDeploymentService.php#L257-L326 | train |
bseddon/XPath20 | DOM/DOMSchemaAttribute.php | DOMSchemaAttribute.fromQName | public static function fromQName( $name )
{
if ( $name instanceof QName )
{
$name = "{$name->prefix}:{$name->localName}";
}
if ( ! is_string( $name ) )
{
throw new \InvalidArgumentException( "$name must be string or a QName instanxe" );
}
$types = SchemaTypes::getInstance();
$attribu... | php | public static function fromQName( $name )
{
if ( $name instanceof QName )
{
$name = "{$name->prefix}:{$name->localName}";
}
if ( ! is_string( $name ) )
{
throw new \InvalidArgumentException( "$name must be string or a QName instanxe" );
}
$types = SchemaTypes::getInstance();
$attribu... | [
"public",
"static",
"function",
"fromQName",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"$",
"name",
"instanceof",
"QName",
")",
"{",
"$",
"name",
"=",
"\"{$name->prefix}:{$name->localName}\"",
";",
"}",
"if",
"(",
"!",
"is_string",
"(",
"$",
"name",
")",
")... | The qualified name of the attribute
@param QName|string $name | [
"The",
"qualified",
"name",
"of",
"the",
"attribute"
] | 69882b6efffaa5470a819d5fdd2f6473ddeb046d | https://github.com/bseddon/XPath20/blob/69882b6efffaa5470a819d5fdd2f6473ddeb046d/DOM/DOMSchemaAttribute.php#L51-L73 | train |
AdamB7586/menu-builder | src/Helpers/URI.php | URI.setURI | protected static function setURI($uri){
if(!is_string($uri)){
throw new InvalidArgumentException(
'$uri must be a string or null'
);
}
self::$uri = filter_var($uri, FILTER_SANITIZE_URL);
} | php | protected static function setURI($uri){
if(!is_string($uri)){
throw new InvalidArgumentException(
'$uri must be a string or null'
);
}
self::$uri = filter_var($uri, FILTER_SANITIZE_URL);
} | [
"protected",
"static",
"function",
"setURI",
"(",
"$",
"uri",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"uri",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"'$uri must be a string or null'",
")",
";",
"}",
"self",
"::",
"$",
"uri"... | Sets the link URI
@param string $uri This should be the link string
@throws InvalidArgumentException | [
"Sets",
"the",
"link",
"URI"
] | dbc192bca7d59475068c19d1a07a039e5f997ee4 | https://github.com/AdamB7586/menu-builder/blob/dbc192bca7d59475068c19d1a07a039e5f997ee4/src/Helpers/URI.php#L16-L23 | train |
AdamB7586/menu-builder | src/Helpers/URI.php | URI.setAnchorPoint | protected static function setAnchorPoint($anchor){
if(is_string($anchor) && !empty(trim($anchor))){
self::$anchor = '#'.trim($anchor, '#');
}
else{
self::$anchor = false;
}
} | php | protected static function setAnchorPoint($anchor){
if(is_string($anchor) && !empty(trim($anchor))){
self::$anchor = '#'.trim($anchor, '#');
}
else{
self::$anchor = false;
}
} | [
"protected",
"static",
"function",
"setAnchorPoint",
"(",
"$",
"anchor",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"anchor",
")",
"&&",
"!",
"empty",
"(",
"trim",
"(",
"$",
"anchor",
")",
")",
")",
"{",
"self",
"::",
"$",
"anchor",
"=",
"'#'",
".... | Sets the anchor point for the link
@param mixed $anchor If the anchor point exists set to the string here | [
"Sets",
"the",
"anchor",
"point",
"for",
"the",
"link"
] | dbc192bca7d59475068c19d1a07a039e5f997ee4 | https://github.com/AdamB7586/menu-builder/blob/dbc192bca7d59475068c19d1a07a039e5f997ee4/src/Helpers/URI.php#L37-L44 | train |
AdamB7586/menu-builder | src/Helpers/URI.php | URI.getHref | public static function getHref($link) {
self::setURI($link['uri']);
self::setAnchorPoint($link['fragment']);
return self::getURI().self::getAnchorPoint();
} | php | public static function getHref($link) {
self::setURI($link['uri']);
self::setAnchorPoint($link['fragment']);
return self::getURI().self::getAnchorPoint();
} | [
"public",
"static",
"function",
"getHref",
"(",
"$",
"link",
")",
"{",
"self",
"::",
"setURI",
"(",
"$",
"link",
"[",
"'uri'",
"]",
")",
";",
"self",
"::",
"setAnchorPoint",
"(",
"$",
"link",
"[",
"'fragment'",
"]",
")",
";",
"return",
"self",
"::",
... | Returns the correctly formatted link string
@param array $link This should be the link information
@return mixed Will return the link string if it exists else will return false | [
"Returns",
"the",
"correctly",
"formatted",
"link",
"string"
] | dbc192bca7d59475068c19d1a07a039e5f997ee4 | https://github.com/AdamB7586/menu-builder/blob/dbc192bca7d59475068c19d1a07a039e5f997ee4/src/Helpers/URI.php#L59-L63 | train |
codeblanche/Entity | src/Entity/Definition/PropertyDefinition.php | PropertyDefinition.extractGeneric | protected function extractGeneric($type)
{
if (empty($type)) {
return null;
}
$generic = null;
if (substr($type, -2) === '[]') {
$generic = substr($type, 0, -2);
}
elseif (strtolower(substr($type, 0, 6)) === 'array<' && substr($type, -1) === ... | php | protected function extractGeneric($type)
{
if (empty($type)) {
return null;
}
$generic = null;
if (substr($type, -2) === '[]') {
$generic = substr($type, 0, -2);
}
elseif (strtolower(substr($type, 0, 6)) === 'array<' && substr($type, -1) === ... | [
"protected",
"function",
"extractGeneric",
"(",
"$",
"type",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"type",
")",
")",
"{",
"return",
"null",
";",
"}",
"$",
"generic",
"=",
"null",
";",
"if",
"(",
"substr",
"(",
"$",
"type",
",",
"-",
"2",
")",
... | Extract the generic subtype from the specified type if there is one.
@param string $type
@return string|null | [
"Extract",
"the",
"generic",
"subtype",
"from",
"the",
"specified",
"type",
"if",
"there",
"is",
"one",
"."
] | 1d3839c09d7639ae8bbfc9d2721223202f3a5cdd | https://github.com/codeblanche/Entity/blob/1d3839c09d7639ae8bbfc9d2721223202f3a5cdd/src/Entity/Definition/PropertyDefinition.php#L107-L123 | train |
devlabmtl/haven-core | Lib/NestedSet/Config.php | Config.setClass | public function setClass($clazz)
{
if($clazz instanceof ClassMetadata)
{
$classMetadata = $clazz;
$classname = $clazz->getReflectionClass()->getName();
}
else if (class_exists($clazz))
{
$classname = $clazz;
$classMetadata = $th... | php | public function setClass($clazz)
{
if($clazz instanceof ClassMetadata)
{
$classMetadata = $clazz;
$classname = $clazz->getReflectionClass()->getName();
}
else if (class_exists($clazz))
{
$classname = $clazz;
$classMetadata = $th... | [
"public",
"function",
"setClass",
"(",
"$",
"clazz",
")",
"{",
"if",
"(",
"$",
"clazz",
"instanceof",
"ClassMetadata",
")",
"{",
"$",
"classMetadata",
"=",
"$",
"clazz",
";",
"$",
"classname",
"=",
"$",
"clazz",
"->",
"getReflectionClass",
"(",
")",
"->"... | Sets the class associated with this configuration
@param mixed $clazz a class name or ClassMetadata object representing
the entity class associated with this configuration
@return Config $this for fluent API | [
"Sets",
"the",
"class",
"associated",
"with",
"this",
"configuration"
] | f13410f996fd4002efafe482b927adadb211dec8 | https://github.com/devlabmtl/haven-core/blob/f13410f996fd4002efafe482b927adadb211dec8/Lib/NestedSet/Config.php#L81-L121 | train |
devlabmtl/haven-core | Lib/NestedSet/Config.php | Config.setBaseQueryBuilder | public function setBaseQueryBuilder(QueryBuilder $baseQueryBuilder=null)
{
if($baseQueryBuilder === null)
{
$this->baseQueryBuilder = $this->getDefaultQueryBuilder();
}
else
{
$this->baseQueryBuilder = $baseQueryBuilder;
}
} | php | public function setBaseQueryBuilder(QueryBuilder $baseQueryBuilder=null)
{
if($baseQueryBuilder === null)
{
$this->baseQueryBuilder = $this->getDefaultQueryBuilder();
}
else
{
$this->baseQueryBuilder = $baseQueryBuilder;
}
} | [
"public",
"function",
"setBaseQueryBuilder",
"(",
"QueryBuilder",
"$",
"baseQueryBuilder",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"baseQueryBuilder",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"baseQueryBuilder",
"=",
"$",
"this",
"->",
"getDefaultQueryBuilder"... | sets the base query builder
@param Query $baseQueryBuilder or null to reset the base query builder | [
"sets",
"the",
"base",
"query",
"builder"
] | f13410f996fd4002efafe482b927adadb211dec8 | https://github.com/devlabmtl/haven-core/blob/f13410f996fd4002efafe482b927adadb211dec8/Lib/NestedSet/Config.php#L260-L270 | train |
devlabmtl/haven-core | Lib/NestedSet/Config.php | Config.getDefaultQueryBuilder | public function getDefaultQueryBuilder()
{
$em = $this->getEntityManager();
return $em->createQueryBuilder()
->select('n')
->from($this->getClassname(), 'n');
} | php | public function getDefaultQueryBuilder()
{
$em = $this->getEntityManager();
return $em->createQueryBuilder()
->select('n')
->from($this->getClassname(), 'n');
} | [
"public",
"function",
"getDefaultQueryBuilder",
"(",
")",
"{",
"$",
"em",
"=",
"$",
"this",
"->",
"getEntityManager",
"(",
")",
";",
"return",
"$",
"em",
"->",
"createQueryBuilder",
"(",
")",
"->",
"select",
"(",
"'n'",
")",
"->",
"from",
"(",
"$",
"th... | gets the default query builder
@return QueryBuilder | [
"gets",
"the",
"default",
"query",
"builder"
] | f13410f996fd4002efafe482b927adadb211dec8 | https://github.com/devlabmtl/haven-core/blob/f13410f996fd4002efafe482b927adadb211dec8/Lib/NestedSet/Config.php#L287-L293 | train |
cloudtek/dynamodm | lib/Cloudtek/DynamoDM/Schema/Identifier/CompositeIdentifier.php | CompositeIdentifier.addToDocument | protected function addToDocument($document)
{
parent::addToDocument($document);
$this->getRangeKey()->getPropertyMetadata()->setValue(
$document,
$this->getRangeValue()
);
} | php | protected function addToDocument($document)
{
parent::addToDocument($document);
$this->getRangeKey()->getPropertyMetadata()->setValue(
$document,
$this->getRangeValue()
);
} | [
"protected",
"function",
"addToDocument",
"(",
"$",
"document",
")",
"{",
"parent",
"::",
"addToDocument",
"(",
"$",
"document",
")",
";",
"$",
"this",
"->",
"getRangeKey",
"(",
")",
"->",
"getPropertyMetadata",
"(",
")",
"->",
"setValue",
"(",
"$",
"docum... | Set this identifier's values on the provided document instance.
@param object $document
@return void | [
"Set",
"this",
"identifier",
"s",
"values",
"on",
"the",
"provided",
"document",
"instance",
"."
] | 119d355e2c5cbaef1f867970349b4432f5704fcd | https://github.com/cloudtek/dynamodm/blob/119d355e2c5cbaef1f867970349b4432f5704fcd/lib/Cloudtek/DynamoDM/Schema/Identifier/CompositeIdentifier.php#L62-L70 | train |
cloudtek/dynamodm | lib/Cloudtek/DynamoDM/Schema/Identifier/CompositeIdentifier.php | CompositeIdentifier.getArray | protected function getArray()
{
$key = $this->getRangeKey()->getPropertyMetadata()->name;
$array = parent::getArray();
$array[$key] = $this->getRangeValue();
return $array;
} | php | protected function getArray()
{
$key = $this->getRangeKey()->getPropertyMetadata()->name;
$array = parent::getArray();
$array[$key] = $this->getRangeValue();
return $array;
} | [
"protected",
"function",
"getArray",
"(",
")",
"{",
"$",
"key",
"=",
"$",
"this",
"->",
"getRangeKey",
"(",
")",
"->",
"getPropertyMetadata",
"(",
")",
"->",
"name",
";",
"$",
"array",
"=",
"parent",
"::",
"getArray",
"(",
")",
";",
"$",
"array",
"["... | Return this identifier's key names and values.
Useful for compatibility with Doctrine\Common interfaces.
@return array | [
"Return",
"this",
"identifier",
"s",
"key",
"names",
"and",
"values",
"."
] | 119d355e2c5cbaef1f867970349b4432f5704fcd | https://github.com/cloudtek/dynamodm/blob/119d355e2c5cbaef1f867970349b4432f5704fcd/lib/Cloudtek/DynamoDM/Schema/Identifier/CompositeIdentifier.php#L79-L86 | train |
ItalyStrap/config | src/Config/Config.php | Config.push | public function push( string $key, $value ) : self {
$this->offsetSet( $key, $value );
return $this;
} | php | public function push( string $key, $value ) : self {
$this->offsetSet( $key, $value );
return $this;
} | [
"public",
"function",
"push",
"(",
"string",
"$",
"key",
",",
"$",
"value",
")",
":",
"self",
"{",
"$",
"this",
"->",
"offsetSet",
"(",
"$",
"key",
",",
"$",
"value",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Push a configuration in via the key
@since 1.0.0
@param string $key Key to be assigned, which also becomes the property
@param mixed $value Value to be assigned to the parameter key
@return self | [
"Push",
"a",
"configuration",
"in",
"via",
"the",
"key"
] | cb4c163e124a98e0b4af67b10bbbdae6469f7113 | https://github.com/ItalyStrap/config/blob/cb4c163e124a98e0b4af67b10bbbdae6469f7113/src/Config/Config.php#L73-L76 | train |
ItalyStrap/config | src/Config/Config.php | Config.remove | public function remove( ...$with_keys ) : self {
foreach ( $with_keys as $keys ) {
foreach ( (array) $keys as $k ) {
$this->offsetUnset( $k );
}
}
return $this;
} | php | public function remove( ...$with_keys ) : self {
foreach ( $with_keys as $keys ) {
foreach ( (array) $keys as $k ) {
$this->offsetUnset( $k );
}
}
return $this;
} | [
"public",
"function",
"remove",
"(",
"...",
"$",
"with_keys",
")",
":",
"self",
"{",
"foreach",
"(",
"$",
"with_keys",
"as",
"$",
"keys",
")",
"{",
"foreach",
"(",
"(",
"array",
")",
"$",
"keys",
"as",
"$",
"k",
")",
"{",
"$",
"this",
"->",
"offs... | Removes an item or multiple items.
@since 2.0.0
@param mixed ...$with_keys
@return self | [
"Removes",
"an",
"item",
"or",
"multiple",
"items",
"."
] | cb4c163e124a98e0b4af67b10bbbdae6469f7113 | https://github.com/ItalyStrap/config/blob/cb4c163e124a98e0b4af67b10bbbdae6469f7113/src/Config/Config.php#L86-L95 | train |
Stinger-Soft/TwigExtensions | src/StingerSoft/TwigExtensions/ArrayExtensions.php | ArrayExtensions.unsetFilter | public function unsetFilter($array, $keys) {
if(is_array($array)) {
if(!is_array($keys)) {
$keys = array(
$keys
);
}
foreach($keys as $key) {
if(array_key_exists($key, $array)) {
unset($array[$key]);
}
}
}
return $array;
} | php | public function unsetFilter($array, $keys) {
if(is_array($array)) {
if(!is_array($keys)) {
$keys = array(
$keys
);
}
foreach($keys as $key) {
if(array_key_exists($key, $array)) {
unset($array[$key]);
}
}
}
return $array;
} | [
"public",
"function",
"unsetFilter",
"(",
"$",
"array",
",",
"$",
"keys",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"array",
")",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"keys",
")",
")",
"{",
"$",
"keys",
"=",
"array",
"(",
"$",
"keys... | Removes an element from the given array
@param array $array
@param array|string $keys
@return array | [
"Removes",
"an",
"element",
"from",
"the",
"given",
"array"
] | 7bfce337b0dd33106e22f80b221338451a02d7c5 | https://github.com/Stinger-Soft/TwigExtensions/blob/7bfce337b0dd33106e22f80b221338451a02d7c5/src/StingerSoft/TwigExtensions/ArrayExtensions.php#L41-L55 | train |
fridge-project/dbal | src/Fridge/DBAL/Driver/Statement/StatementRewriter.php | StatementRewriter.getRewritedParameters | public function getRewritedParameters($parameter)
{
if (is_int($parameter)) {
return array($parameter);
}
if (!isset($this->parameters[$parameter])) {
throw StatementRewriterException::parameterDoesNotExist($parameter);
}
return $this->parameters[$pa... | php | public function getRewritedParameters($parameter)
{
if (is_int($parameter)) {
return array($parameter);
}
if (!isset($this->parameters[$parameter])) {
throw StatementRewriterException::parameterDoesNotExist($parameter);
}
return $this->parameters[$pa... | [
"public",
"function",
"getRewritedParameters",
"(",
"$",
"parameter",
")",
"{",
"if",
"(",
"is_int",
"(",
"$",
"parameter",
")",
")",
"{",
"return",
"array",
"(",
"$",
"parameter",
")",
";",
"}",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"para... | Gets the rewrited positional statement parameters according to the named parameter.
The metod returns an array because a named parameter can be used multiple times in the statement.
@param string $parameter The named parameter.
@throws \Fridge\DBAL\Exception\StatementRewriterException If the parameter does not exist... | [
"Gets",
"the",
"rewrited",
"positional",
"statement",
"parameters",
"according",
"to",
"the",
"named",
"parameter",
"."
] | d0b8c3551922d696836487aa0eb1bd74014edcd4 | https://github.com/fridge-project/dbal/blob/d0b8c3551922d696836487aa0eb1bd74014edcd4/src/Fridge/DBAL/Driver/Statement/StatementRewriter.php#L67-L78 | train |
fridge-project/dbal | src/Fridge/DBAL/Driver/Statement/StatementRewriter.php | StatementRewriter.rewrite | private function rewrite()
{
// Current positional parameter.
$positionalParameter = 1;
// TRUE if we are in a literal section else FALSE.
$literal = false;
// The statement length.
$statementLength = strlen($this->statement);
// Iterate each statement char... | php | private function rewrite()
{
// Current positional parameter.
$positionalParameter = 1;
// TRUE if we are in a literal section else FALSE.
$literal = false;
// The statement length.
$statementLength = strlen($this->statement);
// Iterate each statement char... | [
"private",
"function",
"rewrite",
"(",
")",
"{",
"// Current positional parameter.",
"$",
"positionalParameter",
"=",
"1",
";",
"// TRUE if we are in a literal section else FALSE.",
"$",
"literal",
"=",
"false",
";",
"// The statement length.",
"$",
"statementLength",
"=",
... | Rewrite the named statement and parameters to positional.
Example:
- before:
- statement: SELECT * FROM foo WHERE bar = :bar
- parameters: array()
- after:
- statement: SELECT * FROM foo WHERE bar = ?
- parameters: array(':bar' => array(1)) | [
"Rewrite",
"the",
"named",
"statement",
"and",
"parameters",
"to",
"positional",
"."
] | d0b8c3551922d696836487aa0eb1bd74014edcd4 | https://github.com/fridge-project/dbal/blob/d0b8c3551922d696836487aa0eb1bd74014edcd4/src/Fridge/DBAL/Driver/Statement/StatementRewriter.php#L91-L143 | train |
fridge-project/dbal | src/Fridge/DBAL/Driver/Statement/StatementRewriter.php | StatementRewriter.isValidPlaceholderCharacter | private function isValidPlaceholderCharacter($character)
{
$asciiCode = ord($character);
return (($asciiCode >= 48) && ($asciiCode <= 57))
|| (($asciiCode >= 65) && ($asciiCode <= 90))
|| (($asciiCode >= 97) && ($asciiCode <= 122));
} | php | private function isValidPlaceholderCharacter($character)
{
$asciiCode = ord($character);
return (($asciiCode >= 48) && ($asciiCode <= 57))
|| (($asciiCode >= 65) && ($asciiCode <= 90))
|| (($asciiCode >= 97) && ($asciiCode <= 122));
} | [
"private",
"function",
"isValidPlaceholderCharacter",
"(",
"$",
"character",
")",
"{",
"$",
"asciiCode",
"=",
"ord",
"(",
"$",
"character",
")",
";",
"return",
"(",
"(",
"$",
"asciiCode",
">=",
"48",
")",
"&&",
"(",
"$",
"asciiCode",
"<=",
"57",
")",
"... | Checks if the character is a valid placeholder character.
@param string $character The character to check.
@return boolean TRUE if the character is a valid placeholder character else FALSE. | [
"Checks",
"if",
"the",
"character",
"is",
"a",
"valid",
"placeholder",
"character",
"."
] | d0b8c3551922d696836487aa0eb1bd74014edcd4 | https://github.com/fridge-project/dbal/blob/d0b8c3551922d696836487aa0eb1bd74014edcd4/src/Fridge/DBAL/Driver/Statement/StatementRewriter.php#L152-L159 | train |
porkchopsandwiches/silex-utilities | lib/src/PorkChopSandwiches/Silex/Utilities/Arrays.php | Arrays.deepMerge | public function deepMerge (array $mergee, array $merger) {
$merged = $mergee;
foreach ($merger as $key => &$value) {
# If key exists an an array on both sides, deep merge
if (array_key_exists($key, $merged) && is_array($value) && is_array($merged[$key])) {
$merged[$key] = $this -> deepMerge($merged[$key... | php | public function deepMerge (array $mergee, array $merger) {
$merged = $mergee;
foreach ($merger as $key => &$value) {
# If key exists an an array on both sides, deep merge
if (array_key_exists($key, $merged) && is_array($value) && is_array($merged[$key])) {
$merged[$key] = $this -> deepMerge($merged[$key... | [
"public",
"function",
"deepMerge",
"(",
"array",
"$",
"mergee",
",",
"array",
"$",
"merger",
")",
"{",
"$",
"merged",
"=",
"$",
"mergee",
";",
"foreach",
"(",
"$",
"merger",
"as",
"$",
"key",
"=>",
"&",
"$",
"value",
")",
"{",
"# If key exists an an ar... | Performs an array merge, but when both values for a key are arrays, a deep merge will occur, retaining the unique keys of both without changing the value types.
@example
$a = array(1 => 2, 3 => array(4 => 5, 6 => 7));
$b = array(3 => array(4 => "Four"));
deepMerge($a, $b) == array(1 => 2, 3 => array(4 => "Four", 6 => ... | [
"Performs",
"an",
"array",
"merge",
"but",
"when",
"both",
"values",
"for",
"a",
"key",
"are",
"arrays",
"a",
"deep",
"merge",
"will",
"occur",
"retaining",
"the",
"unique",
"keys",
"of",
"both",
"without",
"changing",
"the",
"value",
"types",
"."
] | 756d041f40c7980b1763c08004f1f405bfc74af6 | https://github.com/porkchopsandwiches/silex-utilities/blob/756d041f40c7980b1763c08004f1f405bfc74af6/lib/src/PorkChopSandwiches/Silex/Utilities/Arrays.php#L121-L137 | train |
erenmustafaozdal/laravel-modules-base | src/Controllers/BaseController.php | BaseController.changeOptions | protected function changeOptions($category)
{
$thumbnails = $category->ancestorsAndSelf()->with('thumbnails')->get()->map(function($item)
{
return $item->thumbnails->keyBy('slug')->map(function($item)
{
return [ 'width' => $item->photo_width, 'height' => $item... | php | protected function changeOptions($category)
{
$thumbnails = $category->ancestorsAndSelf()->with('thumbnails')->get()->map(function($item)
{
return $item->thumbnails->keyBy('slug')->map(function($item)
{
return [ 'width' => $item->photo_width, 'height' => $item... | [
"protected",
"function",
"changeOptions",
"(",
"$",
"category",
")",
"{",
"$",
"thumbnails",
"=",
"$",
"category",
"->",
"ancestorsAndSelf",
"(",
")",
"->",
"with",
"(",
"'thumbnails'",
")",
"->",
"get",
"(",
")",
"->",
"map",
"(",
"function",
"(",
"$",
... | change options with model category
@param $category
@return void | [
"change",
"options",
"with",
"model",
"category"
] | c26600543817642926bcf16ada84009e00d784e0 | https://github.com/erenmustafaozdal/laravel-modules-base/blob/c26600543817642926bcf16ada84009e00d784e0/src/Controllers/BaseController.php#L87-L101 | train |
t3v/t3v_core | Classes/Service/FileService.php | FileService.saveFile | public static function saveFile($file, string $uploadsFolderPath) {
if (!empty($file) && is_array($file) && !empty($uploadsFolderPath)) {
$fileName = $file['name'];
$temporaryFileName = $file['tmp_name'];
if (GeneralUtility::verifyFilenameAgainstDenyPattern($fileName)) {
$uploads... | php | public static function saveFile($file, string $uploadsFolderPath) {
if (!empty($file) && is_array($file) && !empty($uploadsFolderPath)) {
$fileName = $file['name'];
$temporaryFileName = $file['tmp_name'];
if (GeneralUtility::verifyFilenameAgainstDenyPattern($fileName)) {
$uploads... | [
"public",
"static",
"function",
"saveFile",
"(",
"$",
"file",
",",
"string",
"$",
"uploadsFolderPath",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"file",
")",
"&&",
"is_array",
"(",
"$",
"file",
")",
"&&",
"!",
"empty",
"(",
"$",
"uploadsFolderPath",... | Saves a file to an uploads folder.
@param object $file The file object
@param string $uploadsFolderPath The uploads folder path
@return string|null The file name of the saved file or null if the file could not be saved
@throws \TYPO3\CMS\Core\Resource\Exception\InvalidFileNameException | [
"Saves",
"a",
"file",
"to",
"an",
"uploads",
"folder",
"."
] | 8c04b7688cc2773f11fcc87fda3f7cd53d80a980 | https://github.com/t3v/t3v_core/blob/8c04b7688cc2773f11fcc87fda3f7cd53d80a980/Classes/Service/FileService.php#L56-L76 | train |
t3v/t3v_core | Classes/Service/FileService.php | FileService.cleanFileName | public static function cleanFileName(string $fileName, array $rulesets = self::FILE_NAME_RULESETS, string $separator = '-'): string {
$slugify = new Slugify(['rulesets' => $rulesets, 'separator' => $separator]);
$name = $slugify->slugify(pathinfo($fileName, PATHINFO_FILENAME));
$extension = pathinfo(... | php | public static function cleanFileName(string $fileName, array $rulesets = self::FILE_NAME_RULESETS, string $separator = '-'): string {
$slugify = new Slugify(['rulesets' => $rulesets, 'separator' => $separator]);
$name = $slugify->slugify(pathinfo($fileName, PATHINFO_FILENAME));
$extension = pathinfo(... | [
"public",
"static",
"function",
"cleanFileName",
"(",
"string",
"$",
"fileName",
",",
"array",
"$",
"rulesets",
"=",
"self",
"::",
"FILE_NAME_RULESETS",
",",
"string",
"$",
"separator",
"=",
"'-'",
")",
":",
"string",
"{",
"$",
"slugify",
"=",
"new",
"Slug... | Cleans a file name.
@param string $fileName The file name
@param array $rulesets The optional rulesets, defaults to `FileService::FILE_NAME_RULESETS`
@param string $separator The optional separator, defaults to `-`
@return string The cleaned file name | [
"Cleans",
"a",
"file",
"name",
"."
] | 8c04b7688cc2773f11fcc87fda3f7cd53d80a980 | https://github.com/t3v/t3v_core/blob/8c04b7688cc2773f11fcc87fda3f7cd53d80a980/Classes/Service/FileService.php#L96-L106 | train |
t3v/t3v_core | Classes/Service/FileService.php | FileService.normalizeFileName | public static function normalizeFileName(string $fileName, array $rulesets = self::FILE_NAME_RULESETS, string $separator = '-'): string {
return self::cleanFileName($fileName, $rulesets, $separator);
} | php | public static function normalizeFileName(string $fileName, array $rulesets = self::FILE_NAME_RULESETS, string $separator = '-'): string {
return self::cleanFileName($fileName, $rulesets, $separator);
} | [
"public",
"static",
"function",
"normalizeFileName",
"(",
"string",
"$",
"fileName",
",",
"array",
"$",
"rulesets",
"=",
"self",
"::",
"FILE_NAME_RULESETS",
",",
"string",
"$",
"separator",
"=",
"'-'",
")",
":",
"string",
"{",
"return",
"self",
"::",
"cleanF... | Normalizes a file name, alias for `cleanFileName`.
@param string $fileName The file name
@param array $rulesets The optional rulesets, defaults to `FileService::FILE_NAME_RULESETS`
@param string $separator The optional separator, defaults to `-`
@return string The normalized file name | [
"Normalizes",
"a",
"file",
"name",
"alias",
"for",
"cleanFileName",
"."
] | 8c04b7688cc2773f11fcc87fda3f7cd53d80a980 | https://github.com/t3v/t3v_core/blob/8c04b7688cc2773f11fcc87fda3f7cd53d80a980/Classes/Service/FileService.php#L116-L118 | train |
t3v/t3v_core | Classes/Service/FileService.php | FileService.getUniqueFileName | public static function getUniqueFileName(string $fileName, string $directory): string {
$basicFileUtility = GeneralUtility::makeInstance(BasicFileUtility::class);
return $basicFileUtility->getUniqueName($fileName, $directory);
} | php | public static function getUniqueFileName(string $fileName, string $directory): string {
$basicFileUtility = GeneralUtility::makeInstance(BasicFileUtility::class);
return $basicFileUtility->getUniqueName($fileName, $directory);
} | [
"public",
"static",
"function",
"getUniqueFileName",
"(",
"string",
"$",
"fileName",
",",
"string",
"$",
"directory",
")",
":",
"string",
"{",
"$",
"basicFileUtility",
"=",
"GeneralUtility",
"::",
"makeInstance",
"(",
"BasicFileUtility",
"::",
"class",
")",
";",... | Gets an unique file name.
@param string $fileName The file name
@param string $directory The directory for which to return a unique file name for, MUST be a valid directory and should be absolute
@return string The unique file name | [
"Gets",
"an",
"unique",
"file",
"name",
"."
] | 8c04b7688cc2773f11fcc87fda3f7cd53d80a980 | https://github.com/t3v/t3v_core/blob/8c04b7688cc2773f11fcc87fda3f7cd53d80a980/Classes/Service/FileService.php#L127-L131 | train |
sil-project/VarietyBundle | src/Entity/Family.php | Family.addGenus | public function addGenus(\Librinfo\VarietiesBundle\Entity\Genus $genus)
{
$genus->setFamily($this);
$this->genuses->add($genus);
return $this;
} | php | public function addGenus(\Librinfo\VarietiesBundle\Entity\Genus $genus)
{
$genus->setFamily($this);
$this->genuses->add($genus);
return $this;
} | [
"public",
"function",
"addGenus",
"(",
"\\",
"Librinfo",
"\\",
"VarietiesBundle",
"\\",
"Entity",
"\\",
"Genus",
"$",
"genus",
")",
"{",
"$",
"genus",
"->",
"setFamily",
"(",
"$",
"this",
")",
";",
"$",
"this",
"->",
"genuses",
"->",
"add",
"(",
"$",
... | Add genus.
@param \Librinfo\VarietiesBundle\Entity\Genus $genus
@return Family | [
"Add",
"genus",
"."
] | e9508ce13a4bb277d10bdcd925fdb84bc01f453f | https://github.com/sil-project/VarietyBundle/blob/e9508ce13a4bb277d10bdcd925fdb84bc01f453f/src/Entity/Family.php#L124-L130 | train |
sil-project/VarietyBundle | src/Entity/Family.php | Family.removeGenus | public function removeGenus(\Librinfo\VarietiesBundle\Entity\Genus $genus)
{
return $this->genuses->removeElement($genus);
} | php | public function removeGenus(\Librinfo\VarietiesBundle\Entity\Genus $genus)
{
return $this->genuses->removeElement($genus);
} | [
"public",
"function",
"removeGenus",
"(",
"\\",
"Librinfo",
"\\",
"VarietiesBundle",
"\\",
"Entity",
"\\",
"Genus",
"$",
"genus",
")",
"{",
"return",
"$",
"this",
"->",
"genuses",
"->",
"removeElement",
"(",
"$",
"genus",
")",
";",
"}"
] | Remove genus.
@param \Librinfo\VarietiesBundle\Entity\Genus $genus
@return bool tRUE if this collection contained the specified element, FALSE otherwise | [
"Remove",
"genus",
"."
] | e9508ce13a4bb277d10bdcd925fdb84bc01f453f | https://github.com/sil-project/VarietyBundle/blob/e9508ce13a4bb277d10bdcd925fdb84bc01f453f/src/Entity/Family.php#L139-L142 | train |
ringoteam/RingoPhpRedmonBundle | Command/LoggerCommand.php | LoggerCommand.execute | protected function execute(InputInterface $input, OutputInterface $output)
{
$logger = $this->getContainer()->get('ringo_php_redmon.instance_logger');
$manager = $this->getContainer()->get('ringo_php_redmon.instance_manager');
$instances = $manager->findAll();
if(is_array($i... | php | protected function execute(InputInterface $input, OutputInterface $output)
{
$logger = $this->getContainer()->get('ringo_php_redmon.instance_logger');
$manager = $this->getContainer()->get('ringo_php_redmon.instance_manager');
$instances = $manager->findAll();
if(is_array($i... | [
"protected",
"function",
"execute",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
"{",
"$",
"logger",
"=",
"$",
"this",
"->",
"getContainer",
"(",
")",
"->",
"get",
"(",
"'ringo_php_redmon.instance_logger'",
")",
";",
"$",
... | Execute task
Get all redis instances and log some of infos
@param \Symfony\Component\Console\Input\InputInterface $input
@param \Symfony\Component\Console\Output\OutputInterface $output | [
"Execute",
"task",
"Get",
"all",
"redis",
"instances",
"and",
"log",
"some",
"of",
"infos"
] | 9aab989a9bee9e6152ec19f8a30bc24f3bde6012 | https://github.com/ringoteam/RingoPhpRedmonBundle/blob/9aab989a9bee9e6152ec19f8a30bc24f3bde6012/Command/LoggerCommand.php#L45-L58 | train |
wb-crowdfusion/crowdfusion | system/core/classes/libraries/utils/FileSystemUtils.php | FileSystemUtils.createWorkingDirectory | public static function createWorkingDirectory()
{
$workdir = sys_get_temp_dir() . '/tmp-' . session_id() . '/';
self::recursiveMkdir($workdir, 0777);
//@chmod($workdir,0777);
if (!is_dir($workdir)) {
throw new Exception("cannot create directory: " . $workdir);
}... | php | public static function createWorkingDirectory()
{
$workdir = sys_get_temp_dir() . '/tmp-' . session_id() . '/';
self::recursiveMkdir($workdir, 0777);
//@chmod($workdir,0777);
if (!is_dir($workdir)) {
throw new Exception("cannot create directory: " . $workdir);
}... | [
"public",
"static",
"function",
"createWorkingDirectory",
"(",
")",
"{",
"$",
"workdir",
"=",
"sys_get_temp_dir",
"(",
")",
".",
"'/tmp-'",
".",
"session_id",
"(",
")",
".",
"'/'",
";",
"self",
"::",
"recursiveMkdir",
"(",
"$",
"workdir",
",",
"0777",
")",... | Creates a unique temporary directory and returns the absolute path
@return string the absolute path to the temporary directory | [
"Creates",
"a",
"unique",
"temporary",
"directory",
"and",
"returns",
"the",
"absolute",
"path"
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/libraries/utils/FileSystemUtils.php#L973-L985 | train |
wb-crowdfusion/crowdfusion | system/core/classes/libraries/utils/FileSystemUtils.php | FileSystemUtils.recursiveRmdir | public static function recursiveRmdir($path, $removeParent = true)
{
if (!file_exists($path))
return true;
if (!is_dir($path))
return @unlink($path);
$objects = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path), RecursiveIteratorIterator::CHILD_FIR... | php | public static function recursiveRmdir($path, $removeParent = true)
{
if (!file_exists($path))
return true;
if (!is_dir($path))
return @unlink($path);
$objects = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path), RecursiveIteratorIterator::CHILD_FIR... | [
"public",
"static",
"function",
"recursiveRmdir",
"(",
"$",
"path",
",",
"$",
"removeParent",
"=",
"true",
")",
"{",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"path",
")",
")",
"return",
"true",
";",
"if",
"(",
"!",
"is_dir",
"(",
"$",
"path",
")",
... | Recursively remove a directory and its contents.
@param string $path The directory to remove
@param boolean $removeParent If false, then remove only the contents of the directory at $path.
Default: true
@return boolean true on success | [
"Recursively",
"remove",
"a",
"directory",
"and",
"its",
"contents",
"."
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/libraries/utils/FileSystemUtils.php#L1089-L1112 | train |
wb-crowdfusion/crowdfusion | system/core/classes/libraries/utils/FileSystemUtils.php | FileSystemUtils.secureTmpname | public static function secureTmpname($dir = null, $prefix = 'tmp', $postfix = '.tmp')
{
// validate arguments
if (!(isset ($postfix) && is_string($postfix)))
return false;
if (!(isset ($prefix) && is_string($prefix)))
return false;
if (!isset ($dir))
... | php | public static function secureTmpname($dir = null, $prefix = 'tmp', $postfix = '.tmp')
{
// validate arguments
if (!(isset ($postfix) && is_string($postfix)))
return false;
if (!(isset ($prefix) && is_string($prefix)))
return false;
if (!isset ($dir))
... | [
"public",
"static",
"function",
"secureTmpname",
"(",
"$",
"dir",
"=",
"null",
",",
"$",
"prefix",
"=",
"'tmp'",
",",
"$",
"postfix",
"=",
"'.tmp'",
")",
"{",
"// validate arguments",
"if",
"(",
"!",
"(",
"isset",
"(",
"$",
"postfix",
")",
"&&",
"is_st... | Creates a temp file with a specific extension.
Creating a temporary file with a specific extension is a common
requirement on dynamic websites. Largely this need arises from
Microsoft browsers that identify a downloaded file's mimetype based
on the file's extension.
No single PHP function creates a temporary filename... | [
"Creates",
"a",
"temp",
"file",
"with",
"a",
"specific",
"extension",
"."
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/libraries/utils/FileSystemUtils.php#L1138-L1174 | train |
niels-nijens/protocol-stream | src/StreamManager.php | StreamManager.registerStream | public function registerStream(StreamInterface $stream, $replaceWrapper = false)
{
$protocol = $stream->getProtocol();
if ($replaceWrapper === true && in_array($protocol, stream_get_wrappers())) {
stream_wrapper_unregister($protocol);
}
if (stream_wrapper_register($proto... | php | public function registerStream(StreamInterface $stream, $replaceWrapper = false)
{
$protocol = $stream->getProtocol();
if ($replaceWrapper === true && in_array($protocol, stream_get_wrappers())) {
stream_wrapper_unregister($protocol);
}
if (stream_wrapper_register($proto... | [
"public",
"function",
"registerStream",
"(",
"StreamInterface",
"$",
"stream",
",",
"$",
"replaceWrapper",
"=",
"false",
")",
"{",
"$",
"protocol",
"=",
"$",
"stream",
"->",
"getProtocol",
"(",
")",
";",
"if",
"(",
"$",
"replaceWrapper",
"===",
"true",
"&&... | Registers stream instance for a protocol.
@param StreamInterface $stream
@param bool $replaceWrapper
@return self | [
"Registers",
"stream",
"instance",
"for",
"a",
"protocol",
"."
] | c45b8d282bbb83f2a3d17adeb1d66500c14a868c | https://github.com/niels-nijens/protocol-stream/blob/c45b8d282bbb83f2a3d17adeb1d66500c14a868c/src/StreamManager.php#L39-L51 | train |
niels-nijens/protocol-stream | src/StreamManager.php | StreamManager.unregisterStream | public function unregisterStream($protocol)
{
if (isset(self::$streams[$protocol])) {
$result = stream_wrapper_unregister($protocol);
if ($result === true) {
unset(self::$streams[$protocol]);
}
}
return $this;
} | php | public function unregisterStream($protocol)
{
if (isset(self::$streams[$protocol])) {
$result = stream_wrapper_unregister($protocol);
if ($result === true) {
unset(self::$streams[$protocol]);
}
}
return $this;
} | [
"public",
"function",
"unregisterStream",
"(",
"$",
"protocol",
")",
"{",
"if",
"(",
"isset",
"(",
"self",
"::",
"$",
"streams",
"[",
"$",
"protocol",
"]",
")",
")",
"{",
"$",
"result",
"=",
"stream_wrapper_unregister",
"(",
"$",
"protocol",
")",
";",
... | Unregisters a stream instance by protocol.
@param string $protocol
@return self | [
"Unregisters",
"a",
"stream",
"instance",
"by",
"protocol",
"."
] | c45b8d282bbb83f2a3d17adeb1d66500c14a868c | https://github.com/niels-nijens/protocol-stream/blob/c45b8d282bbb83f2a3d17adeb1d66500c14a868c/src/StreamManager.php#L60-L70 | train |
kkthek/diqa-util | src/Util/FileLinkUtils.php | FileLinkUtils.ImageOverlayLinkBegin | public static function ImageOverlayLinkBegin($dummy, \Title $target, &$text, &$customAttribs, &$query, &$options, &$ret) {
global $wgDIQAImageOverlayWhitelist;
global $wgDIQADownloadWhitelist;
if (!self::isImage($target->mNamespace)) {
// don't rewrite links not pointing to images
... | php | public static function ImageOverlayLinkBegin($dummy, \Title $target, &$text, &$customAttribs, &$query, &$options, &$ret) {
global $wgDIQAImageOverlayWhitelist;
global $wgDIQADownloadWhitelist;
if (!self::isImage($target->mNamespace)) {
// don't rewrite links not pointing to images
... | [
"public",
"static",
"function",
"ImageOverlayLinkBegin",
"(",
"$",
"dummy",
",",
"\\",
"Title",
"$",
"target",
",",
"&",
"$",
"text",
",",
"&",
"$",
"customAttribs",
",",
"&",
"$",
"query",
",",
"&",
"$",
"options",
",",
"&",
"$",
"ret",
")",
"{",
... | Rewrites links to images in order to open them into a overlay
@param unknown $dummy
@param \Title $target
@param unknown $text
@param unknown $customAttribs
@param unknown $query
@param unknown $options
@param unknown $ret
@return boolean | [
"Rewrites",
"links",
"to",
"images",
"in",
"order",
"to",
"open",
"them",
"into",
"a",
"overlay"
] | df35d16403b5dbf0f7570daded6cfa26814ae7e0 | https://github.com/kkthek/diqa-util/blob/df35d16403b5dbf0f7570daded6cfa26814ae7e0/src/Util/FileLinkUtils.php#L29-L65 | train |
story75/Raptor | src/CommandProxyGenerator.php | CommandProxyGenerator.generateCommandProxy | public function generateCommandProxy($className)
{
$classMeta = $this->reflectionService->getClassMetaReflection($className);
$proxies = [];
$cachePath = $this->getRaptorCachePath();
$this->createDirectory($cachePath);
$thisNode = new Variable('this');
foreach ($cla... | php | public function generateCommandProxy($className)
{
$classMeta = $this->reflectionService->getClassMetaReflection($className);
$proxies = [];
$cachePath = $this->getRaptorCachePath();
$this->createDirectory($cachePath);
$thisNode = new Variable('this');
foreach ($cla... | [
"public",
"function",
"generateCommandProxy",
"(",
"$",
"className",
")",
"{",
"$",
"classMeta",
"=",
"$",
"this",
"->",
"reflectionService",
"->",
"getClassMetaReflection",
"(",
"$",
"className",
")",
";",
"$",
"proxies",
"=",
"[",
"]",
";",
"$",
"cachePath... | Entry point to create proxies of a bonefish command class
@param string $className
@return array | [
"Entry",
"point",
"to",
"create",
"proxies",
"of",
"a",
"bonefish",
"command",
"class"
] | e62e9e56be9d7b8ad16971b628c4c77ff4448d77 | https://github.com/story75/Raptor/blob/e62e9e56be9d7b8ad16971b628c4c77ff4448d77/src/CommandProxyGenerator.php#L95-L116 | train |
story75/Raptor | src/CommandProxyGenerator.php | CommandProxyGenerator.getCommandName | protected function getCommandName($methodMeta, $classMeta)
{
$nameSpaceParts = explode('\\', $classMeta->getNamespace());
$vendor = $nameSpaceParts[0];
$package = $nameSpaceParts[1];
return strtolower($vendor . ':' . $package . ':' . str_replace(self::COMMAND_SUFFIX, '', $methodMeta... | php | protected function getCommandName($methodMeta, $classMeta)
{
$nameSpaceParts = explode('\\', $classMeta->getNamespace());
$vendor = $nameSpaceParts[0];
$package = $nameSpaceParts[1];
return strtolower($vendor . ':' . $package . ':' . str_replace(self::COMMAND_SUFFIX, '', $methodMeta... | [
"protected",
"function",
"getCommandName",
"(",
"$",
"methodMeta",
",",
"$",
"classMeta",
")",
"{",
"$",
"nameSpaceParts",
"=",
"explode",
"(",
"'\\\\'",
",",
"$",
"classMeta",
"->",
"getNamespace",
"(",
")",
")",
";",
"$",
"vendor",
"=",
"$",
"nameSpacePa... | Create a unique command name
@param MethodMeta $methodMeta
@param ClassMeta $classMeta
@return string | [
"Create",
"a",
"unique",
"command",
"name"
] | e62e9e56be9d7b8ad16971b628c4c77ff4448d77 | https://github.com/story75/Raptor/blob/e62e9e56be9d7b8ad16971b628c4c77ff4448d77/src/CommandProxyGenerator.php#L125-L132 | train |
naucon/Utility | src/IteratorReverseAbstract.php | IteratorReverseAbstract.next | public function next()
{
$this->_itemValid = true;
if (!prev($this->_items)) {
// no next item
$this->_itemValid = false;
} else {
$this->_itemPosition--;
}
} | php | public function next()
{
$this->_itemValid = true;
if (!prev($this->_items)) {
// no next item
$this->_itemValid = false;
} else {
$this->_itemPosition--;
}
} | [
"public",
"function",
"next",
"(",
")",
"{",
"$",
"this",
"->",
"_itemValid",
"=",
"true",
";",
"if",
"(",
"!",
"prev",
"(",
"$",
"this",
"->",
"_items",
")",
")",
"{",
"// no next item",
"$",
"this",
"->",
"_itemValid",
"=",
"false",
";",
"}",
"el... | set next item to current item
@return void | [
"set",
"next",
"item",
"to",
"current",
"item"
] | d225bb5d09d82400917f710c9d502949a66442c4 | https://github.com/naucon/Utility/blob/d225bb5d09d82400917f710c9d502949a66442c4/src/IteratorReverseAbstract.php#L74-L84 | train |
Weblab-nl/restclient | src/Adapters/OAuth.php | OAuth.fetchAccessToken | private function fetchAccessToken() {
// Setup the params
$params = [
'client_id' => $this->clientID,
'client_secret' => $this->secret,
'grant_type' => 'authorization_code',
'code' => $this->requestToken
];
if (isset($this-... | php | private function fetchAccessToken() {
// Setup the params
$params = [
'client_id' => $this->clientID,
'client_secret' => $this->secret,
'grant_type' => 'authorization_code',
'code' => $this->requestToken
];
if (isset($this-... | [
"private",
"function",
"fetchAccessToken",
"(",
")",
"{",
"// Setup the params",
"$",
"params",
"=",
"[",
"'client_id'",
"=>",
"$",
"this",
"->",
"clientID",
",",
"'client_secret'",
"=>",
"$",
"this",
"->",
"secret",
",",
"'grant_type'",
"=>",
"'authorization_co... | Does a cURL to request a new access token
@throws \Exception | [
"Does",
"a",
"cURL",
"to",
"request",
"a",
"new",
"access",
"token"
] | 6bc4e7890580b7b31e78032e40be5a67122b0dd0 | https://github.com/Weblab-nl/restclient/blob/6bc4e7890580b7b31e78032e40be5a67122b0dd0/src/Adapters/OAuth.php#L223-L238 | train |
Weblab-nl/restclient | src/Adapters/OAuth.php | OAuth.refreshAccessToken | private function refreshAccessToken() {
// Setup the params
$params = [
'client_id' => $this->clientID,
'client_secret' => $this->secret,
'grant_type' => 'refresh_token',
'refresh_token' => $this->refreshToken
];
// Parse the cURL r... | php | private function refreshAccessToken() {
// Setup the params
$params = [
'client_id' => $this->clientID,
'client_secret' => $this->secret,
'grant_type' => 'refresh_token',
'refresh_token' => $this->refreshToken
];
// Parse the cURL r... | [
"private",
"function",
"refreshAccessToken",
"(",
")",
"{",
"// Setup the params",
"$",
"params",
"=",
"[",
"'client_id'",
"=>",
"$",
"this",
"->",
"clientID",
",",
"'client_secret'",
"=>",
"$",
"this",
"->",
"secret",
",",
"'grant_type'",
"=>",
"'refresh_token'... | Refreshes the access token
@throws \Exception | [
"Refreshes",
"the",
"access",
"token"
] | 6bc4e7890580b7b31e78032e40be5a67122b0dd0 | https://github.com/Weblab-nl/restclient/blob/6bc4e7890580b7b31e78032e40be5a67122b0dd0/src/Adapters/OAuth.php#L245-L256 | train |
Weblab-nl/restclient | src/Adapters/OAuth.php | OAuth.processRequestToken | public function processRequestToken($token) {
// Setup the params
$params = [
'client_id' => $this->clientID,
'client_secret' => $this->secret,
'code' => $token,
'grant_type' => 'authorization_code',
'redirect_uri' => $this->re... | php | public function processRequestToken($token) {
// Setup the params
$params = [
'client_id' => $this->clientID,
'client_secret' => $this->secret,
'code' => $token,
'grant_type' => 'authorization_code',
'redirect_uri' => $this->re... | [
"public",
"function",
"processRequestToken",
"(",
"$",
"token",
")",
"{",
"// Setup the params",
"$",
"params",
"=",
"[",
"'client_id'",
"=>",
"$",
"this",
"->",
"clientID",
",",
"'client_secret'",
"=>",
"$",
"this",
"->",
"secret",
",",
"'code'",
"=>",
"$",... | Convert a request token to an access token
@param string $token
@return mixed | [
"Convert",
"a",
"request",
"token",
"to",
"an",
"access",
"token"
] | 6bc4e7890580b7b31e78032e40be5a67122b0dd0 | https://github.com/Weblab-nl/restclient/blob/6bc4e7890580b7b31e78032e40be5a67122b0dd0/src/Adapters/OAuth.php#L291-L303 | train |
Dev4Media/ngnfeed-ebay | src/D4m/NgnFeed/Ebay/Serializer/Normalizer/GetSetMethodNormalizer.php | GetSetMethodNormalizer.setCallbacks | public function setCallbacks(array $callbacks)
{
foreach ($callbacks as $attribute => $callback) {
if (!is_callable($callback)) {
throw new \InvalidArgumentException(sprintf('The given callback for attribute "%s" is not callable.', $attribute));
}
}
$t... | php | public function setCallbacks(array $callbacks)
{
foreach ($callbacks as $attribute => $callback) {
if (!is_callable($callback)) {
throw new \InvalidArgumentException(sprintf('The given callback for attribute "%s" is not callable.', $attribute));
}
}
$t... | [
"public",
"function",
"setCallbacks",
"(",
"array",
"$",
"callbacks",
")",
"{",
"foreach",
"(",
"$",
"callbacks",
"as",
"$",
"attribute",
"=>",
"$",
"callback",
")",
"{",
"if",
"(",
"!",
"is_callable",
"(",
"$",
"callback",
")",
")",
"{",
"throw",
"new... | Set normalization callbacks
@param array $callbacks help normalize the result
@throws InvalidArgumentException if a non-callable callback is set | [
"Set",
"normalization",
"callbacks"
] | fb9652e30c7e4823a4e4dd571f41c8839953e72c | https://github.com/Dev4Media/ngnfeed-ebay/blob/fb9652e30c7e4823a4e4dd571f41c8839953e72c/src/D4m/NgnFeed/Ebay/Serializer/Normalizer/GetSetMethodNormalizer.php#L30-L38 | train |
Dev4Media/ngnfeed-ebay | src/D4m/NgnFeed/Ebay/Serializer/Normalizer/GetSetMethodNormalizer.php | GetSetMethodNormalizer.formatAttribute | protected function formatAttribute($attributeName)
{
if (in_array($attributeName, $this->camelizedAttributes)) {
return preg_replace_callback(
'/(^|_|\.)+(.)/', function ($match) {
return ('.' === $match[1] ? '_' : '').strtoupper($match[2]);
},... | php | protected function formatAttribute($attributeName)
{
if (in_array($attributeName, $this->camelizedAttributes)) {
return preg_replace_callback(
'/(^|_|\.)+(.)/', function ($match) {
return ('.' === $match[1] ? '_' : '').strtoupper($match[2]);
},... | [
"protected",
"function",
"formatAttribute",
"(",
"$",
"attributeName",
")",
"{",
"if",
"(",
"in_array",
"(",
"$",
"attributeName",
",",
"$",
"this",
"->",
"camelizedAttributes",
")",
")",
"{",
"return",
"preg_replace_callback",
"(",
"'/(^|_|\\.)+(.)/'",
",",
"fu... | Format attribute name to access parameters or methods
As option, if attribute name is found on camelizedAttributes array
returns attribute name in camelcase format
@param string $attributeName
@return string | [
"Format",
"attribute",
"name",
"to",
"access",
"parameters",
"or",
"methods",
"As",
"option",
"if",
"attribute",
"name",
"is",
"found",
"on",
"camelizedAttributes",
"array",
"returns",
"attribute",
"name",
"in",
"camelcase",
"format"
] | fb9652e30c7e4823a4e4dd571f41c8839953e72c | https://github.com/Dev4Media/ngnfeed-ebay/blob/fb9652e30c7e4823a4e4dd571f41c8839953e72c/src/D4m/NgnFeed/Ebay/Serializer/Normalizer/GetSetMethodNormalizer.php#L174-L185 | train |
realboard/DBInstance | src/Realboard/Component/Database/DBInstance/Service/RestServiceHandler.php | RestServiceHandler.getServerVersion | public function getServerVersion()
{
$di = new DBInstance($this->rawConfig);
$version = $di->getServerVersion();
unset($di);
return array(
'version' => $version,
);
} | php | public function getServerVersion()
{
$di = new DBInstance($this->rawConfig);
$version = $di->getServerVersion();
unset($di);
return array(
'version' => $version,
);
} | [
"public",
"function",
"getServerVersion",
"(",
")",
"{",
"$",
"di",
"=",
"new",
"DBInstance",
"(",
"$",
"this",
"->",
"rawConfig",
")",
";",
"$",
"version",
"=",
"$",
"di",
"->",
"getServerVersion",
"(",
")",
";",
"unset",
"(",
"$",
"di",
")",
";",
... | Get DBInstance database version.
@return array | [
"Get",
"DBInstance",
"database",
"version",
"."
] | f2cde7fdf480d5eb5a491a5cf81ff7f4b3be0a35 | https://github.com/realboard/DBInstance/blob/f2cde7fdf480d5eb5a491a5cf81ff7f4b3be0a35/src/Realboard/Component/Database/DBInstance/Service/RestServiceHandler.php#L132-L141 | train |
nilstr/Flash-Messages-for-Anax-MVC | src/FlashMessages/FlashMessages.php | FlashMessages.message | public function message($type, $message)
{
if ( $this->session->has('flashMessages') ) {
$flashMessages = $this->session->get('flashMessages');
$flashMessages[] = ['type' => $type, 'message' => $message];
$this->session->set('flashMessages', $flashMessages);
} els... | php | public function message($type, $message)
{
if ( $this->session->has('flashMessages') ) {
$flashMessages = $this->session->get('flashMessages');
$flashMessages[] = ['type' => $type, 'message' => $message];
$this->session->set('flashMessages', $flashMessages);
} els... | [
"public",
"function",
"message",
"(",
"$",
"type",
",",
"$",
"message",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"session",
"->",
"has",
"(",
"'flashMessages'",
")",
")",
"{",
"$",
"flashMessages",
"=",
"$",
"this",
"->",
"session",
"->",
"get",
"(",
... | Saves the message in the session.
@param string $type The type of flash message. Will be the class of the output div.
@param string $message The message to output.
@return void | [
"Saves",
"the",
"message",
"in",
"the",
"session",
"."
] | 7129241dd72a91eb0fcfe0e1d25144692334230c | https://github.com/nilstr/Flash-Messages-for-Anax-MVC/blob/7129241dd72a91eb0fcfe0e1d25144692334230c/src/FlashMessages/FlashMessages.php#L66-L75 | train |
nilstr/Flash-Messages-for-Anax-MVC | src/FlashMessages/FlashMessages.php | FlashMessages.output | public function output()
{
if ( $this->session->has('flashMessages') ) {
$flashMessages = $this->session->get('flashMessages');
$this->session->set('flashMessages', []);
$html = null;
foreach ($flashMessages as $message) {
$html .= "<div class=... | php | public function output()
{
if ( $this->session->has('flashMessages') ) {
$flashMessages = $this->session->get('flashMessages');
$this->session->set('flashMessages', []);
$html = null;
foreach ($flashMessages as $message) {
$html .= "<div class=... | [
"public",
"function",
"output",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"session",
"->",
"has",
"(",
"'flashMessages'",
")",
")",
"{",
"$",
"flashMessages",
"=",
"$",
"this",
"->",
"session",
"->",
"get",
"(",
"'flashMessages'",
")",
";",
"$",
"... | Gets and resets the flash messages from session and building html.
@return string The html for the output. | [
"Gets",
"and",
"resets",
"the",
"flash",
"messages",
"from",
"session",
"and",
"building",
"html",
"."
] | 7129241dd72a91eb0fcfe0e1d25144692334230c | https://github.com/nilstr/Flash-Messages-for-Anax-MVC/blob/7129241dd72a91eb0fcfe0e1d25144692334230c/src/FlashMessages/FlashMessages.php#L83-L94 | train |
mamasu/mama-log | src/log/Log.php | Log.elapsedTime | public function elapsedTime() {
$currentTime = microtime(true);
if ($this->startTime === null) {
$this->startTime = $currentTime;
$this->finishTime = $currentTime;
} else {
$this->finishTime = $currentTime;
$this->ela... | php | public function elapsedTime() {
$currentTime = microtime(true);
if ($this->startTime === null) {
$this->startTime = $currentTime;
$this->finishTime = $currentTime;
} else {
$this->finishTime = $currentTime;
$this->ela... | [
"public",
"function",
"elapsedTime",
"(",
")",
"{",
"$",
"currentTime",
"=",
"microtime",
"(",
"true",
")",
";",
"if",
"(",
"$",
"this",
"->",
"startTime",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"startTime",
"=",
"$",
"currentTime",
";",
"$",
"t... | Calculated the different time of the log line. | [
"Calculated",
"the",
"different",
"time",
"of",
"the",
"log",
"line",
"."
] | 86431258fc42a3f364af2d959382d43c2a2dd3a0 | https://github.com/mamasu/mama-log/blob/86431258fc42a3f364af2d959382d43c2a2dd3a0/src/log/Log.php#L54-L63 | train |
jmfeurprier/perf-caching | lib/perf/Caching/CacheClient.php | CacheClient.store | public function store($id, $data, $maxLifetimeSeconds = null)
{
$creationTimestamp = time();
if (null === $maxLifetimeSeconds) {
$expirationTimestamp = null;
} else {
$expirationTimestamp = ($creationTimestamp + (int) $maxLifetimeSeconds);
}
$entry =... | php | public function store($id, $data, $maxLifetimeSeconds = null)
{
$creationTimestamp = time();
if (null === $maxLifetimeSeconds) {
$expirationTimestamp = null;
} else {
$expirationTimestamp = ($creationTimestamp + (int) $maxLifetimeSeconds);
}
$entry =... | [
"public",
"function",
"store",
"(",
"$",
"id",
",",
"$",
"data",
",",
"$",
"maxLifetimeSeconds",
"=",
"null",
")",
"{",
"$",
"creationTimestamp",
"=",
"time",
"(",
")",
";",
"if",
"(",
"null",
"===",
"$",
"maxLifetimeSeconds",
")",
"{",
"$",
"expiratio... | Attempts to store provided content into cache. Cache file will hold creation and expiration timestamps,
and provided content.
@param mixed $id Cache item unique identifier (ex: 123).
@param mixed $data Content to be added to cache.
@param null|int $maxLifetimeSeconds (Optional) duration in seconds after which cache fi... | [
"Attempts",
"to",
"store",
"provided",
"content",
"into",
"cache",
".",
"Cache",
"file",
"will",
"hold",
"creation",
"and",
"expiration",
"timestamps",
"and",
"provided",
"content",
"."
] | 16cf61dae3aa4d6dcb8722e14760934457087173 | https://github.com/jmfeurprier/perf-caching/blob/16cf61dae3aa4d6dcb8722e14760934457087173/lib/perf/Caching/CacheClient.php#L62-L77 | train |
jmfeurprier/perf-caching | lib/perf/Caching/CacheClient.php | CacheClient.tryFetch | public function tryFetch($id, $maxLifetimeSeconds = null)
{
$entry = $this->storage->tryFetch($id);
if (null === $entry) {
return null;
}
if (null !== $maxLifetimeSeconds) {
if (($this->nowTimestamp - $entry->creationTimestamp()) > $maxLifetimeSeconds) {
... | php | public function tryFetch($id, $maxLifetimeSeconds = null)
{
$entry = $this->storage->tryFetch($id);
if (null === $entry) {
return null;
}
if (null !== $maxLifetimeSeconds) {
if (($this->nowTimestamp - $entry->creationTimestamp()) > $maxLifetimeSeconds) {
... | [
"public",
"function",
"tryFetch",
"(",
"$",
"id",
",",
"$",
"maxLifetimeSeconds",
"=",
"null",
")",
"{",
"$",
"entry",
"=",
"$",
"this",
"->",
"storage",
"->",
"tryFetch",
"(",
"$",
"id",
")",
";",
"if",
"(",
"null",
"===",
"$",
"entry",
")",
"{",
... | Attempts to retrieve data from cache.
@param mixed $id Cache entry unique identifier (ex: "123").
@param null|int $maxLifetimeSeconds Duration in seconds. If provided, will bypass expiration timestamp
in cache file, using creation timestamp + provided duration to check whether cached content has
expired or not.
@retur... | [
"Attempts",
"to",
"retrieve",
"data",
"from",
"cache",
"."
] | 16cf61dae3aa4d6dcb8722e14760934457087173 | https://github.com/jmfeurprier/perf-caching/blob/16cf61dae3aa4d6dcb8722e14760934457087173/lib/perf/Caching/CacheClient.php#L88-L109 | train |
silverorange/Concentrate | Concentrate/Concentrator.php | Concentrate_Concentrator.getDependsInfo | public function getDependsInfo()
{
$dependsInfo = $this->getCachedValue('dependsInfo');
if ($dependsInfo === false) {
$data = $this->dataProvider->getData();
$dependsInfo = array();
foreach ($this->getPackageSortOrder() as $packageId => $order) {
... | php | public function getDependsInfo()
{
$dependsInfo = $this->getCachedValue('dependsInfo');
if ($dependsInfo === false) {
$data = $this->dataProvider->getData();
$dependsInfo = array();
foreach ($this->getPackageSortOrder() as $packageId => $order) {
... | [
"public",
"function",
"getDependsInfo",
"(",
")",
"{",
"$",
"dependsInfo",
"=",
"$",
"this",
"->",
"getCachedValue",
"(",
"'dependsInfo'",
")",
";",
"if",
"(",
"$",
"dependsInfo",
"===",
"false",
")",
"{",
"$",
"data",
"=",
"$",
"this",
"->",
"dataProvid... | Gets a flat list of file dependencies for each file
@return array | [
"Gets",
"a",
"flat",
"list",
"of",
"file",
"dependencies",
"for",
"each",
"file"
] | e0b679bedc105dc4280bb68a233c31246d20e6c5 | https://github.com/silverorange/Concentrate/blob/e0b679bedc105dc4280bb68a233c31246d20e6c5/Concentrate/Concentrator.php#L454-L494 | train |
freialib/freia.autoloader | src/SymbolLoader.php | SymbolLoader.instance | static function instance($syspath, $conf) {
$i = new static;
$i->env = $i->environementInstance($syspath, $conf);
return $i;
} | php | static function instance($syspath, $conf) {
$i = new static;
$i->env = $i->environementInstance($syspath, $conf);
return $i;
} | [
"static",
"function",
"instance",
"(",
"$",
"syspath",
",",
"$",
"conf",
")",
"{",
"$",
"i",
"=",
"new",
"static",
";",
"$",
"i",
"->",
"env",
"=",
"$",
"i",
"->",
"environementInstance",
"(",
"$",
"syspath",
",",
"$",
"conf",
")",
";",
"return",
... | You may set debugMode to true to use debug modules, otherwise if modules
with a debug type in the autoload rules section are found they will be
ignored.
@return static | [
"You",
"may",
"set",
"debugMode",
"to",
"true",
"to",
"use",
"debug",
"modules",
"otherwise",
"if",
"modules",
"with",
"a",
"debug",
"type",
"in",
"the",
"autoload",
"rules",
"section",
"are",
"found",
"they",
"will",
"be",
"ignored",
"."
] | 45e0dfcd56d55cf533f12255db647e8a05fcd494 | https://github.com/freialib/freia.autoloader/blob/45e0dfcd56d55cf533f12255db647e8a05fcd494/src/SymbolLoader.php#L24-L29 | train |
freialib/freia.autoloader | src/SymbolLoader.php | SymbolLoader.exists | function exists($symbol, $autoload = false) {
return class_exists($symbol, $autoload)
|| interface_exists($symbol, $autoload)
|| trait_exists($symbol, $autoload);
} | php | function exists($symbol, $autoload = false) {
return class_exists($symbol, $autoload)
|| interface_exists($symbol, $autoload)
|| trait_exists($symbol, $autoload);
} | [
"function",
"exists",
"(",
"$",
"symbol",
",",
"$",
"autoload",
"=",
"false",
")",
"{",
"return",
"class_exists",
"(",
"$",
"symbol",
",",
"$",
"autoload",
")",
"||",
"interface_exists",
"(",
"$",
"symbol",
",",
"$",
"autoload",
")",
"||",
"trait_exists"... | Maintained for backwards comaptibility.
@param string symbol (class, interface, traits, etc)
@param boolean autoload while checking?
@return boolean symbol exists | [
"Maintained",
"for",
"backwards",
"comaptibility",
"."
] | 45e0dfcd56d55cf533f12255db647e8a05fcd494 | https://github.com/freialib/freia.autoloader/blob/45e0dfcd56d55cf533f12255db647e8a05fcd494/src/SymbolLoader.php#L48-L52 | train |
freialib/freia.autoloader | src/SymbolLoader.php | SymbolLoader.load | function load($symbol) {
if ($this->env->knownUnknown($symbol)) {
return false;
}
if ($this->env->autoresolve($symbol)) {
return true;
}
$ns_pos = \strripos($symbol, '\\');
if ($ns_pos !== false && $ns_pos != 0) {
$ns = \substr($symbol, 0, $ns_pos + 1);
// Validate Main Segment
// ======... | php | function load($symbol) {
if ($this->env->knownUnknown($symbol)) {
return false;
}
if ($this->env->autoresolve($symbol)) {
return true;
}
$ns_pos = \strripos($symbol, '\\');
if ($ns_pos !== false && $ns_pos != 0) {
$ns = \substr($symbol, 0, $ns_pos + 1);
// Validate Main Segment
// ======... | [
"function",
"load",
"(",
"$",
"symbol",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"env",
"->",
"knownUnknown",
"(",
"$",
"symbol",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"env",
"->",
"autoresolve",
"(",
"$",
"symb... | Load given symbol
@return boolean | [
"Load",
"given",
"symbol"
] | 45e0dfcd56d55cf533f12255db647e8a05fcd494 | https://github.com/freialib/freia.autoloader/blob/45e0dfcd56d55cf533f12255db647e8a05fcd494/src/SymbolLoader.php#L59-L141 | train |
Wedeto/HTTP | src/CachePolicy.php | CachePolicy.setExpireDate | public function setExpireDate(DateTimeInterface $dt)
{
$this->expire_time = (int)$dt->format('U') - time();
return $this;
} | php | public function setExpireDate(DateTimeInterface $dt)
{
$this->expire_time = (int)$dt->format('U') - time();
return $this;
} | [
"public",
"function",
"setExpireDate",
"(",
"DateTimeInterface",
"$",
"dt",
")",
"{",
"$",
"this",
"->",
"expire_time",
"=",
"(",
"int",
")",
"$",
"dt",
"->",
"format",
"(",
"'U'",
")",
"-",
"time",
"(",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Set the exact moment when the cache should expire.
@param DateTimeInterface $dt When the cache should expire
@return CachePolicy Provides fluent interface | [
"Set",
"the",
"exact",
"moment",
"when",
"the",
"cache",
"should",
"expire",
"."
] | 7318eff1b81a3c103c4263466d09b7f3593b70b9 | https://github.com/Wedeto/HTTP/blob/7318eff1b81a3c103c4263466d09b7f3593b70b9/src/CachePolicy.php#L58-L62 | train |
Wedeto/HTTP | src/CachePolicy.php | CachePolicy.setExpiresIn | public function setExpiresIn(DateInterval $interval)
{
$now = new DateTimeImmutable();
$expire = $now->add($interval);
$this->setExpiresInSeconds($expire->getTimestamp() - $now->getTimestamp());
return $this;
} | php | public function setExpiresIn(DateInterval $interval)
{
$now = new DateTimeImmutable();
$expire = $now->add($interval);
$this->setExpiresInSeconds($expire->getTimestamp() - $now->getTimestamp());
return $this;
} | [
"public",
"function",
"setExpiresIn",
"(",
"DateInterval",
"$",
"interval",
")",
"{",
"$",
"now",
"=",
"new",
"DateTimeImmutable",
"(",
")",
";",
"$",
"expire",
"=",
"$",
"now",
"->",
"add",
"(",
"$",
"interval",
")",
";",
"$",
"this",
"->",
"setExpire... | Set the time until the cache should expire.
@param DateInterval $interval In what time the cache should expire.
@return CachePolicy Provides fluent interface | [
"Set",
"the",
"time",
"until",
"the",
"cache",
"should",
"expire",
"."
] | 7318eff1b81a3c103c4263466d09b7f3593b70b9 | https://github.com/Wedeto/HTTP/blob/7318eff1b81a3c103c4263466d09b7f3593b70b9/src/CachePolicy.php#L80-L86 | train |
Wedeto/HTTP | src/CachePolicy.php | CachePolicy.setExpires | public function setExpires($period)
{
if (is_int($period))
return $this->setExpiresInSeconds($period);
if ($period instanceof DateTimeInterface)
return $this->setExpireDate($period);
if ($period instanceof DateInterval)
return $this->setExpiresIn($period);... | php | public function setExpires($period)
{
if (is_int($period))
return $this->setExpiresInSeconds($period);
if ($period instanceof DateTimeInterface)
return $this->setExpireDate($period);
if ($period instanceof DateInterval)
return $this->setExpiresIn($period);... | [
"public",
"function",
"setExpires",
"(",
"$",
"period",
")",
"{",
"if",
"(",
"is_int",
"(",
"$",
"period",
")",
")",
"return",
"$",
"this",
"->",
"setExpiresInSeconds",
"(",
"$",
"period",
")",
";",
"if",
"(",
"$",
"period",
"instanceof",
"DateTimeInterf... | Set the when the cache should expire. Wrapper for setExpiresIn,
setExpiresInSeconds and setExpireDate, with type detection.
@param mixed $period Can be int (seconds), DateTimeInterface or DateInterval.
@return CachePolicy Provides fluent interface | [
"Set",
"the",
"when",
"the",
"cache",
"should",
"expire",
".",
"Wrapper",
"for",
"setExpiresIn",
"setExpiresInSeconds",
"and",
"setExpireDate",
"with",
"type",
"detection",
"."
] | 7318eff1b81a3c103c4263466d09b7f3593b70b9 | https://github.com/Wedeto/HTTP/blob/7318eff1b81a3c103c4263466d09b7f3593b70b9/src/CachePolicy.php#L95-L105 | train |
Wedeto/HTTP | src/CachePolicy.php | CachePolicy.setCachePolicy | public function setCachePolicy(string $policy)
{
if ($policy !== self::CACHE_DISABLE && $policy !== self::CACHE_PUBLIC && $policy !== self::CACHE_PRIVATE)
throw new \InvalidArgumentException("Invalid cache policy: " . $policy);
$this->cache_policy = $policy;
return $this;
} | php | public function setCachePolicy(string $policy)
{
if ($policy !== self::CACHE_DISABLE && $policy !== self::CACHE_PUBLIC && $policy !== self::CACHE_PRIVATE)
throw new \InvalidArgumentException("Invalid cache policy: " . $policy);
$this->cache_policy = $policy;
return $this;
} | [
"public",
"function",
"setCachePolicy",
"(",
"string",
"$",
"policy",
")",
"{",
"if",
"(",
"$",
"policy",
"!==",
"self",
"::",
"CACHE_DISABLE",
"&&",
"$",
"policy",
"!==",
"self",
"::",
"CACHE_PUBLIC",
"&&",
"$",
"policy",
"!==",
"self",
"::",
"CACHE_PRIVA... | Set the cache policy for this response.
@param string $policy One of CachePolicy::CACHE_PUBLIC, CACHE_PRIVATE or CACHE_DISABLED.
@return CachePolicy Provides fluent interface | [
"Set",
"the",
"cache",
"policy",
"for",
"this",
"response",
"."
] | 7318eff1b81a3c103c4263466d09b7f3593b70b9 | https://github.com/Wedeto/HTTP/blob/7318eff1b81a3c103c4263466d09b7f3593b70b9/src/CachePolicy.php#L120-L127 | train |
Vectrex/vxPHP | src/Form/FormElement/LabelElement.php | LabelElement.setAttribute | public function setAttribute($attr, $value)
{
$attr = strtolower($attr);
if(is_null($value)) {
unset($this->attributes[$attr]);
}
else {
$this->attributes[$attr] = $value;
}
return $this;
} | php | public function setAttribute($attr, $value)
{
$attr = strtolower($attr);
if(is_null($value)) {
unset($this->attributes[$attr]);
}
else {
$this->attributes[$attr] = $value;
}
return $this;
} | [
"public",
"function",
"setAttribute",
"(",
"$",
"attr",
",",
"$",
"value",
")",
"{",
"$",
"attr",
"=",
"strtolower",
"(",
"$",
"attr",
")",
";",
"if",
"(",
"is_null",
"(",
"$",
"value",
")",
")",
"{",
"unset",
"(",
"$",
"this",
"->",
"attributes",
... | sets attributes of form label
@param string $attr
@param string $value
@return LabelElement | [
"sets",
"attributes",
"of",
"form",
"label"
] | 295c21b00e7ef6085efcdf5b64fabb28d499b5a6 | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Form/FormElement/LabelElement.php#L80-L94 | train |
Vectrex/vxPHP | src/Form/FormElement/LabelElement.php | LabelElement.render | public function render()
{
$attr = [];
foreach($this->attributes as $k => $v) {
$attr[] = sprintf('%s="%s"', $k, $v);
}
return sprintf('<label %s>%s</label>',
implode(' ', $attr),
trim($this->labelText)
);
} | php | public function render()
{
$attr = [];
foreach($this->attributes as $k => $v) {
$attr[] = sprintf('%s="%s"', $k, $v);
}
return sprintf('<label %s>%s</label>',
implode(' ', $attr),
trim($this->labelText)
);
} | [
"public",
"function",
"render",
"(",
")",
"{",
"$",
"attr",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"attributes",
"as",
"$",
"k",
"=>",
"$",
"v",
")",
"{",
"$",
"attr",
"[",
"]",
"=",
"sprintf",
"(",
"'%s=\"%s\"'",
",",
"$",
"k",... | render the label element
if a form element was assigned a
matching "for" attribute can be generated
@return string | [
"render",
"the",
"label",
"element",
"if",
"a",
"form",
"element",
"was",
"assigned",
"a",
"matching",
"for",
"attribute",
"can",
"be",
"generated"
] | 295c21b00e7ef6085efcdf5b64fabb28d499b5a6 | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Form/FormElement/LabelElement.php#L119-L133 | train |
DeimosProject/Helper | src/Helper/Helpers/Str/Str.php | Str.translit | public function translit($string)
{
$string = \strtr($string, $this->transliterationTable);
return \iconv(\mb_internal_encoding(), 'ASCII//TRANSLIT', $string);
} | php | public function translit($string)
{
$string = \strtr($string, $this->transliterationTable);
return \iconv(\mb_internal_encoding(), 'ASCII//TRANSLIT', $string);
} | [
"public",
"function",
"translit",
"(",
"$",
"string",
")",
"{",
"$",
"string",
"=",
"\\",
"strtr",
"(",
"$",
"string",
",",
"$",
"this",
"->",
"transliterationTable",
")",
";",
"return",
"\\",
"iconv",
"(",
"\\",
"mb_internal_encoding",
"(",
")",
",",
... | transliteration cyr->lat
@param $string
@return string | [
"transliteration",
"cyr",
"-",
">",
"lat"
] | 39c67de21a87c7c6391b2f98416063f41c94e26f | https://github.com/DeimosProject/Helper/blob/39c67de21a87c7c6391b2f98416063f41c94e26f/src/Helper/Helpers/Str/Str.php#L231-L236 | train |
eureka-framework/component-template | src/Template/Block.php | Block.end | public function end($name, $append = true)
{
$content = trim(ob_get_contents());
ob_end_clean();
$hash = md5($content);
if (isset($this->hashCache[$hash])) {
return;
}
$this->hashCache[$hash] = true;
if (isset($this->blocks[$name]) && $append) ... | php | public function end($name, $append = true)
{
$content = trim(ob_get_contents());
ob_end_clean();
$hash = md5($content);
if (isset($this->hashCache[$hash])) {
return;
}
$this->hashCache[$hash] = true;
if (isset($this->blocks[$name]) && $append) ... | [
"public",
"function",
"end",
"(",
"$",
"name",
",",
"$",
"append",
"=",
"true",
")",
"{",
"$",
"content",
"=",
"trim",
"(",
"ob_get_contents",
"(",
")",
")",
";",
"ob_end_clean",
"(",
")",
";",
"$",
"hash",
"=",
"md5",
"(",
"$",
"content",
")",
"... | End to catch block and save it.
@param string $name
@param bool $append Append content to previous block. Otherwise, reset content.
@return void | [
"End",
"to",
"catch",
"block",
"and",
"save",
"it",
"."
] | 42e9b3954b79892ba340ba7ca909f03ee99c36fe | https://github.com/eureka-framework/component-template/blob/42e9b3954b79892ba340ba7ca909f03ee99c36fe/src/Template/Block.php#L94-L112 | train |
praxigento/mobi_mod_downline | Plugin/Magento/Framework/App/FrontControllerInterface.php | FrontControllerInterface.beforeDispatch | public function beforeDispatch(
\Magento\Framework\App\FrontControllerInterface $subject,
\Magento\Framework\App\RequestInterface $request
) {
$code = $request->getParam(static::REQ_REFERRAL);
if (!empty($code)) {
$this->session->logout();
}
$this->hlpRefC... | php | public function beforeDispatch(
\Magento\Framework\App\FrontControllerInterface $subject,
\Magento\Framework\App\RequestInterface $request
) {
$code = $request->getParam(static::REQ_REFERRAL);
if (!empty($code)) {
$this->session->logout();
}
$this->hlpRefC... | [
"public",
"function",
"beforeDispatch",
"(",
"\\",
"Magento",
"\\",
"Framework",
"\\",
"App",
"\\",
"FrontControllerInterface",
"$",
"subject",
",",
"\\",
"Magento",
"\\",
"Framework",
"\\",
"App",
"\\",
"RequestInterface",
"$",
"request",
")",
"{",
"$",
"code... | Extract referral code from GET-variable or cookie and save it into registry.
@param \Magento\Framework\App\FrontControllerInterface $subject
@param \Magento\Framework\App\RequestInterface $request | [
"Extract",
"referral",
"code",
"from",
"GET",
"-",
"variable",
"or",
"cookie",
"and",
"save",
"it",
"into",
"registry",
"."
] | 0f3c276dfff1aa029f9fd205ccfc56f207a2e75b | https://github.com/praxigento/mobi_mod_downline/blob/0f3c276dfff1aa029f9fd205ccfc56f207a2e75b/Plugin/Magento/Framework/App/FrontControllerInterface.php#L34-L43 | train |
jabernardo/lollipop-php | Library/Utils/Vars.php | Vars.fuse | static function fuse(&$opt1, $opt2) {
return isset($opt1) ? $opt1 : (isset($opt2) ? $opt2 : null);
} | php | static function fuse(&$opt1, $opt2) {
return isset($opt1) ? $opt1 : (isset($opt2) ? $opt2 : null);
} | [
"static",
"function",
"fuse",
"(",
"&",
"$",
"opt1",
",",
"$",
"opt2",
")",
"{",
"return",
"isset",
"(",
"$",
"opt1",
")",
"?",
"$",
"opt1",
":",
"(",
"isset",
"(",
"$",
"opt2",
")",
"?",
"$",
"opt2",
":",
"null",
")",
";",
"}"
] | Alternate a value to undefined variable
@param reference &$opt1 Variable
@param mixed $opt2 Alternative value
@return mixed | [
"Alternate",
"a",
"value",
"to",
"undefined",
"variable"
] | 004d80b21f7246bb3e08c7b9f74a165b0d3ca0f5 | https://github.com/jabernardo/lollipop-php/blob/004d80b21f7246bb3e08c7b9f74a165b0d3ca0f5/Library/Utils/Vars.php#L23-L25 | train |
Vectrex/vxPHP | src/Template/TemplateBuffer.php | TemplateBuffer.includeFile | public function includeFile($templateFilename) {
/* @deprecated use $this when accessing assigned variables */
$tpl = $this;
eval('?>' .
file_get_contents(Application::getInstance()->getRootPath() .
(defined('TPL_PATH') ? str_replace('/', DIRECTORY_SEPARATOR, ltrim... | php | public function includeFile($templateFilename) {
/* @deprecated use $this when accessing assigned variables */
$tpl = $this;
eval('?>' .
file_get_contents(Application::getInstance()->getRootPath() .
(defined('TPL_PATH') ? str_replace('/', DIRECTORY_SEPARATOR, ltrim... | [
"public",
"function",
"includeFile",
"(",
"$",
"templateFilename",
")",
"{",
"/* @deprecated use $this when accessing assigned variables */",
"$",
"tpl",
"=",
"$",
"this",
";",
"eval",
"(",
"'?>'",
".",
"file_get_contents",
"(",
"Application",
"::",
"getInstance",
"("... | include another template file
does only path handling
included files are within the same scope as the including file
@param string $templateFilename
@throws \vxPHP\Application\Exception\ApplicationException | [
"include",
"another",
"template",
"file",
"does",
"only",
"path",
"handling",
"included",
"files",
"are",
"within",
"the",
"same",
"scope",
"as",
"the",
"including",
"file"
] | 295c21b00e7ef6085efcdf5b64fabb28d499b5a6 | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Template/TemplateBuffer.php#L44-L56 | train |
n2n/n2n-io | src/app/n2n/io/fs/FsPath.php | FsPath.createFile | public function createFile($perm) {
if ($this->isFile()) return false;
IoUtils::touch($this->path);
IoUtils::chmod($this->path, $perm);
return true;
} | php | public function createFile($perm) {
if ($this->isFile()) return false;
IoUtils::touch($this->path);
IoUtils::chmod($this->path, $perm);
return true;
} | [
"public",
"function",
"createFile",
"(",
"$",
"perm",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isFile",
"(",
")",
")",
"return",
"false",
";",
"IoUtils",
"::",
"touch",
"(",
"$",
"this",
"->",
"path",
")",
";",
"IoUtils",
"::",
"chmod",
"(",
"$",
... | Atomically creates a new, empty file named by this abstract path if and only if a file with this name does not yet exist.
@return bool true if the named file does not exist and was successfully created; false if the named file already exists | [
"Atomically",
"creates",
"a",
"new",
"empty",
"file",
"named",
"by",
"this",
"abstract",
"path",
"if",
"and",
"only",
"if",
"a",
"file",
"with",
"this",
"name",
"does",
"not",
"yet",
"exist",
"."
] | ff642e195f0c0db1273b6c067eff1192cf2cd987 | https://github.com/n2n/n2n-io/blob/ff642e195f0c0db1273b6c067eff1192cf2cd987/src/app/n2n/io/fs/FsPath.php#L158-L165 | train |
phpffcms/ffcms-core | src/Helper/Mailer.php | Mailer.tpl | public function tpl(string $tpl, ?array $params = [], ?string $dir = null)
{
try {
$this->message = App::$View->render($tpl, $params, $dir);
} catch (SyntaxException $e) {
}
return $this;
} | php | public function tpl(string $tpl, ?array $params = [], ?string $dir = null)
{
try {
$this->message = App::$View->render($tpl, $params, $dir);
} catch (SyntaxException $e) {
}
return $this;
} | [
"public",
"function",
"tpl",
"(",
"string",
"$",
"tpl",
",",
"?",
"array",
"$",
"params",
"=",
"[",
"]",
",",
"?",
"string",
"$",
"dir",
"=",
"null",
")",
"{",
"try",
"{",
"$",
"this",
"->",
"message",
"=",
"App",
"::",
"$",
"View",
"->",
"rend... | Set tpl file
@param string $tpl
@param array|null $params
@param null|string $dir
@return $this | [
"Set",
"tpl",
"file"
] | 44a309553ef9f115ccfcfd71f2ac6e381c612082 | https://github.com/phpffcms/ffcms-core/blob/44a309553ef9f115ccfcfd71f2ac6e381c612082/src/Helper/Mailer.php#L49-L56 | train |
phpffcms/ffcms-core | src/Helper/Mailer.php | Mailer.send | public function send(string $address, string $subject, ?string $message = null): bool
{
// try to get message from global if not passed direct
if ($message === null) {
$message = $this->message;
}
try {
if ($message === null) {
throw new \Exce... | php | public function send(string $address, string $subject, ?string $message = null): bool
{
// try to get message from global if not passed direct
if ($message === null) {
$message = $this->message;
}
try {
if ($message === null) {
throw new \Exce... | [
"public",
"function",
"send",
"(",
"string",
"$",
"address",
",",
"string",
"$",
"subject",
",",
"?",
"string",
"$",
"message",
"=",
"null",
")",
":",
"bool",
"{",
"// try to get message from global if not passed direct",
"if",
"(",
"$",
"message",
"===",
"nul... | Set mail to address
@param string $address
@param string $subject
@param null|string $message
@return bool | [
"Set",
"mail",
"to",
"address"
] | 44a309553ef9f115ccfcfd71f2ac6e381c612082 | https://github.com/phpffcms/ffcms-core/blob/44a309553ef9f115ccfcfd71f2ac6e381c612082/src/Helper/Mailer.php#L65-L91 | train |
agentmedia/phine-core | src/Core/Modules/Backend/LayoutForm.php | LayoutForm.Init | protected function Init()
{
$this->layout = new Layout(Request::GetData('layout'));
$this->layoutRights = new LayoutRights($this->layout->GetUserGroupRights());
$this->InitAreas();
$this->AddNameField();
$this->AddAreasField();
$this->AddUserGroupField();
$thi... | php | protected function Init()
{
$this->layout = new Layout(Request::GetData('layout'));
$this->layoutRights = new LayoutRights($this->layout->GetUserGroupRights());
$this->InitAreas();
$this->AddNameField();
$this->AddAreasField();
$this->AddUserGroupField();
$thi... | [
"protected",
"function",
"Init",
"(",
")",
"{",
"$",
"this",
"->",
"layout",
"=",
"new",
"Layout",
"(",
"Request",
"::",
"GetData",
"(",
"'layout'",
")",
")",
";",
"$",
"this",
"->",
"layoutRights",
"=",
"new",
"LayoutRights",
"(",
"$",
"this",
"->",
... | Initializes the layout form
@return boolea | [
"Initializes",
"the",
"layout",
"form"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Modules/Backend/LayoutForm.php#L58-L68 | train |
agentmedia/phine-core | src/Core/Modules/Backend/LayoutForm.php | LayoutForm.AddAreasField | private function AddAreasField()
{
$name = 'Areas';
$field = Input::Text($name, join(', ' , $this->areaNames));
$this->AddField($field);
if ($this->layout->Exists())
{
$field->SetHtmlAttribute('readonly', 'readonly');
}
else
{
$... | php | private function AddAreasField()
{
$name = 'Areas';
$field = Input::Text($name, join(', ' , $this->areaNames));
$this->AddField($field);
if ($this->layout->Exists())
{
$field->SetHtmlAttribute('readonly', 'readonly');
}
else
{
$... | [
"private",
"function",
"AddAreasField",
"(",
")",
"{",
"$",
"name",
"=",
"'Areas'",
";",
"$",
"field",
"=",
"Input",
"::",
"Text",
"(",
"$",
"name",
",",
"join",
"(",
"', '",
",",
"$",
"this",
"->",
"areaNames",
")",
")",
";",
"$",
"this",
"->",
... | Adds the server path field to the form | [
"Adds",
"the",
"server",
"path",
"field",
"to",
"the",
"form"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Modules/Backend/LayoutForm.php#L132-L146 | train |
agentmedia/phine-core | src/Core/Modules/Backend/LayoutForm.php | LayoutForm.OnSuccess | protected function OnSuccess()
{
$action = Action::Update();
$isNew = !$this->layout->Exists();
if ($isNew)
{
$action = Action::Create();
$this->layout->SetUser(self::Guard()->GetUser());
}
$oldFile = $isNew ? '' : PathUtil::LayoutTemplate($thi... | php | protected function OnSuccess()
{
$action = Action::Update();
$isNew = !$this->layout->Exists();
if ($isNew)
{
$action = Action::Create();
$this->layout->SetUser(self::Guard()->GetUser());
}
$oldFile = $isNew ? '' : PathUtil::LayoutTemplate($thi... | [
"protected",
"function",
"OnSuccess",
"(",
")",
"{",
"$",
"action",
"=",
"Action",
"::",
"Update",
"(",
")",
";",
"$",
"isNew",
"=",
"!",
"$",
"this",
"->",
"layout",
"->",
"Exists",
"(",
")",
";",
"if",
"(",
"$",
"isNew",
")",
"{",
"$",
"action"... | Saves the layout | [
"Saves",
"the",
"layout"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Modules/Backend/LayoutForm.php#L151-L176 | train |
itkg/core | src/Itkg/Core/CollectionAbstract.php | CollectionAbstract.getById | public function getById($id)
{
if (isset($this->elements[$id])) {
return $this->elements[$id];
}
throw new \InvalidArgumentException(sprintf('Element for id %s does not exist', $id));
} | php | public function getById($id)
{
if (isset($this->elements[$id])) {
return $this->elements[$id];
}
throw new \InvalidArgumentException(sprintf('Element for id %s does not exist', $id));
} | [
"public",
"function",
"getById",
"(",
"$",
"id",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"elements",
"[",
"$",
"id",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"elements",
"[",
"$",
"id",
"]",
";",
"}",
"throw",
"new",
"\\",... | Get an entity by its ID
@param $id
@return EntityAbstract
@throws \InvalidArgumentException | [
"Get",
"an",
"entity",
"by",
"its",
"ID"
] | e5e4efb05feb4d23b0df41f2b21fd095103e593b | https://github.com/itkg/core/blob/e5e4efb05feb4d23b0df41f2b21fd095103e593b/src/Itkg/Core/CollectionAbstract.php#L47-L54 | train |
ekyna/PaymentBundle | Form/EventListener/BuildConfigSubscriber.php | BuildConfigSubscriber.buildConfigField | public function buildConfigField(FormEvent $event)
{
/** @var array $data */
$data = $event->getData();
if (is_null($data)) {
return;
}
$propertyPath = is_array($data) ? '[factoryName]' : 'factoryName';
$factoryName = PropertyAccess::createPropertyAccesso... | php | public function buildConfigField(FormEvent $event)
{
/** @var array $data */
$data = $event->getData();
if (is_null($data)) {
return;
}
$propertyPath = is_array($data) ? '[factoryName]' : 'factoryName';
$factoryName = PropertyAccess::createPropertyAccesso... | [
"public",
"function",
"buildConfigField",
"(",
"FormEvent",
"$",
"event",
")",
"{",
"/** @var array $data */",
"$",
"data",
"=",
"$",
"event",
"->",
"getData",
"(",
")",
";",
"if",
"(",
"is_null",
"(",
"$",
"data",
")",
")",
"{",
"return",
";",
"}",
"$... | Builds the config field.
@param FormEvent $event | [
"Builds",
"the",
"config",
"field",
"."
] | 1b4f4103b28e3a4f8dbfac2cbd872d728238f4d1 | https://github.com/ekyna/PaymentBundle/blob/1b4f4103b28e3a4f8dbfac2cbd872d728238f4d1/Form/EventListener/BuildConfigSubscriber.php#L38-L90 | train |
Finesse/QueryScribe | src/QueryBricks/JoinTrait.php | JoinTrait.innerJoin | public function innerJoin($table, ...$criterion): self
{
$this->join[] = $this->joinArgumentsToJoinObject('INNER', $table, $criterion);
return $this;
} | php | public function innerJoin($table, ...$criterion): self
{
$this->join[] = $this->joinArgumentsToJoinObject('INNER', $table, $criterion);
return $this;
} | [
"public",
"function",
"innerJoin",
"(",
"$",
"table",
",",
"...",
"$",
"criterion",
")",
":",
"self",
"{",
"$",
"this",
"->",
"join",
"[",
"]",
"=",
"$",
"this",
"->",
"joinArgumentsToJoinObject",
"(",
"'INNER'",
",",
"$",
"table",
",",
"$",
"criterion... | Adds a table joined with the "inner" rule.
The first argument is a table name or an array where the first value is a table name and the second value is the
table alias name.
The rest arguments may have one of the following formats:
- column1, rule, column1 — column compared to another column by the given rule. Includ... | [
"Adds",
"a",
"table",
"joined",
"with",
"the",
"inner",
"rule",
"."
] | 4edba721e37693780d142229b3ecb0cd4004c7a5 | https://github.com/Finesse/QueryScribe/blob/4edba721e37693780d142229b3ecb0cd4004c7a5/src/QueryBricks/JoinTrait.php#L58-L62 | train |
Finesse/QueryScribe | src/QueryBricks/JoinTrait.php | JoinTrait.outerJoin | public function outerJoin($table, ...$criterion): self
{
$this->join[] = $this->joinArgumentsToJoinObject('OUTER', $table, $criterion);
return $this;
} | php | public function outerJoin($table, ...$criterion): self
{
$this->join[] = $this->joinArgumentsToJoinObject('OUTER', $table, $criterion);
return $this;
} | [
"public",
"function",
"outerJoin",
"(",
"$",
"table",
",",
"...",
"$",
"criterion",
")",
":",
"self",
"{",
"$",
"this",
"->",
"join",
"[",
"]",
"=",
"$",
"this",
"->",
"joinArgumentsToJoinObject",
"(",
"'OUTER'",
",",
"$",
"table",
",",
"$",
"criterion... | Adds a table joined with the "outer" rule.
@see innerJoin The arguments format
@return $this
@throws InvalidArgumentException
@throws InvalidReturnValueException | [
"Adds",
"a",
"table",
"joined",
"with",
"the",
"outer",
"rule",
"."
] | 4edba721e37693780d142229b3ecb0cd4004c7a5 | https://github.com/Finesse/QueryScribe/blob/4edba721e37693780d142229b3ecb0cd4004c7a5/src/QueryBricks/JoinTrait.php#L72-L76 | train |
Finesse/QueryScribe | src/QueryBricks/JoinTrait.php | JoinTrait.leftJoin | public function leftJoin($table, ...$criterion): self
{
$this->join[] = $this->joinArgumentsToJoinObject('LEFT', $table, $criterion);
return $this;
} | php | public function leftJoin($table, ...$criterion): self
{
$this->join[] = $this->joinArgumentsToJoinObject('LEFT', $table, $criterion);
return $this;
} | [
"public",
"function",
"leftJoin",
"(",
"$",
"table",
",",
"...",
"$",
"criterion",
")",
":",
"self",
"{",
"$",
"this",
"->",
"join",
"[",
"]",
"=",
"$",
"this",
"->",
"joinArgumentsToJoinObject",
"(",
"'LEFT'",
",",
"$",
"table",
",",
"$",
"criterion",... | Adds a table joined with the "left" rule.
@see innerJoin The arguments format
@return $this
@throws InvalidArgumentException
@throws InvalidReturnValueException | [
"Adds",
"a",
"table",
"joined",
"with",
"the",
"left",
"rule",
"."
] | 4edba721e37693780d142229b3ecb0cd4004c7a5 | https://github.com/Finesse/QueryScribe/blob/4edba721e37693780d142229b3ecb0cd4004c7a5/src/QueryBricks/JoinTrait.php#L86-L90 | train |
Finesse/QueryScribe | src/QueryBricks/JoinTrait.php | JoinTrait.rightJoin | public function rightJoin($table, ...$criterion): self
{
$this->join[] = $this->joinArgumentsToJoinObject('RIGHT', $table, $criterion);
return $this;
} | php | public function rightJoin($table, ...$criterion): self
{
$this->join[] = $this->joinArgumentsToJoinObject('RIGHT', $table, $criterion);
return $this;
} | [
"public",
"function",
"rightJoin",
"(",
"$",
"table",
",",
"...",
"$",
"criterion",
")",
":",
"self",
"{",
"$",
"this",
"->",
"join",
"[",
"]",
"=",
"$",
"this",
"->",
"joinArgumentsToJoinObject",
"(",
"'RIGHT'",
",",
"$",
"table",
",",
"$",
"criterion... | Adds a table joined with the "right" rule.
@see innerJoin The arguments format
@return $this
@throws InvalidArgumentException
@throws InvalidReturnValueException | [
"Adds",
"a",
"table",
"joined",
"with",
"the",
"right",
"rule",
"."
] | 4edba721e37693780d142229b3ecb0cd4004c7a5 | https://github.com/Finesse/QueryScribe/blob/4edba721e37693780d142229b3ecb0cd4004c7a5/src/QueryBricks/JoinTrait.php#L100-L104 | train |
Finesse/QueryScribe | src/QueryBricks/JoinTrait.php | JoinTrait.joinArgumentsToJoinObject | protected function joinArgumentsToJoinObject(string $type, $table, array $criterion = []): Join
{
if (is_array($table)) {
$tableName = $table[0] ?? null;
$tableAlias = $table[1] ?? null;
} else {
$tableName = $table;
$tableAlias = null;
}
... | php | protected function joinArgumentsToJoinObject(string $type, $table, array $criterion = []): Join
{
if (is_array($table)) {
$tableName = $table[0] ?? null;
$tableAlias = $table[1] ?? null;
} else {
$tableName = $table;
$tableAlias = null;
}
... | [
"protected",
"function",
"joinArgumentsToJoinObject",
"(",
"string",
"$",
"type",
",",
"$",
"table",
",",
"array",
"$",
"criterion",
"=",
"[",
"]",
")",
":",
"Join",
"{",
"if",
"(",
"is_array",
"(",
"$",
"table",
")",
")",
"{",
"$",
"tableName",
"=",
... | Converts `join` method arguments to a join object
@see innerJoin The arguments format
@params string $type The join type (INNER, LEFT, etc.)
@params mixed $table The joined table
@params array The join criterion arguments
@return Join
@throws InvalidArgumentException
@throws InvalidReturnValueException | [
"Converts",
"join",
"method",
"arguments",
"to",
"a",
"join",
"object"
] | 4edba721e37693780d142229b3ecb0cd4004c7a5 | https://github.com/Finesse/QueryScribe/blob/4edba721e37693780d142229b3ecb0cd4004c7a5/src/QueryBricks/JoinTrait.php#L163-L192 | train |
wb-crowdfusion/crowdfusion | system/core/classes/mvc/controllers/AbstractApiController.php | AbstractApiController.passthruParameter | protected function passthruParameter(&$dto, $variableName) {
$reqName = str_replace('.','_', $variableName);
if($this->Request->getParameter($reqName) !== null && $this->Request->getParameter($reqName) != '')
$dto->setParameter($variableName, $this->Request->getParameter($reqName));
} | php | protected function passthruParameter(&$dto, $variableName) {
$reqName = str_replace('.','_', $variableName);
if($this->Request->getParameter($reqName) !== null && $this->Request->getParameter($reqName) != '')
$dto->setParameter($variableName, $this->Request->getParameter($reqName));
} | [
"protected",
"function",
"passthruParameter",
"(",
"&",
"$",
"dto",
",",
"$",
"variableName",
")",
"{",
"$",
"reqName",
"=",
"str_replace",
"(",
"'.'",
",",
"'_'",
",",
"$",
"variableName",
")",
";",
"if",
"(",
"$",
"this",
"->",
"Request",
"->",
"getP... | copied from AbstractController | [
"copied",
"from",
"AbstractController"
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/mvc/controllers/AbstractApiController.php#L135-L139 | train |
AnonymPHP/Anonym-Route | RouteMatcher.php | RouteMatcher.matchWhen | public function matchWhen($url = null)
{
if (null !== $url) {
$this->setMatchUrl($url);
}
return strpos($this->getRequestedUrl(), $this->getMatchUrl()) === 0;
} | php | public function matchWhen($url = null)
{
if (null !== $url) {
$this->setMatchUrl($url);
}
return strpos($this->getRequestedUrl(), $this->getMatchUrl()) === 0;
} | [
"public",
"function",
"matchWhen",
"(",
"$",
"url",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"!==",
"$",
"url",
")",
"{",
"$",
"this",
"->",
"setMatchUrl",
"(",
"$",
"url",
")",
";",
"}",
"return",
"strpos",
"(",
"$",
"this",
"->",
"getRequestedUr... | match uri for when( method
@param null|string $url
@return bool | [
"match",
"uri",
"for",
"when",
"(",
"method"
] | bb7f8004fbbd2998af8b0061f404f026f11466ab | https://github.com/AnonymPHP/Anonym-Route/blob/bb7f8004fbbd2998af8b0061f404f026f11466ab/RouteMatcher.php#L71-L78 | train |
apioo/psx-validate | src/Filter/Collection.php | Collection.apply | public function apply($value)
{
$modified = false;
foreach ($this->filters as $filter) {
$result = $filter->apply($value);
if ($result === false) {
return false;
} elseif ($result === true) {
} else {
$modified = true;... | php | public function apply($value)
{
$modified = false;
foreach ($this->filters as $filter) {
$result = $filter->apply($value);
if ($result === false) {
return false;
} elseif ($result === true) {
} else {
$modified = true;... | [
"public",
"function",
"apply",
"(",
"$",
"value",
")",
"{",
"$",
"modified",
"=",
"false",
";",
"foreach",
"(",
"$",
"this",
"->",
"filters",
"as",
"$",
"filter",
")",
"{",
"$",
"result",
"=",
"$",
"filter",
"->",
"apply",
"(",
"$",
"value",
")",
... | Returns true if all filters allow the value
@param mixed $value
@return boolean | [
"Returns",
"true",
"if",
"all",
"filters",
"allow",
"the",
"value"
] | 4860c6a2c7f7ca52d3bd6d7e6ec7d6a7ddcfd83d | https://github.com/apioo/psx-validate/blob/4860c6a2c7f7ca52d3bd6d7e6ec7d6a7ddcfd83d/src/Filter/Collection.php#L53-L70 | train |
Linkvalue-Interne/MobileNotif | src/Model/GcmMessage.php | GcmMessage.setData | public function setData(array $data)
{
$reservedDataKeys = array(
'from',
'notification',
'to',
'registration_ids',
'collapse_key',
'priority',
'restricted_package_name',
'content_available',
'delay_w... | php | public function setData(array $data)
{
$reservedDataKeys = array(
'from',
'notification',
'to',
'registration_ids',
'collapse_key',
'priority',
'restricted_package_name',
'content_available',
'delay_w... | [
"public",
"function",
"setData",
"(",
"array",
"$",
"data",
")",
"{",
"$",
"reservedDataKeys",
"=",
"array",
"(",
"'from'",
",",
"'notification'",
",",
"'to'",
",",
"'registration_ids'",
",",
"'collapse_key'",
",",
"'priority'",
",",
"'restricted_package_name'",
... | Set the value of Data.
@param array $data
@return self | [
"Set",
"the",
"value",
"of",
"Data",
"."
] | e6e4c4219f3bbb0aee32e90e5fdfc8c6a7ed53f6 | https://github.com/Linkvalue-Interne/MobileNotif/blob/e6e4c4219f3bbb0aee32e90e5fdfc8c6a7ed53f6/src/Model/GcmMessage.php#L733-L771 | train |
cloudtek/dynamodm | lib/Cloudtek/DynamoDM/Persister/DocumentPersister.php | DocumentPersister.addFilterToQueryBuilder | public function addFilterToQueryBuilder(QueryBuilder $qb)
{
$filters = $this->dm->getFilterCollection()->getFilterCriteria($this->class);
foreach ($filters as $filter) {
$qb->addCriteria($filter);
}
} | php | public function addFilterToQueryBuilder(QueryBuilder $qb)
{
$filters = $this->dm->getFilterCollection()->getFilterCriteria($this->class);
foreach ($filters as $filter) {
$qb->addCriteria($filter);
}
} | [
"public",
"function",
"addFilterToQueryBuilder",
"(",
"QueryBuilder",
"$",
"qb",
")",
"{",
"$",
"filters",
"=",
"$",
"this",
"->",
"dm",
"->",
"getFilterCollection",
"(",
")",
"->",
"getFilterCriteria",
"(",
"$",
"this",
"->",
"class",
")",
";",
"foreach",
... | Adds filter criteria to a QueryBuilder instance.
@param QueryBuilder $qb
@return void | [
"Adds",
"filter",
"criteria",
"to",
"a",
"QueryBuilder",
"instance",
"."
] | 119d355e2c5cbaef1f867970349b4432f5704fcd | https://github.com/cloudtek/dynamodm/blob/119d355e2c5cbaef1f867970349b4432f5704fcd/lib/Cloudtek/DynamoDM/Persister/DocumentPersister.php#L110-L117 | train |
cloudtek/dynamodm | lib/Cloudtek/DynamoDM/Persister/DocumentPersister.php | DocumentPersister.createDocument | private function createDocument($data, $document = null, $refresh = false)
{
if ($this->class->isLockable) {
$lockAttribute = $this->class->getLockMetadata()->attributeName;
if (isset($result[$lockAttribute]) && $data[$lockAttribute] === LockMode::PESSIMISTIC_WRITE) {
... | php | private function createDocument($data, $document = null, $refresh = false)
{
if ($this->class->isLockable) {
$lockAttribute = $this->class->getLockMetadata()->attributeName;
if (isset($result[$lockAttribute]) && $data[$lockAttribute] === LockMode::PESSIMISTIC_WRITE) {
... | [
"private",
"function",
"createDocument",
"(",
"$",
"data",
",",
"$",
"document",
"=",
"null",
",",
"$",
"refresh",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"class",
"->",
"isLockable",
")",
"{",
"$",
"lockAttribute",
"=",
"$",
"this",
"-... | Creates or fills a single document object from a query result.
@param array $data Raw result data from DynamoDB.
@param object $document The document object to fill, if any.
@param bool $refresh Refresh hint for UnitOfWork behavior.
@return object The filled and managed document object or NULL, if the
query r... | [
"Creates",
"or",
"fills",
"a",
"single",
"document",
"object",
"from",
"a",
"query",
"result",
"."
] | 119d355e2c5cbaef1f867970349b4432f5704fcd | https://github.com/cloudtek/dynamodm/blob/119d355e2c5cbaef1f867970349b4432f5704fcd/lib/Cloudtek/DynamoDM/Persister/DocumentPersister.php#L131-L149 | train |
cloudtek/dynamodm | lib/Cloudtek/DynamoDM/Persister/DocumentPersister.php | DocumentPersister.createReferenceInverseSideQuery | public function createReferenceInverseSideQuery(PropertyMetadata $mapping, $owner)
{
$targetClass = $this->dm->getClassMetadata($mapping->targetDocument);
$mappedBy = $targetClass->getPropertyMetadata($mapping->mappedBy);
$qb = $this->dm->createQueryBuilder($mapping->targetDocume... | php | public function createReferenceInverseSideQuery(PropertyMetadata $mapping, $owner)
{
$targetClass = $this->dm->getClassMetadata($mapping->targetDocument);
$mappedBy = $targetClass->getPropertyMetadata($mapping->mappedBy);
$qb = $this->dm->createQueryBuilder($mapping->targetDocume... | [
"public",
"function",
"createReferenceInverseSideQuery",
"(",
"PropertyMetadata",
"$",
"mapping",
",",
"$",
"owner",
")",
"{",
"$",
"targetClass",
"=",
"$",
"this",
"->",
"dm",
"->",
"getClassMetadata",
"(",
"$",
"mapping",
"->",
"targetDocument",
")",
";",
"$... | Build and return a query capable of populating the given inverse-side reference.
@param PropertyMetadata $mapping
@param object $owner
@return Query|Scan | [
"Build",
"and",
"return",
"a",
"query",
"capable",
"of",
"populating",
"the",
"given",
"inverse",
"-",
"side",
"reference",
"."
] | 119d355e2c5cbaef1f867970349b4432f5704fcd | https://github.com/cloudtek/dynamodm/blob/119d355e2c5cbaef1f867970349b4432f5704fcd/lib/Cloudtek/DynamoDM/Persister/DocumentPersister.php#L159-L193 | train |
cloudtek/dynamodm | lib/Cloudtek/DynamoDM/Persister/DocumentPersister.php | DocumentPersister.delete | public function delete($document)
{
$qb = $this->dm->createQueryBuilder($this->class->name);
$identifier = $this->uow->getDocumentIdentifier($document);
$qb->delete();
$qb->setIdentifier($identifier);
if ($this->class->isLockable) {
$qb->attr($this->clas... | php | public function delete($document)
{
$qb = $this->dm->createQueryBuilder($this->class->name);
$identifier = $this->uow->getDocumentIdentifier($document);
$qb->delete();
$qb->setIdentifier($identifier);
if ($this->class->isLockable) {
$qb->attr($this->clas... | [
"public",
"function",
"delete",
"(",
"$",
"document",
")",
"{",
"$",
"qb",
"=",
"$",
"this",
"->",
"dm",
"->",
"createQueryBuilder",
"(",
"$",
"this",
"->",
"class",
"->",
"name",
")",
";",
"$",
"identifier",
"=",
"$",
"this",
"->",
"uow",
"->",
"g... | Removes a document from DynamoDB
@param object $document
@return void
@throws LockException | [
"Removes",
"a",
"document",
"from",
"DynamoDB"
] | 119d355e2c5cbaef1f867970349b4432f5704fcd | https://github.com/cloudtek/dynamodm/blob/119d355e2c5cbaef1f867970349b4432f5704fcd/lib/Cloudtek/DynamoDM/Persister/DocumentPersister.php#L237-L261 | train |
cloudtek/dynamodm | lib/Cloudtek/DynamoDM/Persister/DocumentPersister.php | DocumentPersister.insert | public function insert($document)
{
$class = $this->dm->getClassMetadata(get_class($document));
$changeset = $this->uow->getDocumentChangeSet($document);
$qb = $this->dm->createQueryBuilder($this->class->name);
foreach ($class->propertyMetadata as $mapping) {
... | php | public function insert($document)
{
$class = $this->dm->getClassMetadata(get_class($document));
$changeset = $this->uow->getDocumentChangeSet($document);
$qb = $this->dm->createQueryBuilder($this->class->name);
foreach ($class->propertyMetadata as $mapping) {
... | [
"public",
"function",
"insert",
"(",
"$",
"document",
")",
"{",
"$",
"class",
"=",
"$",
"this",
"->",
"dm",
"->",
"getClassMetadata",
"(",
"get_class",
"(",
"$",
"document",
")",
")",
";",
"$",
"changeset",
"=",
"$",
"this",
"->",
"uow",
"->",
"getDo... | Insert the provided document.
@param object $document
@return void | [
"Insert",
"the",
"provided",
"document",
"."
] | 119d355e2c5cbaef1f867970349b4432f5704fcd | https://github.com/cloudtek/dynamodm/blob/119d355e2c5cbaef1f867970349b4432f5704fcd/lib/Cloudtek/DynamoDM/Persister/DocumentPersister.php#L317-L347 | train |
cloudtek/dynamodm | lib/Cloudtek/DynamoDM/Persister/DocumentPersister.php | DocumentPersister.load | public function load(Identifier $identifier, $document = null, $lockMode = LockMode::NONE)
{
$qb = $this->dm->createQueryBuilder($this->class->name);
$query = $qb->get()->setIdentifier($identifier)->getQuery();
$result = $query->getSingleMarshalledResult();
return $result ? $th... | php | public function load(Identifier $identifier, $document = null, $lockMode = LockMode::NONE)
{
$qb = $this->dm->createQueryBuilder($this->class->name);
$query = $qb->get()->setIdentifier($identifier)->getQuery();
$result = $query->getSingleMarshalledResult();
return $result ? $th... | [
"public",
"function",
"load",
"(",
"Identifier",
"$",
"identifier",
",",
"$",
"document",
"=",
"null",
",",
"$",
"lockMode",
"=",
"LockMode",
"::",
"NONE",
")",
"{",
"$",
"qb",
"=",
"$",
"this",
"->",
"dm",
"->",
"createQueryBuilder",
"(",
"$",
"this",... | Find a document by Identifier instance.
@param Identifier $identifier
@param object|null $document Document to load the data into. If not
specified, a new document is created.
@param int $lockMode
@return object|null The loaded and managed document instance or null if
no document was found | [
"Find",
"a",
"document",
"by",
"Identifier",
"instance",
"."
] | 119d355e2c5cbaef1f867970349b4432f5704fcd | https://github.com/cloudtek/dynamodm/blob/119d355e2c5cbaef1f867970349b4432f5704fcd/lib/Cloudtek/DynamoDM/Persister/DocumentPersister.php#L360-L367 | train |
cloudtek/dynamodm | lib/Cloudtek/DynamoDM/Persister/DocumentPersister.php | DocumentPersister.loadAll | public function loadAll(array $criteria = [], $limit = null)
{
$qb = $this->dm->createQueryBuilder($this->class->name)->addCriteria($criteria);
return $qb->getQuery()->limit($limit)->execute();
} | php | public function loadAll(array $criteria = [], $limit = null)
{
$qb = $this->dm->createQueryBuilder($this->class->name)->addCriteria($criteria);
return $qb->getQuery()->limit($limit)->execute();
} | [
"public",
"function",
"loadAll",
"(",
"array",
"$",
"criteria",
"=",
"[",
"]",
",",
"$",
"limit",
"=",
"null",
")",
"{",
"$",
"qb",
"=",
"$",
"this",
"->",
"dm",
"->",
"createQueryBuilder",
"(",
"$",
"this",
"->",
"class",
"->",
"name",
")",
"->",
... | Load all documents from a table, optionally limited by the provided criteria.
@param array $criteria Query criteria.
@param int|null $limit Limit the number of documents returned.
@return Iterator | [
"Load",
"all",
"documents",
"from",
"a",
"table",
"optionally",
"limited",
"by",
"the",
"provided",
"criteria",
"."
] | 119d355e2c5cbaef1f867970349b4432f5704fcd | https://github.com/cloudtek/dynamodm/blob/119d355e2c5cbaef1f867970349b4432f5704fcd/lib/Cloudtek/DynamoDM/Persister/DocumentPersister.php#L377-L382 | train |
cloudtek/dynamodm | lib/Cloudtek/DynamoDM/Persister/DocumentPersister.php | DocumentPersister.loadReferenceManyCollectionInverseSide | private function loadReferenceManyCollectionInverseSide(PersistentCollectionInterface $collection)
{
$query = $this->createReferenceInverseSideQuery($collection->getMapping(), $collection->getOwner());
$documents = $query->execute()->toArray();
foreach ($documents as $key => $document) ... | php | private function loadReferenceManyCollectionInverseSide(PersistentCollectionInterface $collection)
{
$query = $this->createReferenceInverseSideQuery($collection->getMapping(), $collection->getOwner());
$documents = $query->execute()->toArray();
foreach ($documents as $key => $document) ... | [
"private",
"function",
"loadReferenceManyCollectionInverseSide",
"(",
"PersistentCollectionInterface",
"$",
"collection",
")",
"{",
"$",
"query",
"=",
"$",
"this",
"->",
"createReferenceInverseSideQuery",
"(",
"$",
"collection",
"->",
"getMapping",
"(",
")",
",",
"$",... | Populate an inverse-side ReferenceMany association.
@param PersistentCollectionInterface $collection
@return void | [
"Populate",
"an",
"inverse",
"-",
"side",
"ReferenceMany",
"association",
"."
] | 119d355e2c5cbaef1f867970349b4432f5704fcd | https://github.com/cloudtek/dynamodm/blob/119d355e2c5cbaef1f867970349b4432f5704fcd/lib/Cloudtek/DynamoDM/Persister/DocumentPersister.php#L451-L459 | train |
cloudtek/dynamodm | lib/Cloudtek/DynamoDM/Persister/DocumentPersister.php | DocumentPersister.loadReferenceManyCollectionOwningSide | private function loadReferenceManyCollectionOwningSide(PersistentCollectionInterface $collection)
{
$mapping = $collection->getMapping();
/** @var Identifier[] $identifiers */
$identifiers = array_map(
function ($referenceData) use ($mapping) {
return $this->ap->... | php | private function loadReferenceManyCollectionOwningSide(PersistentCollectionInterface $collection)
{
$mapping = $collection->getMapping();
/** @var Identifier[] $identifiers */
$identifiers = array_map(
function ($referenceData) use ($mapping) {
return $this->ap->... | [
"private",
"function",
"loadReferenceManyCollectionOwningSide",
"(",
"PersistentCollectionInterface",
"$",
"collection",
")",
"{",
"$",
"mapping",
"=",
"$",
"collection",
"->",
"getMapping",
"(",
")",
";",
"/** @var Identifier[] $identifiers */",
"$",
"identifiers",
"=",
... | Populate an owning-side ReferenceMany association.
@param PersistentCollectionInterface $collection
@return void | [
"Populate",
"an",
"owning",
"-",
"side",
"ReferenceMany",
"association",
"."
] | 119d355e2c5cbaef1f867970349b4432f5704fcd | https://github.com/cloudtek/dynamodm/blob/119d355e2c5cbaef1f867970349b4432f5704fcd/lib/Cloudtek/DynamoDM/Persister/DocumentPersister.php#L468-L556 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.