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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
webeweb/jquery-datatables-bundle | Controller/AbstractController.php | AbstractController.getDataTablesURL | protected function getDataTablesURL(DataTablesProviderInterface $dtProvider) {
$this->getLogger()->debug(sprintf("DataTables controller search for an URL with name \"%s\"", $dtProvider->getName()));
if (false === ($dtProvider instanceof DataTablesRouterInterface)) {
return $this->getRouter()->generate("jquery_datatables_index", ["name" => $dtProvider->getName()]);
}
$this->getLogger()->debug(sprintf("DataTables controller found for an URL with name \"%s\"", $dtProvider->getName()));
return $dtProvider->getUrl();
} | php | protected function getDataTablesURL(DataTablesProviderInterface $dtProvider) {
$this->getLogger()->debug(sprintf("DataTables controller search for an URL with name \"%s\"", $dtProvider->getName()));
if (false === ($dtProvider instanceof DataTablesRouterInterface)) {
return $this->getRouter()->generate("jquery_datatables_index", ["name" => $dtProvider->getName()]);
}
$this->getLogger()->debug(sprintf("DataTables controller found for an URL with name \"%s\"", $dtProvider->getName()));
return $dtProvider->getUrl();
} | [
"protected",
"function",
"getDataTablesURL",
"(",
"DataTablesProviderInterface",
"$",
"dtProvider",
")",
"{",
"$",
"this",
"->",
"getLogger",
"(",
")",
"->",
"debug",
"(",
"sprintf",
"(",
"\"DataTables controller search for an URL with name \\\"%s\\\"\"",
",",
"$",
"dtP... | Get an URL.
@param DataTablesProviderInterface $dtProvider The provider.
@return string Returns the URL. | [
"Get",
"an",
"URL",
"."
] | b53df9585a523fa1617128e6b467a5e574262a94 | https://github.com/webeweb/jquery-datatables-bundle/blob/b53df9585a523fa1617128e6b467a5e574262a94/Controller/AbstractController.php#L320-L331 | train |
webeweb/jquery-datatables-bundle | Controller/AbstractController.php | AbstractController.getDataTablesWrapper | protected function getDataTablesWrapper(DataTablesProviderInterface $dtProvider) {
$url = $this->getDataTablesURL($dtProvider);
$dtWrapper = DataTablesFactory::newWrapper($url, $dtProvider, $this->getKernelEventListener()->getUser());
foreach ($dtProvider->getColumns() as $dtColumn) {
$this->getLogger()->debug(sprintf("DataTables provider \"%s\" add a column \"%s\"", $dtProvider->getName(), $dtColumn->getData()));
$dtWrapper->addColumn($dtColumn);
}
if (null !== $dtProvider->getOptions()) {
$dtWrapper->setOptions($dtProvider->getOptions());
}
return $dtWrapper;
} | php | protected function getDataTablesWrapper(DataTablesProviderInterface $dtProvider) {
$url = $this->getDataTablesURL($dtProvider);
$dtWrapper = DataTablesFactory::newWrapper($url, $dtProvider, $this->getKernelEventListener()->getUser());
foreach ($dtProvider->getColumns() as $dtColumn) {
$this->getLogger()->debug(sprintf("DataTables provider \"%s\" add a column \"%s\"", $dtProvider->getName(), $dtColumn->getData()));
$dtWrapper->addColumn($dtColumn);
}
if (null !== $dtProvider->getOptions()) {
$dtWrapper->setOptions($dtProvider->getOptions());
}
return $dtWrapper;
} | [
"protected",
"function",
"getDataTablesWrapper",
"(",
"DataTablesProviderInterface",
"$",
"dtProvider",
")",
"{",
"$",
"url",
"=",
"$",
"this",
"->",
"getDataTablesURL",
"(",
"$",
"dtProvider",
")",
";",
"$",
"dtWrapper",
"=",
"DataTablesFactory",
"::",
"newWrappe... | Get a wrapper.
@param DataTablesProviderInterface $dtProvider The provider.
@return DataTablesWrapperInterface Returns the wrapper. | [
"Get",
"a",
"wrapper",
"."
] | b53df9585a523fa1617128e6b467a5e574262a94 | https://github.com/webeweb/jquery-datatables-bundle/blob/b53df9585a523fa1617128e6b467a5e574262a94/Controller/AbstractController.php#L339-L357 | train |
webeweb/jquery-datatables-bundle | Controller/AbstractController.php | AbstractController.prepareActionResponse | protected function prepareActionResponse($status, $notificationId) {
$response = new ActionResponse();
$response->setStatus($status);
$response->setNotify($this->getDataTablesNotification($notificationId));
return $response;
} | php | protected function prepareActionResponse($status, $notificationId) {
$response = new ActionResponse();
$response->setStatus($status);
$response->setNotify($this->getDataTablesNotification($notificationId));
return $response;
} | [
"protected",
"function",
"prepareActionResponse",
"(",
"$",
"status",
",",
"$",
"notificationId",
")",
"{",
"$",
"response",
"=",
"new",
"ActionResponse",
"(",
")",
";",
"$",
"response",
"->",
"setStatus",
"(",
"$",
"status",
")",
";",
"$",
"response",
"->... | Prepare an action response.
@param int $status The status.
@param string $notificationId The notification id.
@return ActionResponse Returns the action response. | [
"Prepare",
"an",
"action",
"response",
"."
] | b53df9585a523fa1617128e6b467a5e574262a94 | https://github.com/webeweb/jquery-datatables-bundle/blob/b53df9585a523fa1617128e6b467a5e574262a94/Controller/AbstractController.php#L384-L391 | train |
i-lateral/silverstripe-gallery | src/control/GalleryHubController.php | GalleryHubController.PaginatedGalleries | public function PaginatedGalleries()
{
$children = $this->AllChildren();
$limit = $this->ThumbnailsPerPage;
$list = ArrayList::create();
foreach ($children as $child) {
$image = $child->SortedImages()->first();
$child_data = $child->toMap();
$child_data["Link"] = $child->Link();
if ($image) {
$child_data["GalleryThumbnail"] = $this->ScaledImage($image, true);
} else {
$child_data["GalleryThumbnail"] = null;
}
$list->add(ArrayData::create($child_data));
}
$pages = PaginatedList::create($list, $this->getRequest());
$pages->setPageLength($limit);
return $pages;
} | php | public function PaginatedGalleries()
{
$children = $this->AllChildren();
$limit = $this->ThumbnailsPerPage;
$list = ArrayList::create();
foreach ($children as $child) {
$image = $child->SortedImages()->first();
$child_data = $child->toMap();
$child_data["Link"] = $child->Link();
if ($image) {
$child_data["GalleryThumbnail"] = $this->ScaledImage($image, true);
} else {
$child_data["GalleryThumbnail"] = null;
}
$list->add(ArrayData::create($child_data));
}
$pages = PaginatedList::create($list, $this->getRequest());
$pages->setPageLength($limit);
return $pages;
} | [
"public",
"function",
"PaginatedGalleries",
"(",
")",
"{",
"$",
"children",
"=",
"$",
"this",
"->",
"AllChildren",
"(",
")",
";",
"$",
"limit",
"=",
"$",
"this",
"->",
"ThumbnailsPerPage",
";",
"$",
"list",
"=",
"ArrayList",
"::",
"create",
"(",
")",
"... | Get a custom list of children with resized gallery images
@return PaginatedList | [
"Get",
"a",
"custom",
"list",
"of",
"children",
"with",
"resized",
"gallery",
"images"
] | 7077704b1831d6159a8f7431d0795ba0f93c0026 | https://github.com/i-lateral/silverstripe-gallery/blob/7077704b1831d6159a8f7431d0795ba0f93c0026/src/control/GalleryHubController.php#L18-L40 | train |
ArgentCrusade/selectel-cloud-storage | src/FluentFilesLoader.php | FluentFilesLoader.setParam | protected function setParam($key, $value, $trimLeadingSlashes = true)
{
$this->params[$key] = $trimLeadingSlashes ? ltrim($value, '/') : $value;
return $this;
} | php | protected function setParam($key, $value, $trimLeadingSlashes = true)
{
$this->params[$key] = $trimLeadingSlashes ? ltrim($value, '/') : $value;
return $this;
} | [
"protected",
"function",
"setParam",
"(",
"$",
"key",
",",
"$",
"value",
",",
"$",
"trimLeadingSlashes",
"=",
"true",
")",
"{",
"$",
"this",
"->",
"params",
"[",
"$",
"key",
"]",
"=",
"$",
"trimLeadingSlashes",
"?",
"ltrim",
"(",
"$",
"value",
",",
"... | Sets loader parameter.
@param string $key
@param string|int $value
@param bool $trimLeadingSlashes = true
@return \ArgentCrusade\Selectel\CloudStorage\Contracts\FluentFilesLoaderContract | [
"Sets",
"loader",
"parameter",
"."
] | f085af14b496463dc30d4804eac8c5f574d121a4 | https://github.com/ArgentCrusade/selectel-cloud-storage/blob/f085af14b496463dc30d4804eac8c5f574d121a4/src/FluentFilesLoader.php#L80-L85 | train |
ArgentCrusade/selectel-cloud-storage | src/FluentFilesLoader.php | FluentFilesLoader.limit | public function limit($limit, $markerFile = '')
{
return $this->setParam('limit', intval($limit), false)
->setParam('marker', $markerFile, false);
} | php | public function limit($limit, $markerFile = '')
{
return $this->setParam('limit', intval($limit), false)
->setParam('marker', $markerFile, false);
} | [
"public",
"function",
"limit",
"(",
"$",
"limit",
",",
"$",
"markerFile",
"=",
"''",
")",
"{",
"return",
"$",
"this",
"->",
"setParam",
"(",
"'limit'",
",",
"intval",
"(",
"$",
"limit",
")",
",",
"false",
")",
"->",
"setParam",
"(",
"'marker'",
",",
... | Sets files limit. If you need to paginate through results, pass markerFile
argument with latest filename from previous request as value. If you're
working within a directory, its path will be appended to markerFile.
@param int $limit
@param string $markerFile = ''
@return \ArgentCrusade\Selectel\CloudStorage\Contracts\FluentFilesLoaderContract | [
"Sets",
"files",
"limit",
".",
"If",
"you",
"need",
"to",
"paginate",
"through",
"results",
"pass",
"markerFile",
"argument",
"with",
"latest",
"filename",
"from",
"previous",
"request",
"as",
"value",
".",
"If",
"you",
"re",
"working",
"within",
"a",
"direc... | f085af14b496463dc30d4804eac8c5f574d121a4 | https://github.com/ArgentCrusade/selectel-cloud-storage/blob/f085af14b496463dc30d4804eac8c5f574d121a4/src/FluentFilesLoader.php#L156-L160 | train |
ArgentCrusade/selectel-cloud-storage | src/FluentFilesLoader.php | FluentFilesLoader.find | public function find($path)
{
$file = $this->findFileAt($path);
if (is_null($file)) {
throw new FileNotFoundException('File "'.$path.'" was not found.');
}
return new File($this->api, $this->containerName(), $file);
} | php | public function find($path)
{
$file = $this->findFileAt($path);
if (is_null($file)) {
throw new FileNotFoundException('File "'.$path.'" was not found.');
}
return new File($this->api, $this->containerName(), $file);
} | [
"public",
"function",
"find",
"(",
"$",
"path",
")",
"{",
"$",
"file",
"=",
"$",
"this",
"->",
"findFileAt",
"(",
"$",
"path",
")",
";",
"if",
"(",
"is_null",
"(",
"$",
"file",
")",
")",
"{",
"throw",
"new",
"FileNotFoundException",
"(",
"'File \"'",... | Finds single file at given path.
@param string $path
@throws \ArgentCrusade\Selectel\CloudStorage\Exceptions\FileNotFoundException
@return \ArgentCrusade\Selectel\CloudStorage\Contracts\FileContract | [
"Finds",
"single",
"file",
"at",
"given",
"path",
"."
] | f085af14b496463dc30d4804eac8c5f574d121a4 | https://github.com/ArgentCrusade/selectel-cloud-storage/blob/f085af14b496463dc30d4804eac8c5f574d121a4/src/FluentFilesLoader.php#L211-L220 | train |
ArgentCrusade/selectel-cloud-storage | src/FluentFilesLoader.php | FluentFilesLoader.findFileAt | protected function findFileAt($path)
{
try {
$files = $this->fromDirectory('')
->withPrefix($path)
->withDelimiter('')
->limit(1)
->get();
} catch (ApiRequestFailedException $e) {
return;
}
return $files->get(0);
} | php | protected function findFileAt($path)
{
try {
$files = $this->fromDirectory('')
->withPrefix($path)
->withDelimiter('')
->limit(1)
->get();
} catch (ApiRequestFailedException $e) {
return;
}
return $files->get(0);
} | [
"protected",
"function",
"findFileAt",
"(",
"$",
"path",
")",
"{",
"try",
"{",
"$",
"files",
"=",
"$",
"this",
"->",
"fromDirectory",
"(",
"''",
")",
"->",
"withPrefix",
"(",
"$",
"path",
")",
"->",
"withDelimiter",
"(",
"''",
")",
"->",
"limit",
"("... | Loads file from path.
@param string $path
@return array|null | [
"Loads",
"file",
"from",
"path",
"."
] | f085af14b496463dc30d4804eac8c5f574d121a4 | https://github.com/ArgentCrusade/selectel-cloud-storage/blob/f085af14b496463dc30d4804eac8c5f574d121a4/src/FluentFilesLoader.php#L229-L242 | train |
ArgentCrusade/selectel-cloud-storage | src/FluentFilesLoader.php | FluentFilesLoader.get | public function get()
{
$response = $this->api->request('GET', $this->containerUrl, [
'query' => $this->buildParams(),
]);
if ($response->getStatusCode() !== 200) {
throw new ApiRequestFailedException('Unable to list container files.', $response->getStatusCode());
}
$files = json_decode($response->getBody(), true);
if ($this->asFileObjects === true) {
$this->asFileObjects = false;
return $this->getFilesCollectionFromArrays($files);
}
// Add 'filename' attribute to each file, so users
// can pass it to new loader instance as marker,
// if they want to iterate inside a directory.
$files = array_map(function ($file) {
$path = explode('/', $file['name']);
$file['filename'] = array_pop($path);
return $file;
}, $files);
return new Collection($files);
} | php | public function get()
{
$response = $this->api->request('GET', $this->containerUrl, [
'query' => $this->buildParams(),
]);
if ($response->getStatusCode() !== 200) {
throw new ApiRequestFailedException('Unable to list container files.', $response->getStatusCode());
}
$files = json_decode($response->getBody(), true);
if ($this->asFileObjects === true) {
$this->asFileObjects = false;
return $this->getFilesCollectionFromArrays($files);
}
// Add 'filename' attribute to each file, so users
// can pass it to new loader instance as marker,
// if they want to iterate inside a directory.
$files = array_map(function ($file) {
$path = explode('/', $file['name']);
$file['filename'] = array_pop($path);
return $file;
}, $files);
return new Collection($files);
} | [
"public",
"function",
"get",
"(",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"api",
"->",
"request",
"(",
"'GET'",
",",
"$",
"this",
"->",
"containerUrl",
",",
"[",
"'query'",
"=>",
"$",
"this",
"->",
"buildParams",
"(",
")",
",",
"]",
")",... | Loads files.
@throws \ArgentCrusade\Selectel\CloudStorage\Exceptions\ApiRequestFailedException
@return \ArgentCrusade\Selectel\CloudStorage\Contracts\Collections\CollectionContract | [
"Loads",
"files",
"."
] | f085af14b496463dc30d4804eac8c5f574d121a4 | https://github.com/ArgentCrusade/selectel-cloud-storage/blob/f085af14b496463dc30d4804eac8c5f574d121a4/src/FluentFilesLoader.php#L251-L281 | train |
oliverklee/ext-oelib | Classes/AbstractMailer.php | Tx_Oelib_AbstractMailer.formatEmailBody | protected function formatEmailBody($rawEmailBody)
{
if (!$this->enableFormatting) {
return $rawEmailBody;
}
$body = str_replace([CRLF, CR], LF, $rawEmailBody);
$body = preg_replace('/\\n{2,}/', LF . LF, $body);
return trim($body);
} | php | protected function formatEmailBody($rawEmailBody)
{
if (!$this->enableFormatting) {
return $rawEmailBody;
}
$body = str_replace([CRLF, CR], LF, $rawEmailBody);
$body = preg_replace('/\\n{2,}/', LF . LF, $body);
return trim($body);
} | [
"protected",
"function",
"formatEmailBody",
"(",
"$",
"rawEmailBody",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"enableFormatting",
")",
"{",
"return",
"$",
"rawEmailBody",
";",
"}",
"$",
"body",
"=",
"str_replace",
"(",
"[",
"CRLF",
",",
"CR",
"]",
... | Formats the e-mail body if this is enabled.
Replaces single carriage returns or carriage return plus linefeed
with line feeds and strips surplus blank lines, so there are no more than
two line breaks behind one another.
@param string $rawEmailBody string raw e-mail body, must not be empty
@return string e-mail body, formatted if formatting is enabled, will not be empty | [
"Formats",
"the",
"e",
"-",
"mail",
"body",
"if",
"this",
"is",
"enabled",
"."
] | f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1 | https://github.com/oliverklee/ext-oelib/blob/f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1/Classes/AbstractMailer.php#L178-L188 | train |
oliverklee/ext-oelib | Classes/SalutationSwitcher.php | Tx_Oelib_SalutationSwitcher.getAvailableLanguages | private function getAvailableLanguages()
{
if ($this->availableLanguages === null) {
$this->availableLanguages = [];
if (!empty($this->LLkey)) {
$this->availableLanguages[] = $this->LLkey;
}
// The key for English is "default", not "en".
$this->availableLanguages = str_replace(
'en',
'default',
$this->availableLanguages
);
// Remove duplicates in case the default language is the same as the fall-back language.
$this->availableLanguages = array_unique($this->availableLanguages);
// Now check that we only keep languages for which we have
// translations.
foreach ($this->availableLanguages as $index => $code) {
if (!isset($this->LOCAL_LANG[$code])) {
unset($this->availableLanguages[$index]);
}
}
}
return $this->availableLanguages;
} | php | private function getAvailableLanguages()
{
if ($this->availableLanguages === null) {
$this->availableLanguages = [];
if (!empty($this->LLkey)) {
$this->availableLanguages[] = $this->LLkey;
}
// The key for English is "default", not "en".
$this->availableLanguages = str_replace(
'en',
'default',
$this->availableLanguages
);
// Remove duplicates in case the default language is the same as the fall-back language.
$this->availableLanguages = array_unique($this->availableLanguages);
// Now check that we only keep languages for which we have
// translations.
foreach ($this->availableLanguages as $index => $code) {
if (!isset($this->LOCAL_LANG[$code])) {
unset($this->availableLanguages[$index]);
}
}
}
return $this->availableLanguages;
} | [
"private",
"function",
"getAvailableLanguages",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"availableLanguages",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"availableLanguages",
"=",
"[",
"]",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"L... | Compiles a list of language keys for which localizations have been loaded.
@return string[] a list of language keys (may be empty) | [
"Compiles",
"a",
"list",
"of",
"language",
"keys",
"for",
"which",
"localizations",
"have",
"been",
"loaded",
"."
] | f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1 | https://github.com/oliverklee/ext-oelib/blob/f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1/Classes/SalutationSwitcher.php#L172-L199 | train |
oliverklee/ext-oelib | Classes/SalutationSwitcher.php | Tx_Oelib_SalutationSwitcher.getSuffixesToTry | private function getSuffixesToTry()
{
if ($this->suffixesToTry === null) {
$this->suffixesToTry = [];
if (isset($this->conf['salutation'])) {
if ($this->conf['salutation'] === 'informal') {
$this->suffixesToTry[] = '_informal';
}
$this->suffixesToTry[] = '_formal';
}
$this->suffixesToTry[] = '';
}
return $this->suffixesToTry;
} | php | private function getSuffixesToTry()
{
if ($this->suffixesToTry === null) {
$this->suffixesToTry = [];
if (isset($this->conf['salutation'])) {
if ($this->conf['salutation'] === 'informal') {
$this->suffixesToTry[] = '_informal';
}
$this->suffixesToTry[] = '_formal';
}
$this->suffixesToTry[] = '';
}
return $this->suffixesToTry;
} | [
"private",
"function",
"getSuffixesToTry",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"suffixesToTry",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"suffixesToTry",
"=",
"[",
"]",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"conf",
"[",
"'salut... | Gets an ordered list of language label suffixes that should be tried to
get localizations in the preferred order of formality.
@return string[] ordered list of suffixes from "", "_formal" and "_informal", will not be empty | [
"Gets",
"an",
"ordered",
"list",
"of",
"language",
"label",
"suffixes",
"that",
"should",
"be",
"tried",
"to",
"get",
"localizations",
"in",
"the",
"preferred",
"order",
"of",
"formality",
"."
] | f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1 | https://github.com/oliverklee/ext-oelib/blob/f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1/Classes/SalutationSwitcher.php#L207-L222 | train |
oliverklee/ext-oelib | Classes/Visibility/Tree.php | Tx_Oelib_Visibility_Tree.buildTreeFromArray | private function buildTreeFromArray(
array $treeStructure,
\Tx_Oelib_Visibility_Node $parentNode
) {
foreach ($treeStructure as $nodeKey => $nodeContents) {
/** @var \Tx_Oelib_Visibility_Node $childNode */
$childNode = GeneralUtility::makeInstance(\Tx_Oelib_Visibility_Node::class);
$parentNode->addChild($childNode);
if (is_array($nodeContents)) {
$this->buildTreeFromArray($nodeContents, $childNode);
} elseif ($nodeContents === true) {
$childNode->markAsVisible();
}
$this->nodes[$nodeKey] = $childNode;
}
} | php | private function buildTreeFromArray(
array $treeStructure,
\Tx_Oelib_Visibility_Node $parentNode
) {
foreach ($treeStructure as $nodeKey => $nodeContents) {
/** @var \Tx_Oelib_Visibility_Node $childNode */
$childNode = GeneralUtility::makeInstance(\Tx_Oelib_Visibility_Node::class);
$parentNode->addChild($childNode);
if (is_array($nodeContents)) {
$this->buildTreeFromArray($nodeContents, $childNode);
} elseif ($nodeContents === true) {
$childNode->markAsVisible();
}
$this->nodes[$nodeKey] = $childNode;
}
} | [
"private",
"function",
"buildTreeFromArray",
"(",
"array",
"$",
"treeStructure",
",",
"\\",
"Tx_Oelib_Visibility_Node",
"$",
"parentNode",
")",
"{",
"foreach",
"(",
"$",
"treeStructure",
"as",
"$",
"nodeKey",
"=>",
"$",
"nodeContents",
")",
"{",
"/** @var \\Tx_Oel... | Builds the node tree from the given structure.
@param array $treeStructure
the tree structure as array, may be empty
@param \Tx_Oelib_Visibility_Node $parentNode
the parent node for the current key
@return void | [
"Builds",
"the",
"node",
"tree",
"from",
"the",
"given",
"structure",
"."
] | f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1 | https://github.com/oliverklee/ext-oelib/blob/f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1/Classes/Visibility/Tree.php#L56-L73 | train |
oliverklee/ext-oelib | Classes/Visibility/Tree.php | Tx_Oelib_Visibility_Tree.getKeysOfHiddenSubparts | public function getKeysOfHiddenSubparts()
{
$keysToHide = [];
foreach ($this->nodes as $key => $node) {
if (!$node->isVisible()) {
$keysToHide[] = $key;
}
}
return $keysToHide;
} | php | public function getKeysOfHiddenSubparts()
{
$keysToHide = [];
foreach ($this->nodes as $key => $node) {
if (!$node->isVisible()) {
$keysToHide[] = $key;
}
}
return $keysToHide;
} | [
"public",
"function",
"getKeysOfHiddenSubparts",
"(",
")",
"{",
"$",
"keysToHide",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"nodes",
"as",
"$",
"key",
"=>",
"$",
"node",
")",
"{",
"if",
"(",
"!",
"$",
"node",
"->",
"isVisible",
"(",
"... | Creates a numeric array of all subparts that still are hidden.
The output of this function can be used for
\Tx_Oelib_Template::hideSubpartsArray.
@return string[] the key of the subparts which are hidden, will be empty if no elements are hidden | [
"Creates",
"a",
"numeric",
"array",
"of",
"all",
"subparts",
"that",
"still",
"are",
"hidden",
"."
] | f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1 | https://github.com/oliverklee/ext-oelib/blob/f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1/Classes/Visibility/Tree.php#L83-L94 | train |
oliverklee/ext-oelib | Classes/Visibility/Tree.php | Tx_Oelib_Visibility_Tree.makeNodesVisible | public function makeNodesVisible(array $nodeKeys)
{
foreach ($nodeKeys as $nodeKey) {
if (isset($this->nodes[$nodeKey])) {
$this->nodes[$nodeKey]->markAsVisible();
}
}
} | php | public function makeNodesVisible(array $nodeKeys)
{
foreach ($nodeKeys as $nodeKey) {
if (isset($this->nodes[$nodeKey])) {
$this->nodes[$nodeKey]->markAsVisible();
}
}
} | [
"public",
"function",
"makeNodesVisible",
"(",
"array",
"$",
"nodeKeys",
")",
"{",
"foreach",
"(",
"$",
"nodeKeys",
"as",
"$",
"nodeKey",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"nodes",
"[",
"$",
"nodeKey",
"]",
")",
")",
"{",
"$",
"... | Makes nodes in the tree visible.
@param string[] $nodeKeys
the keys of the visible nodes, may be empty
@return void | [
"Makes",
"nodes",
"in",
"the",
"tree",
"visible",
"."
] | f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1 | https://github.com/oliverklee/ext-oelib/blob/f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1/Classes/Visibility/Tree.php#L114-L121 | train |
girosolution/girocheckout_sdk | src/girocheckout-sdk/helper/GiroCheckout_SDK_Curl_helper.php | GiroCheckout_SDK_Curl_helper.submit | public static function submit($url, $params) {
$Config = GiroCheckout_SDK_Config::getInstance();
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:'));
// For Windows environments
if( defined('__GIROSOLUTION_SDK_CERT__') ) {
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);
curl_setopt($ch, CURLOPT_CAINFO, str_replace('\\', '/', __GIROSOLUTION_SDK_CERT__));
}
// For Windows environments
if( defined('__GIROSOLUTION_SDK_SSL_VERIFY_OFF__') && __GIROSOLUTION_SDK_SSL_VERIFY_OFF__ ) {
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
}
if ($Config->getConfig('CURLOPT_SSL_VERIFYPEER')) {
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, $Config->getConfig('CURLOPT_SSL_VERIFYPEER'));
}
if ($Config->getConfig('CURLOPT_CAINFO')) {
curl_setopt($ch, CURLOPT_CAINFO, $Config->getConfig('CURLOPT_CAINFO'));
}
if ($Config->getConfig('CURLOPT_SSL_VERIFYHOST')) {
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, $Config->getConfig('CURLOPT_SSL_VERIFYHOST'));
}
if ($Config->getConfig('CURLOPT_CONNECTTIMEOUT')) {
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $Config->getConfig('CURLOPT_CONNECTTIMEOUT'));
}
// Begin Proxy
if( $Config->getConfig('CURLOPT_PROXY') && $Config->getConfig('CURLOPT_PROXYPORT') ) {
curl_setopt($ch, CURLOPT_PROXY, $Config->getConfig('CURLOPT_PROXY'));
curl_setopt($ch, CURLOPT_PROXYPORT, $Config->getConfig('CURLOPT_PROXYPORT'));
if($Config->getConfig('CURLOPT_PROXYUSERPWD')) {
curl_setopt($ch, CURLOPT_PROXYUSERPWD, $Config->getConfig('CURLOPT_PROXYUSERPWD'));
}
}
// End Proxy
if ($Config->getConfig('DEBUG_MODE')) {
curl_setopt($ch, CURLINFO_HEADER_OUT, 1);
}
$result = curl_exec($ch);
if($Config->getConfig('DEBUG_MODE')) { GiroCheckout_SDK_Debug_helper::getInstance()->logRequest(curl_getinfo($ch),$params); }
if($Config->getConfig('DEBUG_MODE')) { GiroCheckout_SDK_Debug_helper::getInstance()->logReply($result, curl_error($ch)); }
if($result === false) {
throw new Exception('cURL: submit failed.');
}
curl_close($ch);
return self::getHeaderAndBody($result);
} | php | public static function submit($url, $params) {
$Config = GiroCheckout_SDK_Config::getInstance();
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:'));
// For Windows environments
if( defined('__GIROSOLUTION_SDK_CERT__') ) {
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);
curl_setopt($ch, CURLOPT_CAINFO, str_replace('\\', '/', __GIROSOLUTION_SDK_CERT__));
}
// For Windows environments
if( defined('__GIROSOLUTION_SDK_SSL_VERIFY_OFF__') && __GIROSOLUTION_SDK_SSL_VERIFY_OFF__ ) {
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
}
if ($Config->getConfig('CURLOPT_SSL_VERIFYPEER')) {
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, $Config->getConfig('CURLOPT_SSL_VERIFYPEER'));
}
if ($Config->getConfig('CURLOPT_CAINFO')) {
curl_setopt($ch, CURLOPT_CAINFO, $Config->getConfig('CURLOPT_CAINFO'));
}
if ($Config->getConfig('CURLOPT_SSL_VERIFYHOST')) {
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, $Config->getConfig('CURLOPT_SSL_VERIFYHOST'));
}
if ($Config->getConfig('CURLOPT_CONNECTTIMEOUT')) {
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $Config->getConfig('CURLOPT_CONNECTTIMEOUT'));
}
// Begin Proxy
if( $Config->getConfig('CURLOPT_PROXY') && $Config->getConfig('CURLOPT_PROXYPORT') ) {
curl_setopt($ch, CURLOPT_PROXY, $Config->getConfig('CURLOPT_PROXY'));
curl_setopt($ch, CURLOPT_PROXYPORT, $Config->getConfig('CURLOPT_PROXYPORT'));
if($Config->getConfig('CURLOPT_PROXYUSERPWD')) {
curl_setopt($ch, CURLOPT_PROXYUSERPWD, $Config->getConfig('CURLOPT_PROXYUSERPWD'));
}
}
// End Proxy
if ($Config->getConfig('DEBUG_MODE')) {
curl_setopt($ch, CURLINFO_HEADER_OUT, 1);
}
$result = curl_exec($ch);
if($Config->getConfig('DEBUG_MODE')) { GiroCheckout_SDK_Debug_helper::getInstance()->logRequest(curl_getinfo($ch),$params); }
if($Config->getConfig('DEBUG_MODE')) { GiroCheckout_SDK_Debug_helper::getInstance()->logReply($result, curl_error($ch)); }
if($result === false) {
throw new Exception('cURL: submit failed.');
}
curl_close($ch);
return self::getHeaderAndBody($result);
} | [
"public",
"static",
"function",
"submit",
"(",
"$",
"url",
",",
"$",
"params",
")",
"{",
"$",
"Config",
"=",
"GiroCheckout_SDK_Config",
"::",
"getInstance",
"(",
")",
";",
"$",
"ch",
"=",
"curl_init",
"(",
")",
";",
"curl_setopt",
"(",
"$",
"ch",
",",
... | submits data by using curl to a given url
@param String url where data has to be sent to
@param mixed[] array data which has to be sent
@return array body of the response | [
"submits",
"data",
"by",
"using",
"curl",
"to",
"a",
"given",
"url"
] | 4360f8894452a9c8f41b07f021746105e27a8575 | https://github.com/girosolution/girocheckout_sdk/blob/4360f8894452a9c8f41b07f021746105e27a8575/src/girocheckout-sdk/helper/GiroCheckout_SDK_Curl_helper.php#L22-L89 | train |
girosolution/girocheckout_sdk | src/girocheckout-sdk/helper/GiroCheckout_SDK_Curl_helper.php | GiroCheckout_SDK_Curl_helper.getJSONResponseToArray | public static function getJSONResponseToArray($string) {
$json = json_decode($string,true);
if($json !== NULL) {
return $json;
}
else {
throw new \Exception('Response is not a valid json string.');
}
} | php | public static function getJSONResponseToArray($string) {
$json = json_decode($string,true);
if($json !== NULL) {
return $json;
}
else {
throw new \Exception('Response is not a valid json string.');
}
} | [
"public",
"static",
"function",
"getJSONResponseToArray",
"(",
"$",
"string",
")",
"{",
"$",
"json",
"=",
"json_decode",
"(",
"$",
"string",
",",
"true",
")",
";",
"if",
"(",
"$",
"json",
"!==",
"NULL",
")",
"{",
"return",
"$",
"json",
";",
"}",
"els... | Decodes a json string and returns an array
@param String json string
@return mixed[] array of an parsed json string
@throws \Exception if string is not a valid json string | [
"Decodes",
"a",
"json",
"string",
"and",
"returns",
"an",
"array"
] | 4360f8894452a9c8f41b07f021746105e27a8575 | https://github.com/girosolution/girocheckout_sdk/blob/4360f8894452a9c8f41b07f021746105e27a8575/src/girocheckout-sdk/helper/GiroCheckout_SDK_Curl_helper.php#L98-L106 | train |
girosolution/girocheckout_sdk | src/girocheckout-sdk/helper/GiroCheckout_SDK_Curl_helper.php | GiroCheckout_SDK_Curl_helper.getHeaderAndBody | private static function getHeaderAndBody($response) {
$header = self::http_parse_headers(substr($response, 0, strrpos($response,"\r\n\r\n")));
$body = substr($response, strrpos($response,"\r\n\r\n")+4);
return array($header,$body);
} | php | private static function getHeaderAndBody($response) {
$header = self::http_parse_headers(substr($response, 0, strrpos($response,"\r\n\r\n")));
$body = substr($response, strrpos($response,"\r\n\r\n")+4);
return array($header,$body);
} | [
"private",
"static",
"function",
"getHeaderAndBody",
"(",
"$",
"response",
")",
"{",
"$",
"header",
"=",
"self",
"::",
"http_parse_headers",
"(",
"substr",
"(",
"$",
"response",
",",
"0",
",",
"strrpos",
"(",
"$",
"response",
",",
"\"\\r\\n\\r\\n\"",
")",
... | Strip header content
@param String server response
@return array header, body of the server response. The header is parsed as an array. | [
"Strip",
"header",
"content"
] | 4360f8894452a9c8f41b07f021746105e27a8575 | https://github.com/girosolution/girocheckout_sdk/blob/4360f8894452a9c8f41b07f021746105e27a8575/src/girocheckout-sdk/helper/GiroCheckout_SDK_Curl_helper.php#L114-L119 | train |
oliverklee/ext-oelib | Classes/BackEndLoginManager.php | Tx_Oelib_BackEndLoginManager.getLoggedInUser | public function getLoggedInUser($mapperName = \Tx_Oelib_Mapper_BackEndUser::class)
{
if ($mapperName === '') {
throw new \InvalidArgumentException('$mapperName must not be empty.', 1331318483);
}
if (!$this->isLoggedIn()) {
return null;
}
if ($this->loggedInUser) {
return $this->loggedInUser;
}
/** @var \Tx_Oelib_Mapper_BackEndUser $mapper */
$mapper = \Tx_Oelib_MapperRegistry::get($mapperName);
/** @var \Tx_Oelib_Model_BackEndUser $user */
$user = $mapper->find($this->getBackEndUserAuthentication()->user['uid']);
return $user;
} | php | public function getLoggedInUser($mapperName = \Tx_Oelib_Mapper_BackEndUser::class)
{
if ($mapperName === '') {
throw new \InvalidArgumentException('$mapperName must not be empty.', 1331318483);
}
if (!$this->isLoggedIn()) {
return null;
}
if ($this->loggedInUser) {
return $this->loggedInUser;
}
/** @var \Tx_Oelib_Mapper_BackEndUser $mapper */
$mapper = \Tx_Oelib_MapperRegistry::get($mapperName);
/** @var \Tx_Oelib_Model_BackEndUser $user */
$user = $mapper->find($this->getBackEndUserAuthentication()->user['uid']);
return $user;
} | [
"public",
"function",
"getLoggedInUser",
"(",
"$",
"mapperName",
"=",
"\\",
"Tx_Oelib_Mapper_BackEndUser",
"::",
"class",
")",
"{",
"if",
"(",
"$",
"mapperName",
"===",
"''",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'$mapperName must not b... | Gets the currently logged-in back-end user.
@param string $mapperName
the name of the mapper to use for getting the back-end user model, must not be empty
@return \Tx_Oelib_Model_BackEndUser the logged-in back-end user, will be NULL if no user is logged in | [
"Gets",
"the",
"currently",
"logged",
"-",
"in",
"back",
"-",
"end",
"user",
"."
] | f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1 | https://github.com/oliverklee/ext-oelib/blob/f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1/Classes/BackEndLoginManager.php#L76-L94 | train |
mocdk/MOC.Varnish | Classes/Package.php | Package.boot | public function boot(\Neos\Flow\Core\Bootstrap $bootstrap)
{
$dispatcher = $bootstrap->getSignalSlotDispatcher();
$dispatcher->connect(ConfigurationManager::class, 'configurationManagerReady', function (ConfigurationManager $configurationManager) use ($dispatcher) {
$enabled = $configurationManager->getConfiguration(ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, 'MOC.Varnish.enabled');
if ((boolean)$enabled === true) {
$dispatcher->connect('Neos\Neos\Service\PublishingService', 'nodePublished', 'MOC\Varnish\Service\ContentCacheFlusherService', 'flushForNode');
$dispatcher->connect('Neos\Flow\Mvc\Dispatcher', 'afterControllerInvocation', 'MOC\Varnish\Service\CacheControlService', 'addHeaders');
}
});
} | php | public function boot(\Neos\Flow\Core\Bootstrap $bootstrap)
{
$dispatcher = $bootstrap->getSignalSlotDispatcher();
$dispatcher->connect(ConfigurationManager::class, 'configurationManagerReady', function (ConfigurationManager $configurationManager) use ($dispatcher) {
$enabled = $configurationManager->getConfiguration(ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, 'MOC.Varnish.enabled');
if ((boolean)$enabled === true) {
$dispatcher->connect('Neos\Neos\Service\PublishingService', 'nodePublished', 'MOC\Varnish\Service\ContentCacheFlusherService', 'flushForNode');
$dispatcher->connect('Neos\Flow\Mvc\Dispatcher', 'afterControllerInvocation', 'MOC\Varnish\Service\CacheControlService', 'addHeaders');
}
});
} | [
"public",
"function",
"boot",
"(",
"\\",
"Neos",
"\\",
"Flow",
"\\",
"Core",
"\\",
"Bootstrap",
"$",
"bootstrap",
")",
"{",
"$",
"dispatcher",
"=",
"$",
"bootstrap",
"->",
"getSignalSlotDispatcher",
"(",
")",
";",
"$",
"dispatcher",
"->",
"connect",
"(",
... | Register slots for sending correct headers and BANS to varnish
@param \Neos\Flow\Core\Bootstrap $bootstrap The current bootstrap
@return void | [
"Register",
"slots",
"for",
"sending",
"correct",
"headers",
"and",
"BANS",
"to",
"varnish"
] | f7f4cec4ceb0ce03ca259e896d8f75a645272759 | https://github.com/mocdk/MOC.Varnish/blob/f7f4cec4ceb0ce03ca259e896d8f75a645272759/Classes/Package.php#L16-L26 | train |
wp-jungle/baobab | src/Baobab/Helper/Customizer.php | Customizer.defaultPanel | public static function defaultPanel()
{
$argCount = func_num_args();
$args = func_get_args();
$sections = array();
for ($i = 0; $i < $argCount; ++$i) {
$sections[$args[$i]['id']] = $args[$i];
}
return array(
'sections' => $sections
);
} | php | public static function defaultPanel()
{
$argCount = func_num_args();
$args = func_get_args();
$sections = array();
for ($i = 0; $i < $argCount; ++$i) {
$sections[$args[$i]['id']] = $args[$i];
}
return array(
'sections' => $sections
);
} | [
"public",
"static",
"function",
"defaultPanel",
"(",
")",
"{",
"$",
"argCount",
"=",
"func_num_args",
"(",
")",
";",
"$",
"args",
"=",
"func_get_args",
"(",
")",
";",
"$",
"sections",
"=",
"array",
"(",
")",
";",
"for",
"(",
"$",
"i",
"=",
"0",
";"... | Set all sections which will go to the default customizer panel. The function accepts more than 0 arguments.
All arguments will define the sections of the panel.
@return array | [
"Set",
"all",
"sections",
"which",
"will",
"go",
"to",
"the",
"default",
"customizer",
"panel",
".",
"The",
"function",
"accepts",
"more",
"than",
"0",
"arguments",
".",
"All",
"arguments",
"will",
"define",
"the",
"sections",
"of",
"the",
"panel",
"."
] | ed2a9f2bbc3d194aa4df454b50aec43796fc68da | https://github.com/wp-jungle/baobab/blob/ed2a9f2bbc3d194aa4df454b50aec43796fc68da/src/Baobab/Helper/Customizer.php#L20-L33 | train |
wp-jungle/baobab | src/Baobab/Helper/Customizer.php | Customizer.panel | public static function panel($title, $description)
{
$argCount = func_num_args();
$args = func_get_args();
$sections = array();
for ($i = 2; $i < $argCount; ++$i) {
$sections[$args[$i]['id']] = $args[$i];
}
return array(
'title' => $title,
'description' => $description,
'sections' => $sections
);
} | php | public static function panel($title, $description)
{
$argCount = func_num_args();
$args = func_get_args();
$sections = array();
for ($i = 2; $i < $argCount; ++$i) {
$sections[$args[$i]['id']] = $args[$i];
}
return array(
'title' => $title,
'description' => $description,
'sections' => $sections
);
} | [
"public",
"static",
"function",
"panel",
"(",
"$",
"title",
",",
"$",
"description",
")",
"{",
"$",
"argCount",
"=",
"func_num_args",
"(",
")",
";",
"$",
"args",
"=",
"func_get_args",
"(",
")",
";",
"$",
"sections",
"=",
"array",
"(",
")",
";",
"for"... | Define a customizer panel. The function accepts more than 2 arguments. All arguments passed after the description
will define the sections of the panel.
@param string $title
@param string $description
@return array | [
"Define",
"a",
"customizer",
"panel",
".",
"The",
"function",
"accepts",
"more",
"than",
"2",
"arguments",
".",
"All",
"arguments",
"passed",
"after",
"the",
"description",
"will",
"define",
"the",
"sections",
"of",
"the",
"panel",
"."
] | ed2a9f2bbc3d194aa4df454b50aec43796fc68da | https://github.com/wp-jungle/baobab/blob/ed2a9f2bbc3d194aa4df454b50aec43796fc68da/src/Baobab/Helper/Customizer.php#L43-L58 | train |
contributte/nextras-orm-events | src/DI/NextrasOrmEventsExtension.php | NextrasOrmEventsExtension.loadEntityMapping | private function loadEntityMapping(): array
{
$mapping = [];
$builder = $this->getContainerBuilder();
$repositories = $builder->findByType(IRepository::class);
foreach ($repositories as $repository) {
/** @var string $repositoryClass */
$repositoryClass = $repository->getEntity();
// Skip invalid repositoryClass name
if (!class_exists($repositoryClass)) {
throw new ServiceCreationException(sprintf("Repository class '%s' not found", $repositoryClass));
}
// Skip invalid subtype ob IRepository
if (!method_exists($repositoryClass, 'getEntityClassNames')) continue;
// Append mapping [repository => [entity1, entity2, entityN]
foreach ($repositoryClass::getEntityClassNames() as $entity) {
$mapping[$entity] = $repositoryClass;
}
}
return $mapping;
} | php | private function loadEntityMapping(): array
{
$mapping = [];
$builder = $this->getContainerBuilder();
$repositories = $builder->findByType(IRepository::class);
foreach ($repositories as $repository) {
/** @var string $repositoryClass */
$repositoryClass = $repository->getEntity();
// Skip invalid repositoryClass name
if (!class_exists($repositoryClass)) {
throw new ServiceCreationException(sprintf("Repository class '%s' not found", $repositoryClass));
}
// Skip invalid subtype ob IRepository
if (!method_exists($repositoryClass, 'getEntityClassNames')) continue;
// Append mapping [repository => [entity1, entity2, entityN]
foreach ($repositoryClass::getEntityClassNames() as $entity) {
$mapping[$entity] = $repositoryClass;
}
}
return $mapping;
} | [
"private",
"function",
"loadEntityMapping",
"(",
")",
":",
"array",
"{",
"$",
"mapping",
"=",
"[",
"]",
";",
"$",
"builder",
"=",
"$",
"this",
"->",
"getContainerBuilder",
"(",
")",
";",
"$",
"repositories",
"=",
"$",
"builder",
"->",
"findByType",
"(",
... | Load entity mapping
@return string[] | [
"Load",
"entity",
"mapping"
] | 3b0d669ce407d3502b9a13c8add99d78a2704537 | https://github.com/contributte/nextras-orm-events/blob/3b0d669ce407d3502b9a13c8add99d78a2704537/src/DI/NextrasOrmEventsExtension.php#L77-L103 | train |
i-lateral/silverstripe-gallery | src/control/GalleryPageController.php | GalleryPageController.Gallery | public function Gallery()
{
if ($this->Images()->exists()) {
// Create a list of images with generated gallery image and thumbnail
$images = ArrayList::create();
$pages = $this->PaginatedImages();
foreach ($this->PaginatedImages() as $image) {
$image_data = $image->toMap();
$image_data["GalleryImage"] = $this->GalleryImage($image);
$image_data["GalleryThumbnail"] = $this->GalleryThumbnail($image);
$images->add(ArrayData::create($image_data));
}
$vars = [
'PaginatedImages' => $pages,
'Images' => $images,
'Width' => $this->getFullWidth(),
'Height' => $this->getFullHeight()
];
return $this->renderWith(
[
'Gallery',
'ilateral\SilverStripe\Gallery\Includes\Gallery'
],
$vars
);
} else {
return "";
}
} | php | public function Gallery()
{
if ($this->Images()->exists()) {
// Create a list of images with generated gallery image and thumbnail
$images = ArrayList::create();
$pages = $this->PaginatedImages();
foreach ($this->PaginatedImages() as $image) {
$image_data = $image->toMap();
$image_data["GalleryImage"] = $this->GalleryImage($image);
$image_data["GalleryThumbnail"] = $this->GalleryThumbnail($image);
$images->add(ArrayData::create($image_data));
}
$vars = [
'PaginatedImages' => $pages,
'Images' => $images,
'Width' => $this->getFullWidth(),
'Height' => $this->getFullHeight()
];
return $this->renderWith(
[
'Gallery',
'ilateral\SilverStripe\Gallery\Includes\Gallery'
],
$vars
);
} else {
return "";
}
} | [
"public",
"function",
"Gallery",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"Images",
"(",
")",
"->",
"exists",
"(",
")",
")",
"{",
"// Create a list of images with generated gallery image and thumbnail",
"$",
"images",
"=",
"ArrayList",
"::",
"create",
"(",
... | Generate an image gallery from the Gallery template, if no images are
available, then return an empty string.
@return string | [
"Generate",
"an",
"image",
"gallery",
"from",
"the",
"Gallery",
"template",
"if",
"no",
"images",
"are",
"available",
"then",
"return",
"an",
"empty",
"string",
"."
] | 7077704b1831d6159a8f7431d0795ba0f93c0026 | https://github.com/i-lateral/silverstripe-gallery/blob/7077704b1831d6159a8f7431d0795ba0f93c0026/src/control/GalleryPageController.php#L46-L77 | train |
girosolution/girocheckout_sdk | src/girocheckout-sdk/GiroCheckout_SDK_Request_Cart.php | GiroCheckout_SDK_Request_Cart.addItem | public function addItem($p_strName, $p_iQuantity, $p_iGrossAmt, $p_strEAN = "") {
if (empty($p_strName) || empty($p_iQuantity) || !isset($p_iGrossAmt)) {
throw new GiroCheckout_SDK_Exception_helper('Name, quantity and amount are mandatory for cart items');
}
$aItem = array(
"name" => $p_strName,
"quantity" => $p_iQuantity,
"grossAmount" => $p_iGrossAmt
);
if (!empty($p_strEAN)) {
$aItem["ean"] = $p_strEAN;
}
$this->m_aItems[] = $aItem;
} | php | public function addItem($p_strName, $p_iQuantity, $p_iGrossAmt, $p_strEAN = "") {
if (empty($p_strName) || empty($p_iQuantity) || !isset($p_iGrossAmt)) {
throw new GiroCheckout_SDK_Exception_helper('Name, quantity and amount are mandatory for cart items');
}
$aItem = array(
"name" => $p_strName,
"quantity" => $p_iQuantity,
"grossAmount" => $p_iGrossAmt
);
if (!empty($p_strEAN)) {
$aItem["ean"] = $p_strEAN;
}
$this->m_aItems[] = $aItem;
} | [
"public",
"function",
"addItem",
"(",
"$",
"p_strName",
",",
"$",
"p_iQuantity",
",",
"$",
"p_iGrossAmt",
",",
"$",
"p_strEAN",
"=",
"\"\"",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"p_strName",
")",
"||",
"empty",
"(",
"$",
"p_iQuantity",
")",
"||",
... | Add item to cart.
@param string $p_strName Item name
@param integer $p_iQuantity Number of items of this kind in the cart
@param integer $p_iGrossAmt Gross amount (value) of the item
@param string $p_strEAN (optional) Item id number
@throws GiroCheckout_SDK_Exception_helper | [
"Add",
"item",
"to",
"cart",
"."
] | 4360f8894452a9c8f41b07f021746105e27a8575 | https://github.com/girosolution/girocheckout_sdk/blob/4360f8894452a9c8f41b07f021746105e27a8575/src/girocheckout-sdk/GiroCheckout_SDK_Request_Cart.php#L26-L43 | train |
girosolution/girocheckout_sdk | src/girocheckout-sdk/GiroCheckout_SDK_Request_Cart.php | GiroCheckout_SDK_Request_Cart.getAllItems | public function getAllItems() {
if (version_compare(phpversion(), '5.3.0', '<')) {
return json_encode($this->m_aItems);
}
else {
return json_encode($this->m_aItems, JSON_UNESCAPED_UNICODE);
}
} | php | public function getAllItems() {
if (version_compare(phpversion(), '5.3.0', '<')) {
return json_encode($this->m_aItems);
}
else {
return json_encode($this->m_aItems, JSON_UNESCAPED_UNICODE);
}
} | [
"public",
"function",
"getAllItems",
"(",
")",
"{",
"if",
"(",
"version_compare",
"(",
"phpversion",
"(",
")",
",",
"'5.3.0'",
",",
"'<'",
")",
")",
"{",
"return",
"json_encode",
"(",
"$",
"this",
"->",
"m_aItems",
")",
";",
"}",
"else",
"{",
"return",... | Returns all items as a JSON string.
@return string JSON encoded item array. | [
"Returns",
"all",
"items",
"as",
"a",
"JSON",
"string",
"."
] | 4360f8894452a9c8f41b07f021746105e27a8575 | https://github.com/girosolution/girocheckout_sdk/blob/4360f8894452a9c8f41b07f021746105e27a8575/src/girocheckout-sdk/GiroCheckout_SDK_Request_Cart.php#L50-L57 | train |
VM9/orion-explorer-php-frame-work | src/Orion/Operations/subscribeContext.php | subscribeContext.notifyConditions | public function notifyConditions($type, $condValues = array()) {
if (!is_array($condValues)) {
$condValues = array($condValues);
}
$context = new \Orion\Context\ContextFactory();
$context->put("type", $type);
$context->put("condValues", $condValues);
$this->_notifyConditions[] = $context->get();
return $this;
} | php | public function notifyConditions($type, $condValues = array()) {
if (!is_array($condValues)) {
$condValues = array($condValues);
}
$context = new \Orion\Context\ContextFactory();
$context->put("type", $type);
$context->put("condValues", $condValues);
$this->_notifyConditions[] = $context->get();
return $this;
} | [
"public",
"function",
"notifyConditions",
"(",
"$",
"type",
",",
"$",
"condValues",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"condValues",
")",
")",
"{",
"$",
"condValues",
"=",
"array",
"(",
"$",
"condValues",
")",
";"... | Build notifyCondition object
@param string $type ONTIMEINTERVAL | ONCHANGE (!ONVALUE not supported yet)
When ONTIMEINTERVAL use time as conditional value(ISO 8601 format)
EX: PT10S - 10 of interval
When ONCHANGE use a attribute name to track changes only at this attribute
an empty means all attributes
@param array $condValues insert is Parttern attribute | [
"Build",
"notifyCondition",
"object"
] | f16005de36ec4b86e44eb47a4aa04e37fe5deca6 | https://github.com/VM9/orion-explorer-php-frame-work/blob/f16005de36ec4b86e44eb47a4aa04e37fe5deca6/src/Orion/Operations/subscribeContext.php#L143-L154 | train |
webeweb/jquery-datatables-bundle | API/DataTablesWrapper.php | DataTablesWrapper.removeColumn | public function removeColumn(DataTablesColumnInterface $column) {
if (true === array_key_exists($column->getData(), $this->columns)) {
$this->columns[$column->getData()]->getMapping()->setPrefix(null);
unset($this->columns[$column->getData()]);
}
return $this;
} | php | public function removeColumn(DataTablesColumnInterface $column) {
if (true === array_key_exists($column->getData(), $this->columns)) {
$this->columns[$column->getData()]->getMapping()->setPrefix(null);
unset($this->columns[$column->getData()]);
}
return $this;
} | [
"public",
"function",
"removeColumn",
"(",
"DataTablesColumnInterface",
"$",
"column",
")",
"{",
"if",
"(",
"true",
"===",
"array_key_exists",
"(",
"$",
"column",
"->",
"getData",
"(",
")",
",",
"$",
"this",
"->",
"columns",
")",
")",
"{",
"$",
"this",
"... | Remove a column.
@param DataTablesColumnInterface $column The column.
@return DataTablesWrapperInterface Returns this wrapper. | [
"Remove",
"a",
"column",
"."
] | b53df9585a523fa1617128e6b467a5e574262a94 | https://github.com/webeweb/jquery-datatables-bundle/blob/b53df9585a523fa1617128e6b467a5e574262a94/API/DataTablesWrapper.php#L223-L229 | train |
wp-jungle/baobab | src/Baobab/Helper/Strings.php | Strings.sanitizeJsVarName | public static function sanitizeJsVarName($str)
{
$out = preg_replace("/ /", '_', trim($str));
$out = preg_replace("/[^A-Za-z_]/", '', $out);
return $out;
} | php | public static function sanitizeJsVarName($str)
{
$out = preg_replace("/ /", '_', trim($str));
$out = preg_replace("/[^A-Za-z_]/", '', $out);
return $out;
} | [
"public",
"static",
"function",
"sanitizeJsVarName",
"(",
"$",
"str",
")",
"{",
"$",
"out",
"=",
"preg_replace",
"(",
"\"/ /\"",
",",
"'_'",
",",
"trim",
"(",
"$",
"str",
")",
")",
";",
"$",
"out",
"=",
"preg_replace",
"(",
"\"/[^A-Za-z_]/\"",
",",
"''... | Turn an arbitrary string into a usable javascript variable name
@param string $str The string to sanitize
@return string The sanitized string | [
"Turn",
"an",
"arbitrary",
"string",
"into",
"a",
"usable",
"javascript",
"variable",
"name"
] | ed2a9f2bbc3d194aa4df454b50aec43796fc68da | https://github.com/wp-jungle/baobab/blob/ed2a9f2bbc3d194aa4df454b50aec43796fc68da/src/Baobab/Helper/Strings.php#L39-L45 | train |
VM9/orion-explorer-php-frame-work | src/Orion/Context/ContextFactory.php | ContextFactory.addAttribute | public function addAttribute($name, $value, $type = "Integer", $metadata = null) {
$attr = (object) [
"value" => $value,
"type" => $type
];
if(null != $metadata){
$attr->metadata = (object) $metadata;
}
$this->put($name, $attr);
} | php | public function addAttribute($name, $value, $type = "Integer", $metadata = null) {
$attr = (object) [
"value" => $value,
"type" => $type
];
if(null != $metadata){
$attr->metadata = (object) $metadata;
}
$this->put($name, $attr);
} | [
"public",
"function",
"addAttribute",
"(",
"$",
"name",
",",
"$",
"value",
",",
"$",
"type",
"=",
"\"Integer\"",
",",
"$",
"metadata",
"=",
"null",
")",
"{",
"$",
"attr",
"=",
"(",
"object",
")",
"[",
"\"value\"",
"=>",
"$",
"value",
",",
"\"type\"",... | This convenience method create a Entity NGSIv2 attribute format.
@param mixed $name
@param mixed $value
@param mixed $type | [
"This",
"convenience",
"method",
"create",
"a",
"Entity",
"NGSIv2",
"attribute",
"format",
"."
] | f16005de36ec4b86e44eb47a4aa04e37fe5deca6 | https://github.com/VM9/orion-explorer-php-frame-work/blob/f16005de36ec4b86e44eb47a4aa04e37fe5deca6/src/Orion/Context/ContextFactory.php#L82-L93 | train |
oliverklee/ext-oelib | Classes/Visibility/Node.php | Tx_Oelib_Visibility_Node.setParent | public function setParent(\Tx_Oelib_Visibility_Node $parentNode)
{
if ($this->parentNode !== null) {
throw new \InvalidArgumentException('This node already has a parent node.', 1331488668);
}
$this->parentNode = $parentNode;
} | php | public function setParent(\Tx_Oelib_Visibility_Node $parentNode)
{
if ($this->parentNode !== null) {
throw new \InvalidArgumentException('This node already has a parent node.', 1331488668);
}
$this->parentNode = $parentNode;
} | [
"public",
"function",
"setParent",
"(",
"\\",
"Tx_Oelib_Visibility_Node",
"$",
"parentNode",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"parentNode",
"!==",
"null",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'This node already has a parent node.'... | Sets the parent node of this node.
The parent can only be set once.
@param \Tx_Oelib_Visibility_Node $parentNode the parent node to add
@return void | [
"Sets",
"the",
"parent",
"node",
"of",
"this",
"node",
"."
] | f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1 | https://github.com/oliverklee/ext-oelib/blob/f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1/Classes/Visibility/Node.php#L57-L64 | train |
rdohms/DMS | src/DMS/Bundle/TwigExtensionBundle/Twig/Date/TextualDateExtension.php | TextualDateExtension.textualDateFilter | public function textualDateFilter($date)
{
if ( ! $date instanceof \DateTime) {
throw new \InvalidArgumentException('Textual Date Filter expects input to be a instance of DateTime');
}
$now = new \DateTime('now');
$diff = $now->diff($date);
$diffUnit = $this->getHighestDiffUnitAndValue($diff);
$temporalModifier = ($diff->invert)? 'ago':'next';
$translationString = $temporalModifier. '.' .$diffUnit['unit'];
// Override yesterday and tomorrow
if ($diffUnit['unit'] == 'd' && $diffUnit['value'] == 1) {
$translationString = ($diff->invert)? 'date.yesterday':'date.tomorrow';
}
// Override "just.now"
if ($diffUnit['unit'] == 'now') {
$translationString = 'date.just_now';
}
return $this->translator->transChoice($translationString, $diffUnit['value'], array('%value%' => $diffUnit['value']), 'date');
} | php | public function textualDateFilter($date)
{
if ( ! $date instanceof \DateTime) {
throw new \InvalidArgumentException('Textual Date Filter expects input to be a instance of DateTime');
}
$now = new \DateTime('now');
$diff = $now->diff($date);
$diffUnit = $this->getHighestDiffUnitAndValue($diff);
$temporalModifier = ($diff->invert)? 'ago':'next';
$translationString = $temporalModifier. '.' .$diffUnit['unit'];
// Override yesterday and tomorrow
if ($diffUnit['unit'] == 'd' && $diffUnit['value'] == 1) {
$translationString = ($diff->invert)? 'date.yesterday':'date.tomorrow';
}
// Override "just.now"
if ($diffUnit['unit'] == 'now') {
$translationString = 'date.just_now';
}
return $this->translator->transChoice($translationString, $diffUnit['value'], array('%value%' => $diffUnit['value']), 'date');
} | [
"public",
"function",
"textualDateFilter",
"(",
"$",
"date",
")",
"{",
"if",
"(",
"!",
"$",
"date",
"instanceof",
"\\",
"DateTime",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'Textual Date Filter expects input to be a instance of DateTime'",
")"... | Converts dates into relative textual dates
Ex: x days ago, yesterday, tomorrow, in x days
@param \DateTime $date
@throws \InvalidArgumentException
@return string | [
"Converts",
"dates",
"into",
"relative",
"textual",
"dates"
] | 3fab902ac2db2a31876101280cdfe7611146a243 | https://github.com/rdohms/DMS/blob/3fab902ac2db2a31876101280cdfe7611146a243/src/DMS/Bundle/TwigExtensionBundle/Twig/Date/TextualDateExtension.php#L54-L78 | train |
rdohms/DMS | src/DMS/Bundle/TwigExtensionBundle/Twig/Date/TextualDateExtension.php | TextualDateExtension.getHighestDiffUnitAndValue | protected function getHighestDiffUnitAndValue($diff)
{
// Manually define props due to Reflection Bug #53439 (PHP)
$properties = array('y', 'm', 'd', 'h', 'i', 's');
foreach($properties as $prop) {
if ($diff->$prop > 0) {
return array('unit' => $prop, 'value' => $diff->$prop);
}
}
return array('unit' => 'now', 'value' => 0);
} | php | protected function getHighestDiffUnitAndValue($diff)
{
// Manually define props due to Reflection Bug #53439 (PHP)
$properties = array('y', 'm', 'd', 'h', 'i', 's');
foreach($properties as $prop) {
if ($diff->$prop > 0) {
return array('unit' => $prop, 'value' => $diff->$prop);
}
}
return array('unit' => 'now', 'value' => 0);
} | [
"protected",
"function",
"getHighestDiffUnitAndValue",
"(",
"$",
"diff",
")",
"{",
"// Manually define props due to Reflection Bug #53439 (PHP)",
"$",
"properties",
"=",
"array",
"(",
"'y'",
",",
"'m'",
",",
"'d'",
",",
"'h'",
",",
"'i'",
",",
"'s'",
")",
";",
"... | Returns the highest unit and its value in a diff.
@param \DateInterval $diff
@return array | [
"Returns",
"the",
"highest",
"unit",
"and",
"its",
"value",
"in",
"a",
"diff",
"."
] | 3fab902ac2db2a31876101280cdfe7611146a243 | https://github.com/rdohms/DMS/blob/3fab902ac2db2a31876101280cdfe7611146a243/src/DMS/Bundle/TwigExtensionBundle/Twig/Date/TextualDateExtension.php#L86-L98 | train |
girosolution/girocheckout_sdk | src/girocheckout-sdk/helper/GiroCheckout_SDK_ResponseCode_helper.php | GiroCheckout_SDK_ResponseCode_helper.getMessage | public static function getMessage( $code, $lang = 'EN' ) {
if( $code < 0 ) {
return null;
} //code invalid
$lang = strtoupper( $lang );
if( !array_key_exists( $lang, self::$code ) ) { //language not found
$lang = 'EN';
}
if( array_key_exists( $code, self::$code[$lang] ) ) { //code not defined
return self::$code[$lang][$code];
}
return null;
} | php | public static function getMessage( $code, $lang = 'EN' ) {
if( $code < 0 ) {
return null;
} //code invalid
$lang = strtoupper( $lang );
if( !array_key_exists( $lang, self::$code ) ) { //language not found
$lang = 'EN';
}
if( array_key_exists( $code, self::$code[$lang] ) ) { //code not defined
return self::$code[$lang][$code];
}
return null;
} | [
"public",
"static",
"function",
"getMessage",
"(",
"$",
"code",
",",
"$",
"lang",
"=",
"'EN'",
")",
"{",
"if",
"(",
"$",
"code",
"<",
"0",
")",
"{",
"return",
"null",
";",
"}",
"//code invalid",
"$",
"lang",
"=",
"strtoupper",
"(",
"$",
"lang",
")"... | Returns the message string of an given code in the given language
@param integer code
@param String language
@return null/String message | [
"Returns",
"the",
"message",
"string",
"of",
"an",
"given",
"code",
"in",
"the",
"given",
"language"
] | 4360f8894452a9c8f41b07f021746105e27a8575 | https://github.com/girosolution/girocheckout_sdk/blob/4360f8894452a9c8f41b07f021746105e27a8575/src/girocheckout-sdk/helper/GiroCheckout_SDK_ResponseCode_helper.php#L333-L349 | train |
wp-jungle/baobab | src/Baobab/Ajax/AjaxHandler.php | AjaxHandler.registerHooks | protected function registerHooks()
{
// Our callbacks are registered only on the admin side even for guest and frontend callbacks
if (is_admin())
{
switch ($this->accessType)
{
case 'guest':
Hooks::action('wp_ajax_nopriv_' . static::$ACTION, $this, 'doAjax');
break;
case 'logged':
Hooks::action('wp_ajax_' . static::$ACTION, $this, 'doAjax');
break;
case 'any':
Hooks::action('wp_ajax_nopriv_' . static::$ACTION, $this, 'doAjax');
Hooks::action('wp_ajax_' . static::$ACTION, $this, 'doAjax');
break;
default:
throw new \InvalidArgumentException("Invalid value for the Ajax access type parameter: "
. $this->accessType);
}
}
// If we have global variables
Hooks::filter('baobab/ajax/global_data', $this, 'addGlobalVariables');
} | php | protected function registerHooks()
{
// Our callbacks are registered only on the admin side even for guest and frontend callbacks
if (is_admin())
{
switch ($this->accessType)
{
case 'guest':
Hooks::action('wp_ajax_nopriv_' . static::$ACTION, $this, 'doAjax');
break;
case 'logged':
Hooks::action('wp_ajax_' . static::$ACTION, $this, 'doAjax');
break;
case 'any':
Hooks::action('wp_ajax_nopriv_' . static::$ACTION, $this, 'doAjax');
Hooks::action('wp_ajax_' . static::$ACTION, $this, 'doAjax');
break;
default:
throw new \InvalidArgumentException("Invalid value for the Ajax access type parameter: "
. $this->accessType);
}
}
// If we have global variables
Hooks::filter('baobab/ajax/global_data', $this, 'addGlobalVariables');
} | [
"protected",
"function",
"registerHooks",
"(",
")",
"{",
"// Our callbacks are registered only on the admin side even for guest and frontend callbacks",
"if",
"(",
"is_admin",
"(",
")",
")",
"{",
"switch",
"(",
"$",
"this",
"->",
"accessType",
")",
"{",
"case",
"'guest'... | Hook into WordPress to execute our ajax callback | [
"Hook",
"into",
"WordPress",
"to",
"execute",
"our",
"ajax",
"callback"
] | ed2a9f2bbc3d194aa4df454b50aec43796fc68da | https://github.com/wp-jungle/baobab/blob/ed2a9f2bbc3d194aa4df454b50aec43796fc68da/src/Baobab/Ajax/AjaxHandler.php#L65-L93 | train |
wp-jungle/baobab | src/Baobab/Ajax/AjaxHandler.php | AjaxHandler.addGlobalVariables | public function addGlobalVariables($vars)
{
$globalVars = $this->getGlobalVariables();
if ($globalVars == null || empty($globalVars))
{
return $vars;
}
return array_merge($vars, $this->getGlobalVariables());
} | php | public function addGlobalVariables($vars)
{
$globalVars = $this->getGlobalVariables();
if ($globalVars == null || empty($globalVars))
{
return $vars;
}
return array_merge($vars, $this->getGlobalVariables());
} | [
"public",
"function",
"addGlobalVariables",
"(",
"$",
"vars",
")",
"{",
"$",
"globalVars",
"=",
"$",
"this",
"->",
"getGlobalVariables",
"(",
")",
";",
"if",
"(",
"$",
"globalVars",
"==",
"null",
"||",
"empty",
"(",
"$",
"globalVars",
")",
")",
"{",
"r... | Add our variables to the global namespace object
@param array $vars The current variables
@return array The original variables + our own stuff | [
"Add",
"our",
"variables",
"to",
"the",
"global",
"namespace",
"object"
] | ed2a9f2bbc3d194aa4df454b50aec43796fc68da | https://github.com/wp-jungle/baobab/blob/ed2a9f2bbc3d194aa4df454b50aec43796fc68da/src/Baobab/Ajax/AjaxHandler.php#L102-L111 | train |
oliverklee/ext-oelib | Classes/TemplateRegistry.php | Tx_Oelib_TemplateRegistry.getByFileName | public function getByFileName($fileName)
{
if (!isset($this->templates[$fileName])) {
/** @var \Tx_Oelib_Template $template */
$template = GeneralUtility::makeInstance(\Tx_Oelib_Template::class);
if ($fileName !== '') {
$template->processTemplateFromFile($fileName);
}
$this->templates[$fileName] = $template;
}
return clone $this->templates[$fileName];
} | php | public function getByFileName($fileName)
{
if (!isset($this->templates[$fileName])) {
/** @var \Tx_Oelib_Template $template */
$template = GeneralUtility::makeInstance(\Tx_Oelib_Template::class);
if ($fileName !== '') {
$template->processTemplateFromFile($fileName);
}
$this->templates[$fileName] = $template;
}
return clone $this->templates[$fileName];
} | [
"public",
"function",
"getByFileName",
"(",
"$",
"fileName",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"templates",
"[",
"$",
"fileName",
"]",
")",
")",
"{",
"/** @var \\Tx_Oelib_Template $template */",
"$",
"template",
"=",
"GeneralUtility",
... | Creates a new template for a provided template file name with an already
parsed the template file.
If the template file name is empty, no template file will be used for
that template.
@param string $fileName
the file name of the template to retrieve, may not be empty to get a template that is not related to a
template file
@return \Tx_Oelib_Template the template for the given template file name | [
"Creates",
"a",
"new",
"template",
"for",
"a",
"provided",
"template",
"file",
"name",
"with",
"an",
"already",
"parsed",
"the",
"template",
"file",
"."
] | f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1 | https://github.com/oliverklee/ext-oelib/blob/f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1/Classes/TemplateRegistry.php#L86-L99 | train |
girosolution/girocheckout_sdk | src/girocheckout-sdk/GiroCheckout_SDK_Config.php | GiroCheckout_SDK_Config.setConfig | public function setConfig($key,$value) {
switch ($key) {
//curl options
case 'CURLOPT_CAINFO':
case 'CURLOPT_SSL_VERIFYPEER':
case 'CURLOPT_SSL_VERIFYHOST':
case 'CURLOPT_CONNECTTIMEOUT':
// Proxy
case 'CURLOPT_PROXY':
case 'CURLOPT_PROXYPORT':
case 'CURLOPT_PROXYUSERPWD':
// Debug
case 'DEBUG_LOG_PATH':
case 'DEBUG_MODE':
$this->config[$key] = $value;
return true;
break;
default:
return false;
}
} | php | public function setConfig($key,$value) {
switch ($key) {
//curl options
case 'CURLOPT_CAINFO':
case 'CURLOPT_SSL_VERIFYPEER':
case 'CURLOPT_SSL_VERIFYHOST':
case 'CURLOPT_CONNECTTIMEOUT':
// Proxy
case 'CURLOPT_PROXY':
case 'CURLOPT_PROXYPORT':
case 'CURLOPT_PROXYUSERPWD':
// Debug
case 'DEBUG_LOG_PATH':
case 'DEBUG_MODE':
$this->config[$key] = $value;
return true;
break;
default:
return false;
}
} | [
"public",
"function",
"setConfig",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"switch",
"(",
"$",
"key",
")",
"{",
"//curl options",
"case",
"'CURLOPT_CAINFO'",
":",
"case",
"'CURLOPT_SSL_VERIFYPEER'",
":",
"case",
"'CURLOPT_SSL_VERIFYHOST'",
":",
"case",
"... | Setter for config values
@param $key
@param $value
@return bool | [
"Setter",
"for",
"config",
"values"
] | 4360f8894452a9c8f41b07f021746105e27a8575 | https://github.com/girosolution/girocheckout_sdk/blob/4360f8894452a9c8f41b07f021746105e27a8575/src/girocheckout-sdk/GiroCheckout_SDK_Config.php#L68-L92 | train |
webeweb/jquery-datatables-bundle | Twig/Extension/AbstractDataTablesTwigExtension.php | AbstractDataTablesTwigExtension.encodeOptions | protected function encodeOptions(array $options) {
if (0 === count($options)) {
return "{}";
}
ksort($options);
$output = json_encode($options, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
return str_replace("\n", "\n ", $output);
} | php | protected function encodeOptions(array $options) {
if (0 === count($options)) {
return "{}";
}
ksort($options);
$output = json_encode($options, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
return str_replace("\n", "\n ", $output);
} | [
"protected",
"function",
"encodeOptions",
"(",
"array",
"$",
"options",
")",
"{",
"if",
"(",
"0",
"===",
"count",
"(",
"$",
"options",
")",
")",
"{",
"return",
"\"{}\"",
";",
"}",
"ksort",
"(",
"$",
"options",
")",
";",
"$",
"output",
"=",
"json_enco... | Encode the options.
@param array $options The options.
@return string Returns the encoded options. | [
"Encode",
"the",
"options",
"."
] | b53df9585a523fa1617128e6b467a5e574262a94 | https://github.com/webeweb/jquery-datatables-bundle/blob/b53df9585a523fa1617128e6b467a5e574262a94/Twig/Extension/AbstractDataTablesTwigExtension.php#L76-L83 | train |
webeweb/jquery-datatables-bundle | Twig/Extension/AbstractDataTablesTwigExtension.php | AbstractDataTablesTwigExtension.jQueryDataTablesStandalone | protected function jQueryDataTablesStandalone($selector, $language, array $options) {
if (null !== $language) {
$options["language"] = ["url" => DataTablesWrapperHelper::getLanguageURL($language)];
}
$searches = ["%selector%", "%options%"];
$replaces = [$selector, $this->encodeOptions($options)];
$javascript = StringHelper::replace(self::JQUERY_DATATABLES_STANDALONE, $searches, $replaces);
return $this->getRendererTwigExtension()->coreScriptFilter($javascript);
} | php | protected function jQueryDataTablesStandalone($selector, $language, array $options) {
if (null !== $language) {
$options["language"] = ["url" => DataTablesWrapperHelper::getLanguageURL($language)];
}
$searches = ["%selector%", "%options%"];
$replaces = [$selector, $this->encodeOptions($options)];
$javascript = StringHelper::replace(self::JQUERY_DATATABLES_STANDALONE, $searches, $replaces);
return $this->getRendererTwigExtension()->coreScriptFilter($javascript);
} | [
"protected",
"function",
"jQueryDataTablesStandalone",
"(",
"$",
"selector",
",",
"$",
"language",
",",
"array",
"$",
"options",
")",
"{",
"if",
"(",
"null",
"!==",
"$",
"language",
")",
"{",
"$",
"options",
"[",
"\"language\"",
"]",
"=",
"[",
"\"url\"",
... | Displays a jQuery DataTables "standalone".
@param string $selector The selector.
@param string $language The language.
@param array $options The options.
@return string Returns the jQuery DataTables "Standalone".
@throws FileNotFoundException Throws a file not found exception if the language file does not exist. | [
"Displays",
"a",
"jQuery",
"DataTables",
"standalone",
"."
] | b53df9585a523fa1617128e6b467a5e574262a94 | https://github.com/webeweb/jquery-datatables-bundle/blob/b53df9585a523fa1617128e6b467a5e574262a94/Twig/Extension/AbstractDataTablesTwigExtension.php#L120-L131 | train |
webeweb/jquery-datatables-bundle | Twig/Extension/AbstractDataTablesTwigExtension.php | AbstractDataTablesTwigExtension.renderDataTablesColumn | private function renderDataTablesColumn(DataTablesColumnInterface $dtColumn, $rowScope = false) {
$attributes = [];
$attributes["scope"] = true === $rowScope ? "row" : null;
$attributes["class"] = $dtColumn->getClassname();
$attributes["width"] = $dtColumn->getWidth();
return static::coreHTMLElement("th", $dtColumn->getTitle(), $attributes);
} | php | private function renderDataTablesColumn(DataTablesColumnInterface $dtColumn, $rowScope = false) {
$attributes = [];
$attributes["scope"] = true === $rowScope ? "row" : null;
$attributes["class"] = $dtColumn->getClassname();
$attributes["width"] = $dtColumn->getWidth();
return static::coreHTMLElement("th", $dtColumn->getTitle(), $attributes);
} | [
"private",
"function",
"renderDataTablesColumn",
"(",
"DataTablesColumnInterface",
"$",
"dtColumn",
",",
"$",
"rowScope",
"=",
"false",
")",
"{",
"$",
"attributes",
"=",
"[",
"]",
";",
"$",
"attributes",
"[",
"\"scope\"",
"]",
"=",
"true",
"===",
"$",
"rowSc... | Render a column.
@param DataTablesColumnInterface $dtColumn The column.
@param bool $rowScope Row scope ?
@return string Returns the rendered column. | [
"Render",
"a",
"column",
"."
] | b53df9585a523fa1617128e6b467a5e574262a94 | https://github.com/webeweb/jquery-datatables-bundle/blob/b53df9585a523fa1617128e6b467a5e574262a94/Twig/Extension/AbstractDataTablesTwigExtension.php#L164-L173 | train |
webeweb/jquery-datatables-bundle | Twig/Extension/AbstractDataTablesTwigExtension.php | AbstractDataTablesTwigExtension.renderDataTablesRow | private function renderDataTablesRow(DataTablesWrapperInterface $dtWrapper, $wrapper) {
$innerHTML = "";
$count = count($dtWrapper->getColumns());
for ($i = 0; $i < $count; ++$i) {
$dtColumn = array_values($dtWrapper->getColumns())[$i];
$th = $this->renderDataTablesColumn($dtColumn, ("thead" === $wrapper && 0 === $i));
if ("" === $th) {
continue;
}
$innerHTML .= $th . "\n";
}
$tr = static::coreHTMLElement("tr", "\n" . $innerHTML);
return static::coreHTMLElement($wrapper, "\n" . $tr . "\n");
} | php | private function renderDataTablesRow(DataTablesWrapperInterface $dtWrapper, $wrapper) {
$innerHTML = "";
$count = count($dtWrapper->getColumns());
for ($i = 0; $i < $count; ++$i) {
$dtColumn = array_values($dtWrapper->getColumns())[$i];
$th = $this->renderDataTablesColumn($dtColumn, ("thead" === $wrapper && 0 === $i));
if ("" === $th) {
continue;
}
$innerHTML .= $th . "\n";
}
$tr = static::coreHTMLElement("tr", "\n" . $innerHTML);
return static::coreHTMLElement($wrapper, "\n" . $tr . "\n");
} | [
"private",
"function",
"renderDataTablesRow",
"(",
"DataTablesWrapperInterface",
"$",
"dtWrapper",
",",
"$",
"wrapper",
")",
"{",
"$",
"innerHTML",
"=",
"\"\"",
";",
"$",
"count",
"=",
"count",
"(",
"$",
"dtWrapper",
"->",
"getColumns",
"(",
")",
")",
";",
... | Render a row.
@param DataTablesWrapperInterface $dtWrapper The wrapper.
@param string $wrapper The wrapper (thead or tfoot)
@return string Returns the rendered row. | [
"Render",
"a",
"row",
"."
] | b53df9585a523fa1617128e6b467a5e574262a94 | https://github.com/webeweb/jquery-datatables-bundle/blob/b53df9585a523fa1617128e6b467a5e574262a94/Twig/Extension/AbstractDataTablesTwigExtension.php#L182-L202 | train |
oliverklee/ext-oelib | Classes/List.php | Tx_Oelib_List.rebuildUidCache | private function rebuildUidCache()
{
$this->hasItemWithoutUid = false;
/** @var \Tx_Oelib_Model $item */
foreach ($this as $item) {
if ($item->hasUid()) {
$uid = $item->getUid();
$this->uids[$uid] = $uid;
} else {
$this->hasItemWithoutUid = true;
}
}
} | php | private function rebuildUidCache()
{
$this->hasItemWithoutUid = false;
/** @var \Tx_Oelib_Model $item */
foreach ($this as $item) {
if ($item->hasUid()) {
$uid = $item->getUid();
$this->uids[$uid] = $uid;
} else {
$this->hasItemWithoutUid = true;
}
}
} | [
"private",
"function",
"rebuildUidCache",
"(",
")",
"{",
"$",
"this",
"->",
"hasItemWithoutUid",
"=",
"false",
";",
"/** @var \\Tx_Oelib_Model $item */",
"foreach",
"(",
"$",
"this",
"as",
"$",
"item",
")",
"{",
"if",
"(",
"$",
"item",
"->",
"hasUid",
"(",
... | Rebuilds the UID cache.
@return void | [
"Rebuilds",
"the",
"UID",
"cache",
"."
] | f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1 | https://github.com/oliverklee/ext-oelib/blob/f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1/Classes/List.php#L147-L160 | train |
oliverklee/ext-oelib | Classes/List.php | Tx_Oelib_List.sort | public function sort($callbackFunction)
{
$items = iterator_to_array($this, false);
usort($items, $callbackFunction);
/** @var \Tx_Oelib_Model $item */
foreach ($items as $item) {
$this->detach($item);
$this->attach($item);
}
$this->markAsDirty();
} | php | public function sort($callbackFunction)
{
$items = iterator_to_array($this, false);
usort($items, $callbackFunction);
/** @var \Tx_Oelib_Model $item */
foreach ($items as $item) {
$this->detach($item);
$this->attach($item);
}
$this->markAsDirty();
} | [
"public",
"function",
"sort",
"(",
"$",
"callbackFunction",
")",
"{",
"$",
"items",
"=",
"iterator_to_array",
"(",
"$",
"this",
",",
"false",
")",
";",
"usort",
"(",
"$",
"items",
",",
"$",
"callbackFunction",
")",
";",
"/** @var \\Tx_Oelib_Model $item */",
... | Sorts this list by using the given callback function.
The callback function, must take 2 parameters and return -1, 0 or 1.
The return value -1 means that the first parameter is sorted before the
second one, 1 means that the second parameter is sorted before the first
one and 0 means the parameters stay in order.
@param mixed $callbackFunction a callback function to use with the models stored in the list, must not be empty
@return void | [
"Sorts",
"this",
"list",
"by",
"using",
"the",
"given",
"callback",
"function",
"."
] | f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1 | https://github.com/oliverklee/ext-oelib/blob/f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1/Classes/List.php#L174-L186 | train |
oliverklee/ext-oelib | Classes/List.php | Tx_Oelib_List.purgeCurrent | public function purgeCurrent()
{
if (!$this->valid()) {
return;
}
if ($this->current()->hasUid()) {
$uid = $this->current()->getUid();
if (isset($this->uids[$uid])) {
unset($this->uids[$uid]);
}
}
$this->detach($this->current());
$this->markAsDirty();
} | php | public function purgeCurrent()
{
if (!$this->valid()) {
return;
}
if ($this->current()->hasUid()) {
$uid = $this->current()->getUid();
if (isset($this->uids[$uid])) {
unset($this->uids[$uid]);
}
}
$this->detach($this->current());
$this->markAsDirty();
} | [
"public",
"function",
"purgeCurrent",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"valid",
"(",
")",
")",
"{",
"return",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"current",
"(",
")",
"->",
"hasUid",
"(",
")",
")",
"{",
"$",
"uid",
"=",
"... | Drops the current element from the list and sets the pointer to the
next element.
If the pointer does not point to a valid element, this function is a
no-op.
@return void | [
"Drops",
"the",
"current",
"element",
"from",
"the",
"list",
"and",
"sets",
"the",
"pointer",
"to",
"the",
"next",
"element",
"."
] | f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1 | https://github.com/oliverklee/ext-oelib/blob/f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1/Classes/List.php#L216-L232 | train |
oliverklee/ext-oelib | Classes/Model.php | Tx_Oelib_Model.resetData | public function resetData(array $data)
{
$this->data = $data;
if ($this->existsKey('uid')) {
if (!$this->hasUid()) {
$this->setUid((int)$this->data['uid']);
}
unset($this->data['uid']);
}
$this->markAsLoaded();
if ($this->hasUid()) {
$this->markAsClean();
} else {
$this->markAsDirty();
}
} | php | public function resetData(array $data)
{
$this->data = $data;
if ($this->existsKey('uid')) {
if (!$this->hasUid()) {
$this->setUid((int)$this->data['uid']);
}
unset($this->data['uid']);
}
$this->markAsLoaded();
if ($this->hasUid()) {
$this->markAsClean();
} else {
$this->markAsDirty();
}
} | [
"public",
"function",
"resetData",
"(",
"array",
"$",
"data",
")",
"{",
"$",
"this",
"->",
"data",
"=",
"$",
"data",
";",
"if",
"(",
"$",
"this",
"->",
"existsKey",
"(",
"'uid'",
")",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasUid",
"(",
... | Sets the complete data for this model.
This function may be called more than once.
@param array $data the data for this model, may be empty
@return void | [
"Sets",
"the",
"complete",
"data",
"for",
"this",
"model",
"."
] | f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1 | https://github.com/oliverklee/ext-oelib/blob/f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1/Classes/Model.php#L159-L175 | train |
oliverklee/ext-oelib | Classes/Model.php | Tx_Oelib_Model.setUid | public function setUid($uid)
{
if ($this->hasUid()) {
throw new \BadMethodCallException('The UID of a model cannot be set a second time.', 1331489260);
}
if ($this->isVirgin()) {
$this->setLoadStatus(self::STATUS_GHOST);
}
$this->uid = $uid;
} | php | public function setUid($uid)
{
if ($this->hasUid()) {
throw new \BadMethodCallException('The UID of a model cannot be set a second time.', 1331489260);
}
if ($this->isVirgin()) {
$this->setLoadStatus(self::STATUS_GHOST);
}
$this->uid = $uid;
} | [
"public",
"function",
"setUid",
"(",
"$",
"uid",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"hasUid",
"(",
")",
")",
"{",
"throw",
"new",
"\\",
"BadMethodCallException",
"(",
"'The UID of a model cannot be set a second time.'",
",",
"1331489260",
")",
";",
"}",
... | Sets this model's UID.
This function may only be called on models that do not have a UID yet.
If this function is called on an empty model, the model state is changed
to ghost.
@param int $uid the UID to set, must be > 0
@return void | [
"Sets",
"this",
"model",
"s",
"UID",
"."
] | f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1 | https://github.com/oliverklee/ext-oelib/blob/f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1/Classes/Model.php#L233-L243 | train |
oliverklee/ext-oelib | Classes/Model.php | Tx_Oelib_Model.load | private function load()
{
if ($this->isVirgin()) {
throw new \BadMethodCallException(
get_class($this) . '#' . $this->getUid()
. ': Please call setData() directly after instantiation first.',
1331489395
);
}
if ($this->isGhost()) {
if (!$this->hasLoadCallBack()) {
throw new \BadMethodCallException(
'Ghosts need a load callback function before their data can be accessed.',
1331489414
);
}
$this->markAsLoading();
call_user_func($this->loadCallback, $this);
}
} | php | private function load()
{
if ($this->isVirgin()) {
throw new \BadMethodCallException(
get_class($this) . '#' . $this->getUid()
. ': Please call setData() directly after instantiation first.',
1331489395
);
}
if ($this->isGhost()) {
if (!$this->hasLoadCallBack()) {
throw new \BadMethodCallException(
'Ghosts need a load callback function before their data can be accessed.',
1331489414
);
}
$this->markAsLoading();
call_user_func($this->loadCallback, $this);
}
} | [
"private",
"function",
"load",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isVirgin",
"(",
")",
")",
"{",
"throw",
"new",
"\\",
"BadMethodCallException",
"(",
"get_class",
"(",
"$",
"this",
")",
".",
"'#'",
".",
"$",
"this",
"->",
"getUid",
"(",
... | Makes sure this model has some data by loading the data for ghost models.
@return void | [
"Makes",
"sure",
"this",
"model",
"has",
"some",
"data",
"by",
"loading",
"the",
"data",
"for",
"ghost",
"models",
"."
] | f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1 | https://github.com/oliverklee/ext-oelib/blob/f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1/Classes/Model.php#L395-L416 | train |
oliverklee/ext-oelib | Classes/Model.php | Tx_Oelib_Model.setToDeleted | public function setToDeleted()
{
if ($this->isLoaded()) {
$this->data['deleted'] = true;
$this->markAsDirty();
} else {
$this->markAsDead();
}
} | php | public function setToDeleted()
{
if ($this->isLoaded()) {
$this->data['deleted'] = true;
$this->markAsDirty();
} else {
$this->markAsDead();
}
} | [
"public",
"function",
"setToDeleted",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isLoaded",
"(",
")",
")",
"{",
"$",
"this",
"->",
"data",
"[",
"'deleted'",
"]",
"=",
"true",
";",
"$",
"this",
"->",
"markAsDirty",
"(",
")",
";",
"}",
"else",
"... | Sets the "deleted" property for the current model.
Note: This function is intended to be called only by a data mapper.
@return void | [
"Sets",
"the",
"deleted",
"property",
"for",
"the",
"current",
"model",
"."
] | f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1 | https://github.com/oliverklee/ext-oelib/blob/f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1/Classes/Model.php#L603-L611 | train |
oliverklee/ext-oelib | Classes/Model.php | Tx_Oelib_Model.isEmpty | public function isEmpty()
{
if ($this->isGhost()) {
$this->load();
$this->markAsLoaded();
}
return empty($this->data);
} | php | public function isEmpty()
{
if ($this->isGhost()) {
$this->load();
$this->markAsLoaded();
}
return empty($this->data);
} | [
"public",
"function",
"isEmpty",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isGhost",
"(",
")",
")",
"{",
"$",
"this",
"->",
"load",
"(",
")",
";",
"$",
"this",
"->",
"markAsLoaded",
"(",
")",
";",
"}",
"return",
"empty",
"(",
"$",
"this",
"... | Checks whether this model is empty.
@return bool TRUE if this model is empty, FALSE if it is writable | [
"Checks",
"whether",
"this",
"model",
"is",
"empty",
"."
] | f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1 | https://github.com/oliverklee/ext-oelib/blob/f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1/Classes/Model.php#L705-L712 | train |
webeweb/jquery-datatables-bundle | API/DataTablesEnumerator.php | DataTablesEnumerator.enumParameters | public static function enumParameters() {
return [
DataTablesRequestInterface::DATATABLES_PARAMETER_COLUMNS,
DataTablesRequestInterface::DATATABLES_PARAMETER_DRAW,
DataTablesRequestInterface::DATATABLES_PARAMETER_LENGTH,
DataTablesRequestInterface::DATATABLES_PARAMETER_ORDER,
DataTablesRequestInterface::DATATABLES_PARAMETER_SEARCH,
DataTablesRequestInterface::DATATABLES_PARAMETER_START,
];
} | php | public static function enumParameters() {
return [
DataTablesRequestInterface::DATATABLES_PARAMETER_COLUMNS,
DataTablesRequestInterface::DATATABLES_PARAMETER_DRAW,
DataTablesRequestInterface::DATATABLES_PARAMETER_LENGTH,
DataTablesRequestInterface::DATATABLES_PARAMETER_ORDER,
DataTablesRequestInterface::DATATABLES_PARAMETER_SEARCH,
DataTablesRequestInterface::DATATABLES_PARAMETER_START,
];
} | [
"public",
"static",
"function",
"enumParameters",
"(",
")",
"{",
"return",
"[",
"DataTablesRequestInterface",
"::",
"DATATABLES_PARAMETER_COLUMNS",
",",
"DataTablesRequestInterface",
"::",
"DATATABLES_PARAMETER_DRAW",
",",
"DataTablesRequestInterface",
"::",
"DATATABLES_PARAMET... | Enumerates parameters.
@return array Returns the parameters enumeration. | [
"Enumerates",
"parameters",
"."
] | b53df9585a523fa1617128e6b467a5e574262a94 | https://github.com/webeweb/jquery-datatables-bundle/blob/b53df9585a523fa1617128e6b467a5e574262a94/API/DataTablesEnumerator.php#L63-L72 | train |
webeweb/jquery-datatables-bundle | API/DataTablesEnumerator.php | DataTablesEnumerator.enumTypes | public static function enumTypes() {
return [
DataTablesColumnInterface::DATATABLES_TYPE_DATE,
DataTablesColumnInterface::DATATABLES_TYPE_HTML,
DataTablesColumnInterface::DATATABLES_TYPE_HTML_NUM,
DataTablesColumnInterface::DATATABLES_TYPE_NUM,
DataTablesColumnInterface::DATATABLES_TYPE_NUM_FMT,
DataTablesColumnInterface::DATATABLES_TYPE_STRING,
];
} | php | public static function enumTypes() {
return [
DataTablesColumnInterface::DATATABLES_TYPE_DATE,
DataTablesColumnInterface::DATATABLES_TYPE_HTML,
DataTablesColumnInterface::DATATABLES_TYPE_HTML_NUM,
DataTablesColumnInterface::DATATABLES_TYPE_NUM,
DataTablesColumnInterface::DATATABLES_TYPE_NUM_FMT,
DataTablesColumnInterface::DATATABLES_TYPE_STRING,
];
} | [
"public",
"static",
"function",
"enumTypes",
"(",
")",
"{",
"return",
"[",
"DataTablesColumnInterface",
"::",
"DATATABLES_TYPE_DATE",
",",
"DataTablesColumnInterface",
"::",
"DATATABLES_TYPE_HTML",
",",
"DataTablesColumnInterface",
"::",
"DATATABLES_TYPE_HTML_NUM",
",",
"Da... | Enumerates types.
@return array Returns the types enumeration. | [
"Enumerates",
"types",
"."
] | b53df9585a523fa1617128e6b467a5e574262a94 | https://github.com/webeweb/jquery-datatables-bundle/blob/b53df9585a523fa1617128e6b467a5e574262a94/API/DataTablesEnumerator.php#L93-L102 | train |
oliverklee/ext-oelib | Classes/IdentityMap.php | Tx_Oelib_IdentityMap.add | public function add(\Tx_Oelib_Model $model)
{
if (!$model->hasUid()) {
throw new \InvalidArgumentException('Add() requires a model that has a UID.', 1331488748);
}
$this->items[$model->getUid()] = $model;
$this->highestUid = max($this->highestUid, $model->getUid());
} | php | public function add(\Tx_Oelib_Model $model)
{
if (!$model->hasUid()) {
throw new \InvalidArgumentException('Add() requires a model that has a UID.', 1331488748);
}
$this->items[$model->getUid()] = $model;
$this->highestUid = max($this->highestUid, $model->getUid());
} | [
"public",
"function",
"add",
"(",
"\\",
"Tx_Oelib_Model",
"$",
"model",
")",
"{",
"if",
"(",
"!",
"$",
"model",
"->",
"hasUid",
"(",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'Add() requires a model that has a UID.'",
",",
"1331488... | Adds a model to the identity map.
@param \Tx_Oelib_Model $model the model to add, must have a UID
@return void | [
"Adds",
"a",
"model",
"to",
"the",
"identity",
"map",
"."
] | f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1 | https://github.com/oliverklee/ext-oelib/blob/f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1/Classes/IdentityMap.php#L27-L35 | train |
oliverklee/ext-oelib | Classes/IdentityMap.php | Tx_Oelib_IdentityMap.get | public function get($uid)
{
if ($uid <= 0) {
throw new \InvalidArgumentException('$uid must be > 0.', 1331488761);
}
if (!isset($this->items[$uid])) {
throw new \Tx_Oelib_Exception_NotFound(
'This map currently does not contain a model with the UID ' .
$uid . '.'
);
}
return $this->items[$uid];
} | php | public function get($uid)
{
if ($uid <= 0) {
throw new \InvalidArgumentException('$uid must be > 0.', 1331488761);
}
if (!isset($this->items[$uid])) {
throw new \Tx_Oelib_Exception_NotFound(
'This map currently does not contain a model with the UID ' .
$uid . '.'
);
}
return $this->items[$uid];
} | [
"public",
"function",
"get",
"(",
"$",
"uid",
")",
"{",
"if",
"(",
"$",
"uid",
"<=",
"0",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'$uid must be > 0.'",
",",
"1331488761",
")",
";",
"}",
"if",
"(",
"!",
"isset",
"(",
"$",
"th... | Retrieves a model from the map by UID.
@throws \Tx_Oelib_Exception_NotFound if this map does not have a model
with that particular UID
@param int $uid the UID of the model to retrieve, must be > 0
@return \Tx_Oelib_Model the stored model with the UID $uid | [
"Retrieves",
"a",
"model",
"from",
"the",
"map",
"by",
"UID",
"."
] | f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1 | https://github.com/oliverklee/ext-oelib/blob/f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1/Classes/IdentityMap.php#L47-L61 | train |
rdohms/DMS | src/DMS/Bundle/MeetupApiBundle/Service/ClientFactory.php | ClientFactory.getKeyAuthClient | public function getKeyAuthClient($forceNew = false)
{
if ( ! isset($this->instances[self::CLIENT_KEY]) || $forceNew) {
$this->instances[self::CLIENT_KEY] = MeetupKeyAuthClient::factory($this->config);
}
return $this->instances[self::CLIENT_KEY];
} | php | public function getKeyAuthClient($forceNew = false)
{
if ( ! isset($this->instances[self::CLIENT_KEY]) || $forceNew) {
$this->instances[self::CLIENT_KEY] = MeetupKeyAuthClient::factory($this->config);
}
return $this->instances[self::CLIENT_KEY];
} | [
"public",
"function",
"getKeyAuthClient",
"(",
"$",
"forceNew",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"instances",
"[",
"self",
"::",
"CLIENT_KEY",
"]",
")",
"||",
"$",
"forceNew",
")",
"{",
"$",
"this",
"->",
"inst... | Get a new instance of a Key Auth Client for Meetup API
@param bool $forceNew
@return MeetupKeyAuthClient | [
"Get",
"a",
"new",
"instance",
"of",
"a",
"Key",
"Auth",
"Client",
"for",
"Meetup",
"API"
] | 3fab902ac2db2a31876101280cdfe7611146a243 | https://github.com/rdohms/DMS/blob/3fab902ac2db2a31876101280cdfe7611146a243/src/DMS/Bundle/MeetupApiBundle/Service/ClientFactory.php#L47-L54 | train |
rdohms/DMS | src/DMS/Bundle/MeetupApiBundle/Service/ClientFactory.php | ClientFactory.getOauthClient | public function getOauthClient($forceNew = false)
{
if ( ! isset($this->instances[self::CLIENT_OAUTH]) || $forceNew) {
$this->instances[self::CLIENT_OAUTH] = MeetupOAuthClient::factory($this->getUpdatedOauthConfig());
}
return $this->instances[self::CLIENT_OAUTH];
} | php | public function getOauthClient($forceNew = false)
{
if ( ! isset($this->instances[self::CLIENT_OAUTH]) || $forceNew) {
$this->instances[self::CLIENT_OAUTH] = MeetupOAuthClient::factory($this->getUpdatedOauthConfig());
}
return $this->instances[self::CLIENT_OAUTH];
} | [
"public",
"function",
"getOauthClient",
"(",
"$",
"forceNew",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"instances",
"[",
"self",
"::",
"CLIENT_OAUTH",
"]",
")",
"||",
"$",
"forceNew",
")",
"{",
"$",
"this",
"->",
"inst... | Get a new instance of a Oauth Client for Meetup API
@param bool $forceNew
@return MeetupOAuthClient | [
"Get",
"a",
"new",
"instance",
"of",
"a",
"Oauth",
"Client",
"for",
"Meetup",
"API"
] | 3fab902ac2db2a31876101280cdfe7611146a243 | https://github.com/rdohms/DMS/blob/3fab902ac2db2a31876101280cdfe7611146a243/src/DMS/Bundle/MeetupApiBundle/Service/ClientFactory.php#L62-L69 | train |
rdohms/DMS | src/DMS/Bundle/MeetupApiBundle/Service/ClientFactory.php | ClientFactory.getUpdatedOauthConfig | public function getUpdatedOauthConfig()
{
$token = $this->session->has(self::SESSION_TOKEN_KEY)
? $this->session->get(self::SESSION_TOKEN_KEY)
: false;
$tokenSecret = $this->session->has(self::SESSION_TOKEN_SECRET_KEY)
? $this->session->get(self::SESSION_TOKEN_SECRET_KEY)
: false;
return array_merge(
array('token' => $token, 'token_secret' => $tokenSecret),
$this->config
);
} | php | public function getUpdatedOauthConfig()
{
$token = $this->session->has(self::SESSION_TOKEN_KEY)
? $this->session->get(self::SESSION_TOKEN_KEY)
: false;
$tokenSecret = $this->session->has(self::SESSION_TOKEN_SECRET_KEY)
? $this->session->get(self::SESSION_TOKEN_SECRET_KEY)
: false;
return array_merge(
array('token' => $token, 'token_secret' => $tokenSecret),
$this->config
);
} | [
"public",
"function",
"getUpdatedOauthConfig",
"(",
")",
"{",
"$",
"token",
"=",
"$",
"this",
"->",
"session",
"->",
"has",
"(",
"self",
"::",
"SESSION_TOKEN_KEY",
")",
"?",
"$",
"this",
"->",
"session",
"->",
"get",
"(",
"self",
"::",
"SESSION_TOKEN_KEY",... | Loads Oauth token and secret from session and adds to configuration
@return array | [
"Loads",
"Oauth",
"token",
"and",
"secret",
"from",
"session",
"and",
"adds",
"to",
"configuration"
] | 3fab902ac2db2a31876101280cdfe7611146a243 | https://github.com/rdohms/DMS/blob/3fab902ac2db2a31876101280cdfe7611146a243/src/DMS/Bundle/MeetupApiBundle/Service/ClientFactory.php#L76-L90 | train |
rdohms/DMS | src/DMS/Bundle/MeetupApiBundle/Service/ClientFactory.php | ClientFactory.setSessionTokens | public function setSessionTokens($token, $tokenSecret = null)
{
$this->session->set(self::SESSION_TOKEN_KEY, $token);
$this->session->set(self::SESSION_TOKEN_SECRET_KEY, $tokenSecret);
} | php | public function setSessionTokens($token, $tokenSecret = null)
{
$this->session->set(self::SESSION_TOKEN_KEY, $token);
$this->session->set(self::SESSION_TOKEN_SECRET_KEY, $tokenSecret);
} | [
"public",
"function",
"setSessionTokens",
"(",
"$",
"token",
",",
"$",
"tokenSecret",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"session",
"->",
"set",
"(",
"self",
"::",
"SESSION_TOKEN_KEY",
",",
"$",
"token",
")",
";",
"$",
"this",
"->",
"session",
"... | Set the necessary token in the session for future OAuth Clients
@param string $token
@param string $tokenSecret | [
"Set",
"the",
"necessary",
"token",
"in",
"the",
"session",
"for",
"future",
"OAuth",
"Clients"
] | 3fab902ac2db2a31876101280cdfe7611146a243 | https://github.com/rdohms/DMS/blob/3fab902ac2db2a31876101280cdfe7611146a243/src/DMS/Bundle/MeetupApiBundle/Service/ClientFactory.php#L98-L102 | train |
rdohms/DMS | src/DMS/Bundle/MeetupApiBundle/Service/ClientFactory.php | ClientFactory.clearSessionTokens | public function clearSessionTokens()
{
$this->session->remove(self::SESSION_TOKEN_KEY);
$this->session->remove(self::SESSION_TOKEN_SECRET_KEY);
} | php | public function clearSessionTokens()
{
$this->session->remove(self::SESSION_TOKEN_KEY);
$this->session->remove(self::SESSION_TOKEN_SECRET_KEY);
} | [
"public",
"function",
"clearSessionTokens",
"(",
")",
"{",
"$",
"this",
"->",
"session",
"->",
"remove",
"(",
"self",
"::",
"SESSION_TOKEN_KEY",
")",
";",
"$",
"this",
"->",
"session",
"->",
"remove",
"(",
"self",
"::",
"SESSION_TOKEN_SECRET_KEY",
")",
";",
... | Removes tokens from session | [
"Removes",
"tokens",
"from",
"session"
] | 3fab902ac2db2a31876101280cdfe7611146a243 | https://github.com/rdohms/DMS/blob/3fab902ac2db2a31876101280cdfe7611146a243/src/DMS/Bundle/MeetupApiBundle/Service/ClientFactory.php#L107-L111 | train |
rdohms/DMS | src/DMS/Bundle/MeetupApiBundle/Service/ClientFactory.php | ClientFactory.hasSessionTokens | public function hasSessionTokens()
{
return ($this->session->has(self::SESSION_TOKEN_KEY)
&& $this->session->has(self::SESSION_TOKEN_SECRET_KEY));
} | php | public function hasSessionTokens()
{
return ($this->session->has(self::SESSION_TOKEN_KEY)
&& $this->session->has(self::SESSION_TOKEN_SECRET_KEY));
} | [
"public",
"function",
"hasSessionTokens",
"(",
")",
"{",
"return",
"(",
"$",
"this",
"->",
"session",
"->",
"has",
"(",
"self",
"::",
"SESSION_TOKEN_KEY",
")",
"&&",
"$",
"this",
"->",
"session",
"->",
"has",
"(",
"self",
"::",
"SESSION_TOKEN_SECRET_KEY",
... | Checks if there is a token in the session
@return bool | [
"Checks",
"if",
"there",
"is",
"a",
"token",
"in",
"the",
"session"
] | 3fab902ac2db2a31876101280cdfe7611146a243 | https://github.com/rdohms/DMS/blob/3fab902ac2db2a31876101280cdfe7611146a243/src/DMS/Bundle/MeetupApiBundle/Service/ClientFactory.php#L118-L122 | train |
codezero-be/twitter | src/Entities/Tweet.php | Tweet.createTweet | private function createTweet(array $tweet, User $user)
{
$this->fields = [
'id' => $this->getValue('id', $tweet),
'text' => $this->getValue('text', $tweet),
'source' => $this->getValue('source', $tweet),
'url' => $this->getValue('url', $tweet),
'retweet_count' => $this->getValue('retweet_count', $tweet),
'favorite_count' => $this->getValue('favorite_count', $tweet),
'created_at' => $this->getValue('created_at', $tweet),
'hashtags' => $this->listHashTags($tweet),
'user' => $user
];
} | php | private function createTweet(array $tweet, User $user)
{
$this->fields = [
'id' => $this->getValue('id', $tweet),
'text' => $this->getValue('text', $tweet),
'source' => $this->getValue('source', $tweet),
'url' => $this->getValue('url', $tweet),
'retweet_count' => $this->getValue('retweet_count', $tweet),
'favorite_count' => $this->getValue('favorite_count', $tweet),
'created_at' => $this->getValue('created_at', $tweet),
'hashtags' => $this->listHashTags($tweet),
'user' => $user
];
} | [
"private",
"function",
"createTweet",
"(",
"array",
"$",
"tweet",
",",
"User",
"$",
"user",
")",
"{",
"$",
"this",
"->",
"fields",
"=",
"[",
"'id'",
"=>",
"$",
"this",
"->",
"getValue",
"(",
"'id'",
",",
"$",
"tweet",
")",
",",
"'text'",
"=>",
"$",... | Set most used tweet properties
@link https://dev.twitter.com/docs/platform-objects/tweets
@param array $tweet
@param User $user
@return void | [
"Set",
"most",
"used",
"tweet",
"properties"
] | 272ef08e0f8d1ecd4b9534a3a0634b811aef6034 | https://github.com/codezero-be/twitter/blob/272ef08e0f8d1ecd4b9534a3a0634b811aef6034/src/Entities/Tweet.php#L133-L146 | train |
codezero-be/twitter | src/Entities/Tweet.php | Tweet.listHashTags | private function listHashTags(array $tweet)
{
$list = [];
if (array_key_exists('entities', $tweet) and array_key_exists('hashtags', $tweet['entities']))
{
$hashTags = $tweet['entities']['hashtags'];
foreach ($hashTags as $hashTag)
{
if (array_key_exists('text', $hashTag))
{
$list[] = $hashTag['text'];
}
}
}
return $list;
} | php | private function listHashTags(array $tweet)
{
$list = [];
if (array_key_exists('entities', $tweet) and array_key_exists('hashtags', $tweet['entities']))
{
$hashTags = $tweet['entities']['hashtags'];
foreach ($hashTags as $hashTag)
{
if (array_key_exists('text', $hashTag))
{
$list[] = $hashTag['text'];
}
}
}
return $list;
} | [
"private",
"function",
"listHashTags",
"(",
"array",
"$",
"tweet",
")",
"{",
"$",
"list",
"=",
"[",
"]",
";",
"if",
"(",
"array_key_exists",
"(",
"'entities'",
",",
"$",
"tweet",
")",
"and",
"array_key_exists",
"(",
"'hashtags'",
",",
"$",
"tweet",
"[",
... | List all tweet hash tags
@param array $tweet
@return array | [
"List",
"all",
"tweet",
"hash",
"tags"
] | 272ef08e0f8d1ecd4b9534a3a0634b811aef6034 | https://github.com/codezero-be/twitter/blob/272ef08e0f8d1ecd4b9534a3a0634b811aef6034/src/Entities/Tweet.php#L155-L173 | train |
oliverklee/ext-oelib | Classes/HeaderProxyFactory.php | Tx_Oelib_HeaderProxyFactory.getHeaderProxy | public function getHeaderProxy()
{
if ($this->isTestMode) {
$className = \Tx_Oelib_HeaderCollector::class;
} else {
$className = \Tx_Oelib_RealHeaderProxy::class;
}
if (!is_object($this->headerProxy) || (get_class($this->headerProxy) !== $className)) {
$this->headerProxy = GeneralUtility::makeInstance($className);
}
return $this->headerProxy;
} | php | public function getHeaderProxy()
{
if ($this->isTestMode) {
$className = \Tx_Oelib_HeaderCollector::class;
} else {
$className = \Tx_Oelib_RealHeaderProxy::class;
}
if (!is_object($this->headerProxy) || (get_class($this->headerProxy) !== $className)) {
$this->headerProxy = GeneralUtility::makeInstance($className);
}
return $this->headerProxy;
} | [
"public",
"function",
"getHeaderProxy",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isTestMode",
")",
"{",
"$",
"className",
"=",
"\\",
"Tx_Oelib_HeaderCollector",
"::",
"class",
";",
"}",
"else",
"{",
"$",
"className",
"=",
"\\",
"Tx_Oelib_RealHeaderProxy... | Retrieves the singleton header proxy instance. Depending on the mode,
this instance is either a header collector or a real header proxy.
@return \Tx_Oelib_AbstractHeaderProxy|\Tx_Oelib_HeaderCollector|\Tx_Oelib_RealHeaderProxy the singleton header
proxy | [
"Retrieves",
"the",
"singleton",
"header",
"proxy",
"instance",
".",
"Depending",
"on",
"the",
"mode",
"this",
"instance",
"is",
"either",
"a",
"header",
"collector",
"or",
"a",
"real",
"header",
"proxy",
"."
] | f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1 | https://github.com/oliverklee/ext-oelib/blob/f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1/Classes/HeaderProxyFactory.php#L58-L71 | train |
gourmet/aroma | src/Core/Configure/Engine/DbConfig.php | DbConfig.read | public function read($key)
{
$query = $this->_table->find('kv');
if ($key !== '*') {
$query->where([
$this->_table->aliasField('namespace') . ' IS' => $key
]);
}
return $query
->cache(function ($q) {
return md5(serialize($q->clause('where')));
}, $this->_cacheConfig)
->toArray();
} | php | public function read($key)
{
$query = $this->_table->find('kv');
if ($key !== '*') {
$query->where([
$this->_table->aliasField('namespace') . ' IS' => $key
]);
}
return $query
->cache(function ($q) {
return md5(serialize($q->clause('where')));
}, $this->_cacheConfig)
->toArray();
} | [
"public",
"function",
"read",
"(",
"$",
"key",
")",
"{",
"$",
"query",
"=",
"$",
"this",
"->",
"_table",
"->",
"find",
"(",
"'kv'",
")",
";",
"if",
"(",
"$",
"key",
"!==",
"'*'",
")",
"{",
"$",
"query",
"->",
"where",
"(",
"[",
"$",
"this",
"... | Read method is used for reading configuration information from sources.
These sources can either be static resources like files, or dynamic ones like
a database, or other datasource.
@param string $key Key to read.
@return array An array of data to merge into the runtime configuration | [
"Read",
"method",
"is",
"used",
"for",
"reading",
"configuration",
"information",
"from",
"sources",
".",
"These",
"sources",
"can",
"either",
"be",
"static",
"resources",
"like",
"files",
"or",
"dynamic",
"ones",
"like",
"a",
"database",
"or",
"other",
"datas... | c227b03f482082bdd5051d764cf1adfc2397a3fb | https://github.com/gourmet/aroma/blob/c227b03f482082bdd5051d764cf1adfc2397a3fb/src/Core/Configure/Engine/DbConfig.php#L63-L78 | train |
wp-jungle/baobab | src/Baobab/Configuration/Initializer/ImageSizes.php | ImageSizes.addImageSizes | private function addImageSizes()
{
$data = $this->getData();
foreach ($data as $slug => $props)
{
add_image_size($slug, $props['width'], $props['height'], $props['crop']);
}
} | php | private function addImageSizes()
{
$data = $this->getData();
foreach ($data as $slug => $props)
{
add_image_size($slug, $props['width'], $props['height'], $props['crop']);
}
} | [
"private",
"function",
"addImageSizes",
"(",
")",
"{",
"$",
"data",
"=",
"$",
"this",
"->",
"getData",
"(",
")",
";",
"foreach",
"(",
"$",
"data",
"as",
"$",
"slug",
"=>",
"$",
"props",
")",
"{",
"add_image_size",
"(",
"$",
"slug",
",",
"$",
"props... | Loop through the registered image sizes and add them.
@return void | [
"Loop",
"through",
"the",
"registered",
"image",
"sizes",
"and",
"add",
"them",
"."
] | ed2a9f2bbc3d194aa4df454b50aec43796fc68da | https://github.com/wp-jungle/baobab/blob/ed2a9f2bbc3d194aa4df454b50aec43796fc68da/src/Baobab/Configuration/Initializer/ImageSizes.php#L47-L54 | train |
wp-jungle/baobab | src/Baobab/Configuration/Initializer/ImageSizes.php | ImageSizes.addSizesToDropDownList | public function addSizesToDropDownList($sizes)
{
$new = array();
$data = $this->getData();
foreach ($data as $slug => $props)
{
// If no 4th option, stop the loop.
if ( !isset($props['media']) || false == $props['media'])
{
continue;
}
$new[$slug] = isset($props['mediaLabel']) ? $props['mediaLabel'] : Strings::labelizeSlug($slug);
// Internationalize what has to be
$new[$slug] = Strings::translate($new[$slug]);
}
return array_merge($sizes, $new);
} | php | public function addSizesToDropDownList($sizes)
{
$new = array();
$data = $this->getData();
foreach ($data as $slug => $props)
{
// If no 4th option, stop the loop.
if ( !isset($props['media']) || false == $props['media'])
{
continue;
}
$new[$slug] = isset($props['mediaLabel']) ? $props['mediaLabel'] : Strings::labelizeSlug($slug);
// Internationalize what has to be
$new[$slug] = Strings::translate($new[$slug]);
}
return array_merge($sizes, $new);
} | [
"public",
"function",
"addSizesToDropDownList",
"(",
"$",
"sizes",
")",
"{",
"$",
"new",
"=",
"array",
"(",
")",
";",
"$",
"data",
"=",
"$",
"this",
"->",
"getData",
"(",
")",
";",
"foreach",
"(",
"$",
"data",
"as",
"$",
"slug",
"=>",
"$",
"props",... | Add image sizes to the media size dropdown list.
@param array $sizes The existing sizes.
@return array | [
"Add",
"image",
"sizes",
"to",
"the",
"media",
"size",
"dropdown",
"list",
"."
] | ed2a9f2bbc3d194aa4df454b50aec43796fc68da | https://github.com/wp-jungle/baobab/blob/ed2a9f2bbc3d194aa4df454b50aec43796fc68da/src/Baobab/Configuration/Initializer/ImageSizes.php#L63-L83 | train |
oliverklee/ext-oelib | Classes/Geocoding/Calculator.php | Tx_Oelib_Geocoding_Calculator.calculateDistanceInKilometers | public function calculateDistanceInKilometers(
\Tx_Oelib_Interface_Geo $object1,
\Tx_Oelib_Interface_Geo $object2
) {
if ($object1->hasGeoError()) {
throw new \InvalidArgumentException('$object1 has a geo error.');
}
if ($object2->hasGeoError()) {
throw new \InvalidArgumentException('$object2 has a geo error.');
}
if (!$object1->hasGeoCoordinates()) {
throw new \InvalidArgumentException(
'$object1 needs to have coordinates, but has none.'
);
}
if (!$object2->hasGeoCoordinates()) {
throw new \InvalidArgumentException(
'$object2 needs to have coordinates, but has none.'
);
}
$coordinates1 = $object1->getGeoCoordinates();
$latitude1 = \deg2rad($coordinates1['latitude']);
$longitude1 = \deg2rad($coordinates1['longitude']);
$coordinates2 = $object2->getGeoCoordinates();
$latitude2 = \deg2rad($coordinates2['latitude']);
$longitude2 = \deg2rad($coordinates2['longitude']);
return \acos(
\sin($latitude1) * \sin($latitude2)
+ \cos($latitude1) * \cos($latitude2) * \cos($longitude2 - $longitude1)
) * self::EARTH_RADIUS_IN_KILOMETERS;
} | php | public function calculateDistanceInKilometers(
\Tx_Oelib_Interface_Geo $object1,
\Tx_Oelib_Interface_Geo $object2
) {
if ($object1->hasGeoError()) {
throw new \InvalidArgumentException('$object1 has a geo error.');
}
if ($object2->hasGeoError()) {
throw new \InvalidArgumentException('$object2 has a geo error.');
}
if (!$object1->hasGeoCoordinates()) {
throw new \InvalidArgumentException(
'$object1 needs to have coordinates, but has none.'
);
}
if (!$object2->hasGeoCoordinates()) {
throw new \InvalidArgumentException(
'$object2 needs to have coordinates, but has none.'
);
}
$coordinates1 = $object1->getGeoCoordinates();
$latitude1 = \deg2rad($coordinates1['latitude']);
$longitude1 = \deg2rad($coordinates1['longitude']);
$coordinates2 = $object2->getGeoCoordinates();
$latitude2 = \deg2rad($coordinates2['latitude']);
$longitude2 = \deg2rad($coordinates2['longitude']);
return \acos(
\sin($latitude1) * \sin($latitude2)
+ \cos($latitude1) * \cos($latitude2) * \cos($longitude2 - $longitude1)
) * self::EARTH_RADIUS_IN_KILOMETERS;
} | [
"public",
"function",
"calculateDistanceInKilometers",
"(",
"\\",
"Tx_Oelib_Interface_Geo",
"$",
"object1",
",",
"\\",
"Tx_Oelib_Interface_Geo",
"$",
"object2",
")",
"{",
"if",
"(",
"$",
"object1",
"->",
"hasGeoError",
"(",
")",
")",
"{",
"throw",
"new",
"\\",
... | Calculates the great-circle distance in kilometers between two geo
objects using the haversine formula.
@param \Tx_Oelib_Interface_Geo $object1
the first object, must have geo coordinates
@param \Tx_Oelib_Interface_Geo $object2
the second object, must have geo coordinates
@return float the distance between $object1 and $object2 in kilometers, will be >= 0.0
@throws \InvalidArgumentException | [
"Calculates",
"the",
"great",
"-",
"circle",
"distance",
"in",
"kilometers",
"between",
"two",
"geo",
"objects",
"using",
"the",
"haversine",
"formula",
"."
] | f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1 | https://github.com/oliverklee/ext-oelib/blob/f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1/Classes/Geocoding/Calculator.php#L35-L67 | train |
oliverklee/ext-oelib | Classes/Geocoding/Calculator.php | Tx_Oelib_Geocoding_Calculator.filterByDistance | public function filterByDistance(\Tx_Oelib_List $unfilteredObjects, \Tx_Oelib_Interface_Geo $center, $distance)
{
$objectsWithinDistance = new \Tx_Oelib_List();
/** @var \Tx_Oelib_Interface_Geo|\Tx_Oelib_Model $object */
foreach ($unfilteredObjects as $object) {
if ($this->calculateDistanceInKilometers($center, $object) <= $distance) {
$objectsWithinDistance->add($object);
}
}
return $objectsWithinDistance;
} | php | public function filterByDistance(\Tx_Oelib_List $unfilteredObjects, \Tx_Oelib_Interface_Geo $center, $distance)
{
$objectsWithinDistance = new \Tx_Oelib_List();
/** @var \Tx_Oelib_Interface_Geo|\Tx_Oelib_Model $object */
foreach ($unfilteredObjects as $object) {
if ($this->calculateDistanceInKilometers($center, $object) <= $distance) {
$objectsWithinDistance->add($object);
}
}
return $objectsWithinDistance;
} | [
"public",
"function",
"filterByDistance",
"(",
"\\",
"Tx_Oelib_List",
"$",
"unfilteredObjects",
",",
"\\",
"Tx_Oelib_Interface_Geo",
"$",
"center",
",",
"$",
"distance",
")",
"{",
"$",
"objectsWithinDistance",
"=",
"new",
"\\",
"Tx_Oelib_List",
"(",
")",
";",
"/... | Filters a list of geo objects by distance around another geo object.
The returned list will only contain objects that are within $distance of
$center, including objects that are located at a distance of exactly
$distance.
@param \Tx_Oelib_List<\Tx_Oelib_Interface_Geo> $unfilteredObjects
the list to filter, may be empty
@param \Tx_Oelib_Interface_Geo $center
the center to which $distance related
@param float $distance
the distance in kilometers within which the returned objects must
be located
@return \Tx_Oelib_List<\Tx_Oelib_Interface_Geo>
a copy of $unfilteredObjects with only those objects that are
located within $distance kilometers of $center | [
"Filters",
"a",
"list",
"of",
"geo",
"objects",
"by",
"distance",
"around",
"another",
"geo",
"object",
"."
] | f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1 | https://github.com/oliverklee/ext-oelib/blob/f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1/Classes/Geocoding/Calculator.php#L88-L100 | train |
veseluy-rodjer/supercrud | src/Commands/CrudCommand.php | CrudCommand.addRoutes | protected function addRoutes()
{
return ["Route::delete('" . $this->routeName . "/arr-delete', '" . $this->controller . "@arrDelete')->name('" . $this->myAddrName . ".arrDelete');\nRoute::resource('" . $this->routeName . "', '" . $this->controller . "');"];
} | php | protected function addRoutes()
{
return ["Route::delete('" . $this->routeName . "/arr-delete', '" . $this->controller . "@arrDelete')->name('" . $this->myAddrName . ".arrDelete');\nRoute::resource('" . $this->routeName . "', '" . $this->controller . "');"];
} | [
"protected",
"function",
"addRoutes",
"(",
")",
"{",
"return",
"[",
"\"Route::delete('\"",
".",
"$",
"this",
"->",
"routeName",
".",
"\"/arr-delete', '\"",
".",
"$",
"this",
"->",
"controller",
".",
"\"@arrDelete')->name('\"",
".",
"$",
"this",
"->",
"myAddrName... | Add routes.
@return array | [
"Add",
"routes",
"."
] | 83b4c92dbfe1c555e55859ee01330ded43070d89 | https://github.com/veseluy-rodjer/supercrud/blob/83b4c92dbfe1c555e55859ee01330ded43070d89/src/Commands/CrudCommand.php#L178-L181 | train |
veseluy-rodjer/supercrud | src/Commands/CrudCommand.php | CrudCommand.processJSONFields | protected function processJSONFields($file)
{
$json = File::get($file);
$fields = json_decode($json);
$fieldsString = '';
foreach ($fields->fields as $field) {
if ($field->type === 'select' || $field->type === 'enum') {
$fieldsString .= $field->name . '#' . $field->type . '#options=' . json_encode($field->options) . ';';
} else {
$fieldsString .= $field->name . '#' . $field->type . ';';
}
}
$fieldsString = rtrim($fieldsString, ';');
return $fieldsString;
} | php | protected function processJSONFields($file)
{
$json = File::get($file);
$fields = json_decode($json);
$fieldsString = '';
foreach ($fields->fields as $field) {
if ($field->type === 'select' || $field->type === 'enum') {
$fieldsString .= $field->name . '#' . $field->type . '#options=' . json_encode($field->options) . ';';
} else {
$fieldsString .= $field->name . '#' . $field->type . ';';
}
}
$fieldsString = rtrim($fieldsString, ';');
return $fieldsString;
} | [
"protected",
"function",
"processJSONFields",
"(",
"$",
"file",
")",
"{",
"$",
"json",
"=",
"File",
"::",
"get",
"(",
"$",
"file",
")",
";",
"$",
"fields",
"=",
"json_decode",
"(",
"$",
"json",
")",
";",
"$",
"fieldsString",
"=",
"''",
";",
"foreach"... | Process the JSON Fields.
@param string $file
@return string | [
"Process",
"the",
"JSON",
"Fields",
"."
] | 83b4c92dbfe1c555e55859ee01330ded43070d89 | https://github.com/veseluy-rodjer/supercrud/blob/83b4c92dbfe1c555e55859ee01330ded43070d89/src/Commands/CrudCommand.php#L190-L207 | train |
silverstripe/silverstripe-sitewidecontent-report | src/SitewideContentReport.php | SitewideContentReport.columns | public function columns($itemType = 'Pages')
{
$columns = [
'Title' => [
'title' => _t(__CLASS__ . '.Name', 'Name'),
'link' => true,
],
'Created' => [
'title' => _t(__CLASS__ . '.Created', 'Date created'),
'formatting' => function ($value, $item) {
return $item->dbObject('Created')->Nice();
},
],
'LastEdited' => [
'title' => _t(__CLASS__ . '.LastEdited', 'Date last edited'),
'formatting' => function ($value, $item) {
return $item->dbObject('LastEdited')->Nice();
},
],
];
if ($itemType === 'Pages') {
// Page specific fields
$columns['i18n_singular_name'] = _t(__CLASS__ . '.PageType', 'Page type');
$columns['StageState'] = [
'title' => _t(__CLASS__ . '.Stage', 'Stage'),
'formatting' => function ($value, $item) {
// Stage only
if (!$item->isPublished()) {
return _t(__CLASS__ . '.Draft', 'Draft');
}
// Pending changes
if ($item->isModifiedOnDraft()) {
return _t(__CLASS__ . '.PublishedWithChanges', 'Published (with changes)');
}
// If on live and unmodified
return _t(__CLASS__ . '.Published', 'Published');
},
];
$columns['RelativeLink'] = _t(__CLASS__ . '.Link', 'Link');
$columns['MetaDescription'] = [
'title' => _t(__CLASS__ . '.MetaDescription', 'Description'),
'printonly' => true,
];
} else {
// File specific fields
$columns['FileType'] = [
'title' => _t(__CLASS__ . '.FileType', 'File type'),
'datasource' => function ($record) {
// Handle folders separately
if ($record instanceof Folder) {
return $record->i18n_singular_name();
}
return $record->getFileType();
}
];
$columns['Size'] = _t(__CLASS__ . '.Size', 'Size');
$columns['Filename'] = _t(__CLASS__ . '.Directory', 'Directory');
}
$this->extend('updateColumns', $itemType, $columns);
return $columns;
} | php | public function columns($itemType = 'Pages')
{
$columns = [
'Title' => [
'title' => _t(__CLASS__ . '.Name', 'Name'),
'link' => true,
],
'Created' => [
'title' => _t(__CLASS__ . '.Created', 'Date created'),
'formatting' => function ($value, $item) {
return $item->dbObject('Created')->Nice();
},
],
'LastEdited' => [
'title' => _t(__CLASS__ . '.LastEdited', 'Date last edited'),
'formatting' => function ($value, $item) {
return $item->dbObject('LastEdited')->Nice();
},
],
];
if ($itemType === 'Pages') {
// Page specific fields
$columns['i18n_singular_name'] = _t(__CLASS__ . '.PageType', 'Page type');
$columns['StageState'] = [
'title' => _t(__CLASS__ . '.Stage', 'Stage'),
'formatting' => function ($value, $item) {
// Stage only
if (!$item->isPublished()) {
return _t(__CLASS__ . '.Draft', 'Draft');
}
// Pending changes
if ($item->isModifiedOnDraft()) {
return _t(__CLASS__ . '.PublishedWithChanges', 'Published (with changes)');
}
// If on live and unmodified
return _t(__CLASS__ . '.Published', 'Published');
},
];
$columns['RelativeLink'] = _t(__CLASS__ . '.Link', 'Link');
$columns['MetaDescription'] = [
'title' => _t(__CLASS__ . '.MetaDescription', 'Description'),
'printonly' => true,
];
} else {
// File specific fields
$columns['FileType'] = [
'title' => _t(__CLASS__ . '.FileType', 'File type'),
'datasource' => function ($record) {
// Handle folders separately
if ($record instanceof Folder) {
return $record->i18n_singular_name();
}
return $record->getFileType();
}
];
$columns['Size'] = _t(__CLASS__ . '.Size', 'Size');
$columns['Filename'] = _t(__CLASS__ . '.Directory', 'Directory');
}
$this->extend('updateColumns', $itemType, $columns);
return $columns;
} | [
"public",
"function",
"columns",
"(",
"$",
"itemType",
"=",
"'Pages'",
")",
"{",
"$",
"columns",
"=",
"[",
"'Title'",
"=>",
"[",
"'title'",
"=>",
"_t",
"(",
"__CLASS__",
".",
"'.Name'",
",",
"'Name'",
")",
",",
"'link'",
"=>",
"true",
",",
"]",
",",
... | Returns columns for the grid fields on this report.
@param string $itemType (i.e 'Pages' or 'Files')
@return array | [
"Returns",
"columns",
"for",
"the",
"grid",
"fields",
"on",
"this",
"report",
"."
] | 8375b4d789d25db3e1f718d48d042d145c083f60 | https://github.com/silverstripe/silverstripe-sitewidecontent-report/blob/8375b4d789d25db3e1f718d48d042d145c083f60/src/SitewideContentReport.php#L103-L169 | train |
silverstripe/silverstripe-sitewidecontent-report | src/SitewideContentReport.php | SitewideContentReport.getPrintExportColumns | public function getPrintExportColumns($gridField, $itemType, $exportColumns)
{
// Swap RelativeLink for AbsoluteLink for export
$exportColumns['AbsoluteLink'] = _t(__CLASS__ . '.Link', 'Link');
unset($exportColumns['RelativeLink']);
$this->extend('updatePrintExportColumns', $gridField, $itemType, $exportColumns);
return $exportColumns;
} | php | public function getPrintExportColumns($gridField, $itemType, $exportColumns)
{
// Swap RelativeLink for AbsoluteLink for export
$exportColumns['AbsoluteLink'] = _t(__CLASS__ . '.Link', 'Link');
unset($exportColumns['RelativeLink']);
$this->extend('updatePrintExportColumns', $gridField, $itemType, $exportColumns);
return $exportColumns;
} | [
"public",
"function",
"getPrintExportColumns",
"(",
"$",
"gridField",
",",
"$",
"itemType",
",",
"$",
"exportColumns",
")",
"{",
"// Swap RelativeLink for AbsoluteLink for export",
"$",
"exportColumns",
"[",
"'AbsoluteLink'",
"]",
"=",
"_t",
"(",
"__CLASS__",
".",
"... | Returns the columns for the export and print functionality.
@param GridField $gridField
@param string $itemType (i.e 'Pages' or 'Files')
@param array $exportColumns
@return array | [
"Returns",
"the",
"columns",
"for",
"the",
"export",
"and",
"print",
"functionality",
"."
] | 8375b4d789d25db3e1f718d48d042d145c083f60 | https://github.com/silverstripe/silverstripe-sitewidecontent-report/blob/8375b4d789d25db3e1f718d48d042d145c083f60/src/SitewideContentReport.php#L300-L309 | train |
rdohms/DMS | src/DMS/Filter/Rules/RegExp.php | RegExp.checkUnicodeSupport | public function checkUnicodeSupport()
{
if (null === self::$unicodeEnabled) {
self::$unicodeEnabled = (@preg_match('/\pL/u', 'a')) ? true : false;
}
return self::$unicodeEnabled;
} | php | public function checkUnicodeSupport()
{
if (null === self::$unicodeEnabled) {
self::$unicodeEnabled = (@preg_match('/\pL/u', 'a')) ? true : false;
}
return self::$unicodeEnabled;
} | [
"public",
"function",
"checkUnicodeSupport",
"(",
")",
"{",
"if",
"(",
"null",
"===",
"self",
"::",
"$",
"unicodeEnabled",
")",
"{",
"self",
"::",
"$",
"unicodeEnabled",
"=",
"(",
"@",
"preg_match",
"(",
"'/\\pL/u'",
",",
"'a'",
")",
")",
"?",
"true",
... | Verifies that Regular Expression functions support unicode
@return boolean | [
"Verifies",
"that",
"Regular",
"Expression",
"functions",
"support",
"unicode"
] | 3fab902ac2db2a31876101280cdfe7611146a243 | https://github.com/rdohms/DMS/blob/3fab902ac2db2a31876101280cdfe7611146a243/src/DMS/Filter/Rules/RegExp.php#L55-L62 | train |
oliverklee/ext-oelib | Classes/ViewHelpers/GoogleMapsViewHelper.php | Tx_Oelib_ViewHelpers_GoogleMapsViewHelper.generateJavaScript | protected function generateJavaScript($mapId, array $mapPoints, $initializeFunctionName)
{
// Note: If there are several map points with coordinates and the map
// is fit to the map points, the Google Maps API still requires a center
// point. In that case, any point will do (e.g., the first point).
$centerCoordinates = $mapPoints[0]->getGeoCoordinates();
return 'var mapMarkersByUid = mapMarkersByUid || {};' . LF .
'function ' . $initializeFunctionName . '() {' . LF .
'var center = new google.maps.LatLng(' . \number_format($centerCoordinates['latitude'], 6, '.', '') . ', ' .
\number_format($centerCoordinates['longitude'], 6, '.', '') . ');' . LF .
'var mapOptions = {' . LF .
' mapTypeId: google.maps.MapTypeId.ROADMAP,' . LF .
' scrollwheel: false, ' . LF .
' zoom: ' . self::DEFAULT_ZOOM_LEVEL . ', ' . LF .
' center: center' . LF .
'};' . LF .
'mapMarkersByUid.' . $mapId . ' = {};' . LF .
'var map = new google.maps.Map(document.getElementById("' . $mapId . '"), mapOptions);' . LF .
'var bounds = new google.maps.LatLngBounds();' . LF .
$this->createMapMarkers($mapPoints, $mapId) .
'}';
} | php | protected function generateJavaScript($mapId, array $mapPoints, $initializeFunctionName)
{
// Note: If there are several map points with coordinates and the map
// is fit to the map points, the Google Maps API still requires a center
// point. In that case, any point will do (e.g., the first point).
$centerCoordinates = $mapPoints[0]->getGeoCoordinates();
return 'var mapMarkersByUid = mapMarkersByUid || {};' . LF .
'function ' . $initializeFunctionName . '() {' . LF .
'var center = new google.maps.LatLng(' . \number_format($centerCoordinates['latitude'], 6, '.', '') . ', ' .
\number_format($centerCoordinates['longitude'], 6, '.', '') . ');' . LF .
'var mapOptions = {' . LF .
' mapTypeId: google.maps.MapTypeId.ROADMAP,' . LF .
' scrollwheel: false, ' . LF .
' zoom: ' . self::DEFAULT_ZOOM_LEVEL . ', ' . LF .
' center: center' . LF .
'};' . LF .
'mapMarkersByUid.' . $mapId . ' = {};' . LF .
'var map = new google.maps.Map(document.getElementById("' . $mapId . '"), mapOptions);' . LF .
'var bounds = new google.maps.LatLngBounds();' . LF .
$this->createMapMarkers($mapPoints, $mapId) .
'}';
} | [
"protected",
"function",
"generateJavaScript",
"(",
"$",
"mapId",
",",
"array",
"$",
"mapPoints",
",",
"$",
"initializeFunctionName",
")",
"{",
"// Note: If there are several map points with coordinates and the map",
"// is fit to the map points, the Google Maps API still requires a ... | Generates the JavaScript for the Google Map.
@param string $mapId
HTML ID of the map, must not be empty
@param \Tx_Oelib_Interface_MapPoint[] $mapPoints
map points with coordinates, must not be empty
@param string $initializeFunctionName
name of the JavaScript initialization function to create, must
not be empty
@return string the generated JavaScript, will not be empty | [
"Generates",
"the",
"JavaScript",
"for",
"the",
"Google",
"Map",
"."
] | f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1 | https://github.com/oliverklee/ext-oelib/blob/f2f353fdb8b5eb58b805f3c3170a82e9ed9066e1/Classes/ViewHelpers/GoogleMapsViewHelper.php#L143-L165 | train |
kenarkose/Tracker | src/SiteView.php | SiteView.scopeOlderThanOrBetween | public function scopeOlderThanOrBetween(Builder $query, $until = null, $from = null)
{
if (is_null($until))
{
$until = Carbon::now();
}
$query->where('created_at', '<', $until);
if ( ! is_null($from))
{
$query->where('created_at', '>=', $from);
}
return $query;
} | php | public function scopeOlderThanOrBetween(Builder $query, $until = null, $from = null)
{
if (is_null($until))
{
$until = Carbon::now();
}
$query->where('created_at', '<', $until);
if ( ! is_null($from))
{
$query->where('created_at', '>=', $from);
}
return $query;
} | [
"public",
"function",
"scopeOlderThanOrBetween",
"(",
"Builder",
"$",
"query",
",",
"$",
"until",
"=",
"null",
",",
"$",
"from",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"until",
")",
")",
"{",
"$",
"until",
"=",
"Carbon",
"::",
"now",
... | Scope for choosing by date
@param Builder $query
@param timestamp $until
@param timestamp|null $from
@return Builder | [
"Scope",
"for",
"choosing",
"by",
"date"
] | 8254ed559f9ec92c18a6090e97ad21ade2aeee40 | https://github.com/kenarkose/Tracker/blob/8254ed559f9ec92c18a6090e97ad21ade2aeee40/src/SiteView.php#L55-L70 | train |
Krinkle/intuition | language/mw-classes/LanguageLa.php | LanguageLa.convertGrammar | function convertGrammar( $word, $case ) {
global $wgGrammarForms;
if ( isset( $wgGrammarForms['la'][$case][$word] ) ) {
return $wgGrammarForms['la'][$case][$word];
}
switch ( $case ) {
case 'genitive':
// only a few declensions, and even for those mostly the singular only
$in = array( '/u[ms]$/', # 2nd declension singular
'/ommunia$/', # 3rd declension neuter plural (partly)
'/a$/', # 1st declension singular
'/libri$/', '/nuntii$/', # 2nd declension plural (partly)
'/tio$/', '/ns$/', '/as$/', # 3rd declension singular (partly)
'/es$/' # 5th declension singular
);
$out = array( 'i',
'ommunium',
'ae',
'librorum', 'nuntiorum',
'tionis', 'ntis', 'atis',
'ei'
);
return preg_replace( $in, $out, $word );
case 'accusative':
// only a few declensions, and even for those mostly the singular only
$in = array( '/u[ms]$/', # 2nd declension singular
'/a$/', # 1st declension singular
'/ommuniam$/', # 3rd declension neuter plural (partly)
'/libri$/', '/nuntii$/', # 2nd declension plural (partly)
'/tio$/', '/ns$/', '/as$/', # 3rd declension singular (partly)
'/es$/' # 5th declension singular
);
$out = array( 'um',
'am',
'ommunia',
'libros', 'nuntios',
'tionem', 'ntem', 'atem',
'em'
);
return preg_replace( $in, $out, $word );
case 'ablative':
// only a few declensions, and even for those mostly the singular only
$in = array( '/u[ms]$/', # 2nd declension singular
'/ommunia$/', # 3rd declension neuter plural (partly)
'/a$/', # 1st declension singular
'/libri$/', '/nuntii$/', # 2nd declension plural (partly)
'/tio$/', '/ns$/', '/as$/', # 3rd declension singular (partly)
'/es$/' # 5th declension singular
);
$out = array( 'o',
'ommunibus',
'a',
'libris', 'nuntiis',
'tione', 'nte', 'ate',
'e'
);
return preg_replace( $in, $out, $word );
default:
return $word;
}
} | php | function convertGrammar( $word, $case ) {
global $wgGrammarForms;
if ( isset( $wgGrammarForms['la'][$case][$word] ) ) {
return $wgGrammarForms['la'][$case][$word];
}
switch ( $case ) {
case 'genitive':
// only a few declensions, and even for those mostly the singular only
$in = array( '/u[ms]$/', # 2nd declension singular
'/ommunia$/', # 3rd declension neuter plural (partly)
'/a$/', # 1st declension singular
'/libri$/', '/nuntii$/', # 2nd declension plural (partly)
'/tio$/', '/ns$/', '/as$/', # 3rd declension singular (partly)
'/es$/' # 5th declension singular
);
$out = array( 'i',
'ommunium',
'ae',
'librorum', 'nuntiorum',
'tionis', 'ntis', 'atis',
'ei'
);
return preg_replace( $in, $out, $word );
case 'accusative':
// only a few declensions, and even for those mostly the singular only
$in = array( '/u[ms]$/', # 2nd declension singular
'/a$/', # 1st declension singular
'/ommuniam$/', # 3rd declension neuter plural (partly)
'/libri$/', '/nuntii$/', # 2nd declension plural (partly)
'/tio$/', '/ns$/', '/as$/', # 3rd declension singular (partly)
'/es$/' # 5th declension singular
);
$out = array( 'um',
'am',
'ommunia',
'libros', 'nuntios',
'tionem', 'ntem', 'atem',
'em'
);
return preg_replace( $in, $out, $word );
case 'ablative':
// only a few declensions, and even for those mostly the singular only
$in = array( '/u[ms]$/', # 2nd declension singular
'/ommunia$/', # 3rd declension neuter plural (partly)
'/a$/', # 1st declension singular
'/libri$/', '/nuntii$/', # 2nd declension plural (partly)
'/tio$/', '/ns$/', '/as$/', # 3rd declension singular (partly)
'/es$/' # 5th declension singular
);
$out = array( 'o',
'ommunibus',
'a',
'libris', 'nuntiis',
'tione', 'nte', 'ate',
'e'
);
return preg_replace( $in, $out, $word );
default:
return $word;
}
} | [
"function",
"convertGrammar",
"(",
"$",
"word",
",",
"$",
"case",
")",
"{",
"global",
"$",
"wgGrammarForms",
";",
"if",
"(",
"isset",
"(",
"$",
"wgGrammarForms",
"[",
"'la'",
"]",
"[",
"$",
"case",
"]",
"[",
"$",
"word",
"]",
")",
")",
"{",
"return... | Convert from the nominative form of a noun to some other case
Just used in a couple places for sitenames; special-case as necessary.
Rules are far from complete.
Cases: genitive, accusative, ablative
@param $word string
@param $case string
@return string | [
"Convert",
"from",
"the",
"nominative",
"form",
"of",
"a",
"noun",
"to",
"some",
"other",
"case"
] | 36f48ffe925905ae5d60c7f04d76077e150d3a2c | https://github.com/Krinkle/intuition/blob/36f48ffe925905ae5d60c7f04d76077e150d3a2c/language/mw-classes/LanguageLa.php#L21-L82 | train |
jaxon-php/jaxon-dialogs | src/Dialog.php | Dialog.getLibrary | public function getLibrary($sName)
{
try
{
$library = $this->di[$sName];
}
catch(\Exception $e)
{
$library = null;
}
return $library;
} | php | public function getLibrary($sName)
{
try
{
$library = $this->di[$sName];
}
catch(\Exception $e)
{
$library = null;
}
return $library;
} | [
"public",
"function",
"getLibrary",
"(",
"$",
"sName",
")",
"{",
"try",
"{",
"$",
"library",
"=",
"$",
"this",
"->",
"di",
"[",
"$",
"sName",
"]",
";",
"}",
"catch",
"(",
"\\",
"Exception",
"$",
"e",
")",
"{",
"$",
"library",
"=",
"null",
";",
... | Get a library adapter by its name.
@param string $sName The name of the library adapter
@return Libraries\Library | [
"Get",
"a",
"library",
"adapter",
"by",
"its",
"name",
"."
] | 830c5bff764e1a9aafb0c2d6a8aeb7be4c2b06d7 | https://github.com/jaxon-php/jaxon-dialogs/blob/830c5bff764e1a9aafb0c2d6a8aeb7be4c2b06d7/src/Dialog.php#L187-L198 | train |
jaxon-php/jaxon-dialogs | src/Dialog.php | Dialog.getModalLibrary | protected function getModalLibrary()
{
// Get the current modal library
if(($this->sModalLibrary) &&
($library = $this->getLibrary($this->sModalLibrary)) && ($library instanceof Modal))
{
return $library;
}
// Get the default modal library
if(($sName = $this->getOption('dialogs.default.modal', '')) &&
($library = $this->getLibrary($sName)) && ($library instanceof Modal))
{
return $library;
}
return null;
} | php | protected function getModalLibrary()
{
// Get the current modal library
if(($this->sModalLibrary) &&
($library = $this->getLibrary($this->sModalLibrary)) && ($library instanceof Modal))
{
return $library;
}
// Get the default modal library
if(($sName = $this->getOption('dialogs.default.modal', '')) &&
($library = $this->getLibrary($sName)) && ($library instanceof Modal))
{
return $library;
}
return null;
} | [
"protected",
"function",
"getModalLibrary",
"(",
")",
"{",
"// Get the current modal library",
"if",
"(",
"(",
"$",
"this",
"->",
"sModalLibrary",
")",
"&&",
"(",
"$",
"library",
"=",
"$",
"this",
"->",
"getLibrary",
"(",
"$",
"this",
"->",
"sModalLibrary",
... | Get the library adapter to use for modals.
@return Libraries\Library|null | [
"Get",
"the",
"library",
"adapter",
"to",
"use",
"for",
"modals",
"."
] | 830c5bff764e1a9aafb0c2d6a8aeb7be4c2b06d7 | https://github.com/jaxon-php/jaxon-dialogs/blob/830c5bff764e1a9aafb0c2d6a8aeb7be4c2b06d7/src/Dialog.php#L217-L232 | train |
jaxon-php/jaxon-dialogs | src/Dialog.php | Dialog.getAlertLibrary | protected function getAlertLibrary($bReturnDefault = false)
{
// Get the current alert library
if(($this->sAlertLibrary) &&
($library = $this->getLibrary($this->sAlertLibrary)) && ($library instanceof Alert))
{
return $library;
}
// Get the configured alert library
if(($sName = $this->getOption('dialogs.default.alert', '')) &&
($library = $this->getLibrary($sName)) && ($library instanceof Alert))
{
return $library;
}
// Get the default alert library
return ($bReturnDefault ? $this->getPluginManager()->getDefaultAlert() : null);
} | php | protected function getAlertLibrary($bReturnDefault = false)
{
// Get the current alert library
if(($this->sAlertLibrary) &&
($library = $this->getLibrary($this->sAlertLibrary)) && ($library instanceof Alert))
{
return $library;
}
// Get the configured alert library
if(($sName = $this->getOption('dialogs.default.alert', '')) &&
($library = $this->getLibrary($sName)) && ($library instanceof Alert))
{
return $library;
}
// Get the default alert library
return ($bReturnDefault ? $this->getPluginManager()->getDefaultAlert() : null);
} | [
"protected",
"function",
"getAlertLibrary",
"(",
"$",
"bReturnDefault",
"=",
"false",
")",
"{",
"// Get the current alert library",
"if",
"(",
"(",
"$",
"this",
"->",
"sAlertLibrary",
")",
"&&",
"(",
"$",
"library",
"=",
"$",
"this",
"->",
"getLibrary",
"(",
... | Get the library adapter to use for alerts.
@return Libraries\Library|null | [
"Get",
"the",
"library",
"adapter",
"to",
"use",
"for",
"alerts",
"."
] | 830c5bff764e1a9aafb0c2d6a8aeb7be4c2b06d7 | https://github.com/jaxon-php/jaxon-dialogs/blob/830c5bff764e1a9aafb0c2d6a8aeb7be4c2b06d7/src/Dialog.php#L251-L267 | train |
jaxon-php/jaxon-dialogs | src/Dialog.php | Dialog.getConfirmLibrary | protected function getConfirmLibrary($bReturnDefault = false)
{
// Get the current confirm library
if(($this->sConfirmLibrary) &&
($library = $this->getLibrary($this->sConfirmLibrary)) && ($library instanceof Confirm))
{
return $library;
}
// Get the configured confirm library
if(($sName = $this->getOption('dialogs.default.confirm', '')) &&
($library = $this->getLibrary($sName)) && ($library instanceof Confirm))
{
return $library;
}
// Get the default confirm library
return ($bReturnDefault ? $this->getPluginManager()->getDefaultConfirm() : null);
} | php | protected function getConfirmLibrary($bReturnDefault = false)
{
// Get the current confirm library
if(($this->sConfirmLibrary) &&
($library = $this->getLibrary($this->sConfirmLibrary)) && ($library instanceof Confirm))
{
return $library;
}
// Get the configured confirm library
if(($sName = $this->getOption('dialogs.default.confirm', '')) &&
($library = $this->getLibrary($sName)) && ($library instanceof Confirm))
{
return $library;
}
// Get the default confirm library
return ($bReturnDefault ? $this->getPluginManager()->getDefaultConfirm() : null);
} | [
"protected",
"function",
"getConfirmLibrary",
"(",
"$",
"bReturnDefault",
"=",
"false",
")",
"{",
"// Get the current confirm library",
"if",
"(",
"(",
"$",
"this",
"->",
"sConfirmLibrary",
")",
"&&",
"(",
"$",
"library",
"=",
"$",
"this",
"->",
"getLibrary",
... | Get the library adapter to use for confirmation.
@param bool $bReturnDefault Return the default confirm if none is configured
@return Libraries\Library|null | [
"Get",
"the",
"library",
"adapter",
"to",
"use",
"for",
"confirmation",
"."
] | 830c5bff764e1a9aafb0c2d6a8aeb7be4c2b06d7 | https://github.com/jaxon-php/jaxon-dialogs/blob/830c5bff764e1a9aafb0c2d6a8aeb7be4c2b06d7/src/Dialog.php#L288-L304 | train |
jaxon-php/jaxon-dialogs | src/Dialog.php | Dialog.getLibrariesInUse | protected function getLibrariesInUse()
{
$aNames = $this->getOption('dialogs.libraries', array());
if(!is_array($aNames))
{
$aNames = array();
}
$libraries = array();
foreach($aNames as $sName)
{
if(($library = $this->getLibrary($sName)))
{
$libraries[$library->getName()] = $library;
}
}
if(($library = $this->getModalLibrary()))
{
$libraries[$library->getName()] = $library;
}
if(($library = $this->getAlertLibrary()))
{
$libraries[$library->getName()] = $library;
}
if(($library = $this->getConfirmLibrary()))
{
$libraries[$library->getName()] = $library;
}
return $libraries;
} | php | protected function getLibrariesInUse()
{
$aNames = $this->getOption('dialogs.libraries', array());
if(!is_array($aNames))
{
$aNames = array();
}
$libraries = array();
foreach($aNames as $sName)
{
if(($library = $this->getLibrary($sName)))
{
$libraries[$library->getName()] = $library;
}
}
if(($library = $this->getModalLibrary()))
{
$libraries[$library->getName()] = $library;
}
if(($library = $this->getAlertLibrary()))
{
$libraries[$library->getName()] = $library;
}
if(($library = $this->getConfirmLibrary()))
{
$libraries[$library->getName()] = $library;
}
return $libraries;
} | [
"protected",
"function",
"getLibrariesInUse",
"(",
")",
"{",
"$",
"aNames",
"=",
"$",
"this",
"->",
"getOption",
"(",
"'dialogs.libraries'",
",",
"array",
"(",
")",
")",
";",
"if",
"(",
"!",
"is_array",
"(",
"$",
"aNames",
")",
")",
"{",
"$",
"aNames",... | Get the list of library adapters that are present in the configuration.
@return array | [
"Get",
"the",
"list",
"of",
"library",
"adapters",
"that",
"are",
"present",
"in",
"the",
"configuration",
"."
] | 830c5bff764e1a9aafb0c2d6a8aeb7be4c2b06d7 | https://github.com/jaxon-php/jaxon-dialogs/blob/830c5bff764e1a9aafb0c2d6a8aeb7be4c2b06d7/src/Dialog.php#L311-L339 | train |
jaxon-php/jaxon-dialogs | src/Dialog.php | Dialog.getJs | public function getJs()
{
if(!$this->includeAssets())
{
return '';
}
$libraries = $this->getLibrariesInUse();
$code = '';
foreach($libraries as $library)
{
$code .= "\n" . $library->getJs() . "\n";
}
return $code;
} | php | public function getJs()
{
if(!$this->includeAssets())
{
return '';
}
$libraries = $this->getLibrariesInUse();
$code = '';
foreach($libraries as $library)
{
$code .= "\n" . $library->getJs() . "\n";
}
return $code;
} | [
"public",
"function",
"getJs",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"includeAssets",
"(",
")",
")",
"{",
"return",
"''",
";",
"}",
"$",
"libraries",
"=",
"$",
"this",
"->",
"getLibrariesInUse",
"(",
")",
";",
"$",
"code",
"=",
"''",
... | Return the javascript header code and file includes
@return string | [
"Return",
"the",
"javascript",
"header",
"code",
"and",
"file",
"includes"
] | 830c5bff764e1a9aafb0c2d6a8aeb7be4c2b06d7 | https://github.com/jaxon-php/jaxon-dialogs/blob/830c5bff764e1a9aafb0c2d6a8aeb7be4c2b06d7/src/Dialog.php#L346-L359 | train |
jaxon-php/jaxon-dialogs | src/Dialog.php | Dialog.getCss | public function getCss()
{
if(!$this->includeAssets())
{
return '';
}
$libraries = $this->getLibrariesInUse();
$code = '';
foreach($libraries as $library)
{
$code .= $library->getCss() . "\n";
}
return $code;
} | php | public function getCss()
{
if(!$this->includeAssets())
{
return '';
}
$libraries = $this->getLibrariesInUse();
$code = '';
foreach($libraries as $library)
{
$code .= $library->getCss() . "\n";
}
return $code;
} | [
"public",
"function",
"getCss",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"includeAssets",
"(",
")",
")",
"{",
"return",
"''",
";",
"}",
"$",
"libraries",
"=",
"$",
"this",
"->",
"getLibrariesInUse",
"(",
")",
";",
"$",
"code",
"=",
"''",
... | Return the CSS header code and file includes
@return string | [
"Return",
"the",
"CSS",
"header",
"code",
"and",
"file",
"includes"
] | 830c5bff764e1a9aafb0c2d6a8aeb7be4c2b06d7 | https://github.com/jaxon-php/jaxon-dialogs/blob/830c5bff764e1a9aafb0c2d6a8aeb7be4c2b06d7/src/Dialog.php#L366-L379 | train |
jaxon-php/jaxon-dialogs | src/Dialog.php | Dialog.success | public function success($message, $title = null)
{
return $this->getAlertLibrary(true)->success((string)$message, (string)$title);
} | php | public function success($message, $title = null)
{
return $this->getAlertLibrary(true)->success((string)$message, (string)$title);
} | [
"public",
"function",
"success",
"(",
"$",
"message",
",",
"$",
"title",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"getAlertLibrary",
"(",
"true",
")",
"->",
"success",
"(",
"(",
"string",
")",
"$",
"message",
",",
"(",
"string",
")",
"$",
... | Print a success message.
It is a function of the Jaxon\Request\Interfaces\Alert interface.
@param string $message The text of the message
@param string|null $title The title of the message
@return void | [
"Print",
"a",
"success",
"message",
"."
] | 830c5bff764e1a9aafb0c2d6a8aeb7be4c2b06d7 | https://github.com/jaxon-php/jaxon-dialogs/blob/830c5bff764e1a9aafb0c2d6a8aeb7be4c2b06d7/src/Dialog.php#L488-L491 | train |
jaxon-php/jaxon-dialogs | src/Dialog.php | Dialog.info | public function info($message, $title = null)
{
return $this->getAlertLibrary(true)->info((string)$message, (string)$title);
} | php | public function info($message, $title = null)
{
return $this->getAlertLibrary(true)->info((string)$message, (string)$title);
} | [
"public",
"function",
"info",
"(",
"$",
"message",
",",
"$",
"title",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"getAlertLibrary",
"(",
"true",
")",
"->",
"info",
"(",
"(",
"string",
")",
"$",
"message",
",",
"(",
"string",
")",
"$",
"tit... | Print an information message.
It is a function of the Jaxon\Request\Interfaces\Alert interface.
@param string $message The text of the message
@param string|null $title The title of the message
@return void | [
"Print",
"an",
"information",
"message",
"."
] | 830c5bff764e1a9aafb0c2d6a8aeb7be4c2b06d7 | https://github.com/jaxon-php/jaxon-dialogs/blob/830c5bff764e1a9aafb0c2d6a8aeb7be4c2b06d7/src/Dialog.php#L503-L506 | train |
jaxon-php/jaxon-dialogs | src/Dialog.php | Dialog.warning | public function warning($message, $title = null)
{
return $this->getAlertLibrary(true)->warning((string)$message, (string)$title);
} | php | public function warning($message, $title = null)
{
return $this->getAlertLibrary(true)->warning((string)$message, (string)$title);
} | [
"public",
"function",
"warning",
"(",
"$",
"message",
",",
"$",
"title",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"getAlertLibrary",
"(",
"true",
")",
"->",
"warning",
"(",
"(",
"string",
")",
"$",
"message",
",",
"(",
"string",
")",
"$",
... | Print a warning message.
It is a function of the Jaxon\Request\Interfaces\Alert interface.
@param string $message The text of the message
@param string|null $title The title of the message
@return void | [
"Print",
"a",
"warning",
"message",
"."
] | 830c5bff764e1a9aafb0c2d6a8aeb7be4c2b06d7 | https://github.com/jaxon-php/jaxon-dialogs/blob/830c5bff764e1a9aafb0c2d6a8aeb7be4c2b06d7/src/Dialog.php#L518-L521 | train |
jaxon-php/jaxon-dialogs | src/Dialog.php | Dialog.error | public function error($message, $title = null)
{
return $this->getAlertLibrary(true)->error((string)$message, (string)$title);
} | php | public function error($message, $title = null)
{
return $this->getAlertLibrary(true)->error((string)$message, (string)$title);
} | [
"public",
"function",
"error",
"(",
"$",
"message",
",",
"$",
"title",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"getAlertLibrary",
"(",
"true",
")",
"->",
"error",
"(",
"(",
"string",
")",
"$",
"message",
",",
"(",
"string",
")",
"$",
"t... | Print an error message.
It is a function of the Jaxon\Request\Interfaces\Alert interface.
@param string $message The text of the message
@param string|null $title The title of the message
@return void | [
"Print",
"an",
"error",
"message",
"."
] | 830c5bff764e1a9aafb0c2d6a8aeb7be4c2b06d7 | https://github.com/jaxon-php/jaxon-dialogs/blob/830c5bff764e1a9aafb0c2d6a8aeb7be4c2b06d7/src/Dialog.php#L533-L536 | train |
nabu-3/core | nabu/data/icontact/base/CNabuIContactProspectStatusTypeLanguageBase.php | CNabuIContactProspectStatusTypeLanguageBase.setIcontactProspectStatusTypeId | public function setIcontactProspectStatusTypeId(int $nb_icontact_prospect_status_type_id) : CNabuDataObject
{
if ($nb_icontact_prospect_status_type_id === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$nb_icontact_prospect_status_type_id")
);
}
$this->setValue('nb_icontact_prospect_status_type_id', $nb_icontact_prospect_status_type_id);
return $this;
} | php | public function setIcontactProspectStatusTypeId(int $nb_icontact_prospect_status_type_id) : CNabuDataObject
{
if ($nb_icontact_prospect_status_type_id === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$nb_icontact_prospect_status_type_id")
);
}
$this->setValue('nb_icontact_prospect_status_type_id', $nb_icontact_prospect_status_type_id);
return $this;
} | [
"public",
"function",
"setIcontactProspectStatusTypeId",
"(",
"int",
"$",
"nb_icontact_prospect_status_type_id",
")",
":",
"CNabuDataObject",
"{",
"if",
"(",
"$",
"nb_icontact_prospect_status_type_id",
"===",
"null",
")",
"{",
"throw",
"new",
"ENabuCoreException",
"(",
... | Sets the Icontact Prospect Status Type Id attribute value.
@param int $nb_icontact_prospect_status_type_id New value for attribute
@return CNabuDataObject Returns self instance to grant chained setters call. | [
"Sets",
"the",
"Icontact",
"Prospect",
"Status",
"Type",
"Id",
"attribute",
"value",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/icontact/base/CNabuIContactProspectStatusTypeLanguageBase.php#L184-L195 | train |
nabu-3/core | nabu/data/icontact/base/CNabuIContactProspectStatusTypeLanguageBase.php | CNabuIContactProspectStatusTypeLanguageBase.setLanguageId | public function setLanguageId(int $nb_language_id) : CNabuDataObject
{
if ($nb_language_id === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$nb_language_id")
);
}
$this->setValue('nb_language_id', $nb_language_id);
return $this;
} | php | public function setLanguageId(int $nb_language_id) : CNabuDataObject
{
if ($nb_language_id === null) {
throw new ENabuCoreException(
ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
array("\$nb_language_id")
);
}
$this->setValue('nb_language_id', $nb_language_id);
return $this;
} | [
"public",
"function",
"setLanguageId",
"(",
"int",
"$",
"nb_language_id",
")",
":",
"CNabuDataObject",
"{",
"if",
"(",
"$",
"nb_language_id",
"===",
"null",
")",
"{",
"throw",
"new",
"ENabuCoreException",
"(",
"ENabuCoreException",
"::",
"ERROR_NULL_VALUE_NOT_ALLOWE... | Sets the Language Id attribute value.
@param int $nb_language_id New value for attribute
@return CNabuDataObject Returns self instance to grant chained setters call. | [
"Sets",
"the",
"Language",
"Id",
"attribute",
"value",
"."
] | 8a93a91ba146536d66f57821e6f23f9175d8bd11 | https://github.com/nabu-3/core/blob/8a93a91ba146536d66f57821e6f23f9175d8bd11/nabu/data/icontact/base/CNabuIContactProspectStatusTypeLanguageBase.php#L211-L222 | train |
rips/php-connector-bundle | Services/CallbackService.php | CallbackService.getAll | public function getAll(array $queryParams = [])
{
$response = $this->api->callbacks()->getAll($queryParams);
return new CallbacksResponse($response);
} | php | public function getAll(array $queryParams = [])
{
$response = $this->api->callbacks()->getAll($queryParams);
return new CallbacksResponse($response);
} | [
"public",
"function",
"getAll",
"(",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"api",
"->",
"callbacks",
"(",
")",
"->",
"getAll",
"(",
"$",
"queryParams",
")",
";",
"return",
"new",
"CallbacksRespon... | Get all callbacks
@param array $queryParams
@return CallbacksResponse | [
"Get",
"all",
"callbacks"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Services/CallbackService.php#L33-L38 | train |
rips/php-connector-bundle | Services/CallbackService.php | CallbackService.getById | public function getById($callbackId, array $queryParams = [])
{
$response = $this->api->callbacks()->getById($callbackId, $queryParams);
return new CallbackResponse($response);
} | php | public function getById($callbackId, array $queryParams = [])
{
$response = $this->api->callbacks()->getById($callbackId, $queryParams);
return new CallbackResponse($response);
} | [
"public",
"function",
"getById",
"(",
"$",
"callbackId",
",",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"api",
"->",
"callbacks",
"(",
")",
"->",
"getById",
"(",
"$",
"callbackId",
",",
"$",
"query... | Get callback by id
@param int $callbackId
@param array $queryParams
@return CallbackResponse | [
"Get",
"callback",
"by",
"id"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Services/CallbackService.php#L47-L52 | train |
rips/php-connector-bundle | Services/CallbackService.php | CallbackService.create | public function create(CallbackBuilder $input, array $queryParams = [])
{
$response = $this->api->callbacks()->create($input->toArray(), $queryParams);
return new CallbackResponse($response);
} | php | public function create(CallbackBuilder $input, array $queryParams = [])
{
$response = $this->api->callbacks()->create($input->toArray(), $queryParams);
return new CallbackResponse($response);
} | [
"public",
"function",
"create",
"(",
"CallbackBuilder",
"$",
"input",
",",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"api",
"->",
"callbacks",
"(",
")",
"->",
"create",
"(",
"$",
"input",
"->",
"to... | Create a new callback
@param CallbackBuilder $input
@param array $queryParams
@return CallbackResponse | [
"Create",
"a",
"new",
"callback"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Services/CallbackService.php#L61-L66 | train |
rips/php-connector-bundle | Services/CallbackService.php | CallbackService.update | public function update($callbackId, CallbackBuilder $input, array $queryParams = [])
{
$response = $this->api->callbacks()->update($callbackId, $input->toArray(), $queryParams);
return new CallbackResponse($response);
} | php | public function update($callbackId, CallbackBuilder $input, array $queryParams = [])
{
$response = $this->api->callbacks()->update($callbackId, $input->toArray(), $queryParams);
return new CallbackResponse($response);
} | [
"public",
"function",
"update",
"(",
"$",
"callbackId",
",",
"CallbackBuilder",
"$",
"input",
",",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"api",
"->",
"callbacks",
"(",
")",
"->",
"update",
"(",
... | Update an existing callback
@param int $callbackId
@param CallbackBuilder $input
@param array $queryParams
@return CallbackResponse | [
"Update",
"an",
"existing",
"callback"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Services/CallbackService.php#L76-L81 | train |
rips/php-connector-bundle | Services/CallbackService.php | CallbackService.deleteAll | public function deleteAll(array $queryParams = [])
{
$response = $this->api->callbacks()->deleteAll($queryParams);
return new BaseResponse($response);
} | php | public function deleteAll(array $queryParams = [])
{
$response = $this->api->callbacks()->deleteAll($queryParams);
return new BaseResponse($response);
} | [
"public",
"function",
"deleteAll",
"(",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"api",
"->",
"callbacks",
"(",
")",
"->",
"deleteAll",
"(",
"$",
"queryParams",
")",
";",
"return",
"new",
"BaseRespo... | Delete all callbacks
@param array $queryParams
@return BaseResponse | [
"Delete",
"all",
"callbacks"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Services/CallbackService.php#L89-L94 | train |
rips/php-connector-bundle | Services/CallbackService.php | CallbackService.deleteById | public function deleteById($callbackId, array $queryParams = [])
{
$response = $this->api->callbacks()->deleteById($callbackId, $queryParams);
return new BaseResponse($response);
} | php | public function deleteById($callbackId, array $queryParams = [])
{
$response = $this->api->callbacks()->deleteById($callbackId, $queryParams);
return new BaseResponse($response);
} | [
"public",
"function",
"deleteById",
"(",
"$",
"callbackId",
",",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"api",
"->",
"callbacks",
"(",
")",
"->",
"deleteById",
"(",
"$",
"callbackId",
",",
"$",
... | Delete callback by id
@param int $callbackId
@param array $queryParams
@return BaseResponse | [
"Delete",
"callback",
"by",
"id"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Services/CallbackService.php#L103-L108 | train |
markusjwetzel/laravel-datamapper | src/Support/ValueObject.php | ValueObject.equals | public function equals(ValueObjectContract $valueObject)
{
foreach (get_object_vars($this) as $name => $value) {
if ($this->{$name} !== $valueObject->{$name}) {
return false;
}
}
return true;
} | php | public function equals(ValueObjectContract $valueObject)
{
foreach (get_object_vars($this) as $name => $value) {
if ($this->{$name} !== $valueObject->{$name}) {
return false;
}
}
return true;
} | [
"public",
"function",
"equals",
"(",
"ValueObjectContract",
"$",
"valueObject",
")",
"{",
"foreach",
"(",
"get_object_vars",
"(",
"$",
"this",
")",
"as",
"$",
"name",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"{",
"$",
"name",
"}",
... | Compare two value objects.
@param \ProAI\Datamapper\Contracts\ValueObject $valueObject
@return boolean | [
"Compare",
"two",
"value",
"objects",
"."
] | 8fac20e5bca8fb81eefa7dacc49269b4a6241cbf | https://github.com/markusjwetzel/laravel-datamapper/blob/8fac20e5bca8fb81eefa7dacc49269b4a6241cbf/src/Support/ValueObject.php#L18-L27 | train |
rips/php-connector-bundle | Services/Application/Profile/SettingService.php | SettingService.get | public function get($appId, $profileId, array $queryParams)
{
$response = $this->api->applications()->profiles()->settings()->get($appId, $profileId, $queryParams);
return new SettingResponse($response);
} | php | public function get($appId, $profileId, array $queryParams)
{
$response = $this->api->applications()->profiles()->settings()->get($appId, $profileId, $queryParams);
return new SettingResponse($response);
} | [
"public",
"function",
"get",
"(",
"$",
"appId",
",",
"$",
"profileId",
",",
"array",
"$",
"queryParams",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"api",
"->",
"applications",
"(",
")",
"->",
"profiles",
"(",
")",
"->",
"settings",
"(",
")",... | Get settings for a profile profile
@param int $appId
@param int $profileId
@param array $queryParams
@return SettingResponse | [
"Get",
"settings",
"for",
"a",
"profile",
"profile"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Services/Application/Profile/SettingService.php#L34-L39 | train |
rips/php-connector-bundle | Services/Application/Profile/SettingService.php | SettingService.update | public function update($appId, $profileId, SettingBuilder $input, array $queryParams = [])
{
$response = $this->api->applications()->profiles()->settings()->update($appId, $profileId, $input->toArray(), $queryParams);
return new SettingResponse($response);
} | php | public function update($appId, $profileId, SettingBuilder $input, array $queryParams = [])
{
$response = $this->api->applications()->profiles()->settings()->update($appId, $profileId, $input->toArray(), $queryParams);
return new SettingResponse($response);
} | [
"public",
"function",
"update",
"(",
"$",
"appId",
",",
"$",
"profileId",
",",
"SettingBuilder",
"$",
"input",
",",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"api",
"->",
"applications",
"(",
")",
... | Update settings for profile profile
@param int $appId
@param int $profileId
@param SettingBuilder $input
@param array $queryParams
@return SettingResponse | [
"Update",
"settings",
"for",
"profile",
"profile"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Services/Application/Profile/SettingService.php#L50-L55 | train |
php-xapi/model | src/LanguageMap.php | LanguageMap.withEntry | public function withEntry(string $languageTag, string $value): self
{
$languageMap = clone $this;
$languageMap->map[$languageTag] = $value;
return $languageMap;
} | php | public function withEntry(string $languageTag, string $value): self
{
$languageMap = clone $this;
$languageMap->map[$languageTag] = $value;
return $languageMap;
} | [
"public",
"function",
"withEntry",
"(",
"string",
"$",
"languageTag",
",",
"string",
"$",
"value",
")",
":",
"self",
"{",
"$",
"languageMap",
"=",
"clone",
"$",
"this",
";",
"$",
"languageMap",
"->",
"map",
"[",
"$",
"languageTag",
"]",
"=",
"$",
"valu... | Creates a new language map based on the current map including the given entry.
An existing entry will be overridden if the given language tag is already
present in this language map. | [
"Creates",
"a",
"new",
"language",
"map",
"based",
"on",
"the",
"current",
"map",
"including",
"the",
"given",
"entry",
"."
] | ca80d0f534ceb544b558dea1039c86a184cbeebe | https://github.com/php-xapi/model/blob/ca80d0f534ceb544b558dea1039c86a184cbeebe/src/LanguageMap.php#L43-L49 | train |
rips/php-connector-bundle | Services/ActivityService.php | ActivityService.getAll | public function getAll(array $queryParams = [])
{
$response = $this->api->activities()->getAll($queryParams);
return new ActivitiesResponse($response);
} | php | public function getAll(array $queryParams = [])
{
$response = $this->api->activities()->getAll($queryParams);
return new ActivitiesResponse($response);
} | [
"public",
"function",
"getAll",
"(",
"array",
"$",
"queryParams",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"api",
"->",
"activities",
"(",
")",
"->",
"getAll",
"(",
"$",
"queryParams",
")",
";",
"return",
"new",
"ActivitiesResp... | Get all activities
@param array $queryParams
@return ActivitiesResponse | [
"Get",
"all",
"activities"
] | 34ac080a7988d4d91f8129419998e51291261f55 | https://github.com/rips/php-connector-bundle/blob/34ac080a7988d4d91f8129419998e51291261f55/Services/ActivityService.php#L31-L36 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.