repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_code_tokens listlengths 15 672k | func_documentation_string stringlengths 1 47.2k | func_documentation_tokens listlengths 1 3.92k | split_name stringclasses 1
value | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|---|---|---|
colorium/web | src/Colorium/Web/App.php | App.render | protected function render(Context $context)
{
$this->logger->debug('kernel.process.render: render Response');
// resolve output format
if($context->response->raw) {
// template
if($template = $context->logic->html) {
// render template
... | php | protected function render(Context $context)
{
$this->logger->debug('kernel.process.render: render Response');
// resolve output format
if($context->response->raw) {
// template
if($template = $context->logic->html) {
// render template
... | [
"protected",
"function",
"render",
"(",
"Context",
"$",
"context",
")",
"{",
"$",
"this",
"->",
"logger",
"->",
"debug",
"(",
"'kernel.process.render: render Response'",
")",
";",
"// resolve output format",
"if",
"(",
"$",
"context",
"->",
"response",
"->",
"ra... | Render response
@param Context $context
@return Context | [
"Render",
"response"
] | train | https://github.com/colorium/web/blob/2a767658b8737022939b0cc4505b5f652c1683d2/src/Colorium/Web/App.php#L58-L96 |
mslib/resource-proxy | Msl/ResourceProxy/Source/Imap.php | Imap.setConfig | public function setConfig(SourceConfig $sourceConfig)
{
// FILTERS
// 1. Setting message status filter
$filters = $sourceConfig->getFilter();
if (isset($filters[self::MESSAGES_STATUS_FILTER])) {
$messageStatus = $filters[self::MESSAGES_STATUS_FILTER];
if ($mes... | php | public function setConfig(SourceConfig $sourceConfig)
{
// FILTERS
// 1. Setting message status filter
$filters = $sourceConfig->getFilter();
if (isset($filters[self::MESSAGES_STATUS_FILTER])) {
$messageStatus = $filters[self::MESSAGES_STATUS_FILTER];
if ($mes... | [
"public",
"function",
"setConfig",
"(",
"SourceConfig",
"$",
"sourceConfig",
")",
"{",
"// FILTERS",
"// 1. Setting message status filter",
"$",
"filters",
"=",
"$",
"sourceConfig",
"->",
"getFilter",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"filters",
"[",
... | Sets all the required parameters to configure a given Source instance.
@param SourceConfig $sourceConfig
@throws \Msl\ResourceProxy\Exception\BadSourceConfigurationException
@return void | [
"Sets",
"all",
"the",
"required",
"parameters",
"to",
"configure",
"a",
"given",
"Source",
"instance",
"."
] | train | https://github.com/mslib/resource-proxy/blob/be3f8589753f738f5114443a3465f5e84aecd156/Msl/ResourceProxy/Source/Imap.php#L43-L61 |
mslib/resource-proxy | Msl/ResourceProxy/Source/Imap.php | Imap.getContentIterator | public function getContentIterator()
{
// Initializing output array
$output = new \ArrayIterator();
// Getting total number of messages
$maxMessage = $this->storage->countMessages();
for($i=1; $i<=$maxMessage; $i++) {
// Getting the message object
$m... | php | public function getContentIterator()
{
// Initializing output array
$output = new \ArrayIterator();
// Getting total number of messages
$maxMessage = $this->storage->countMessages();
for($i=1; $i<=$maxMessage; $i++) {
// Getting the message object
$m... | [
"public",
"function",
"getContentIterator",
"(",
")",
"{",
"// Initializing output array",
"$",
"output",
"=",
"new",
"\\",
"ArrayIterator",
"(",
")",
";",
"// Getting total number of messages",
"$",
"maxMessage",
"=",
"$",
"this",
"->",
"storage",
"->",
"countMessa... | Returns an Iterator instance for a list of Resource instances.
(in this case, list of emails to be parsed)
@throws \Exception
@return mixed | [
"Returns",
"an",
"Iterator",
"instance",
"for",
"a",
"list",
"of",
"Resource",
"instances",
".",
"(",
"in",
"this",
"case",
"list",
"of",
"emails",
"to",
"be",
"parsed",
")"
] | train | https://github.com/mslib/resource-proxy/blob/be3f8589753f738f5114443a3465f5e84aecd156/Msl/ResourceProxy/Source/Imap.php#L71-L110 |
mslib/resource-proxy | Msl/ResourceProxy/Source/Imap.php | Imap.postParseUnitAction | public function postParseUnitAction($uniqueId, $success = true)
{
// Setting parsed message flag to SEEN
$result = new ParseResult();
try {
if ($success) {
$this->storage->setFlags($uniqueId, array(ZendStorage::FLAG_SEEN));
} else {
$th... | php | public function postParseUnitAction($uniqueId, $success = true)
{
// Setting parsed message flag to SEEN
$result = new ParseResult();
try {
if ($success) {
$this->storage->setFlags($uniqueId, array(ZendStorage::FLAG_SEEN));
} else {
$th... | [
"public",
"function",
"postParseUnitAction",
"(",
"$",
"uniqueId",
",",
"$",
"success",
"=",
"true",
")",
"{",
"// Setting parsed message flag to SEEN",
"$",
"result",
"=",
"new",
"ParseResult",
"(",
")",
";",
"try",
"{",
"if",
"(",
"$",
"success",
")",
"{",... | Action to be run after a single set of data retrieved from the remote source has been parsed.
@param string $uniqueId Unique id of the single set to be treated (e.g. unique id of a message in a mail box)
@param bool $success True if the data of a given resource have been downloaded and used correctly; false otherwi... | [
"Action",
"to",
"be",
"run",
"after",
"a",
"single",
"set",
"of",
"data",
"retrieved",
"from",
"the",
"remote",
"source",
"has",
"been",
"parsed",
"."
] | train | https://github.com/mslib/resource-proxy/blob/be3f8589753f738f5114443a3465f5e84aecd156/Msl/ResourceProxy/Source/Imap.php#L120-L138 |
snapwp/snap-blade | src/Blade_Strategy.php | Blade_Strategy.render | public function render($slug, $data = [])
{
$this->current_view = $this->get_template_name($slug);
$data = $this->add_default_data($data);
echo $this->blade->run($this->current_view, $data);
// Now a view has been rendered, reset the current_view context.
$this->current_vi... | php | public function render($slug, $data = [])
{
$this->current_view = $this->get_template_name($slug);
$data = $this->add_default_data($data);
echo $this->blade->run($this->current_view, $data);
// Now a view has been rendered, reset the current_view context.
$this->current_vi... | [
"public",
"function",
"render",
"(",
"$",
"slug",
",",
"$",
"data",
"=",
"[",
"]",
")",
"{",
"$",
"this",
"->",
"current_view",
"=",
"$",
"this",
"->",
"get_template_name",
"(",
"$",
"slug",
")",
";",
"$",
"data",
"=",
"$",
"this",
"->",
"add_defau... | Renders a view.
@since 1.0.0
@param string $slug The slug for the generic template.
@param array $data Optional. Additional data to pass to a partial. Available in the partial as $data.
@throws \Exception | [
"Renders",
"a",
"view",
"."
] | train | https://github.com/snapwp/snap-blade/blob/41e004e93440f6b58638b64dc8d20cca4a0546fa/src/Blade_Strategy.php#L45-L55 |
snapwp/snap-blade | src/Blade_Strategy.php | Blade_Strategy.partial | public function partial($slug, $data = [])
{
$data = $this->add_default_data($data);
// Check if this is being run outside of a view context.
if ($this->current_view === null) {
echo $this->blade->run('partials.' . $this->bladeify($slug), $data);
return;
}
... | php | public function partial($slug, $data = [])
{
$data = $this->add_default_data($data);
// Check if this is being run outside of a view context.
if ($this->current_view === null) {
echo $this->blade->run('partials.' . $this->bladeify($slug), $data);
return;
}
... | [
"public",
"function",
"partial",
"(",
"$",
"slug",
",",
"$",
"data",
"=",
"[",
"]",
")",
"{",
"$",
"data",
"=",
"$",
"this",
"->",
"add_default_data",
"(",
"$",
"data",
")",
";",
"// Check if this is being run outside of a view context.",
"if",
"(",
"$",
"... | Fetch and display a template partial.
@since 1.0.0
@param string $slug The slug for the generic template.
@param array $data Optional. Additional data to pass to a partial. Available in the partial as $data.
@throws \Exception | [
"Fetch",
"and",
"display",
"a",
"template",
"partial",
"."
] | train | https://github.com/snapwp/snap-blade/blob/41e004e93440f6b58638b64dc8d20cca4a0546fa/src/Blade_Strategy.php#L66-L77 |
snapwp/snap-blade | src/Blade_Strategy.php | Blade_Strategy.get_template_name | public function get_template_name($slug)
{
$slug = \str_replace(
[
Config::get('theme.templates_directory') . '/',
$this->blade->getFileExtension(),
],
'',
$slug
);
if (\strpos($slug, 'views/') !== 0) {
... | php | public function get_template_name($slug)
{
$slug = \str_replace(
[
Config::get('theme.templates_directory') . '/',
$this->blade->getFileExtension(),
],
'',
$slug
);
if (\strpos($slug, 'views/') !== 0) {
... | [
"public",
"function",
"get_template_name",
"(",
"$",
"slug",
")",
"{",
"$",
"slug",
"=",
"\\",
"str_replace",
"(",
"[",
"Config",
"::",
"get",
"(",
"'theme.templates_directory'",
")",
".",
"'/'",
",",
"$",
"this",
"->",
"blade",
"->",
"getFileExtension",
"... | Generate the template file name from the slug.
@since 1.0.0
@param string $slug The slug for the generic template.
@return string | [
"Generate",
"the",
"template",
"file",
"name",
"from",
"the",
"slug",
"."
] | train | https://github.com/snapwp/snap-blade/blob/41e004e93440f6b58638b64dc8d20cca4a0546fa/src/Blade_Strategy.php#L87-L103 |
snapwp/snap-blade | src/Blade_Strategy.php | Blade_Strategy.add_default_data | private function add_default_data($data = [])
{
global $wp_query, $post;
$data['wp_query'] = $wp_query;
$data['post'] = &$post;
$data['current_view'] = $this->current_view;
$data['request'] = Request::get_root_instance();
$data['errors'] = Validation::$errors... | php | private function add_default_data($data = [])
{
global $wp_query, $post;
$data['wp_query'] = $wp_query;
$data['post'] = &$post;
$data['current_view'] = $this->current_view;
$data['request'] = Request::get_root_instance();
$data['errors'] = Validation::$errors... | [
"private",
"function",
"add_default_data",
"(",
"$",
"data",
"=",
"[",
"]",
")",
"{",
"global",
"$",
"wp_query",
",",
"$",
"post",
";",
"$",
"data",
"[",
"'wp_query'",
"]",
"=",
"$",
"wp_query",
";",
"$",
"data",
"[",
"'post'",
"]",
"=",
"&",
"$",
... | Add default data to template.
@since 1.0.0
@param array $data Data array.
@return array | [
"Add",
"default",
"data",
"to",
"template",
"."
] | train | https://github.com/snapwp/snap-blade/blob/41e004e93440f6b58638b64dc8d20cca4a0546fa/src/Blade_Strategy.php#L125-L136 |
DataDo/data | src/main/php/DataDo/Data/Parser/DefaultMethodNameParser.php | DefaultMethodNameParser.parse | public function parse($methodName)
{
return new MethodNameToken(
$methodName,
$this->getQueryMode($methodName),
$this->getTokens($methodName)
);
} | php | public function parse($methodName)
{
return new MethodNameToken(
$methodName,
$this->getQueryMode($methodName),
$this->getTokens($methodName)
);
} | [
"public",
"function",
"parse",
"(",
"$",
"methodName",
")",
"{",
"return",
"new",
"MethodNameToken",
"(",
"$",
"methodName",
",",
"$",
"this",
"->",
"getQueryMode",
"(",
"$",
"methodName",
")",
",",
"$",
"this",
"->",
"getTokens",
"(",
"$",
"methodName",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/DataDo/data/blob/555b02a27755032fcd53e165b0674e81a68067c0/src/main/php/DataDo/Data/Parser/DefaultMethodNameParser.php#L25-L32 |
DataDo/data | src/main/php/DataDo/Data/Parser/DefaultMethodNameParser.php | DefaultMethodNameParser.getTokens | private function getTokens($methodName)
{
preg_match_all('([A-Z_-][^A-Z_-]*)', $methodName, $rawTokens);
$result = array();
$lastToken = null;
$seenBy = false;
foreach ($rawTokens[0] as $token) {
$newToken = $this->getToken($token, $seenBy);
if ($newT... | php | private function getTokens($methodName)
{
preg_match_all('([A-Z_-][^A-Z_-]*)', $methodName, $rawTokens);
$result = array();
$lastToken = null;
$seenBy = false;
foreach ($rawTokens[0] as $token) {
$newToken = $this->getToken($token, $seenBy);
if ($newT... | [
"private",
"function",
"getTokens",
"(",
"$",
"methodName",
")",
"{",
"preg_match_all",
"(",
"'([A-Z_-][^A-Z_-]*)'",
",",
"$",
"methodName",
",",
"$",
"rawTokens",
")",
";",
"$",
"result",
"=",
"array",
"(",
")",
";",
"$",
"lastToken",
"=",
"null",
";",
... | Split the method name into tokens and parse them.
@param $methodName string the method name
@return Token[] | [
"Split",
"the",
"method",
"name",
"into",
"tokens",
"and",
"parse",
"them",
"."
] | train | https://github.com/DataDo/data/blob/555b02a27755032fcd53e165b0674e81a68067c0/src/main/php/DataDo/Data/Parser/DefaultMethodNameParser.php#L50-L79 |
DataDo/data | src/main/php/DataDo/Data/Parser/DefaultMethodNameParser.php | DefaultMethodNameParser.getToken | private function getToken($token, &$hasSeenBy)
{
switch ($token) {
case 'And':
return new AndToken();
case 'Or':
return new OrToken();
case 'By':
case 'Where':
$hasSeenBy = true;
return new ByToke... | php | private function getToken($token, &$hasSeenBy)
{
switch ($token) {
case 'And':
return new AndToken();
case 'Or':
return new OrToken();
case 'By':
case 'Where':
$hasSeenBy = true;
return new ByToke... | [
"private",
"function",
"getToken",
"(",
"$",
"token",
",",
"&",
"$",
"hasSeenBy",
")",
"{",
"switch",
"(",
"$",
"token",
")",
"{",
"case",
"'And'",
":",
"return",
"new",
"AndToken",
"(",
")",
";",
"case",
"'Or'",
":",
"return",
"new",
"OrToken",
"(",... | Translate a token source to a token object.
@param $token string the token source
@return Token the token object | [
"Translate",
"a",
"token",
"source",
"to",
"a",
"token",
"object",
"."
] | train | https://github.com/DataDo/data/blob/555b02a27755032fcd53e165b0674e81a68067c0/src/main/php/DataDo/Data/Parser/DefaultMethodNameParser.php#L87-L115 |
xiewulong/yii2-fileupload | oss/libs/symfony/yaml/Symfony/Component/Yaml/Parser.php | Parser.parse | public function parse($value, $exceptionOnInvalidType = false, $objectSupport = false)
{
$this->currentLineNb = -1;
$this->currentLine = '';
$this->lines = explode("\n", $this->cleanup($value));
if (function_exists('mb_detect_encoding') && false === mb_detect_encoding($value, 'UTF-8... | php | public function parse($value, $exceptionOnInvalidType = false, $objectSupport = false)
{
$this->currentLineNb = -1;
$this->currentLine = '';
$this->lines = explode("\n", $this->cleanup($value));
if (function_exists('mb_detect_encoding') && false === mb_detect_encoding($value, 'UTF-8... | [
"public",
"function",
"parse",
"(",
"$",
"value",
",",
"$",
"exceptionOnInvalidType",
"=",
"false",
",",
"$",
"objectSupport",
"=",
"false",
")",
"{",
"$",
"this",
"->",
"currentLineNb",
"=",
"-",
"1",
";",
"$",
"this",
"->",
"currentLine",
"=",
"''",
... | Parses a YAML string to a PHP value.
@param string $value A YAML string
@param Boolean $exceptionOnInvalidType true if an exception must be thrown on invalid types (a PHP resource or object), false otherwise
@param Boolean $objectSupport true if object support is enabled, false otherwise
@r... | [
"Parses",
"a",
"YAML",
"string",
"to",
"a",
"PHP",
"value",
"."
] | train | https://github.com/xiewulong/yii2-fileupload/blob/3e75b17a4a18dd8466e3f57c63136de03470ca82/oss/libs/symfony/yaml/Symfony/Component/Yaml/Parser.php#L49-L256 |
xiewulong/yii2-fileupload | oss/libs/symfony/yaml/Symfony/Component/Yaml/Parser.php | Parser.getNextEmbedBlock | private function getNextEmbedBlock($indentation = null)
{
$this->moveToNextLine();
if (null === $indentation) {
$newIndent = $this->getCurrentLineIndentation();
$unindentedEmbedBlock = $this->isStringUnIndentedCollectionItem($this->currentLine);
if (!$this->isC... | php | private function getNextEmbedBlock($indentation = null)
{
$this->moveToNextLine();
if (null === $indentation) {
$newIndent = $this->getCurrentLineIndentation();
$unindentedEmbedBlock = $this->isStringUnIndentedCollectionItem($this->currentLine);
if (!$this->isC... | [
"private",
"function",
"getNextEmbedBlock",
"(",
"$",
"indentation",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"moveToNextLine",
"(",
")",
";",
"if",
"(",
"null",
"===",
"$",
"indentation",
")",
"{",
"$",
"newIndent",
"=",
"$",
"this",
"->",
"getCurrentL... | Returns the next embed block of YAML.
@param integer $indentation The indent level at which the block is to be read, or null for default
@return string A YAML string
@throws ParseException When indentation problem are detected | [
"Returns",
"the",
"next",
"embed",
"block",
"of",
"YAML",
"."
] | train | https://github.com/xiewulong/yii2-fileupload/blob/3e75b17a4a18dd8466e3f57c63136de03470ca82/oss/libs/symfony/yaml/Symfony/Component/Yaml/Parser.php#L287-L339 |
xiewulong/yii2-fileupload | oss/libs/symfony/yaml/Symfony/Component/Yaml/Parser.php | Parser.parseValue | private function parseValue($value, $exceptionOnInvalidType, $objectSupport)
{
if (0 === strpos($value, '*')) {
if (false !== $pos = strpos($value, '#')) {
$value = substr($value, 1, $pos - 2);
} else {
$value = substr($value, 1);
}
... | php | private function parseValue($value, $exceptionOnInvalidType, $objectSupport)
{
if (0 === strpos($value, '*')) {
if (false !== $pos = strpos($value, '#')) {
$value = substr($value, 1, $pos - 2);
} else {
$value = substr($value, 1);
}
... | [
"private",
"function",
"parseValue",
"(",
"$",
"value",
",",
"$",
"exceptionOnInvalidType",
",",
"$",
"objectSupport",
")",
"{",
"if",
"(",
"0",
"===",
"strpos",
"(",
"$",
"value",
",",
"'*'",
")",
")",
"{",
"if",
"(",
"false",
"!==",
"$",
"pos",
"="... | Parses a YAML value.
@param string $value A YAML value
@param Boolean $exceptionOnInvalidType True if an exception must be thrown on invalid types false otherwise
@param Boolean $objectSupport True if object support is enabled, false otherwise
@return mixed A PHP value
@throws ParseExcept... | [
"Parses",
"a",
"YAML",
"value",
"."
] | train | https://github.com/xiewulong/yii2-fileupload/blob/3e75b17a4a18dd8466e3f57c63136de03470ca82/oss/libs/symfony/yaml/Symfony/Component/Yaml/Parser.php#L376-L406 |
xiewulong/yii2-fileupload | oss/libs/symfony/yaml/Symfony/Component/Yaml/Parser.php | Parser.parseFoldedScalar | private function parseFoldedScalar($separator, $indicator = '', $indentation = 0)
{
$notEOF = $this->moveToNextLine();
if (!$notEOF) {
return '';
}
$isCurrentLineBlank = $this->isCurrentLineBlank();
$text = '';
// leading blank lines are consumed before ... | php | private function parseFoldedScalar($separator, $indicator = '', $indentation = 0)
{
$notEOF = $this->moveToNextLine();
if (!$notEOF) {
return '';
}
$isCurrentLineBlank = $this->isCurrentLineBlank();
$text = '';
// leading blank lines are consumed before ... | [
"private",
"function",
"parseFoldedScalar",
"(",
"$",
"separator",
",",
"$",
"indicator",
"=",
"''",
",",
"$",
"indentation",
"=",
"0",
")",
"{",
"$",
"notEOF",
"=",
"$",
"this",
"->",
"moveToNextLine",
"(",
")",
";",
"if",
"(",
"!",
"$",
"notEOF",
"... | Parses a folded scalar.
@param string $separator The separator that was used to begin this folded scalar (| or >)
@param string $indicator The indicator that was used to begin this folded scalar (+ or -)
@param integer $indentation The indentation that was used to begin this folded scalar
@return string The te... | [
"Parses",
"a",
"folded",
"scalar",
"."
] | train | https://github.com/xiewulong/yii2-fileupload/blob/3e75b17a4a18dd8466e3f57c63136de03470ca82/oss/libs/symfony/yaml/Symfony/Component/Yaml/Parser.php#L417-L487 |
byu-oit/byu-jwt-php | src/BYUJWT.php | BYUJWT.getWellKnown | public function getWellKnown()
{
$cached = $this->getCache('wellKnown');
if (!empty($cached)) {
return $cached;
}
try {
$response = $this->client->get($this->wellKnownUrl);
} catch (RequestException $e) {
$this->lastException = $e;
... | php | public function getWellKnown()
{
$cached = $this->getCache('wellKnown');
if (!empty($cached)) {
return $cached;
}
try {
$response = $this->client->get($this->wellKnownUrl);
} catch (RequestException $e) {
$this->lastException = $e;
... | [
"public",
"function",
"getWellKnown",
"(",
")",
"{",
"$",
"cached",
"=",
"$",
"this",
"->",
"getCache",
"(",
"'wellKnown'",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"cached",
")",
")",
"{",
"return",
"$",
"cached",
";",
"}",
"try",
"{",
"$",
... | Get the response of the specified .well-known URL.
@return object Parsed JSON response from the well known URL | [
"Get",
"the",
"response",
"of",
"the",
"specified",
".",
"well",
"-",
"known",
"URL",
"."
] | train | https://github.com/byu-oit/byu-jwt-php/blob/9e55be8928a2c4925176303c100caf293d6a2cf9/src/BYUJWT.php#L63-L85 |
byu-oit/byu-jwt-php | src/BYUJWT.php | BYUJWT.getPublicKey | public function getPublicKey()
{
$cached = $this->getCache('publicKey');
if (!empty($cached)) {
return $cached;
}
$wellKnown = $this->getWellKnown();
if (empty($wellKnown->jwks_uri)) {
return null;
}
try {
$response = $thi... | php | public function getPublicKey()
{
$cached = $this->getCache('publicKey');
if (!empty($cached)) {
return $cached;
}
$wellKnown = $this->getWellKnown();
if (empty($wellKnown->jwks_uri)) {
return null;
}
try {
$response = $thi... | [
"public",
"function",
"getPublicKey",
"(",
")",
"{",
"$",
"cached",
"=",
"$",
"this",
"->",
"getCache",
"(",
"'publicKey'",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"cached",
")",
")",
"{",
"return",
"$",
"cached",
";",
"}",
"$",
"wellKnown",
"... | Get the public key of the current well-known URL
@return string | [
"Get",
"the",
"public",
"key",
"of",
"the",
"current",
"well",
"-",
"known",
"URL"
] | train | https://github.com/byu-oit/byu-jwt-php/blob/9e55be8928a2c4925176303c100caf293d6a2cf9/src/BYUJWT.php#L92-L126 |
byu-oit/byu-jwt-php | src/BYUJWT.php | BYUJWT.validateJWT | public function validateJWT($jwt)
{
try {
$decoded = $this->decode($jwt);
return !empty($decoded);
} catch (Exception $e) {
//For simple true/false validation we don't throw exceptions;
//just return false but store exception in case further
... | php | public function validateJWT($jwt)
{
try {
$decoded = $this->decode($jwt);
return !empty($decoded);
} catch (Exception $e) {
//For simple true/false validation we don't throw exceptions;
//just return false but store exception in case further
... | [
"public",
"function",
"validateJWT",
"(",
"$",
"jwt",
")",
"{",
"try",
"{",
"$",
"decoded",
"=",
"$",
"this",
"->",
"decode",
"(",
"$",
"jwt",
")",
";",
"return",
"!",
"empty",
"(",
"$",
"decoded",
")",
";",
"}",
"catch",
"(",
"Exception",
"$",
"... | Check if a JWT is valid
@param string $jwt JWT
@return bool true if $jwt is a valid JWT, false if not | [
"Check",
"if",
"a",
"JWT",
"is",
"valid"
] | train | https://github.com/byu-oit/byu-jwt-php/blob/9e55be8928a2c4925176303c100caf293d6a2cf9/src/BYUJWT.php#L135-L147 |
byu-oit/byu-jwt-php | src/BYUJWT.php | BYUJWT.decode | public function decode($jwt)
{
$wellKnown = $this->getWellKnown();
$key = $this->getPublicKey();
$decodedObject = JWT::decode(
$jwt,
$key,
$wellKnown->id_token_signing_alg_values_supported
);
//Firebase\JWT\JWT::decode does not verify that... | php | public function decode($jwt)
{
$wellKnown = $this->getWellKnown();
$key = $this->getPublicKey();
$decodedObject = JWT::decode(
$jwt,
$key,
$wellKnown->id_token_signing_alg_values_supported
);
//Firebase\JWT\JWT::decode does not verify that... | [
"public",
"function",
"decode",
"(",
"$",
"jwt",
")",
"{",
"$",
"wellKnown",
"=",
"$",
"this",
"->",
"getWellKnown",
"(",
")",
";",
"$",
"key",
"=",
"$",
"this",
"->",
"getPublicKey",
"(",
")",
";",
"$",
"decodedObject",
"=",
"JWT",
"::",
"decode",
... | Decode a JWT
@param string $jwt JWT
@return object decoded JWT
@throws Exception Various exceptions for various problems with JWT
(see Firebase\JWT\JWT::decode for details) | [
"Decode",
"a",
"JWT"
] | train | https://github.com/byu-oit/byu-jwt-php/blob/9e55be8928a2c4925176303c100caf293d6a2cf9/src/BYUJWT.php#L159-L188 |
byu-oit/byu-jwt-php | src/BYUJWT.php | BYUJWT.parseClaims | public function parseClaims($jwt)
{
//PHP 7 has convenient "??" operator, but we're making this
//5.4+ compatible. So this is a simple "safe array access" that
//won't cause warnings or errors if we try to get a non-existent key
$get = function ($arr, $key) {
return array... | php | public function parseClaims($jwt)
{
//PHP 7 has convenient "??" operator, but we're making this
//5.4+ compatible. So this is a simple "safe array access" that
//won't cause warnings or errors if we try to get a non-existent key
$get = function ($arr, $key) {
return array... | [
"public",
"function",
"parseClaims",
"(",
"$",
"jwt",
")",
"{",
"//PHP 7 has convenient \"??\" operator, but we're making this",
"//5.4+ compatible. So this is a simple \"safe array access\" that",
"//won't cause warnings or errors if we try to get a non-existent key",
"$",
"get",
"=",
"... | Parse standard set of 'http://XXXX/claims/YYYY' claims and save as
hierarchal array data
@param array $jwt
@return array | [
"Parse",
"standard",
"set",
"of",
"http",
":",
"//",
"XXXX",
"/",
"claims",
"/",
"YYYY",
"claims",
"and",
"save",
"as",
"hierarchal",
"array",
"data"
] | train | https://github.com/byu-oit/byu-jwt-php/blob/9e55be8928a2c4925176303c100caf293d6a2cf9/src/BYUJWT.php#L198-L264 |
byu-oit/byu-jwt-php | src/BYUJWT.php | BYUJWT.getCache | protected function getCache($key)
{
if (array_key_exists($key, $this->cache)) {
return $this->cache[$key];
}
return false;
} | php | protected function getCache($key)
{
if (array_key_exists($key, $this->cache)) {
return $this->cache[$key];
}
return false;
} | [
"protected",
"function",
"getCache",
"(",
"$",
"key",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"$",
"key",
",",
"$",
"this",
"->",
"cache",
")",
")",
"{",
"return",
"$",
"this",
"->",
"cache",
"[",
"$",
"key",
"]",
";",
"}",
"return",
"false",... | Simple cache reader. Implemented as a function so that if you don't
want caching, you can make a subclass that overrides this
function and always returns false
@param string $key Cache key
@return various | [
"Simple",
"cache",
"reader",
".",
"Implemented",
"as",
"a",
"function",
"so",
"that",
"if",
"you",
"don",
"t",
"want",
"caching",
"you",
"can",
"make",
"a",
"subclass",
"that",
"overrides",
"this",
"function",
"and",
"always",
"returns",
"false"
] | train | https://github.com/byu-oit/byu-jwt-php/blob/9e55be8928a2c4925176303c100caf293d6a2cf9/src/BYUJWT.php#L275-L281 |
WellCommerce/StandardEditionBundle | DataFixtures/ORM/LoadTaxData.php | LoadTaxData.load | public function load(ObjectManager $manager)
{
if (!$this->isEnabled()) {
return;
}
foreach (self::$samples as $val) {
$name = sprintf('%s%s', $val, '%');
$tax = new Tax();
$tax->setValue($val);
foreach ($this->getLocales(... | php | public function load(ObjectManager $manager)
{
if (!$this->isEnabled()) {
return;
}
foreach (self::$samples as $val) {
$name = sprintf('%s%s', $val, '%');
$tax = new Tax();
$tax->setValue($val);
foreach ($this->getLocales(... | [
"public",
"function",
"load",
"(",
"ObjectManager",
"$",
"manager",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isEnabled",
"(",
")",
")",
"{",
"return",
";",
"}",
"foreach",
"(",
"self",
"::",
"$",
"samples",
"as",
"$",
"val",
")",
"{",
"$",
"... | {@inheritDoc} | [
"{"
] | train | https://github.com/WellCommerce/StandardEditionBundle/blob/6367bd20bbb6bde37c710a6ba87ae72b5f05f61e/DataFixtures/ORM/LoadTaxData.php#L31-L51 |
gdbots/iam-php | src/CreateAppHandler.php | CreateAppHandler.beforePutEvents | protected function beforePutEvents(NodeCreated $event, CreateNode $command, Pbjx $pbjx): void
{
parent::beforePutEvents($event, $command, $pbjx);
/** @var App $node */
$node = $event->get('node');
$node->set('status', NodeStatus::PUBLISHED());
} | php | protected function beforePutEvents(NodeCreated $event, CreateNode $command, Pbjx $pbjx): void
{
parent::beforePutEvents($event, $command, $pbjx);
/** @var App $node */
$node = $event->get('node');
$node->set('status', NodeStatus::PUBLISHED());
} | [
"protected",
"function",
"beforePutEvents",
"(",
"NodeCreated",
"$",
"event",
",",
"CreateNode",
"$",
"command",
",",
"Pbjx",
"$",
"pbjx",
")",
":",
"void",
"{",
"parent",
"::",
"beforePutEvents",
"(",
"$",
"event",
",",
"$",
"command",
",",
"$",
"pbjx",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/gdbots/iam-php/blob/3dbfa602de183a7ac5fb5140304e8cf4c4b15ab3/src/CreateAppHandler.php#L24-L31 |
Xety/Breadcrumbs | src/BreadcrumbsTrait.php | BreadcrumbsTrait.setDivider | public function setDivider($divider = '/'): Breadcrumbs
{
if (!is_string($divider) && !is_null($divider)) {
throw new InvalidArgumentException('Breadcrumbs::setDivider() only accepts strings or NULL');
}
$this->setOption('divider', $divider);
return $this;
} | php | public function setDivider($divider = '/'): Breadcrumbs
{
if (!is_string($divider) && !is_null($divider)) {
throw new InvalidArgumentException('Breadcrumbs::setDivider() only accepts strings or NULL');
}
$this->setOption('divider', $divider);
return $this;
} | [
"public",
"function",
"setDivider",
"(",
"$",
"divider",
"=",
"'/'",
")",
":",
"Breadcrumbs",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"divider",
")",
"&&",
"!",
"is_null",
"(",
"$",
"divider",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException"... | Sets the divider which will be printed between the breadcrumbs.
If set to `null`, the divider won't be printed at all.
@param string|null $divider The divider used to separe the breadcrumbs.
@return \Xety\Breadcrumbs\Breadcrumbs | [
"Sets",
"the",
"divider",
"which",
"will",
"be",
"printed",
"between",
"the",
"breadcrumbs",
"."
] | train | https://github.com/Xety/Breadcrumbs/blob/aded39bdbf4f6e857f0154a810339d71897a94b0/src/BreadcrumbsTrait.php#L53-L61 |
Xety/Breadcrumbs | src/BreadcrumbsTrait.php | BreadcrumbsTrait.setDividerElement | public function setDividerElement(string $element): Breadcrumbs
{
$this->validateElement('allowedDividerElement', $element);
$this->setOption('dividerElement', $element);
return $this;
} | php | public function setDividerElement(string $element): Breadcrumbs
{
$this->validateElement('allowedDividerElement', $element);
$this->setOption('dividerElement', $element);
return $this;
} | [
"public",
"function",
"setDividerElement",
"(",
"string",
"$",
"element",
")",
":",
"Breadcrumbs",
"{",
"$",
"this",
"->",
"validateElement",
"(",
"'allowedDividerElement'",
",",
"$",
"element",
")",
";",
"$",
"this",
"->",
"setOption",
"(",
"'dividerElement'",
... | Set the divider list DOM Element.
@param string $element The Element to set.
@return \Xety\Breadcrumbs\Breadcrumbs | [
"Set",
"the",
"divider",
"list",
"DOM",
"Element",
"."
] | train | https://github.com/Xety/Breadcrumbs/blob/aded39bdbf4f6e857f0154a810339d71897a94b0/src/BreadcrumbsTrait.php#L80-L87 |
Xety/Breadcrumbs | src/BreadcrumbsTrait.php | BreadcrumbsTrait.setListElement | public function setListElement(string $element): Breadcrumbs
{
$this->validateElement('allowedListElement', $element);
$this->setOption('listElement', $element);
return $this;
} | php | public function setListElement(string $element): Breadcrumbs
{
$this->validateElement('allowedListElement', $element);
$this->setOption('listElement', $element);
return $this;
} | [
"public",
"function",
"setListElement",
"(",
"string",
"$",
"element",
")",
":",
"Breadcrumbs",
"{",
"$",
"this",
"->",
"validateElement",
"(",
"'allowedListElement'",
",",
"$",
"element",
")",
";",
"$",
"this",
"->",
"setOption",
"(",
"'listElement'",
",",
... | Set the container list DOM Element.
@param string $element The Element to set.
@return \Xety\Breadcrumbs\Breadcrumbs | [
"Set",
"the",
"container",
"list",
"DOM",
"Element",
"."
] | train | https://github.com/Xety/Breadcrumbs/blob/aded39bdbf4f6e857f0154a810339d71897a94b0/src/BreadcrumbsTrait.php#L152-L159 |
Xety/Breadcrumbs | src/BreadcrumbsTrait.php | BreadcrumbsTrait.setListItemElement | public function setListItemElement(string $element): Breadcrumbs
{
$this->validateElement('allowedListItemElement', $element);
$this->setOption('listItemElement', $element);
return $this;
} | php | public function setListItemElement(string $element): Breadcrumbs
{
$this->validateElement('allowedListItemElement', $element);
$this->setOption('listItemElement', $element);
return $this;
} | [
"public",
"function",
"setListItemElement",
"(",
"string",
"$",
"element",
")",
":",
"Breadcrumbs",
"{",
"$",
"this",
"->",
"validateElement",
"(",
"'allowedListItemElement'",
",",
"$",
"element",
")",
";",
"$",
"this",
"->",
"setOption",
"(",
"'listItemElement'... | Set the item DOM Element.
@param string $element The Element to set.
@return \Xety\Breadcrumbs\Breadcrumbs | [
"Set",
"the",
"item",
"DOM",
"Element",
"."
] | train | https://github.com/Xety/Breadcrumbs/blob/aded39bdbf4f6e857f0154a810339d71897a94b0/src/BreadcrumbsTrait.php#L224-L231 |
Xety/Breadcrumbs | src/BreadcrumbsTrait.php | BreadcrumbsTrait.setListActiveElement | public function setListActiveElement(string $element): Breadcrumbs
{
$this->validateElement('allowedListActiveElement', $element);
$this->setOption('listActiveElement', $element);
return $this;
} | php | public function setListActiveElement(string $element): Breadcrumbs
{
$this->validateElement('allowedListActiveElement', $element);
$this->setOption('listActiveElement', $element);
return $this;
} | [
"public",
"function",
"setListActiveElement",
"(",
"string",
"$",
"element",
")",
":",
"Breadcrumbs",
"{",
"$",
"this",
"->",
"validateElement",
"(",
"'allowedListActiveElement'",
",",
"$",
"element",
")",
";",
"$",
"this",
"->",
"setOption",
"(",
"'listActiveEl... | Set the active DOM Element.
@param string $element The Element to set.
@return \Xety\Breadcrumbs\Breadcrumbs | [
"Set",
"the",
"active",
"DOM",
"Element",
"."
] | train | https://github.com/Xety/Breadcrumbs/blob/aded39bdbf4f6e857f0154a810339d71897a94b0/src/BreadcrumbsTrait.php#L296-L303 |
Xety/Breadcrumbs | src/BreadcrumbsTrait.php | BreadcrumbsTrait.setElementClasses | protected function setElementClasses(string $option, $classes): Breadcrumbs
{
if (is_string($classes)) {
$classes = explode(' ', $classes);
}
$this->validateClasses($classes);
$this->setOption($option, array_unique($classes));
return $this;
} | php | protected function setElementClasses(string $option, $classes): Breadcrumbs
{
if (is_string($classes)) {
$classes = explode(' ', $classes);
}
$this->validateClasses($classes);
$this->setOption($option, array_unique($classes));
return $this;
} | [
"protected",
"function",
"setElementClasses",
"(",
"string",
"$",
"option",
",",
"$",
"classes",
")",
":",
"Breadcrumbs",
"{",
"if",
"(",
"is_string",
"(",
"$",
"classes",
")",
")",
"{",
"$",
"classes",
"=",
"explode",
"(",
"' '",
",",
"$",
"classes",
... | Set the classes to the given option type.
@param string $option The option from where we must set the classes.
@param string|array $classes The classes to set.
@return \Xety\Breadcrumbs\Breadcrumbs | [
"Set",
"the",
"classes",
"to",
"the",
"given",
"option",
"type",
"."
] | train | https://github.com/Xety/Breadcrumbs/blob/aded39bdbf4f6e857f0154a810339d71897a94b0/src/BreadcrumbsTrait.php#L369-L379 |
Xety/Breadcrumbs | src/BreadcrumbsTrait.php | BreadcrumbsTrait.addElementClasses | protected function addElementClasses(string $option, $classes): Breadcrumbs
{
if (is_string($classes)) {
$classes = explode(' ', $classes);
}
$this->validateClasses($classes);
$classes = array_merge(
$this->getOption($option),
$classes
);
... | php | protected function addElementClasses(string $option, $classes): Breadcrumbs
{
if (is_string($classes)) {
$classes = explode(' ', $classes);
}
$this->validateClasses($classes);
$classes = array_merge(
$this->getOption($option),
$classes
);
... | [
"protected",
"function",
"addElementClasses",
"(",
"string",
"$",
"option",
",",
"$",
"classes",
")",
":",
"Breadcrumbs",
"{",
"if",
"(",
"is_string",
"(",
"$",
"classes",
")",
")",
"{",
"$",
"classes",
"=",
"explode",
"(",
"' '",
",",
"$",
"classes",
... | Add one or more CSS classes related to the option type.
@param string $option The option from where we must add the classes.
@param string|array $classes The classes to add.
@return \Xety\Breadcrumbs\Breadcrumbs | [
"Add",
"one",
"or",
"more",
"CSS",
"classes",
"related",
"to",
"the",
"option",
"type",
"."
] | train | https://github.com/Xety/Breadcrumbs/blob/aded39bdbf4f6e857f0154a810339d71897a94b0/src/BreadcrumbsTrait.php#L405-L419 |
Xety/Breadcrumbs | src/BreadcrumbsTrait.php | BreadcrumbsTrait.removeElementClasses | protected function removeElementClasses(string $option, $classes): Breadcrumbs
{
if (is_string($classes)) {
$classes = explode(' ', $classes);
}
$this->validateClasses($classes);
$classes = array_diff(
$this->getOption($option),
$classes
)... | php | protected function removeElementClasses(string $option, $classes): Breadcrumbs
{
if (is_string($classes)) {
$classes = explode(' ', $classes);
}
$this->validateClasses($classes);
$classes = array_diff(
$this->getOption($option),
$classes
)... | [
"protected",
"function",
"removeElementClasses",
"(",
"string",
"$",
"option",
",",
"$",
"classes",
")",
":",
"Breadcrumbs",
"{",
"if",
"(",
"is_string",
"(",
"$",
"classes",
")",
")",
"{",
"$",
"classes",
"=",
"explode",
"(",
"' '",
",",
"$",
"classes",... | Remove one or more CSS classes related to the option type.
@param string $option The option from where we must remove the classes.
@param string|array $classes The classes to remove.
@return \Xety\Breadcrumbs\Breadcrumbs | [
"Remove",
"one",
"or",
"more",
"CSS",
"classes",
"related",
"to",
"the",
"option",
"type",
"."
] | train | https://github.com/Xety/Breadcrumbs/blob/aded39bdbf4f6e857f0154a810339d71897a94b0/src/BreadcrumbsTrait.php#L429-L443 |
Xety/Breadcrumbs | src/BreadcrumbsTrait.php | BreadcrumbsTrait.validateElement | protected function validateElement(string $type, string $element)
{
if (!in_array($element, $this->{$type})) {
$trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 2)[1]['function'];
throw new InvalidArgumentException("Breadcrumbs::{$trace} was passed \"$element\", but " .
... | php | protected function validateElement(string $type, string $element)
{
if (!in_array($element, $this->{$type})) {
$trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 2)[1]['function'];
throw new InvalidArgumentException("Breadcrumbs::{$trace} was passed \"$element\", but " .
... | [
"protected",
"function",
"validateElement",
"(",
"string",
"$",
"type",
",",
"string",
"$",
"element",
")",
"{",
"if",
"(",
"!",
"in_array",
"(",
"$",
"element",
",",
"$",
"this",
"->",
"{",
"$",
"type",
"}",
")",
")",
"{",
"$",
"trace",
"=",
"debu... | Validate an Element before saving it.
@param string $type The type from where we must validate the Element.
@param string $element The Element to validate.
@throws \InvalidArgumentException When the validation fail.
@return void | [
"Validate",
"an",
"Element",
"before",
"saving",
"it",
"."
] | train | https://github.com/Xety/Breadcrumbs/blob/aded39bdbf4f6e857f0154a810339d71897a94b0/src/BreadcrumbsTrait.php#L455-L463 |
Xety/Breadcrumbs | src/BreadcrumbsTrait.php | BreadcrumbsTrait.validateClasses | protected function validateClasses($classes)
{
if (!is_array($classes)) {
$trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 3)[2]['function'];
throw new InvalidArgumentException("Breadcrumbs::{$trace}() only accepts strings or arrays.");
}
foreach ($classes as $... | php | protected function validateClasses($classes)
{
if (!is_array($classes)) {
$trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 3)[2]['function'];
throw new InvalidArgumentException("Breadcrumbs::{$trace}() only accepts strings or arrays.");
}
foreach ($classes as $... | [
"protected",
"function",
"validateClasses",
"(",
"$",
"classes",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"classes",
")",
")",
"{",
"$",
"trace",
"=",
"debug_backtrace",
"(",
"DEBUG_BACKTRACE_IGNORE_ARGS",
",",
"3",
")",
"[",
"2",
"]",
"[",
"'func... | Validate the classes to ensure they have the right format.
@param array $classes The classes to validate.
@throws \InvalidArgumentException When the classes is not an array or a string.
Or when the class name is not a string.
@return void | [
"Validate",
"the",
"classes",
"to",
"ensure",
"they",
"have",
"the",
"right",
"format",
"."
] | train | https://github.com/Xety/Breadcrumbs/blob/aded39bdbf4f6e857f0154a810339d71897a94b0/src/BreadcrumbsTrait.php#L475-L493 |
i-lateral/silverstripe-users | code/forms/Users_EditAccountForm.php | Users_EditAccountForm.doUpdate | public function doUpdate($data)
{
$filter = array();
$member = Member::get()->byID($data["ID"]);
$this->extend("onBeforeUpdate", $data);
// Check that a member isn't trying to mess up another users profile
if (Member::currentUserID() && $member->canEdit(Member::currentUser(... | php | public function doUpdate($data)
{
$filter = array();
$member = Member::get()->byID($data["ID"]);
$this->extend("onBeforeUpdate", $data);
// Check that a member isn't trying to mess up another users profile
if (Member::currentUserID() && $member->canEdit(Member::currentUser(... | [
"public",
"function",
"doUpdate",
"(",
"$",
"data",
")",
"{",
"$",
"filter",
"=",
"array",
"(",
")",
";",
"$",
"member",
"=",
"Member",
"::",
"get",
"(",
")",
"->",
"byID",
"(",
"$",
"data",
"[",
"\"ID\"",
"]",
")",
";",
"$",
"this",
"->",
"ext... | Register a new member
@param array $data User submitted data
@return SS_HTTPResponse | [
"Register",
"a",
"new",
"member"
] | train | https://github.com/i-lateral/silverstripe-users/blob/27ddc38890fa2709ac419eccf854ab6b439f0d9a/code/forms/Users_EditAccountForm.php#L107-L141 |
titledk/silverstripe-uploaddirrules | code/rules/SubsiteUploadDirRules.php | SubsiteUploadDirRules.calc_directory_for_subsite | public static function calc_directory_for_subsite($subsite)
{
//$subsite = Subsite::currentSubsite();
if ($subsite) {
$title = $subsite->Title;
$url = strtolower(singleton('SiteTree')->generateURLSegment($title));
return $url;
} else {
return ... | php | public static function calc_directory_for_subsite($subsite)
{
//$subsite = Subsite::currentSubsite();
if ($subsite) {
$title = $subsite->Title;
$url = strtolower(singleton('SiteTree')->generateURLSegment($title));
return $url;
} else {
return ... | [
"public",
"static",
"function",
"calc_directory_for_subsite",
"(",
"$",
"subsite",
")",
"{",
"//$subsite = Subsite::currentSubsite();",
"if",
"(",
"$",
"subsite",
")",
"{",
"$",
"title",
"=",
"$",
"subsite",
"->",
"Title",
";",
"$",
"url",
"=",
"strtolower",
"... | Base rules for subsite directory
TODO make it configurable, allowing for subsite dirs to be either in the root, or inside of a "subsites" directory.
@return bool|string | [
"Base",
"rules",
"for",
"subsite",
"directory",
"TODO",
"make",
"it",
"configurable",
"allowing",
"for",
"subsite",
"dirs",
"to",
"be",
"either",
"in",
"the",
"root",
"or",
"inside",
"of",
"a",
"subsites",
"directory",
"."
] | train | https://github.com/titledk/silverstripe-uploaddirrules/blob/ed8ece7b6a4ca86dcb5dc16ee10ff339f629de3c/code/rules/SubsiteUploadDirRules.php#L16-L27 |
titledk/silverstripe-uploaddirrules | code/rules/SubsiteUploadDirRules.php | SubsiteUploadDirRules.get_directory_for_current_subsite | public static function get_directory_for_current_subsite()
{
$subsite = Subsite::currentSubsite();
if ($subsite) {
if ((int) $subsite->AssetsFolderID > 0) {
$dirObj = $subsite->AssetsFolder();
$dirName = str_replace('assets/', '', $dirObj->Filename);
... | php | public static function get_directory_for_current_subsite()
{
$subsite = Subsite::currentSubsite();
if ($subsite) {
if ((int) $subsite->AssetsFolderID > 0) {
$dirObj = $subsite->AssetsFolder();
$dirName = str_replace('assets/', '', $dirObj->Filename);
... | [
"public",
"static",
"function",
"get_directory_for_current_subsite",
"(",
")",
"{",
"$",
"subsite",
"=",
"Subsite",
"::",
"currentSubsite",
"(",
")",
";",
"if",
"(",
"$",
"subsite",
")",
"{",
"if",
"(",
"(",
"int",
")",
"$",
"subsite",
"->",
"AssetsFolderI... | Getting subsite directory based on it's assets folder.
@return bool|mixed | [
"Getting",
"subsite",
"directory",
"based",
"on",
"it",
"s",
"assets",
"folder",
"."
] | train | https://github.com/titledk/silverstripe-uploaddirrules/blob/ed8ece7b6a4ca86dcb5dc16ee10ff339f629de3c/code/rules/SubsiteUploadDirRules.php#L34-L51 |
titledk/silverstripe-uploaddirrules | code/rules/SubsiteUploadDirRules.php | SubsiteUploadDirRules.calc_full_directory_for_object | public static function calc_full_directory_for_object(DataObject $do)
{
if ($do->ClassName == 'Subsite') {
//This is the subsite creation
//we only want the subsite part
return self::calc_directory_for_subsite($do);
} else {
//If we're dealing with a p... | php | public static function calc_full_directory_for_object(DataObject $do)
{
if ($do->ClassName == 'Subsite') {
//This is the subsite creation
//we only want the subsite part
return self::calc_directory_for_subsite($do);
} else {
//If we're dealing with a p... | [
"public",
"static",
"function",
"calc_full_directory_for_object",
"(",
"DataObject",
"$",
"do",
")",
"{",
"if",
"(",
"$",
"do",
"->",
"ClassName",
"==",
"'Subsite'",
")",
"{",
"//This is the subsite creation",
"//we only want the subsite part",
"return",
"self",
"::",... | Full subsite directory.
@param DataObject $do
@return bool|string | [
"Full",
"subsite",
"directory",
"."
] | train | https://github.com/titledk/silverstripe-uploaddirrules/blob/ed8ece7b6a4ca86dcb5dc16ee10ff339f629de3c/code/rules/SubsiteUploadDirRules.php#L69-L90 |
DevGroup-ru/yii2-measure | src/models/Measure.php | Measure.validateConverterClass | public function validateConverterClass($attribute, $params)
{
$className = $this->$attribute;
if (class_exists($className) === true) {
if (new $className instanceof MeasureConverterInterface === false) {
$this->addError($attribute, MeasureHelper::t('Class does not impleme... | php | public function validateConverterClass($attribute, $params)
{
$className = $this->$attribute;
if (class_exists($className) === true) {
if (new $className instanceof MeasureConverterInterface === false) {
$this->addError($attribute, MeasureHelper::t('Class does not impleme... | [
"public",
"function",
"validateConverterClass",
"(",
"$",
"attribute",
",",
"$",
"params",
")",
"{",
"$",
"className",
"=",
"$",
"this",
"->",
"$",
"attribute",
";",
"if",
"(",
"class_exists",
"(",
"$",
"className",
")",
"===",
"true",
")",
"{",
"if",
... | Validate the converter class name
@param string $attribute
@param array $params | [
"Validate",
"the",
"converter",
"class",
"name"
] | train | https://github.com/DevGroup-ru/yii2-measure/blob/1d41a4af6ad3f2e34cabc32fa1c97bfd3643269c/src/models/Measure.php#L44-L54 |
DevGroup-ru/yii2-measure | src/models/Measure.php | Measure.getTypes | public static function getTypes()
{
$typesList = [];
foreach (Yii::$app->db->getTableSchema(static::tableName())->columns['type']->enumValues as $type) {
$typesList[$type] = MeasureHelper::t($type);
}
return $typesList;
} | php | public static function getTypes()
{
$typesList = [];
foreach (Yii::$app->db->getTableSchema(static::tableName())->columns['type']->enumValues as $type) {
$typesList[$type] = MeasureHelper::t($type);
}
return $typesList;
} | [
"public",
"static",
"function",
"getTypes",
"(",
")",
"{",
"$",
"typesList",
"=",
"[",
"]",
";",
"foreach",
"(",
"Yii",
"::",
"$",
"app",
"->",
"db",
"->",
"getTableSchema",
"(",
"static",
"::",
"tableName",
"(",
")",
")",
"->",
"columns",
"[",
"'typ... | Get list of measure types.
@return array of types in the next format `'TypeName' => 'Translated type name'` | [
"Get",
"list",
"of",
"measure",
"types",
"."
] | train | https://github.com/DevGroup-ru/yii2-measure/blob/1d41a4af6ad3f2e34cabc32fa1c97bfd3643269c/src/models/Measure.php#L60-L67 |
DevGroup-ru/yii2-measure | src/models/Measure.php | Measure.getFormatter | public function getFormatter()
{
if ($this->formatterInstance === null) {
$this->formatterInstance = Yii::createObject(
[
'class' => '\yii\i18n\Formatter',
'decimalSeparator' => $this->decimal_separator,
'thousandSeparat... | php | public function getFormatter()
{
if ($this->formatterInstance === null) {
$this->formatterInstance = Yii::createObject(
[
'class' => '\yii\i18n\Formatter',
'decimalSeparator' => $this->decimal_separator,
'thousandSeparat... | [
"public",
"function",
"getFormatter",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"formatterInstance",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"formatterInstance",
"=",
"Yii",
"::",
"createObject",
"(",
"[",
"'class'",
"=>",
"'\\yii\\i18n\\Formatter'",
... | Returns \yii\i18n\Formatter instance for current Currency instance
@return \yii\i18n\Formatter
@throws InvalidConfigException | [
"Returns",
"\\",
"yii",
"\\",
"i18n",
"\\",
"Formatter",
"instance",
"for",
"current",
"Currency",
"instance"
] | train | https://github.com/DevGroup-ru/yii2-measure/blob/1d41a4af6ad3f2e34cabc32fa1c97bfd3643269c/src/models/Measure.php#L119-L135 |
DevGroup-ru/yii2-measure | src/models/Measure.php | Measure.getMeasures | public static function getMeasures($type)
{
/** @var ActiveQuery $query */
$query = static::find()->select(['name', 'id'])->indexBy('id');
if (empty($type) === false) {
$query->where(['type' => $type]);
}
return $query->column();
} | php | public static function getMeasures($type)
{
/** @var ActiveQuery $query */
$query = static::find()->select(['name', 'id'])->indexBy('id');
if (empty($type) === false) {
$query->where(['type' => $type]);
}
return $query->column();
} | [
"public",
"static",
"function",
"getMeasures",
"(",
"$",
"type",
")",
"{",
"/** @var ActiveQuery $query */",
"$",
"query",
"=",
"static",
"::",
"find",
"(",
")",
"->",
"select",
"(",
"[",
"'name'",
",",
"'id'",
"]",
")",
"->",
"indexBy",
"(",
"'id'",
")"... | Get measures by type name.
@param string $type
@return array of measures in the next format `measure_id => 'Measure name'` | [
"Get",
"measures",
"by",
"type",
"name",
"."
] | train | https://github.com/DevGroup-ru/yii2-measure/blob/1d41a4af6ad3f2e34cabc32fa1c97bfd3643269c/src/models/Measure.php#L152-L160 |
skmetaly/laravel-twitch-restful-api | src/API/Authentication.php | Authentication.authenticationURL | public function authenticationURL()
{
$clientId = config('twitch-api.client_id');
$scopes = implode('+', config('twitch-api.scopes'));
$redirectURL = config('twitch-api.redirect_url');
return config('twitch-api.api_url') . '/kraken/oauth2/authorize?response_type=code&client_id=' . $... | php | public function authenticationURL()
{
$clientId = config('twitch-api.client_id');
$scopes = implode('+', config('twitch-api.scopes'));
$redirectURL = config('twitch-api.redirect_url');
return config('twitch-api.api_url') . '/kraken/oauth2/authorize?response_type=code&client_id=' . $... | [
"public",
"function",
"authenticationURL",
"(",
")",
"{",
"$",
"clientId",
"=",
"config",
"(",
"'twitch-api.client_id'",
")",
";",
"$",
"scopes",
"=",
"implode",
"(",
"'+'",
",",
"config",
"(",
"'twitch-api.scopes'",
")",
")",
";",
"$",
"redirectURL",
"=",
... | Returns the authentication URL where the user needs to be redirected to
@return string | [
"Returns",
"the",
"authentication",
"URL",
"where",
"the",
"user",
"needs",
"to",
"be",
"redirected",
"to"
] | train | https://github.com/skmetaly/laravel-twitch-restful-api/blob/70c83e441deb411ade2e343ad5cb0339c90dc6c2/src/API/Authentication.php#L22-L29 |
skmetaly/laravel-twitch-restful-api | src/API/Authentication.php | Authentication.requestToken | public function requestToken($code)
{
$parameters = [
'client_id' => config('twitch-api.client_id'),
'client_secret' => config('twitch-api.client_secret'),
'redirect_uri' => config('twitch-api.redirect_url'),
'code' => $code,
'grant_type' => 'autho... | php | public function requestToken($code)
{
$parameters = [
'client_id' => config('twitch-api.client_id'),
'client_secret' => config('twitch-api.client_secret'),
'redirect_uri' => config('twitch-api.redirect_url'),
'code' => $code,
'grant_type' => 'autho... | [
"public",
"function",
"requestToken",
"(",
"$",
"code",
")",
"{",
"$",
"parameters",
"=",
"[",
"'client_id'",
"=>",
"config",
"(",
"'twitch-api.client_id'",
")",
",",
"'client_secret'",
"=>",
"config",
"(",
"'twitch-api.client_secret'",
")",
",",
"'redirect_uri'",... | Requests a token for a given code
@param $code
@return mixed
@throws \Exception | [
"Requests",
"a",
"token",
"for",
"a",
"given",
"code"
] | train | https://github.com/skmetaly/laravel-twitch-restful-api/blob/70c83e441deb411ade2e343ad5cb0339c90dc6c2/src/API/Authentication.php#L39-L65 |
lukasz-adamski/teamspeak3-framework | src/TeamSpeak3/Viewer/Html.php | Html.getCorpusIcon | protected function getCorpusIcon()
{
if($this->currObj instanceof Channel && $this->currObj->isSpacer()) return;
return $this->getImage($this->currObj->getIcon() . ".png");
} | php | protected function getCorpusIcon()
{
if($this->currObj instanceof Channel && $this->currObj->isSpacer()) return;
return $this->getImage($this->currObj->getIcon() . ".png");
} | [
"protected",
"function",
"getCorpusIcon",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"currObj",
"instanceof",
"Channel",
"&&",
"$",
"this",
"->",
"currObj",
"->",
"isSpacer",
"(",
")",
")",
"return",
";",
"return",
"$",
"this",
"->",
"getImage",
"(",
... | Returns a HTML img tag which can be used to display the status icon for a
TeamSpeak_Node_Abstract object.
@return string | [
"Returns",
"a",
"HTML",
"img",
"tag",
"which",
"can",
"be",
"used",
"to",
"display",
"the",
"status",
"icon",
"for",
"a",
"TeamSpeak_Node_Abstract",
"object",
"."
] | train | https://github.com/lukasz-adamski/teamspeak3-framework/blob/39a56eca608da6b56b6aa386a7b5b31dc576c41a/src/TeamSpeak3/Viewer/Html.php#L329-L334 |
lukasz-adamski/teamspeak3-framework | src/TeamSpeak3/Viewer/Html.php | Html.getSuffixIcon | protected function getSuffixIcon()
{
if($this->currObj instanceof Server)
{
return $this->getSuffixIconServer();
}
elseif($this->currObj instanceof Channel)
{
return $this->getSuffixIconChannel();
}
elseif($this->currObj instanceof Client)
{
return $this->getSuffixIco... | php | protected function getSuffixIcon()
{
if($this->currObj instanceof Server)
{
return $this->getSuffixIconServer();
}
elseif($this->currObj instanceof Channel)
{
return $this->getSuffixIconChannel();
}
elseif($this->currObj instanceof Client)
{
return $this->getSuffixIco... | [
"protected",
"function",
"getSuffixIcon",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"currObj",
"instanceof",
"Server",
")",
"{",
"return",
"$",
"this",
"->",
"getSuffixIconServer",
"(",
")",
";",
"}",
"elseif",
"(",
"$",
"this",
"->",
"currObj",
"inst... | Returns the HTML img tags which can be used to display the various icons for a
TeamSpeak_Node_Abstract object.
@return string | [
"Returns",
"the",
"HTML",
"img",
"tags",
"which",
"can",
"be",
"used",
"to",
"display",
"the",
"various",
"icons",
"for",
"a",
"TeamSpeak_Node_Abstract",
"object",
"."
] | train | https://github.com/lukasz-adamski/teamspeak3-framework/blob/39a56eca608da6b56b6aa386a7b5b31dc576c41a/src/TeamSpeak3/Viewer/Html.php#L406-L420 |
wenbinye/PhalconX | src/Db/Schema/Index.php | Index.fromIndex | public static function fromIndex(Db\Index $index)
{
return new self([
'name' => $index->getName(),
'columns' => $index->getColumns(),
'type' => $index->getType()
]);
} | php | public static function fromIndex(Db\Index $index)
{
return new self([
'name' => $index->getName(),
'columns' => $index->getColumns(),
'type' => $index->getType()
]);
} | [
"public",
"static",
"function",
"fromIndex",
"(",
"Db",
"\\",
"Index",
"$",
"index",
")",
"{",
"return",
"new",
"self",
"(",
"[",
"'name'",
"=>",
"$",
"index",
"->",
"getName",
"(",
")",
",",
"'columns'",
"=>",
"$",
"index",
"->",
"getColumns",
"(",
... | convert from Phalcon\Db\Index object | [
"convert",
"from",
"Phalcon",
"\\",
"Db",
"\\",
"Index",
"object"
] | train | https://github.com/wenbinye/PhalconX/blob/0d2e1480e722dde56ccd23b2e8a5c8ac6ac2f8e1/src/Db/Schema/Index.php#L34-L41 |
wenbinye/PhalconX | src/Db/Schema/Index.php | Index.create | public static function create($name, $definition)
{
if (preg_match('/^(.*?)KEY\s*\((.*?)\)/', $definition, $matches)) {
return new self([
'name' => $name,
'columns' => preg_split('/\s*,\s*/', $matches[2]),
'type' => trim($matches[1])
])... | php | public static function create($name, $definition)
{
if (preg_match('/^(.*?)KEY\s*\((.*?)\)/', $definition, $matches)) {
return new self([
'name' => $name,
'columns' => preg_split('/\s*,\s*/', $matches[2]),
'type' => trim($matches[1])
])... | [
"public",
"static",
"function",
"create",
"(",
"$",
"name",
",",
"$",
"definition",
")",
"{",
"if",
"(",
"preg_match",
"(",
"'/^(.*?)KEY\\s*\\((.*?)\\)/'",
",",
"$",
"definition",
",",
"$",
"matches",
")",
")",
"{",
"return",
"new",
"self",
"(",
"[",
"'n... | create from definition
PRIMARY KEY(col1, ...)
UNIQUE KEY(col1, ...)
KEY(col1, ...) | [
"create",
"from",
"definition",
"PRIMARY",
"KEY",
"(",
"col1",
"...",
")",
"UNIQUE",
"KEY",
"(",
"col1",
"...",
")",
"KEY",
"(",
"col1",
"...",
")"
] | train | https://github.com/wenbinye/PhalconX/blob/0d2e1480e722dde56ccd23b2e8a5c8ac6ac2f8e1/src/Db/Schema/Index.php#L49-L60 |
wenbinye/PhalconX | src/Db/Schema/Index.php | Index.isSame | public function isSame(Index $other, $renamedColumns = null)
{
if ($renamedColumns) {
$columns = [];
foreach ($this->columns as $col) {
$columns[] = isset($renamedColumns[$col]) ? $renamedColumns[$col]->name : $col;
}
} else {
$columns ... | php | public function isSame(Index $other, $renamedColumns = null)
{
if ($renamedColumns) {
$columns = [];
foreach ($this->columns as $col) {
$columns[] = isset($renamedColumns[$col]) ? $renamedColumns[$col]->name : $col;
}
} else {
$columns ... | [
"public",
"function",
"isSame",
"(",
"Index",
"$",
"other",
",",
"$",
"renamedColumns",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"renamedColumns",
")",
"{",
"$",
"columns",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"columns",
"as",
"$",
... | compare with index
@param Index $other
@param array $renamedColumns
@return boolean | [
"compare",
"with",
"index"
] | train | https://github.com/wenbinye/PhalconX/blob/0d2e1480e722dde56ccd23b2e8a5c8ac6ac2f8e1/src/Db/Schema/Index.php#L100-L118 |
DesignPond/newsletter | src/Http/Controllers/Backend/ListController.php | ListController.show | public function show($id)
{
$lists = $this->list->getAll();
$list = $this->list->find($id);
return view('newsletter::Backend.lists.emails')->with(['lists' => $lists, 'list' => $list]);
} | php | public function show($id)
{
$lists = $this->list->getAll();
$list = $this->list->find($id);
return view('newsletter::Backend.lists.emails')->with(['lists' => $lists, 'list' => $list]);
} | [
"public",
"function",
"show",
"(",
"$",
"id",
")",
"{",
"$",
"lists",
"=",
"$",
"this",
"->",
"list",
"->",
"getAll",
"(",
")",
";",
"$",
"list",
"=",
"$",
"this",
"->",
"list",
"->",
"find",
"(",
"$",
"id",
")",
";",
"return",
"view",
"(",
"... | Display a listing of the resource.
@return \Illuminate\Http\Response | [
"Display",
"a",
"listing",
"of",
"the",
"resource",
"."
] | train | https://github.com/DesignPond/newsletter/blob/0bf0e7a8a42fa4b90a5e937771bb80058e0a91c3/src/Http/Controllers/Backend/ListController.php#L52-L58 |
DesignPond/newsletter | src/Http/Controllers/Backend/ListController.php | ListController.send | public function send(SendListRequest $request)
{
$list = $this->list->find($request->input('list_id'));
$this->import->send($request->input('campagne_id'),$list);
alert()->success('Campagne envoyé à la liste!');
return redirect('build/newsletter');
} | php | public function send(SendListRequest $request)
{
$list = $this->list->find($request->input('list_id'));
$this->import->send($request->input('campagne_id'),$list);
alert()->success('Campagne envoyé à la liste!');
return redirect('build/newsletter');
} | [
"public",
"function",
"send",
"(",
"SendListRequest",
"$",
"request",
")",
"{",
"$",
"list",
"=",
"$",
"this",
"->",
"list",
"->",
"find",
"(",
"$",
"request",
"->",
"input",
"(",
"'list_id'",
")",
")",
";",
"$",
"this",
"->",
"import",
"->",
"send",... | Send test campagne
@return \Illuminate\Http\Response | [
"Send",
"test",
"campagne"
] | train | https://github.com/DesignPond/newsletter/blob/0bf0e7a8a42fa4b90a5e937771bb80058e0a91c3/src/Http/Controllers/Backend/ListController.php#L65-L74 |
Avatar4eg/flarum-ext-geotags | src/Api/Serializer/GeotagBasicSerializer.php | GeotagBasicSerializer.getDefaultAttributes | protected function getDefaultAttributes($geotag)
{
if (! ($geotag instanceof Geotag)) {
throw new InvalidArgumentException(get_class($this)
. ' can only serialize instances of ' . Geotag::class);
}
return [
'title' => $geotag->title,
... | php | protected function getDefaultAttributes($geotag)
{
if (! ($geotag instanceof Geotag)) {
throw new InvalidArgumentException(get_class($this)
. ' can only serialize instances of ' . Geotag::class);
}
return [
'title' => $geotag->title,
... | [
"protected",
"function",
"getDefaultAttributes",
"(",
"$",
"geotag",
")",
"{",
"if",
"(",
"!",
"(",
"$",
"geotag",
"instanceof",
"Geotag",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"get_class",
"(",
"$",
"this",
")",
".",
"' can only se... | {@inheritdoc}
@param Geotag $geotag
@throws InvalidArgumentException | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/Avatar4eg/flarum-ext-geotags/blob/a54216a02a3e0abc908f9ba3aec69431f906fb92/src/Api/Serializer/GeotagBasicSerializer.php#L35-L48 |
surebert/surebert-framework | src/sb/Email/Writer.php | Writer.send | public function send($email = 0)
{
if ($email instanceof Email) {
$this->addEmailToOutbox($email);
}
$sent_emails = 0;
foreach ($this->emails as &$email) {
//all email goes to DEBUG_EMAIL if specified
if (defined("DEBUG_EMAIL")) {
... | php | public function send($email = 0)
{
if ($email instanceof Email) {
$this->addEmailToOutbox($email);
}
$sent_emails = 0;
foreach ($this->emails as &$email) {
//all email goes to DEBUG_EMAIL if specified
if (defined("DEBUG_EMAIL")) {
... | [
"public",
"function",
"send",
"(",
"$",
"email",
"=",
"0",
")",
"{",
"if",
"(",
"$",
"email",
"instanceof",
"Email",
")",
"{",
"$",
"this",
"->",
"addEmailToOutbox",
"(",
"$",
"email",
")",
";",
"}",
"$",
"sent_emails",
"=",
"0",
";",
"foreach",
"(... | Sends the emails in the $emails array that were attached using
addEmailToOutbox, logs progress if log file is specified | [
"Sends",
"the",
"emails",
"in",
"the",
"$emails",
"array",
"that",
"were",
"attached",
"using",
"addEmailToOutbox",
"logs",
"progress",
"if",
"log",
"file",
"is",
"specified"
] | train | https://github.com/surebert/surebert-framework/blob/f2f32eb693bd39385ceb93355efb5b2a429f27ce/src/sb/Email/Writer.php#L90-L159 |
surebert/surebert-framework | src/sb/Email/Writer.php | Writer.addEmailToOutbox | public function addEmailToOutbox(\sb\Email $email)
{
if ($this->checkHeadersForInjection($email)) {
return 0;
} else {
$this->emails[] = $email;
return true;
}
} | php | public function addEmailToOutbox(\sb\Email $email)
{
if ($this->checkHeadersForInjection($email)) {
return 0;
} else {
$this->emails[] = $email;
return true;
}
} | [
"public",
"function",
"addEmailToOutbox",
"(",
"\\",
"sb",
"\\",
"Email",
"$",
"email",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"checkHeadersForInjection",
"(",
"$",
"email",
")",
")",
"{",
"return",
"0",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"em... | Adds an email to the outbox which is sent with the send method
@param \sb\Email $email
@return boolean false if it has injectors, true if added to outbox | [
"Adds",
"an",
"email",
"to",
"the",
"outbox",
"which",
"is",
"sent",
"with",
"the",
"send",
"method"
] | train | https://github.com/surebert/surebert-framework/blob/f2f32eb693bd39385ceb93355efb5b2a429f27ce/src/sb/Email/Writer.php#L167-L178 |
surebert/surebert-framework | src/sb/Email/Writer.php | Writer.logEmail | private function logEmail($email, $sent)
{
$message = "\nEmail sent at " . date('m/d/y h:i:s');
$message .= "\nFrom:" . $email->from . '@' . $this->remote_addr;
$message .= "\nTo: " . $email->to;
foreach ($email->cc as $cc) {
$message .="\nCc:" . $cc;
}
f... | php | private function logEmail($email, $sent)
{
$message = "\nEmail sent at " . date('m/d/y h:i:s');
$message .= "\nFrom:" . $email->from . '@' . $this->remote_addr;
$message .= "\nTo: " . $email->to;
foreach ($email->cc as $cc) {
$message .="\nCc:" . $cc;
}
f... | [
"private",
"function",
"logEmail",
"(",
"$",
"email",
",",
"$",
"sent",
")",
"{",
"$",
"message",
"=",
"\"\\nEmail sent at \"",
".",
"date",
"(",
"'m/d/y h:i:s'",
")",
";",
"$",
"message",
".=",
"\"\\nFrom:\"",
".",
"$",
"email",
"->",
"from",
".",
"'@'"... | Logs the sending of emails if logging is enable by specifying the log_file property
@param $email \sb\Email
@param $sent Boolean, was the email sent or not | [
"Logs",
"the",
"sending",
"of",
"emails",
"if",
"logging",
"is",
"enable",
"by",
"specifying",
"the",
"log_file",
"property"
] | train | https://github.com/surebert/surebert-framework/blob/f2f32eb693bd39385ceb93355efb5b2a429f27ce/src/sb/Email/Writer.php#L186-L217 |
surebert/surebert-framework | src/sb/Email/Writer.php | Writer.checkHeadersForInjection | private function checkHeadersForInjection(\sb\Email $email)
{
if (\preg_match("~\r|:~i", $email->to) || preg_match("~\r|:~i", $email->from)) {
return true;
}
return false;
} | php | private function checkHeadersForInjection(\sb\Email $email)
{
if (\preg_match("~\r|:~i", $email->to) || preg_match("~\r|:~i", $email->from)) {
return true;
}
return false;
} | [
"private",
"function",
"checkHeadersForInjection",
"(",
"\\",
"sb",
"\\",
"Email",
"$",
"email",
")",
"{",
"if",
"(",
"\\",
"preg_match",
"(",
"\"~\\r|:~i\"",
",",
"$",
"email",
"->",
"to",
")",
"||",
"preg_match",
"(",
"\"~\\r|:~i\"",
",",
"$",
"email",
... | Checks email for injections in from and to addr
@param \sb\Email $email
@return boolean | [
"Checks",
"email",
"for",
"injections",
"in",
"from",
"and",
"to",
"addr"
] | train | https://github.com/surebert/surebert-framework/blob/f2f32eb693bd39385ceb93355efb5b2a429f27ce/src/sb/Email/Writer.php#L225-L233 |
ArrowSphere/Client | src/xAC/Cursor.php | Cursor.get | public function get()
{
$uri = null;
if ($this->context) {
$uri = $this->context->getBaseUri() . '/';
}
$uri .= $this->params['endpoint'];
$uri .= sprintf("?page=%d&perpage=%d"
, $this->page
, $this->perpage
);
... | php | public function get()
{
$uri = null;
if ($this->context) {
$uri = $this->context->getBaseUri() . '/';
}
$uri .= $this->params['endpoint'];
$uri .= sprintf("?page=%d&perpage=%d"
, $this->page
, $this->perpage
);
... | [
"public",
"function",
"get",
"(",
")",
"{",
"$",
"uri",
"=",
"null",
";",
"if",
"(",
"$",
"this",
"->",
"context",
")",
"{",
"$",
"uri",
"=",
"$",
"this",
"->",
"context",
"->",
"getBaseUri",
"(",
")",
".",
"'/'",
";",
"}",
"$",
"uri",
".=",
... | Get current data
@return array | [
"Get",
"current",
"data"
] | train | https://github.com/ArrowSphere/Client/blob/6608f8257060375e7d3a27c485b23268b73f6ef7/src/xAC/Cursor.php#L86-L123 |
ArrowSphere/Client | src/xAC/Cursor.php | Cursor.getNext | public function getNext()
{
if (count($this->pagination) == 0) {
$this->get();
}
if ($this->page < $this->pagination['total_pages']) {
$this->page++;
return $this->get();
}
return false;
} | php | public function getNext()
{
if (count($this->pagination) == 0) {
$this->get();
}
if ($this->page < $this->pagination['total_pages']) {
$this->page++;
return $this->get();
}
return false;
} | [
"public",
"function",
"getNext",
"(",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"this",
"->",
"pagination",
")",
"==",
"0",
")",
"{",
"$",
"this",
"->",
"get",
"(",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"page",
"<",
"$",
"this",
"->",
"p... | Increase page number and get next results batch
return array | [
"Increase",
"page",
"number",
"and",
"get",
"next",
"results",
"batch",
"return",
"array"
] | train | https://github.com/ArrowSphere/Client/blob/6608f8257060375e7d3a27c485b23268b73f6ef7/src/xAC/Cursor.php#L129-L141 |
ArrowSphere/Client | src/xAC/Cursor.php | Cursor.setPerPage | public function setPerPage($perpage)
{
if ($perpage > 0) {
$this->perpage = (int) $perpage;
$this->page = 1;
}
return $this;
} | php | public function setPerPage($perpage)
{
if ($perpage > 0) {
$this->perpage = (int) $perpage;
$this->page = 1;
}
return $this;
} | [
"public",
"function",
"setPerPage",
"(",
"$",
"perpage",
")",
"{",
"if",
"(",
"$",
"perpage",
">",
"0",
")",
"{",
"$",
"this",
"->",
"perpage",
"=",
"(",
"int",
")",
"$",
"perpage",
";",
"$",
"this",
"->",
"page",
"=",
"1",
";",
"}",
"return",
... | Set per page value, reset page value to 1
@param integer $perpage
@return \Arrowsphere\Client\xAC\Cursor | [
"Set",
"per",
"page",
"value",
"reset",
"page",
"value",
"to",
"1"
] | train | https://github.com/ArrowSphere/Client/blob/6608f8257060375e7d3a27c485b23268b73f6ef7/src/xAC/Cursor.php#L173-L181 |
ArrowSphere/Client | src/xAC/Cursor.php | Cursor.addFilter | public function addFilter($field, $value, $operator= '=')
{
$this->filter[] = [
'field' => $field,
'value' => $value,
'operator' => $operator,
];
return $this;
} | php | public function addFilter($field, $value, $operator= '=')
{
$this->filter[] = [
'field' => $field,
'value' => $value,
'operator' => $operator,
];
return $this;
} | [
"public",
"function",
"addFilter",
"(",
"$",
"field",
",",
"$",
"value",
",",
"$",
"operator",
"=",
"'='",
")",
"{",
"$",
"this",
"->",
"filter",
"[",
"]",
"=",
"[",
"'field'",
"=>",
"$",
"field",
",",
"'value'",
"=>",
"$",
"value",
",",
"'operator... | Add a filter that will be passed to the API query
@param string $field
@param string $value
@param string $operator
@return \Arrowsphere\Client\xAC\Cursor | [
"Add",
"a",
"filter",
"that",
"will",
"be",
"passed",
"to",
"the",
"API",
"query"
] | train | https://github.com/ArrowSphere/Client/blob/6608f8257060375e7d3a27c485b23268b73f6ef7/src/xAC/Cursor.php#L200-L209 |
ArrowSphere/Client | src/xAC/Cursor.php | Cursor.resetFilters | public function resetFilters($field = null)
{
if (is_null($field)) {
$this->filters = [];
} else {
if (isset($this->filters[$field])) {
unset($this->filters[$field]);
}
}
return $this;
} | php | public function resetFilters($field = null)
{
if (is_null($field)) {
$this->filters = [];
} else {
if (isset($this->filters[$field])) {
unset($this->filters[$field]);
}
}
return $this;
} | [
"public",
"function",
"resetFilters",
"(",
"$",
"field",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"field",
")",
")",
"{",
"$",
"this",
"->",
"filters",
"=",
"[",
"]",
";",
"}",
"else",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"-... | Remove filter matching given identifier or all filters if empty
@param string $field
@return \Arrowsphere\Client\xAC\Cursor | [
"Remove",
"filter",
"matching",
"given",
"identifier",
"or",
"all",
"filters",
"if",
"empty"
] | train | https://github.com/ArrowSphere/Client/blob/6608f8257060375e7d3a27c485b23268b73f6ef7/src/xAC/Cursor.php#L216-L227 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/Cache/src/storage/file/plain.php | ezcCacheStorageFilePlain.prepareData | protected function prepareData( $data )
{
if ( is_scalar( $data ) === false )
{
throw new ezcCacheInvalidDataException( gettype( $data ), array( 'simple' ) );
}
return ( string ) $data;
} | php | protected function prepareData( $data )
{
if ( is_scalar( $data ) === false )
{
throw new ezcCacheInvalidDataException( gettype( $data ), array( 'simple' ) );
}
return ( string ) $data;
} | [
"protected",
"function",
"prepareData",
"(",
"$",
"data",
")",
"{",
"if",
"(",
"is_scalar",
"(",
"$",
"data",
")",
"===",
"false",
")",
"{",
"throw",
"new",
"ezcCacheInvalidDataException",
"(",
"gettype",
"(",
"$",
"data",
")",
",",
"array",
"(",
"'simpl... | Serialize the data for storing.
Serializes a PHP variable (except type resource and object) to a
executable PHP code representation string.
@param mixed $data Simple type or array
@return string The serialized data
@throws ezcCacheInvalidDataException
If the data submitted is an array,object or a resource, since
this... | [
"Serialize",
"the",
"data",
"for",
"storing",
".",
"Serializes",
"a",
"PHP",
"variable",
"(",
"except",
"type",
"resource",
"and",
"object",
")",
"to",
"a",
"executable",
"PHP",
"code",
"representation",
"string",
"."
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Cache/src/storage/file/plain.php#L71-L78 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/Cache/src/storage/file/plain.php | ezcCacheStorageFilePlain.restoreMetaData | public function restoreMetaData()
{
// Silence require warnings. It's ok that meta data does not exist.
$dataStr = @$this->fetchData(
$this->properties['location'] . $this->properties['options']->metaDataFile
);
$dataArr = unserialize( $dataStr );
$result = null... | php | public function restoreMetaData()
{
// Silence require warnings. It's ok that meta data does not exist.
$dataStr = @$this->fetchData(
$this->properties['location'] . $this->properties['options']->metaDataFile
);
$dataArr = unserialize( $dataStr );
$result = null... | [
"public",
"function",
"restoreMetaData",
"(",
")",
"{",
"// Silence require warnings. It's ok that meta data does not exist.",
"$",
"dataStr",
"=",
"@",
"$",
"this",
"->",
"fetchData",
"(",
"$",
"this",
"->",
"properties",
"[",
"'location'",
"]",
".",
"$",
"this",
... | Restores and returns the meta data struct.
This method fetches the meta data stored in the storage and returns the
according struct of type {@link ezcCacheStackMetaData}. The meta data
must be stored inside the storage, but should not be visible as normal
cache items to the user.
@return ezcCacheStackMetaData | [
"Restores",
"and",
"returns",
"the",
"meta",
"data",
"struct",
"."
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Cache/src/storage/file/plain.php#L90-L106 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/Cache/src/storage/file/plain.php | ezcCacheStorageFilePlain.storeMetaData | public function storeMetaData( ezcCacheStackMetaData $metaData )
{
$dataArr = array(
'class' => get_class( $metaData ),
'data' => $metaData->getState(),
);
// This storage only handles scalar values, so we serialize here.
$dataStr = serialize( $dataArr );
... | php | public function storeMetaData( ezcCacheStackMetaData $metaData )
{
$dataArr = array(
'class' => get_class( $metaData ),
'data' => $metaData->getState(),
);
// This storage only handles scalar values, so we serialize here.
$dataStr = serialize( $dataArr );
... | [
"public",
"function",
"storeMetaData",
"(",
"ezcCacheStackMetaData",
"$",
"metaData",
")",
"{",
"$",
"dataArr",
"=",
"array",
"(",
"'class'",
"=>",
"get_class",
"(",
"$",
"metaData",
")",
",",
"'data'",
"=>",
"$",
"metaData",
"->",
"getState",
"(",
")",
",... | Stores the given meta data struct.
This method stores the given $metaData inside the storage. The data must
be stored with the same mechanism that the storage itself uses. However,
it should not be stored as a normal cache item, if possible, to avoid
accedental user manipulation.
@param ezcCacheStackMetaData $metaDat... | [
"Stores",
"the",
"given",
"meta",
"data",
"struct",
"."
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Cache/src/storage/file/plain.php#L119-L131 |
znck/countries | src/FileLoader.php | FileLoader.load | public function load(string $locale):array
{
$filename = "{$this->path}/{$locale}.php";
try {
$loaded = $this->files->getRequire($filename);
if (!is_array($loaded)) {
throw new InvalidResourceException();
}
return $loaded;
} ca... | php | public function load(string $locale):array
{
$filename = "{$this->path}/{$locale}.php";
try {
$loaded = $this->files->getRequire($filename);
if (!is_array($loaded)) {
throw new InvalidResourceException();
}
return $loaded;
} ca... | [
"public",
"function",
"load",
"(",
"string",
"$",
"locale",
")",
":",
"array",
"{",
"$",
"filename",
"=",
"\"{$this->path}/{$locale}.php\"",
";",
"try",
"{",
"$",
"loaded",
"=",
"$",
"this",
"->",
"files",
"->",
"getRequire",
"(",
"$",
"filename",
")",
"... | Loads a locale.
@param string $locale A locale
@throws NotFoundResourceException when the resource cannot be found
@throws InvalidResourceException when the resource cannot be loaded
@return array | [
"Loads",
"a",
"locale",
"."
] | train | https://github.com/znck/countries/blob/a78a2b302dfa8eacab8fe0c06127dbb37fa98fd3/src/FileLoader.php#L43-L58 |
impensavel/essence | src/AbstractEssence.php | AbstractEssence.register | public function register(array $element, $key = 'default')
{
if (! is_array($element['map'])) {
throw new EssenceException('['.$key.'] Element property map must be an array');
}
if (! isset($element['handler'])) {
throw new EssenceException('['.$key.'] Element data h... | php | public function register(array $element, $key = 'default')
{
if (! is_array($element['map'])) {
throw new EssenceException('['.$key.'] Element property map must be an array');
}
if (! isset($element['handler'])) {
throw new EssenceException('['.$key.'] Element data h... | [
"public",
"function",
"register",
"(",
"array",
"$",
"element",
",",
"$",
"key",
"=",
"'default'",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"element",
"[",
"'map'",
"]",
")",
")",
"{",
"throw",
"new",
"EssenceException",
"(",
"'['",
".",
"$",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/impensavel/essence/blob/e74969e55ac889e8c2cab9a915f82e93a72e629e/src/AbstractEssence.php#L36-L52 |
odiaseo/pagebuilder | src/PageBuilder/Controller/TemplateController.php | TemplateController.get | public function get($id)
{
return $this->_sendPayload(
$this->_getService($this->_pageServiceKey)->getTemplateLayout($id)
);
} | php | public function get($id)
{
return $this->_sendPayload(
$this->_getService($this->_pageServiceKey)->getTemplateLayout($id)
);
} | [
"public",
"function",
"get",
"(",
"$",
"id",
")",
"{",
"return",
"$",
"this",
"->",
"_sendPayload",
"(",
"$",
"this",
"->",
"_getService",
"(",
"$",
"this",
"->",
"_pageServiceKey",
")",
"->",
"getTemplateLayout",
"(",
"$",
"id",
")",
")",
";",
"}"
] | Get template details
@param mixed $id
@return mixed|\Zend\View\Model\ModelInterface | [
"Get",
"template",
"details"
] | train | https://github.com/odiaseo/pagebuilder/blob/88ef7cccf305368561307efe4ca07fac8e5774f3/src/PageBuilder/Controller/TemplateController.php#L18-L23 |
odiaseo/pagebuilder | src/PageBuilder/Controller/TemplateController.php | TemplateController.update | public function update($id, $data)
{
$layout = isset($data['layout']) ? $data['layout'] : null;
return $this->_sendPayload(
$this->_getService($this->_pageServiceKey)->updateTemplateLayout($id, $layout)
);
} | php | public function update($id, $data)
{
$layout = isset($data['layout']) ? $data['layout'] : null;
return $this->_sendPayload(
$this->_getService($this->_pageServiceKey)->updateTemplateLayout($id, $layout)
);
} | [
"public",
"function",
"update",
"(",
"$",
"id",
",",
"$",
"data",
")",
"{",
"$",
"layout",
"=",
"isset",
"(",
"$",
"data",
"[",
"'layout'",
"]",
")",
"?",
"$",
"data",
"[",
"'layout'",
"]",
":",
"null",
";",
"return",
"$",
"this",
"->",
"_sendPay... | Update template
@param mixed $id
@param mixed $data
@return mixed|\Zend\View\Model\ModelInterface | [
"Update",
"template"
] | train | https://github.com/odiaseo/pagebuilder/blob/88ef7cccf305368561307efe4ca07fac8e5774f3/src/PageBuilder/Controller/TemplateController.php#L33-L40 |
GrupaZero/api | src/Gzero/Api/Transformer/WidgetTransformer.php | WidgetTransformer.transform | public function transform($widget)
{
$widget = $this->entityToArray(Widget::class, $widget);
return [
'id' => (int) $widget['id'],
'name' => $widget['name'],
'args' => array_camel_case_keys($widget['args']),
'isActive' => (boo... | php | public function transform($widget)
{
$widget = $this->entityToArray(Widget::class, $widget);
return [
'id' => (int) $widget['id'],
'name' => $widget['name'],
'args' => array_camel_case_keys($widget['args']),
'isActive' => (boo... | [
"public",
"function",
"transform",
"(",
"$",
"widget",
")",
"{",
"$",
"widget",
"=",
"$",
"this",
"->",
"entityToArray",
"(",
"Widget",
"::",
"class",
",",
"$",
"widget",
")",
";",
"return",
"[",
"'id'",
"=>",
"(",
"int",
")",
"$",
"widget",
"[",
"... | Transforms widget entity
@param Widget|array $widget Widget entity
@return array | [
"Transforms",
"widget",
"entity"
] | train | https://github.com/GrupaZero/api/blob/fc544bb6057274e9d5e7b617346c3f854ea5effd/src/Gzero/Api/Transformer/WidgetTransformer.php#L26-L38 |
SergioMadness/query-builder | src/traits/Conditional.php | Conditional.setConditionBuilder | public function setConditionBuilder(\pwf\components\querybuilder\interfaces\ConditionBuilder $builder)
{
$this->conditionBuilder = $builder;
return $this;
} | php | public function setConditionBuilder(\pwf\components\querybuilder\interfaces\ConditionBuilder $builder)
{
$this->conditionBuilder = $builder;
return $this;
} | [
"public",
"function",
"setConditionBuilder",
"(",
"\\",
"pwf",
"\\",
"components",
"\\",
"querybuilder",
"\\",
"interfaces",
"\\",
"ConditionBuilder",
"$",
"builder",
")",
"{",
"$",
"this",
"->",
"conditionBuilder",
"=",
"$",
"builder",
";",
"return",
"$",
"th... | Set condition builder
@param \pwf\components\querybuilder\interfaces\ConditionBuilder $builder
@return $this | [
"Set",
"condition",
"builder"
] | train | https://github.com/SergioMadness/query-builder/blob/95b7a46bba4c4d369101c6f0d37f133fecb3956d/src/traits/Conditional.php#L27-L31 |
comodojo/daemon | src/Comodojo/Daemon/Console/LogHandler.php | LogHandler.write | protected function write(array $record) {
$level = $record['level'];
$message = $record['formatted'];
$context = empty($record['context']) ? null : $record['context'];
$time = $record['datetime']->format('c');
$this->toConsole($time, $level, $message, $context);
} | php | protected function write(array $record) {
$level = $record['level'];
$message = $record['formatted'];
$context = empty($record['context']) ? null : $record['context'];
$time = $record['datetime']->format('c');
$this->toConsole($time, $level, $message, $context);
} | [
"protected",
"function",
"write",
"(",
"array",
"$",
"record",
")",
"{",
"$",
"level",
"=",
"$",
"record",
"[",
"'level'",
"]",
";",
"$",
"message",
"=",
"$",
"record",
"[",
"'formatted'",
"]",
";",
"$",
"context",
"=",
"empty",
"(",
"$",
"record",
... | Record's writer | [
"Record",
"s",
"writer"
] | train | https://github.com/comodojo/daemon/blob/361b0a3a91dc7720dd3bec448bb4ca47d0ef0292/src/Comodojo/Daemon/Console/LogHandler.php#L91-L103 |
comodojo/daemon | src/Comodojo/Daemon/Console/LogHandler.php | LogHandler.toConsole | private function toConsole($time, $level, $message, $context) {
$color = static::$colors[$level];
$pattern = "<%s>%s</%s>";
$message = sprintf($pattern, $color, $message, $color);
$this->outputcontroller->out($message);
if ( !empty($context) && $this->include_context ) {
... | php | private function toConsole($time, $level, $message, $context) {
$color = static::$colors[$level];
$pattern = "<%s>%s</%s>";
$message = sprintf($pattern, $color, $message, $color);
$this->outputcontroller->out($message);
if ( !empty($context) && $this->include_context ) {
... | [
"private",
"function",
"toConsole",
"(",
"$",
"time",
",",
"$",
"level",
",",
"$",
"message",
",",
"$",
"context",
")",
"{",
"$",
"color",
"=",
"static",
"::",
"$",
"colors",
"[",
"$",
"level",
"]",
";",
"$",
"pattern",
"=",
"\"<%s>%s</%s>\"",
";",
... | Send record to console formatting it | [
"Send",
"record",
"to",
"console",
"formatting",
"it"
] | train | https://github.com/comodojo/daemon/blob/361b0a3a91dc7720dd3bec448bb4ca47d0ef0292/src/Comodojo/Daemon/Console/LogHandler.php#L108-L124 |
surebert/surebert-framework | src/sb/Controller/REST.php | REST.render | public function render()
{
if ($this->onBeforeRender() === false) {
return $this->notFound();
}
$method = \sb\Gateway::$request->method;
if (method_exists($this, $method)) {
$reflection = new \ReflectionMethod($this, $method);
//check for phpdocs... | php | public function render()
{
if ($this->onBeforeRender() === false) {
return $this->notFound();
}
$method = \sb\Gateway::$request->method;
if (method_exists($this, $method)) {
$reflection = new \ReflectionMethod($this, $method);
//check for phpdocs... | [
"public",
"function",
"render",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"onBeforeRender",
"(",
")",
"===",
"false",
")",
"{",
"return",
"$",
"this",
"->",
"notFound",
"(",
")",
";",
"}",
"$",
"method",
"=",
"\\",
"sb",
"\\",
"Gateway",
"::",
... | Used to render the output through the filterOutput method by calling the
handler appropriate to the HTTP request
@return string | [
"Used",
"to",
"render",
"the",
"output",
"through",
"the",
"filterOutput",
"method",
"by",
"calling",
"the",
"handler",
"appropriate",
"to",
"the",
"HTTP",
"request"
] | train | https://github.com/surebert/surebert-framework/blob/f2f32eb693bd39385ceb93355efb5b2a429f27ce/src/sb/Controller/REST.php#L66-L93 |
surebert/surebert-framework | src/sb/Gitlab/User.php | User.getByEmail | protected function getByEmail($email) {
$users = $this->_client->get('/users?search='.urlencode($email));
return isset($users[0]) ? $users[0] : false;
} | php | protected function getByEmail($email) {
$users = $this->_client->get('/users?search='.urlencode($email));
return isset($users[0]) ? $users[0] : false;
} | [
"protected",
"function",
"getByEmail",
"(",
"$",
"email",
")",
"{",
"$",
"users",
"=",
"$",
"this",
"->",
"_client",
"->",
"get",
"(",
"'/users?search='",
".",
"urlencode",
"(",
"$",
"email",
")",
")",
";",
"return",
"isset",
"(",
"$",
"users",
"[",
... | Loads a user by email
@param string $email
@return \stdClass | [
"Loads",
"a",
"user",
"by",
"email"
] | train | https://github.com/surebert/surebert-framework/blob/f2f32eb693bd39385ceb93355efb5b2a429f27ce/src/sb/Gitlab/User.php#L88-L91 |
DevGroup-ru/yii2-users-module | src/models/SocialMappings.php | SocialMappings.mapForSocialService | public static function mapForSocialService($id)
{
/** @var LazyCache $cache */
$cache = Yii::$app->cache;
$map = $cache->lazy(
function () use ($id) {
return static::find()
->where(['social_service_id' => $id])
->indexBy('mo... | php | public static function mapForSocialService($id)
{
/** @var LazyCache $cache */
$cache = Yii::$app->cache;
$map = $cache->lazy(
function () use ($id) {
return static::find()
->where(['social_service_id' => $id])
->indexBy('mo... | [
"public",
"static",
"function",
"mapForSocialService",
"(",
"$",
"id",
")",
"{",
"/** @var LazyCache $cache */",
"$",
"cache",
"=",
"Yii",
"::",
"$",
"app",
"->",
"cache",
";",
"$",
"map",
"=",
"$",
"cache",
"->",
"lazy",
"(",
"function",
"(",
")",
"use"... | @param integer $id
@return array | [
"@param",
"integer",
"$id"
] | train | https://github.com/DevGroup-ru/yii2-users-module/blob/ff0103dc55c3462627ccc704c33e70c96053f750/src/models/SocialMappings.php#L71-L96 |
f3ath/lazypdo | src/PDODecorator.php | PDODecorator.quote | public function quote($string, $type = PDO::PARAM_STR)
{
return $this->getPDO()->quote($string, $type);
} | php | public function quote($string, $type = PDO::PARAM_STR)
{
return $this->getPDO()->quote($string, $type);
} | [
"public",
"function",
"quote",
"(",
"$",
"string",
",",
"$",
"type",
"=",
"PDO",
"::",
"PARAM_STR",
")",
"{",
"return",
"$",
"this",
"->",
"getPDO",
"(",
")",
"->",
"quote",
"(",
"$",
"string",
",",
"$",
"type",
")",
";",
"}"
] | Quotes a string for use in a query.
@param string $string
@param int $type
@return string | [
"Quotes",
"a",
"string",
"for",
"use",
"in",
"a",
"query",
"."
] | train | https://github.com/f3ath/lazypdo/blob/0ebdb3bc87d327d68a322d5fca049f4c21865928/src/PDODecorator.php#L144-L147 |
f3ath/lazypdo | src/PDODecorator.php | PDODecorator.query | public function query($statement)
{
if (1 == func_num_args()) {
return $this->getPDO()->query($statement);
}
// this way is much slower but supports overloading
// http://php.net/manual/en/pdo.query.php
return call_user_func_array(array($this->getPDO(), __FUNCTION... | php | public function query($statement)
{
if (1 == func_num_args()) {
return $this->getPDO()->query($statement);
}
// this way is much slower but supports overloading
// http://php.net/manual/en/pdo.query.php
return call_user_func_array(array($this->getPDO(), __FUNCTION... | [
"public",
"function",
"query",
"(",
"$",
"statement",
")",
"{",
"if",
"(",
"1",
"==",
"func_num_args",
"(",
")",
")",
"{",
"return",
"$",
"this",
"->",
"getPDO",
"(",
")",
"->",
"query",
"(",
"$",
"statement",
")",
";",
"}",
"// this way is much slower... | Executes an SQL statement, returning a result set as a PDOStatement object,
overloading is supported
@param string $statement
@return PDOStatement | [
"Executes",
"an",
"SQL",
"statement",
"returning",
"a",
"result",
"set",
"as",
"a",
"PDOStatement",
"object",
"overloading",
"is",
"supported"
] | train | https://github.com/f3ath/lazypdo/blob/0ebdb3bc87d327d68a322d5fca049f4c21865928/src/PDODecorator.php#L167-L175 |
ezsystems/ezdfs-fsbackend-dispatcher | classes/ezdfsfilehandlerdfsdispatcher.php | eZDFSFileHandlerDFSDispatcher.copyFromDFSToDFS | public function copyFromDFSToDFS( $srcFilePath, $dstFilePath )
{
$srcHandler = $this->getHandler( $srcFilePath );
$dstHandler = $this->getHandler( $dstFilePath );
if ( $srcHandler === $dstHandler )
{
return $srcHandler->copyFromDFSToDFS( $srcFilePath, $dstFilePath );
... | php | public function copyFromDFSToDFS( $srcFilePath, $dstFilePath )
{
$srcHandler = $this->getHandler( $srcFilePath );
$dstHandler = $this->getHandler( $dstFilePath );
if ( $srcHandler === $dstHandler )
{
return $srcHandler->copyFromDFSToDFS( $srcFilePath, $dstFilePath );
... | [
"public",
"function",
"copyFromDFSToDFS",
"(",
"$",
"srcFilePath",
",",
"$",
"dstFilePath",
")",
"{",
"$",
"srcHandler",
"=",
"$",
"this",
"->",
"getHandler",
"(",
"$",
"srcFilePath",
")",
";",
"$",
"dstHandler",
"=",
"$",
"this",
"->",
"getHandler",
"(",
... | Creates a copy of $srcFilePath from DFS to $dstFilePath on DFS
@param string $srcFilePath Local source file path
@param string $dstFilePath Local destination file path
@return bool | [
"Creates",
"a",
"copy",
"of",
"$srcFilePath",
"from",
"DFS",
"to",
"$dstFilePath",
"on",
"DFS"
] | train | https://github.com/ezsystems/ezdfs-fsbackend-dispatcher/blob/e12c51e58ad452b2376bb6e0ec6deb8be5d8e036/classes/ezdfsfilehandlerdfsdispatcher.php#L63-L76 |
ezsystems/ezdfs-fsbackend-dispatcher | classes/ezdfsfilehandlerdfsdispatcher.php | eZDFSFileHandlerDFSDispatcher.copyFromDFS | public function copyFromDFS( $srcFilePath, $dstFilePath = false )
{
return $this->getHandler( $srcFilePath )->copyFromDFS( $srcFilePath, $dstFilePath );
} | php | public function copyFromDFS( $srcFilePath, $dstFilePath = false )
{
return $this->getHandler( $srcFilePath )->copyFromDFS( $srcFilePath, $dstFilePath );
} | [
"public",
"function",
"copyFromDFS",
"(",
"$",
"srcFilePath",
",",
"$",
"dstFilePath",
"=",
"false",
")",
"{",
"return",
"$",
"this",
"->",
"getHandler",
"(",
"$",
"srcFilePath",
")",
"->",
"copyFromDFS",
"(",
"$",
"srcFilePath",
",",
"$",
"dstFilePath",
"... | Copies the DFS file $srcFilePath to FS
@param string $srcFilePath Source file path (on DFS)
@param string|bool $dstFilePath Destination file path (on FS). If not specified, $srcFilePath is used
@return bool | [
"Copies",
"the",
"DFS",
"file",
"$srcFilePath",
"to",
"FS"
] | train | https://github.com/ezsystems/ezdfs-fsbackend-dispatcher/blob/e12c51e58ad452b2376bb6e0ec6deb8be5d8e036/classes/ezdfsfilehandlerdfsdispatcher.php#L86-L89 |
ezsystems/ezdfs-fsbackend-dispatcher | classes/ezdfsfilehandlerdfsdispatcher.php | eZDFSFileHandlerDFSDispatcher.copyToDFS | public function copyToDFS( $srcFilePath, $dstFilePath = false )
{
return $this->getHandler( $dstFilePath ?: $srcFilePath )->copyToDFS( $srcFilePath, $dstFilePath );
} | php | public function copyToDFS( $srcFilePath, $dstFilePath = false )
{
return $this->getHandler( $dstFilePath ?: $srcFilePath )->copyToDFS( $srcFilePath, $dstFilePath );
} | [
"public",
"function",
"copyToDFS",
"(",
"$",
"srcFilePath",
",",
"$",
"dstFilePath",
"=",
"false",
")",
"{",
"return",
"$",
"this",
"->",
"getHandler",
"(",
"$",
"dstFilePath",
"?",
":",
"$",
"srcFilePath",
")",
"->",
"copyToDFS",
"(",
"$",
"srcFilePath",
... | Copies the local file $filePath to DFS under the same name, or a new name
if specified
@param string $srcFilePath Local file path to copy from
@param bool|string $dstFilePath
Optional path to copy to. If not specified, $srcFilePath is used
@return bool | [
"Copies",
"the",
"local",
"file",
"$filePath",
"to",
"DFS",
"under",
"the",
"same",
"name",
"or",
"a",
"new",
"name",
"if",
"specified"
] | train | https://github.com/ezsystems/ezdfs-fsbackend-dispatcher/blob/e12c51e58ad452b2376bb6e0ec6deb8be5d8e036/classes/ezdfsfilehandlerdfsdispatcher.php#L101-L104 |
ezsystems/ezdfs-fsbackend-dispatcher | classes/ezdfsfilehandlerdfsdispatcher.php | eZDFSFileHandlerDFSDispatcher.delete | public function delete( $filePath )
{
$map = $this->mapFilePathArray( (array)$filePath );
$returnValue = true;
/** @var eZDFSFileHandlerDFSBackendInterface $handler */
foreach ( $map['handlers'] as $handlerClass => $handler )
{
$returnValue &= $handler->delete( $... | php | public function delete( $filePath )
{
$map = $this->mapFilePathArray( (array)$filePath );
$returnValue = true;
/** @var eZDFSFileHandlerDFSBackendInterface $handler */
foreach ( $map['handlers'] as $handlerClass => $handler )
{
$returnValue &= $handler->delete( $... | [
"public",
"function",
"delete",
"(",
"$",
"filePath",
")",
"{",
"$",
"map",
"=",
"$",
"this",
"->",
"mapFilePathArray",
"(",
"(",
"array",
")",
"$",
"filePath",
")",
";",
"$",
"returnValue",
"=",
"true",
";",
"/** @var eZDFSFileHandlerDFSBackendInterface $hand... | Deletes one or more files from DFS
@param string|array $filePath Single local filename, or array of local filenames
@return bool true if deletion was successful, false otherwise | [
"Deletes",
"one",
"or",
"more",
"files",
"from",
"DFS"
] | train | https://github.com/ezsystems/ezdfs-fsbackend-dispatcher/blob/e12c51e58ad452b2376bb6e0ec6deb8be5d8e036/classes/ezdfsfilehandlerdfsdispatcher.php#L113-L125 |
ezsystems/ezdfs-fsbackend-dispatcher | classes/ezdfsfilehandlerdfsdispatcher.php | eZDFSFileHandlerDFSDispatcher.passthrough | public function passthrough( $filePath, $startOffset = 0, $length = false )
{
return $this->getHandler( $filePath )->passthrough( $filePath, $startOffset, $length );
} | php | public function passthrough( $filePath, $startOffset = 0, $length = false )
{
return $this->getHandler( $filePath )->passthrough( $filePath, $startOffset, $length );
} | [
"public",
"function",
"passthrough",
"(",
"$",
"filePath",
",",
"$",
"startOffset",
"=",
"0",
",",
"$",
"length",
"=",
"false",
")",
"{",
"return",
"$",
"this",
"->",
"getHandler",
"(",
"$",
"filePath",
")",
"->",
"passthrough",
"(",
"$",
"filePath",
"... | Sends the contents of $filePath to default output
@param string $filePath File path
@param int $startOffset Starting offset
@param bool|int $length Length to transmit, false means everything
@return bool true, or false if operation failed | [
"Sends",
"the",
"contents",
"of",
"$filePath",
"to",
"default",
"output"
] | train | https://github.com/ezsystems/ezdfs-fsbackend-dispatcher/blob/e12c51e58ad452b2376bb6e0ec6deb8be5d8e036/classes/ezdfsfilehandlerdfsdispatcher.php#L136-L139 |
ezsystems/ezdfs-fsbackend-dispatcher | classes/ezdfsfilehandlerdfsdispatcher.php | eZDFSFileHandlerDFSDispatcher.renameOnDFS | public function renameOnDFS( $oldPath, $newPath )
{
$oldPathHandler = $this->getHandler( $oldPath );
$newPathHandler = $this->getHandler( $newPath );
// same handler, normal rename
if ( $oldPathHandler === $newPathHandler )
{
return $oldPathHandler->renameOnDFS( ... | php | public function renameOnDFS( $oldPath, $newPath )
{
$oldPathHandler = $this->getHandler( $oldPath );
$newPathHandler = $this->getHandler( $newPath );
// same handler, normal rename
if ( $oldPathHandler === $newPathHandler )
{
return $oldPathHandler->renameOnDFS( ... | [
"public",
"function",
"renameOnDFS",
"(",
"$",
"oldPath",
",",
"$",
"newPath",
")",
"{",
"$",
"oldPathHandler",
"=",
"$",
"this",
"->",
"getHandler",
"(",
"$",
"oldPath",
")",
";",
"$",
"newPathHandler",
"=",
"$",
"this",
"->",
"getHandler",
"(",
"$",
... | Renamed DFS file $oldPath to DFS file $newPath
@param string $oldPath
@param string $newPath
@return bool | [
"Renamed",
"DFS",
"file",
"$oldPath",
"to",
"DFS",
"file",
"$newPath"
] | train | https://github.com/ezsystems/ezdfs-fsbackend-dispatcher/blob/e12c51e58ad452b2376bb6e0ec6deb8be5d8e036/classes/ezdfsfilehandlerdfsdispatcher.php#L174-L192 |
ezsystems/ezdfs-fsbackend-dispatcher | classes/ezdfsfilehandlerdfsdispatcher.php | eZDFSFileHandlerDFSDispatcher.getFilesList | public function getFilesList( $basePath )
{
$iterator = new AppendIterator();
foreach ( $this->getAllHandlers() as $handler )
{
$iterator->append( $handler->getFilesList( $basePath ) );
}
return $iterator;
} | php | public function getFilesList( $basePath )
{
$iterator = new AppendIterator();
foreach ( $this->getAllHandlers() as $handler )
{
$iterator->append( $handler->getFilesList( $basePath ) );
}
return $iterator;
} | [
"public",
"function",
"getFilesList",
"(",
"$",
"basePath",
")",
"{",
"$",
"iterator",
"=",
"new",
"AppendIterator",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"getAllHandlers",
"(",
")",
"as",
"$",
"handler",
")",
"{",
"$",
"iterator",
"->",
"a... | Returns an AppendIterator with every handler's iterator
@param string $basePath
@return Iterator | [
"Returns",
"an",
"AppendIterator",
"with",
"every",
"handler",
"s",
"iterator"
] | train | https://github.com/ezsystems/ezdfs-fsbackend-dispatcher/blob/e12c51e58ad452b2376bb6e0ec6deb8be5d8e036/classes/ezdfsfilehandlerdfsdispatcher.php#L225-L233 |
ezsystems/ezdfs-fsbackend-dispatcher | classes/ezdfsfilehandlerdfsdispatcher.php | eZDFSFileHandlerDFSDispatcher.mapFilePathArray | private function mapFilePathArray( array $filePath )
{
$map = array( 'handlers' => array(), 'files' => array() );
foreach ( $filePath as $path )
{
$handler = $this->getHandler( $path );
$handlerClass = get_class( $handler );
if ( !isset( $map['handlers'][$... | php | private function mapFilePathArray( array $filePath )
{
$map = array( 'handlers' => array(), 'files' => array() );
foreach ( $filePath as $path )
{
$handler = $this->getHandler( $path );
$handlerClass = get_class( $handler );
if ( !isset( $map['handlers'][$... | [
"private",
"function",
"mapFilePathArray",
"(",
"array",
"$",
"filePath",
")",
"{",
"$",
"map",
"=",
"array",
"(",
"'handlers'",
"=>",
"array",
"(",
")",
",",
"'files'",
"=>",
"array",
"(",
")",
")",
";",
"foreach",
"(",
"$",
"filePath",
"as",
"$",
"... | Groups file paths from $filePath by handlers.
@param array $filePath
@param eZDFSFileHandlerDFSBackendInterface[] $handler
@param array $handlerClass
@return array an array with two sub-arrays
$return['handlers'] is a hash of eZDFSFileHandlerDFSBackendInterface, indexed by handler class name
$return['files'] is a ha... | [
"Groups",
"file",
"paths",
"from",
"$filePath",
"by",
"handlers",
"."
] | train | https://github.com/ezsystems/ezdfs-fsbackend-dispatcher/blob/e12c51e58ad452b2376bb6e0ec6deb8be5d8e036/classes/ezdfsfilehandlerdfsdispatcher.php#L251-L268 |
alevilar/ristorantino-vendor | Compras/Model/PedidoMercaderia.php | PedidoMercaderia.getProveedoresInvolucrados | public function getProveedoresInvolucrados( $pedidoMercaderias ) {
$provs = [];
foreach ($pedidoMercaderias as $pm) {
if ( !empty($pm['Mercaderia']['Proveedor']['id']) ) {
$provs[] = $pm['Mercaderia']['Proveedor']['id'];
}
if ( !empty($pm['Mercaderia']['Rubro']['Proveedor']) ) {
foreach ($pm['Merc... | php | public function getProveedoresInvolucrados( $pedidoMercaderias ) {
$provs = [];
foreach ($pedidoMercaderias as $pm) {
if ( !empty($pm['Mercaderia']['Proveedor']['id']) ) {
$provs[] = $pm['Mercaderia']['Proveedor']['id'];
}
if ( !empty($pm['Mercaderia']['Rubro']['Proveedor']) ) {
foreach ($pm['Merc... | [
"public",
"function",
"getProveedoresInvolucrados",
"(",
"$",
"pedidoMercaderias",
")",
"{",
"$",
"provs",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"pedidoMercaderias",
"as",
"$",
"pm",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"pm",
"[",
"'Mercaderia... | filtrar los proveedores involucrados retornando un listado de ID's
@param array $pedidoMercaderias array del find de PedidoMercaderia
@return array con un list de id's de proveedores | [
"filtrar",
"los",
"proveedores",
"involucrados",
"retornando",
"un",
"listado",
"de",
"ID",
"s"
] | train | https://github.com/alevilar/ristorantino-vendor/blob/6b91a1e20cc0ba09a1968d77e3de6512cfa2d966/Compras/Model/PedidoMercaderia.php#L153-L167 |
InfiniteSoftware/ISEcommpayPayum | Action/StatusAction.php | StatusAction.execute | public function execute($request)
{
ArrayObject::ensureArrayObject($request->getModel());
$this->gateway->execute($status = new GetHttpRequest());
if (isset($status->request['operation']) === false) {
$request->markNew();
return;
}
if (isset($status... | php | public function execute($request)
{
ArrayObject::ensureArrayObject($request->getModel());
$this->gateway->execute($status = new GetHttpRequest());
if (isset($status->request['operation']) === false) {
$request->markNew();
return;
}
if (isset($status... | [
"public",
"function",
"execute",
"(",
"$",
"request",
")",
"{",
"ArrayObject",
"::",
"ensureArrayObject",
"(",
"$",
"request",
"->",
"getModel",
"(",
")",
")",
";",
"$",
"this",
"->",
"gateway",
"->",
"execute",
"(",
"$",
"status",
"=",
"new",
"GetHttpRe... | {@inheritDoc}
@param GetStatusInterface $request | [
"{",
"@inheritDoc",
"}"
] | train | https://github.com/InfiniteSoftware/ISEcommpayPayum/blob/44a073e3d885d9007aa54d6ff13aea93a9e52e7c/Action/StatusAction.php#L20-L43 |
K-Phoen/DoctrineStateMachineBehavior | src/StateMachine/StateMachineExtension.php | StateMachineExtension.canJumpToState | public function canJumpToState($state)
{
if ($state instanceof StateInterface) {
$state = $state->getName();
}
// assert that the given state exists
$this->getState($state);
return in_array($this->currentState->getName(), $this->statePrecedence[$state], true);
... | php | public function canJumpToState($state)
{
if ($state instanceof StateInterface) {
$state = $state->getName();
}
// assert that the given state exists
$this->getState($state);
return in_array($this->currentState->getName(), $this->statePrecedence[$state], true);
... | [
"public",
"function",
"canJumpToState",
"(",
"$",
"state",
")",
"{",
"if",
"(",
"$",
"state",
"instanceof",
"StateInterface",
")",
"{",
"$",
"state",
"=",
"$",
"state",
"->",
"getName",
"(",
")",
";",
"}",
"// assert that the given state exists",
"$",
"this"... | Tells if moving to the given state is allowed.
@param string|StateInterface $state
@return bool | [
"Tells",
"if",
"moving",
"to",
"the",
"given",
"state",
"is",
"allowed",
"."
] | train | https://github.com/K-Phoen/DoctrineStateMachineBehavior/blob/699880fed03dd777ddae6cd8cec4b3d61853d4d7/src/StateMachine/StateMachineExtension.php#L64-L74 |
K-Phoen/DoctrineStateMachineBehavior | src/StateMachine/StateMachineExtension.php | StateMachineExtension.jumpToState | public function jumpToState($state)
{
if (!$state instanceof StateInterface) {
$state = $this->getState($state);
}
if (!$this->canJumpToState($state)) {
throw new StateException(sprintf('Can not jump from state "%s" to "%s".',$this->currentState->getName(), $state->g... | php | public function jumpToState($state)
{
if (!$state instanceof StateInterface) {
$state = $this->getState($state);
}
if (!$this->canJumpToState($state)) {
throw new StateException(sprintf('Can not jump from state "%s" to "%s".',$this->currentState->getName(), $state->g... | [
"public",
"function",
"jumpToState",
"(",
"$",
"state",
")",
"{",
"if",
"(",
"!",
"$",
"state",
"instanceof",
"StateInterface",
")",
"{",
"$",
"state",
"=",
"$",
"this",
"->",
"getState",
"(",
"$",
"state",
")",
";",
"}",
"if",
"(",
"!",
"$",
"this... | Moves to the given state if allowed.
@param string|StateInterface $state
@return bool | [
"Moves",
"to",
"the",
"given",
"state",
"if",
"allowed",
"."
] | train | https://github.com/K-Phoen/DoctrineStateMachineBehavior/blob/699880fed03dd777ddae6cd8cec4b3d61853d4d7/src/StateMachine/StateMachineExtension.php#L83-L95 |
zhouyl/mellivora | Mellivora/Console/Parser.php | Parser.parseOption | protected static function parseOption($token)
{
list($token, $description) = static::extractDescription($token);
$matches = preg_split('/\s*\|\s*/', $token, 2);
if (isset($matches[1])) {
$shortcut = $matches[0];
$token = $matches[1];
} else {
... | php | protected static function parseOption($token)
{
list($token, $description) = static::extractDescription($token);
$matches = preg_split('/\s*\|\s*/', $token, 2);
if (isset($matches[1])) {
$shortcut = $matches[0];
$token = $matches[1];
} else {
... | [
"protected",
"static",
"function",
"parseOption",
"(",
"$",
"token",
")",
"{",
"list",
"(",
"$",
"token",
",",
"$",
"description",
")",
"=",
"static",
"::",
"extractDescription",
"(",
"$",
"token",
")",
";",
"$",
"matches",
"=",
"preg_split",
"(",
"'/\\s... | Parse an option expression.
@param string $token
@return \Symfony\Component\Console\Input\InputOption | [
"Parse",
"an",
"option",
"expression",
"."
] | train | https://github.com/zhouyl/mellivora/blob/79f844c5c9c25ffbe18d142062e9bc3df00b36a1/Mellivora/Console/Parser.php#L110-L133 |
zhouyl/mellivora | Mellivora/Console/Parser.php | Parser.extractDescription | protected static function extractDescription($token)
{
$parts = preg_split('/\s+:\s+/', trim($token), 2);
return count($parts) === 2 ? $parts : [$token, null];
} | php | protected static function extractDescription($token)
{
$parts = preg_split('/\s+:\s+/', trim($token), 2);
return count($parts) === 2 ? $parts : [$token, null];
} | [
"protected",
"static",
"function",
"extractDescription",
"(",
"$",
"token",
")",
"{",
"$",
"parts",
"=",
"preg_split",
"(",
"'/\\s+:\\s+/'",
",",
"trim",
"(",
"$",
"token",
")",
",",
"2",
")",
";",
"return",
"count",
"(",
"$",
"parts",
")",
"===",
"2",... | Parse the token into its token and description segments.
@param string $token
@return array | [
"Parse",
"the",
"token",
"into",
"its",
"token",
"and",
"description",
"segments",
"."
] | train | https://github.com/zhouyl/mellivora/blob/79f844c5c9c25ffbe18d142062e9bc3df00b36a1/Mellivora/Console/Parser.php#L142-L147 |
ajgarlag/AjglCsv | src/Writer/NativePhpWriter.php | NativePhpWriter.doWrite | protected function doWrite($fileHandler, array $row, $delimiter)
{
$res = @fputcsv($fileHandler, $row, $delimiter);
if (false === $res) {
throw new \RuntimeException('Cannot write to the given resource');
}
} | php | protected function doWrite($fileHandler, array $row, $delimiter)
{
$res = @fputcsv($fileHandler, $row, $delimiter);
if (false === $res) {
throw new \RuntimeException('Cannot write to the given resource');
}
} | [
"protected",
"function",
"doWrite",
"(",
"$",
"fileHandler",
",",
"array",
"$",
"row",
",",
"$",
"delimiter",
")",
"{",
"$",
"res",
"=",
"@",
"fputcsv",
"(",
"$",
"fileHandler",
",",
"$",
"row",
",",
"$",
"delimiter",
")",
";",
"if",
"(",
"false",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/ajgarlag/AjglCsv/blob/28872f58b9ef864893cac6faddfcb1229c2c2047/src/Writer/NativePhpWriter.php#L22-L28 |
AOEpeople/Aoe_Layout | app/code/local/Aoe/Layout/Helper/AbstractModel.php | Aoe_Layout_Helper_AbstractModel.getViewUrl | public function getViewUrl($model = null)
{
if (!$model instanceof Mage_Core_Model_Abstract) {
$model = $this->getCurrentRecord();
} else {
$expectedClass = get_class($this->getModel());
if (!is_a($model, $expectedClass)) {
throw new RuntimeExcepti... | php | public function getViewUrl($model = null)
{
if (!$model instanceof Mage_Core_Model_Abstract) {
$model = $this->getCurrentRecord();
} else {
$expectedClass = get_class($this->getModel());
if (!is_a($model, $expectedClass)) {
throw new RuntimeExcepti... | [
"public",
"function",
"getViewUrl",
"(",
"$",
"model",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"model",
"instanceof",
"Mage_Core_Model_Abstract",
")",
"{",
"$",
"model",
"=",
"$",
"this",
"->",
"getCurrentRecord",
"(",
")",
";",
"}",
"else",
"{",
"... | @param Mage_Core_Model_Abstract $model
@return string
@throws RuntimeException | [
"@param",
"Mage_Core_Model_Abstract",
"$model"
] | train | https://github.com/AOEpeople/Aoe_Layout/blob/d88ba3406cf12dbaf09548477133c3cb27d155ed/app/code/local/Aoe/Layout/Helper/AbstractModel.php#L79-L91 |
AOEpeople/Aoe_Layout | app/code/local/Aoe/Layout/Helper/AbstractModel.php | Aoe_Layout_Helper_AbstractModel.setCurrentRecord | public function setCurrentRecord(Mage_Core_Model_Abstract $model = null)
{
if ($model) {
$expectedClass = get_class($this->getModel());
if (!is_a($model, $expectedClass)) {
throw new RuntimeException($this->__('Invalid model class. Expected:%1$s Passed:%2$s', $expecte... | php | public function setCurrentRecord(Mage_Core_Model_Abstract $model = null)
{
if ($model) {
$expectedClass = get_class($this->getModel());
if (!is_a($model, $expectedClass)) {
throw new RuntimeException($this->__('Invalid model class. Expected:%1$s Passed:%2$s', $expecte... | [
"public",
"function",
"setCurrentRecord",
"(",
"Mage_Core_Model_Abstract",
"$",
"model",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"model",
")",
"{",
"$",
"expectedClass",
"=",
"get_class",
"(",
"$",
"this",
"->",
"getModel",
"(",
")",
")",
";",
"if",
"(",
... | @param Mage_Core_Model_Abstract $model
@return $this
@throws RuntimeException | [
"@param",
"Mage_Core_Model_Abstract",
"$model"
] | train | https://github.com/AOEpeople/Aoe_Layout/blob/d88ba3406cf12dbaf09548477133c3cb27d155ed/app/code/local/Aoe/Layout/Helper/AbstractModel.php#L119-L135 |
oroinc/OroLayoutComponent | RawLayout.php | RawLayout.getParentId | public function getParentId($id)
{
$path = $this->getProperty($id, self::PATH);
array_pop($path);
return empty($path)
? null // the given item is the root
: array_pop($path);
} | php | public function getParentId($id)
{
$path = $this->getProperty($id, self::PATH);
array_pop($path);
return empty($path)
? null // the given item is the root
: array_pop($path);
} | [
"public",
"function",
"getParentId",
"(",
"$",
"id",
")",
"{",
"$",
"path",
"=",
"$",
"this",
"->",
"getProperty",
"(",
"$",
"id",
",",
"self",
"::",
"PATH",
")",
";",
"array_pop",
"(",
"$",
"path",
")",
";",
"return",
"empty",
"(",
"$",
"path",
... | Returns the id of the parent layout item
@param string $id The id or alias of the layout item
@return string|null The id of the parent layout item or null if the given item is the root | [
"Returns",
"the",
"id",
"of",
"the",
"parent",
"layout",
"item"
] | train | https://github.com/oroinc/OroLayoutComponent/blob/682a96672393d81c63728e47c4a4c3618c515be0/RawLayout.php#L87-L95 |
oroinc/OroLayoutComponent | RawLayout.php | RawLayout.resolveId | public function resolveId($id)
{
return $this->aliases->has($id)
? $this->aliases->getId($id)
: $id;
} | php | public function resolveId($id)
{
return $this->aliases->has($id)
? $this->aliases->getId($id)
: $id;
} | [
"public",
"function",
"resolveId",
"(",
"$",
"id",
")",
"{",
"return",
"$",
"this",
"->",
"aliases",
"->",
"has",
"(",
"$",
"id",
")",
"?",
"$",
"this",
"->",
"aliases",
"->",
"getId",
"(",
"$",
"id",
")",
":",
"$",
"id",
";",
"}"
] | Returns real id of the layout item
@param string $id The id or alias of the layout item
@return string The layout item id | [
"Returns",
"real",
"id",
"of",
"the",
"layout",
"item"
] | train | https://github.com/oroinc/OroLayoutComponent/blob/682a96672393d81c63728e47c4a4c3618c515be0/RawLayout.php#L104-L109 |
oroinc/OroLayoutComponent | RawLayout.php | RawLayout.has | public function has($id)
{
$id = $this->resolveId($id);
return isset($this->items[$id]);
} | php | public function has($id)
{
$id = $this->resolveId($id);
return isset($this->items[$id]);
} | [
"public",
"function",
"has",
"(",
"$",
"id",
")",
"{",
"$",
"id",
"=",
"$",
"this",
"->",
"resolveId",
"(",
"$",
"id",
")",
";",
"return",
"isset",
"(",
"$",
"this",
"->",
"items",
"[",
"$",
"id",
"]",
")",
";",
"}"
] | Checks if the layout item with the given id exists
@param string $id The id or alias of the layout item
@return bool | [
"Checks",
"if",
"the",
"layout",
"item",
"with",
"the",
"given",
"id",
"exists"
] | train | https://github.com/oroinc/OroLayoutComponent/blob/682a96672393d81c63728e47c4a4c3618c515be0/RawLayout.php#L118-L123 |
oroinc/OroLayoutComponent | RawLayout.php | RawLayout.add | public function add(
$id,
$parentId,
$blockType,
array $options = [],
$siblingId = null,
$prepend = null
) {
$this->validateId($id, true);
if (isset($this->items[$id])) {
throw new Exception\ItemAlreadyExistsException(
sprin... | php | public function add(
$id,
$parentId,
$blockType,
array $options = [],
$siblingId = null,
$prepend = null
) {
$this->validateId($id, true);
if (isset($this->items[$id])) {
throw new Exception\ItemAlreadyExistsException(
sprin... | [
"public",
"function",
"add",
"(",
"$",
"id",
",",
"$",
"parentId",
",",
"$",
"blockType",
",",
"array",
"$",
"options",
"=",
"[",
"]",
",",
"$",
"siblingId",
"=",
"null",
",",
"$",
"prepend",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"validateId",
... | Adds a new item to the layout
@param string $id The layout item id
@param string $parentId The id or alias of parent item. Set null to add the root item
@param mixed $blockType The block type associated with the layout item
@param array $options The layout item options
@param string|nul... | [
"Adds",
"a",
"new",
"item",
"to",
"the",
"layout"
] | train | https://github.com/oroinc/OroLayoutComponent/blob/682a96672393d81c63728e47c4a4c3618c515be0/RawLayout.php#L143-L194 |
oroinc/OroLayoutComponent | RawLayout.php | RawLayout.remove | public function remove($id)
{
$id = $this->validateAndResolveId($id);
$path = $this->items[$id][self::PATH];
// remove item from hierarchy
$this->hierarchy->remove($path);
// remove item
unset($this->items[$id]);
$this->aliases->removeById($id);
uns... | php | public function remove($id)
{
$id = $this->validateAndResolveId($id);
$path = $this->items[$id][self::PATH];
// remove item from hierarchy
$this->hierarchy->remove($path);
// remove item
unset($this->items[$id]);
$this->aliases->removeById($id);
uns... | [
"public",
"function",
"remove",
"(",
"$",
"id",
")",
"{",
"$",
"id",
"=",
"$",
"this",
"->",
"validateAndResolveId",
"(",
"$",
"id",
")",
";",
"$",
"path",
"=",
"$",
"this",
"->",
"items",
"[",
"$",
"id",
"]",
"[",
"self",
"::",
"PATH",
"]",
";... | Removes the given item from the layout
@param string $id The id of the layout item to be removed
@throws Exception\InvalidArgumentException if the id is empty
@throws Exception\ItemNotFoundException if the layout item does not exist | [
"Removes",
"the",
"given",
"item",
"from",
"the",
"layout"
] | train | https://github.com/oroinc/OroLayoutComponent/blob/682a96672393d81c63728e47c4a4c3618c515be0/RawLayout.php#L204-L227 |
oroinc/OroLayoutComponent | RawLayout.php | RawLayout.move | public function move($id, $parentId = null, $siblingId = null, $prepend = null)
{
$id = $this->validateAndResolveId($id);
if ($parentId) {
$parentId = $this->resolveId($parentId);
if (!isset($this->items[$parentId])) {
throw new Exception\ItemNotFoundException... | php | public function move($id, $parentId = null, $siblingId = null, $prepend = null)
{
$id = $this->validateAndResolveId($id);
if ($parentId) {
$parentId = $this->resolveId($parentId);
if (!isset($this->items[$parentId])) {
throw new Exception\ItemNotFoundException... | [
"public",
"function",
"move",
"(",
"$",
"id",
",",
"$",
"parentId",
"=",
"null",
",",
"$",
"siblingId",
"=",
"null",
",",
"$",
"prepend",
"=",
"null",
")",
"{",
"$",
"id",
"=",
"$",
"this",
"->",
"validateAndResolveId",
"(",
"$",
"id",
")",
";",
... | Moves the given item to another location
@param string $id The id or alias of the layout item to be moved
@param string|null $parentId The id or alias of a parent item the specified item is moved to
If this parameter is null only the order of the item is changed
@param string|null $siblingId The id or ali... | [
"Moves",
"the",
"given",
"item",
"to",
"another",
"location"
] | train | https://github.com/oroinc/OroLayoutComponent/blob/682a96672393d81c63728e47c4a4c3618c515be0/RawLayout.php#L246-L308 |
oroinc/OroLayoutComponent | RawLayout.php | RawLayout.hasProperty | public function hasProperty($id, $name, $directAccess = false)
{
if (!$directAccess) {
$id = $this->validateAndResolveId($id);
}
return isset($this->items[$id][$name]) || array_key_exists($name, $this->items[$id]);
} | php | public function hasProperty($id, $name, $directAccess = false)
{
if (!$directAccess) {
$id = $this->validateAndResolveId($id);
}
return isset($this->items[$id][$name]) || array_key_exists($name, $this->items[$id]);
} | [
"public",
"function",
"hasProperty",
"(",
"$",
"id",
",",
"$",
"name",
",",
"$",
"directAccess",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"$",
"directAccess",
")",
"{",
"$",
"id",
"=",
"$",
"this",
"->",
"validateAndResolveId",
"(",
"$",
"id",
")",
... | Checks if the layout item has the given additional property
@param string $id The id or alias of the layout item
@param string $name The property name
@param bool $directAccess Indicated whether the item id validation should be skipped.
This flag can be used to increase performance of get operation... | [
"Checks",
"if",
"the",
"layout",
"item",
"has",
"the",
"given",
"additional",
"property"
] | train | https://github.com/oroinc/OroLayoutComponent/blob/682a96672393d81c63728e47c4a4c3618c515be0/RawLayout.php#L325-L332 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.