id
int32 0
241k
| repo
stringlengths 6
63
| path
stringlengths 5
140
| func_name
stringlengths 3
151
| original_string
stringlengths 84
13k
| language
stringclasses 1
value | code
stringlengths 84
13k
| code_tokens
sequence | docstring
stringlengths 3
47.2k
| docstring_tokens
sequence | sha
stringlengths 40
40
| url
stringlengths 91
247
|
---|---|---|---|---|---|---|---|---|---|---|---|
10,100 | indigophp-archive/codeception-fuel-module | fuel/fuel/core/classes/pagination.php | Pagination.previous | public function previous($marker = null)
{
$html = '';
$marker === null and $marker = $this->template['previous-marker'];
if ($this->config['total_pages'] > 1)
{
if ($this->config['calculated_page'] == 1)
{
$html = str_replace(
'{link}',
str_replace(array('{uri}', '{page}'), array('#', $marker), $this->template['previous-inactive-link']),
$this->template['previous-inactive']
);
$this->raw_results['previous'] = array('uri' => '#', 'title' => $marker, 'type' => 'previous-inactive');
}
else
{
$previous_page = $this->config['calculated_page'] - 1;
$previous_page = ($previous_page == 1) ? '' : $previous_page;
$html = str_replace(
'{link}',
str_replace(array('{uri}', '{page}'), array($this->_make_link($previous_page), $marker), $this->template['previous-link']),
$this->template['previous']
);
$this->raw_results['previous'] = array('uri' => $this->_make_link($previous_page), 'title' => $marker, 'type' => 'previous');
}
}
return $html;
} | php | public function previous($marker = null)
{
$html = '';
$marker === null and $marker = $this->template['previous-marker'];
if ($this->config['total_pages'] > 1)
{
if ($this->config['calculated_page'] == 1)
{
$html = str_replace(
'{link}',
str_replace(array('{uri}', '{page}'), array('#', $marker), $this->template['previous-inactive-link']),
$this->template['previous-inactive']
);
$this->raw_results['previous'] = array('uri' => '#', 'title' => $marker, 'type' => 'previous-inactive');
}
else
{
$previous_page = $this->config['calculated_page'] - 1;
$previous_page = ($previous_page == 1) ? '' : $previous_page;
$html = str_replace(
'{link}',
str_replace(array('{uri}', '{page}'), array($this->_make_link($previous_page), $marker), $this->template['previous-link']),
$this->template['previous']
);
$this->raw_results['previous'] = array('uri' => $this->_make_link($previous_page), 'title' => $marker, 'type' => 'previous');
}
}
return $html;
} | [
"public",
"function",
"previous",
"(",
"$",
"marker",
"=",
"null",
")",
"{",
"$",
"html",
"=",
"''",
";",
"$",
"marker",
"===",
"null",
"and",
"$",
"marker",
"=",
"$",
"this",
"->",
"template",
"[",
"'previous-marker'",
"]",
";",
"if",
"(",
"$",
"this",
"->",
"config",
"[",
"'total_pages'",
"]",
">",
"1",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"config",
"[",
"'calculated_page'",
"]",
"==",
"1",
")",
"{",
"$",
"html",
"=",
"str_replace",
"(",
"'{link}'",
",",
"str_replace",
"(",
"array",
"(",
"'{uri}'",
",",
"'{page}'",
")",
",",
"array",
"(",
"'#'",
",",
"$",
"marker",
")",
",",
"$",
"this",
"->",
"template",
"[",
"'previous-inactive-link'",
"]",
")",
",",
"$",
"this",
"->",
"template",
"[",
"'previous-inactive'",
"]",
")",
";",
"$",
"this",
"->",
"raw_results",
"[",
"'previous'",
"]",
"=",
"array",
"(",
"'uri'",
"=>",
"'#'",
",",
"'title'",
"=>",
"$",
"marker",
",",
"'type'",
"=>",
"'previous-inactive'",
")",
";",
"}",
"else",
"{",
"$",
"previous_page",
"=",
"$",
"this",
"->",
"config",
"[",
"'calculated_page'",
"]",
"-",
"1",
";",
"$",
"previous_page",
"=",
"(",
"$",
"previous_page",
"==",
"1",
")",
"?",
"''",
":",
"$",
"previous_page",
";",
"$",
"html",
"=",
"str_replace",
"(",
"'{link}'",
",",
"str_replace",
"(",
"array",
"(",
"'{uri}'",
",",
"'{page}'",
")",
",",
"array",
"(",
"$",
"this",
"->",
"_make_link",
"(",
"$",
"previous_page",
")",
",",
"$",
"marker",
")",
",",
"$",
"this",
"->",
"template",
"[",
"'previous-link'",
"]",
")",
",",
"$",
"this",
"->",
"template",
"[",
"'previous'",
"]",
")",
";",
"$",
"this",
"->",
"raw_results",
"[",
"'previous'",
"]",
"=",
"array",
"(",
"'uri'",
"=>",
"$",
"this",
"->",
"_make_link",
"(",
"$",
"previous_page",
")",
",",
"'title'",
"=>",
"$",
"marker",
",",
"'type'",
"=>",
"'previous'",
")",
";",
"}",
"}",
"return",
"$",
"html",
";",
"}"
] | Pagination "Previous" link
@param string $value optional text to display in the link
@return string Markup for the 'previous' page number link | [
"Pagination",
"Previous",
"link"
] | 0973b7cbd540a0e89cc5bb7af94627f77f09bf49 | https://github.com/indigophp-archive/codeception-fuel-module/blob/0973b7cbd540a0e89cc5bb7af94627f77f09bf49/fuel/fuel/core/classes/pagination.php#L396-L428 |
10,101 | indigophp-archive/codeception-fuel-module | fuel/fuel/core/classes/pagination.php | Pagination.next | public function next($marker = null)
{
$html = '';
$marker === null and $marker = $this->template['next-marker'];
if ($this->config['total_pages'] > 1)
{
if ($this->config['calculated_page'] == $this->config['total_pages'])
{
$html = str_replace(
'{link}',
str_replace(array('{uri}', '{page}'), array('#', $marker), $this->template['next-inactive-link']),
$this->template['next-inactive']
);
$this->raw_results['next'] = array('uri' => '#', 'title' => $marker, 'type' => 'next-inactive');
}
else
{
$next_page = $this->config['calculated_page'] + 1;
$html = str_replace(
'{link}',
str_replace(array('{uri}', '{page}'), array($this->_make_link($next_page), $marker), $this->template['next-link']),
$this->template['next']
);
$this->raw_results['next'] = array('uri' => $this->_make_link($next_page), 'title' => $marker, 'type' => 'next');
}
}
return $html;
} | php | public function next($marker = null)
{
$html = '';
$marker === null and $marker = $this->template['next-marker'];
if ($this->config['total_pages'] > 1)
{
if ($this->config['calculated_page'] == $this->config['total_pages'])
{
$html = str_replace(
'{link}',
str_replace(array('{uri}', '{page}'), array('#', $marker), $this->template['next-inactive-link']),
$this->template['next-inactive']
);
$this->raw_results['next'] = array('uri' => '#', 'title' => $marker, 'type' => 'next-inactive');
}
else
{
$next_page = $this->config['calculated_page'] + 1;
$html = str_replace(
'{link}',
str_replace(array('{uri}', '{page}'), array($this->_make_link($next_page), $marker), $this->template['next-link']),
$this->template['next']
);
$this->raw_results['next'] = array('uri' => $this->_make_link($next_page), 'title' => $marker, 'type' => 'next');
}
}
return $html;
} | [
"public",
"function",
"next",
"(",
"$",
"marker",
"=",
"null",
")",
"{",
"$",
"html",
"=",
"''",
";",
"$",
"marker",
"===",
"null",
"and",
"$",
"marker",
"=",
"$",
"this",
"->",
"template",
"[",
"'next-marker'",
"]",
";",
"if",
"(",
"$",
"this",
"->",
"config",
"[",
"'total_pages'",
"]",
">",
"1",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"config",
"[",
"'calculated_page'",
"]",
"==",
"$",
"this",
"->",
"config",
"[",
"'total_pages'",
"]",
")",
"{",
"$",
"html",
"=",
"str_replace",
"(",
"'{link}'",
",",
"str_replace",
"(",
"array",
"(",
"'{uri}'",
",",
"'{page}'",
")",
",",
"array",
"(",
"'#'",
",",
"$",
"marker",
")",
",",
"$",
"this",
"->",
"template",
"[",
"'next-inactive-link'",
"]",
")",
",",
"$",
"this",
"->",
"template",
"[",
"'next-inactive'",
"]",
")",
";",
"$",
"this",
"->",
"raw_results",
"[",
"'next'",
"]",
"=",
"array",
"(",
"'uri'",
"=>",
"'#'",
",",
"'title'",
"=>",
"$",
"marker",
",",
"'type'",
"=>",
"'next-inactive'",
")",
";",
"}",
"else",
"{",
"$",
"next_page",
"=",
"$",
"this",
"->",
"config",
"[",
"'calculated_page'",
"]",
"+",
"1",
";",
"$",
"html",
"=",
"str_replace",
"(",
"'{link}'",
",",
"str_replace",
"(",
"array",
"(",
"'{uri}'",
",",
"'{page}'",
")",
",",
"array",
"(",
"$",
"this",
"->",
"_make_link",
"(",
"$",
"next_page",
")",
",",
"$",
"marker",
")",
",",
"$",
"this",
"->",
"template",
"[",
"'next-link'",
"]",
")",
",",
"$",
"this",
"->",
"template",
"[",
"'next'",
"]",
")",
";",
"$",
"this",
"->",
"raw_results",
"[",
"'next'",
"]",
"=",
"array",
"(",
"'uri'",
"=>",
"$",
"this",
"->",
"_make_link",
"(",
"$",
"next_page",
")",
",",
"'title'",
"=>",
"$",
"marker",
",",
"'type'",
"=>",
"'next'",
")",
";",
"}",
"}",
"return",
"$",
"html",
";",
"}"
] | Pagination "Next" link
@param string $value optional text to display in the link
@return string Markup for the 'next' page number link | [
"Pagination",
"Next",
"link"
] | 0973b7cbd540a0e89cc5bb7af94627f77f09bf49 | https://github.com/indigophp-archive/codeception-fuel-module/blob/0973b7cbd540a0e89cc5bb7af94627f77f09bf49/fuel/fuel/core/classes/pagination.php#L437-L468 |
10,102 | indigophp-archive/codeception-fuel-module | fuel/fuel/core/classes/pagination.php | Pagination.last | public function last($marker = null)
{
$html = '';
$marker === null and $marker = $this->template['last-marker'];
if ($this->config['show_last'])
{
if ($this->config['total_pages'] > 1 and $this->config['calculated_page'] != $this->config['total_pages'])
{
$html = str_replace(
'{link}',
str_replace(array('{uri}', '{page}'), array($this->_make_link($this->config['total_pages']), $marker), $this->template['last-link']),
$this->template['last']
);
$this->raw_results['last'] = array('uri' => $this->_make_link($this->config['total_pages']), 'title' => $marker, 'type' => 'last');
}
else
{
$html = str_replace(
'{link}',
str_replace(array('{uri}', '{page}'), array('#', $marker), $this->template['last-inactive-link']),
$this->template['last-inactive']
);
$this->raw_results['last'] = array('uri' => '#', 'title' => $marker, 'type' => 'last-inactive');
}
}
return $html;
} | php | public function last($marker = null)
{
$html = '';
$marker === null and $marker = $this->template['last-marker'];
if ($this->config['show_last'])
{
if ($this->config['total_pages'] > 1 and $this->config['calculated_page'] != $this->config['total_pages'])
{
$html = str_replace(
'{link}',
str_replace(array('{uri}', '{page}'), array($this->_make_link($this->config['total_pages']), $marker), $this->template['last-link']),
$this->template['last']
);
$this->raw_results['last'] = array('uri' => $this->_make_link($this->config['total_pages']), 'title' => $marker, 'type' => 'last');
}
else
{
$html = str_replace(
'{link}',
str_replace(array('{uri}', '{page}'), array('#', $marker), $this->template['last-inactive-link']),
$this->template['last-inactive']
);
$this->raw_results['last'] = array('uri' => '#', 'title' => $marker, 'type' => 'last-inactive');
}
}
return $html;
} | [
"public",
"function",
"last",
"(",
"$",
"marker",
"=",
"null",
")",
"{",
"$",
"html",
"=",
"''",
";",
"$",
"marker",
"===",
"null",
"and",
"$",
"marker",
"=",
"$",
"this",
"->",
"template",
"[",
"'last-marker'",
"]",
";",
"if",
"(",
"$",
"this",
"->",
"config",
"[",
"'show_last'",
"]",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"config",
"[",
"'total_pages'",
"]",
">",
"1",
"and",
"$",
"this",
"->",
"config",
"[",
"'calculated_page'",
"]",
"!=",
"$",
"this",
"->",
"config",
"[",
"'total_pages'",
"]",
")",
"{",
"$",
"html",
"=",
"str_replace",
"(",
"'{link}'",
",",
"str_replace",
"(",
"array",
"(",
"'{uri}'",
",",
"'{page}'",
")",
",",
"array",
"(",
"$",
"this",
"->",
"_make_link",
"(",
"$",
"this",
"->",
"config",
"[",
"'total_pages'",
"]",
")",
",",
"$",
"marker",
")",
",",
"$",
"this",
"->",
"template",
"[",
"'last-link'",
"]",
")",
",",
"$",
"this",
"->",
"template",
"[",
"'last'",
"]",
")",
";",
"$",
"this",
"->",
"raw_results",
"[",
"'last'",
"]",
"=",
"array",
"(",
"'uri'",
"=>",
"$",
"this",
"->",
"_make_link",
"(",
"$",
"this",
"->",
"config",
"[",
"'total_pages'",
"]",
")",
",",
"'title'",
"=>",
"$",
"marker",
",",
"'type'",
"=>",
"'last'",
")",
";",
"}",
"else",
"{",
"$",
"html",
"=",
"str_replace",
"(",
"'{link}'",
",",
"str_replace",
"(",
"array",
"(",
"'{uri}'",
",",
"'{page}'",
")",
",",
"array",
"(",
"'#'",
",",
"$",
"marker",
")",
",",
"$",
"this",
"->",
"template",
"[",
"'last-inactive-link'",
"]",
")",
",",
"$",
"this",
"->",
"template",
"[",
"'last-inactive'",
"]",
")",
";",
"$",
"this",
"->",
"raw_results",
"[",
"'last'",
"]",
"=",
"array",
"(",
"'uri'",
"=>",
"'#'",
",",
"'title'",
"=>",
"$",
"marker",
",",
"'type'",
"=>",
"'last-inactive'",
")",
";",
"}",
"}",
"return",
"$",
"html",
";",
"}"
] | Pagination "Last" link
@param string $value optional text to display in the link
@return string Markup for the 'last' page number link | [
"Pagination",
"Last",
"link"
] | 0973b7cbd540a0e89cc5bb7af94627f77f09bf49 | https://github.com/indigophp-archive/codeception-fuel-module/blob/0973b7cbd540a0e89cc5bb7af94627f77f09bf49/fuel/fuel/core/classes/pagination.php#L477-L506 |
10,103 | indigophp-archive/codeception-fuel-module | fuel/fuel/core/classes/pagination.php | Pagination._recalculate | protected function _recalculate()
{
// calculate the number of pages
$this->config['total_pages'] = (int) ceil($this->config['total_items'] / $this->config['per_page']) ?: 1;
// get the current page number, either from the one set, or from the URI or the query string
if ($this->config['current_page'])
{
$this->config['calculated_page'] = $this->config['current_page'];
}
else
{
if (is_string($this->config['uri_segment']))
{
$this->config['calculated_page'] = \Input::get($this->config['uri_segment'], 1);
}
else
{
$this->config['calculated_page'] = (int) \Request::main()->uri->get_segment($this->config['uri_segment']);
}
}
// make sure the current page is within bounds
if ($this->config['calculated_page'] > $this->config['total_pages'])
{
$this->config['calculated_page'] = $this->config['total_pages'];
}
elseif ($this->config['calculated_page'] < 1)
{
$this->config['calculated_page'] = 1;
}
// the current page must be zero based so that the offset for page 1 is 0.
$this->config['offset'] = ($this->config['calculated_page'] - 1) * $this->config['per_page'];
} | php | protected function _recalculate()
{
// calculate the number of pages
$this->config['total_pages'] = (int) ceil($this->config['total_items'] / $this->config['per_page']) ?: 1;
// get the current page number, either from the one set, or from the URI or the query string
if ($this->config['current_page'])
{
$this->config['calculated_page'] = $this->config['current_page'];
}
else
{
if (is_string($this->config['uri_segment']))
{
$this->config['calculated_page'] = \Input::get($this->config['uri_segment'], 1);
}
else
{
$this->config['calculated_page'] = (int) \Request::main()->uri->get_segment($this->config['uri_segment']);
}
}
// make sure the current page is within bounds
if ($this->config['calculated_page'] > $this->config['total_pages'])
{
$this->config['calculated_page'] = $this->config['total_pages'];
}
elseif ($this->config['calculated_page'] < 1)
{
$this->config['calculated_page'] = 1;
}
// the current page must be zero based so that the offset for page 1 is 0.
$this->config['offset'] = ($this->config['calculated_page'] - 1) * $this->config['per_page'];
} | [
"protected",
"function",
"_recalculate",
"(",
")",
"{",
"// calculate the number of pages",
"$",
"this",
"->",
"config",
"[",
"'total_pages'",
"]",
"=",
"(",
"int",
")",
"ceil",
"(",
"$",
"this",
"->",
"config",
"[",
"'total_items'",
"]",
"/",
"$",
"this",
"->",
"config",
"[",
"'per_page'",
"]",
")",
"?",
":",
"1",
";",
"// get the current page number, either from the one set, or from the URI or the query string",
"if",
"(",
"$",
"this",
"->",
"config",
"[",
"'current_page'",
"]",
")",
"{",
"$",
"this",
"->",
"config",
"[",
"'calculated_page'",
"]",
"=",
"$",
"this",
"->",
"config",
"[",
"'current_page'",
"]",
";",
"}",
"else",
"{",
"if",
"(",
"is_string",
"(",
"$",
"this",
"->",
"config",
"[",
"'uri_segment'",
"]",
")",
")",
"{",
"$",
"this",
"->",
"config",
"[",
"'calculated_page'",
"]",
"=",
"\\",
"Input",
"::",
"get",
"(",
"$",
"this",
"->",
"config",
"[",
"'uri_segment'",
"]",
",",
"1",
")",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"config",
"[",
"'calculated_page'",
"]",
"=",
"(",
"int",
")",
"\\",
"Request",
"::",
"main",
"(",
")",
"->",
"uri",
"->",
"get_segment",
"(",
"$",
"this",
"->",
"config",
"[",
"'uri_segment'",
"]",
")",
";",
"}",
"}",
"// make sure the current page is within bounds",
"if",
"(",
"$",
"this",
"->",
"config",
"[",
"'calculated_page'",
"]",
">",
"$",
"this",
"->",
"config",
"[",
"'total_pages'",
"]",
")",
"{",
"$",
"this",
"->",
"config",
"[",
"'calculated_page'",
"]",
"=",
"$",
"this",
"->",
"config",
"[",
"'total_pages'",
"]",
";",
"}",
"elseif",
"(",
"$",
"this",
"->",
"config",
"[",
"'calculated_page'",
"]",
"<",
"1",
")",
"{",
"$",
"this",
"->",
"config",
"[",
"'calculated_page'",
"]",
"=",
"1",
";",
"}",
"// the current page must be zero based so that the offset for page 1 is 0.",
"$",
"this",
"->",
"config",
"[",
"'offset'",
"]",
"=",
"(",
"$",
"this",
"->",
"config",
"[",
"'calculated_page'",
"]",
"-",
"1",
")",
"*",
"$",
"this",
"->",
"config",
"[",
"'per_page'",
"]",
";",
"}"
] | Prepares vars for creating links | [
"Prepares",
"vars",
"for",
"creating",
"links"
] | 0973b7cbd540a0e89cc5bb7af94627f77f09bf49 | https://github.com/indigophp-archive/codeception-fuel-module/blob/0973b7cbd540a0e89cc5bb7af94627f77f09bf49/fuel/fuel/core/classes/pagination.php#L511-L545 |
10,104 | indigophp-archive/codeception-fuel-module | fuel/fuel/core/classes/pagination.php | Pagination._validate | protected function _validate($name, $value)
{
switch ($name)
{
case 'offset':
case 'total_items':
// make sure it's an integer
if ($value != intval($value))
{
$value = 0;
}
// and that it's within bounds
$value = max(0, $value);
break;
// integer or string
case 'uri_segment':
if (is_numeric($value))
{
// make sure it's an integer
if ($value != intval($value))
{
$value = 1;
}
// and that it's within bounds
$value = max(1, $value);
}
break;
// validate integer values
case 'current_page':
case 'per_page':
case 'limit':
case 'total_pages':
case 'num_links':
// make sure it's an integer
if ($value != intval($value))
{
$value = 1;
}
// and that it's within bounds
$value = max(1, $value);
break;
// validate booleans
case 'show_first':
case 'show_last':
if ( ! is_bool($value))
{
$value = (bool) $value;
}
break;
// validate the link offset, and adjust if needed
case 'link_offset':
// make sure we have a fraction between 0 and 1
if ($value > 1)
{
$value = $value / 100;
}
// and that it's within bounds
$value = max(0.01, min($value, 0.99));
break;
}
return $value;
} | php | protected function _validate($name, $value)
{
switch ($name)
{
case 'offset':
case 'total_items':
// make sure it's an integer
if ($value != intval($value))
{
$value = 0;
}
// and that it's within bounds
$value = max(0, $value);
break;
// integer or string
case 'uri_segment':
if (is_numeric($value))
{
// make sure it's an integer
if ($value != intval($value))
{
$value = 1;
}
// and that it's within bounds
$value = max(1, $value);
}
break;
// validate integer values
case 'current_page':
case 'per_page':
case 'limit':
case 'total_pages':
case 'num_links':
// make sure it's an integer
if ($value != intval($value))
{
$value = 1;
}
// and that it's within bounds
$value = max(1, $value);
break;
// validate booleans
case 'show_first':
case 'show_last':
if ( ! is_bool($value))
{
$value = (bool) $value;
}
break;
// validate the link offset, and adjust if needed
case 'link_offset':
// make sure we have a fraction between 0 and 1
if ($value > 1)
{
$value = $value / 100;
}
// and that it's within bounds
$value = max(0.01, min($value, 0.99));
break;
}
return $value;
} | [
"protected",
"function",
"_validate",
"(",
"$",
"name",
",",
"$",
"value",
")",
"{",
"switch",
"(",
"$",
"name",
")",
"{",
"case",
"'offset'",
":",
"case",
"'total_items'",
":",
"// make sure it's an integer",
"if",
"(",
"$",
"value",
"!=",
"intval",
"(",
"$",
"value",
")",
")",
"{",
"$",
"value",
"=",
"0",
";",
"}",
"// and that it's within bounds",
"$",
"value",
"=",
"max",
"(",
"0",
",",
"$",
"value",
")",
";",
"break",
";",
"// integer or string",
"case",
"'uri_segment'",
":",
"if",
"(",
"is_numeric",
"(",
"$",
"value",
")",
")",
"{",
"// make sure it's an integer",
"if",
"(",
"$",
"value",
"!=",
"intval",
"(",
"$",
"value",
")",
")",
"{",
"$",
"value",
"=",
"1",
";",
"}",
"// and that it's within bounds",
"$",
"value",
"=",
"max",
"(",
"1",
",",
"$",
"value",
")",
";",
"}",
"break",
";",
"// validate integer values",
"case",
"'current_page'",
":",
"case",
"'per_page'",
":",
"case",
"'limit'",
":",
"case",
"'total_pages'",
":",
"case",
"'num_links'",
":",
"// make sure it's an integer",
"if",
"(",
"$",
"value",
"!=",
"intval",
"(",
"$",
"value",
")",
")",
"{",
"$",
"value",
"=",
"1",
";",
"}",
"// and that it's within bounds",
"$",
"value",
"=",
"max",
"(",
"1",
",",
"$",
"value",
")",
";",
"break",
";",
"// validate booleans",
"case",
"'show_first'",
":",
"case",
"'show_last'",
":",
"if",
"(",
"!",
"is_bool",
"(",
"$",
"value",
")",
")",
"{",
"$",
"value",
"=",
"(",
"bool",
")",
"$",
"value",
";",
"}",
"break",
";",
"// validate the link offset, and adjust if needed",
"case",
"'link_offset'",
":",
"// make sure we have a fraction between 0 and 1",
"if",
"(",
"$",
"value",
">",
"1",
")",
"{",
"$",
"value",
"=",
"$",
"value",
"/",
"100",
";",
"}",
"// and that it's within bounds",
"$",
"value",
"=",
"max",
"(",
"0.01",
",",
"min",
"(",
"$",
"value",
",",
"0.99",
")",
")",
";",
"break",
";",
"}",
"return",
"$",
"value",
";",
"}"
] | Validate the input configuration | [
"Validate",
"the",
"input",
"configuration"
] | 0973b7cbd540a0e89cc5bb7af94627f77f09bf49 | https://github.com/indigophp-archive/codeception-fuel-module/blob/0973b7cbd540a0e89cc5bb7af94627f77f09bf49/fuel/fuel/core/classes/pagination.php#L620-L687 |
10,105 | duellsy/pockpack | src/Duellsy/Pockpack/Pockpack.php | Pockpack.send | public function send(PockpackQueue $queue = null)
{
if( is_null($queue) ) {
throw new NoPockpackQueueException();
}
$params = array(
'actions' => json_encode($queue->getActions()),
'consumer_key' => $this->consumer_key,
'access_token' => $this->access_token
);
$request = $this->getClient()->get('/v3/send');
$request->getQuery()->merge($params);
$response = $request->send();
// remove any items from the queue
$queue->clear();
return json_decode($response->getBody());
} | php | public function send(PockpackQueue $queue = null)
{
if( is_null($queue) ) {
throw new NoPockpackQueueException();
}
$params = array(
'actions' => json_encode($queue->getActions()),
'consumer_key' => $this->consumer_key,
'access_token' => $this->access_token
);
$request = $this->getClient()->get('/v3/send');
$request->getQuery()->merge($params);
$response = $request->send();
// remove any items from the queue
$queue->clear();
return json_decode($response->getBody());
} | [
"public",
"function",
"send",
"(",
"PockpackQueue",
"$",
"queue",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"queue",
")",
")",
"{",
"throw",
"new",
"NoPockpackQueueException",
"(",
")",
";",
"}",
"$",
"params",
"=",
"array",
"(",
"'actions'",
"=>",
"json_encode",
"(",
"$",
"queue",
"->",
"getActions",
"(",
")",
")",
",",
"'consumer_key'",
"=>",
"$",
"this",
"->",
"consumer_key",
",",
"'access_token'",
"=>",
"$",
"this",
"->",
"access_token",
")",
";",
"$",
"request",
"=",
"$",
"this",
"->",
"getClient",
"(",
")",
"->",
"get",
"(",
"'/v3/send'",
")",
";",
"$",
"request",
"->",
"getQuery",
"(",
")",
"->",
"merge",
"(",
"$",
"params",
")",
";",
"$",
"response",
"=",
"$",
"request",
"->",
"send",
"(",
")",
";",
"// remove any items from the queue",
"$",
"queue",
"->",
"clear",
"(",
")",
";",
"return",
"json_decode",
"(",
"$",
"response",
"->",
"getBody",
"(",
")",
")",
";",
"}"
] | Responsible for sending the request to the pocket API
@param string $consumer_key
@param string $access_token
@param array $actions | [
"Responsible",
"for",
"sending",
"the",
"request",
"to",
"the",
"pocket",
"API"
] | b38b9942631ae786c6ed953da65f666ea9305f3c | https://github.com/duellsy/pockpack/blob/b38b9942631ae786c6ed953da65f666ea9305f3c/src/Duellsy/Pockpack/Pockpack.php#L36-L57 |
10,106 | duellsy/pockpack | src/Duellsy/Pockpack/Pockpack.php | Pockpack.retrieve | public function retrieve($options = array(), $isArray = false)
{
$params = array(
'consumer_key' => $this->consumer_key,
'access_token' => $this->access_token
);
// combine the creds with any options sent
$params = array_merge($params, $options);
$request = $this->getClient()->post('/v3/get');
$request->getParams()->set('redirect.strict', true);
$request->setHeader('Content-Type', 'application/json; charset=UTF8');
$request->setHeader('X-Accept', 'application/json');
$request->setBody(json_encode($params));
$response = $request->send();
return json_decode($response->getBody(), $isArray);
} | php | public function retrieve($options = array(), $isArray = false)
{
$params = array(
'consumer_key' => $this->consumer_key,
'access_token' => $this->access_token
);
// combine the creds with any options sent
$params = array_merge($params, $options);
$request = $this->getClient()->post('/v3/get');
$request->getParams()->set('redirect.strict', true);
$request->setHeader('Content-Type', 'application/json; charset=UTF8');
$request->setHeader('X-Accept', 'application/json');
$request->setBody(json_encode($params));
$response = $request->send();
return json_decode($response->getBody(), $isArray);
} | [
"public",
"function",
"retrieve",
"(",
"$",
"options",
"=",
"array",
"(",
")",
",",
"$",
"isArray",
"=",
"false",
")",
"{",
"$",
"params",
"=",
"array",
"(",
"'consumer_key'",
"=>",
"$",
"this",
"->",
"consumer_key",
",",
"'access_token'",
"=>",
"$",
"this",
"->",
"access_token",
")",
";",
"// combine the creds with any options sent",
"$",
"params",
"=",
"array_merge",
"(",
"$",
"params",
",",
"$",
"options",
")",
";",
"$",
"request",
"=",
"$",
"this",
"->",
"getClient",
"(",
")",
"->",
"post",
"(",
"'/v3/get'",
")",
";",
"$",
"request",
"->",
"getParams",
"(",
")",
"->",
"set",
"(",
"'redirect.strict'",
",",
"true",
")",
";",
"$",
"request",
"->",
"setHeader",
"(",
"'Content-Type'",
",",
"'application/json; charset=UTF8'",
")",
";",
"$",
"request",
"->",
"setHeader",
"(",
"'X-Accept'",
",",
"'application/json'",
")",
";",
"$",
"request",
"->",
"setBody",
"(",
"json_encode",
"(",
"$",
"params",
")",
")",
";",
"$",
"response",
"=",
"$",
"request",
"->",
"send",
"(",
")",
";",
"return",
"json_decode",
"(",
"$",
"response",
"->",
"getBody",
"(",
")",
",",
"$",
"isArray",
")",
";",
"}"
] | Retrieve the data from the pocket API
@param array $options options to filter the data
@param boolean $isArray if decode JSON to array
@return array | [
"Retrieve",
"the",
"data",
"from",
"the",
"pocket",
"API"
] | b38b9942631ae786c6ed953da65f666ea9305f3c | https://github.com/duellsy/pockpack/blob/b38b9942631ae786c6ed953da65f666ea9305f3c/src/Duellsy/Pockpack/Pockpack.php#L67-L85 |
10,107 | Gelembjuk/mail | src/Gelembjuk/Mail/EmailFormat.php | EmailFormat.fetchTemplate | public function fetchTemplate($template,$data = array(),$outtemplate = null) {
// template is required
if (trim($template) == '') {
throw new \Exception('No template to format email');
}
$templatedata = $this->getTemplateData($template);
// use default out template if is not provided
if ($outtemplate === null) {
$outtemplate = 'default';
}
// template is not found in any locale
if (!is_array($templatedata)) {
throw new \Exception(sprintf('Email template %s not found',$template));
}
// if email template provided.
if ($outtemplate != '') {
$outtemplate_real = $this->getOutTemplate($outtemplate);
if (!$outtemplate_real) {
throw new \Exception(sprintf('Email template %s not found',$outtemplate));
}
$outtemplate = $outtemplate_real;
}
// create template processor object
$class = $this->templateprocessorclass;
$templating = new $class();
// init template processor
$templating->init($this->tepmlateprocessorinitoptions);
if (is_object($this->options['application'])) {
$templating->setApplication($this->options['application']);
}
// check if template processor can access a template
if (!$templating->checkTemplateExists($templatedata['file'])) {
throw new \Exception(sprintf('Email template %s not found',$template));
}
// set data to fetch with the template
$templating->setVars($data);
// fetch subject template (it also can contains some wildcards)
$subject = $templating->fetchString($templatedata['subject']);
$templating->setTemplate($templatedata['file']);
// generate email body
$emailhtml = $templating->fetchTemplate();
// insert a body to a common outer template
if ($outtemplate != '') {
$templating->setVar('EMAILCONTENT',$emailhtml);
$templating->setTemplate($outtemplate);
$emailhtml = $templating->fetchTemplate();
}
// return body and subject
return array('body'=>$emailhtml,'subject'=>$subject);
} | php | public function fetchTemplate($template,$data = array(),$outtemplate = null) {
// template is required
if (trim($template) == '') {
throw new \Exception('No template to format email');
}
$templatedata = $this->getTemplateData($template);
// use default out template if is not provided
if ($outtemplate === null) {
$outtemplate = 'default';
}
// template is not found in any locale
if (!is_array($templatedata)) {
throw new \Exception(sprintf('Email template %s not found',$template));
}
// if email template provided.
if ($outtemplate != '') {
$outtemplate_real = $this->getOutTemplate($outtemplate);
if (!$outtemplate_real) {
throw new \Exception(sprintf('Email template %s not found',$outtemplate));
}
$outtemplate = $outtemplate_real;
}
// create template processor object
$class = $this->templateprocessorclass;
$templating = new $class();
// init template processor
$templating->init($this->tepmlateprocessorinitoptions);
if (is_object($this->options['application'])) {
$templating->setApplication($this->options['application']);
}
// check if template processor can access a template
if (!$templating->checkTemplateExists($templatedata['file'])) {
throw new \Exception(sprintf('Email template %s not found',$template));
}
// set data to fetch with the template
$templating->setVars($data);
// fetch subject template (it also can contains some wildcards)
$subject = $templating->fetchString($templatedata['subject']);
$templating->setTemplate($templatedata['file']);
// generate email body
$emailhtml = $templating->fetchTemplate();
// insert a body to a common outer template
if ($outtemplate != '') {
$templating->setVar('EMAILCONTENT',$emailhtml);
$templating->setTemplate($outtemplate);
$emailhtml = $templating->fetchTemplate();
}
// return body and subject
return array('body'=>$emailhtml,'subject'=>$subject);
} | [
"public",
"function",
"fetchTemplate",
"(",
"$",
"template",
",",
"$",
"data",
"=",
"array",
"(",
")",
",",
"$",
"outtemplate",
"=",
"null",
")",
"{",
"// template is required",
"if",
"(",
"trim",
"(",
"$",
"template",
")",
"==",
"''",
")",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
"'No template to format email'",
")",
";",
"}",
"$",
"templatedata",
"=",
"$",
"this",
"->",
"getTemplateData",
"(",
"$",
"template",
")",
";",
"// use default out template if is not provided",
"if",
"(",
"$",
"outtemplate",
"===",
"null",
")",
"{",
"$",
"outtemplate",
"=",
"'default'",
";",
"}",
"// template is not found in any locale",
"if",
"(",
"!",
"is_array",
"(",
"$",
"templatedata",
")",
")",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
"sprintf",
"(",
"'Email template %s not found'",
",",
"$",
"template",
")",
")",
";",
"}",
"// if email template provided.",
"if",
"(",
"$",
"outtemplate",
"!=",
"''",
")",
"{",
"$",
"outtemplate_real",
"=",
"$",
"this",
"->",
"getOutTemplate",
"(",
"$",
"outtemplate",
")",
";",
"if",
"(",
"!",
"$",
"outtemplate_real",
")",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
"sprintf",
"(",
"'Email template %s not found'",
",",
"$",
"outtemplate",
")",
")",
";",
"}",
"$",
"outtemplate",
"=",
"$",
"outtemplate_real",
";",
"}",
"// create template processor object",
"$",
"class",
"=",
"$",
"this",
"->",
"templateprocessorclass",
";",
"$",
"templating",
"=",
"new",
"$",
"class",
"(",
")",
";",
"// init template processor",
"$",
"templating",
"->",
"init",
"(",
"$",
"this",
"->",
"tepmlateprocessorinitoptions",
")",
";",
"if",
"(",
"is_object",
"(",
"$",
"this",
"->",
"options",
"[",
"'application'",
"]",
")",
")",
"{",
"$",
"templating",
"->",
"setApplication",
"(",
"$",
"this",
"->",
"options",
"[",
"'application'",
"]",
")",
";",
"}",
"// check if template processor can access a template",
"if",
"(",
"!",
"$",
"templating",
"->",
"checkTemplateExists",
"(",
"$",
"templatedata",
"[",
"'file'",
"]",
")",
")",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
"sprintf",
"(",
"'Email template %s not found'",
",",
"$",
"template",
")",
")",
";",
"}",
"// set data to fetch with the template",
"$",
"templating",
"->",
"setVars",
"(",
"$",
"data",
")",
";",
"// fetch subject template (it also can contains some wildcards)",
"$",
"subject",
"=",
"$",
"templating",
"->",
"fetchString",
"(",
"$",
"templatedata",
"[",
"'subject'",
"]",
")",
";",
"$",
"templating",
"->",
"setTemplate",
"(",
"$",
"templatedata",
"[",
"'file'",
"]",
")",
";",
"// generate email body",
"$",
"emailhtml",
"=",
"$",
"templating",
"->",
"fetchTemplate",
"(",
")",
";",
"// insert a body to a common outer template",
"if",
"(",
"$",
"outtemplate",
"!=",
"''",
")",
"{",
"$",
"templating",
"->",
"setVar",
"(",
"'EMAILCONTENT'",
",",
"$",
"emailhtml",
")",
";",
"$",
"templating",
"->",
"setTemplate",
"(",
"$",
"outtemplate",
")",
";",
"$",
"emailhtml",
"=",
"$",
"templating",
"->",
"fetchTemplate",
"(",
")",
";",
"}",
"// return body and subject",
"return",
"array",
"(",
"'body'",
"=>",
"$",
"emailhtml",
",",
"'subject'",
"=>",
"$",
"subject",
")",
";",
"}"
] | Generate email body and subject based on templates and options
@param string $template Email template file
@param array $data Template data to fetch (insert in a template)
@param string $outtemplate Out template to use for email. Default is `default` (plus prefix). Set to empty string to skip out template
@return array Array with 2 keys: body and subject | [
"Generate",
"email",
"body",
"and",
"subject",
"based",
"on",
"templates",
"and",
"options"
] | c2dfa5aee0e49af1ea7803fb056c614b09921a9d | https://github.com/Gelembjuk/mail/blob/c2dfa5aee0e49af1ea7803fb056c614b09921a9d/src/Gelembjuk/Mail/EmailFormat.php#L152-L219 |
10,108 | Gelembjuk/mail | src/Gelembjuk/Mail/EmailFormat.php | EmailFormat.getTemplateData | protected function getTemplateData($template) {
// firstly, check for current locale, if it was set
if ($this->locale != '') {
$tdata = $this->getTemplateDataForLocale($template,$this->locale);
// found for this locale. return
if (is_array($tdata)) {
return $tdata;
}
}
// check for default locale
// for example, didn't find for locale `ge` but found for default `en`
if ($this->deflocale != '') {
$tdata = $this->getTemplateDataForLocale($template,$this->deflocale);
if (is_array($tdata)) {
return $tdata;
}
}
// if nothing found for both locales then check in root templates folder
// this is normal case for non-internation application where
// locales are not used
$tdata = $this->getTemplateDataForLocale($template,'');
return $tdata;
} | php | protected function getTemplateData($template) {
// firstly, check for current locale, if it was set
if ($this->locale != '') {
$tdata = $this->getTemplateDataForLocale($template,$this->locale);
// found for this locale. return
if (is_array($tdata)) {
return $tdata;
}
}
// check for default locale
// for example, didn't find for locale `ge` but found for default `en`
if ($this->deflocale != '') {
$tdata = $this->getTemplateDataForLocale($template,$this->deflocale);
if (is_array($tdata)) {
return $tdata;
}
}
// if nothing found for both locales then check in root templates folder
// this is normal case for non-internation application where
// locales are not used
$tdata = $this->getTemplateDataForLocale($template,'');
return $tdata;
} | [
"protected",
"function",
"getTemplateData",
"(",
"$",
"template",
")",
"{",
"// firstly, check for current locale, if it was set",
"if",
"(",
"$",
"this",
"->",
"locale",
"!=",
"''",
")",
"{",
"$",
"tdata",
"=",
"$",
"this",
"->",
"getTemplateDataForLocale",
"(",
"$",
"template",
",",
"$",
"this",
"->",
"locale",
")",
";",
"// found for this locale. return",
"if",
"(",
"is_array",
"(",
"$",
"tdata",
")",
")",
"{",
"return",
"$",
"tdata",
";",
"}",
"}",
"// check for default locale",
"// for example, didn't find for locale `ge` but found for default `en`",
"if",
"(",
"$",
"this",
"->",
"deflocale",
"!=",
"''",
")",
"{",
"$",
"tdata",
"=",
"$",
"this",
"->",
"getTemplateDataForLocale",
"(",
"$",
"template",
",",
"$",
"this",
"->",
"deflocale",
")",
";",
"if",
"(",
"is_array",
"(",
"$",
"tdata",
")",
")",
"{",
"return",
"$",
"tdata",
";",
"}",
"}",
"// if nothing found for both locales then check in root templates folder",
"// this is normal case for non-internation application where ",
"// locales are not used",
"$",
"tdata",
"=",
"$",
"this",
"->",
"getTemplateDataForLocale",
"(",
"$",
"template",
",",
"''",
")",
";",
"return",
"$",
"tdata",
";",
"}"
] | Returns template data according to locale settings
@param string $template Template file | [
"Returns",
"template",
"data",
"according",
"to",
"locale",
"settings"
] | c2dfa5aee0e49af1ea7803fb056c614b09921a9d | https://github.com/Gelembjuk/mail/blob/c2dfa5aee0e49af1ea7803fb056c614b09921a9d/src/Gelembjuk/Mail/EmailFormat.php#L225-L252 |
10,109 | Gelembjuk/mail | src/Gelembjuk/Mail/EmailFormat.php | EmailFormat.getTemplateDataForLocale | protected function getTemplateDataForLocale($template,$locale) {
// path to document with subjects
$metafile = $this->templatespath.'/'.$locale.'/subjects.xml';
if (!file_exists($metafile)) {
// file with subjects not found
return null;
}
// load and parse document with subjects
$xml = @file_get_contents($metafile);
if (!$xml || $xml == '') {
return null;
}
$array = \LSS\XML2Array::createArray($xml);
// our template is not found in this document so it is not there
if (!isset($array['templates'][$template])) {
return null;
}
$templatefile = $this->templatespath.'/'.$locale.'/'.$template.'.htm';
// check if template file exists for this locale
if (!file_exists($templatefile)) {
return null;
}
$tmpl = ($locale != '') ? $locale.'/':'';
$tmpl .= $template;
// all was fine. return found template
return array('subject'=>$array['templates'][$template]['subject'],
'file'=>$tmpl);
} | php | protected function getTemplateDataForLocale($template,$locale) {
// path to document with subjects
$metafile = $this->templatespath.'/'.$locale.'/subjects.xml';
if (!file_exists($metafile)) {
// file with subjects not found
return null;
}
// load and parse document with subjects
$xml = @file_get_contents($metafile);
if (!$xml || $xml == '') {
return null;
}
$array = \LSS\XML2Array::createArray($xml);
// our template is not found in this document so it is not there
if (!isset($array['templates'][$template])) {
return null;
}
$templatefile = $this->templatespath.'/'.$locale.'/'.$template.'.htm';
// check if template file exists for this locale
if (!file_exists($templatefile)) {
return null;
}
$tmpl = ($locale != '') ? $locale.'/':'';
$tmpl .= $template;
// all was fine. return found template
return array('subject'=>$array['templates'][$template]['subject'],
'file'=>$tmpl);
} | [
"protected",
"function",
"getTemplateDataForLocale",
"(",
"$",
"template",
",",
"$",
"locale",
")",
"{",
"// path to document with subjects",
"$",
"metafile",
"=",
"$",
"this",
"->",
"templatespath",
".",
"'/'",
".",
"$",
"locale",
".",
"'/subjects.xml'",
";",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"metafile",
")",
")",
"{",
"// file with subjects not found",
"return",
"null",
";",
"}",
"// load and parse document with subjects",
"$",
"xml",
"=",
"@",
"file_get_contents",
"(",
"$",
"metafile",
")",
";",
"if",
"(",
"!",
"$",
"xml",
"||",
"$",
"xml",
"==",
"''",
")",
"{",
"return",
"null",
";",
"}",
"$",
"array",
"=",
"\\",
"LSS",
"\\",
"XML2Array",
"::",
"createArray",
"(",
"$",
"xml",
")",
";",
"// our template is not found in this document so it is not there",
"if",
"(",
"!",
"isset",
"(",
"$",
"array",
"[",
"'templates'",
"]",
"[",
"$",
"template",
"]",
")",
")",
"{",
"return",
"null",
";",
"}",
"$",
"templatefile",
"=",
"$",
"this",
"->",
"templatespath",
".",
"'/'",
".",
"$",
"locale",
".",
"'/'",
".",
"$",
"template",
".",
"'.htm'",
";",
"// check if template file exists for this locale",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"templatefile",
")",
")",
"{",
"return",
"null",
";",
"}",
"$",
"tmpl",
"=",
"(",
"$",
"locale",
"!=",
"''",
")",
"?",
"$",
"locale",
".",
"'/'",
":",
"''",
";",
"$",
"tmpl",
".=",
"$",
"template",
";",
"// all was fine. return found template",
"return",
"array",
"(",
"'subject'",
"=>",
"$",
"array",
"[",
"'templates'",
"]",
"[",
"$",
"template",
"]",
"[",
"'subject'",
"]",
",",
"'file'",
"=>",
"$",
"tmpl",
")",
";",
"}"
] | Get template information for specified locale
@param string $template Template file
@param string $locale Locale or empty string
@return array Template subject and file path | [
"Get",
"template",
"information",
"for",
"specified",
"locale"
] | c2dfa5aee0e49af1ea7803fb056c614b09921a9d | https://github.com/Gelembjuk/mail/blob/c2dfa5aee0e49af1ea7803fb056c614b09921a9d/src/Gelembjuk/Mail/EmailFormat.php#L261-L298 |
10,110 | Gelembjuk/mail | src/Gelembjuk/Mail/EmailFormat.php | EmailFormat.getOutTemplate | protected function getOutTemplate($template = 'default') {
// check for current locale
if ($this->locale != '') {
$templatefile = $this->templatespath.'/'.$this->locale.'/'.$this->outtemplateprefix.$template.'.htm';
if (file_exists($templatefile)) {
return $this->locale.'/'.$this->outtemplateprefix.$template;
}
}
// if not found, check for default locale
if ($this->deflocale != '') {
$templatefile = $this->templatespath.'/'.$this->deflocale.'/'.$this->outtemplateprefix.$template.'.htm';
if (file_exists($templatefile)) {
return $this->deflocale.'/'.$this->outtemplateprefix.$template;
}
}
// if not found then check in root
$templatefile = $this->templatespath.'/'.$this->outtemplateprefix.$template.'.htm';
if (file_exists($templatefile)) {
return $this->outtemplateprefix.$template;
}
// out template not found
return null;
} | php | protected function getOutTemplate($template = 'default') {
// check for current locale
if ($this->locale != '') {
$templatefile = $this->templatespath.'/'.$this->locale.'/'.$this->outtemplateprefix.$template.'.htm';
if (file_exists($templatefile)) {
return $this->locale.'/'.$this->outtemplateprefix.$template;
}
}
// if not found, check for default locale
if ($this->deflocale != '') {
$templatefile = $this->templatespath.'/'.$this->deflocale.'/'.$this->outtemplateprefix.$template.'.htm';
if (file_exists($templatefile)) {
return $this->deflocale.'/'.$this->outtemplateprefix.$template;
}
}
// if not found then check in root
$templatefile = $this->templatespath.'/'.$this->outtemplateprefix.$template.'.htm';
if (file_exists($templatefile)) {
return $this->outtemplateprefix.$template;
}
// out template not found
return null;
} | [
"protected",
"function",
"getOutTemplate",
"(",
"$",
"template",
"=",
"'default'",
")",
"{",
"// check for current locale",
"if",
"(",
"$",
"this",
"->",
"locale",
"!=",
"''",
")",
"{",
"$",
"templatefile",
"=",
"$",
"this",
"->",
"templatespath",
".",
"'/'",
".",
"$",
"this",
"->",
"locale",
".",
"'/'",
".",
"$",
"this",
"->",
"outtemplateprefix",
".",
"$",
"template",
".",
"'.htm'",
";",
"if",
"(",
"file_exists",
"(",
"$",
"templatefile",
")",
")",
"{",
"return",
"$",
"this",
"->",
"locale",
".",
"'/'",
".",
"$",
"this",
"->",
"outtemplateprefix",
".",
"$",
"template",
";",
"}",
"}",
"// if not found, check for default locale",
"if",
"(",
"$",
"this",
"->",
"deflocale",
"!=",
"''",
")",
"{",
"$",
"templatefile",
"=",
"$",
"this",
"->",
"templatespath",
".",
"'/'",
".",
"$",
"this",
"->",
"deflocale",
".",
"'/'",
".",
"$",
"this",
"->",
"outtemplateprefix",
".",
"$",
"template",
".",
"'.htm'",
";",
"if",
"(",
"file_exists",
"(",
"$",
"templatefile",
")",
")",
"{",
"return",
"$",
"this",
"->",
"deflocale",
".",
"'/'",
".",
"$",
"this",
"->",
"outtemplateprefix",
".",
"$",
"template",
";",
"}",
"}",
"// if not found then check in root",
"$",
"templatefile",
"=",
"$",
"this",
"->",
"templatespath",
".",
"'/'",
".",
"$",
"this",
"->",
"outtemplateprefix",
".",
"$",
"template",
".",
"'.htm'",
";",
"if",
"(",
"file_exists",
"(",
"$",
"templatefile",
")",
")",
"{",
"return",
"$",
"this",
"->",
"outtemplateprefix",
".",
"$",
"template",
";",
"}",
"// out template not found",
"return",
"null",
";",
"}"
] | Return template file for out template
@param string $template Out template name without a prefix
@return string Template file relative path | [
"Return",
"template",
"file",
"for",
"out",
"template"
] | c2dfa5aee0e49af1ea7803fb056c614b09921a9d | https://github.com/Gelembjuk/mail/blob/c2dfa5aee0e49af1ea7803fb056c614b09921a9d/src/Gelembjuk/Mail/EmailFormat.php#L306-L334 |
10,111 | ForceLabsDev/framework | src/Mvc/Controller.php | Controller.view | protected function view($file, array $params = []): TwigRenderer
{
$this->eventHandler->trigger(BeforeLoadView::class, [
'file' => $file,
'params' => $params,
]);
/** @var TwigRenderer $renderer */
$renderer = $this->app->make(TwigRenderer::class);
return $renderer->loadWithController($this, $file, $params);
} | php | protected function view($file, array $params = []): TwigRenderer
{
$this->eventHandler->trigger(BeforeLoadView::class, [
'file' => $file,
'params' => $params,
]);
/** @var TwigRenderer $renderer */
$renderer = $this->app->make(TwigRenderer::class);
return $renderer->loadWithController($this, $file, $params);
} | [
"protected",
"function",
"view",
"(",
"$",
"file",
",",
"array",
"$",
"params",
"=",
"[",
"]",
")",
":",
"TwigRenderer",
"{",
"$",
"this",
"->",
"eventHandler",
"->",
"trigger",
"(",
"BeforeLoadView",
"::",
"class",
",",
"[",
"'file'",
"=>",
"$",
"file",
",",
"'params'",
"=>",
"$",
"params",
",",
"]",
")",
";",
"/** @var TwigRenderer $renderer */",
"$",
"renderer",
"=",
"$",
"this",
"->",
"app",
"->",
"make",
"(",
"TwigRenderer",
"::",
"class",
")",
";",
"return",
"$",
"renderer",
"->",
"loadWithController",
"(",
"$",
"this",
",",
"$",
"file",
",",
"$",
"params",
")",
";",
"}"
] | Loads the given view file with the given parameters.
@param string $file
@param array $params
@return TwigRenderer | [
"Loads",
"the",
"given",
"view",
"file",
"with",
"the",
"given",
"parameters",
"."
] | e2288582432857771e85c9859acd6d32e5f2f9b7 | https://github.com/ForceLabsDev/framework/blob/e2288582432857771e85c9859acd6d32e5f2f9b7/src/Mvc/Controller.php#L45-L56 |
10,112 | douyacun/dyc-pay | src/Gateways/Wechat/Gateway.php | Gateway.preOrder | protected function preOrder($endpoint, $payload): Collection
{
$payload['sign'] = Support::generateSign($payload, $this->config->get('key'));
Log::debug('Pre Order:', [$endpoint, $payload]);
return Support::requestApi($endpoint, $payload, $this->config->get('key'));
} | php | protected function preOrder($endpoint, $payload): Collection
{
$payload['sign'] = Support::generateSign($payload, $this->config->get('key'));
Log::debug('Pre Order:', [$endpoint, $payload]);
return Support::requestApi($endpoint, $payload, $this->config->get('key'));
} | [
"protected",
"function",
"preOrder",
"(",
"$",
"endpoint",
",",
"$",
"payload",
")",
":",
"Collection",
"{",
"$",
"payload",
"[",
"'sign'",
"]",
"=",
"Support",
"::",
"generateSign",
"(",
"$",
"payload",
",",
"$",
"this",
"->",
"config",
"->",
"get",
"(",
"'key'",
")",
")",
";",
"Log",
"::",
"debug",
"(",
"'Pre Order:'",
",",
"[",
"$",
"endpoint",
",",
"$",
"payload",
"]",
")",
";",
"return",
"Support",
"::",
"requestApi",
"(",
"$",
"endpoint",
",",
"$",
"payload",
",",
"$",
"this",
"->",
"config",
"->",
"get",
"(",
"'key'",
")",
")",
";",
"}"
] | Preorder an order.
@author yansongda <[email protected]>
@param string $endpoint
@param array $payload
@return Collection | [
"Preorder",
"an",
"order",
"."
] | 9fac85d375bdd52b872c3fa8174920e40609f6f2 | https://github.com/douyacun/dyc-pay/blob/9fac85d375bdd52b872c3fa8174920e40609f6f2/src/Gateways/Wechat/Gateway.php#L71-L78 |
10,113 | tekkla/core-html | Core/Html/Controls/OptionGroup.php | OptionGroup.& | public function &createOption($text = '', $value = '')
{
$option = $this->factory->create('Form\Checkbox');
if ($text) {
$option->setInner($text);
}
if ($value) {
$option->setValue($value);
}
$this->controls[] = $option;
return $option;
} | php | public function &createOption($text = '', $value = '')
{
$option = $this->factory->create('Form\Checkbox');
if ($text) {
$option->setInner($text);
}
if ($value) {
$option->setValue($value);
}
$this->controls[] = $option;
return $option;
} | [
"public",
"function",
"&",
"createOption",
"(",
"$",
"text",
"=",
"''",
",",
"$",
"value",
"=",
"''",
")",
"{",
"$",
"option",
"=",
"$",
"this",
"->",
"factory",
"->",
"create",
"(",
"'Form\\Checkbox'",
")",
";",
"if",
"(",
"$",
"text",
")",
"{",
"$",
"option",
"->",
"setInner",
"(",
"$",
"text",
")",
";",
"}",
"if",
"(",
"$",
"value",
")",
"{",
"$",
"option",
"->",
"setValue",
"(",
"$",
"value",
")",
";",
"}",
"$",
"this",
"->",
"controls",
"[",
"]",
"=",
"$",
"option",
";",
"return",
"$",
"option",
";",
"}"
] | Add an option to the optionslist and returns a reference to it.
@return \Core\Html\Form\Checkbox | [
"Add",
"an",
"option",
"to",
"the",
"optionslist",
"and",
"returns",
"a",
"reference",
"to",
"it",
"."
] | 00bf3fa8e060e8aadf1c341f6e3c548c7a76cfd3 | https://github.com/tekkla/core-html/blob/00bf3fa8e060e8aadf1c341f6e3c548c7a76cfd3/Core/Html/Controls/OptionGroup.php#L28-L43 |
10,114 | gios-asu/nectary | src/daos/sql-query-builder.php | Select_SQL_Query_Builder.limit | public function limit( $new_limit ) {
$this->limit = $new_limit;
if ( false === starts_with( $new_limit . '', ':' ) ) {
$this->limit = (int) $new_limit;
}
} | php | public function limit( $new_limit ) {
$this->limit = $new_limit;
if ( false === starts_with( $new_limit . '', ':' ) ) {
$this->limit = (int) $new_limit;
}
} | [
"public",
"function",
"limit",
"(",
"$",
"new_limit",
")",
"{",
"$",
"this",
"->",
"limit",
"=",
"$",
"new_limit",
";",
"if",
"(",
"false",
"===",
"starts_with",
"(",
"$",
"new_limit",
".",
"''",
",",
"':'",
")",
")",
"{",
"$",
"this",
"->",
"limit",
"=",
"(",
"int",
")",
"$",
"new_limit",
";",
"}",
"}"
] | For setting a limit on the query other than the default
@param int|string $new_limit | [
"For",
"setting",
"a",
"limit",
"on",
"the",
"query",
"other",
"than",
"the",
"default"
] | f972c737a9036a3090652950a1309a62c07d86c0 | https://github.com/gios-asu/nectary/blob/f972c737a9036a3090652950a1309a62c07d86c0/src/daos/sql-query-builder.php#L78-L83 |
10,115 | gios-asu/nectary | src/daos/sql-query-builder.php | Select_SQL_Query_Builder.offset | public function offset( $offset ) {
$this->offset = $offset;
if ( false === starts_with( $offset . '', ':' ) ) {
$this->offset = (int) $offset;
}
} | php | public function offset( $offset ) {
$this->offset = $offset;
if ( false === starts_with( $offset . '', ':' ) ) {
$this->offset = (int) $offset;
}
} | [
"public",
"function",
"offset",
"(",
"$",
"offset",
")",
"{",
"$",
"this",
"->",
"offset",
"=",
"$",
"offset",
";",
"if",
"(",
"false",
"===",
"starts_with",
"(",
"$",
"offset",
".",
"''",
",",
"':'",
")",
")",
"{",
"$",
"this",
"->",
"offset",
"=",
"(",
"int",
")",
"$",
"offset",
";",
"}",
"}"
] | For setting a offset on the query other than the default
@param int|string $offset | [
"For",
"setting",
"a",
"offset",
"on",
"the",
"query",
"other",
"than",
"the",
"default"
] | f972c737a9036a3090652950a1309a62c07d86c0 | https://github.com/gios-asu/nectary/blob/f972c737a9036a3090652950a1309a62c07d86c0/src/daos/sql-query-builder.php#L90-L95 |
10,116 | gios-asu/nectary | src/daos/sql-query-builder.php | Select_SQL_Query_Builder.bind_value | public function bind_value( string $name, $value, $data_type = false ) {
$this->values_to_bind[ $name ] = array(
'value' => $value,
'data_type' => $data_type,
);
} | php | public function bind_value( string $name, $value, $data_type = false ) {
$this->values_to_bind[ $name ] = array(
'value' => $value,
'data_type' => $data_type,
);
} | [
"public",
"function",
"bind_value",
"(",
"string",
"$",
"name",
",",
"$",
"value",
",",
"$",
"data_type",
"=",
"false",
")",
"{",
"$",
"this",
"->",
"values_to_bind",
"[",
"$",
"name",
"]",
"=",
"array",
"(",
"'value'",
"=>",
"$",
"value",
",",
"'data_type'",
"=>",
"$",
"data_type",
",",
")",
";",
"}"
] | Adds a variable to be bound to in the prepared statement
@param string $name
@param mixed $value
@param bool|string $data_type | [
"Adds",
"a",
"variable",
"to",
"be",
"bound",
"to",
"in",
"the",
"prepared",
"statement"
] | f972c737a9036a3090652950a1309a62c07d86c0 | https://github.com/gios-asu/nectary/blob/f972c737a9036a3090652950a1309a62c07d86c0/src/daos/sql-query-builder.php#L150-L155 |
10,117 | gios-asu/nectary | src/daos/sql-query-builder.php | Select_SQL_Query_Builder.get_sql | public function get_sql() : string {
if ( empty( $this->columns_to_select ) ) {
// this should be the default behavior
$this->columns_to_select = [ '*' ];
}
$from = ' FROM ' . implode( ', ', $this->from ) . ' ';
if ( ! empty( $this->joins ) ) {
$from .= $this->joins;
}
$from .= 'WHERE ' . $this->where_clause;
$select = 'SELECT ' . implode( ', ', $this->columns_to_select ) . $from;
if ( ! empty( $this->group_by ) ) {
$select .= 'GROUP BY ' . implode( ', ', $this->group_by ) . ' ';
}
if ( $this->order_by !== '' ) {
$select .= 'ORDER BY ' . $this->order_by . ' ';
}
$select .= 'LIMIT ' . $this->limit;
if ( $this->offset !== '' ) {
$select .= ' OFFSET ' . $this->offset;
}
return $select;
} | php | public function get_sql() : string {
if ( empty( $this->columns_to_select ) ) {
// this should be the default behavior
$this->columns_to_select = [ '*' ];
}
$from = ' FROM ' . implode( ', ', $this->from ) . ' ';
if ( ! empty( $this->joins ) ) {
$from .= $this->joins;
}
$from .= 'WHERE ' . $this->where_clause;
$select = 'SELECT ' . implode( ', ', $this->columns_to_select ) . $from;
if ( ! empty( $this->group_by ) ) {
$select .= 'GROUP BY ' . implode( ', ', $this->group_by ) . ' ';
}
if ( $this->order_by !== '' ) {
$select .= 'ORDER BY ' . $this->order_by . ' ';
}
$select .= 'LIMIT ' . $this->limit;
if ( $this->offset !== '' ) {
$select .= ' OFFSET ' . $this->offset;
}
return $select;
} | [
"public",
"function",
"get_sql",
"(",
")",
":",
"string",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"columns_to_select",
")",
")",
"{",
"// this should be the default behavior",
"$",
"this",
"->",
"columns_to_select",
"=",
"[",
"'*'",
"]",
";",
"}",
"$",
"from",
"=",
"' FROM '",
".",
"implode",
"(",
"', '",
",",
"$",
"this",
"->",
"from",
")",
".",
"' '",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"joins",
")",
")",
"{",
"$",
"from",
".=",
"$",
"this",
"->",
"joins",
";",
"}",
"$",
"from",
".=",
"'WHERE '",
".",
"$",
"this",
"->",
"where_clause",
";",
"$",
"select",
"=",
"'SELECT '",
".",
"implode",
"(",
"', '",
",",
"$",
"this",
"->",
"columns_to_select",
")",
".",
"$",
"from",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"group_by",
")",
")",
"{",
"$",
"select",
".=",
"'GROUP BY '",
".",
"implode",
"(",
"', '",
",",
"$",
"this",
"->",
"group_by",
")",
".",
"' '",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"order_by",
"!==",
"''",
")",
"{",
"$",
"select",
".=",
"'ORDER BY '",
".",
"$",
"this",
"->",
"order_by",
".",
"' '",
";",
"}",
"$",
"select",
".=",
"'LIMIT '",
".",
"$",
"this",
"->",
"limit",
";",
"if",
"(",
"$",
"this",
"->",
"offset",
"!==",
"''",
")",
"{",
"$",
"select",
".=",
"' OFFSET '",
".",
"$",
"this",
"->",
"offset",
";",
"}",
"return",
"$",
"select",
";",
"}"
] | Uses the current state of the object to build the sql statement
@return string : the sql select statement as a string | [
"Uses",
"the",
"current",
"state",
"of",
"the",
"object",
"to",
"build",
"the",
"sql",
"statement"
] | f972c737a9036a3090652950a1309a62c07d86c0 | https://github.com/gios-asu/nectary/blob/f972c737a9036a3090652950a1309a62c07d86c0/src/daos/sql-query-builder.php#L162-L192 |
10,118 | orkestra/orkestra-transactor | lib/Orkestra/Transactor/AbstractTransactor.php | AbstractTransactor.supportsType | public function supportsType(Transaction\TransactionType $type = null)
{
return in_array((null === $type ? null : $type->getValue()), static::$supportedTypes);
} | php | public function supportsType(Transaction\TransactionType $type = null)
{
return in_array((null === $type ? null : $type->getValue()), static::$supportedTypes);
} | [
"public",
"function",
"supportsType",
"(",
"Transaction",
"\\",
"TransactionType",
"$",
"type",
"=",
"null",
")",
"{",
"return",
"in_array",
"(",
"(",
"null",
"===",
"$",
"type",
"?",
"null",
":",
"$",
"type",
"->",
"getValue",
"(",
")",
")",
",",
"static",
"::",
"$",
"supportedTypes",
")",
";",
"}"
] | Returns true if this Transactor supports a given Transaction type
@param \Orkestra\Transactor\Entity\Transaction\TransactionType|null $type
@return boolean True if supported | [
"Returns",
"true",
"if",
"this",
"Transactor",
"supports",
"a",
"given",
"Transaction",
"type"
] | 0edaeb756f22c2d25d6fa2da4793df9b343f8811 | https://github.com/orkestra/orkestra-transactor/blob/0edaeb756f22c2d25d6fa2da4793df9b343f8811/lib/Orkestra/Transactor/AbstractTransactor.php#L136-L139 |
10,119 | orkestra/orkestra-transactor | lib/Orkestra/Transactor/AbstractTransactor.php | AbstractTransactor.supportsNetwork | public function supportsNetwork(Transaction\NetworkType $network = null)
{
return in_array((null === $network ? null : $network->getValue()), static::$supportedNetworks);
} | php | public function supportsNetwork(Transaction\NetworkType $network = null)
{
return in_array((null === $network ? null : $network->getValue()), static::$supportedNetworks);
} | [
"public",
"function",
"supportsNetwork",
"(",
"Transaction",
"\\",
"NetworkType",
"$",
"network",
"=",
"null",
")",
"{",
"return",
"in_array",
"(",
"(",
"null",
"===",
"$",
"network",
"?",
"null",
":",
"$",
"network",
"->",
"getValue",
"(",
")",
")",
",",
"static",
"::",
"$",
"supportedNetworks",
")",
";",
"}"
] | Returns true if this Transactor supports a given Network type
@param \Orkestra\Transactor\Entity\Transaction\NetworkType|null $network
@return boolean True if supported | [
"Returns",
"true",
"if",
"this",
"Transactor",
"supports",
"a",
"given",
"Network",
"type"
] | 0edaeb756f22c2d25d6fa2da4793df9b343f8811 | https://github.com/orkestra/orkestra-transactor/blob/0edaeb756f22c2d25d6fa2da4793df9b343f8811/lib/Orkestra/Transactor/AbstractTransactor.php#L148-L151 |
10,120 | the-kbA-team/typecast | src/TypeCastArray.php | TypeCastArray.cast | public function cast($array)
{
if (!is_array($array)) {
throw new \InvalidArgumentException(sprintf('Expected an array, but got %s!', gettype($array)));
}
foreach ($array as $key => $value) {
//is this a repeating array?
$mapKey = $this->mapKey($key);
//try to cast the value
try {
$array[$key] = $this[$mapKey]->cast($value);
} catch (KeyNotFoundException $knfex) {
//no key, no typecast, nothing happened.
} catch (\InvalidArgumentException $iaex) {
//unexpected value
throw new \InvalidArgumentException(
sprintf(
'Unexpected value for key %s: %s',
$key,
$iaex->getMessage()
),
0,
$iaex
);
}
}
return $array;
} | php | public function cast($array)
{
if (!is_array($array)) {
throw new \InvalidArgumentException(sprintf('Expected an array, but got %s!', gettype($array)));
}
foreach ($array as $key => $value) {
//is this a repeating array?
$mapKey = $this->mapKey($key);
//try to cast the value
try {
$array[$key] = $this[$mapKey]->cast($value);
} catch (KeyNotFoundException $knfex) {
//no key, no typecast, nothing happened.
} catch (\InvalidArgumentException $iaex) {
//unexpected value
throw new \InvalidArgumentException(
sprintf(
'Unexpected value for key %s: %s',
$key,
$iaex->getMessage()
),
0,
$iaex
);
}
}
return $array;
} | [
"public",
"function",
"cast",
"(",
"$",
"array",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"array",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"sprintf",
"(",
"'Expected an array, but got %s!'",
",",
"gettype",
"(",
"$",
"array",
")",
")",
")",
";",
"}",
"foreach",
"(",
"$",
"array",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"//is this a repeating array?",
"$",
"mapKey",
"=",
"$",
"this",
"->",
"mapKey",
"(",
"$",
"key",
")",
";",
"//try to cast the value",
"try",
"{",
"$",
"array",
"[",
"$",
"key",
"]",
"=",
"$",
"this",
"[",
"$",
"mapKey",
"]",
"->",
"cast",
"(",
"$",
"value",
")",
";",
"}",
"catch",
"(",
"KeyNotFoundException",
"$",
"knfex",
")",
"{",
"//no key, no typecast, nothing happened.",
"}",
"catch",
"(",
"\\",
"InvalidArgumentException",
"$",
"iaex",
")",
"{",
"//unexpected value",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"sprintf",
"(",
"'Unexpected value for key %s: %s'",
",",
"$",
"key",
",",
"$",
"iaex",
"->",
"getMessage",
"(",
")",
")",
",",
"0",
",",
"$",
"iaex",
")",
";",
"}",
"}",
"return",
"$",
"array",
";",
"}"
] | Cast the values of the given array to the typecast information defined in this
class.
@param array $array The raw data to be typecasted.
@return array The same data structure as the input, but casted to the
typecasting information defined in this
class.
@throws \InvalidArgumentException in case the given value does not match the
typecasting information defined in this
class. | [
"Cast",
"the",
"values",
"of",
"the",
"given",
"array",
"to",
"the",
"typecast",
"information",
"defined",
"in",
"this",
"class",
"."
] | 89939ad0dbf92f6ef09c48764347f473d51e8786 | https://github.com/the-kbA-team/typecast/blob/89939ad0dbf92f6ef09c48764347f473d51e8786/src/TypeCastArray.php#L85-L112 |
10,121 | samurai-fw/samurai | src/Samurai/Component/Migration/Helper.php | Helper.getSchemaFile | public function getSchemaFile($database)
{
$dir = $this->loader->find($this->application->config('directory.database.schema'))->first();
return $dir . DS . $this->schemaFileNameStrategy($database);
} | php | public function getSchemaFile($database)
{
$dir = $this->loader->find($this->application->config('directory.database.schema'))->first();
return $dir . DS . $this->schemaFileNameStrategy($database);
} | [
"public",
"function",
"getSchemaFile",
"(",
"$",
"database",
")",
"{",
"$",
"dir",
"=",
"$",
"this",
"->",
"loader",
"->",
"find",
"(",
"$",
"this",
"->",
"application",
"->",
"config",
"(",
"'directory.database.schema'",
")",
")",
"->",
"first",
"(",
")",
";",
"return",
"$",
"dir",
".",
"DS",
".",
"$",
"this",
"->",
"schemaFileNameStrategy",
"(",
"$",
"database",
")",
";",
"}"
] | get schema file
@param string $database
@return string | [
"get",
"schema",
"file"
] | 7ca3847b13f86e2847a17ab5e8e4e20893021d5a | https://github.com/samurai-fw/samurai/blob/7ca3847b13f86e2847a17ab5e8e4e20893021d5a/src/Samurai/Component/Migration/Helper.php#L115-L119 |
10,122 | samurai-fw/samurai | src/Samurai/Component/Migration/Helper.php | Helper.getSchemaYAMLFile | public function getSchemaYAMLFile($database)
{
$dir = $this->loader->find($this->application->config('directory.database.schema'))->first();
return $dir . DS . $this->schemaYAMLFileNameStrategy($database);
} | php | public function getSchemaYAMLFile($database)
{
$dir = $this->loader->find($this->application->config('directory.database.schema'))->first();
return $dir . DS . $this->schemaYAMLFileNameStrategy($database);
} | [
"public",
"function",
"getSchemaYAMLFile",
"(",
"$",
"database",
")",
"{",
"$",
"dir",
"=",
"$",
"this",
"->",
"loader",
"->",
"find",
"(",
"$",
"this",
"->",
"application",
"->",
"config",
"(",
"'directory.database.schema'",
")",
")",
"->",
"first",
"(",
")",
";",
"return",
"$",
"dir",
".",
"DS",
".",
"$",
"this",
"->",
"schemaYAMLFileNameStrategy",
"(",
"$",
"database",
")",
";",
"}"
] | get schema yaml file
@param string $database
@return string | [
"get",
"schema",
"yaml",
"file"
] | 7ca3847b13f86e2847a17ab5e8e4e20893021d5a | https://github.com/samurai-fw/samurai/blob/7ca3847b13f86e2847a17ab5e8e4e20893021d5a/src/Samurai/Component/Migration/Helper.php#L128-L132 |
10,123 | imsamurai/cakephp-task-plugin | Lib/Task/TaskRunner.php | TaskRunner.start | public function start() {
ConnectionManager::getDataSource($this->_TaskServer->useDbConfig)->reconnect(array('persistent' => false));
$this->_Shell->out("Task #{$this->_task['id']} started");
$this->_task['started'] = $this->_getCurrentDateTime();
$this->_task['stderr'] = '';
$this->_task['stdout'] = '';
$this->_TaskServer->started($this->_task);
$this->_run();
return $this->_task;
} | php | public function start() {
ConnectionManager::getDataSource($this->_TaskServer->useDbConfig)->reconnect(array('persistent' => false));
$this->_Shell->out("Task #{$this->_task['id']} started");
$this->_task['started'] = $this->_getCurrentDateTime();
$this->_task['stderr'] = '';
$this->_task['stdout'] = '';
$this->_TaskServer->started($this->_task);
$this->_run();
return $this->_task;
} | [
"public",
"function",
"start",
"(",
")",
"{",
"ConnectionManager",
"::",
"getDataSource",
"(",
"$",
"this",
"->",
"_TaskServer",
"->",
"useDbConfig",
")",
"->",
"reconnect",
"(",
"array",
"(",
"'persistent'",
"=>",
"false",
")",
")",
";",
"$",
"this",
"->",
"_Shell",
"->",
"out",
"(",
"\"Task #{$this->_task['id']} started\"",
")",
";",
"$",
"this",
"->",
"_task",
"[",
"'started'",
"]",
"=",
"$",
"this",
"->",
"_getCurrentDateTime",
"(",
")",
";",
"$",
"this",
"->",
"_task",
"[",
"'stderr'",
"]",
"=",
"''",
";",
"$",
"this",
"->",
"_task",
"[",
"'stdout'",
"]",
"=",
"''",
";",
"$",
"this",
"->",
"_TaskServer",
"->",
"started",
"(",
"$",
"this",
"->",
"_task",
")",
";",
"$",
"this",
"->",
"_run",
"(",
")",
";",
"return",
"$",
"this",
"->",
"_task",
";",
"}"
] | Notify client about started task and run this task | [
"Notify",
"client",
"about",
"started",
"task",
"and",
"run",
"this",
"task"
] | 9d7bd9fa908abf0ae5c24f27aa829a39ac034961 | https://github.com/imsamurai/cakephp-task-plugin/blob/9d7bd9fa908abf0ae5c24f27aa829a39ac034961/Lib/Task/TaskRunner.php#L87-L96 |
10,124 | imsamurai/cakephp-task-plugin | Lib/Task/TaskRunner.php | TaskRunner._stopped | protected function _stopped($manual = false) {
$this->_task = array(
'stdout' => $this->_Process->getOutput(),
'stderr' => $this->_Process->getErrorOutput(),
'stopped' => $this->_getCurrentDateTime(),
'process_id' => 0,
) + $this->_task;
$this->_TaskServer->stopped($this->_task, $manual);
$this->_Shell->out("Task #{$this->_task['id']} stopped, code " . (string)$this->_task['code']);
} | php | protected function _stopped($manual = false) {
$this->_task = array(
'stdout' => $this->_Process->getOutput(),
'stderr' => $this->_Process->getErrorOutput(),
'stopped' => $this->_getCurrentDateTime(),
'process_id' => 0,
) + $this->_task;
$this->_TaskServer->stopped($this->_task, $manual);
$this->_Shell->out("Task #{$this->_task['id']} stopped, code " . (string)$this->_task['code']);
} | [
"protected",
"function",
"_stopped",
"(",
"$",
"manual",
"=",
"false",
")",
"{",
"$",
"this",
"->",
"_task",
"=",
"array",
"(",
"'stdout'",
"=>",
"$",
"this",
"->",
"_Process",
"->",
"getOutput",
"(",
")",
",",
"'stderr'",
"=>",
"$",
"this",
"->",
"_Process",
"->",
"getErrorOutput",
"(",
")",
",",
"'stopped'",
"=>",
"$",
"this",
"->",
"_getCurrentDateTime",
"(",
")",
",",
"'process_id'",
"=>",
"0",
",",
")",
"+",
"$",
"this",
"->",
"_task",
";",
"$",
"this",
"->",
"_TaskServer",
"->",
"stopped",
"(",
"$",
"this",
"->",
"_task",
",",
"$",
"manual",
")",
";",
"$",
"this",
"->",
"_Shell",
"->",
"out",
"(",
"\"Task #{$this->_task['id']} stopped, code \"",
".",
"(",
"string",
")",
"$",
"this",
"->",
"_task",
"[",
"'code'",
"]",
")",
";",
"}"
] | Notify client about stopped task
@param bool $manual True means process stopped manually | [
"Notify",
"client",
"about",
"stopped",
"task"
] | 9d7bd9fa908abf0ae5c24f27aa829a39ac034961 | https://github.com/imsamurai/cakephp-task-plugin/blob/9d7bd9fa908abf0ae5c24f27aa829a39ac034961/Lib/Task/TaskRunner.php#L103-L112 |
10,125 | imsamurai/cakephp-task-plugin | Lib/Task/TaskRunner.php | TaskRunner._argsToString | protected function _argsToString(array $arguments) {
$stringArguments = '';
foreach ($arguments as $name => $value) {
if (is_numeric($name)) {
$stringArguments .= ' ' . $value;
} else {
$stringArguments .= ' ' . $name . ' ' . ProcessUtils::escapeArgument($value);
}
}
return $stringArguments;
} | php | protected function _argsToString(array $arguments) {
$stringArguments = '';
foreach ($arguments as $name => $value) {
if (is_numeric($name)) {
$stringArguments .= ' ' . $value;
} else {
$stringArguments .= ' ' . $name . ' ' . ProcessUtils::escapeArgument($value);
}
}
return $stringArguments;
} | [
"protected",
"function",
"_argsToString",
"(",
"array",
"$",
"arguments",
")",
"{",
"$",
"stringArguments",
"=",
"''",
";",
"foreach",
"(",
"$",
"arguments",
"as",
"$",
"name",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"is_numeric",
"(",
"$",
"name",
")",
")",
"{",
"$",
"stringArguments",
".=",
"' '",
".",
"$",
"value",
";",
"}",
"else",
"{",
"$",
"stringArguments",
".=",
"' '",
".",
"$",
"name",
".",
"' '",
".",
"ProcessUtils",
"::",
"escapeArgument",
"(",
"$",
"value",
")",
";",
"}",
"}",
"return",
"$",
"stringArguments",
";",
"}"
] | Convert array of arguments into string
@param array $arguments
@return string | [
"Convert",
"array",
"of",
"arguments",
"into",
"string"
] | 9d7bd9fa908abf0ae5c24f27aa829a39ac034961 | https://github.com/imsamurai/cakephp-task-plugin/blob/9d7bd9fa908abf0ae5c24f27aa829a39ac034961/Lib/Task/TaskRunner.php#L161-L172 |
10,126 | GroundSix/password | src/PasswordValidator.php | PasswordValidator.validate | public function validate(string $password): bool
{
foreach ($this->validators as $validator) {
$validator->validate($password);
}
return true;
} | php | public function validate(string $password): bool
{
foreach ($this->validators as $validator) {
$validator->validate($password);
}
return true;
} | [
"public",
"function",
"validate",
"(",
"string",
"$",
"password",
")",
":",
"bool",
"{",
"foreach",
"(",
"$",
"this",
"->",
"validators",
"as",
"$",
"validator",
")",
"{",
"$",
"validator",
"->",
"validate",
"(",
"$",
"password",
")",
";",
"}",
"return",
"true",
";",
"}"
] | Validates the given password against the current rule set.
@param string $password
@return bool True if the password is valid
@throws PasswordException If the password fails a validation attempt. | [
"Validates",
"the",
"given",
"password",
"against",
"the",
"current",
"rule",
"set",
"."
] | 83241a362051c28f09cd7cdcd0fbd03918ce0a5b | https://github.com/GroundSix/password/blob/83241a362051c28f09cd7cdcd0fbd03918ce0a5b/src/PasswordValidator.php#L45-L52 |
10,127 | jianfengye/hades | src/Hades/Container/Container.php | Container.bind | public function bind($contract, $class, $args = [])
{
$closure = function($class, $args) {
$reflect = new \ReflectionClass($class);
return $reflect->newInstanceArgs($args);
};
$this->bindings[$contract] = [
'type' => 'closure',
'closure' => $closure,
'class' => $class,
'args' => $args
];
if (!class_exists($contract, false)) {
eval("class {$contract} extends \Hades\Container\Facade {} ");
}
} | php | public function bind($contract, $class, $args = [])
{
$closure = function($class, $args) {
$reflect = new \ReflectionClass($class);
return $reflect->newInstanceArgs($args);
};
$this->bindings[$contract] = [
'type' => 'closure',
'closure' => $closure,
'class' => $class,
'args' => $args
];
if (!class_exists($contract, false)) {
eval("class {$contract} extends \Hades\Container\Facade {} ");
}
} | [
"public",
"function",
"bind",
"(",
"$",
"contract",
",",
"$",
"class",
",",
"$",
"args",
"=",
"[",
"]",
")",
"{",
"$",
"closure",
"=",
"function",
"(",
"$",
"class",
",",
"$",
"args",
")",
"{",
"$",
"reflect",
"=",
"new",
"\\",
"ReflectionClass",
"(",
"$",
"class",
")",
";",
"return",
"$",
"reflect",
"->",
"newInstanceArgs",
"(",
"$",
"args",
")",
";",
"}",
";",
"$",
"this",
"->",
"bindings",
"[",
"$",
"contract",
"]",
"=",
"[",
"'type'",
"=>",
"'closure'",
",",
"'closure'",
"=>",
"$",
"closure",
",",
"'class'",
"=>",
"$",
"class",
",",
"'args'",
"=>",
"$",
"args",
"]",
";",
"if",
"(",
"!",
"class_exists",
"(",
"$",
"contract",
",",
"false",
")",
")",
"{",
"eval",
"(",
"\"class {$contract} extends \\Hades\\Container\\Facade {} \"",
")",
";",
"}",
"}"
] | the class will have new instance when use | [
"the",
"class",
"will",
"have",
"new",
"instance",
"when",
"use"
] | a0690d96dada070b4cf4b9ff63ab3aa024c34a67 | https://github.com/jianfengye/hades/blob/a0690d96dada070b4cf4b9ff63ab3aa024c34a67/src/Hades/Container/Container.php#L48-L65 |
10,128 | jianfengye/hades | src/Hades/Container/Container.php | Container.singleton | public function singleton($contract, $class, $args = [])
{
$reflect = new \ReflectionClass($class);
$instance = $reflect->newInstanceArgs($args);
$this->bindings[$contract] = [
'type' => 'singleton',
'instance' => $instance,
'class' => $class,
'args' => $args
];
if (!class_exists($contract, false)) {
eval("class {$contract} extends \Hades\Container\Facade {} ");
}
} | php | public function singleton($contract, $class, $args = [])
{
$reflect = new \ReflectionClass($class);
$instance = $reflect->newInstanceArgs($args);
$this->bindings[$contract] = [
'type' => 'singleton',
'instance' => $instance,
'class' => $class,
'args' => $args
];
if (!class_exists($contract, false)) {
eval("class {$contract} extends \Hades\Container\Facade {} ");
}
} | [
"public",
"function",
"singleton",
"(",
"$",
"contract",
",",
"$",
"class",
",",
"$",
"args",
"=",
"[",
"]",
")",
"{",
"$",
"reflect",
"=",
"new",
"\\",
"ReflectionClass",
"(",
"$",
"class",
")",
";",
"$",
"instance",
"=",
"$",
"reflect",
"->",
"newInstanceArgs",
"(",
"$",
"args",
")",
";",
"$",
"this",
"->",
"bindings",
"[",
"$",
"contract",
"]",
"=",
"[",
"'type'",
"=>",
"'singleton'",
",",
"'instance'",
"=>",
"$",
"instance",
",",
"'class'",
"=>",
"$",
"class",
",",
"'args'",
"=>",
"$",
"args",
"]",
";",
"if",
"(",
"!",
"class_exists",
"(",
"$",
"contract",
",",
"false",
")",
")",
"{",
"eval",
"(",
"\"class {$contract} extends \\Hades\\Container\\Facade {} \"",
")",
";",
"}",
"}"
] | the class will instance one time when use | [
"the",
"class",
"will",
"instance",
"one",
"time",
"when",
"use"
] | a0690d96dada070b4cf4b9ff63ab3aa024c34a67 | https://github.com/jianfengye/hades/blob/a0690d96dada070b4cf4b9ff63ab3aa024c34a67/src/Hades/Container/Container.php#L69-L84 |
10,129 | jianfengye/hades | src/Hades/Container/Container.php | Container.make | public function make($contract)
{
if (empty($this->bindings[$contract])) {
throw new \LogicException('Not found contract:' . $contract);
}
$class = $this->bindings[$contract];
if ($class['type'] == 'closure') {
return call_user_func($class['closure'], $class['class'], $class['args']);
} else if ($class['type'] == 'singleton') {
return $class['instance'];
}
throw new \LogicException('Not found contract:' . $contract);
} | php | public function make($contract)
{
if (empty($this->bindings[$contract])) {
throw new \LogicException('Not found contract:' . $contract);
}
$class = $this->bindings[$contract];
if ($class['type'] == 'closure') {
return call_user_func($class['closure'], $class['class'], $class['args']);
} else if ($class['type'] == 'singleton') {
return $class['instance'];
}
throw new \LogicException('Not found contract:' . $contract);
} | [
"public",
"function",
"make",
"(",
"$",
"contract",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"bindings",
"[",
"$",
"contract",
"]",
")",
")",
"{",
"throw",
"new",
"\\",
"LogicException",
"(",
"'Not found contract:'",
".",
"$",
"contract",
")",
";",
"}",
"$",
"class",
"=",
"$",
"this",
"->",
"bindings",
"[",
"$",
"contract",
"]",
";",
"if",
"(",
"$",
"class",
"[",
"'type'",
"]",
"==",
"'closure'",
")",
"{",
"return",
"call_user_func",
"(",
"$",
"class",
"[",
"'closure'",
"]",
",",
"$",
"class",
"[",
"'class'",
"]",
",",
"$",
"class",
"[",
"'args'",
"]",
")",
";",
"}",
"else",
"if",
"(",
"$",
"class",
"[",
"'type'",
"]",
"==",
"'singleton'",
")",
"{",
"return",
"$",
"class",
"[",
"'instance'",
"]",
";",
"}",
"throw",
"new",
"\\",
"LogicException",
"(",
"'Not found contract:'",
".",
"$",
"contract",
")",
";",
"}"
] | make some contract | [
"make",
"some",
"contract"
] | a0690d96dada070b4cf4b9ff63ab3aa024c34a67 | https://github.com/jianfengye/hades/blob/a0690d96dada070b4cf4b9ff63ab3aa024c34a67/src/Hades/Container/Container.php#L87-L101 |
10,130 | drmvc/helpers | src/Helpers/Arrays.php | Arrays.orderBy | public static function orderBy(): array
{
$args = \func_get_args();
$data = array_shift($args);
foreach ($args as $n => $field) {
if (\is_string($field)) {
$tmp = [];
foreach ($data as $key => $row) {
$tmp[$key] = $row[$field];
}
$args[$n] = $tmp;
}
}
$args[] = &$data;
array_multisort($args);
return array_pop($args);
} | php | public static function orderBy(): array
{
$args = \func_get_args();
$data = array_shift($args);
foreach ($args as $n => $field) {
if (\is_string($field)) {
$tmp = [];
foreach ($data as $key => $row) {
$tmp[$key] = $row[$field];
}
$args[$n] = $tmp;
}
}
$args[] = &$data;
array_multisort($args);
return array_pop($args);
} | [
"public",
"static",
"function",
"orderBy",
"(",
")",
":",
"array",
"{",
"$",
"args",
"=",
"\\",
"func_get_args",
"(",
")",
";",
"$",
"data",
"=",
"array_shift",
"(",
"$",
"args",
")",
";",
"foreach",
"(",
"$",
"args",
"as",
"$",
"n",
"=>",
"$",
"field",
")",
"{",
"if",
"(",
"\\",
"is_string",
"(",
"$",
"field",
")",
")",
"{",
"$",
"tmp",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"data",
"as",
"$",
"key",
"=>",
"$",
"row",
")",
"{",
"$",
"tmp",
"[",
"$",
"key",
"]",
"=",
"$",
"row",
"[",
"$",
"field",
"]",
";",
"}",
"$",
"args",
"[",
"$",
"n",
"]",
"=",
"$",
"tmp",
";",
"}",
"}",
"$",
"args",
"[",
"]",
"=",
"&",
"$",
"data",
";",
"array_multisort",
"(",
"$",
"args",
")",
";",
"return",
"array_pop",
"(",
"$",
"args",
")",
";",
"}"
] | Order array by arguments
@return array | [
"Order",
"array",
"by",
"arguments"
] | 1a9a3f8d4c655b48ddbd61a81eb15688ad207d7b | https://github.com/drmvc/helpers/blob/1a9a3f8d4c655b48ddbd61a81eb15688ad207d7b/src/Helpers/Arrays.php#L16-L32 |
10,131 | drmvc/helpers | src/Helpers/Arrays.php | Arrays.equal | public static function equal(array $a, array $b): bool
{
// Elements count should be equal
$count_equal = (\count($a) === \count($b));
// Between the keys should not be differences
$difference = (array_diff($a, $b) === array_diff($b, $a));
return ($count_equal && $difference);
} | php | public static function equal(array $a, array $b): bool
{
// Elements count should be equal
$count_equal = (\count($a) === \count($b));
// Between the keys should not be differences
$difference = (array_diff($a, $b) === array_diff($b, $a));
return ($count_equal && $difference);
} | [
"public",
"static",
"function",
"equal",
"(",
"array",
"$",
"a",
",",
"array",
"$",
"b",
")",
":",
"bool",
"{",
"// Elements count should be equal",
"$",
"count_equal",
"=",
"(",
"\\",
"count",
"(",
"$",
"a",
")",
"===",
"\\",
"count",
"(",
"$",
"b",
")",
")",
";",
"// Between the keys should not be differences",
"$",
"difference",
"=",
"(",
"array_diff",
"(",
"$",
"a",
",",
"$",
"b",
")",
"===",
"array_diff",
"(",
"$",
"b",
",",
"$",
"a",
")",
")",
";",
"return",
"(",
"$",
"count_equal",
"&&",
"$",
"difference",
")",
";",
"}"
] | Check if two arrays is equal, with same keys
@param array $a
@param array $b
@return bool | [
"Check",
"if",
"two",
"arrays",
"is",
"equal",
"with",
"same",
"keys"
] | 1a9a3f8d4c655b48ddbd61a81eb15688ad207d7b | https://github.com/drmvc/helpers/blob/1a9a3f8d4c655b48ddbd61a81eb15688ad207d7b/src/Helpers/Arrays.php#L58-L66 |
10,132 | drmvc/helpers | src/Helpers/Arrays.php | Arrays.dirToArr | public static function dirToArr($path): array
{
$result = [];
$dirContent = scandir($path, null);
foreach ($dirContent as $key => $value) {
// Exclude system dots folders
if (!\in_array($value, ['.', '..'])) {
if (is_dir($path . DIRECTORY_SEPARATOR . $value)) {
$result[$value] = self::dirToArr($path . DIRECTORY_SEPARATOR . $value);
} else {
$result[] = $value;
}
}
}
return $result;
} | php | public static function dirToArr($path): array
{
$result = [];
$dirContent = scandir($path, null);
foreach ($dirContent as $key => $value) {
// Exclude system dots folders
if (!\in_array($value, ['.', '..'])) {
if (is_dir($path . DIRECTORY_SEPARATOR . $value)) {
$result[$value] = self::dirToArr($path . DIRECTORY_SEPARATOR . $value);
} else {
$result[] = $value;
}
}
}
return $result;
} | [
"public",
"static",
"function",
"dirToArr",
"(",
"$",
"path",
")",
":",
"array",
"{",
"$",
"result",
"=",
"[",
"]",
";",
"$",
"dirContent",
"=",
"scandir",
"(",
"$",
"path",
",",
"null",
")",
";",
"foreach",
"(",
"$",
"dirContent",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"// Exclude system dots folders",
"if",
"(",
"!",
"\\",
"in_array",
"(",
"$",
"value",
",",
"[",
"'.'",
",",
"'..'",
"]",
")",
")",
"{",
"if",
"(",
"is_dir",
"(",
"$",
"path",
".",
"DIRECTORY_SEPARATOR",
".",
"$",
"value",
")",
")",
"{",
"$",
"result",
"[",
"$",
"value",
"]",
"=",
"self",
"::",
"dirToArr",
"(",
"$",
"path",
".",
"DIRECTORY_SEPARATOR",
".",
"$",
"value",
")",
";",
"}",
"else",
"{",
"$",
"result",
"[",
"]",
"=",
"$",
"value",
";",
"}",
"}",
"}",
"return",
"$",
"result",
";",
"}"
] | Read any files and folder into some directory
@param string $path - Source directory with files
@return array | [
"Read",
"any",
"files",
"and",
"folder",
"into",
"some",
"directory"
] | 1a9a3f8d4c655b48ddbd61a81eb15688ad207d7b | https://github.com/drmvc/helpers/blob/1a9a3f8d4c655b48ddbd61a81eb15688ad207d7b/src/Helpers/Arrays.php#L74-L91 |
10,133 | drmvc/helpers | src/Helpers/Arrays.php | Arrays.searchMdObject | private static function searchMdObject($multi, array $target): array
{
return array_map(
function($element) use ($target) {
$exist = true;
foreach ($target as $skey => $svalue) {
$exist = $exist && isset($element->$skey) && ($element->$skey === $svalue);
}
return $exist ? $element : null;
},
(array) $multi
);
} | php | private static function searchMdObject($multi, array $target): array
{
return array_map(
function($element) use ($target) {
$exist = true;
foreach ($target as $skey => $svalue) {
$exist = $exist && isset($element->$skey) && ($element->$skey === $svalue);
}
return $exist ? $element : null;
},
(array) $multi
);
} | [
"private",
"static",
"function",
"searchMdObject",
"(",
"$",
"multi",
",",
"array",
"$",
"target",
")",
":",
"array",
"{",
"return",
"array_map",
"(",
"function",
"(",
"$",
"element",
")",
"use",
"(",
"$",
"target",
")",
"{",
"$",
"exist",
"=",
"true",
";",
"foreach",
"(",
"$",
"target",
"as",
"$",
"skey",
"=>",
"$",
"svalue",
")",
"{",
"$",
"exist",
"=",
"$",
"exist",
"&&",
"isset",
"(",
"$",
"element",
"->",
"$",
"skey",
")",
"&&",
"(",
"$",
"element",
"->",
"$",
"skey",
"===",
"$",
"svalue",
")",
";",
"}",
"return",
"$",
"exist",
"?",
"$",
"element",
":",
"null",
";",
"}",
",",
"(",
"array",
")",
"$",
"multi",
")",
";",
"}"
] | Make search in MD object
@param object $multi
@param array $target
@return array | [
"Make",
"search",
"in",
"MD",
"object"
] | 1a9a3f8d4c655b48ddbd61a81eb15688ad207d7b | https://github.com/drmvc/helpers/blob/1a9a3f8d4c655b48ddbd61a81eb15688ad207d7b/src/Helpers/Arrays.php#L100-L112 |
10,134 | drmvc/helpers | src/Helpers/Arrays.php | Arrays.searchMd | public static function searchMd($multi, $target)
{
if (empty($target) || empty($multi)) {
return false;
}
$output = \is_object($multi)
? self::searchMdObject($multi, $target)
: self::searchMdArray($multi, $target);
$output = array_values(array_filter($output));
// If output is not empty, false by default
return !empty($output) ? $output : false;
} | php | public static function searchMd($multi, $target)
{
if (empty($target) || empty($multi)) {
return false;
}
$output = \is_object($multi)
? self::searchMdObject($multi, $target)
: self::searchMdArray($multi, $target);
$output = array_values(array_filter($output));
// If output is not empty, false by default
return !empty($output) ? $output : false;
} | [
"public",
"static",
"function",
"searchMd",
"(",
"$",
"multi",
",",
"$",
"target",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"target",
")",
"||",
"empty",
"(",
"$",
"multi",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"output",
"=",
"\\",
"is_object",
"(",
"$",
"multi",
")",
"?",
"self",
"::",
"searchMdObject",
"(",
"$",
"multi",
",",
"$",
"target",
")",
":",
"self",
"::",
"searchMdArray",
"(",
"$",
"multi",
",",
"$",
"target",
")",
";",
"$",
"output",
"=",
"array_values",
"(",
"array_filter",
"(",
"$",
"output",
")",
")",
";",
"// If output is not empty, false by default",
"return",
"!",
"empty",
"(",
"$",
"output",
")",
"?",
"$",
"output",
":",
"false",
";",
"}"
] | Find nested array inside two-dimensional array
TODO: Not work with objects
@param array|object $multi where need to make search
@param array $target what we want to find
@return bool|array | [
"Find",
"nested",
"array",
"inside",
"two",
"-",
"dimensional",
"array"
] | 1a9a3f8d4c655b48ddbd61a81eb15688ad207d7b | https://github.com/drmvc/helpers/blob/1a9a3f8d4c655b48ddbd61a81eb15688ad207d7b/src/Helpers/Arrays.php#L144-L158 |
10,135 | Happykiller/ODA_FW_SERVER | dist/OdaLibInterface.php | OdaLibInterface.addDataStr | public function addDataStr($p_params){
try {
if(is_object($p_params)){
if(is_object($p_params->value)){
$this->object_retour->strErreur = "The value is not a string.";
$this->object_retour->statut = self::STATE_ERROR;
die();
}
if(isset($p_params->label)){
$this->object_retour->data[$p_params->label] = $p_params->value;
}else{
$this->object_retour->data = $p_params->value;
}
}else{
$this->object_retour->data = $p_params;
}
} catch (Exception $ex) {
$this->dieInError($ex.'');
}
} | php | public function addDataStr($p_params){
try {
if(is_object($p_params)){
if(is_object($p_params->value)){
$this->object_retour->strErreur = "The value is not a string.";
$this->object_retour->statut = self::STATE_ERROR;
die();
}
if(isset($p_params->label)){
$this->object_retour->data[$p_params->label] = $p_params->value;
}else{
$this->object_retour->data = $p_params->value;
}
}else{
$this->object_retour->data = $p_params;
}
} catch (Exception $ex) {
$this->dieInError($ex.'');
}
} | [
"public",
"function",
"addDataStr",
"(",
"$",
"p_params",
")",
"{",
"try",
"{",
"if",
"(",
"is_object",
"(",
"$",
"p_params",
")",
")",
"{",
"if",
"(",
"is_object",
"(",
"$",
"p_params",
"->",
"value",
")",
")",
"{",
"$",
"this",
"->",
"object_retour",
"->",
"strErreur",
"=",
"\"The value is not a string.\"",
";",
"$",
"this",
"->",
"object_retour",
"->",
"statut",
"=",
"self",
"::",
"STATE_ERROR",
";",
"die",
"(",
")",
";",
"}",
"if",
"(",
"isset",
"(",
"$",
"p_params",
"->",
"label",
")",
")",
"{",
"$",
"this",
"->",
"object_retour",
"->",
"data",
"[",
"$",
"p_params",
"->",
"label",
"]",
"=",
"$",
"p_params",
"->",
"value",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"object_retour",
"->",
"data",
"=",
"$",
"p_params",
"->",
"value",
";",
"}",
"}",
"else",
"{",
"$",
"this",
"->",
"object_retour",
"->",
"data",
"=",
"$",
"p_params",
";",
"}",
"}",
"catch",
"(",
"Exception",
"$",
"ex",
")",
"{",
"$",
"this",
"->",
"dieInError",
"(",
"$",
"ex",
".",
"''",
")",
";",
"}",
"}"
] | Attetion, not handle error from the OdaRetourSQL.
$p_params :
- string value
- string label
or
$p_params = string
@param stdClass|string p_params | [
"Attetion",
"not",
"handle",
"error",
"from",
"the",
"OdaRetourSQL",
"."
] | edcede606239063a1baa469db7b46b78f155844a | https://github.com/Happykiller/ODA_FW_SERVER/blob/edcede606239063a1baa469db7b46b78f155844a/dist/OdaLibInterface.php#L428-L448 |
10,136 | Happykiller/ODA_FW_SERVER | dist/OdaLibInterface.php | OdaLibInterface.dieInError | public function dieInError($message, $errorCode = self::STATE_ERROR){
$this->object_retour->strErreur = $message;
$this->object_retour->statut = $errorCode;
die();
} | php | public function dieInError($message, $errorCode = self::STATE_ERROR){
$this->object_retour->strErreur = $message;
$this->object_retour->statut = $errorCode;
die();
} | [
"public",
"function",
"dieInError",
"(",
"$",
"message",
",",
"$",
"errorCode",
"=",
"self",
"::",
"STATE_ERROR",
")",
"{",
"$",
"this",
"->",
"object_retour",
"->",
"strErreur",
"=",
"$",
"message",
";",
"$",
"this",
"->",
"object_retour",
"->",
"statut",
"=",
"$",
"errorCode",
";",
"die",
"(",
")",
";",
"}"
] | To die an interface
@param String $message | [
"To",
"die",
"an",
"interface"
] | edcede606239063a1baa469db7b46b78f155844a | https://github.com/Happykiller/ODA_FW_SERVER/blob/edcede606239063a1baa469db7b46b78f155844a/dist/OdaLibInterface.php#L805-L809 |
10,137 | marando/phpSOFA | src/Marando/IAU/iauGmst06.php | iauGmst06.Gmst06 | public static function Gmst06($uta, $utb, $tta, $ttb) {
$t;
$gmst;
/* TT Julian centuries since J2000.0. */
$t = (($tta - DJ00) + $ttb) / DJC;
/* Greenwich mean sidereal time, IAU 2006. */
$gmst = IAU::Anp(IAU::Era00($uta, $utb) +
( 0.014506 +
( 4612.156534 +
( 1.3915817 +
( -0.00000044 +
( -0.000029956 +
( -0.0000000368 ) * $t) * $t) * $t) * $t) * $t) * DAS2R);
return $gmst;
} | php | public static function Gmst06($uta, $utb, $tta, $ttb) {
$t;
$gmst;
/* TT Julian centuries since J2000.0. */
$t = (($tta - DJ00) + $ttb) / DJC;
/* Greenwich mean sidereal time, IAU 2006. */
$gmst = IAU::Anp(IAU::Era00($uta, $utb) +
( 0.014506 +
( 4612.156534 +
( 1.3915817 +
( -0.00000044 +
( -0.000029956 +
( -0.0000000368 ) * $t) * $t) * $t) * $t) * $t) * DAS2R);
return $gmst;
} | [
"public",
"static",
"function",
"Gmst06",
"(",
"$",
"uta",
",",
"$",
"utb",
",",
"$",
"tta",
",",
"$",
"ttb",
")",
"{",
"$",
"t",
";",
"$",
"gmst",
";",
"/* TT Julian centuries since J2000.0. */",
"$",
"t",
"=",
"(",
"(",
"$",
"tta",
"-",
"DJ00",
")",
"+",
"$",
"ttb",
")",
"/",
"DJC",
";",
"/* Greenwich mean sidereal time, IAU 2006. */",
"$",
"gmst",
"=",
"IAU",
"::",
"Anp",
"(",
"IAU",
"::",
"Era00",
"(",
"$",
"uta",
",",
"$",
"utb",
")",
"+",
"(",
"0.014506",
"+",
"(",
"4612.156534",
"+",
"(",
"1.3915817",
"+",
"(",
"-",
"0.00000044",
"+",
"(",
"-",
"0.000029956",
"+",
"(",
"-",
"0.0000000368",
")",
"*",
"$",
"t",
")",
"*",
"$",
"t",
")",
"*",
"$",
"t",
")",
"*",
"$",
"t",
")",
"*",
"$",
"t",
")",
"*",
"DAS2R",
")",
";",
"return",
"$",
"gmst",
";",
"}"
] | - - - - - - - - - -
i a u G m s t 0 6
- - - - - - - - - -
Greenwich mean sidereal time (consistent with IAU 2006 precession).
This function is part of the International Astronomical Union's
SOFA (Standards Of Fundamental Astronomy) software collection.
Status: canonical model.
Given:
uta,utb double UT1 as a 2-part Julian Date (Notes 1,2)
tta,ttb double TT as a 2-part Julian Date (Notes 1,2)
Returned (function value):
double Greenwich mean sidereal time (radians)
Notes:
1) The UT1 and TT dates uta+utb and tta+ttb respectively, are both
Julian Dates, apportioned in any convenient way between the
argument pairs. For example, JD=2450123.7 could be expressed in
any of these ways, among others:
Part A Part B
2450123.7 0.0 (JD method)
2451545.0 -1421.3 (J2000 method)
2400000.5 50123.2 (MJD method)
2450123.5 0.2 (date & time method)
The JD method is the most natural and convenient to use in
cases where the loss of several decimal digits of resolution
is acceptable (in the case of UT; the TT is not at all critical
in this respect). The J2000 and MJD methods are good compromises
between resolution and convenience. For UT, the date & time
method is best matched to the algorithm that is used by the Earth
rotation angle function, called internally: maximum precision is
delivered when the uta argument is for 0hrs UT1 on the day in
question and the utb argument lies in the range 0 to 1, or vice
versa.
2) Both UT1 and TT are required, UT1 to predict the Earth rotation
and TT to predict the effects of precession. If UT1 is used for
both purposes, errors of order 100 microarcseconds result.
3) This GMST is compatible with the IAU 2006 precession and must not
be used with other precession models.
4) The result is returned in the range 0 to 2pi.
Called:
iauEra00 Earth rotation angle, IAU 2000
iauAnp normalize angle into range 0 to 2pi
Reference:
Capitaine, N., Wallace, P.T. & Chapront, J., 2005,
Astron.Astrophys. 432, 355
This revision: 2013 June 18
SOFA release 2015-02-09
Copyright (C) 2015 IAU SOFA Board. See notes at end. | [
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"i",
"a",
"u",
"G",
"m",
"s",
"t",
"0",
"6",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-",
"-"
] | 757fa49fe335ae1210eaa7735473fd4388b13f07 | https://github.com/marando/phpSOFA/blob/757fa49fe335ae1210eaa7735473fd4388b13f07/src/Marando/IAU/iauGmst06.php#L75-L92 |
10,138 | nano7/Http | src/RedirectResponse.php | RedirectResponse.withStatus | public function withStatus($message, $type = 'success')
{
$status = [
'message' => $message,
'type' => $type,
];
$this->with('status', $status);
return $this;
} | php | public function withStatus($message, $type = 'success')
{
$status = [
'message' => $message,
'type' => $type,
];
$this->with('status', $status);
return $this;
} | [
"public",
"function",
"withStatus",
"(",
"$",
"message",
",",
"$",
"type",
"=",
"'success'",
")",
"{",
"$",
"status",
"=",
"[",
"'message'",
"=>",
"$",
"message",
",",
"'type'",
"=>",
"$",
"type",
",",
"]",
";",
"$",
"this",
"->",
"with",
"(",
"'status'",
",",
"$",
"status",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Flash a container of status to the session.
@param string $message
@param string $type
@return $this | [
"Flash",
"a",
"container",
"of",
"status",
"to",
"the",
"session",
"."
] | 9af795646ceb3cf1364160a71e339cb79d63773f | https://github.com/nano7/Http/blob/9af795646ceb3cf1364160a71e339cb79d63773f/src/RedirectResponse.php#L102-L112 |
10,139 | kreta-plugins/VCS | src/Kreta/Component/VCS/Factory/CommitFactory.php | CommitFactory.create | public function create($sha, $message, BranchInterface $branch, $author, $url)
{
$commit = new $this->className();
return $commit
->setSHA($sha)
->setMessage($message)
->setBranch($branch)
->setAuthor($author)
->setUrl($url);
} | php | public function create($sha, $message, BranchInterface $branch, $author, $url)
{
$commit = new $this->className();
return $commit
->setSHA($sha)
->setMessage($message)
->setBranch($branch)
->setAuthor($author)
->setUrl($url);
} | [
"public",
"function",
"create",
"(",
"$",
"sha",
",",
"$",
"message",
",",
"BranchInterface",
"$",
"branch",
",",
"$",
"author",
",",
"$",
"url",
")",
"{",
"$",
"commit",
"=",
"new",
"$",
"this",
"->",
"className",
"(",
")",
";",
"return",
"$",
"commit",
"->",
"setSHA",
"(",
"$",
"sha",
")",
"->",
"setMessage",
"(",
"$",
"message",
")",
"->",
"setBranch",
"(",
"$",
"branch",
")",
"->",
"setAuthor",
"(",
"$",
"author",
")",
"->",
"setUrl",
"(",
"$",
"url",
")",
";",
"}"
] | Creates a Commit object with the given response by the VCS provider.
@param string $sha The sha
@param string $message The message
@param \Kreta\Component\VCS\Model\Interfaces\BranchInterface $branch The branch
@param string $author the author
@param string $url The url
@return \Kreta\Component\VCS\Model\Interfaces\CommitInterface | [
"Creates",
"a",
"Commit",
"object",
"with",
"the",
"given",
"response",
"by",
"the",
"VCS",
"provider",
"."
] | 0b6daae2b8044d9250adc8009d03a6745370cd2e | https://github.com/kreta-plugins/VCS/blob/0b6daae2b8044d9250adc8009d03a6745370cd2e/src/Kreta/Component/VCS/Factory/CommitFactory.php#L53-L63 |
10,140 | zerospam/sdk-framework | src/Request/Arguments/Mergeable/Worker/ArgMerger.php | ArgMerger.toPrimitive | public function toPrimitive()
{
if (empty($this->args)) {
throw new \InvalidArgumentException("Args shouldn't be empty");
}
$values = array_keys($this->args);
return implode($this->glue, $values);
} | php | public function toPrimitive()
{
if (empty($this->args)) {
throw new \InvalidArgumentException("Args shouldn't be empty");
}
$values = array_keys($this->args);
return implode($this->glue, $values);
} | [
"public",
"function",
"toPrimitive",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"args",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"\"Args shouldn't be empty\"",
")",
";",
"}",
"$",
"values",
"=",
"array_keys",
"(",
"$",
"this",
"->",
"args",
")",
";",
"return",
"implode",
"(",
"$",
"this",
"->",
"glue",
",",
"$",
"values",
")",
";",
"}"
] | Return a primitive value for this object.
@return int|float|string|float | [
"Return",
"a",
"primitive",
"value",
"for",
"this",
"object",
"."
] | 6780b81584619cb177d5d5e14fd7e87a9d8e48fd | https://github.com/zerospam/sdk-framework/blob/6780b81584619cb177d5d5e14fd7e87a9d8e48fd/src/Request/Arguments/Mergeable/Worker/ArgMerger.php#L78-L87 |
10,141 | crisu83/yii-extension | behaviors/ExtensionBehavior.php | ExtensionBehavior.import | public function import($alias, $forceInclude = false)
{
if (($baseAlias = $this->getAlias()) !== null) {
$alias = $baseAlias . '.' . $alias;
}
return Yii::import($alias, $forceInclude);
} | php | public function import($alias, $forceInclude = false)
{
if (($baseAlias = $this->getAlias()) !== null) {
$alias = $baseAlias . '.' . $alias;
}
return Yii::import($alias, $forceInclude);
} | [
"public",
"function",
"import",
"(",
"$",
"alias",
",",
"$",
"forceInclude",
"=",
"false",
")",
"{",
"if",
"(",
"(",
"$",
"baseAlias",
"=",
"$",
"this",
"->",
"getAlias",
"(",
")",
")",
"!==",
"null",
")",
"{",
"$",
"alias",
"=",
"$",
"baseAlias",
".",
"'.'",
".",
"$",
"alias",
";",
"}",
"return",
"Yii",
"::",
"import",
"(",
"$",
"alias",
",",
"$",
"forceInclude",
")",
";",
"}"
] | Imports the a class or directory.
The path alias is automatically prepended if applicable.
@param string $alias path alias to be imported.
@param boolean $forceInclude whether to include the class file immediately.
@return string the class name or the directory that this alias refers to.
@throws \CException if the alias is invalid. | [
"Imports",
"the",
"a",
"class",
"or",
"directory",
".",
"The",
"path",
"alias",
"is",
"automatically",
"prepended",
"if",
"applicable",
"."
] | 1443a4df7bac8f53567074f6e6df86d7ff23337c | https://github.com/crisu83/yii-extension/blob/1443a4df7bac8f53567074f6e6df86d7ff23337c/behaviors/ExtensionBehavior.php#L43-L49 |
10,142 | crisu83/yii-extension | behaviors/ExtensionBehavior.php | ExtensionBehavior.getDbConnection | public function getDbConnection()
{
if (!Yii::app()->hasComponent($this->connectionID)) {
throw new CException(sprintf('Connection component "%s" does not exist.', $this->connectionID));
}
$db = Yii::app()->getComponent($this->connectionID);
if (!$db instanceof CDbConnection) {
throw new CException(sprintf(
'Connection component "%s" is not an instance of CDbConnection.',
$this->connectionID
));
}
return $db;
} | php | public function getDbConnection()
{
if (!Yii::app()->hasComponent($this->connectionID)) {
throw new CException(sprintf('Connection component "%s" does not exist.', $this->connectionID));
}
$db = Yii::app()->getComponent($this->connectionID);
if (!$db instanceof CDbConnection) {
throw new CException(sprintf(
'Connection component "%s" is not an instance of CDbConnection.',
$this->connectionID
));
}
return $db;
} | [
"public",
"function",
"getDbConnection",
"(",
")",
"{",
"if",
"(",
"!",
"Yii",
"::",
"app",
"(",
")",
"->",
"hasComponent",
"(",
"$",
"this",
"->",
"connectionID",
")",
")",
"{",
"throw",
"new",
"CException",
"(",
"sprintf",
"(",
"'Connection component \"%s\" does not exist.'",
",",
"$",
"this",
"->",
"connectionID",
")",
")",
";",
"}",
"$",
"db",
"=",
"Yii",
"::",
"app",
"(",
")",
"->",
"getComponent",
"(",
"$",
"this",
"->",
"connectionID",
")",
";",
"if",
"(",
"!",
"$",
"db",
"instanceof",
"CDbConnection",
")",
"{",
"throw",
"new",
"CException",
"(",
"sprintf",
"(",
"'Connection component \"%s\" is not an instance of CDbConnection.'",
",",
"$",
"this",
"->",
"connectionID",
")",
")",
";",
"}",
"return",
"$",
"db",
";",
"}"
] | Returns the database connection for this component.
@return \CDbConnection the connection component.
@throws \CException if the component does not exist or is not an instance of CDbConnection. | [
"Returns",
"the",
"database",
"connection",
"for",
"this",
"component",
"."
] | 1443a4df7bac8f53567074f6e6df86d7ff23337c | https://github.com/crisu83/yii-extension/blob/1443a4df7bac8f53567074f6e6df86d7ff23337c/behaviors/ExtensionBehavior.php#L56-L69 |
10,143 | crisu83/yii-extension | behaviors/ExtensionBehavior.php | ExtensionBehavior.publishAssets | public function publishAssets($path, $forceCopy = false)
{
if (!Yii::app()->hasComponent('assetManager')) {
return false; // ignore this method while ran from the console
}
/* @var CAssetManager $assetManager */
$assetManager = Yii::app()->getComponent('assetManager');
if (($basePath = $this->getPath()) !== false) {
$path = $basePath . DIRECTORY_SEPARATOR . $path;
}
$assetsUrl = $assetManager->publish($path, false, -1, $forceCopy);
return $this->_assetsUrl = $assetsUrl;
} | php | public function publishAssets($path, $forceCopy = false)
{
if (!Yii::app()->hasComponent('assetManager')) {
return false; // ignore this method while ran from the console
}
/* @var CAssetManager $assetManager */
$assetManager = Yii::app()->getComponent('assetManager');
if (($basePath = $this->getPath()) !== false) {
$path = $basePath . DIRECTORY_SEPARATOR . $path;
}
$assetsUrl = $assetManager->publish($path, false, -1, $forceCopy);
return $this->_assetsUrl = $assetsUrl;
} | [
"public",
"function",
"publishAssets",
"(",
"$",
"path",
",",
"$",
"forceCopy",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"Yii",
"::",
"app",
"(",
")",
"->",
"hasComponent",
"(",
"'assetManager'",
")",
")",
"{",
"return",
"false",
";",
"// ignore this method while ran from the console",
"}",
"/* @var CAssetManager $assetManager */",
"$",
"assetManager",
"=",
"Yii",
"::",
"app",
"(",
")",
"->",
"getComponent",
"(",
"'assetManager'",
")",
";",
"if",
"(",
"(",
"$",
"basePath",
"=",
"$",
"this",
"->",
"getPath",
"(",
")",
")",
"!==",
"false",
")",
"{",
"$",
"path",
"=",
"$",
"basePath",
".",
"DIRECTORY_SEPARATOR",
".",
"$",
"path",
";",
"}",
"$",
"assetsUrl",
"=",
"$",
"assetManager",
"->",
"publish",
"(",
"$",
"path",
",",
"false",
",",
"-",
"1",
",",
"$",
"forceCopy",
")",
";",
"return",
"$",
"this",
"->",
"_assetsUrl",
"=",
"$",
"assetsUrl",
";",
"}"
] | Publishes the extension assets.
@param string $path assets path.
@param boolean $forceCopy whether we should copy the asset file or directory
even if it is already published before.
@return string the url. | [
"Publishes",
"the",
"extension",
"assets",
"."
] | 1443a4df7bac8f53567074f6e6df86d7ff23337c | https://github.com/crisu83/yii-extension/blob/1443a4df7bac8f53567074f6e6df86d7ff23337c/behaviors/ExtensionBehavior.php#L78-L90 |
10,144 | crisu83/yii-extension | behaviors/ExtensionBehavior.php | ExtensionBehavior.registerScriptFile | public function registerScriptFile($url, $position = null)
{
if (($cs = $this->getClientScript()) === false) {
return null;
}
if (isset($this->_assetsUrl)) {
$url = $this->_assetsUrl . '/' . ltrim($url, '/');
}
return $cs->registerScriptFile($url, $position);
} | php | public function registerScriptFile($url, $position = null)
{
if (($cs = $this->getClientScript()) === false) {
return null;
}
if (isset($this->_assetsUrl)) {
$url = $this->_assetsUrl . '/' . ltrim($url, '/');
}
return $cs->registerScriptFile($url, $position);
} | [
"public",
"function",
"registerScriptFile",
"(",
"$",
"url",
",",
"$",
"position",
"=",
"null",
")",
"{",
"if",
"(",
"(",
"$",
"cs",
"=",
"$",
"this",
"->",
"getClientScript",
"(",
")",
")",
"===",
"false",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"_assetsUrl",
")",
")",
"{",
"$",
"url",
"=",
"$",
"this",
"->",
"_assetsUrl",
".",
"'/'",
".",
"ltrim",
"(",
"$",
"url",
",",
"'/'",
")",
";",
"}",
"return",
"$",
"cs",
"->",
"registerScriptFile",
"(",
"$",
"url",
",",
"$",
"position",
")",
";",
"}"
] | Registers a JavaScript file.
@param string $url URL of the javascript file.
@param integer $position the position of the JavaScript code.
@return CClientScript the client script component. | [
"Registers",
"a",
"JavaScript",
"file",
"."
] | 1443a4df7bac8f53567074f6e6df86d7ff23337c | https://github.com/crisu83/yii-extension/blob/1443a4df7bac8f53567074f6e6df86d7ff23337c/behaviors/ExtensionBehavior.php#L115-L124 |
10,145 | Silvestra/Silvestra | src/Silvestra/Component/Admin/Menu/AdminMenuBuilder.php | AdminMenuBuilder.build | public function build()
{
$event = new AdminMenuEvent();
$this->eventDispatcher->dispatch(Admin::MENU, $event);
return $event->getItems();
} | php | public function build()
{
$event = new AdminMenuEvent();
$this->eventDispatcher->dispatch(Admin::MENU, $event);
return $event->getItems();
} | [
"public",
"function",
"build",
"(",
")",
"{",
"$",
"event",
"=",
"new",
"AdminMenuEvent",
"(",
")",
";",
"$",
"this",
"->",
"eventDispatcher",
"->",
"dispatch",
"(",
"Admin",
"::",
"MENU",
",",
"$",
"event",
")",
";",
"return",
"$",
"event",
"->",
"getItems",
"(",
")",
";",
"}"
] | Build admin menu.
@return array|AdminMenuItem[] | [
"Build",
"admin",
"menu",
"."
] | b7367601b01495ae3c492b42042f804dee13ab06 | https://github.com/Silvestra/Silvestra/blob/b7367601b01495ae3c492b42042f804dee13ab06/src/Silvestra/Component/Admin/Menu/AdminMenuBuilder.php#L45-L52 |
10,146 | zugoripls/laravel-framework | src/Illuminate/Routing/UrlGenerator.php | UrlGenerator.replaceRoutableParameters | protected function replaceRoutableParameters($parameters = array())
{
$parameters = is_array($parameters) ? $parameters : array($parameters);
foreach ($parameters as $key => $parameter)
{
if ($parameter instanceof UrlRoutable)
{
$parameters[$key] = $parameter->getRouteKey();
}
}
return $parameters;
} | php | protected function replaceRoutableParameters($parameters = array())
{
$parameters = is_array($parameters) ? $parameters : array($parameters);
foreach ($parameters as $key => $parameter)
{
if ($parameter instanceof UrlRoutable)
{
$parameters[$key] = $parameter->getRouteKey();
}
}
return $parameters;
} | [
"protected",
"function",
"replaceRoutableParameters",
"(",
"$",
"parameters",
"=",
"array",
"(",
")",
")",
"{",
"$",
"parameters",
"=",
"is_array",
"(",
"$",
"parameters",
")",
"?",
"$",
"parameters",
":",
"array",
"(",
"$",
"parameters",
")",
";",
"foreach",
"(",
"$",
"parameters",
"as",
"$",
"key",
"=>",
"$",
"parameter",
")",
"{",
"if",
"(",
"$",
"parameter",
"instanceof",
"UrlRoutable",
")",
"{",
"$",
"parameters",
"[",
"$",
"key",
"]",
"=",
"$",
"parameter",
"->",
"getRouteKey",
"(",
")",
";",
"}",
"}",
"return",
"$",
"parameters",
";",
"}"
] | Replace UrlRoutable parameters with their route parameter.
@param array $parameters
@return array | [
"Replace",
"UrlRoutable",
"parameters",
"with",
"their",
"route",
"parameter",
"."
] | 90fa2b0e7a9b7786a6f02a9f10aba6a21ac03655 | https://github.com/zugoripls/laravel-framework/blob/90fa2b0e7a9b7786a6f02a9f10aba6a21ac03655/src/Illuminate/Routing/UrlGenerator.php#L385-L398 |
10,147 | youthweb/oauth2-youthweb | src/Provider/YouthwebResourceOwner.php | YouthwebResourceOwner.getName | public function getName()
{
$name = null;
if ( isset($this->response['data']['attributes']['first_name']) )
{
$name = $this->response['data']['attributes']['first_name'] . ' ' . $this->response['data']['attributes']['last_name'];
}
return $name;
} | php | public function getName()
{
$name = null;
if ( isset($this->response['data']['attributes']['first_name']) )
{
$name = $this->response['data']['attributes']['first_name'] . ' ' . $this->response['data']['attributes']['last_name'];
}
return $name;
} | [
"public",
"function",
"getName",
"(",
")",
"{",
"$",
"name",
"=",
"null",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"response",
"[",
"'data'",
"]",
"[",
"'attributes'",
"]",
"[",
"'first_name'",
"]",
")",
")",
"{",
"$",
"name",
"=",
"$",
"this",
"->",
"response",
"[",
"'data'",
"]",
"[",
"'attributes'",
"]",
"[",
"'first_name'",
"]",
".",
"' '",
".",
"$",
"this",
"->",
"response",
"[",
"'data'",
"]",
"[",
"'attributes'",
"]",
"[",
"'last_name'",
"]",
";",
"}",
"return",
"$",
"name",
";",
"}"
] | Get resource owner name
@return string|null | [
"Get",
"resource",
"owner",
"name"
] | e78b35656358af8e257017521aaaad5b5dff6a6e | https://github.com/youthweb/oauth2-youthweb/blob/e78b35656358af8e257017521aaaad5b5dff6a6e/src/Provider/YouthwebResourceOwner.php#L58-L68 |
10,148 | slickframework/orm | src/Repository/QueryObject/SelectEventTriggers.php | SelectEventTriggers.triggerBeforeSelect | public function triggerBeforeSelect(
Select $query, EntityDescriptorInterface $entityDescriptor
) {
$event = new \Slick\Orm\Event\Select(
null,
[
'query' => $query,
'entityDescriptor' => $entityDescriptor
]
);
$event->setAction(\Slick\Orm\Event\Select::ACTION_BEFORE_SELECT);
return Orm::getEmitter($this->getEntityClassName())
->emit($event);
} | php | public function triggerBeforeSelect(
Select $query, EntityDescriptorInterface $entityDescriptor
) {
$event = new \Slick\Orm\Event\Select(
null,
[
'query' => $query,
'entityDescriptor' => $entityDescriptor
]
);
$event->setAction(\Slick\Orm\Event\Select::ACTION_BEFORE_SELECT);
return Orm::getEmitter($this->getEntityClassName())
->emit($event);
} | [
"public",
"function",
"triggerBeforeSelect",
"(",
"Select",
"$",
"query",
",",
"EntityDescriptorInterface",
"$",
"entityDescriptor",
")",
"{",
"$",
"event",
"=",
"new",
"\\",
"Slick",
"\\",
"Orm",
"\\",
"Event",
"\\",
"Select",
"(",
"null",
",",
"[",
"'query'",
"=>",
"$",
"query",
",",
"'entityDescriptor'",
"=>",
"$",
"entityDescriptor",
"]",
")",
";",
"$",
"event",
"->",
"setAction",
"(",
"\\",
"Slick",
"\\",
"Orm",
"\\",
"Event",
"\\",
"Select",
"::",
"ACTION_BEFORE_SELECT",
")",
";",
"return",
"Orm",
"::",
"getEmitter",
"(",
"$",
"this",
"->",
"getEntityClassName",
"(",
")",
")",
"->",
"emit",
"(",
"$",
"event",
")",
";",
"}"
] | Emit before select event
@param Select $query
@param EntityDescriptorInterface $entityDescriptor
@return \League\Event\EventInterface|string | [
"Emit",
"before",
"select",
"event"
] | c5c782f5e3a46cdc6c934eda4411cb9edc48f969 | https://github.com/slickframework/orm/blob/c5c782f5e3a46cdc6c934eda4411cb9edc48f969/src/Repository/QueryObject/SelectEventTriggers.php#L41-L54 |
10,149 | slickframework/orm | src/Repository/QueryObject/SelectEventTriggers.php | SelectEventTriggers.triggerAfterSelect | public function triggerAfterSelect($data, EntityCollection $entities)
{
$event = new \Slick\Orm\Event\Select(
null,
[
'data' => $data,
'entityCollection' => $entities
]
);
$event->setAction(\Slick\Orm\Event\Select::ACTION_AFTER_SELECT);
return Orm::getEmitter($this->getEntityClassName())
->emit($event);
} | php | public function triggerAfterSelect($data, EntityCollection $entities)
{
$event = new \Slick\Orm\Event\Select(
null,
[
'data' => $data,
'entityCollection' => $entities
]
);
$event->setAction(\Slick\Orm\Event\Select::ACTION_AFTER_SELECT);
return Orm::getEmitter($this->getEntityClassName())
->emit($event);
} | [
"public",
"function",
"triggerAfterSelect",
"(",
"$",
"data",
",",
"EntityCollection",
"$",
"entities",
")",
"{",
"$",
"event",
"=",
"new",
"\\",
"Slick",
"\\",
"Orm",
"\\",
"Event",
"\\",
"Select",
"(",
"null",
",",
"[",
"'data'",
"=>",
"$",
"data",
",",
"'entityCollection'",
"=>",
"$",
"entities",
"]",
")",
";",
"$",
"event",
"->",
"setAction",
"(",
"\\",
"Slick",
"\\",
"Orm",
"\\",
"Event",
"\\",
"Select",
"::",
"ACTION_AFTER_SELECT",
")",
";",
"return",
"Orm",
"::",
"getEmitter",
"(",
"$",
"this",
"->",
"getEntityClassName",
"(",
")",
")",
"->",
"emit",
"(",
"$",
"event",
")",
";",
"}"
] | Emits the after select event
@param RecordList $data
@param EntityCollection $entities
@return \League\Event\EventInterface|string | [
"Emits",
"the",
"after",
"select",
"event"
] | c5c782f5e3a46cdc6c934eda4411cb9edc48f969 | https://github.com/slickframework/orm/blob/c5c782f5e3a46cdc6c934eda4411cb9edc48f969/src/Repository/QueryObject/SelectEventTriggers.php#L64-L76 |
10,150 | bazzline/zf_console_helper_debian_6_backport | src/ZfConsoleHelperDebian6Backport/Controller/Console/AbstractConsoleController.php | AbstractConsoleController.getConsole | public function getConsole()
{
if (!($this->console instanceof AdapterInterface)) {
$this->console = Console::getInstance();
}
return $this->console;
} | php | public function getConsole()
{
if (!($this->console instanceof AdapterInterface)) {
$this->console = Console::getInstance();
}
return $this->console;
} | [
"public",
"function",
"getConsole",
"(",
")",
"{",
"if",
"(",
"!",
"(",
"$",
"this",
"->",
"console",
"instanceof",
"AdapterInterface",
")",
")",
"{",
"$",
"this",
"->",
"console",
"=",
"Console",
"::",
"getInstance",
"(",
")",
";",
"}",
"return",
"$",
"this",
"->",
"console",
";",
"}"
] | Instantiate console if no is set
@return AdapterInterface | [
"Instantiate",
"console",
"if",
"no",
"is",
"set"
] | 9b18b98a71b0c1efdca77d0706781b88924855c1 | https://github.com/bazzline/zf_console_helper_debian_6_backport/blob/9b18b98a71b0c1efdca77d0706781b88924855c1/src/ZfConsoleHelperDebian6Backport/Controller/Console/AbstractConsoleController.php#L27-L34 |
10,151 | tonjoo/tiga-framework | src/Console/BaseCommand.php | BaseCommand.showError | protected function showError($title, $messages = '', $output)
{
$output->writeln("<error>$title</error>");
$output->writeln('');
if (is_array($messages)) {
foreach ($messages as $message) {
$output->writeln("<comment>$message</comment>");
}
$output->writeln('');
} elseif ($messages != '') {
$output->writeln("<comment>$messages</comment>");
$output->writeln('');
}
} | php | protected function showError($title, $messages = '', $output)
{
$output->writeln("<error>$title</error>");
$output->writeln('');
if (is_array($messages)) {
foreach ($messages as $message) {
$output->writeln("<comment>$message</comment>");
}
$output->writeln('');
} elseif ($messages != '') {
$output->writeln("<comment>$messages</comment>");
$output->writeln('');
}
} | [
"protected",
"function",
"showError",
"(",
"$",
"title",
",",
"$",
"messages",
"=",
"''",
",",
"$",
"output",
")",
"{",
"$",
"output",
"->",
"writeln",
"(",
"\"<error>$title</error>\"",
")",
";",
"$",
"output",
"->",
"writeln",
"(",
"''",
")",
";",
"if",
"(",
"is_array",
"(",
"$",
"messages",
")",
")",
"{",
"foreach",
"(",
"$",
"messages",
"as",
"$",
"message",
")",
"{",
"$",
"output",
"->",
"writeln",
"(",
"\"<comment>$message</comment>\"",
")",
";",
"}",
"$",
"output",
"->",
"writeln",
"(",
"''",
")",
";",
"}",
"elseif",
"(",
"$",
"messages",
"!=",
"''",
")",
"{",
"$",
"output",
"->",
"writeln",
"(",
"\"<comment>$messages</comment>\"",
")",
";",
"$",
"output",
"->",
"writeln",
"(",
"''",
")",
";",
"}",
"}"
] | Print error message with proper format.
@param string $title
@param string $messages
@param \Symfony\Component\Console\Output\OutputInterface $output | [
"Print",
"error",
"message",
"with",
"proper",
"format",
"."
] | 3c2eebd3bc616106fa1bba3e43f1791aff75eec5 | https://github.com/tonjoo/tiga-framework/blob/3c2eebd3bc616106fa1bba3e43f1791aff75eec5/src/Console/BaseCommand.php#L33-L46 |
10,152 | tonjoo/tiga-framework | src/Console/BaseCommand.php | BaseCommand.showSuccess | protected function showSuccess($title, $messages = '', $output)
{
$output->writeln("<info>$title</info>");
$output->writeln('');
if (is_array($messages)) {
foreach ($messages as $message) {
$output->writeln("$message");
}
$output->writeln('');
} elseif ($messages != '') {
$output->writeln($messages);
$output->writeln('');
}
} | php | protected function showSuccess($title, $messages = '', $output)
{
$output->writeln("<info>$title</info>");
$output->writeln('');
if (is_array($messages)) {
foreach ($messages as $message) {
$output->writeln("$message");
}
$output->writeln('');
} elseif ($messages != '') {
$output->writeln($messages);
$output->writeln('');
}
} | [
"protected",
"function",
"showSuccess",
"(",
"$",
"title",
",",
"$",
"messages",
"=",
"''",
",",
"$",
"output",
")",
"{",
"$",
"output",
"->",
"writeln",
"(",
"\"<info>$title</info>\"",
")",
";",
"$",
"output",
"->",
"writeln",
"(",
"''",
")",
";",
"if",
"(",
"is_array",
"(",
"$",
"messages",
")",
")",
"{",
"foreach",
"(",
"$",
"messages",
"as",
"$",
"message",
")",
"{",
"$",
"output",
"->",
"writeln",
"(",
"\"$message\"",
")",
";",
"}",
"$",
"output",
"->",
"writeln",
"(",
"''",
")",
";",
"}",
"elseif",
"(",
"$",
"messages",
"!=",
"''",
")",
"{",
"$",
"output",
"->",
"writeln",
"(",
"$",
"messages",
")",
";",
"$",
"output",
"->",
"writeln",
"(",
"''",
")",
";",
"}",
"}"
] | Print success message.
@param string $title
@param string $messages
@param \Symfony\Component\Console\Output\OutputInterface $output | [
"Print",
"success",
"message",
"."
] | 3c2eebd3bc616106fa1bba3e43f1791aff75eec5 | https://github.com/tonjoo/tiga-framework/blob/3c2eebd3bc616106fa1bba3e43f1791aff75eec5/src/Console/BaseCommand.php#L55-L68 |
10,153 | Rehyved/php-http-client | src/rehyved/Http/HttpRequest.php | HttpRequest.header | public function header(string $name, $value): HttpRequest
{
if (!array_key_exists($name, $this->headers)) {
$this->headers[$name] = array();
}
$this->headers[$name][] = $value;
return $this;
} | php | public function header(string $name, $value): HttpRequest
{
if (!array_key_exists($name, $this->headers)) {
$this->headers[$name] = array();
}
$this->headers[$name][] = $value;
return $this;
} | [
"public",
"function",
"header",
"(",
"string",
"$",
"name",
",",
"$",
"value",
")",
":",
"HttpRequest",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"name",
",",
"$",
"this",
"->",
"headers",
")",
")",
"{",
"$",
"this",
"->",
"headers",
"[",
"$",
"name",
"]",
"=",
"array",
"(",
")",
";",
"}",
"$",
"this",
"->",
"headers",
"[",
"$",
"name",
"]",
"[",
"]",
"=",
"$",
"value",
";",
"return",
"$",
"this",
";",
"}"
] | Adds a header to the request
@param string $name the name of the header
@param mixed $value the value for the header
@return HttpRequest | [
"Adds",
"a",
"header",
"to",
"the",
"request"
] | 1a4a7d3d30d710ce4062c7628010ee4f06d2359c | https://github.com/Rehyved/php-http-client/blob/1a4a7d3d30d710ce4062c7628010ee4f06d2359c/src/rehyved/Http/HttpRequest.php#L63-L71 |
10,154 | Rehyved/php-http-client | src/rehyved/Http/HttpRequest.php | HttpRequest.headers | public function headers(array $headers): HttpRequest
{
foreach ($headers as $name => $value) {
$this->header($name, $value);
}
return $this;
} | php | public function headers(array $headers): HttpRequest
{
foreach ($headers as $name => $value) {
$this->header($name, $value);
}
return $this;
} | [
"public",
"function",
"headers",
"(",
"array",
"$",
"headers",
")",
":",
"HttpRequest",
"{",
"foreach",
"(",
"$",
"headers",
"as",
"$",
"name",
"=>",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"header",
"(",
"$",
"name",
",",
"$",
"value",
")",
";",
"}",
"return",
"$",
"this",
";",
"}"
] | Adds an array of headers to the HttpRequest
@param array $headers An associative array of name->value to add as headers to the HttpRequest
@return HttpRequest | [
"Adds",
"an",
"array",
"of",
"headers",
"to",
"the",
"HttpRequest"
] | 1a4a7d3d30d710ce4062c7628010ee4f06d2359c | https://github.com/Rehyved/php-http-client/blob/1a4a7d3d30d710ce4062c7628010ee4f06d2359c/src/rehyved/Http/HttpRequest.php#L78-L85 |
10,155 | Rehyved/php-http-client | src/rehyved/Http/HttpRequest.php | HttpRequest.contentType | public function contentType(string $contentType): HttpRequest
{
$contentType = trim($contentType);
// If this is a multipart request and boundary was not defined, we define a boundary as this is required for multipart requests:
if (stripos($contentType, "multipart/") !== false) {
if (stripos($contentType, "boundary") === false) {
$contentType .= "; boundary=\"" . uniqid(time()) . "\"";
$contentType = preg_replace('/(.)(;{2,})/', '$1;', $contentType); // remove double semi-colon, except after scheme
}
}
return $this->header("Content-Type", $contentType);
} | php | public function contentType(string $contentType): HttpRequest
{
$contentType = trim($contentType);
// If this is a multipart request and boundary was not defined, we define a boundary as this is required for multipart requests:
if (stripos($contentType, "multipart/") !== false) {
if (stripos($contentType, "boundary") === false) {
$contentType .= "; boundary=\"" . uniqid(time()) . "\"";
$contentType = preg_replace('/(.)(;{2,})/', '$1;', $contentType); // remove double semi-colon, except after scheme
}
}
return $this->header("Content-Type", $contentType);
} | [
"public",
"function",
"contentType",
"(",
"string",
"$",
"contentType",
")",
":",
"HttpRequest",
"{",
"$",
"contentType",
"=",
"trim",
"(",
"$",
"contentType",
")",
";",
"// If this is a multipart request and boundary was not defined, we define a boundary as this is required for multipart requests:",
"if",
"(",
"stripos",
"(",
"$",
"contentType",
",",
"\"multipart/\"",
")",
"!==",
"false",
")",
"{",
"if",
"(",
"stripos",
"(",
"$",
"contentType",
",",
"\"boundary\"",
")",
"===",
"false",
")",
"{",
"$",
"contentType",
".=",
"\"; boundary=\\\"\"",
".",
"uniqid",
"(",
"time",
"(",
")",
")",
".",
"\"\\\"\"",
";",
"$",
"contentType",
"=",
"preg_replace",
"(",
"'/(.)(;{2,})/'",
",",
"'$1;'",
",",
"$",
"contentType",
")",
";",
"// remove double semi-colon, except after scheme",
"}",
"}",
"return",
"$",
"this",
"->",
"header",
"(",
"\"Content-Type\"",
",",
"$",
"contentType",
")",
";",
"}"
] | Sets the Content-Type header of the HttpRequest
@param string $contentType the value to set for the Content-Type header
@return HttpRequest | [
"Sets",
"the",
"Content",
"-",
"Type",
"header",
"of",
"the",
"HttpRequest"
] | 1a4a7d3d30d710ce4062c7628010ee4f06d2359c | https://github.com/Rehyved/php-http-client/blob/1a4a7d3d30d710ce4062c7628010ee4f06d2359c/src/rehyved/Http/HttpRequest.php#L92-L105 |
10,156 | Rehyved/php-http-client | src/rehyved/Http/HttpRequest.php | HttpRequest.accept | public function accept(string $contentType): HttpRequest
{
$contentType = trim($contentType);
return $this->header("Accept", $contentType);
} | php | public function accept(string $contentType): HttpRequest
{
$contentType = trim($contentType);
return $this->header("Accept", $contentType);
} | [
"public",
"function",
"accept",
"(",
"string",
"$",
"contentType",
")",
":",
"HttpRequest",
"{",
"$",
"contentType",
"=",
"trim",
"(",
"$",
"contentType",
")",
";",
"return",
"$",
"this",
"->",
"header",
"(",
"\"Accept\"",
",",
"$",
"contentType",
")",
";",
"}"
] | Sets the Accept header of the HttpRequest
@param string $contentType the value to set for the Accept header
@return HttpRequest | [
"Sets",
"the",
"Accept",
"header",
"of",
"the",
"HttpRequest"
] | 1a4a7d3d30d710ce4062c7628010ee4f06d2359c | https://github.com/Rehyved/php-http-client/blob/1a4a7d3d30d710ce4062c7628010ee4f06d2359c/src/rehyved/Http/HttpRequest.php#L112-L117 |
10,157 | Rehyved/php-http-client | src/rehyved/Http/HttpRequest.php | HttpRequest.authorization | public function authorization(string $scheme, string $value): HttpRequest
{
if (empty($scheme)) {
throw new \InvalidArgumentException("Scheme was null or empty");
}
if (empty($value)) {
throw new \InvalidArgumentException("Value was null or empty");
}
return $this->header("Authorization", $scheme . " " . $value);
} | php | public function authorization(string $scheme, string $value): HttpRequest
{
if (empty($scheme)) {
throw new \InvalidArgumentException("Scheme was null or empty");
}
if (empty($value)) {
throw new \InvalidArgumentException("Value was null or empty");
}
return $this->header("Authorization", $scheme . " " . $value);
} | [
"public",
"function",
"authorization",
"(",
"string",
"$",
"scheme",
",",
"string",
"$",
"value",
")",
":",
"HttpRequest",
"{",
"if",
"(",
"empty",
"(",
"$",
"scheme",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"\"Scheme was null or empty\"",
")",
";",
"}",
"if",
"(",
"empty",
"(",
"$",
"value",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"\"Value was null or empty\"",
")",
";",
"}",
"return",
"$",
"this",
"->",
"header",
"(",
"\"Authorization\"",
",",
"$",
"scheme",
".",
"\" \"",
".",
"$",
"value",
")",
";",
"}"
] | Sets the Authorization header of the HttpRequest
@param string $scheme the scheme to use in the value of the Authorization header (e.g. Bearer)
@param string $value the value to set for the the Authorization header
@return HttpRequest | [
"Sets",
"the",
"Authorization",
"header",
"of",
"the",
"HttpRequest"
] | 1a4a7d3d30d710ce4062c7628010ee4f06d2359c | https://github.com/Rehyved/php-http-client/blob/1a4a7d3d30d710ce4062c7628010ee4f06d2359c/src/rehyved/Http/HttpRequest.php#L125-L134 |
10,158 | Rehyved/php-http-client | src/rehyved/Http/HttpRequest.php | HttpRequest.parameter | public function parameter(string $name, $value): HttpRequest
{
$this->parameters[$name] = $value;
return $this;
} | php | public function parameter(string $name, $value): HttpRequest
{
$this->parameters[$name] = $value;
return $this;
} | [
"public",
"function",
"parameter",
"(",
"string",
"$",
"name",
",",
"$",
"value",
")",
":",
"HttpRequest",
"{",
"$",
"this",
"->",
"parameters",
"[",
"$",
"name",
"]",
"=",
"$",
"value",
";",
"return",
"$",
"this",
";",
"}"
] | Adds a query parameter to the HttpRequest.
@param string $name the name of the query parameter to add
@param mixed $value the value of the query parameter to add
@return HttpRequest | [
"Adds",
"a",
"query",
"parameter",
"to",
"the",
"HttpRequest",
"."
] | 1a4a7d3d30d710ce4062c7628010ee4f06d2359c | https://github.com/Rehyved/php-http-client/blob/1a4a7d3d30d710ce4062c7628010ee4f06d2359c/src/rehyved/Http/HttpRequest.php#L142-L147 |
10,159 | Rehyved/php-http-client | src/rehyved/Http/HttpRequest.php | HttpRequest.parameters | public function parameters(array $parameters): HttpRequest
{
foreach ($parameters as $name => $value) {
$this->parameter($name, $value);
}
return $this;
} | php | public function parameters(array $parameters): HttpRequest
{
foreach ($parameters as $name => $value) {
$this->parameter($name, $value);
}
return $this;
} | [
"public",
"function",
"parameters",
"(",
"array",
"$",
"parameters",
")",
":",
"HttpRequest",
"{",
"foreach",
"(",
"$",
"parameters",
"as",
"$",
"name",
"=>",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"parameter",
"(",
"$",
"name",
",",
"$",
"value",
")",
";",
"}",
"return",
"$",
"this",
";",
"}"
] | Adds an array of query parameters to the HttpRequest
@param array $parameters An associative array of name->value to add as query parameters to the HttpRequest
@return HttpRequest | [
"Adds",
"an",
"array",
"of",
"query",
"parameters",
"to",
"the",
"HttpRequest"
] | 1a4a7d3d30d710ce4062c7628010ee4f06d2359c | https://github.com/Rehyved/php-http-client/blob/1a4a7d3d30d710ce4062c7628010ee4f06d2359c/src/rehyved/Http/HttpRequest.php#L154-L161 |
10,160 | Rehyved/php-http-client | src/rehyved/Http/HttpRequest.php | HttpRequest.cookie | public function cookie(string $name, $value): HttpRequest
{
if ($name != 'Array') {
$this->cookies[$name] = $value;
}
return $this;
} | php | public function cookie(string $name, $value): HttpRequest
{
if ($name != 'Array') {
$this->cookies[$name] = $value;
}
return $this;
} | [
"public",
"function",
"cookie",
"(",
"string",
"$",
"name",
",",
"$",
"value",
")",
":",
"HttpRequest",
"{",
"if",
"(",
"$",
"name",
"!=",
"'Array'",
")",
"{",
"$",
"this",
"->",
"cookies",
"[",
"$",
"name",
"]",
"=",
"$",
"value",
";",
"}",
"return",
"$",
"this",
";",
"}"
] | Adds a cookie to the HttpRequest
@param string $name the name of the cookie to add to the HttpRequest
@param mixed $value the value of the cookie to add to the HttpRequest
@return HttpRequest | [
"Adds",
"a",
"cookie",
"to",
"the",
"HttpRequest"
] | 1a4a7d3d30d710ce4062c7628010ee4f06d2359c | https://github.com/Rehyved/php-http-client/blob/1a4a7d3d30d710ce4062c7628010ee4f06d2359c/src/rehyved/Http/HttpRequest.php#L169-L175 |
10,161 | Rehyved/php-http-client | src/rehyved/Http/HttpRequest.php | HttpRequest.basicAuthentication | public function basicAuthentication(string $username, string $password = ""): HttpRequest
{
$this->username = $username;
$this->password = $password;
return $this;
} | php | public function basicAuthentication(string $username, string $password = ""): HttpRequest
{
$this->username = $username;
$this->password = $password;
return $this;
} | [
"public",
"function",
"basicAuthentication",
"(",
"string",
"$",
"username",
",",
"string",
"$",
"password",
"=",
"\"\"",
")",
":",
"HttpRequest",
"{",
"$",
"this",
"->",
"username",
"=",
"$",
"username",
";",
"$",
"this",
"->",
"password",
"=",
"$",
"password",
";",
"return",
"$",
"this",
";",
"}"
] | Sets the basic authentication to use on the HttpRequest
@param string $username the username to use with Basic Authentication
@param string $password the password to use with Basic Authentication
@return HttpRequest | [
"Sets",
"the",
"basic",
"authentication",
"to",
"use",
"on",
"the",
"HttpRequest"
] | 1a4a7d3d30d710ce4062c7628010ee4f06d2359c | https://github.com/Rehyved/php-http-client/blob/1a4a7d3d30d710ce4062c7628010ee4f06d2359c/src/rehyved/Http/HttpRequest.php#L201-L206 |
10,162 | Rehyved/php-http-client | src/rehyved/Http/HttpRequest.php | HttpRequest.put | public function put(string $path, $body): HttpResponse
{
return $this->request($path, HttpMethod::PUT, $body);
} | php | public function put(string $path, $body): HttpResponse
{
return $this->request($path, HttpMethod::PUT, $body);
} | [
"public",
"function",
"put",
"(",
"string",
"$",
"path",
",",
"$",
"body",
")",
":",
"HttpResponse",
"{",
"return",
"$",
"this",
"->",
"request",
"(",
"$",
"path",
",",
"HttpMethod",
"::",
"PUT",
",",
"$",
"body",
")",
";",
"}"
] | Executes the HttpRequest as a PUT request to the specified path with the provided body
@param string $path the path to execute the PUT request to
@param mixed body the body to PUT to the specified path
@return HttpResponse The response to the HttpRequest | [
"Executes",
"the",
"HttpRequest",
"as",
"a",
"PUT",
"request",
"to",
"the",
"specified",
"path",
"with",
"the",
"provided",
"body"
] | 1a4a7d3d30d710ce4062c7628010ee4f06d2359c | https://github.com/Rehyved/php-http-client/blob/1a4a7d3d30d710ce4062c7628010ee4f06d2359c/src/rehyved/Http/HttpRequest.php#L248-L251 |
10,163 | Rehyved/php-http-client | src/rehyved/Http/HttpRequest.php | HttpRequest.post | public function post(string $path, $body): HttpResponse
{
return $this->request($path, HttpMethod::POST, $body);
} | php | public function post(string $path, $body): HttpResponse
{
return $this->request($path, HttpMethod::POST, $body);
} | [
"public",
"function",
"post",
"(",
"string",
"$",
"path",
",",
"$",
"body",
")",
":",
"HttpResponse",
"{",
"return",
"$",
"this",
"->",
"request",
"(",
"$",
"path",
",",
"HttpMethod",
"::",
"POST",
",",
"$",
"body",
")",
";",
"}"
] | Executes the HttpRequest as a POST request to the specified path with the provided body
@param string $path the path to execute the POST request to
@param mixed body the body to POST to the specified path
@return HttpResponse The response to the HttpRequest | [
"Executes",
"the",
"HttpRequest",
"as",
"a",
"POST",
"request",
"to",
"the",
"specified",
"path",
"with",
"the",
"provided",
"body"
] | 1a4a7d3d30d710ce4062c7628010ee4f06d2359c | https://github.com/Rehyved/php-http-client/blob/1a4a7d3d30d710ce4062c7628010ee4f06d2359c/src/rehyved/Http/HttpRequest.php#L259-L262 |
10,164 | Rehyved/php-http-client | src/rehyved/Http/HttpRequest.php | HttpRequest.delete | public function delete(string $path, $body): HttpResponse
{
return $this->request($path, HttpMethod::DELETE, $body);
} | php | public function delete(string $path, $body): HttpResponse
{
return $this->request($path, HttpMethod::DELETE, $body);
} | [
"public",
"function",
"delete",
"(",
"string",
"$",
"path",
",",
"$",
"body",
")",
":",
"HttpResponse",
"{",
"return",
"$",
"this",
"->",
"request",
"(",
"$",
"path",
",",
"HttpMethod",
"::",
"DELETE",
",",
"$",
"body",
")",
";",
"}"
] | Executes the HttpRequest as a DELETE request to the specified path with the provided body
@param string $path the path to execute the DELETE request to
@param mixed body the body to DELETE to the specified path
@return HttpResponse The response to the HttpRequest | [
"Executes",
"the",
"HttpRequest",
"as",
"a",
"DELETE",
"request",
"to",
"the",
"specified",
"path",
"with",
"the",
"provided",
"body"
] | 1a4a7d3d30d710ce4062c7628010ee4f06d2359c | https://github.com/Rehyved/php-http-client/blob/1a4a7d3d30d710ce4062c7628010ee4f06d2359c/src/rehyved/Http/HttpRequest.php#L270-L273 |
10,165 | Rehyved/php-http-client | src/rehyved/Http/HttpRequest.php | HttpRequest.request | private function request(string $path, string $method, $body = null): HttpResponse
{
$ch = curl_init();
$this->processUrl($path, $ch);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
$this->processBody($ch, $body); // Do body first as this might add additional headers
$this->processHeaders($ch);
$this->processCookies($ch);
return $this->send($ch);
} | php | private function request(string $path, string $method, $body = null): HttpResponse
{
$ch = curl_init();
$this->processUrl($path, $ch);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
$this->processBody($ch, $body); // Do body first as this might add additional headers
$this->processHeaders($ch);
$this->processCookies($ch);
return $this->send($ch);
} | [
"private",
"function",
"request",
"(",
"string",
"$",
"path",
",",
"string",
"$",
"method",
",",
"$",
"body",
"=",
"null",
")",
":",
"HttpResponse",
"{",
"$",
"ch",
"=",
"curl_init",
"(",
")",
";",
"$",
"this",
"->",
"processUrl",
"(",
"$",
"path",
",",
"$",
"ch",
")",
";",
"curl_setopt",
"(",
"$",
"ch",
",",
"CURLOPT_CUSTOMREQUEST",
",",
"$",
"method",
")",
";",
"$",
"this",
"->",
"processBody",
"(",
"$",
"ch",
",",
"$",
"body",
")",
";",
"// Do body first as this might add additional headers",
"$",
"this",
"->",
"processHeaders",
"(",
"$",
"ch",
")",
";",
"$",
"this",
"->",
"processCookies",
"(",
"$",
"ch",
")",
";",
"return",
"$",
"this",
"->",
"send",
"(",
"$",
"ch",
")",
";",
"}"
] | Constructs the HTTP request and sends it using the provided method and request body
@param string $path the path to send the request to
@param string $method the HTTP method to use
@param mixed|null $body the body to send
@return HttpResponse the response after sending the HTTP request | [
"Constructs",
"the",
"HTTP",
"request",
"and",
"sends",
"it",
"using",
"the",
"provided",
"method",
"and",
"request",
"body"
] | 1a4a7d3d30d710ce4062c7628010ee4f06d2359c | https://github.com/Rehyved/php-http-client/blob/1a4a7d3d30d710ce4062c7628010ee4f06d2359c/src/rehyved/Http/HttpRequest.php#L282-L295 |
10,166 | Rehyved/php-http-client | src/rehyved/Http/HttpRequest.php | HttpRequest.send | private function send($ch): HttpResponse
{
$returnHeaders = array();
curl_setopt($ch, CURLOPT_HEADERFUNCTION, function ($curl, $header) use (&$returnHeaders) {
if (strpos($header, ':') !== false) {
list($name, $value) = explode(':', $header);
if (!array_key_exists($name, $returnHeaders)) {
$returnHeaders[$name] = array();
}
$returnHeaders[$name][] = trim($value);
}
return strlen($header);
});
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// Ensure we are coping with 300 (redirect) responses:
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_HEADER, true);
// Set request timeout
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $this->timeout);
// Set verification of SSL certificates
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, $this->verifySslCertificate);
if (!empty($this->username)) {
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_USERPWD, "$this->username:$this->password");
}
$response = curl_exec($ch);
$requestInfo = curl_getinfo($ch);
$error = curl_error($ch);
if (!empty($error)) {
throw new HttpRequestException($error);
}
$httpResponse = new HttpResponse($requestInfo, $returnHeaders, $response, $error);
return $httpResponse;
} | php | private function send($ch): HttpResponse
{
$returnHeaders = array();
curl_setopt($ch, CURLOPT_HEADERFUNCTION, function ($curl, $header) use (&$returnHeaders) {
if (strpos($header, ':') !== false) {
list($name, $value) = explode(':', $header);
if (!array_key_exists($name, $returnHeaders)) {
$returnHeaders[$name] = array();
}
$returnHeaders[$name][] = trim($value);
}
return strlen($header);
});
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// Ensure we are coping with 300 (redirect) responses:
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_HEADER, true);
// Set request timeout
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $this->timeout);
// Set verification of SSL certificates
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, $this->verifySslCertificate);
if (!empty($this->username)) {
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_USERPWD, "$this->username:$this->password");
}
$response = curl_exec($ch);
$requestInfo = curl_getinfo($ch);
$error = curl_error($ch);
if (!empty($error)) {
throw new HttpRequestException($error);
}
$httpResponse = new HttpResponse($requestInfo, $returnHeaders, $response, $error);
return $httpResponse;
} | [
"private",
"function",
"send",
"(",
"$",
"ch",
")",
":",
"HttpResponse",
"{",
"$",
"returnHeaders",
"=",
"array",
"(",
")",
";",
"curl_setopt",
"(",
"$",
"ch",
",",
"CURLOPT_HEADERFUNCTION",
",",
"function",
"(",
"$",
"curl",
",",
"$",
"header",
")",
"use",
"(",
"&",
"$",
"returnHeaders",
")",
"{",
"if",
"(",
"strpos",
"(",
"$",
"header",
",",
"':'",
")",
"!==",
"false",
")",
"{",
"list",
"(",
"$",
"name",
",",
"$",
"value",
")",
"=",
"explode",
"(",
"':'",
",",
"$",
"header",
")",
";",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"name",
",",
"$",
"returnHeaders",
")",
")",
"{",
"$",
"returnHeaders",
"[",
"$",
"name",
"]",
"=",
"array",
"(",
")",
";",
"}",
"$",
"returnHeaders",
"[",
"$",
"name",
"]",
"[",
"]",
"=",
"trim",
"(",
"$",
"value",
")",
";",
"}",
"return",
"strlen",
"(",
"$",
"header",
")",
";",
"}",
")",
";",
"curl_setopt",
"(",
"$",
"ch",
",",
"CURLOPT_RETURNTRANSFER",
",",
"true",
")",
";",
"// Ensure we are coping with 300 (redirect) responses:",
"curl_setopt",
"(",
"$",
"ch",
",",
"CURLOPT_FOLLOWLOCATION",
",",
"true",
")",
";",
"curl_setopt",
"(",
"$",
"ch",
",",
"CURLOPT_HEADER",
",",
"true",
")",
";",
"// Set request timeout",
"curl_setopt",
"(",
"$",
"ch",
",",
"CURLOPT_CONNECTTIMEOUT",
",",
"$",
"this",
"->",
"timeout",
")",
";",
"// Set verification of SSL certificates",
"curl_setopt",
"(",
"$",
"ch",
",",
"CURLOPT_SSL_VERIFYPEER",
",",
"$",
"this",
"->",
"verifySslCertificate",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"username",
")",
")",
"{",
"curl_setopt",
"(",
"$",
"ch",
",",
"CURLOPT_HTTPAUTH",
",",
"CURLAUTH_BASIC",
")",
";",
"curl_setopt",
"(",
"$",
"ch",
",",
"CURLOPT_USERPWD",
",",
"\"$this->username:$this->password\"",
")",
";",
"}",
"$",
"response",
"=",
"curl_exec",
"(",
"$",
"ch",
")",
";",
"$",
"requestInfo",
"=",
"curl_getinfo",
"(",
"$",
"ch",
")",
";",
"$",
"error",
"=",
"curl_error",
"(",
"$",
"ch",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"error",
")",
")",
"{",
"throw",
"new",
"HttpRequestException",
"(",
"$",
"error",
")",
";",
"}",
"$",
"httpResponse",
"=",
"new",
"HttpResponse",
"(",
"$",
"requestInfo",
",",
"$",
"returnHeaders",
",",
"$",
"response",
",",
"$",
"error",
")",
";",
"return",
"$",
"httpResponse",
";",
"}"
] | Sends the constructed request
@param mixed $ch the curl handler
@return HttpResponse the HTTP response returned by the request
@throws HttpRequestException If an error occurs when trying to send the request | [
"Sends",
"the",
"constructed",
"request"
] | 1a4a7d3d30d710ce4062c7628010ee4f06d2359c | https://github.com/Rehyved/php-http-client/blob/1a4a7d3d30d710ce4062c7628010ee4f06d2359c/src/rehyved/Http/HttpRequest.php#L303-L346 |
10,167 | bytorsten/graphql-subscriptions | src/GraphQL/Utils.php | Utils.construct | protected static function construct(ExecutionContext $exeContext = null): Executor
{
$executorReflection = new \ReflectionClass(Executor::class);
/** @var Executor $executor */
$executor = $executorReflection->newInstanceWithoutConstructor();
if ($exeContext !== null) {
$constructor = $executorReflection->getConstructor();
$constructor->setAccessible(true);
$constructor->invoke($executor, $exeContext);
}
return $executor;
} | php | protected static function construct(ExecutionContext $exeContext = null): Executor
{
$executorReflection = new \ReflectionClass(Executor::class);
/** @var Executor $executor */
$executor = $executorReflection->newInstanceWithoutConstructor();
if ($exeContext !== null) {
$constructor = $executorReflection->getConstructor();
$constructor->setAccessible(true);
$constructor->invoke($executor, $exeContext);
}
return $executor;
} | [
"protected",
"static",
"function",
"construct",
"(",
"ExecutionContext",
"$",
"exeContext",
"=",
"null",
")",
":",
"Executor",
"{",
"$",
"executorReflection",
"=",
"new",
"\\",
"ReflectionClass",
"(",
"Executor",
"::",
"class",
")",
";",
"/** @var Executor $executor */",
"$",
"executor",
"=",
"$",
"executorReflection",
"->",
"newInstanceWithoutConstructor",
"(",
")",
";",
"if",
"(",
"$",
"exeContext",
"!==",
"null",
")",
"{",
"$",
"constructor",
"=",
"$",
"executorReflection",
"->",
"getConstructor",
"(",
")",
";",
"$",
"constructor",
"->",
"setAccessible",
"(",
"true",
")",
";",
"$",
"constructor",
"->",
"invoke",
"(",
"$",
"executor",
",",
"$",
"exeContext",
")",
";",
"}",
"return",
"$",
"executor",
";",
"}"
] | Some crazy stuff to work around a private constructor
@param ExecutionContext $exeContext
@return Executor | [
"Some",
"crazy",
"stuff",
"to",
"work",
"around",
"a",
"private",
"constructor"
] | c47b40c0c1762439573029cfef49fee5a6ca7a08 | https://github.com/bytorsten/graphql-subscriptions/blob/c47b40c0c1762439573029cfef49fee5a6ca7a08/src/GraphQL/Utils.php#L27-L40 |
10,168 | Dachande663/PHP-DB | src/HybridLogic/DB/Driver/PDO.php | PDO.escape | public function escape($val) {
if($this->db === null) $this->connect();
return $this->db->quote($val);
} | php | public function escape($val) {
if($this->db === null) $this->connect();
return $this->db->quote($val);
} | [
"public",
"function",
"escape",
"(",
"$",
"val",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"db",
"===",
"null",
")",
"$",
"this",
"->",
"connect",
"(",
")",
";",
"return",
"$",
"this",
"->",
"db",
"->",
"quote",
"(",
"$",
"val",
")",
";",
"}"
] | Escape a Value
@param string Raw value
@return string Escaped value | [
"Escape",
"a",
"Value"
] | fed6ec6f4612a36ebc3b10f6d06c8d70ba3b6ef9 | https://github.com/Dachande663/PHP-DB/blob/fed6ec6f4612a36ebc3b10f6d06c8d70ba3b6ef9/src/HybridLogic/DB/Driver/PDO.php#L118-L121 |
10,169 | tadcka/Mapper | src/Tadcka/Mapper/Source/Type/SourceTypeRegistry.php | SourceTypeRegistry.add | public function add(SourceTypeInterface $type, $alias)
{
if ($alias !== $type->getName()) {
throw new SourceTypeException(sprintf('Mapper source type %s alias is not valid!', $alias));
}
$this->types[$alias] = $type;
} | php | public function add(SourceTypeInterface $type, $alias)
{
if ($alias !== $type->getName()) {
throw new SourceTypeException(sprintf('Mapper source type %s alias is not valid!', $alias));
}
$this->types[$alias] = $type;
} | [
"public",
"function",
"add",
"(",
"SourceTypeInterface",
"$",
"type",
",",
"$",
"alias",
")",
"{",
"if",
"(",
"$",
"alias",
"!==",
"$",
"type",
"->",
"getName",
"(",
")",
")",
"{",
"throw",
"new",
"SourceTypeException",
"(",
"sprintf",
"(",
"'Mapper source type %s alias is not valid!'",
",",
"$",
"alias",
")",
")",
";",
"}",
"$",
"this",
"->",
"types",
"[",
"$",
"alias",
"]",
"=",
"$",
"type",
";",
"}"
] | Add mapper source type.
@param SourceTypeInterface $type
@param string $alias
@throws SourceTypeException | [
"Add",
"mapper",
"source",
"type",
"."
] | 6853a2be08dcd35a1013c0a4aba9b71a727ff7da | https://github.com/tadcka/Mapper/blob/6853a2be08dcd35a1013c0a4aba9b71a727ff7da/src/Tadcka/Mapper/Source/Type/SourceTypeRegistry.php#L41-L48 |
10,170 | tadcka/Mapper | src/Tadcka/Mapper/Source/Type/SourceTypeRegistry.php | SourceTypeRegistry.getType | public function getType($name)
{
if (isset($this->types[$name])) {
return $this->types[$name];
}
throw new SourceTypeException(sprintf('Mapper source type %s not found!', $name));
} | php | public function getType($name)
{
if (isset($this->types[$name])) {
return $this->types[$name];
}
throw new SourceTypeException(sprintf('Mapper source type %s not found!', $name));
} | [
"public",
"function",
"getType",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"types",
"[",
"$",
"name",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"types",
"[",
"$",
"name",
"]",
";",
"}",
"throw",
"new",
"SourceTypeException",
"(",
"sprintf",
"(",
"'Mapper source type %s not found!'",
",",
"$",
"name",
")",
")",
";",
"}"
] | Get mapper source type by name.
@param string $name
@return SourceTypeInterface
@throws SourceTypeException | [
"Get",
"mapper",
"source",
"type",
"by",
"name",
"."
] | 6853a2be08dcd35a1013c0a4aba9b71a727ff7da | https://github.com/tadcka/Mapper/blob/6853a2be08dcd35a1013c0a4aba9b71a727ff7da/src/Tadcka/Mapper/Source/Type/SourceTypeRegistry.php#L59-L66 |
10,171 | bishopb/vanilla | library/core/class.email.php | Gdn_Email.Bcc | public function Bcc($RecipientEmail, $RecipientName = '') {
ob_start();
$this->PhpMailer->AddBCC($RecipientEmail, $RecipientName);
ob_end_clean();
return $this;
} | php | public function Bcc($RecipientEmail, $RecipientName = '') {
ob_start();
$this->PhpMailer->AddBCC($RecipientEmail, $RecipientName);
ob_end_clean();
return $this;
} | [
"public",
"function",
"Bcc",
"(",
"$",
"RecipientEmail",
",",
"$",
"RecipientName",
"=",
"''",
")",
"{",
"ob_start",
"(",
")",
";",
"$",
"this",
"->",
"PhpMailer",
"->",
"AddBCC",
"(",
"$",
"RecipientEmail",
",",
"$",
"RecipientName",
")",
";",
"ob_end_clean",
"(",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Adds to the "Bcc" recipient collection.
@param mixed $RecipientEmail An email (or array of emails) to add to the "Bcc" recipient collection.
@param string $RecipientName The recipient name associated with $RecipientEmail. If $RecipientEmail is
an array of email addresses, this value will be ignored.
@return Email | [
"Adds",
"to",
"the",
"Bcc",
"recipient",
"collection",
"."
] | 8494eb4a4ad61603479015a8054d23ff488364e8 | https://github.com/bishopb/vanilla/blob/8494eb4a4ad61603479015a8054d23ff488364e8/library/core/class.email.php#L69-L74 |
10,172 | bishopb/vanilla | library/core/class.email.php | Gdn_Email.Cc | public function Cc($RecipientEmail, $RecipientName = '') {
ob_start();
$this->PhpMailer->AddCC($RecipientEmail, $RecipientName);
ob_end_clean();
return $this;
} | php | public function Cc($RecipientEmail, $RecipientName = '') {
ob_start();
$this->PhpMailer->AddCC($RecipientEmail, $RecipientName);
ob_end_clean();
return $this;
} | [
"public",
"function",
"Cc",
"(",
"$",
"RecipientEmail",
",",
"$",
"RecipientName",
"=",
"''",
")",
"{",
"ob_start",
"(",
")",
";",
"$",
"this",
"->",
"PhpMailer",
"->",
"AddCC",
"(",
"$",
"RecipientEmail",
",",
"$",
"RecipientName",
")",
";",
"ob_end_clean",
"(",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Adds to the "Cc" recipient collection.
@param mixed $RecipientEmail An email (or array of emails) to add to the "Cc" recipient collection.
@param string $RecipientName The recipient name associated with $RecipientEmail. If $RecipientEmail is
an array of email addresses, this value will be ignored.
@return Email | [
"Adds",
"to",
"the",
"Cc",
"recipient",
"collection",
"."
] | 8494eb4a4ad61603479015a8054d23ff488364e8 | https://github.com/bishopb/vanilla/blob/8494eb4a4ad61603479015a8054d23ff488364e8/library/core/class.email.php#L84-L89 |
10,173 | bishopb/vanilla | library/core/class.email.php | Gdn_Email.Clear | public function Clear() {
$this->PhpMailer->ClearAllRecipients();
$this->PhpMailer->Body = '';
$this->PhpMailer->AltBody = '';
$this->From();
$this->_IsToSet = FALSE;
$this->MimeType(C('Garden.Email.MimeType', 'text/plain'));
$this->_MasterView = 'email.master';
$this->Skipped = array();
return $this;
} | php | public function Clear() {
$this->PhpMailer->ClearAllRecipients();
$this->PhpMailer->Body = '';
$this->PhpMailer->AltBody = '';
$this->From();
$this->_IsToSet = FALSE;
$this->MimeType(C('Garden.Email.MimeType', 'text/plain'));
$this->_MasterView = 'email.master';
$this->Skipped = array();
return $this;
} | [
"public",
"function",
"Clear",
"(",
")",
"{",
"$",
"this",
"->",
"PhpMailer",
"->",
"ClearAllRecipients",
"(",
")",
";",
"$",
"this",
"->",
"PhpMailer",
"->",
"Body",
"=",
"''",
";",
"$",
"this",
"->",
"PhpMailer",
"->",
"AltBody",
"=",
"''",
";",
"$",
"this",
"->",
"From",
"(",
")",
";",
"$",
"this",
"->",
"_IsToSet",
"=",
"FALSE",
";",
"$",
"this",
"->",
"MimeType",
"(",
"C",
"(",
"'Garden.Email.MimeType'",
",",
"'text/plain'",
")",
")",
";",
"$",
"this",
"->",
"_MasterView",
"=",
"'email.master'",
";",
"$",
"this",
"->",
"Skipped",
"=",
"array",
"(",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Clears out all previously specified values for this object and restores
it to the state it was in when it was instantiated.
@return Email | [
"Clears",
"out",
"all",
"previously",
"specified",
"values",
"for",
"this",
"object",
"and",
"restores",
"it",
"to",
"the",
"state",
"it",
"was",
"in",
"when",
"it",
"was",
"instantiated",
"."
] | 8494eb4a4ad61603479015a8054d23ff488364e8 | https://github.com/bishopb/vanilla/blob/8494eb4a4ad61603479015a8054d23ff488364e8/library/core/class.email.php#L97-L107 |
10,174 | bishopb/vanilla | library/core/class.email.php | Gdn_Email.From | public function From($SenderEmail = '', $SenderName = '', $bOverrideSender = FALSE) {
if ($SenderEmail == '') {
$SenderEmail = C('Garden.Email.SupportAddress', '');
if (!$SenderEmail) {
$SenderEmail = 'noreply@'.Gdn::Request()->Host();
}
}
if ($SenderName == '')
$SenderName = C('Garden.Email.SupportName', C('Garden.Title', ''));
if($this->PhpMailer->Sender == '' || $bOverrideSender) $this->PhpMailer->Sender = $SenderEmail;
ob_start();
$this->PhpMailer->SetFrom($SenderEmail, $SenderName, FALSE);
ob_end_clean();
return $this;
} | php | public function From($SenderEmail = '', $SenderName = '', $bOverrideSender = FALSE) {
if ($SenderEmail == '') {
$SenderEmail = C('Garden.Email.SupportAddress', '');
if (!$SenderEmail) {
$SenderEmail = 'noreply@'.Gdn::Request()->Host();
}
}
if ($SenderName == '')
$SenderName = C('Garden.Email.SupportName', C('Garden.Title', ''));
if($this->PhpMailer->Sender == '' || $bOverrideSender) $this->PhpMailer->Sender = $SenderEmail;
ob_start();
$this->PhpMailer->SetFrom($SenderEmail, $SenderName, FALSE);
ob_end_clean();
return $this;
} | [
"public",
"function",
"From",
"(",
"$",
"SenderEmail",
"=",
"''",
",",
"$",
"SenderName",
"=",
"''",
",",
"$",
"bOverrideSender",
"=",
"FALSE",
")",
"{",
"if",
"(",
"$",
"SenderEmail",
"==",
"''",
")",
"{",
"$",
"SenderEmail",
"=",
"C",
"(",
"'Garden.Email.SupportAddress'",
",",
"''",
")",
";",
"if",
"(",
"!",
"$",
"SenderEmail",
")",
"{",
"$",
"SenderEmail",
"=",
"'noreply@'",
".",
"Gdn",
"::",
"Request",
"(",
")",
"->",
"Host",
"(",
")",
";",
"}",
"}",
"if",
"(",
"$",
"SenderName",
"==",
"''",
")",
"$",
"SenderName",
"=",
"C",
"(",
"'Garden.Email.SupportName'",
",",
"C",
"(",
"'Garden.Title'",
",",
"''",
")",
")",
";",
"if",
"(",
"$",
"this",
"->",
"PhpMailer",
"->",
"Sender",
"==",
"''",
"||",
"$",
"bOverrideSender",
")",
"$",
"this",
"->",
"PhpMailer",
"->",
"Sender",
"=",
"$",
"SenderEmail",
";",
"ob_start",
"(",
")",
";",
"$",
"this",
"->",
"PhpMailer",
"->",
"SetFrom",
"(",
"$",
"SenderEmail",
",",
"$",
"SenderName",
",",
"FALSE",
")",
";",
"ob_end_clean",
"(",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Allows the explicit definition of the email's sender address & name.
Defaults to the applications Configuration 'SupportEmail' & 'SupportName'
settings respectively.
@param string $SenderEmail
@param string $SenderName
@return Email | [
"Allows",
"the",
"explicit",
"definition",
"of",
"the",
"email",
"s",
"sender",
"address",
"&",
"name",
".",
"Defaults",
"to",
"the",
"applications",
"Configuration",
"SupportEmail",
"&",
"SupportName",
"settings",
"respectively",
"."
] | 8494eb4a4ad61603479015a8054d23ff488364e8 | https://github.com/bishopb/vanilla/blob/8494eb4a4ad61603479015a8054d23ff488364e8/library/core/class.email.php#L118-L135 |
10,175 | bishopb/vanilla | library/core/class.email.php | Gdn_Email.Message | public function Message($Message) {
// htmlspecialchars_decode is being used here to revert any specialchar escaping done by Gdn_Format::Text()
// which, untreated, would result in ' in the message in place of single quotes.
if ($this->PhpMailer->ContentType == 'text/html') {
$TextVersion = FALSE;
if (stristr($Message, '<!-- //TEXT VERSION FOLLOWS//')) {
$EmailParts = explode('<!-- //TEXT VERSION FOLLOWS//', $Message);
$TextVersion = array_pop($EmailParts);
$Message = array_shift($EmailParts);
$TextVersion = trim(strip_tags(preg_replace('/<(head|title|style|script)[^>]*>.*?<\/\\1>/s','',$TextVersion)));
$Message = trim($Message);
}
$this->PhpMailer->MsgHTML(htmlspecialchars_decode($Message,ENT_QUOTES));
if ($TextVersion !== FALSE && !empty($TextVersion)) {
$TextVersion = html_entity_decode($TextVersion);
$this->PhpMailer->AltBody = $TextVersion;
}
} else {
$this->PhpMailer->Body = htmlspecialchars_decode($Message,ENT_QUOTES);
}
return $this;
} | php | public function Message($Message) {
// htmlspecialchars_decode is being used here to revert any specialchar escaping done by Gdn_Format::Text()
// which, untreated, would result in ' in the message in place of single quotes.
if ($this->PhpMailer->ContentType == 'text/html') {
$TextVersion = FALSE;
if (stristr($Message, '<!-- //TEXT VERSION FOLLOWS//')) {
$EmailParts = explode('<!-- //TEXT VERSION FOLLOWS//', $Message);
$TextVersion = array_pop($EmailParts);
$Message = array_shift($EmailParts);
$TextVersion = trim(strip_tags(preg_replace('/<(head|title|style|script)[^>]*>.*?<\/\\1>/s','',$TextVersion)));
$Message = trim($Message);
}
$this->PhpMailer->MsgHTML(htmlspecialchars_decode($Message,ENT_QUOTES));
if ($TextVersion !== FALSE && !empty($TextVersion)) {
$TextVersion = html_entity_decode($TextVersion);
$this->PhpMailer->AltBody = $TextVersion;
}
} else {
$this->PhpMailer->Body = htmlspecialchars_decode($Message,ENT_QUOTES);
}
return $this;
} | [
"public",
"function",
"Message",
"(",
"$",
"Message",
")",
"{",
"// htmlspecialchars_decode is being used here to revert any specialchar escaping done by Gdn_Format::Text()",
"// which, untreated, would result in ' in the message in place of single quotes.",
"if",
"(",
"$",
"this",
"->",
"PhpMailer",
"->",
"ContentType",
"==",
"'text/html'",
")",
"{",
"$",
"TextVersion",
"=",
"FALSE",
";",
"if",
"(",
"stristr",
"(",
"$",
"Message",
",",
"'<!-- //TEXT VERSION FOLLOWS//'",
")",
")",
"{",
"$",
"EmailParts",
"=",
"explode",
"(",
"'<!-- //TEXT VERSION FOLLOWS//'",
",",
"$",
"Message",
")",
";",
"$",
"TextVersion",
"=",
"array_pop",
"(",
"$",
"EmailParts",
")",
";",
"$",
"Message",
"=",
"array_shift",
"(",
"$",
"EmailParts",
")",
";",
"$",
"TextVersion",
"=",
"trim",
"(",
"strip_tags",
"(",
"preg_replace",
"(",
"'/<(head|title|style|script)[^>]*>.*?<\\/\\\\1>/s'",
",",
"''",
",",
"$",
"TextVersion",
")",
")",
")",
";",
"$",
"Message",
"=",
"trim",
"(",
"$",
"Message",
")",
";",
"}",
"$",
"this",
"->",
"PhpMailer",
"->",
"MsgHTML",
"(",
"htmlspecialchars_decode",
"(",
"$",
"Message",
",",
"ENT_QUOTES",
")",
")",
";",
"if",
"(",
"$",
"TextVersion",
"!==",
"FALSE",
"&&",
"!",
"empty",
"(",
"$",
"TextVersion",
")",
")",
"{",
"$",
"TextVersion",
"=",
"html_entity_decode",
"(",
"$",
"TextVersion",
")",
";",
"$",
"this",
"->",
"PhpMailer",
"->",
"AltBody",
"=",
"$",
"TextVersion",
";",
"}",
"}",
"else",
"{",
"$",
"this",
"->",
"PhpMailer",
"->",
"Body",
"=",
"htmlspecialchars_decode",
"(",
"$",
"Message",
",",
"ENT_QUOTES",
")",
";",
"}",
"return",
"$",
"this",
";",
"}"
] | The message to be sent.
@param string $Message The message to be sent.
@param string $TextVersion Optional plaintext version of the message
@return Email | [
"The",
"message",
"to",
"be",
"sent",
"."
] | 8494eb4a4ad61603479015a8054d23ff488364e8 | https://github.com/bishopb/vanilla/blob/8494eb4a4ad61603479015a8054d23ff488364e8/library/core/class.email.php#L156-L180 |
10,176 | bishopb/vanilla | library/core/class.email.php | Gdn_Email.To | public function To($RecipientEmail, $RecipientName = '') {
if (is_string($RecipientEmail)) {
if (strpos($RecipientEmail, ',') > 0) {
$RecipientEmail = explode(',', $RecipientEmail);
// trim no need, PhpMailer::AddAnAddress() will do it
return $this->To($RecipientEmail, $RecipientName);
}
if ($this->PhpMailer->SingleTo) return $this->AddTo($RecipientEmail, $RecipientName);
if (!$this->_IsToSet){
$this->_IsToSet = TRUE;
$this->AddTo($RecipientEmail, $RecipientName);
} else
$this->Cc($RecipientEmail, $RecipientName);
return $this;
} elseif ((is_object($RecipientEmail) && property_exists($RecipientEmail, 'Email'))
|| (is_array($RecipientEmail) && isset($RecipientEmail['Email']))) {
$User = $RecipientEmail;
$RecipientName = GetValue('Name', $User);
$RecipientEmail = GetValue('Email', $User);
$UserID = GetValue('UserID', $User, FALSE);
if ($UserID !== FALSE) {
// Check to make sure the user can receive email.
if (!Gdn::UserModel()->CheckPermission($UserID, 'Garden.Email.View')) {
$this->Skipped[] = $User;
return $this;
}
}
return $this->To($RecipientEmail, $RecipientName);
} elseif ($RecipientEmail instanceof Gdn_DataSet) {
foreach($RecipientEmail->ResultObject() as $Object) $this->To($Object);
return $this;
} elseif (is_array($RecipientEmail)) {
$Count = count($RecipientEmail);
if (!is_array($RecipientName)) $RecipientName = array_fill(0, $Count, '');
if ($Count == count($RecipientName)) {
$RecipientEmail = array_combine($RecipientEmail, $RecipientName);
foreach($RecipientEmail as $Email => $Name) $this->To($Email, $Name);
} else
trigger_error(ErrorMessage('Size of arrays do not match', 'Email', 'To'), E_USER_ERROR);
return $this;
}
trigger_error(ErrorMessage('Incorrect first parameter ('.GetType($RecipientEmail).') passed to function.', 'Email', 'To'), E_USER_ERROR);
} | php | public function To($RecipientEmail, $RecipientName = '') {
if (is_string($RecipientEmail)) {
if (strpos($RecipientEmail, ',') > 0) {
$RecipientEmail = explode(',', $RecipientEmail);
// trim no need, PhpMailer::AddAnAddress() will do it
return $this->To($RecipientEmail, $RecipientName);
}
if ($this->PhpMailer->SingleTo) return $this->AddTo($RecipientEmail, $RecipientName);
if (!$this->_IsToSet){
$this->_IsToSet = TRUE;
$this->AddTo($RecipientEmail, $RecipientName);
} else
$this->Cc($RecipientEmail, $RecipientName);
return $this;
} elseif ((is_object($RecipientEmail) && property_exists($RecipientEmail, 'Email'))
|| (is_array($RecipientEmail) && isset($RecipientEmail['Email']))) {
$User = $RecipientEmail;
$RecipientName = GetValue('Name', $User);
$RecipientEmail = GetValue('Email', $User);
$UserID = GetValue('UserID', $User, FALSE);
if ($UserID !== FALSE) {
// Check to make sure the user can receive email.
if (!Gdn::UserModel()->CheckPermission($UserID, 'Garden.Email.View')) {
$this->Skipped[] = $User;
return $this;
}
}
return $this->To($RecipientEmail, $RecipientName);
} elseif ($RecipientEmail instanceof Gdn_DataSet) {
foreach($RecipientEmail->ResultObject() as $Object) $this->To($Object);
return $this;
} elseif (is_array($RecipientEmail)) {
$Count = count($RecipientEmail);
if (!is_array($RecipientName)) $RecipientName = array_fill(0, $Count, '');
if ($Count == count($RecipientName)) {
$RecipientEmail = array_combine($RecipientEmail, $RecipientName);
foreach($RecipientEmail as $Email => $Name) $this->To($Email, $Name);
} else
trigger_error(ErrorMessage('Size of arrays do not match', 'Email', 'To'), E_USER_ERROR);
return $this;
}
trigger_error(ErrorMessage('Incorrect first parameter ('.GetType($RecipientEmail).') passed to function.', 'Email', 'To'), E_USER_ERROR);
} | [
"public",
"function",
"To",
"(",
"$",
"RecipientEmail",
",",
"$",
"RecipientName",
"=",
"''",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"RecipientEmail",
")",
")",
"{",
"if",
"(",
"strpos",
"(",
"$",
"RecipientEmail",
",",
"','",
")",
">",
"0",
")",
"{",
"$",
"RecipientEmail",
"=",
"explode",
"(",
"','",
",",
"$",
"RecipientEmail",
")",
";",
"// trim no need, PhpMailer::AddAnAddress() will do it",
"return",
"$",
"this",
"->",
"To",
"(",
"$",
"RecipientEmail",
",",
"$",
"RecipientName",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"PhpMailer",
"->",
"SingleTo",
")",
"return",
"$",
"this",
"->",
"AddTo",
"(",
"$",
"RecipientEmail",
",",
"$",
"RecipientName",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"_IsToSet",
")",
"{",
"$",
"this",
"->",
"_IsToSet",
"=",
"TRUE",
";",
"$",
"this",
"->",
"AddTo",
"(",
"$",
"RecipientEmail",
",",
"$",
"RecipientName",
")",
";",
"}",
"else",
"$",
"this",
"->",
"Cc",
"(",
"$",
"RecipientEmail",
",",
"$",
"RecipientName",
")",
";",
"return",
"$",
"this",
";",
"}",
"elseif",
"(",
"(",
"is_object",
"(",
"$",
"RecipientEmail",
")",
"&&",
"property_exists",
"(",
"$",
"RecipientEmail",
",",
"'Email'",
")",
")",
"||",
"(",
"is_array",
"(",
"$",
"RecipientEmail",
")",
"&&",
"isset",
"(",
"$",
"RecipientEmail",
"[",
"'Email'",
"]",
")",
")",
")",
"{",
"$",
"User",
"=",
"$",
"RecipientEmail",
";",
"$",
"RecipientName",
"=",
"GetValue",
"(",
"'Name'",
",",
"$",
"User",
")",
";",
"$",
"RecipientEmail",
"=",
"GetValue",
"(",
"'Email'",
",",
"$",
"User",
")",
";",
"$",
"UserID",
"=",
"GetValue",
"(",
"'UserID'",
",",
"$",
"User",
",",
"FALSE",
")",
";",
"if",
"(",
"$",
"UserID",
"!==",
"FALSE",
")",
"{",
"// Check to make sure the user can receive email.",
"if",
"(",
"!",
"Gdn",
"::",
"UserModel",
"(",
")",
"->",
"CheckPermission",
"(",
"$",
"UserID",
",",
"'Garden.Email.View'",
")",
")",
"{",
"$",
"this",
"->",
"Skipped",
"[",
"]",
"=",
"$",
"User",
";",
"return",
"$",
"this",
";",
"}",
"}",
"return",
"$",
"this",
"->",
"To",
"(",
"$",
"RecipientEmail",
",",
"$",
"RecipientName",
")",
";",
"}",
"elseif",
"(",
"$",
"RecipientEmail",
"instanceof",
"Gdn_DataSet",
")",
"{",
"foreach",
"(",
"$",
"RecipientEmail",
"->",
"ResultObject",
"(",
")",
"as",
"$",
"Object",
")",
"$",
"this",
"->",
"To",
"(",
"$",
"Object",
")",
";",
"return",
"$",
"this",
";",
"}",
"elseif",
"(",
"is_array",
"(",
"$",
"RecipientEmail",
")",
")",
"{",
"$",
"Count",
"=",
"count",
"(",
"$",
"RecipientEmail",
")",
";",
"if",
"(",
"!",
"is_array",
"(",
"$",
"RecipientName",
")",
")",
"$",
"RecipientName",
"=",
"array_fill",
"(",
"0",
",",
"$",
"Count",
",",
"''",
")",
";",
"if",
"(",
"$",
"Count",
"==",
"count",
"(",
"$",
"RecipientName",
")",
")",
"{",
"$",
"RecipientEmail",
"=",
"array_combine",
"(",
"$",
"RecipientEmail",
",",
"$",
"RecipientName",
")",
";",
"foreach",
"(",
"$",
"RecipientEmail",
"as",
"$",
"Email",
"=>",
"$",
"Name",
")",
"$",
"this",
"->",
"To",
"(",
"$",
"Email",
",",
"$",
"Name",
")",
";",
"}",
"else",
"trigger_error",
"(",
"ErrorMessage",
"(",
"'Size of arrays do not match'",
",",
"'Email'",
",",
"'To'",
")",
",",
"E_USER_ERROR",
")",
";",
"return",
"$",
"this",
";",
"}",
"trigger_error",
"(",
"ErrorMessage",
"(",
"'Incorrect first parameter ('",
".",
"GetType",
"(",
"$",
"RecipientEmail",
")",
".",
"') passed to function.'",
",",
"'Email'",
",",
"'To'",
")",
",",
"E_USER_ERROR",
")",
";",
"}"
] | Adds to the "To" recipient collection.
@param mixed $RecipientEmail An email (or array of emails) to add to the "To" recipient collection.
@param string $RecipientName The recipient name associated with $RecipientEmail. If $RecipientEmail is
an array of email addresses, this value will be ignored. | [
"Adds",
"to",
"the",
"To",
"recipient",
"collection",
"."
] | 8494eb4a4ad61603479015a8054d23ff488364e8 | https://github.com/bishopb/vanilla/blob/8494eb4a4ad61603479015a8054d23ff488364e8/library/core/class.email.php#L290-L342 |
10,177 | wigedev/simple-mvc | src/Event/EventHandlerCollection.php | EventHandlerCollection.execute | public function execute(string $event)
{
foreach ($this->members as $member) {
if ($member->getEvent() === $event) {
$member->execute();
}
}
} | php | public function execute(string $event)
{
foreach ($this->members as $member) {
if ($member->getEvent() === $event) {
$member->execute();
}
}
} | [
"public",
"function",
"execute",
"(",
"string",
"$",
"event",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"members",
"as",
"$",
"member",
")",
"{",
"if",
"(",
"$",
"member",
"->",
"getEvent",
"(",
")",
"===",
"$",
"event",
")",
"{",
"$",
"member",
"->",
"execute",
"(",
")",
";",
"}",
"}",
"}"
] | Loop through and execute each member of the collection
@param string $event | [
"Loop",
"through",
"and",
"execute",
"each",
"member",
"of",
"the",
"collection"
] | b722eff02c5dcd8c6f09c8d78f72bc71cb9e1a94 | https://github.com/wigedev/simple-mvc/blob/b722eff02c5dcd8c6f09c8d78f72bc71cb9e1a94/src/Event/EventHandlerCollection.php#L15-L22 |
10,178 | rseyferth/chickenwire | src/ChickenWire/I18n/SimpleBackend.php | SimpleBackend.loadAll | public function loadAll($prefix = '')
{
// Loop through files
foreach ($this->_files as $section => $file) {
// Load it?
if (strlen($prefix) == 0 ||
$prefix == $section ||
(strlen($section) > strlen($prefix) && substr($section, 0, strlen($prefix)) == $prefix) ||
(strlen($section) < strlen($prefix) && substr($prefix, 0, strlen($section)) == $section)) {
// Load file
$this->_loadFile($file);
// Remove from queue
unset($this->_files[$section]);
}
}
} | php | public function loadAll($prefix = '')
{
// Loop through files
foreach ($this->_files as $section => $file) {
// Load it?
if (strlen($prefix) == 0 ||
$prefix == $section ||
(strlen($section) > strlen($prefix) && substr($section, 0, strlen($prefix)) == $prefix) ||
(strlen($section) < strlen($prefix) && substr($prefix, 0, strlen($section)) == $section)) {
// Load file
$this->_loadFile($file);
// Remove from queue
unset($this->_files[$section]);
}
}
} | [
"public",
"function",
"loadAll",
"(",
"$",
"prefix",
"=",
"''",
")",
"{",
"// Loop through files",
"foreach",
"(",
"$",
"this",
"->",
"_files",
"as",
"$",
"section",
"=>",
"$",
"file",
")",
"{",
"// Load it?",
"if",
"(",
"strlen",
"(",
"$",
"prefix",
")",
"==",
"0",
"||",
"$",
"prefix",
"==",
"$",
"section",
"||",
"(",
"strlen",
"(",
"$",
"section",
")",
">",
"strlen",
"(",
"$",
"prefix",
")",
"&&",
"substr",
"(",
"$",
"section",
",",
"0",
",",
"strlen",
"(",
"$",
"prefix",
")",
")",
"==",
"$",
"prefix",
")",
"||",
"(",
"strlen",
"(",
"$",
"section",
")",
"<",
"strlen",
"(",
"$",
"prefix",
")",
"&&",
"substr",
"(",
"$",
"prefix",
",",
"0",
",",
"strlen",
"(",
"$",
"section",
")",
")",
"==",
"$",
"section",
")",
")",
"{",
"// Load file",
"$",
"this",
"->",
"_loadFile",
"(",
"$",
"file",
")",
";",
"// Remove from queue",
"unset",
"(",
"$",
"this",
"->",
"_files",
"[",
"$",
"section",
"]",
")",
";",
"}",
"}",
"}"
] | Load all locale files
@return void | [
"Load",
"all",
"locale",
"files"
] | 74921f0a0d489366602e25df43eda894719e43d3 | https://github.com/rseyferth/chickenwire/blob/74921f0a0d489366602e25df43eda894719e43d3/src/ChickenWire/I18n/SimpleBackend.php#L206-L228 |
10,179 | zepi/turbo-base | Zepi/Web/AccessControl/src/EventHandler/RegisterMenuEntries.php | RegisterMenuEntries.execute | public function execute(Framework $framework, WebRequest $request, Response $response)
{
if ($request->hasSession()) {
$profileMenuEntry = new \Zepi\Web\General\Entity\MenuEntry(
'profile',
$this->translate('Profile', '\\Zepi\\Web\\AccessControl'),
'profile',
'mdi-person'
);
$this->getMenuManager()->addMenuEntry('menu-right', $profileMenuEntry, 90);
// Add the hidden user settings menu entry
$userSettingsSubMenuEntry = new \Zepi\Web\General\Entity\HiddenMenuEntry(
$this->translate('User settings', '\\Zepi\\Web\\AccessControl')
);
$profileMenuEntry->addChild($userSettingsSubMenuEntry);
// Add the hidden change password menu entry
$changePasswordSubMenuEntry = new \Zepi\Web\General\Entity\HiddenMenuEntry(
$this->translate('Change password', '\\Zepi\\Web\\AccessControl'),
'profile/change-password',
'mdi-vpn-key'
);
$userSettingsSubMenuEntry->addChild($changePasswordSubMenuEntry);
// Add the logout menu entry
$menuEntry = new \Zepi\Web\General\Entity\MenuEntry(
'logout',
$this->translate('Logout', '\\Zepi\\Web\\AccessControl'),
'logout',
'glyphicon-log-out'
);
$this->getMenuManager()->addMenuEntry('menu-right', $menuEntry, 100);
} else {
if ($this->getSetting('accesscontrol.allowRegistration')) {
$menuEntry = new \Zepi\Web\General\Entity\MenuEntry(
'registration',
$this->translate('Registration', '\\Pmx\\Autopilot\\AccessControl'),
'/register/',
'mdi-account-circle'
);
$this->getMenuManager()->addMenuEntry('menu-right', $menuEntry);
}
$menuEntry = new \Zepi\Web\General\Entity\MenuEntry(
'login',
$this->translate('Login', '\\Zepi\\Web\\AccessControl'),
'login',
'glyphicon-log-in'
);
$this->getMenuManager()->addMenuEntry('menu-right', $menuEntry, 100);
}
} | php | public function execute(Framework $framework, WebRequest $request, Response $response)
{
if ($request->hasSession()) {
$profileMenuEntry = new \Zepi\Web\General\Entity\MenuEntry(
'profile',
$this->translate('Profile', '\\Zepi\\Web\\AccessControl'),
'profile',
'mdi-person'
);
$this->getMenuManager()->addMenuEntry('menu-right', $profileMenuEntry, 90);
// Add the hidden user settings menu entry
$userSettingsSubMenuEntry = new \Zepi\Web\General\Entity\HiddenMenuEntry(
$this->translate('User settings', '\\Zepi\\Web\\AccessControl')
);
$profileMenuEntry->addChild($userSettingsSubMenuEntry);
// Add the hidden change password menu entry
$changePasswordSubMenuEntry = new \Zepi\Web\General\Entity\HiddenMenuEntry(
$this->translate('Change password', '\\Zepi\\Web\\AccessControl'),
'profile/change-password',
'mdi-vpn-key'
);
$userSettingsSubMenuEntry->addChild($changePasswordSubMenuEntry);
// Add the logout menu entry
$menuEntry = new \Zepi\Web\General\Entity\MenuEntry(
'logout',
$this->translate('Logout', '\\Zepi\\Web\\AccessControl'),
'logout',
'glyphicon-log-out'
);
$this->getMenuManager()->addMenuEntry('menu-right', $menuEntry, 100);
} else {
if ($this->getSetting('accesscontrol.allowRegistration')) {
$menuEntry = new \Zepi\Web\General\Entity\MenuEntry(
'registration',
$this->translate('Registration', '\\Pmx\\Autopilot\\AccessControl'),
'/register/',
'mdi-account-circle'
);
$this->getMenuManager()->addMenuEntry('menu-right', $menuEntry);
}
$menuEntry = new \Zepi\Web\General\Entity\MenuEntry(
'login',
$this->translate('Login', '\\Zepi\\Web\\AccessControl'),
'login',
'glyphicon-log-in'
);
$this->getMenuManager()->addMenuEntry('menu-right', $menuEntry, 100);
}
} | [
"public",
"function",
"execute",
"(",
"Framework",
"$",
"framework",
",",
"WebRequest",
"$",
"request",
",",
"Response",
"$",
"response",
")",
"{",
"if",
"(",
"$",
"request",
"->",
"hasSession",
"(",
")",
")",
"{",
"$",
"profileMenuEntry",
"=",
"new",
"\\",
"Zepi",
"\\",
"Web",
"\\",
"General",
"\\",
"Entity",
"\\",
"MenuEntry",
"(",
"'profile'",
",",
"$",
"this",
"->",
"translate",
"(",
"'Profile'",
",",
"'\\\\Zepi\\\\Web\\\\AccessControl'",
")",
",",
"'profile'",
",",
"'mdi-person'",
")",
";",
"$",
"this",
"->",
"getMenuManager",
"(",
")",
"->",
"addMenuEntry",
"(",
"'menu-right'",
",",
"$",
"profileMenuEntry",
",",
"90",
")",
";",
"// Add the hidden user settings menu entry",
"$",
"userSettingsSubMenuEntry",
"=",
"new",
"\\",
"Zepi",
"\\",
"Web",
"\\",
"General",
"\\",
"Entity",
"\\",
"HiddenMenuEntry",
"(",
"$",
"this",
"->",
"translate",
"(",
"'User settings'",
",",
"'\\\\Zepi\\\\Web\\\\AccessControl'",
")",
")",
";",
"$",
"profileMenuEntry",
"->",
"addChild",
"(",
"$",
"userSettingsSubMenuEntry",
")",
";",
"// Add the hidden change password menu entry ",
"$",
"changePasswordSubMenuEntry",
"=",
"new",
"\\",
"Zepi",
"\\",
"Web",
"\\",
"General",
"\\",
"Entity",
"\\",
"HiddenMenuEntry",
"(",
"$",
"this",
"->",
"translate",
"(",
"'Change password'",
",",
"'\\\\Zepi\\\\Web\\\\AccessControl'",
")",
",",
"'profile/change-password'",
",",
"'mdi-vpn-key'",
")",
";",
"$",
"userSettingsSubMenuEntry",
"->",
"addChild",
"(",
"$",
"changePasswordSubMenuEntry",
")",
";",
"// Add the logout menu entry",
"$",
"menuEntry",
"=",
"new",
"\\",
"Zepi",
"\\",
"Web",
"\\",
"General",
"\\",
"Entity",
"\\",
"MenuEntry",
"(",
"'logout'",
",",
"$",
"this",
"->",
"translate",
"(",
"'Logout'",
",",
"'\\\\Zepi\\\\Web\\\\AccessControl'",
")",
",",
"'logout'",
",",
"'glyphicon-log-out'",
")",
";",
"$",
"this",
"->",
"getMenuManager",
"(",
")",
"->",
"addMenuEntry",
"(",
"'menu-right'",
",",
"$",
"menuEntry",
",",
"100",
")",
";",
"}",
"else",
"{",
"if",
"(",
"$",
"this",
"->",
"getSetting",
"(",
"'accesscontrol.allowRegistration'",
")",
")",
"{",
"$",
"menuEntry",
"=",
"new",
"\\",
"Zepi",
"\\",
"Web",
"\\",
"General",
"\\",
"Entity",
"\\",
"MenuEntry",
"(",
"'registration'",
",",
"$",
"this",
"->",
"translate",
"(",
"'Registration'",
",",
"'\\\\Pmx\\\\Autopilot\\\\AccessControl'",
")",
",",
"'/register/'",
",",
"'mdi-account-circle'",
")",
";",
"$",
"this",
"->",
"getMenuManager",
"(",
")",
"->",
"addMenuEntry",
"(",
"'menu-right'",
",",
"$",
"menuEntry",
")",
";",
"}",
"$",
"menuEntry",
"=",
"new",
"\\",
"Zepi",
"\\",
"Web",
"\\",
"General",
"\\",
"Entity",
"\\",
"MenuEntry",
"(",
"'login'",
",",
"$",
"this",
"->",
"translate",
"(",
"'Login'",
",",
"'\\\\Zepi\\\\Web\\\\AccessControl'",
")",
",",
"'login'",
",",
"'glyphicon-log-in'",
")",
";",
"$",
"this",
"->",
"getMenuManager",
"(",
")",
"->",
"addMenuEntry",
"(",
"'menu-right'",
",",
"$",
"menuEntry",
",",
"100",
")",
";",
"}",
"}"
] | Registers the menu entries which are only accessable if the user is logged in
or not logged in, in example login or logout menu entry.
@access public
@param \Zepi\Turbo\Framework $framework
@param \Zepi\Turbo\Request\WebRequest $request
@param \Zepi\Turbo\Response\Response $response | [
"Registers",
"the",
"menu",
"entries",
"which",
"are",
"only",
"accessable",
"if",
"the",
"user",
"is",
"logged",
"in",
"or",
"not",
"logged",
"in",
"in",
"example",
"login",
"or",
"logout",
"menu",
"entry",
"."
] | 9a36d8c7649317f55f91b2adf386bd1f04ec02a3 | https://github.com/zepi/turbo-base/blob/9a36d8c7649317f55f91b2adf386bd1f04ec02a3/Zepi/Web/AccessControl/src/EventHandler/RegisterMenuEntries.php#L62-L114 |
10,180 | petrepatrasc/starcraft-connection-layer | Service/BaseService.php | BaseService.retrieve | protected function retrieve($url)
{
if ($this->curlWrapper->error) {
throw new StarcraftConnectionLayerException($this->curlWrapper->error_message, $this->curlWrapper->error_code);
}
} | php | protected function retrieve($url)
{
if ($this->curlWrapper->error) {
throw new StarcraftConnectionLayerException($this->curlWrapper->error_message, $this->curlWrapper->error_code);
}
} | [
"protected",
"function",
"retrieve",
"(",
"$",
"url",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"curlWrapper",
"->",
"error",
")",
"{",
"throw",
"new",
"StarcraftConnectionLayerException",
"(",
"$",
"this",
"->",
"curlWrapper",
"->",
"error_message",
",",
"$",
"this",
"->",
"curlWrapper",
"->",
"error_code",
")",
";",
"}",
"}"
] | Method that allows for easy retrieval of data from a URL, and triggers a certain type of exception when something goes wrong.
@param string $url The URL that should be accessed.
@throws \petrepatrasc\StarcraftConnectionLayerBundle\Exception\StarcraftConnectionLayerException | [
"Method",
"that",
"allows",
"for",
"easy",
"retrieval",
"of",
"data",
"from",
"a",
"URL",
"and",
"triggers",
"a",
"certain",
"type",
"of",
"exception",
"when",
"something",
"goes",
"wrong",
"."
] | 3e52cd825c58d450e5329ffe6c0871741b99a1ef | https://github.com/petrepatrasc/starcraft-connection-layer/blob/3e52cd825c58d450e5329ffe6c0871741b99a1ef/Service/BaseService.php#L38-L43 |
10,181 | jeronimos/php-adjutants | src/Arrays/Group.php | Group.groupByPropertiesNames | public static function groupByPropertiesNames(GroupData $groupData)
{
self::$data = $groupData->getData();
self::$groupProperties = $groupData->getGroupProperties();
self::$groupCriteriaHigherLevel = $groupData->getGroupCriteriaHigherLevel();
self::$quantityPropertyName = $groupData->getQuantityPropertyName();
self::$groupResultType = $groupData->getGroupResultType();
if (!is_null($groupData->getMostFrequentQuantity())) {
self::$mostFrequentQuantity = $groupData->getMostFrequentQuantity();
}
self::prepareKeeper();
self::removeRedundantProperties();
foreach (self::$data as $basicKey => $item) {
if (!($item instanceof \StdClass)) {
throw new GroupException("Can't group. Not StdClass in \$item");
}
self::group($basicKey, $item);
}
switch (self::$groupResultType):
case(GroupConsts::RESULT_GROUP_SORT_DATA):
$result = self::getMostFrequentValuesForGrouped(self::$groupKeeper);
break;
case(GroupConsts::RESULT_GROUP_STRING):
$result = self::$groupKeeper;
break;
endswitch;
return $result;
} | php | public static function groupByPropertiesNames(GroupData $groupData)
{
self::$data = $groupData->getData();
self::$groupProperties = $groupData->getGroupProperties();
self::$groupCriteriaHigherLevel = $groupData->getGroupCriteriaHigherLevel();
self::$quantityPropertyName = $groupData->getQuantityPropertyName();
self::$groupResultType = $groupData->getGroupResultType();
if (!is_null($groupData->getMostFrequentQuantity())) {
self::$mostFrequentQuantity = $groupData->getMostFrequentQuantity();
}
self::prepareKeeper();
self::removeRedundantProperties();
foreach (self::$data as $basicKey => $item) {
if (!($item instanceof \StdClass)) {
throw new GroupException("Can't group. Not StdClass in \$item");
}
self::group($basicKey, $item);
}
switch (self::$groupResultType):
case(GroupConsts::RESULT_GROUP_SORT_DATA):
$result = self::getMostFrequentValuesForGrouped(self::$groupKeeper);
break;
case(GroupConsts::RESULT_GROUP_STRING):
$result = self::$groupKeeper;
break;
endswitch;
return $result;
} | [
"public",
"static",
"function",
"groupByPropertiesNames",
"(",
"GroupData",
"$",
"groupData",
")",
"{",
"self",
"::",
"$",
"data",
"=",
"$",
"groupData",
"->",
"getData",
"(",
")",
";",
"self",
"::",
"$",
"groupProperties",
"=",
"$",
"groupData",
"->",
"getGroupProperties",
"(",
")",
";",
"self",
"::",
"$",
"groupCriteriaHigherLevel",
"=",
"$",
"groupData",
"->",
"getGroupCriteriaHigherLevel",
"(",
")",
";",
"self",
"::",
"$",
"quantityPropertyName",
"=",
"$",
"groupData",
"->",
"getQuantityPropertyName",
"(",
")",
";",
"self",
"::",
"$",
"groupResultType",
"=",
"$",
"groupData",
"->",
"getGroupResultType",
"(",
")",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"groupData",
"->",
"getMostFrequentQuantity",
"(",
")",
")",
")",
"{",
"self",
"::",
"$",
"mostFrequentQuantity",
"=",
"$",
"groupData",
"->",
"getMostFrequentQuantity",
"(",
")",
";",
"}",
"self",
"::",
"prepareKeeper",
"(",
")",
";",
"self",
"::",
"removeRedundantProperties",
"(",
")",
";",
"foreach",
"(",
"self",
"::",
"$",
"data",
"as",
"$",
"basicKey",
"=>",
"$",
"item",
")",
"{",
"if",
"(",
"!",
"(",
"$",
"item",
"instanceof",
"\\",
"StdClass",
")",
")",
"{",
"throw",
"new",
"GroupException",
"(",
"\"Can't group. Not StdClass in \\$item\"",
")",
";",
"}",
"self",
"::",
"group",
"(",
"$",
"basicKey",
",",
"$",
"item",
")",
";",
"}",
"switch",
"(",
"self",
"::",
"$",
"groupResultType",
")",
":",
"case",
"(",
"GroupConsts",
"::",
"RESULT_GROUP_SORT_DATA",
")",
":",
"$",
"result",
"=",
"self",
"::",
"getMostFrequentValuesForGrouped",
"(",
"self",
"::",
"$",
"groupKeeper",
")",
";",
"break",
";",
"case",
"(",
"GroupConsts",
"::",
"RESULT_GROUP_STRING",
")",
":",
"$",
"result",
"=",
"self",
"::",
"$",
"groupKeeper",
";",
"break",
";",
"endswitch",
";",
"return",
"$",
"result",
";",
"}"
] | Allow to group data with same properties by properties names.
@param GroupData $groupData
@return mixed
@throws GroupException | [
"Allow",
"to",
"group",
"data",
"with",
"same",
"properties",
"by",
"properties",
"names",
"."
] | 78b428ed05a9d6029a29a86ac47906adeb9fd41d | https://github.com/jeronimos/php-adjutants/blob/78b428ed05a9d6029a29a86ac47906adeb9fd41d/src/Arrays/Group.php#L34-L66 |
10,182 | netcore/module-translate | Console/FindTranslations.php | FindTranslations.writeToFile | protected function writeToFile(array $translations): void
{
$excel = app('excel');
$filename = config('netcore.module-translate.translations_file');
$excel
->create($filename, function (LaravelExcelWriter $writer) use ($translations) {
$writer->setTitle('Translations');
$writer->sheet('Translations', function (LaravelExcelWorksheet $sheet) use ($translations) {
$sheet->fromArray($translations, '', 'A1');
$sheet->row(1, function ($row) {
$row->setFontWeight('bold');
});
});
})
->store('xlsx', resource_path('seed_translations'));
} | php | protected function writeToFile(array $translations): void
{
$excel = app('excel');
$filename = config('netcore.module-translate.translations_file');
$excel
->create($filename, function (LaravelExcelWriter $writer) use ($translations) {
$writer->setTitle('Translations');
$writer->sheet('Translations', function (LaravelExcelWorksheet $sheet) use ($translations) {
$sheet->fromArray($translations, '', 'A1');
$sheet->row(1, function ($row) {
$row->setFontWeight('bold');
});
});
})
->store('xlsx', resource_path('seed_translations'));
} | [
"protected",
"function",
"writeToFile",
"(",
"array",
"$",
"translations",
")",
":",
"void",
"{",
"$",
"excel",
"=",
"app",
"(",
"'excel'",
")",
";",
"$",
"filename",
"=",
"config",
"(",
"'netcore.module-translate.translations_file'",
")",
";",
"$",
"excel",
"->",
"create",
"(",
"$",
"filename",
",",
"function",
"(",
"LaravelExcelWriter",
"$",
"writer",
")",
"use",
"(",
"$",
"translations",
")",
"{",
"$",
"writer",
"->",
"setTitle",
"(",
"'Translations'",
")",
";",
"$",
"writer",
"->",
"sheet",
"(",
"'Translations'",
",",
"function",
"(",
"LaravelExcelWorksheet",
"$",
"sheet",
")",
"use",
"(",
"$",
"translations",
")",
"{",
"$",
"sheet",
"->",
"fromArray",
"(",
"$",
"translations",
",",
"''",
",",
"'A1'",
")",
";",
"$",
"sheet",
"->",
"row",
"(",
"1",
",",
"function",
"(",
"$",
"row",
")",
"{",
"$",
"row",
"->",
"setFontWeight",
"(",
"'bold'",
")",
";",
"}",
")",
";",
"}",
")",
";",
"}",
")",
"->",
"store",
"(",
"'xlsx'",
",",
"resource_path",
"(",
"'seed_translations'",
")",
")",
";",
"}"
] | Write translations to the file.
@param array $translations
@return void | [
"Write",
"translations",
"to",
"the",
"file",
"."
] | 7f2b7c60acf316c13830722d38f61e81b6011496 | https://github.com/netcore/module-translate/blob/7f2b7c60acf316c13830722d38f61e81b6011496/Console/FindTranslations.php#L159-L177 |
10,183 | netcore/module-translate | Console/FindTranslations.php | FindTranslations.makeRows | protected function makeRows($group, $key, $value): array
{
$rows = [];
if (is_array($value)) {
foreach ($value as $subKey => $subValue) {
$rows[] = [
'key' => $group . '.' . $key . '.' . $subKey,
'value' => $subValue,
];
}
} else {
$rows[] = [
'key' => $group . '.' . $key,
'value' => $value,
];
}
return $rows;
} | php | protected function makeRows($group, $key, $value): array
{
$rows = [];
if (is_array($value)) {
foreach ($value as $subKey => $subValue) {
$rows[] = [
'key' => $group . '.' . $key . '.' . $subKey,
'value' => $subValue,
];
}
} else {
$rows[] = [
'key' => $group . '.' . $key,
'value' => $value,
];
}
return $rows;
} | [
"protected",
"function",
"makeRows",
"(",
"$",
"group",
",",
"$",
"key",
",",
"$",
"value",
")",
":",
"array",
"{",
"$",
"rows",
"=",
"[",
"]",
";",
"if",
"(",
"is_array",
"(",
"$",
"value",
")",
")",
"{",
"foreach",
"(",
"$",
"value",
"as",
"$",
"subKey",
"=>",
"$",
"subValue",
")",
"{",
"$",
"rows",
"[",
"]",
"=",
"[",
"'key'",
"=>",
"$",
"group",
".",
"'.'",
".",
"$",
"key",
".",
"'.'",
".",
"$",
"subKey",
",",
"'value'",
"=>",
"$",
"subValue",
",",
"]",
";",
"}",
"}",
"else",
"{",
"$",
"rows",
"[",
"]",
"=",
"[",
"'key'",
"=>",
"$",
"group",
".",
"'.'",
".",
"$",
"key",
",",
"'value'",
"=>",
"$",
"value",
",",
"]",
";",
"}",
"return",
"$",
"rows",
";",
"}"
] | Create translations from array.
@param $group
@param $key
@param $value
@return array | [
"Create",
"translations",
"from",
"array",
"."
] | 7f2b7c60acf316c13830722d38f61e81b6011496 | https://github.com/netcore/module-translate/blob/7f2b7c60acf316c13830722d38f61e81b6011496/Console/FindTranslations.php#L187-L206 |
10,184 | netcore/module-translate | Console/FindTranslations.php | FindTranslations.getPaths | protected function getPaths(): array
{
$paths = [
base_path('app'),
base_path('modules'),
base_path('resources'),
base_path('routes'),
];
foreach ($paths as $i => $path) {
if (!File::isDirectory($path)) {
unset($paths[$i]);
}
}
return $paths;
} | php | protected function getPaths(): array
{
$paths = [
base_path('app'),
base_path('modules'),
base_path('resources'),
base_path('routes'),
];
foreach ($paths as $i => $path) {
if (!File::isDirectory($path)) {
unset($paths[$i]);
}
}
return $paths;
} | [
"protected",
"function",
"getPaths",
"(",
")",
":",
"array",
"{",
"$",
"paths",
"=",
"[",
"base_path",
"(",
"'app'",
")",
",",
"base_path",
"(",
"'modules'",
")",
",",
"base_path",
"(",
"'resources'",
")",
",",
"base_path",
"(",
"'routes'",
")",
",",
"]",
";",
"foreach",
"(",
"$",
"paths",
"as",
"$",
"i",
"=>",
"$",
"path",
")",
"{",
"if",
"(",
"!",
"File",
"::",
"isDirectory",
"(",
"$",
"path",
")",
")",
"{",
"unset",
"(",
"$",
"paths",
"[",
"$",
"i",
"]",
")",
";",
"}",
"}",
"return",
"$",
"paths",
";",
"}"
] | Get paths in which to search for translations.
@return array | [
"Get",
"paths",
"in",
"which",
"to",
"search",
"for",
"translations",
"."
] | 7f2b7c60acf316c13830722d38f61e81b6011496 | https://github.com/netcore/module-translate/blob/7f2b7c60acf316c13830722d38f61e81b6011496/Console/FindTranslations.php#L213-L229 |
10,185 | eix/core | src/php/main/Eix/Services/Data/Responders/CollectionManager.php | CollectionManager.storeEntity | protected function storeEntity()
{
$request = $this->getRequest();
$id = $request->getParameter('id');
// Try to find an existing instance of the entity.
$entity = NULL;
try {
$entity = $this->getFactory()->findEntity($id);
} catch (NotFoundException $exception) {
// Not found? Create it.
$className = $this->getFactory()->getEntitiesClassName();
$entity = new $className(array(
'id' => $id,
));
}
// Get the data from the request.
$dataFromRequest = $this->getEntityDataFromRequest();
if ($this->nullsIgnoredOnStore) {
// Remove unspecified values, so that they are not modified.
$dataFromRequest = array_filter(
$dataFromRequest,
function ($value) {
return !is_null($value);
}
);
}
// Update the product from the request data.
$entity->update($dataFromRequest);
// Store the entity.
$entity->store();
return $entity;
} | php | protected function storeEntity()
{
$request = $this->getRequest();
$id = $request->getParameter('id');
// Try to find an existing instance of the entity.
$entity = NULL;
try {
$entity = $this->getFactory()->findEntity($id);
} catch (NotFoundException $exception) {
// Not found? Create it.
$className = $this->getFactory()->getEntitiesClassName();
$entity = new $className(array(
'id' => $id,
));
}
// Get the data from the request.
$dataFromRequest = $this->getEntityDataFromRequest();
if ($this->nullsIgnoredOnStore) {
// Remove unspecified values, so that they are not modified.
$dataFromRequest = array_filter(
$dataFromRequest,
function ($value) {
return !is_null($value);
}
);
}
// Update the product from the request data.
$entity->update($dataFromRequest);
// Store the entity.
$entity->store();
return $entity;
} | [
"protected",
"function",
"storeEntity",
"(",
")",
"{",
"$",
"request",
"=",
"$",
"this",
"->",
"getRequest",
"(",
")",
";",
"$",
"id",
"=",
"$",
"request",
"->",
"getParameter",
"(",
"'id'",
")",
";",
"// Try to find an existing instance of the entity.",
"$",
"entity",
"=",
"NULL",
";",
"try",
"{",
"$",
"entity",
"=",
"$",
"this",
"->",
"getFactory",
"(",
")",
"->",
"findEntity",
"(",
"$",
"id",
")",
";",
"}",
"catch",
"(",
"NotFoundException",
"$",
"exception",
")",
"{",
"// Not found? Create it.",
"$",
"className",
"=",
"$",
"this",
"->",
"getFactory",
"(",
")",
"->",
"getEntitiesClassName",
"(",
")",
";",
"$",
"entity",
"=",
"new",
"$",
"className",
"(",
"array",
"(",
"'id'",
"=>",
"$",
"id",
",",
")",
")",
";",
"}",
"// Get the data from the request.",
"$",
"dataFromRequest",
"=",
"$",
"this",
"->",
"getEntityDataFromRequest",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"nullsIgnoredOnStore",
")",
"{",
"// Remove unspecified values, so that they are not modified.",
"$",
"dataFromRequest",
"=",
"array_filter",
"(",
"$",
"dataFromRequest",
",",
"function",
"(",
"$",
"value",
")",
"{",
"return",
"!",
"is_null",
"(",
"$",
"value",
")",
";",
"}",
")",
";",
"}",
"// Update the product from the request data.",
"$",
"entity",
"->",
"update",
"(",
"$",
"dataFromRequest",
")",
";",
"// Store the entity.",
"$",
"entity",
"->",
"store",
"(",
")",
";",
"return",
"$",
"entity",
";",
"}"
] | Updates the entity with the new data in the request and stores it.
@return Entity the stored entity | [
"Updates",
"the",
"entity",
"with",
"the",
"new",
"data",
"in",
"the",
"request",
"and",
"stores",
"it",
"."
] | a5b4c09cc168221e85804fdfeb78e519a0415466 | https://github.com/eix/core/blob/a5b4c09cc168221e85804fdfeb78e519a0415466/src/php/main/Eix/Services/Data/Responders/CollectionManager.php#L121-L155 |
10,186 | eix/core | src/php/main/Eix/Services/Data/Responders/CollectionManager.php | CollectionManager.getEntityData | public function getEntityData()
{
$entity = null;
try {
$entity = $this->getEntity(
$this->getRequest()->getParameter('id')
);
} catch (NotFoundException $exception) {
// The entity does not exist, create a new one from the data in the
// request.
$entity = $this->getEntityClass()->newInstanceArgs(
$this->getEntityDataFromRequest()
);
}
return $entity->getFieldsData();
} | php | public function getEntityData()
{
$entity = null;
try {
$entity = $this->getEntity(
$this->getRequest()->getParameter('id')
);
} catch (NotFoundException $exception) {
// The entity does not exist, create a new one from the data in the
// request.
$entity = $this->getEntityClass()->newInstanceArgs(
$this->getEntityDataFromRequest()
);
}
return $entity->getFieldsData();
} | [
"public",
"function",
"getEntityData",
"(",
")",
"{",
"$",
"entity",
"=",
"null",
";",
"try",
"{",
"$",
"entity",
"=",
"$",
"this",
"->",
"getEntity",
"(",
"$",
"this",
"->",
"getRequest",
"(",
")",
"->",
"getParameter",
"(",
"'id'",
")",
")",
";",
"}",
"catch",
"(",
"NotFoundException",
"$",
"exception",
")",
"{",
"// The entity does not exist, create a new one from the data in the",
"// request.",
"$",
"entity",
"=",
"$",
"this",
"->",
"getEntityClass",
"(",
")",
"->",
"newInstanceArgs",
"(",
"$",
"this",
"->",
"getEntityDataFromRequest",
"(",
")",
")",
";",
"}",
"return",
"$",
"entity",
"->",
"getFieldsData",
"(",
")",
";",
"}"
] | Gets the current entity's data so that it can be set into the request. | [
"Gets",
"the",
"current",
"entity",
"s",
"data",
"so",
"that",
"it",
"can",
"be",
"set",
"into",
"the",
"request",
"."
] | a5b4c09cc168221e85804fdfeb78e519a0415466 | https://github.com/eix/core/blob/a5b4c09cc168221e85804fdfeb78e519a0415466/src/php/main/Eix/Services/Data/Responders/CollectionManager.php#L167-L183 |
10,187 | eix/core | src/php/main/Eix/Services/Data/Responders/CollectionManager.php | CollectionManager.getBatchActionConfirmationResponse | protected function getBatchActionConfirmationResponse($actionId, array $selectedIds)
{
$response = null;
if (empty($selectedIds)) {
// No IDs, so redirect to the index page.
$response = $this->getIndexRedirectionResponse();
} else {
// There are IDs, so display the confirmation page.
$response = $this->getHtmlResponse();
$collectionName = $this->getCollectionName();
$response->setTemplateId(sprintf('%s/%s',
$collectionName,
$actionId
));
$response->setData($collectionName, $selectedIds);
}
return $response;
} | php | protected function getBatchActionConfirmationResponse($actionId, array $selectedIds)
{
$response = null;
if (empty($selectedIds)) {
// No IDs, so redirect to the index page.
$response = $this->getIndexRedirectionResponse();
} else {
// There are IDs, so display the confirmation page.
$response = $this->getHtmlResponse();
$collectionName = $this->getCollectionName();
$response->setTemplateId(sprintf('%s/%s',
$collectionName,
$actionId
));
$response->setData($collectionName, $selectedIds);
}
return $response;
} | [
"protected",
"function",
"getBatchActionConfirmationResponse",
"(",
"$",
"actionId",
",",
"array",
"$",
"selectedIds",
")",
"{",
"$",
"response",
"=",
"null",
";",
"if",
"(",
"empty",
"(",
"$",
"selectedIds",
")",
")",
"{",
"// No IDs, so redirect to the index page.",
"$",
"response",
"=",
"$",
"this",
"->",
"getIndexRedirectionResponse",
"(",
")",
";",
"}",
"else",
"{",
"// There are IDs, so display the confirmation page.",
"$",
"response",
"=",
"$",
"this",
"->",
"getHtmlResponse",
"(",
")",
";",
"$",
"collectionName",
"=",
"$",
"this",
"->",
"getCollectionName",
"(",
")",
";",
"$",
"response",
"->",
"setTemplateId",
"(",
"sprintf",
"(",
"'%s/%s'",
",",
"$",
"collectionName",
",",
"$",
"actionId",
")",
")",
";",
"$",
"response",
"->",
"setData",
"(",
"$",
"collectionName",
",",
"$",
"selectedIds",
")",
";",
"}",
"return",
"$",
"response",
";",
"}"
] | Returns a response which displays a confirmation page for a batch
process.
@param string $actionId the ID of the action to perform. This will be
part of the URL.
@param array $selectedIds the IDs onto which the action would be
performed.
@return Http | [
"Returns",
"a",
"response",
"which",
"displays",
"a",
"confirmation",
"page",
"for",
"a",
"batch",
"process",
"."
] | a5b4c09cc168221e85804fdfeb78e519a0415466 | https://github.com/eix/core/blob/a5b4c09cc168221e85804fdfeb78e519a0415466/src/php/main/Eix/Services/Data/Responders/CollectionManager.php#L281-L300 |
10,188 | eix/core | src/php/main/Eix/Services/Data/Responders/CollectionManager.php | CollectionManager.getBatchActionResponse | protected function getBatchActionResponse($actionFunction, array $selectedIds)
{
$response = $this->getIndexRedirectionResponse();
$successfullyUsedIds = array();
foreach ($selectedIds as $id) {
try {
call_user_func($actionFunction, $id);
$successfullyUsedIds[] = $id;
} catch (NotFoundException $exception) {
$response->addErrorMessage(sprintf(_('%s %s was not found.'),
_($this->getItemName()),
$id
));
}
}
// TODO: Create a Report with the successfully used IDs.
$response->addNotice(sprintf(_('%d %s were affected.'),
count($successfullyUsedIds), _($this->getCollectionName())
));
return $response;
} | php | protected function getBatchActionResponse($actionFunction, array $selectedIds)
{
$response = $this->getIndexRedirectionResponse();
$successfullyUsedIds = array();
foreach ($selectedIds as $id) {
try {
call_user_func($actionFunction, $id);
$successfullyUsedIds[] = $id;
} catch (NotFoundException $exception) {
$response->addErrorMessage(sprintf(_('%s %s was not found.'),
_($this->getItemName()),
$id
));
}
}
// TODO: Create a Report with the successfully used IDs.
$response->addNotice(sprintf(_('%d %s were affected.'),
count($successfullyUsedIds), _($this->getCollectionName())
));
return $response;
} | [
"protected",
"function",
"getBatchActionResponse",
"(",
"$",
"actionFunction",
",",
"array",
"$",
"selectedIds",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"getIndexRedirectionResponse",
"(",
")",
";",
"$",
"successfullyUsedIds",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"selectedIds",
"as",
"$",
"id",
")",
"{",
"try",
"{",
"call_user_func",
"(",
"$",
"actionFunction",
",",
"$",
"id",
")",
";",
"$",
"successfullyUsedIds",
"[",
"]",
"=",
"$",
"id",
";",
"}",
"catch",
"(",
"NotFoundException",
"$",
"exception",
")",
"{",
"$",
"response",
"->",
"addErrorMessage",
"(",
"sprintf",
"(",
"_",
"(",
"'%s %s was not found.'",
")",
",",
"_",
"(",
"$",
"this",
"->",
"getItemName",
"(",
")",
")",
",",
"$",
"id",
")",
")",
";",
"}",
"}",
"// TODO: Create a Report with the successfully used IDs.",
"$",
"response",
"->",
"addNotice",
"(",
"sprintf",
"(",
"_",
"(",
"'%d %s were affected.'",
")",
",",
"count",
"(",
"$",
"successfullyUsedIds",
")",
",",
"_",
"(",
"$",
"this",
"->",
"getCollectionName",
"(",
")",
")",
")",
")",
";",
"return",
"$",
"response",
";",
"}"
] | Issue a response to a batch action request.
@param callback $actionFunction the function that will be executed for
each of the selected IDs.
@param array $selectedIds the IDs on which the batch process must be
executed. | [
"Issue",
"a",
"response",
"to",
"a",
"batch",
"action",
"request",
"."
] | a5b4c09cc168221e85804fdfeb78e519a0415466 | https://github.com/eix/core/blob/a5b4c09cc168221e85804fdfeb78e519a0415466/src/php/main/Eix/Services/Data/Responders/CollectionManager.php#L310-L334 |
10,189 | eix/core | src/php/main/Eix/Services/Data/Responders/CollectionManager.php | CollectionManager.getIndexRedirectionResponse | private function getIndexRedirectionResponse()
{
$response = new Redirection($this->getRequest());
$url = sprintf('/%s/', $this->getCollectionName());
// If a particular view was being shown, honour it.
$view = $this->getRequest()->getParameter('view');
if (!empty($view)) {
$url .= '?view=' . $view;
}
$response->setNextUrl($url);
return $response;
} | php | private function getIndexRedirectionResponse()
{
$response = new Redirection($this->getRequest());
$url = sprintf('/%s/', $this->getCollectionName());
// If a particular view was being shown, honour it.
$view = $this->getRequest()->getParameter('view');
if (!empty($view)) {
$url .= '?view=' . $view;
}
$response->setNextUrl($url);
return $response;
} | [
"private",
"function",
"getIndexRedirectionResponse",
"(",
")",
"{",
"$",
"response",
"=",
"new",
"Redirection",
"(",
"$",
"this",
"->",
"getRequest",
"(",
")",
")",
";",
"$",
"url",
"=",
"sprintf",
"(",
"'/%s/'",
",",
"$",
"this",
"->",
"getCollectionName",
"(",
")",
")",
";",
"// If a particular view was being shown, honour it.",
"$",
"view",
"=",
"$",
"this",
"->",
"getRequest",
"(",
")",
"->",
"getParameter",
"(",
"'view'",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"view",
")",
")",
"{",
"$",
"url",
".=",
"'?view='",
".",
"$",
"view",
";",
"}",
"$",
"response",
"->",
"setNextUrl",
"(",
"$",
"url",
")",
";",
"return",
"$",
"response",
";",
"}"
] | Gets a redirection to the collection's index page, honouring the current
view. | [
"Gets",
"a",
"redirection",
"to",
"the",
"collection",
"s",
"index",
"page",
"honouring",
"the",
"current",
"view",
"."
] | a5b4c09cc168221e85804fdfeb78e519a0415466 | https://github.com/eix/core/blob/a5b4c09cc168221e85804fdfeb78e519a0415466/src/php/main/Eix/Services/Data/Responders/CollectionManager.php#L362-L374 |
10,190 | eix/core | src/php/main/Eix/Services/Data/Responders/CollectionManager.php | CollectionManager.getEditionResponse | protected function getEditionResponse(Entity $entity = null)
{
// Create a new HTML response.
$response = $this->getHtmlResponse();
// Indicate where is the template.
$response->setTemplateId(sprintf(
'%s/edit',
$this->getCollectionName()
));
// If there is an entity ID, load that entity in the response as well.
if ($entity) {
$response->setData(
$this->getItemName(),
$entity->getFieldsData()
);
}
return $response;
} | php | protected function getEditionResponse(Entity $entity = null)
{
// Create a new HTML response.
$response = $this->getHtmlResponse();
// Indicate where is the template.
$response->setTemplateId(sprintf(
'%s/edit',
$this->getCollectionName()
));
// If there is an entity ID, load that entity in the response as well.
if ($entity) {
$response->setData(
$this->getItemName(),
$entity->getFieldsData()
);
}
return $response;
} | [
"protected",
"function",
"getEditionResponse",
"(",
"Entity",
"$",
"entity",
"=",
"null",
")",
"{",
"// Create a new HTML response.",
"$",
"response",
"=",
"$",
"this",
"->",
"getHtmlResponse",
"(",
")",
";",
"// Indicate where is the template.",
"$",
"response",
"->",
"setTemplateId",
"(",
"sprintf",
"(",
"'%s/edit'",
",",
"$",
"this",
"->",
"getCollectionName",
"(",
")",
")",
")",
";",
"// If there is an entity ID, load that entity in the response as well.",
"if",
"(",
"$",
"entity",
")",
"{",
"$",
"response",
"->",
"setData",
"(",
"$",
"this",
"->",
"getItemName",
"(",
")",
",",
"$",
"entity",
"->",
"getFieldsData",
"(",
")",
")",
";",
"}",
"return",
"$",
"response",
";",
"}"
] | Return a response that shows an edition page.
@param type $id the ID of the entity to edit, if any.
@return Html | [
"Return",
"a",
"response",
"that",
"shows",
"an",
"edition",
"page",
"."
] | a5b4c09cc168221e85804fdfeb78e519a0415466 | https://github.com/eix/core/blob/a5b4c09cc168221e85804fdfeb78e519a0415466/src/php/main/Eix/Services/Data/Responders/CollectionManager.php#L381-L399 |
10,191 | eix/core | src/php/main/Eix/Services/Data/Responders/CollectionManager.php | CollectionManager.getUpdatedEntityResponse | private function getUpdatedEntityResponse()
{
$response = $this->getEditionResponse();
try {
// Try to store an entity with the data in the request.
$this->storeEntity();
$response->addNotice(sprintf(
_('%s correctly stored.'),
ucfirst($this->getItemName())
));
} catch (ValidatorException $exception) {
// The entity could not be stored because of a validation error.
// Add the error data to the response.
$response->addErrorMessage(array(
'validation' => $exception->getValidationStatus(),
));
} catch (\Exception $exception) {
// An unexpected error has occurred. Display the edition
// page again.
$response->addErrorMessage($exception->getMessage());
}
// Set the entity data into the response.
$response->setData(
$this->getItemName(),
$this->getEntityData()
);
return $response;
} | php | private function getUpdatedEntityResponse()
{
$response = $this->getEditionResponse();
try {
// Try to store an entity with the data in the request.
$this->storeEntity();
$response->addNotice(sprintf(
_('%s correctly stored.'),
ucfirst($this->getItemName())
));
} catch (ValidatorException $exception) {
// The entity could not be stored because of a validation error.
// Add the error data to the response.
$response->addErrorMessage(array(
'validation' => $exception->getValidationStatus(),
));
} catch (\Exception $exception) {
// An unexpected error has occurred. Display the edition
// page again.
$response->addErrorMessage($exception->getMessage());
}
// Set the entity data into the response.
$response->setData(
$this->getItemName(),
$this->getEntityData()
);
return $response;
} | [
"private",
"function",
"getUpdatedEntityResponse",
"(",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"getEditionResponse",
"(",
")",
";",
"try",
"{",
"// Try to store an entity with the data in the request.",
"$",
"this",
"->",
"storeEntity",
"(",
")",
";",
"$",
"response",
"->",
"addNotice",
"(",
"sprintf",
"(",
"_",
"(",
"'%s correctly stored.'",
")",
",",
"ucfirst",
"(",
"$",
"this",
"->",
"getItemName",
"(",
")",
")",
")",
")",
";",
"}",
"catch",
"(",
"ValidatorException",
"$",
"exception",
")",
"{",
"// The entity could not be stored because of a validation error.",
"// Add the error data to the response.",
"$",
"response",
"->",
"addErrorMessage",
"(",
"array",
"(",
"'validation'",
"=>",
"$",
"exception",
"->",
"getValidationStatus",
"(",
")",
",",
")",
")",
";",
"}",
"catch",
"(",
"\\",
"Exception",
"$",
"exception",
")",
"{",
"// An unexpected error has occurred. Display the edition",
"// page again.",
"$",
"response",
"->",
"addErrorMessage",
"(",
"$",
"exception",
"->",
"getMessage",
"(",
")",
")",
";",
"}",
"// Set the entity data into the response.",
"$",
"response",
"->",
"setData",
"(",
"$",
"this",
"->",
"getItemName",
"(",
")",
",",
"$",
"this",
"->",
"getEntityData",
"(",
")",
")",
";",
"return",
"$",
"response",
";",
"}"
] | Updates an entity with the data in the request, and emits a response to
attest for that. | [
"Updates",
"an",
"entity",
"with",
"the",
"data",
"in",
"the",
"request",
"and",
"emits",
"a",
"response",
"to",
"attest",
"for",
"that",
"."
] | a5b4c09cc168221e85804fdfeb78e519a0415466 | https://github.com/eix/core/blob/a5b4c09cc168221e85804fdfeb78e519a0415466/src/php/main/Eix/Services/Data/Responders/CollectionManager.php#L405-L433 |
10,192 | eix/core | src/php/main/Eix/Services/Data/Responders/CollectionManager.php | CollectionManager.getSelectedIds | protected function getSelectedIds()
{
$ids = array();
foreach ($_REQUEST as $parameter => $value) {
$matches = array();
preg_match('/select_(.*)/', $parameter, $matches);
if ($matches) {
$ids[] = $matches[1];
}
}
return $ids;
} | php | protected function getSelectedIds()
{
$ids = array();
foreach ($_REQUEST as $parameter => $value) {
$matches = array();
preg_match('/select_(.*)/', $parameter, $matches);
if ($matches) {
$ids[] = $matches[1];
}
}
return $ids;
} | [
"protected",
"function",
"getSelectedIds",
"(",
")",
"{",
"$",
"ids",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"_REQUEST",
"as",
"$",
"parameter",
"=>",
"$",
"value",
")",
"{",
"$",
"matches",
"=",
"array",
"(",
")",
";",
"preg_match",
"(",
"'/select_(.*)/'",
",",
"$",
"parameter",
",",
"$",
"matches",
")",
";",
"if",
"(",
"$",
"matches",
")",
"{",
"$",
"ids",
"[",
"]",
"=",
"$",
"matches",
"[",
"1",
"]",
";",
"}",
"}",
"return",
"$",
"ids",
";",
"}"
] | Find the IDs of the selected elements in a list. | [
"Find",
"the",
"IDs",
"of",
"the",
"selected",
"elements",
"in",
"a",
"list",
"."
] | a5b4c09cc168221e85804fdfeb78e519a0415466 | https://github.com/eix/core/blob/a5b4c09cc168221e85804fdfeb78e519a0415466/src/php/main/Eix/Services/Data/Responders/CollectionManager.php#L438-L450 |
10,193 | Dragonrun1/event-mediator | src/PimpleContainerMediator.php | PimpleContainerMediator.setServiceContainer | public function setServiceContainer($value = \null): ContainerMediatorInterface
{
if (\null === $value) {
$value = new Container();
}
if (!$value instanceof Container) {
$mess = \sprintf(
'Must be an instance of Pimple Container but given %s',
\gettype($value)
);
throw new \InvalidArgumentException($mess);
}
$this->serviceContainer = $value;
return $this;
} | php | public function setServiceContainer($value = \null): ContainerMediatorInterface
{
if (\null === $value) {
$value = new Container();
}
if (!$value instanceof Container) {
$mess = \sprintf(
'Must be an instance of Pimple Container but given %s',
\gettype($value)
);
throw new \InvalidArgumentException($mess);
}
$this->serviceContainer = $value;
return $this;
} | [
"public",
"function",
"setServiceContainer",
"(",
"$",
"value",
"=",
"\\",
"null",
")",
":",
"ContainerMediatorInterface",
"{",
"if",
"(",
"\\",
"null",
"===",
"$",
"value",
")",
"{",
"$",
"value",
"=",
"new",
"Container",
"(",
")",
";",
"}",
"if",
"(",
"!",
"$",
"value",
"instanceof",
"Container",
")",
"{",
"$",
"mess",
"=",
"\\",
"sprintf",
"(",
"'Must be an instance of Pimple Container but given %s'",
",",
"\\",
"gettype",
"(",
"$",
"value",
")",
")",
";",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"$",
"mess",
")",
";",
"}",
"$",
"this",
"->",
"serviceContainer",
"=",
"$",
"value",
";",
"return",
"$",
"this",
";",
"}"
] | This is used to bring in the service container that will be used.
Though not required it would be considered best practice for this method
to create a new instance of the container when given null. Another good
practice is to call this method from the class constructor to allow
easier testing.
@param Container|null $value
@return ContainerMediatorInterface Fluent interface.
@throws \InvalidArgumentException
@link http://pimple.sensiolabs.org/ Pimple | [
"This",
"is",
"used",
"to",
"bring",
"in",
"the",
"service",
"container",
"that",
"will",
"be",
"used",
"."
] | ff6d875440ce4da272ee509f7d47b5050e1eb7f5 | https://github.com/Dragonrun1/event-mediator/blob/ff6d875440ce4da272ee509f7d47b5050e1eb7f5/src/PimpleContainerMediator.php#L91-L105 |
10,194 | rozaverta/cmf | core/Module/ModuleConfig.php | ModuleConfig.listResources | public function listResources()
{
$list = [];
$path = $this->getPath() . "resources";
if( file_exists($path) )
{
$scan = @ scandir($path);
if( !$scan )
{
throw new ReadException("Cannot ready resources directory for the '" . get_class($this) . "' module");
}
$path .= DIRECTORY_SEPARATOR;
foreach( $scan as $file )
{
if( $file[0] !== "." && preg_match('/\.json$/', $file) )
{
$list[] = new Resource($path . $file);
}
}
}
return new Collection($list);
} | php | public function listResources()
{
$list = [];
$path = $this->getPath() . "resources";
if( file_exists($path) )
{
$scan = @ scandir($path);
if( !$scan )
{
throw new ReadException("Cannot ready resources directory for the '" . get_class($this) . "' module");
}
$path .= DIRECTORY_SEPARATOR;
foreach( $scan as $file )
{
if( $file[0] !== "." && preg_match('/\.json$/', $file) )
{
$list[] = new Resource($path . $file);
}
}
}
return new Collection($list);
} | [
"public",
"function",
"listResources",
"(",
")",
"{",
"$",
"list",
"=",
"[",
"]",
";",
"$",
"path",
"=",
"$",
"this",
"->",
"getPath",
"(",
")",
".",
"\"resources\"",
";",
"if",
"(",
"file_exists",
"(",
"$",
"path",
")",
")",
"{",
"$",
"scan",
"=",
"@",
"scandir",
"(",
"$",
"path",
")",
";",
"if",
"(",
"!",
"$",
"scan",
")",
"{",
"throw",
"new",
"ReadException",
"(",
"\"Cannot ready resources directory for the '\"",
".",
"get_class",
"(",
"$",
"this",
")",
".",
"\"' module\"",
")",
";",
"}",
"$",
"path",
".=",
"DIRECTORY_SEPARATOR",
";",
"foreach",
"(",
"$",
"scan",
"as",
"$",
"file",
")",
"{",
"if",
"(",
"$",
"file",
"[",
"0",
"]",
"!==",
"\".\"",
"&&",
"preg_match",
"(",
"'/\\.json$/'",
",",
"$",
"file",
")",
")",
"{",
"$",
"list",
"[",
"]",
"=",
"new",
"Resource",
"(",
"$",
"path",
".",
"$",
"file",
")",
";",
"}",
"}",
"}",
"return",
"new",
"Collection",
"(",
"$",
"list",
")",
";",
"}"
] | Get all module resources
@return Collection
@throws ReadException | [
"Get",
"all",
"module",
"resources"
] | 95ed38362e397d1c700ee255f7200234ef98d356 | https://github.com/rozaverta/cmf/blob/95ed38362e397d1c700ee255f7200234ef98d356/core/Module/ModuleConfig.php#L104-L127 |
10,195 | phlexible/task-bundle | Controller/TaskController.php | TaskController.listAction | public function listAction(Request $request)
{
$type = $request->request->get('tasks', 'involved');
$sort = $request->request->get('sort', 'createdAt');
$dir = $request->request->get('dir', 'DESC');
$limit = $request->request->get('limit', 20);
$start = $request->request->get('start', 0);
$status = [];
foreach ($request->request->all() as $key => $value) {
if (substr($key, 0, 7) === 'status_') {
$status[] = substr($key, 7);
}
}
$taskManager = $this->get('phlexible_task.task_manager');
if (!count($status)) {
$status[] = current(array_keys($taskManager->getStates()));
}
$userId = $this->getUser()->getId();
switch ($type) {
case 'tasks':
$tasks = $taskManager->findByCreatedByAndStatus($userId, $status, [$sort => $dir], $limit, $start);
$total = $taskManager->countByCreatedByAndStatus($userId, $status);
break;
case 'todos':
$tasks = $taskManager->findByAssignedToAndStatus($userId, $status, [$sort => $dir], $limit, $start);
$total = $taskManager->countByAssignedToAndStatus($userId, $status);
break;
case 'involved':
$tasks = $taskManager->findByInvolvementAndStatus($userId, $status, [$sort => $dir], $limit, $start);
$total = $taskManager->countByInvolvementAndStatus($userId, $status);
break;
case 'all':
default:
$tasks = $taskManager->findByStatus($status, [$sort => $dir], $limit, $start);
$total = $taskManager->countByStatus($status);
break;
}
$data = [];
foreach ($tasks as $task) {
/* @var $task Task */
$data[] = $this->serializeTask($task);
}
return new JsonResponse([
'tasks' => $data,
'total' => $total,
]);
} | php | public function listAction(Request $request)
{
$type = $request->request->get('tasks', 'involved');
$sort = $request->request->get('sort', 'createdAt');
$dir = $request->request->get('dir', 'DESC');
$limit = $request->request->get('limit', 20);
$start = $request->request->get('start', 0);
$status = [];
foreach ($request->request->all() as $key => $value) {
if (substr($key, 0, 7) === 'status_') {
$status[] = substr($key, 7);
}
}
$taskManager = $this->get('phlexible_task.task_manager');
if (!count($status)) {
$status[] = current(array_keys($taskManager->getStates()));
}
$userId = $this->getUser()->getId();
switch ($type) {
case 'tasks':
$tasks = $taskManager->findByCreatedByAndStatus($userId, $status, [$sort => $dir], $limit, $start);
$total = $taskManager->countByCreatedByAndStatus($userId, $status);
break;
case 'todos':
$tasks = $taskManager->findByAssignedToAndStatus($userId, $status, [$sort => $dir], $limit, $start);
$total = $taskManager->countByAssignedToAndStatus($userId, $status);
break;
case 'involved':
$tasks = $taskManager->findByInvolvementAndStatus($userId, $status, [$sort => $dir], $limit, $start);
$total = $taskManager->countByInvolvementAndStatus($userId, $status);
break;
case 'all':
default:
$tasks = $taskManager->findByStatus($status, [$sort => $dir], $limit, $start);
$total = $taskManager->countByStatus($status);
break;
}
$data = [];
foreach ($tasks as $task) {
/* @var $task Task */
$data[] = $this->serializeTask($task);
}
return new JsonResponse([
'tasks' => $data,
'total' => $total,
]);
} | [
"public",
"function",
"listAction",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"type",
"=",
"$",
"request",
"->",
"request",
"->",
"get",
"(",
"'tasks'",
",",
"'involved'",
")",
";",
"$",
"sort",
"=",
"$",
"request",
"->",
"request",
"->",
"get",
"(",
"'sort'",
",",
"'createdAt'",
")",
";",
"$",
"dir",
"=",
"$",
"request",
"->",
"request",
"->",
"get",
"(",
"'dir'",
",",
"'DESC'",
")",
";",
"$",
"limit",
"=",
"$",
"request",
"->",
"request",
"->",
"get",
"(",
"'limit'",
",",
"20",
")",
";",
"$",
"start",
"=",
"$",
"request",
"->",
"request",
"->",
"get",
"(",
"'start'",
",",
"0",
")",
";",
"$",
"status",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"request",
"->",
"request",
"->",
"all",
"(",
")",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"substr",
"(",
"$",
"key",
",",
"0",
",",
"7",
")",
"===",
"'status_'",
")",
"{",
"$",
"status",
"[",
"]",
"=",
"substr",
"(",
"$",
"key",
",",
"7",
")",
";",
"}",
"}",
"$",
"taskManager",
"=",
"$",
"this",
"->",
"get",
"(",
"'phlexible_task.task_manager'",
")",
";",
"if",
"(",
"!",
"count",
"(",
"$",
"status",
")",
")",
"{",
"$",
"status",
"[",
"]",
"=",
"current",
"(",
"array_keys",
"(",
"$",
"taskManager",
"->",
"getStates",
"(",
")",
")",
")",
";",
"}",
"$",
"userId",
"=",
"$",
"this",
"->",
"getUser",
"(",
")",
"->",
"getId",
"(",
")",
";",
"switch",
"(",
"$",
"type",
")",
"{",
"case",
"'tasks'",
":",
"$",
"tasks",
"=",
"$",
"taskManager",
"->",
"findByCreatedByAndStatus",
"(",
"$",
"userId",
",",
"$",
"status",
",",
"[",
"$",
"sort",
"=>",
"$",
"dir",
"]",
",",
"$",
"limit",
",",
"$",
"start",
")",
";",
"$",
"total",
"=",
"$",
"taskManager",
"->",
"countByCreatedByAndStatus",
"(",
"$",
"userId",
",",
"$",
"status",
")",
";",
"break",
";",
"case",
"'todos'",
":",
"$",
"tasks",
"=",
"$",
"taskManager",
"->",
"findByAssignedToAndStatus",
"(",
"$",
"userId",
",",
"$",
"status",
",",
"[",
"$",
"sort",
"=>",
"$",
"dir",
"]",
",",
"$",
"limit",
",",
"$",
"start",
")",
";",
"$",
"total",
"=",
"$",
"taskManager",
"->",
"countByAssignedToAndStatus",
"(",
"$",
"userId",
",",
"$",
"status",
")",
";",
"break",
";",
"case",
"'involved'",
":",
"$",
"tasks",
"=",
"$",
"taskManager",
"->",
"findByInvolvementAndStatus",
"(",
"$",
"userId",
",",
"$",
"status",
",",
"[",
"$",
"sort",
"=>",
"$",
"dir",
"]",
",",
"$",
"limit",
",",
"$",
"start",
")",
";",
"$",
"total",
"=",
"$",
"taskManager",
"->",
"countByInvolvementAndStatus",
"(",
"$",
"userId",
",",
"$",
"status",
")",
";",
"break",
";",
"case",
"'all'",
":",
"default",
":",
"$",
"tasks",
"=",
"$",
"taskManager",
"->",
"findByStatus",
"(",
"$",
"status",
",",
"[",
"$",
"sort",
"=>",
"$",
"dir",
"]",
",",
"$",
"limit",
",",
"$",
"start",
")",
";",
"$",
"total",
"=",
"$",
"taskManager",
"->",
"countByStatus",
"(",
"$",
"status",
")",
";",
"break",
";",
"}",
"$",
"data",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"tasks",
"as",
"$",
"task",
")",
"{",
"/* @var $task Task */",
"$",
"data",
"[",
"]",
"=",
"$",
"this",
"->",
"serializeTask",
"(",
"$",
"task",
")",
";",
"}",
"return",
"new",
"JsonResponse",
"(",
"[",
"'tasks'",
"=>",
"$",
"data",
",",
"'total'",
"=>",
"$",
"total",
",",
"]",
")",
";",
"}"
] | List tasks.
@param Request $request
@return JsonResponse
@Route("/list", name="tasks_list")
@Method({"GET", "POST"})
@ApiDoc(
description="Search",
requirements={
{"name"="query", "dataType"="string", "required"=true, "description"="Search query"}
},
filters={
{"name"="limit", "dataType"="integer", "default"=20, "description"="Limit results"},
{"name"="start", "dataType"="integer", "default"=0, "description"="Result offset"},
{"name"="sort", "dataType"="string", "default"="created_at", "description"="Sort field"},
{"name"="dir", "dataType"="string", "default"="DESC", "description"="Sort direction"},
{"name"="tasks", "dataType"="string", "default"="involved", "description"="involvement"},
{"name"="status_open", "dataType"="boolean", "default"=false, "description"="Status open"},
{"name"="status_rejected", "dataType"="boolean", "default"=false, "description"="Status rejected"},
{"name"="status_reopened", "dataType"="boolean", "default"=false, "description"="Status reopened"},
{"name"="status_finished", "dataType"="boolean", "default"=false, "description"="Status finished"},
{"name"="status_closed", "dataType"="boolean", "default"=false, "description"="Status closed"}
}
) | [
"List",
"tasks",
"."
] | 7f111ba992d40b30a1ae99ca4f06bcbed3fc6af2 | https://github.com/phlexible/task-bundle/blob/7f111ba992d40b30a1ae99ca4f06bcbed3fc6af2/Controller/TaskController.php#L61-L117 |
10,196 | phlexible/task-bundle | Controller/TaskController.php | TaskController.typesAction | public function typesAction(Request $request)
{
$component = $request->request->get('component');
$taskTypes = $this->get('phlexible_task.types');
$types = [];
foreach ($taskTypes->all() as $type) {
/* @var $type TypeInterface */
if ($component && $type->getComponent() !== $component) {
continue;
}
$types[] = [
'id' => $type->getName(),
'name' => $type->getName(),
];
}
return new JsonResponse(['types' => $types]);
} | php | public function typesAction(Request $request)
{
$component = $request->request->get('component');
$taskTypes = $this->get('phlexible_task.types');
$types = [];
foreach ($taskTypes->all() as $type) {
/* @var $type TypeInterface */
if ($component && $type->getComponent() !== $component) {
continue;
}
$types[] = [
'id' => $type->getName(),
'name' => $type->getName(),
];
}
return new JsonResponse(['types' => $types]);
} | [
"public",
"function",
"typesAction",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"component",
"=",
"$",
"request",
"->",
"request",
"->",
"get",
"(",
"'component'",
")",
";",
"$",
"taskTypes",
"=",
"$",
"this",
"->",
"get",
"(",
"'phlexible_task.types'",
")",
";",
"$",
"types",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"taskTypes",
"->",
"all",
"(",
")",
"as",
"$",
"type",
")",
"{",
"/* @var $type TypeInterface */",
"if",
"(",
"$",
"component",
"&&",
"$",
"type",
"->",
"getComponent",
"(",
")",
"!==",
"$",
"component",
")",
"{",
"continue",
";",
"}",
"$",
"types",
"[",
"]",
"=",
"[",
"'id'",
"=>",
"$",
"type",
"->",
"getName",
"(",
")",
",",
"'name'",
"=>",
"$",
"type",
"->",
"getName",
"(",
")",
",",
"]",
";",
"}",
"return",
"new",
"JsonResponse",
"(",
"[",
"'types'",
"=>",
"$",
"types",
"]",
")",
";",
"}"
] | List types.
@param Request $request
@return JsonResponse
@Route("/types", name="tasks_types")
@Method({"GET", "POST"})
@ApiDoc(
description="List task types",
filters={
{"name"="component", "dataType"="string", "description"="Component filter"}
}
) | [
"List",
"types",
"."
] | 7f111ba992d40b30a1ae99ca4f06bcbed3fc6af2 | https://github.com/phlexible/task-bundle/blob/7f111ba992d40b30a1ae99ca4f06bcbed3fc6af2/Controller/TaskController.php#L146-L166 |
10,197 | phlexible/task-bundle | Controller/TaskController.php | TaskController.statusAction | public function statusAction(Request $request)
{
$taskManager = $this->get('phlexible_task.task_manager');
$states = $taskManager->getStates();
return new JsonResponse(['states' => $states]);
} | php | public function statusAction(Request $request)
{
$taskManager = $this->get('phlexible_task.task_manager');
$states = $taskManager->getStates();
return new JsonResponse(['states' => $states]);
} | [
"public",
"function",
"statusAction",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"taskManager",
"=",
"$",
"this",
"->",
"get",
"(",
"'phlexible_task.task_manager'",
")",
";",
"$",
"states",
"=",
"$",
"taskManager",
"->",
"getStates",
"(",
")",
";",
"return",
"new",
"JsonResponse",
"(",
"[",
"'states'",
"=>",
"$",
"states",
"]",
")",
";",
"}"
] | List status.
@param Request $request
@return JsonResponse
@Route("/states", name="tasks_states")
@Method({"GET", "POST"})
@ApiDoc(
description="List task states"
) | [
"List",
"status",
"."
] | 7f111ba992d40b30a1ae99ca4f06bcbed3fc6af2 | https://github.com/phlexible/task-bundle/blob/7f111ba992d40b30a1ae99ca4f06bcbed3fc6af2/Controller/TaskController.php#L180-L187 |
10,198 | phlexible/task-bundle | Controller/TaskController.php | TaskController.recipientsAction | public function recipientsAction(Request $request)
{
$taskType = $request->get('type');
$types = $this->get('phlexible_task.types');
$userManager = $this->get('phlexible_user.user_manager');
$authorizationChecker = $this->get('security.authorization_checker');
$type = $types->get($taskType);
$users = [];
foreach ($userManager->findAll() as $user) {
if (!$authorizationChecker->isGranted('ROLE_TASKS')) {
continue;
}
if ($type->getRole() && !$authorizationChecker->isGranted($type->getRole())) {
continue;
}
$users[$user->getDisplayName()] = [
'uid' => $user->getId(),
'username' => $user->getDisplayName(),
];
}
ksort($users);
$users = array_values($users);
return new JsonResponse(['users' => $users]);
} | php | public function recipientsAction(Request $request)
{
$taskType = $request->get('type');
$types = $this->get('phlexible_task.types');
$userManager = $this->get('phlexible_user.user_manager');
$authorizationChecker = $this->get('security.authorization_checker');
$type = $types->get($taskType);
$users = [];
foreach ($userManager->findAll() as $user) {
if (!$authorizationChecker->isGranted('ROLE_TASKS')) {
continue;
}
if ($type->getRole() && !$authorizationChecker->isGranted($type->getRole())) {
continue;
}
$users[$user->getDisplayName()] = [
'uid' => $user->getId(),
'username' => $user->getDisplayName(),
];
}
ksort($users);
$users = array_values($users);
return new JsonResponse(['users' => $users]);
} | [
"public",
"function",
"recipientsAction",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"taskType",
"=",
"$",
"request",
"->",
"get",
"(",
"'type'",
")",
";",
"$",
"types",
"=",
"$",
"this",
"->",
"get",
"(",
"'phlexible_task.types'",
")",
";",
"$",
"userManager",
"=",
"$",
"this",
"->",
"get",
"(",
"'phlexible_user.user_manager'",
")",
";",
"$",
"authorizationChecker",
"=",
"$",
"this",
"->",
"get",
"(",
"'security.authorization_checker'",
")",
";",
"$",
"type",
"=",
"$",
"types",
"->",
"get",
"(",
"$",
"taskType",
")",
";",
"$",
"users",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"userManager",
"->",
"findAll",
"(",
")",
"as",
"$",
"user",
")",
"{",
"if",
"(",
"!",
"$",
"authorizationChecker",
"->",
"isGranted",
"(",
"'ROLE_TASKS'",
")",
")",
"{",
"continue",
";",
"}",
"if",
"(",
"$",
"type",
"->",
"getRole",
"(",
")",
"&&",
"!",
"$",
"authorizationChecker",
"->",
"isGranted",
"(",
"$",
"type",
"->",
"getRole",
"(",
")",
")",
")",
"{",
"continue",
";",
"}",
"$",
"users",
"[",
"$",
"user",
"->",
"getDisplayName",
"(",
")",
"]",
"=",
"[",
"'uid'",
"=>",
"$",
"user",
"->",
"getId",
"(",
")",
",",
"'username'",
"=>",
"$",
"user",
"->",
"getDisplayName",
"(",
")",
",",
"]",
";",
"}",
"ksort",
"(",
"$",
"users",
")",
";",
"$",
"users",
"=",
"array_values",
"(",
"$",
"users",
")",
";",
"return",
"new",
"JsonResponse",
"(",
"[",
"'users'",
"=>",
"$",
"users",
"]",
")",
";",
"}"
] | List recipients.
@param Request $request
@return JsonResponse
@Route("/recipients", name="tasks_recipients")
@Method({"GET", "POST"})
@ApiDoc(
description="List recipients",
requirements={
{"name"="type", "dataType"="string", "required"=true, "description"="Task type"},
}
) | [
"List",
"recipients",
"."
] | 7f111ba992d40b30a1ae99ca4f06bcbed3fc6af2 | https://github.com/phlexible/task-bundle/blob/7f111ba992d40b30a1ae99ca4f06bcbed3fc6af2/Controller/TaskController.php#L204-L234 |
10,199 | phlexible/task-bundle | Controller/TaskController.php | TaskController.createTaskAction | public function createTaskAction(Request $request)
{
$typeName = $request->get('type');
$assignedUserId = $request->get('recipient');
$description = $request->get('description');
$payload = $request->get('payload');
if ($payload) {
$payload = json_decode($payload, true);
}
$taskManager = $this->get('phlexible_task.task_manager');
$userManager = $this->get('phlexible_user.user_manager');
$types = $this->get('phlexible_task.types');
$type = $types->get($typeName);
$assignedUser = $userManager->find($assignedUserId);
$task = $taskManager->createTask($type, $this->getUser(), $assignedUser, $payload, $description);
return new ResultResponse(true, 'Task created.');
} | php | public function createTaskAction(Request $request)
{
$typeName = $request->get('type');
$assignedUserId = $request->get('recipient');
$description = $request->get('description');
$payload = $request->get('payload');
if ($payload) {
$payload = json_decode($payload, true);
}
$taskManager = $this->get('phlexible_task.task_manager');
$userManager = $this->get('phlexible_user.user_manager');
$types = $this->get('phlexible_task.types');
$type = $types->get($typeName);
$assignedUser = $userManager->find($assignedUserId);
$task = $taskManager->createTask($type, $this->getUser(), $assignedUser, $payload, $description);
return new ResultResponse(true, 'Task created.');
} | [
"public",
"function",
"createTaskAction",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"typeName",
"=",
"$",
"request",
"->",
"get",
"(",
"'type'",
")",
";",
"$",
"assignedUserId",
"=",
"$",
"request",
"->",
"get",
"(",
"'recipient'",
")",
";",
"$",
"description",
"=",
"$",
"request",
"->",
"get",
"(",
"'description'",
")",
";",
"$",
"payload",
"=",
"$",
"request",
"->",
"get",
"(",
"'payload'",
")",
";",
"if",
"(",
"$",
"payload",
")",
"{",
"$",
"payload",
"=",
"json_decode",
"(",
"$",
"payload",
",",
"true",
")",
";",
"}",
"$",
"taskManager",
"=",
"$",
"this",
"->",
"get",
"(",
"'phlexible_task.task_manager'",
")",
";",
"$",
"userManager",
"=",
"$",
"this",
"->",
"get",
"(",
"'phlexible_user.user_manager'",
")",
";",
"$",
"types",
"=",
"$",
"this",
"->",
"get",
"(",
"'phlexible_task.types'",
")",
";",
"$",
"type",
"=",
"$",
"types",
"->",
"get",
"(",
"$",
"typeName",
")",
";",
"$",
"assignedUser",
"=",
"$",
"userManager",
"->",
"find",
"(",
"$",
"assignedUserId",
")",
";",
"$",
"task",
"=",
"$",
"taskManager",
"->",
"createTask",
"(",
"$",
"type",
",",
"$",
"this",
"->",
"getUser",
"(",
")",
",",
"$",
"assignedUser",
",",
"$",
"payload",
",",
"$",
"description",
")",
";",
"return",
"new",
"ResultResponse",
"(",
"true",
",",
"'Task created.'",
")",
";",
"}"
] | Create task.
@param Request $request
@return ResultResponse
@Route("/create/task", name="tasks_create_task")
@Method({"GET", "POST"})
@ApiDoc(
description="Create task",
requirements={
{"name"="type", "dataType"="string", "required"=true, "description"="Task type"},
{"name"="recipient", "dataType"="string", "required"=true, "description"="Recipient"},
{"name"="description", "dataType"="string", "required"=true, "description"="Description"},
{"name"="payload", "dataType"="array", "required"=true, "description"="Payload"}
}
) | [
"Create",
"task",
"."
] | 7f111ba992d40b30a1ae99ca4f06bcbed3fc6af2 | https://github.com/phlexible/task-bundle/blob/7f111ba992d40b30a1ae99ca4f06bcbed3fc6af2/Controller/TaskController.php#L254-L275 |
Subsets and Splits