repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_code_tokens listlengths 15 672k | func_documentation_string stringlengths 1 47.2k | func_documentation_tokens listlengths 1 3.92k | split_name stringclasses 1
value | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|---|---|---|
gregorybesson/PlaygroundCore | src/Filter/Sanitize.php | Sanitize.addWordDelimiter | public function addWordDelimiter($delimiter)
{
if (in_array($delimiter, $this->getWordDelimiters())) {
throw new \Exception("Word delimiter '$delimiter' is already there.");
}
if (empty($delimiter)) {
throw new \Exception('Word delimiter cannot be null.');
}
... | php | public function addWordDelimiter($delimiter)
{
if (in_array($delimiter, $this->getWordDelimiters())) {
throw new \Exception("Word delimiter '$delimiter' is already there.");
}
if (empty($delimiter)) {
throw new \Exception('Word delimiter cannot be null.');
}
... | [
"public",
"function",
"addWordDelimiter",
"(",
"$",
"delimiter",
")",
"{",
"if",
"(",
"in_array",
"(",
"$",
"delimiter",
",",
"$",
"this",
"->",
"getWordDelimiters",
"(",
")",
")",
")",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
"\"Word delimiter '$delimit... | Add word delimiter
@param string|array $delimiter
@return Zend_Filter_Sanitize | [
"Add",
"word",
"delimiter"
] | train | https://github.com/gregorybesson/PlaygroundCore/blob/f8dfa4c7660b54354933b3c28c0cf35304a649df/src/Filter/Sanitize.php#L204-L218 |
gregorybesson/PlaygroundCore | src/Filter/Sanitize.php | Sanitize.toLowerChars | private function toLowerChars($s)
{
$lowerFilter = new \Zend\Filter\StringToLower;
$lowerFilter->setEncoding('utf-8');
return $lowerFilter->filter($s);
} | php | private function toLowerChars($s)
{
$lowerFilter = new \Zend\Filter\StringToLower;
$lowerFilter->setEncoding('utf-8');
return $lowerFilter->filter($s);
} | [
"private",
"function",
"toLowerChars",
"(",
"$",
"s",
")",
"{",
"$",
"lowerFilter",
"=",
"new",
"\\",
"Zend",
"\\",
"Filter",
"\\",
"StringToLower",
";",
"$",
"lowerFilter",
"->",
"setEncoding",
"(",
"'utf-8'",
")",
";",
"return",
"$",
"lowerFilter",
"->",... | to lower chars
@param string $s
@return string | [
"to",
"lower",
"chars"
] | train | https://github.com/gregorybesson/PlaygroundCore/blob/f8dfa4c7660b54354933b3c28c0cf35304a649df/src/Filter/Sanitize.php#L301-L306 |
gregorybesson/PlaygroundCore | src/Filter/Sanitize.php | Sanitize.trimSpecialsChars | private function trimSpecialsChars($s)
{
if (count($this->getNotReplacedChars()) == 0) {
$reg = '~[^-a-z0-9_]+~';
} else {
$reg = '~[^-a-z0-9_' . implode('', $this->getNotReplacedChars()) .']+~';
}
return preg_replace($reg, '', $s);
} | php | private function trimSpecialsChars($s)
{
if (count($this->getNotReplacedChars()) == 0) {
$reg = '~[^-a-z0-9_]+~';
} else {
$reg = '~[^-a-z0-9_' . implode('', $this->getNotReplacedChars()) .']+~';
}
return preg_replace($reg, '', $s);
} | [
"private",
"function",
"trimSpecialsChars",
"(",
"$",
"s",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"this",
"->",
"getNotReplacedChars",
"(",
")",
")",
"==",
"0",
")",
"{",
"$",
"reg",
"=",
"'~[^-a-z0-9_]+~'",
";",
"}",
"else",
"{",
"$",
"reg",
"=",
... | to lower chars
@param string $s
@return string | [
"to",
"lower",
"chars"
] | train | https://github.com/gregorybesson/PlaygroundCore/blob/f8dfa4c7660b54354933b3c28c0cf35304a649df/src/Filter/Sanitize.php#L314-L322 |
gregorybesson/PlaygroundCore | src/Filter/Sanitize.php | Sanitize.replaceDoubleDelimiterReplacementWithSingle | private function replaceDoubleDelimiterReplacementWithSingle($s)
{
$doubleDelimiterReplacement = $this->getDelimiterReplacement() . $this->getDelimiterReplacement();
while (strpos($s, $doubleDelimiterReplacement) !== false) {
$s = str_replace($doubleDelimiterReplacement, $this->getDelimi... | php | private function replaceDoubleDelimiterReplacementWithSingle($s)
{
$doubleDelimiterReplacement = $this->getDelimiterReplacement() . $this->getDelimiterReplacement();
while (strpos($s, $doubleDelimiterReplacement) !== false) {
$s = str_replace($doubleDelimiterReplacement, $this->getDelimi... | [
"private",
"function",
"replaceDoubleDelimiterReplacementWithSingle",
"(",
"$",
"s",
")",
"{",
"$",
"doubleDelimiterReplacement",
"=",
"$",
"this",
"->",
"getDelimiterReplacement",
"(",
")",
".",
"$",
"this",
"->",
"getDelimiterReplacement",
"(",
")",
";",
"while",
... | replace double delimiter with single one
@param string $s
@return string | [
"replace",
"double",
"delimiter",
"with",
"single",
"one"
] | train | https://github.com/gregorybesson/PlaygroundCore/blob/f8dfa4c7660b54354933b3c28c0cf35304a649df/src/Filter/Sanitize.php#L330-L337 |
activecollab/databasestructure | src/Behaviour/PositionInterface/Implementation.php | Implementation.ActiveCollabDatabaseStructureBehaviourPositionInterfaceImplementation | public function ActiveCollabDatabaseStructureBehaviourPositionInterfaceImplementation()
{
$this->registerEventHandler('on_before_save', function () {
if (!$this->getPosition()) {
$table_name = $this->connection->escapeTableName($this->getTableName());
$conditions ... | php | public function ActiveCollabDatabaseStructureBehaviourPositionInterfaceImplementation()
{
$this->registerEventHandler('on_before_save', function () {
if (!$this->getPosition()) {
$table_name = $this->connection->escapeTableName($this->getTableName());
$conditions ... | [
"public",
"function",
"ActiveCollabDatabaseStructureBehaviourPositionInterfaceImplementation",
"(",
")",
"{",
"$",
"this",
"->",
"registerEventHandler",
"(",
"'on_before_save'",
",",
"function",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"getPosition",
"(",
"... | Say hello to the parent class. | [
"Say",
"hello",
"to",
"the",
"parent",
"class",
"."
] | train | https://github.com/activecollab/databasestructure/blob/4b2353c4422186bcfce63b3212da3e70e63eb5df/src/Behaviour/PositionInterface/Implementation.php#L23-L41 |
activecollab/databasestructure | src/Behaviour/PositionInterface/Implementation.php | Implementation.getPositionContextConditions | private function getPositionContextConditions()
{
$pattern = $this->pool->getTypeProperty(get_class($this), 'position_context_conditions_pattern', function () {
$conditions = [];
foreach ($this->getPositionContext() as $field_name) {
$conditions[] = $this->connection... | php | private function getPositionContextConditions()
{
$pattern = $this->pool->getTypeProperty(get_class($this), 'position_context_conditions_pattern', function () {
$conditions = [];
foreach ($this->getPositionContext() as $field_name) {
$conditions[] = $this->connection... | [
"private",
"function",
"getPositionContextConditions",
"(",
")",
"{",
"$",
"pattern",
"=",
"$",
"this",
"->",
"pool",
"->",
"getTypeProperty",
"(",
"get_class",
"(",
"$",
"this",
")",
",",
"'position_context_conditions_pattern'",
",",
"function",
"(",
")",
"{",
... | Return position context conditions.
@return string | [
"Return",
"position",
"context",
"conditions",
"."
] | train | https://github.com/activecollab/databasestructure/blob/4b2353c4422186bcfce63b3212da3e70e63eb5df/src/Behaviour/PositionInterface/Implementation.php#L48-L71 |
pickles2/px2-sitemapexcel | php/apis/csv2xlsx.php | csv2xlsx.convert | public function convert( $path_csv, $path_xlsx ){
$this->path_xlsx = $path_xlsx;
$this->path_csv = $path_csv;
// ↓疑似サイトマップオブジェクト
// sitemapExcel実行時点で、
// 本物の$siteはスタンバイされていないので、
// 偽物でエミュレートする必要があった。
$this->site = new pxplugin_sitemapExcel_helper_parseSitemapCsv( $this->px, $this->path_csv );
$tabl... | php | public function convert( $path_csv, $path_xlsx ){
$this->path_xlsx = $path_xlsx;
$this->path_csv = $path_csv;
// ↓疑似サイトマップオブジェクト
// sitemapExcel実行時点で、
// 本物の$siteはスタンバイされていないので、
// 偽物でエミュレートする必要があった。
$this->site = new pxplugin_sitemapExcel_helper_parseSitemapCsv( $this->px, $this->path_csv );
$tabl... | [
"public",
"function",
"convert",
"(",
"$",
"path_csv",
",",
"$",
"path_xlsx",
")",
"{",
"$",
"this",
"->",
"path_xlsx",
"=",
"$",
"path_xlsx",
";",
"$",
"this",
"->",
"path_csv",
"=",
"$",
"path_csv",
";",
"// ↓疑似サイトマップオブジェクト",
"// sitemapExcel実行時点で、",
"// ... | 現在のサイトマップをxlsxに出力する。 | [
"現在のサイトマップをxlsxに出力する。"
] | train | https://github.com/pickles2/px2-sitemapexcel/blob/fbfa207ee9b2e4bd977aadf69a935d3fade51fea/php/apis/csv2xlsx.php#L52-L227 |
pickles2/px2-sitemapexcel | php/apis/csv2xlsx.php | csv2xlsx.mk_config_string | private function mk_config_string(){
$config = array();
$table_definition = $this->get_table_definition();
foreach( $table_definition as $key=>$val ){
if( $key == 'col_define' ){ continue; }
array_push( $config, urlencode($key).'='.urlencode($val) );
}
// sitemapExcelのバージョン情報を記載
array_push( $config, ... | php | private function mk_config_string(){
$config = array();
$table_definition = $this->get_table_definition();
foreach( $table_definition as $key=>$val ){
if( $key == 'col_define' ){ continue; }
array_push( $config, urlencode($key).'='.urlencode($val) );
}
// sitemapExcelのバージョン情報を記載
array_push( $config, ... | [
"private",
"function",
"mk_config_string",
"(",
")",
"{",
"$",
"config",
"=",
"array",
"(",
")",
";",
"$",
"table_definition",
"=",
"$",
"this",
"->",
"get_table_definition",
"(",
")",
";",
"foreach",
"(",
"$",
"table_definition",
"as",
"$",
"key",
"=>",
... | 設定文字列を作成する | [
"設定文字列を作成する"
] | train | https://github.com/pickles2/px2-sitemapexcel/blob/fbfa207ee9b2e4bd977aadf69a935d3fade51fea/php/apis/csv2xlsx.php#L232-L245 |
pickles2/px2-sitemapexcel | php/apis/csv2xlsx.php | csv2xlsx.get_max_depth | private function get_max_depth(){
if( is_int($this->max_depth) ){
return $this->max_depth;
}
$this->max_depth = $this->site->get_max_depth();
return $this->max_depth;
} | php | private function get_max_depth(){
if( is_int($this->max_depth) ){
return $this->max_depth;
}
$this->max_depth = $this->site->get_max_depth();
return $this->max_depth;
} | [
"private",
"function",
"get_max_depth",
"(",
")",
"{",
"if",
"(",
"is_int",
"(",
"$",
"this",
"->",
"max_depth",
")",
")",
"{",
"return",
"$",
"this",
"->",
"max_depth",
";",
"}",
"$",
"this",
"->",
"max_depth",
"=",
"$",
"this",
"->",
"site",
"->",
... | パンくずの最大の深さを計測 | [
"パンくずの最大の深さを計測"
] | train | https://github.com/pickles2/px2-sitemapexcel/blob/fbfa207ee9b2e4bd977aadf69a935d3fade51fea/php/apis/csv2xlsx.php#L250-L256 |
pickles2/px2-sitemapexcel | php/apis/csv2xlsx.php | csv2xlsx.scan_sitemap_tree_recursive | private function scan_sitemap_tree_recursive($objSheet, $page_id = ''){
if(!is_string($page_id)){return false;}
$sitemap_definition = $this->get_sitemap_definition();
$table_definition = $this->get_table_definition();
// var_dump($this->site->get_sitemap());
$page_info = $this->site->get_page_info($page_id);
... | php | private function scan_sitemap_tree_recursive($objSheet, $page_id = ''){
if(!is_string($page_id)){return false;}
$sitemap_definition = $this->get_sitemap_definition();
$table_definition = $this->get_table_definition();
// var_dump($this->site->get_sitemap());
$page_info = $this->site->get_page_info($page_id);
... | [
"private",
"function",
"scan_sitemap_tree_recursive",
"(",
"$",
"objSheet",
",",
"$",
"page_id",
"=",
"''",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"page_id",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"sitemap_definition",
"=",
"$",
"this... | サイトマップをスキャンして、xlsxのデータ部分を作成する | [
"サイトマップをスキャンして、xlsxのデータ部分を作成する"
] | train | https://github.com/pickles2/px2-sitemapexcel/blob/fbfa207ee9b2e4bd977aadf69a935d3fade51fea/php/apis/csv2xlsx.php#L261-L293 |
pickles2/px2-sitemapexcel | php/apis/csv2xlsx.php | csv2xlsx.mk_xlsx_body | private function mk_xlsx_body($objSheet, $page_info, $is_valid_parent = false){
if(!is_array($page_info)){
return false;
}
set_time_limit(30);
$sitemap_definition = $this->get_sitemap_definition();
$table_definition = $this->get_table_definition();
foreach( $table_definition['col_define'] as $def_row )... | php | private function mk_xlsx_body($objSheet, $page_info, $is_valid_parent = false){
if(!is_array($page_info)){
return false;
}
set_time_limit(30);
$sitemap_definition = $this->get_sitemap_definition();
$table_definition = $this->get_table_definition();
foreach( $table_definition['col_define'] as $def_row )... | [
"private",
"function",
"mk_xlsx_body",
"(",
"$",
"objSheet",
",",
"$",
"page_info",
",",
"$",
"is_valid_parent",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"page_info",
")",
")",
"{",
"return",
"false",
";",
"}",
"set_time_limit",
"(",... | サイトマップをスキャンして、xlsxのデータ部分を作成する | [
"サイトマップをスキャンして、xlsxのデータ部分を作成する"
] | train | https://github.com/pickles2/px2-sitemapexcel/blob/fbfa207ee9b2e4bd977aadf69a935d3fade51fea/php/apis/csv2xlsx.php#L298-L420 |
pickles2/px2-sitemapexcel | php/apis/csv2xlsx.php | csv2xlsx.repair_path | private function repair_path($path){
$tmp_path = $path;
$tmp_path = preg_replace('/^alias[0-9]*\:/si','alias:',$tmp_path);
$tmp_path = preg_replace('/^alias\:([a-zA-Z0-9\+]+\:|\/\/)/si','$1',$tmp_path);
$tmp_path = preg_replace('/^alias\:\#/si','#',$tmp_path);
switch( $this->px->get_path_type($tmp_path) ){
... | php | private function repair_path($path){
$tmp_path = $path;
$tmp_path = preg_replace('/^alias[0-9]*\:/si','alias:',$tmp_path);
$tmp_path = preg_replace('/^alias\:([a-zA-Z0-9\+]+\:|\/\/)/si','$1',$tmp_path);
$tmp_path = preg_replace('/^alias\:\#/si','#',$tmp_path);
switch( $this->px->get_path_type($tmp_path) ){
... | [
"private",
"function",
"repair_path",
"(",
"$",
"path",
")",
"{",
"$",
"tmp_path",
"=",
"$",
"path",
";",
"$",
"tmp_path",
"=",
"preg_replace",
"(",
"'/^alias[0-9]*\\:/si'",
",",
"'alias:'",
",",
"$",
"tmp_path",
")",
";",
"$",
"tmp_path",
"=",
"preg_repla... | 加工されたパスを戻す | [
"加工されたパスを戻す"
] | train | https://github.com/pickles2/px2-sitemapexcel/blob/fbfa207ee9b2e4bd977aadf69a935d3fade51fea/php/apis/csv2xlsx.php#L425-L442 |
pickles2/px2-sitemapexcel | php/apis/csv2xlsx.php | csv2xlsx.repair_page_id | private function repair_page_id($page_id, $path){
$page_id = preg_replace('/^\:auto_page_id\.[0-9]+$/si', '', $page_id);
$tmp_path = $path;
$tmp_path = preg_replace('/\/'.$this->px->get_directory_index_preg_pattern().'$/si', '/', $tmp_path);
$tmp_path = preg_replace('/\.(?:html)$/si', '', $tmp_path);
$tmp_pat... | php | private function repair_page_id($page_id, $path){
$page_id = preg_replace('/^\:auto_page_id\.[0-9]+$/si', '', $page_id);
$tmp_path = $path;
$tmp_path = preg_replace('/\/'.$this->px->get_directory_index_preg_pattern().'$/si', '/', $tmp_path);
$tmp_path = preg_replace('/\.(?:html)$/si', '', $tmp_path);
$tmp_pat... | [
"private",
"function",
"repair_page_id",
"(",
"$",
"page_id",
",",
"$",
"path",
")",
"{",
"$",
"page_id",
"=",
"preg_replace",
"(",
"'/^\\:auto_page_id\\.[0-9]+$/si'",
",",
"''",
",",
"$",
"page_id",
")",
";",
"$",
"tmp_path",
"=",
"$",
"path",
";",
"$",
... | 加工されたページIDを戻す | [
"加工されたページIDを戻す"
] | train | https://github.com/pickles2/px2-sitemapexcel/blob/fbfa207ee9b2e4bd977aadf69a935d3fade51fea/php/apis/csv2xlsx.php#L447-L459 |
pickles2/px2-sitemapexcel | php/apis/csv2xlsx.php | csv2xlsx.get_table_definition | private function get_table_definition(){
if(is_array($this->table_definition)){
return $this->table_definition;
}
$rtn = array();
$rtn['row_definition'] = 8;
$rtn['row_data_start'] = $rtn['row_definition']+1;
$rtn['skip_empty_col'] = 20;
$rtn['col_define'] = array();
$current_col = 'A';
$rtn['co... | php | private function get_table_definition(){
if(is_array($this->table_definition)){
return $this->table_definition;
}
$rtn = array();
$rtn['row_definition'] = 8;
$rtn['row_data_start'] = $rtn['row_definition']+1;
$rtn['skip_empty_col'] = 20;
$rtn['col_define'] = array();
$current_col = 'A';
$rtn['co... | [
"private",
"function",
"get_table_definition",
"(",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"this",
"->",
"table_definition",
")",
")",
"{",
"return",
"$",
"this",
"->",
"table_definition",
";",
"}",
"$",
"rtn",
"=",
"array",
"(",
")",
";",
"$",
"rt... | 表の構造定義を得る | [
"表の構造定義を得る"
] | train | https://github.com/pickles2/px2-sitemapexcel/blob/fbfa207ee9b2e4bd977aadf69a935d3fade51fea/php/apis/csv2xlsx.php#L464-L500 |
pickles2/px2-sitemapexcel | php/apis/csv2xlsx.php | csv2xlsx.get_sitemap_definition | private function get_sitemap_definition(){
// $rtn = $this->site->get_sitemap_definition();
$rtn = $this->plugin->get_sitemap_definition();
if( !is_array(@$rtn['**delete_flg']) ){
$rtn['**delete_flg'] = array();
$rtn['**delete_flg']['name'] = '削除フラグ';
$rtn['**delete_flg']['key'] = '**delete_flg';
}
... | php | private function get_sitemap_definition(){
// $rtn = $this->site->get_sitemap_definition();
$rtn = $this->plugin->get_sitemap_definition();
if( !is_array(@$rtn['**delete_flg']) ){
$rtn['**delete_flg'] = array();
$rtn['**delete_flg']['name'] = '削除フラグ';
$rtn['**delete_flg']['key'] = '**delete_flg';
}
... | [
"private",
"function",
"get_sitemap_definition",
"(",
")",
"{",
"// $rtn = $this->site->get_sitemap_definition();",
"$",
"rtn",
"=",
"$",
"this",
"->",
"plugin",
"->",
"get_sitemap_definition",
"(",
")",
";",
"if",
"(",
"!",
"is_array",
"(",
"@",
"$",
"rtn",
"["... | サイトマップ定義を取得する | [
"サイトマップ定義を取得する"
] | train | https://github.com/pickles2/px2-sitemapexcel/blob/fbfa207ee9b2e4bd977aadf69a935d3fade51fea/php/apis/csv2xlsx.php#L505-L526 |
movoin/one-swoole | src/Validation/Validators/NotNullValidator.php | NotNullValidator.validate | protected function validate(array $attributes, string $name, array $parameters): bool
{
if (! is_null($attributes[$name])) {
return true;
}
$this->addError($name, $parameters, '%s 不能为 Null');
return false;
} | php | protected function validate(array $attributes, string $name, array $parameters): bool
{
if (! is_null($attributes[$name])) {
return true;
}
$this->addError($name, $parameters, '%s 不能为 Null');
return false;
} | [
"protected",
"function",
"validate",
"(",
"array",
"$",
"attributes",
",",
"string",
"$",
"name",
",",
"array",
"$",
"parameters",
")",
":",
"bool",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"attributes",
"[",
"$",
"name",
"]",
")",
")",
"{",
"return... | 校验规则
@param array $attributes
@param string $name
@param array $parameters
@return bool | [
"校验规则"
] | train | https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/Validation/Validators/NotNullValidator.php#L26-L35 |
JoffreyPoreeCoding/MongoDB-ODM | src/Iterator/GridFSDocumentIterator.php | GridFSDocumentIterator.current | public function current()
{
$this->currentData['stream'] = $this->repository->getBucket()->openDownloadStream($this->currentData['_id']);
return parent::current();
} | php | public function current()
{
$this->currentData['stream'] = $this->repository->getBucket()->openDownloadStream($this->currentData['_id']);
return parent::current();
} | [
"public",
"function",
"current",
"(",
")",
"{",
"$",
"this",
"->",
"currentData",
"[",
"'stream'",
"]",
"=",
"$",
"this",
"->",
"repository",
"->",
"getBucket",
"(",
")",
"->",
"openDownloadStream",
"(",
"$",
"this",
"->",
"currentData",
"[",
"'_id'",
"]... | Returns the current element.
@return mixed | [
"Returns",
"the",
"current",
"element",
"."
] | train | https://github.com/JoffreyPoreeCoding/MongoDB-ODM/blob/56fd7ab28c22f276573a89d56bb93c8d74ad7f74/src/Iterator/GridFSDocumentIterator.php#L19-L23 |
JoffreyPoreeCoding/MongoDB-ODM | src/Iterator/GridFSDocumentIterator.php | GridFSDocumentIterator.next | public function next()
{
$this->position++;
$this->generator->next();
$this->currentData = $this->generator->current();
} | php | public function next()
{
$this->position++;
$this->generator->next();
$this->currentData = $this->generator->current();
} | [
"public",
"function",
"next",
"(",
")",
"{",
"$",
"this",
"->",
"position",
"++",
";",
"$",
"this",
"->",
"generator",
"->",
"next",
"(",
")",
";",
"$",
"this",
"->",
"currentData",
"=",
"$",
"this",
"->",
"generator",
"->",
"current",
"(",
")",
";... | Moves forward to next element.
@return void | [
"Moves",
"forward",
"to",
"next",
"element",
"."
] | train | https://github.com/JoffreyPoreeCoding/MongoDB-ODM/blob/56fd7ab28c22f276573a89d56bb93c8d74ad7f74/src/Iterator/GridFSDocumentIterator.php#L30-L35 |
sulu/SuluSalesShippingBundle | src/Sulu/Bundle/Sales/CoreBundle/Item/ItemManager.php | ItemManager.save | public function save(array $data, $locale, $userId = null, $item = null, $itemStatusId = null)
{
$itemEntity = $this->itemFactory->createEntity();
$isNewItem = !$item;
// check required data
if ($isNewItem) {
$this->checkRequiredData($data, true);
$item = $th... | php | public function save(array $data, $locale, $userId = null, $item = null, $itemStatusId = null)
{
$itemEntity = $this->itemFactory->createEntity();
$isNewItem = !$item;
// check required data
if ($isNewItem) {
$this->checkRequiredData($data, true);
$item = $th... | [
"public",
"function",
"save",
"(",
"array",
"$",
"data",
",",
"$",
"locale",
",",
"$",
"userId",
"=",
"null",
",",
"$",
"item",
"=",
"null",
",",
"$",
"itemStatusId",
"=",
"null",
")",
"{",
"$",
"itemEntity",
"=",
"$",
"this",
"->",
"itemFactory",
... | Creates an item, but does not flush
@param array $data
@param string $locale
@param int|null $userId
@param ApiItemInterface|ItemInterface|null $item
@param int|null $itemStatusId
@return ApiItemInterface|null | [
"Creates",
"an",
"item",
"but",
"does",
"not",
"flush"
] | train | https://github.com/sulu/SuluSalesShippingBundle/blob/0d39de262d58579e5679db99a77dbf717d600b5e/src/Sulu/Bundle/Sales/CoreBundle/Item/ItemManager.php#L145-L239 |
sulu/SuluSalesShippingBundle | src/Sulu/Bundle/Sales/CoreBundle/Item/ItemManager.php | ItemManager.removeStatus | public function removeStatus(ApiItemInterface $item, $status, $flush = false)
{
// BITMASK
$currentBitmaskStatus = $item->getBitmaskStatus();
// if status is in bitmask, remove it
if ($currentBitmaskStatus && $currentBitmaskStatus & $status) {
$item->setBitmaskStatus($cur... | php | public function removeStatus(ApiItemInterface $item, $status, $flush = false)
{
// BITMASK
$currentBitmaskStatus = $item->getBitmaskStatus();
// if status is in bitmask, remove it
if ($currentBitmaskStatus && $currentBitmaskStatus & $status) {
$item->setBitmaskStatus($cur... | [
"public",
"function",
"removeStatus",
"(",
"ApiItemInterface",
"$",
"item",
",",
"$",
"status",
",",
"$",
"flush",
"=",
"false",
")",
"{",
"// BITMASK",
"$",
"currentBitmaskStatus",
"=",
"$",
"item",
"->",
"getBitmaskStatus",
"(",
")",
";",
"// if status is in... | Converts status of an item
@param ApiItemInterface $item
@param int $status
@param bool $flush | [
"Converts",
"status",
"of",
"an",
"item"
] | train | https://github.com/sulu/SuluSalesShippingBundle/blob/0d39de262d58579e5679db99a77dbf717d600b5e/src/Sulu/Bundle/Sales/CoreBundle/Item/ItemManager.php#L271-L283 |
sulu/SuluSalesShippingBundle | src/Sulu/Bundle/Sales/CoreBundle/Item/ItemManager.php | ItemManager.findByIdAndLocale | public function findByIdAndLocale($id, $locale)
{
$item = $this->itemRepository->findByIdAndLocale($id, $locale);
if ($item) {
return $this->itemFactory->createApiEntity($item, $locale);
} else {
return null;
}
} | php | public function findByIdAndLocale($id, $locale)
{
$item = $this->itemRepository->findByIdAndLocale($id, $locale);
if ($item) {
return $this->itemFactory->createApiEntity($item, $locale);
} else {
return null;
}
} | [
"public",
"function",
"findByIdAndLocale",
"(",
"$",
"id",
",",
"$",
"locale",
")",
"{",
"$",
"item",
"=",
"$",
"this",
"->",
"itemRepository",
"->",
"findByIdAndLocale",
"(",
"$",
"id",
",",
"$",
"locale",
")",
";",
"if",
"(",
"$",
"item",
")",
"{",... | Finds an item by id and locale
@param int $id
@param string $locale
@return null|ApiItemInterface | [
"Finds",
"an",
"item",
"by",
"id",
"and",
"locale"
] | train | https://github.com/sulu/SuluSalesShippingBundle/blob/0d39de262d58579e5679db99a77dbf717d600b5e/src/Sulu/Bundle/Sales/CoreBundle/Item/ItemManager.php#L312-L321 |
sulu/SuluSalesShippingBundle | src/Sulu/Bundle/Sales/CoreBundle/Item/ItemManager.php | ItemManager.findAllByLocale | public function findAllByLocale($locale, $filter = array())
{
if (empty($filter)) {
$items = $this->itemRepository->findAllByLocale($locale);
} else {
$items = $this->itemRepository->findByLocaleAndFilter($locale, $filter);
}
array_walk(
$items,
... | php | public function findAllByLocale($locale, $filter = array())
{
if (empty($filter)) {
$items = $this->itemRepository->findAllByLocale($locale);
} else {
$items = $this->itemRepository->findByLocaleAndFilter($locale, $filter);
}
array_walk(
$items,
... | [
"public",
"function",
"findAllByLocale",
"(",
"$",
"locale",
",",
"$",
"filter",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"filter",
")",
")",
"{",
"$",
"items",
"=",
"$",
"this",
"->",
"itemRepository",
"->",
"findAllByLocale",
... | @param string $locale
@param array $filter
@return array | [
"@param",
"string",
"$locale",
"@param",
"array",
"$filter"
] | train | https://github.com/sulu/SuluSalesShippingBundle/blob/0d39de262d58579e5679db99a77dbf717d600b5e/src/Sulu/Bundle/Sales/CoreBundle/Item/ItemManager.php#L346-L362 |
sulu/SuluSalesShippingBundle | src/Sulu/Bundle/Sales/CoreBundle/Item/ItemManager.php | ItemManager.setItemByProductData | protected function setItemByProductData($productData, ApiItemInterface $item, $locale)
{
$productId = $this->getProductId($productData);
/** @var Product $product */
$product = $this->productRepository->find($productId);
if (!$product) {
throw new ProductNotFoundExceptio... | php | protected function setItemByProductData($productData, ApiItemInterface $item, $locale)
{
$productId = $this->getProductId($productData);
/** @var Product $product */
$product = $this->productRepository->find($productId);
if (!$product) {
throw new ProductNotFoundExceptio... | [
"protected",
"function",
"setItemByProductData",
"(",
"$",
"productData",
",",
"ApiItemInterface",
"$",
"item",
",",
"$",
"locale",
")",
"{",
"$",
"productId",
"=",
"$",
"this",
"->",
"getProductId",
"(",
"$",
"productData",
")",
";",
"/** @var Product $product ... | Sets item based on given product data
@param array $productData
@param ApiItemInterface $item
@param string $locale
@throws MissingItemAttributeException
@throws ProductException
@throws ProductNotFoundException
@return ProductInterface | [
"Sets",
"item",
"based",
"on",
"given",
"product",
"data"
] | train | https://github.com/sulu/SuluSalesShippingBundle/blob/0d39de262d58579e5679db99a77dbf717d600b5e/src/Sulu/Bundle/Sales/CoreBundle/Item/ItemManager.php#L510-L548 |
sulu/SuluSalesShippingBundle | src/Sulu/Bundle/Sales/CoreBundle/Item/ItemManager.php | ItemManager.setItemSupplier | protected function setItemSupplier($item, $product)
{
// get products supplier
if ($product->getSupplier()) {
$item->setSupplier($product->getSupplier());
$item->setSupplierName($product->getSupplier()->getName());
} else {
$item->setSupplier(null);
... | php | protected function setItemSupplier($item, $product)
{
// get products supplier
if ($product->getSupplier()) {
$item->setSupplier($product->getSupplier());
$item->setSupplierName($product->getSupplier()->getName());
} else {
$item->setSupplier(null);
... | [
"protected",
"function",
"setItemSupplier",
"(",
"$",
"item",
",",
"$",
"product",
")",
"{",
"// get products supplier",
"if",
"(",
"$",
"product",
"->",
"getSupplier",
"(",
")",
")",
"{",
"$",
"item",
"->",
"setSupplier",
"(",
"$",
"product",
"->",
"getSu... | Set supplier of an item
@param $item
@param $product | [
"Set",
"supplier",
"of",
"an",
"item"
] | train | https://github.com/sulu/SuluSalesShippingBundle/blob/0d39de262d58579e5679db99a77dbf717d600b5e/src/Sulu/Bundle/Sales/CoreBundle/Item/ItemManager.php#L556-L566 |
sulu/SuluSalesShippingBundle | src/Sulu/Bundle/Sales/CoreBundle/Item/ItemManager.php | ItemManager.updatePrices | private function updatePrices(ApiItemInterface $item, $data)
{
//TODO: currency
$currency = null;
// set products price by data
if ($item->getUseProductsPrice() === false) {
$item->setPrice($this->getProperty($data, 'price', $item->getPrice()));
}
// set... | php | private function updatePrices(ApiItemInterface $item, $data)
{
//TODO: currency
$currency = null;
// set products price by data
if ($item->getUseProductsPrice() === false) {
$item->setPrice($this->getProperty($data, 'price', $item->getPrice()));
}
// set... | [
"private",
"function",
"updatePrices",
"(",
"ApiItemInterface",
"$",
"item",
",",
"$",
"data",
")",
"{",
"//TODO: currency",
"$",
"currency",
"=",
"null",
";",
"// set products price by data",
"if",
"(",
"$",
"item",
"->",
"getUseProductsPrice",
"(",
")",
"===",... | Function updates item prices its product data
@param ApiItemInterface $item
@param array $data | [
"Function",
"updates",
"item",
"prices",
"its",
"product",
"data"
] | train | https://github.com/sulu/SuluSalesShippingBundle/blob/0d39de262d58579e5679db99a77dbf717d600b5e/src/Sulu/Bundle/Sales/CoreBundle/Item/ItemManager.php#L574-L591 |
dantleech/glob | lib/DTL/Glob/Finder/PhpcrTraversalFinder.php | PhpcrTraversalFinder.getNode | protected function getNode(array $pathSegments)
{
$absPath = '/' . implode('/', $pathSegments);
try {
return $this->session->getNode($absPath);
} catch (\PHPCR\PathNotFoundException $e) {
return null;
}
} | php | protected function getNode(array $pathSegments)
{
$absPath = '/' . implode('/', $pathSegments);
try {
return $this->session->getNode($absPath);
} catch (\PHPCR\PathNotFoundException $e) {
return null;
}
} | [
"protected",
"function",
"getNode",
"(",
"array",
"$",
"pathSegments",
")",
"{",
"$",
"absPath",
"=",
"'/'",
".",
"implode",
"(",
"'/'",
",",
"$",
"pathSegments",
")",
";",
"try",
"{",
"return",
"$",
"this",
"->",
"session",
"->",
"getNode",
"(",
"$",
... | {@inheritDoc} | [
"{"
] | train | https://github.com/dantleech/glob/blob/1f618e6b77a5de4c6b0538d82572fe19cbb1c446/lib/DTL/Glob/Finder/PhpcrTraversalFinder.php#L44-L53 |
refinery29/piston | src/Middleware/Request/Pagination/PagedPagination.php | PagedPagination.coerceToInteger | private function coerceToInteger($param, $param_name)
{
if (\is_numeric($param)) {
$integer_value = (int) $param;
if ($integer_value == (float) $param) {
return $integer_value;
}
}
throw new BadRequestException('Parameter "' . $param_name... | php | private function coerceToInteger($param, $param_name)
{
if (\is_numeric($param)) {
$integer_value = (int) $param;
if ($integer_value == (float) $param) {
return $integer_value;
}
}
throw new BadRequestException('Parameter "' . $param_name... | [
"private",
"function",
"coerceToInteger",
"(",
"$",
"param",
",",
"$",
"param_name",
")",
"{",
"if",
"(",
"\\",
"is_numeric",
"(",
"$",
"param",
")",
")",
"{",
"$",
"integer_value",
"=",
"(",
"int",
")",
"$",
"param",
";",
"if",
"(",
"$",
"integer_va... | @param mixed $param
@param string $param_name
@throws BadRequestException
@return int | [
"@param",
"mixed",
"$param",
"@param",
"string",
"$param_name"
] | train | https://github.com/refinery29/piston/blob/75c402e814136577fa9a02479e8803aca664c865/src/Middleware/Request/Pagination/PagedPagination.php#L80-L91 |
sulu/SuluSalesShippingBundle | src/Sulu/Bundle/Sales/ShippingBundle/Widgets/FlowOfDocuments.php | FlowOfDocuments.getData | public function getData($options)
{
if ($this->checkRequiredParameters($options)) {
$this->getOrderData($options);
$this->getShipppingData($options);
parent::orderDataByDate(false);
return parent::serializeData();
} else {
throw new Widget... | php | public function getData($options)
{
if ($this->checkRequiredParameters($options)) {
$this->getOrderData($options);
$this->getShipppingData($options);
parent::orderDataByDate(false);
return parent::serializeData();
} else {
throw new Widget... | [
"public",
"function",
"getData",
"(",
"$",
"options",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"checkRequiredParameters",
"(",
"$",
"options",
")",
")",
"{",
"$",
"this",
"->",
"getOrderData",
"(",
"$",
"options",
")",
";",
"$",
"this",
"->",
"getShippp... | returns data to render template
@param array $options
@throws WidgetException
@return array | [
"returns",
"data",
"to",
"render",
"template"
] | train | https://github.com/sulu/SuluSalesShippingBundle/blob/0d39de262d58579e5679db99a77dbf717d600b5e/src/Sulu/Bundle/Sales/ShippingBundle/Widgets/FlowOfDocuments.php#L50-L61 |
sulu/SuluSalesShippingBundle | src/Sulu/Bundle/Sales/ShippingBundle/Widgets/FlowOfDocuments.php | FlowOfDocuments.getOrderData | protected function getOrderData($options)
{
parent::addEntry(
$options['orderId'],
$options['orderNumber'],
'order',
new DateTime($options['orderDate']),
parent::getRoute($options['orderId'], 'order', 'details'),
parent::getRoute($optio... | php | protected function getOrderData($options)
{
parent::addEntry(
$options['orderId'],
$options['orderNumber'],
'order',
new DateTime($options['orderDate']),
parent::getRoute($options['orderId'], 'order', 'details'),
parent::getRoute($optio... | [
"protected",
"function",
"getOrderData",
"(",
"$",
"options",
")",
"{",
"parent",
"::",
"addEntry",
"(",
"$",
"options",
"[",
"'orderId'",
"]",
",",
"$",
"options",
"[",
"'orderNumber'",
"]",
",",
"'order'",
",",
"new",
"DateTime",
"(",
"$",
"options",
"... | Retrieves order data
@param $options
@throws \Sulu\Bundle\AdminBundle\Widgets\WidgetParameterException | [
"Retrieves",
"order",
"data"
] | train | https://github.com/sulu/SuluSalesShippingBundle/blob/0d39de262d58579e5679db99a77dbf717d600b5e/src/Sulu/Bundle/Sales/ShippingBundle/Widgets/FlowOfDocuments.php#L69-L79 |
sulu/SuluSalesShippingBundle | src/Sulu/Bundle/Sales/ShippingBundle/Widgets/FlowOfDocuments.php | FlowOfDocuments.getShipppingData | protected function getShipppingData($options)
{
parent::addEntry(
$options['id'],
$options['number'],
'shipping',
new DateTime($options['date']),
parent::getRoute($options['id'], 'shipping', 'details'),
Shipping::$pdfBaseUrl
);
... | php | protected function getShipppingData($options)
{
parent::addEntry(
$options['id'],
$options['number'],
'shipping',
new DateTime($options['date']),
parent::getRoute($options['id'], 'shipping', 'details'),
Shipping::$pdfBaseUrl
);
... | [
"protected",
"function",
"getShipppingData",
"(",
"$",
"options",
")",
"{",
"parent",
"::",
"addEntry",
"(",
"$",
"options",
"[",
"'id'",
"]",
",",
"$",
"options",
"[",
"'number'",
"]",
",",
"'shipping'",
",",
"new",
"DateTime",
"(",
"$",
"options",
"[",... | Retrieves order data
@param $options
@throws \Sulu\Bundle\AdminBundle\Widgets\WidgetParameterException | [
"Retrieves",
"order",
"data"
] | train | https://github.com/sulu/SuluSalesShippingBundle/blob/0d39de262d58579e5679db99a77dbf717d600b5e/src/Sulu/Bundle/Sales/ShippingBundle/Widgets/FlowOfDocuments.php#L87-L97 |
acasademont/wurfl | WURFL/Handlers/Utils.php | WURFL_Handlers_Utils.risMatch | public static function risMatch($collection, $needle, $tolerance)
{
return WURFL_Handlers_Matcher_RISMatcher::INSTANCE()->match($collection, $needle, $tolerance);
} | php | public static function risMatch($collection, $needle, $tolerance)
{
return WURFL_Handlers_Matcher_RISMatcher::INSTANCE()->match($collection, $needle, $tolerance);
} | [
"public",
"static",
"function",
"risMatch",
"(",
"$",
"collection",
",",
"$",
"needle",
",",
"$",
"tolerance",
")",
"{",
"return",
"WURFL_Handlers_Matcher_RISMatcher",
"::",
"INSTANCE",
"(",
")",
"->",
"match",
"(",
"$",
"collection",
",",
"$",
"needle",
","... | Alias of WURFL_Handlers_Matcher_RISMatcher::match()
@param array $collection
@param string $needle
@param int $tolerance
@return string Matched user agent
@see WURFL_Handlers_Matcher_RISMatcher::match() | [
"Alias",
"of",
"WURFL_Handlers_Matcher_RISMatcher",
"::",
"match",
"()"
] | train | https://github.com/acasademont/wurfl/blob/0f4fb6e06b452ba95ad1d15e7d8226d0974b60c2/WURFL/Handlers/Utils.php#L149-L152 |
acasademont/wurfl | WURFL/Handlers/Utils.php | WURFL_Handlers_Utils.ldMatch | public static function ldMatch($collection, $needle, $tolerance = 7)
{
return WURFL_Handlers_Matcher_LDMatcher::INSTANCE()->match($collection, $needle, $tolerance);
} | php | public static function ldMatch($collection, $needle, $tolerance = 7)
{
return WURFL_Handlers_Matcher_LDMatcher::INSTANCE()->match($collection, $needle, $tolerance);
} | [
"public",
"static",
"function",
"ldMatch",
"(",
"$",
"collection",
",",
"$",
"needle",
",",
"$",
"tolerance",
"=",
"7",
")",
"{",
"return",
"WURFL_Handlers_Matcher_LDMatcher",
"::",
"INSTANCE",
"(",
")",
"->",
"match",
"(",
"$",
"collection",
",",
"$",
"ne... | Alias of WURFL_Handlers_Matcher_LDMatcher::match()
@param array $collection
@param string $needle
@param int $tolerance
@return string Matched user agent
@see WURFL_Handlers_Matcher_LDMatcher::match() | [
"Alias",
"of",
"WURFL_Handlers_Matcher_LDMatcher",
"::",
"match",
"()"
] | train | https://github.com/acasademont/wurfl/blob/0f4fb6e06b452ba95ad1d15e7d8226d0974b60c2/WURFL/Handlers/Utils.php#L162-L165 |
acasademont/wurfl | WURFL/Handlers/Utils.php | WURFL_Handlers_Utils.indexOfAnyOrLength | public static function indexOfAnyOrLength($userAgent, $needles = array(), $startingIndex=0)
{
if (count($needles) === 0) {
return strlen($userAgent);
}
$min = strlen($userAgent);
foreach ($needles as $needle) {
$index = WURFL_Handlers_Utils::indexOfOr... | php | public static function indexOfAnyOrLength($userAgent, $needles = array(), $startingIndex=0)
{
if (count($needles) === 0) {
return strlen($userAgent);
}
$min = strlen($userAgent);
foreach ($needles as $needle) {
$index = WURFL_Handlers_Utils::indexOfOr... | [
"public",
"static",
"function",
"indexOfAnyOrLength",
"(",
"$",
"userAgent",
",",
"$",
"needles",
"=",
"array",
"(",
")",
",",
"$",
"startingIndex",
"=",
"0",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"needles",
")",
"===",
"0",
")",
"{",
"return",
"st... | Lowest char index of the first instance of any of the $needles found in $userAgent, starting at $startIndex;
if no match is found, the length of the string is returned
@param string $userAgent haystack
@param array $needles Array of (string)needles to search for in $userAgent
@param int $startingIndex Char index for st... | [
"Lowest",
"char",
"index",
"of",
"the",
"first",
"instance",
"of",
"any",
"of",
"the",
"$needles",
"found",
"in",
"$userAgent",
"starting",
"at",
"$startIndex",
";",
"if",
"no",
"match",
"is",
"found",
"the",
"length",
"of",
"the",
"string",
"is",
"returne... | train | https://github.com/acasademont/wurfl/blob/0f4fb6e06b452ba95ad1d15e7d8226d0974b60c2/WURFL/Handlers/Utils.php#L195-L210 |
acasademont/wurfl | WURFL/Handlers/Utils.php | WURFL_Handlers_Utils.reset | public static function reset()
{
self::$_is_desktop_browser = null;
self::$_is_mobile_browser = null;
self::$_is_smarttv = null;
self::$_is_robot = null;
} | php | public static function reset()
{
self::$_is_desktop_browser = null;
self::$_is_mobile_browser = null;
self::$_is_smarttv = null;
self::$_is_robot = null;
} | [
"public",
"static",
"function",
"reset",
"(",
")",
"{",
"self",
"::",
"$",
"_is_desktop_browser",
"=",
"null",
";",
"self",
"::",
"$",
"_is_mobile_browser",
"=",
"null",
";",
"self",
"::",
"$",
"_is_smarttv",
"=",
"null",
";",
"self",
"::",
"$",
"_is_rob... | Resets cached detection variables for performance | [
"Resets",
"cached",
"detection",
"variables",
"for",
"performance"
] | train | https://github.com/acasademont/wurfl/blob/0f4fb6e06b452ba95ad1d15e7d8226d0974b60c2/WURFL/Handlers/Utils.php#L215-L221 |
acasademont/wurfl | WURFL/Handlers/Utils.php | WURFL_Handlers_Utils.isMobileBrowser | public static function isMobileBrowser($userAgent)
{
if (self::$_is_mobile_browser !== null) {
return self::$_is_mobile_browser;
}
self::$_is_mobile_browser = false;
$userAgent = strtolower($userAgent);
foreach (self::$mobileBrowsers as $key) {
if (str... | php | public static function isMobileBrowser($userAgent)
{
if (self::$_is_mobile_browser !== null) {
return self::$_is_mobile_browser;
}
self::$_is_mobile_browser = false;
$userAgent = strtolower($userAgent);
foreach (self::$mobileBrowsers as $key) {
if (str... | [
"public",
"static",
"function",
"isMobileBrowser",
"(",
"$",
"userAgent",
")",
"{",
"if",
"(",
"self",
"::",
"$",
"_is_mobile_browser",
"!==",
"null",
")",
"{",
"return",
"self",
"::",
"$",
"_is_mobile_browser",
";",
"}",
"self",
"::",
"$",
"_is_mobile_brows... | Returns true if the give $userAgent is from a mobile device
@param string $userAgent
@return bool | [
"Returns",
"true",
"if",
"the",
"give",
"$userAgent",
"is",
"from",
"a",
"mobile",
"device"
] | train | https://github.com/acasademont/wurfl/blob/0f4fb6e06b452ba95ad1d15e7d8226d0974b60c2/WURFL/Handlers/Utils.php#L228-L242 |
acasademont/wurfl | WURFL/Handlers/Utils.php | WURFL_Handlers_Utils.ordinalIndexOf | public static function ordinalIndexOf($haystack, $needle, $ordinal)
{
if (is_null($haystack) || empty($haystack)) {
throw new InvalidArgumentException("haystack must not be null or empty");
}
if (! is_integer($ordinal)) {
throw new InvalidArgumentException("o... | php | public static function ordinalIndexOf($haystack, $needle, $ordinal)
{
if (is_null($haystack) || empty($haystack)) {
throw new InvalidArgumentException("haystack must not be null or empty");
}
if (! is_integer($ordinal)) {
throw new InvalidArgumentException("o... | [
"public",
"static",
"function",
"ordinalIndexOf",
"(",
"$",
"haystack",
",",
"$",
"needle",
",",
"$",
"ordinal",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"haystack",
")",
"||",
"empty",
"(",
"$",
"haystack",
")",
")",
"{",
"throw",
"new",
"InvalidArgu... | The nth($ordinal) occurance of $needle in $haystack or -1 if no match is found
@param string $haystack
@param string $needle
@param int $ordinal
@throws InvalidArgumentException
@return int Char index of occurance | [
"The",
"nth",
"(",
"$ordinal",
")",
"occurance",
"of",
"$needle",
"in",
"$haystack",
"or",
"-",
"1",
"if",
"no",
"match",
"is",
"found"
] | train | https://github.com/acasademont/wurfl/blob/0f4fb6e06b452ba95ad1d15e7d8226d0974b60c2/WURFL/Handlers/Utils.php#L407-L429 |
acasademont/wurfl | WURFL/Handlers/Utils.php | WURFL_Handlers_Utils.toleranceToRisDelimeter | public static function toleranceToRisDelimeter($userAgent)
{
$tolerance = strpos($userAgent, WURFL_Constants::RIS_DELIMITER);
if ($tolerance === false) {
return false;
}
// Push the tolerance to the *end* of the RIS Delimiter
return $tolerance + strlen(WURFL_Const... | php | public static function toleranceToRisDelimeter($userAgent)
{
$tolerance = strpos($userAgent, WURFL_Constants::RIS_DELIMITER);
if ($tolerance === false) {
return false;
}
// Push the tolerance to the *end* of the RIS Delimiter
return $tolerance + strlen(WURFL_Const... | [
"public",
"static",
"function",
"toleranceToRisDelimeter",
"(",
"$",
"userAgent",
")",
"{",
"$",
"tolerance",
"=",
"strpos",
"(",
"$",
"userAgent",
",",
"WURFL_Constants",
"::",
"RIS_DELIMITER",
")",
";",
"if",
"(",
"$",
"tolerance",
"===",
"false",
")",
"{"... | Returns the string position of the end of the RIS delimiter, or false if there is no RIS delimiter
@param string $userAgent
@return int|bool | [
"Returns",
"the",
"string",
"position",
"of",
"the",
"end",
"of",
"the",
"RIS",
"delimiter",
"or",
"false",
"if",
"there",
"is",
"no",
"RIS",
"delimiter"
] | train | https://github.com/acasademont/wurfl/blob/0f4fb6e06b452ba95ad1d15e7d8226d0974b60c2/WURFL/Handlers/Utils.php#L613-L621 |
acasademont/wurfl | WURFL/Handlers/Utils.php | WURFL_Handlers_Utils.findCharPosition | public static function findCharPosition($string, $char, $start_at = 0)
{
$position = strpos($string, $char, $start_at);
return ($position !== false) ? $position + 1 : null;
} | php | public static function findCharPosition($string, $char, $start_at = 0)
{
$position = strpos($string, $char, $start_at);
return ($position !== false) ? $position + 1 : null;
} | [
"public",
"static",
"function",
"findCharPosition",
"(",
"$",
"string",
",",
"$",
"char",
",",
"$",
"start_at",
"=",
"0",
")",
"{",
"$",
"position",
"=",
"strpos",
"(",
"$",
"string",
",",
"$",
"char",
",",
"$",
"start_at",
")",
";",
"return",
"(",
... | The character position in a string. If not present, returns null
@param $string
@param $char
@param $start_at
@return null|int | [
"The",
"character",
"position",
"in",
"a",
"string",
".",
"If",
"not",
"present",
"returns",
"null"
] | train | https://github.com/acasademont/wurfl/blob/0f4fb6e06b452ba95ad1d15e7d8226d0974b60c2/WURFL/Handlers/Utils.php#L640-L645 |
kiwiz/ecl | src/Statement/CommandList.php | CommandList.process | public function process(\ECL\SymbolTable $table) {
$results = [];
// Loop over every Command and process it.
for($i = 0; $i < count($this->commands); ++$i) {
$command = $this->commands[$i];
$curr_result = $command->process($table);
$table[\ECL\SymbolTable::DE... | php | public function process(\ECL\SymbolTable $table) {
$results = [];
// Loop over every Command and process it.
for($i = 0; $i < count($this->commands); ++$i) {
$command = $this->commands[$i];
$curr_result = $command->process($table);
$table[\ECL\SymbolTable::DE... | [
"public",
"function",
"process",
"(",
"\\",
"ECL",
"\\",
"SymbolTable",
"$",
"table",
")",
"{",
"$",
"results",
"=",
"[",
"]",
";",
"// Loop over every Command and process it.",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"$",
"i",
"<",
"count",
"(",
"$",
"th... | Process the list of Commands.
@param \ECL\SymbolTable $table The global SymbolTable.
@return \ECL\ResultSet[] The result from the last Command or an empty array. | [
"Process",
"the",
"list",
"of",
"Commands",
"."
] | train | https://github.com/kiwiz/ecl/blob/6536dd2a4c1905a08cf718bdbef56a22f0e9b488/src/Statement/CommandList.php#L25-L44 |
WellCommerce/CoreBundle | Provider/RouteProvider.php | RouteProvider.getRouteCollectionForRequest | public function getRouteCollectionForRequest(Request $request)
{
$collection = new RouteCollection();
$path = $this->getNormalizedPath($request);
$resource = $this->repository->findOneBy(['path' => $path]);
if ($resource) {
$route = $this->createRoute($re... | php | public function getRouteCollectionForRequest(Request $request)
{
$collection = new RouteCollection();
$path = $this->getNormalizedPath($request);
$resource = $this->repository->findOneBy(['path' => $path]);
if ($resource) {
$route = $this->createRoute($re... | [
"public",
"function",
"getRouteCollectionForRequest",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"collection",
"=",
"new",
"RouteCollection",
"(",
")",
";",
"$",
"path",
"=",
"$",
"this",
"->",
"getNormalizedPath",
"(",
"$",
"request",
")",
";",
"$",
"... | Returns route collection for current request
@param Request $request
@return RouteCollection | [
"Returns",
"route",
"collection",
"for",
"current",
"request"
] | train | https://github.com/WellCommerce/CoreBundle/blob/984fbd544d4b10cf11e54e0f3c304d100deb6842/Provider/RouteProvider.php#L63-L78 |
WellCommerce/CoreBundle | Provider/RouteProvider.php | RouteProvider.getRouteByName | public function getRouteByName($identifier)
{
$id = str_replace(self::DYNAMIC_PREFIX, '', $identifier);
$resource = $this->repository->find($id);
if ($resource instanceof Route) {
return $this->createRoute($resource);
}
return null;
} | php | public function getRouteByName($identifier)
{
$id = str_replace(self::DYNAMIC_PREFIX, '', $identifier);
$resource = $this->repository->find($id);
if ($resource instanceof Route) {
return $this->createRoute($resource);
}
return null;
} | [
"public",
"function",
"getRouteByName",
"(",
"$",
"identifier",
")",
"{",
"$",
"id",
"=",
"str_replace",
"(",
"self",
"::",
"DYNAMIC_PREFIX",
",",
"''",
",",
"$",
"identifier",
")",
";",
"$",
"resource",
"=",
"$",
"this",
"->",
"repository",
"->",
"find"... | Returns route by its identifier
@param string $identifier
@return SymfonyRoute | [
"Returns",
"route",
"by",
"its",
"identifier"
] | train | https://github.com/WellCommerce/CoreBundle/blob/984fbd544d4b10cf11e54e0f3c304d100deb6842/Provider/RouteProvider.php#L87-L97 |
WellCommerce/CoreBundle | Provider/RouteProvider.php | RouteProvider.getNormalizedPath | private function getNormalizedPath(Request $request)
{
$path = ltrim($request->getPathInfo(), '/');
$paths = explode(self::PATH_PARAMS_SEPARATOR, $path);
return current($paths);
} | php | private function getNormalizedPath(Request $request)
{
$path = ltrim($request->getPathInfo(), '/');
$paths = explode(self::PATH_PARAMS_SEPARATOR, $path);
return current($paths);
} | [
"private",
"function",
"getNormalizedPath",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"path",
"=",
"ltrim",
"(",
"$",
"request",
"->",
"getPathInfo",
"(",
")",
",",
"'/'",
")",
";",
"$",
"paths",
"=",
"explode",
"(",
"self",
"::",
"PATH_PARAMS_SEPAR... | Returns normalized path used in resource query
@param Request $request
@return mixed | [
"Returns",
"normalized",
"path",
"used",
"in",
"resource",
"query"
] | train | https://github.com/WellCommerce/CoreBundle/blob/984fbd544d4b10cf11e54e0f3c304d100deb6842/Provider/RouteProvider.php#L111-L117 |
youthweb/urllinker | src/UrlLinker.php | UrlLinker.linkUrlsAndEscapeHtml | public function linkUrlsAndEscapeHtml($text)
{
// We can abort if there is no . in $text
if ( strpos($text, '.') === false )
{
return $this->escapeHtml($text);
}
$html = '';
$position = 0;
$match = array();
while (preg_match($this->buildRegex(), $text, $match, PREG_OFFSET_CAPTURE, $position))
... | php | public function linkUrlsAndEscapeHtml($text)
{
// We can abort if there is no . in $text
if ( strpos($text, '.') === false )
{
return $this->escapeHtml($text);
}
$html = '';
$position = 0;
$match = array();
while (preg_match($this->buildRegex(), $text, $match, PREG_OFFSET_CAPTURE, $position))
... | [
"public",
"function",
"linkUrlsAndEscapeHtml",
"(",
"$",
"text",
")",
"{",
"// We can abort if there is no . in $text",
"if",
"(",
"strpos",
"(",
"$",
"text",
",",
"'.'",
")",
"===",
"false",
")",
"{",
"return",
"$",
"this",
"->",
"escapeHtml",
"(",
"$",
"te... | Transforms plain text into valid HTML, escaping special characters and
turning URLs into links.
@param string $text
@return string | [
"Transforms",
"plain",
"text",
"into",
"valid",
"HTML",
"escaping",
"special",
"characters",
"and",
"turning",
"URLs",
"into",
"links",
"."
] | train | https://github.com/youthweb/urllinker/blob/dbc377ea253b9fc6c137b85b342699b9f5db272a/src/UrlLinker.php#L232-L314 |
youthweb/urllinker | src/UrlLinker.php | UrlLinker.linkUrlsInTrustedHtml | public function linkUrlsInTrustedHtml($html)
{
$reMarkup = '{</?([a-z]+)([^"\'>]|"[^"]*"|\'[^\']*\')*>|&#?[a-zA-Z0-9]+;|$}';
$insideAnchorTag = false;
$position = 0;
$result = '';
// Iterate over every piece of markup in the HTML.
while (true)
{
$match = array();
preg_match($reMarkup, $html, $mat... | php | public function linkUrlsInTrustedHtml($html)
{
$reMarkup = '{</?([a-z]+)([^"\'>]|"[^"]*"|\'[^\']*\')*>|&#?[a-zA-Z0-9]+;|$}';
$insideAnchorTag = false;
$position = 0;
$result = '';
// Iterate over every piece of markup in the HTML.
while (true)
{
$match = array();
preg_match($reMarkup, $html, $mat... | [
"public",
"function",
"linkUrlsInTrustedHtml",
"(",
"$",
"html",
")",
"{",
"$",
"reMarkup",
"=",
"'{</?([a-z]+)([^\"\\'>]|\"[^\"]*\"|\\'[^\\']*\\')*>|&#?[a-zA-Z0-9]+;|$}'",
";",
"$",
"insideAnchorTag",
"=",
"false",
";",
"$",
"position",
"=",
"0",
";",
"$",
"result",
... | Turns URLs into links in a piece of valid HTML/XHTML.
Beware: Never render HTML from untrusted sources. Rendering HTML provided by
a malicious user can lead to system compromise through cross-site scripting.
@param string $html
@return string | [
"Turns",
"URLs",
"into",
"links",
"in",
"a",
"piece",
"of",
"valid",
"HTML",
"/",
"XHTML",
"."
] | train | https://github.com/youthweb/urllinker/blob/dbc377ea253b9fc6c137b85b342699b9f5db272a/src/UrlLinker.php#L325-L372 |
huasituo/hstcms | src/Libraries/HstcmsEncrypter.php | HstcmsEncrypter.decrypt | public function decrypt($payload, $unserialize = false)
{
$payload = $this->getJsonPayload($payload);
if(hst_message_verify($payload)) {
return $payload;
}
$iv = base64_decode($payload['iv']);
// Here we will decrypt the value. If we are able to successfully dec... | php | public function decrypt($payload, $unserialize = false)
{
$payload = $this->getJsonPayload($payload);
if(hst_message_verify($payload)) {
return $payload;
}
$iv = base64_decode($payload['iv']);
// Here we will decrypt the value. If we are able to successfully dec... | [
"public",
"function",
"decrypt",
"(",
"$",
"payload",
",",
"$",
"unserialize",
"=",
"false",
")",
"{",
"$",
"payload",
"=",
"$",
"this",
"->",
"getJsonPayload",
"(",
"$",
"payload",
")",
";",
"if",
"(",
"hst_message_verify",
"(",
"$",
"payload",
")",
"... | Decrypt the given value.
@param mixed $payload
@param bool $unserialize
@return string
@throws \Illuminate\Contracts\Encryption\DecryptException | [
"Decrypt",
"the",
"given",
"value",
"."
] | train | https://github.com/huasituo/hstcms/blob/12819979289e58ce38e3e92540aeeb16e205e525/src/Libraries/HstcmsEncrypter.php#L148-L172 |
huasituo/hstcms | src/Libraries/HstcmsEncrypter.php | HstcmsEncrypter.validPayload | public function validPayload($payload)
{
return is_array($payload) && isset($payload['iv'], $payload['value'], $payload['mac']) &&
strlen(base64_decode($payload['iv'], true)) === openssl_cipher_iv_length($this->cipher);
} | php | public function validPayload($payload)
{
return is_array($payload) && isset($payload['iv'], $payload['value'], $payload['mac']) &&
strlen(base64_decode($payload['iv'], true)) === openssl_cipher_iv_length($this->cipher);
} | [
"public",
"function",
"validPayload",
"(",
"$",
"payload",
")",
"{",
"return",
"is_array",
"(",
"$",
"payload",
")",
"&&",
"isset",
"(",
"$",
"payload",
"[",
"'iv'",
"]",
",",
"$",
"payload",
"[",
"'value'",
"]",
",",
"$",
"payload",
"[",
"'mac'",
"]... | Verify that the encryption payload is valid.
@param mixed $payload
@return bool | [
"Verify",
"that",
"the",
"encryption",
"payload",
"is",
"valid",
"."
] | train | https://github.com/huasituo/hstcms/blob/12819979289e58ce38e3e92540aeeb16e205e525/src/Libraries/HstcmsEncrypter.php#L231-L235 |
huasituo/hstcms | src/Libraries/HstcmsEncrypter.php | HstcmsEncrypter.validMac | public function validMac(array $payload)
{
$calculated = $this->calculateMac($payload, $bytes = self::randomString(16));
return hash_equals(
hash_hmac('sha256', $payload['mac'], $bytes, true), $calculated
);
} | php | public function validMac(array $payload)
{
$calculated = $this->calculateMac($payload, $bytes = self::randomString(16));
return hash_equals(
hash_hmac('sha256', $payload['mac'], $bytes, true), $calculated
);
} | [
"public",
"function",
"validMac",
"(",
"array",
"$",
"payload",
")",
"{",
"$",
"calculated",
"=",
"$",
"this",
"->",
"calculateMac",
"(",
"$",
"payload",
",",
"$",
"bytes",
"=",
"self",
"::",
"randomString",
"(",
"16",
")",
")",
";",
"return",
"hash_eq... | Determine if the MAC for the given payload is valid.
@param array $payload
@return bool | [
"Determine",
"if",
"the",
"MAC",
"for",
"the",
"given",
"payload",
"is",
"valid",
"."
] | train | https://github.com/huasituo/hstcms/blob/12819979289e58ce38e3e92540aeeb16e205e525/src/Libraries/HstcmsEncrypter.php#L243-L250 |
bestit/commercetools-order-export-bundle | src/Exporter.php | Exporter.exportOrder | private function exportOrder(Order $order, int $foundOrder)
{
$logger = $this->getLogger();
try {
$eventDispatcher = $this->getEventDispatcher();
$filesystem = $this->getFilesystem();
$event = $eventDispatcher->dispatch(
EventStore::PRE_ORDER_EXP... | php | private function exportOrder(Order $order, int $foundOrder)
{
$logger = $this->getLogger();
try {
$eventDispatcher = $this->getEventDispatcher();
$filesystem = $this->getFilesystem();
$event = $eventDispatcher->dispatch(
EventStore::PRE_ORDER_EXP... | [
"private",
"function",
"exportOrder",
"(",
"Order",
"$",
"order",
",",
"int",
"$",
"foundOrder",
")",
"{",
"$",
"logger",
"=",
"$",
"this",
"->",
"getLogger",
"(",
")",
";",
"try",
"{",
"$",
"eventDispatcher",
"=",
"$",
"this",
"->",
"getEventDispatcher"... | Exports the given order.
@param Order $order
@param int $foundOrder | [
"Exports",
"the",
"given",
"order",
"."
] | train | https://github.com/bestit/commercetools-order-export-bundle/blob/44bd0dedff6edab5ecf5803dcf6d24ffe0dbf845/src/Exporter.php#L89-L146 |
bestit/commercetools-order-export-bundle | src/Exporter.php | Exporter.exportOrders | public function exportOrders(OrderVisitor $orderVisitor, ProgressBar $bar): bool
{
$logger = $this->getLogger();
$bar->start($count = count($orderVisitor));
$logger->debug('Started the order export.', ['count' => $count]);
foreach ($orderVisitor() as $num => $order) {
... | php | public function exportOrders(OrderVisitor $orderVisitor, ProgressBar $bar): bool
{
$logger = $this->getLogger();
$bar->start($count = count($orderVisitor));
$logger->debug('Started the order export.', ['count' => $count]);
foreach ($orderVisitor() as $num => $order) {
... | [
"public",
"function",
"exportOrders",
"(",
"OrderVisitor",
"$",
"orderVisitor",
",",
"ProgressBar",
"$",
"bar",
")",
":",
"bool",
"{",
"$",
"logger",
"=",
"$",
"this",
"->",
"getLogger",
"(",
")",
";",
"$",
"bar",
"->",
"start",
"(",
"$",
"count",
"=",... | Exports the given orders.
@param OrderVisitor $orderVisitor
@param ProgressBar $bar
@return bool
@todo Add ErrorManagement | [
"Exports",
"the",
"given",
"orders",
"."
] | train | https://github.com/bestit/commercetools-order-export-bundle/blob/44bd0dedff6edab5ecf5803dcf6d24ffe0dbf845/src/Exporter.php#L155-L176 |
piqus/bfp4f-rcon | src/T4G/BFP4F/Rcon/Players.php | Players.fetch | public function fetch()
{
$data = Base::query('bf2cc pl');
$spl = explode("\r", $data);
$vars = 47; // Total Amount of Variables to parse for each Soldier
$chunks = array_chunk($spl, $vars);
$soldiers = array();
for ($i=0,$c=co... | php | public function fetch()
{
$data = Base::query('bf2cc pl');
$spl = explode("\r", $data);
$vars = 47; // Total Amount of Variables to parse for each Soldier
$chunks = array_chunk($spl, $vars);
$soldiers = array();
for ($i=0,$c=co... | [
"public",
"function",
"fetch",
"(",
")",
"{",
"$",
"data",
"=",
"Base",
"::",
"query",
"(",
"'bf2cc pl'",
")",
";",
"$",
"spl",
"=",
"explode",
"(",
"\"\\r\"",
",",
"$",
"data",
")",
";",
"$",
"vars",
"=",
"47",
";",
"// Total Amount of Variables to pa... | Fetches Player Info from Server
@return array | [
"Fetches",
"Player",
"Info",
"from",
"Server"
] | train | https://github.com/piqus/bfp4f-rcon/blob/8e94587bc93c686e5a025a54645aed7c701811e6/src/T4G/BFP4F/Rcon/Players.php#L26-L106 |
WellCommerce/CoreBundle | Form/DataTransformer/DataTransformerFactory.php | DataTransformerFactory.createRepositoryTransformer | public function createRepositoryTransformer(string $alias) : DataTransformerInterface
{
if (!$this->collection->has($alias)) {
throw new MissingFormDataTransformerException($alias);
}
$serviceId = $this->collection->get($alias);
return $this->get($serviceId);
} | php | public function createRepositoryTransformer(string $alias) : DataTransformerInterface
{
if (!$this->collection->has($alias)) {
throw new MissingFormDataTransformerException($alias);
}
$serviceId = $this->collection->get($alias);
return $this->get($serviceId);
} | [
"public",
"function",
"createRepositoryTransformer",
"(",
"string",
"$",
"alias",
")",
":",
"DataTransformerInterface",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"collection",
"->",
"has",
"(",
"$",
"alias",
")",
")",
"{",
"throw",
"new",
"MissingFormDataTransfo... | Creates and returns a new instance of form data transformer
@param string $alias
@return DataTransformerInterface | [
"Creates",
"and",
"returns",
"a",
"new",
"instance",
"of",
"form",
"data",
"transformer"
] | train | https://github.com/WellCommerce/CoreBundle/blob/984fbd544d4b10cf11e54e0f3c304d100deb6842/Form/DataTransformer/DataTransformerFactory.php#L47-L56 |
jamband/ripple | src/Ripple.php | Ripple.embed | public function embed(?string $url = null, ?string $id = null): ?string
{
$hasMultiple = function (string $url, string $pattern): bool {
return false !== strpos($url, $pattern);
};
if (isset($url, $id)) {
$ripple = new static($url);
if (null !== $ripple-... | php | public function embed(?string $url = null, ?string $id = null): ?string
{
$hasMultiple = function (string $url, string $pattern): bool {
return false !== strpos($url, $pattern);
};
if (isset($url, $id)) {
$ripple = new static($url);
if (null !== $ripple-... | [
"public",
"function",
"embed",
"(",
"?",
"string",
"$",
"url",
"=",
"null",
",",
"?",
"string",
"$",
"id",
"=",
"null",
")",
":",
"?",
"string",
"{",
"$",
"hasMultiple",
"=",
"function",
"(",
"string",
"$",
"url",
",",
"string",
"$",
"pattern",
")"... | Returns HTML embed of the track.
@param null|string $url
@param null|string $id
@return null|string | [
"Returns",
"HTML",
"embed",
"of",
"the",
"track",
"."
] | train | https://github.com/jamband/ripple/blob/91443f8016af76cacf749e05633abc1bdaf4675f/src/Ripple.php#L117-L146 |
flownative/flow-doubleoptin | Classes/Helper.php | Helper.generateToken | public function generateToken($identifier, $presetName = 'default', array $meta = [])
{
$preset = $this->getPreset($presetName);
$tokenHash = Algorithms::generateRandomToken($preset['tokenLength']);
$this->tokenCache->set(
$tokenHash,
[
'identifier' ... | php | public function generateToken($identifier, $presetName = 'default', array $meta = [])
{
$preset = $this->getPreset($presetName);
$tokenHash = Algorithms::generateRandomToken($preset['tokenLength']);
$this->tokenCache->set(
$tokenHash,
[
'identifier' ... | [
"public",
"function",
"generateToken",
"(",
"$",
"identifier",
",",
"$",
"presetName",
"=",
"'default'",
",",
"array",
"$",
"meta",
"=",
"[",
"]",
")",
"{",
"$",
"preset",
"=",
"$",
"this",
"->",
"getPreset",
"(",
"$",
"presetName",
")",
";",
"$",
"t... | Generate a Token and assign it the given $identifier.
A $presetName can be given to use a specific configuration preset. The given $meta data
will be stored with the Token and can be retrieved again when validation of the token
is done and was successful.
@param string $identifier
@param string $presetName
@param arr... | [
"Generate",
"a",
"Token",
"and",
"assign",
"it",
"the",
"given",
"$identifier",
"."
] | train | https://github.com/flownative/flow-doubleoptin/blob/18ae7e9b326118d5592816896b46ad840c67491c/Classes/Helper.php#L84-L105 |
flownative/flow-doubleoptin | Classes/Helper.php | Helper.validateTokenHash | public function validateTokenHash($tokenHash)
{
$tokenData = $this->tokenCache->get($tokenHash);
if ($tokenData === false) {
$this->logger->log(sprintf('Validation of token hash %s failed', $tokenHash), LOG_INFO);
return null;
}
$preset = $this->getPreset($... | php | public function validateTokenHash($tokenHash)
{
$tokenData = $this->tokenCache->get($tokenHash);
if ($tokenData === false) {
$this->logger->log(sprintf('Validation of token hash %s failed', $tokenHash), LOG_INFO);
return null;
}
$preset = $this->getPreset($... | [
"public",
"function",
"validateTokenHash",
"(",
"$",
"tokenHash",
")",
"{",
"$",
"tokenData",
"=",
"$",
"this",
"->",
"tokenCache",
"->",
"get",
"(",
"$",
"tokenHash",
")",
";",
"if",
"(",
"$",
"tokenData",
"===",
"false",
")",
"{",
"$",
"this",
"->",
... | This checks if a given hash is known and still valid before returning the associated Token.
If no valid Token is found for the hash, NULL is returned.
@param $tokenHash
@return Token
@throws UnknownPresetException | [
"This",
"checks",
"if",
"a",
"given",
"hash",
"is",
"known",
"and",
"still",
"valid",
"before",
"returning",
"the",
"associated",
"Token",
"."
] | train | https://github.com/flownative/flow-doubleoptin/blob/18ae7e9b326118d5592816896b46ad840c67491c/Classes/Helper.php#L116-L134 |
flownative/flow-doubleoptin | Classes/Helper.php | Helper.invalidateToken | public function invalidateToken(Token $token)
{
$this->tokenCache->remove($token->getHash());
$this->logger->log(sprintf('Deleted token %s.', $token->getIdentifier()), LOG_INFO);
} | php | public function invalidateToken(Token $token)
{
$this->tokenCache->remove($token->getHash());
$this->logger->log(sprintf('Deleted token %s.', $token->getIdentifier()), LOG_INFO);
} | [
"public",
"function",
"invalidateToken",
"(",
"Token",
"$",
"token",
")",
"{",
"$",
"this",
"->",
"tokenCache",
"->",
"remove",
"(",
"$",
"token",
"->",
"getHash",
"(",
")",
")",
";",
"$",
"this",
"->",
"logger",
"->",
"log",
"(",
"sprintf",
"(",
"'D... | Removes the given token from the token cache.
This is only necessary if the 'preserveToken' parameter of the token's preset is true.
Otherwise tokens are deleted automatically.
@param Token $token
@return void | [
"Removes",
"the",
"given",
"token",
"from",
"the",
"token",
"cache",
"."
] | train | https://github.com/flownative/flow-doubleoptin/blob/18ae7e9b326118d5592816896b46ad840c67491c/Classes/Helper.php#L145-L150 |
flownative/flow-doubleoptin | Classes/Helper.php | Helper.getActivationLink | public function getActivationLink(Token $token)
{
$activationConfiguration = $token->getPreset()['activation'];
$tokenHash = $token->getHash();
if ($activationConfiguration['uri'] === null) {
throw new \RuntimeException('Building activation link failed, no uri configuration is s... | php | public function getActivationLink(Token $token)
{
$activationConfiguration = $token->getPreset()['activation'];
$tokenHash = $token->getHash();
if ($activationConfiguration['uri'] === null) {
throw new \RuntimeException('Building activation link failed, no uri configuration is s... | [
"public",
"function",
"getActivationLink",
"(",
"Token",
"$",
"token",
")",
"{",
"$",
"activationConfiguration",
"=",
"$",
"token",
"->",
"getPreset",
"(",
")",
"[",
"'activation'",
"]",
";",
"$",
"tokenHash",
"=",
"$",
"token",
"->",
"getHash",
"(",
")",
... | For the given $token an activation link is returned.
@param Token $token
@return string | [
"For",
"the",
"given",
"$token",
"an",
"activation",
"link",
"is",
"returned",
"."
] | train | https://github.com/flownative/flow-doubleoptin/blob/18ae7e9b326118d5592816896b46ad840c67491c/Classes/Helper.php#L158-L188 |
flownative/flow-doubleoptin | Classes/Helper.php | Helper.sendActivationMail | public function sendActivationMail($recipientAddress, Token $token, array $additionalTemplateVariables = [])
{
$preset = $token->getPreset();
$activationLink = $this->getActivationLink($token);
$mail = new Message();
$mail->setFrom([$preset['mail']['from']['address'] => $preset['mai... | php | public function sendActivationMail($recipientAddress, Token $token, array $additionalTemplateVariables = [])
{
$preset = $token->getPreset();
$activationLink = $this->getActivationLink($token);
$mail = new Message();
$mail->setFrom([$preset['mail']['from']['address'] => $preset['mai... | [
"public",
"function",
"sendActivationMail",
"(",
"$",
"recipientAddress",
",",
"Token",
"$",
"token",
",",
"array",
"$",
"additionalTemplateVariables",
"=",
"[",
"]",
")",
"{",
"$",
"preset",
"=",
"$",
"token",
"->",
"getPreset",
"(",
")",
";",
"$",
"activ... | Sends an activation mail for $token to the given $recipientAddress.
The mail is built and sent according to the configuration given in the preset assigned to the $token.
@param string $recipientAddress
@param Token $token
@param array $additionalTemplateVariables
@return int | [
"Sends",
"an",
"activation",
"mail",
"for",
"$token",
"to",
"the",
"given",
"$recipientAddress",
"."
] | train | https://github.com/flownative/flow-doubleoptin/blob/18ae7e9b326118d5592816896b46ad840c67491c/Classes/Helper.php#L200-L228 |
flownative/flow-doubleoptin | Classes/Helper.php | Helper.getPreset | protected function getPreset($presetName)
{
if (!isset($this->presets[$presetName])) {
throw new UnknownPresetException(sprintf('Preset %s is not configured.', $presetName), 1434730924);
}
$default = $this->presets['default'];
$preset = $this->presets[$presetName];
... | php | protected function getPreset($presetName)
{
if (!isset($this->presets[$presetName])) {
throw new UnknownPresetException(sprintf('Preset %s is not configured.', $presetName), 1434730924);
}
$default = $this->presets['default'];
$preset = $this->presets[$presetName];
... | [
"protected",
"function",
"getPreset",
"(",
"$",
"presetName",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"presets",
"[",
"$",
"presetName",
"]",
")",
")",
"{",
"throw",
"new",
"UnknownPresetException",
"(",
"sprintf",
"(",
"'Preset %s is no... | Returns the preset with the given $presetName.
The preset is merged with the values of the 'default' preset before being returned.
@param string $presetName
@return array
@throws UnknownPresetException | [
"Returns",
"the",
"preset",
"with",
"the",
"given",
"$presetName",
"."
] | train | https://github.com/flownative/flow-doubleoptin/blob/18ae7e9b326118d5592816896b46ad840c67491c/Classes/Helper.php#L250-L260 |
huasituo/hstcms | src/Libraries/HstcmsFields.php | HstcmsFields.get | public function get($name)
{
if (!$name || strpos($name, '.') !== FALSE) {
return NULL;
}
$class = ucfirst($name);
$files = 'Huasituo\Hstcms\Libraries\Fields';
$fieldClass = $this->field_class($files, $class);
if(!class_exists($fieldClass)) {
return NULL;
}
if (is... | php | public function get($name)
{
if (!$name || strpos($name, '.') !== FALSE) {
return NULL;
}
$class = ucfirst($name);
$files = 'Huasituo\Hstcms\Libraries\Fields';
$fieldClass = $this->field_class($files, $class);
if(!class_exists($fieldClass)) {
return NULL;
}
if (is... | [
"public",
"function",
"get",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"!",
"$",
"name",
"||",
"strpos",
"(",
"$",
"name",
",",
"'.'",
")",
"!==",
"FALSE",
")",
"{",
"return",
"NULL",
";",
"}",
"$",
"class",
"=",
"ucfirst",
"(",
"$",
"name",
")",
... | 获取字段类别对象 **
@param string $name 字段类别名称
@param string $module 模块名称
@return object | [
"获取字段类别对象",
"**"
] | train | https://github.com/huasituo/hstcms/blob/12819979289e58ce38e3e92540aeeb16e205e525/src/Libraries/HstcmsFields.php#L30-L46 |
huasituo/hstcms | src/Libraries/HstcmsFields.php | HstcmsFields.option | public function option($name, $option = NULL, $fields = [])
{
return $name ? $this->get($name)->option($option, $fields) : NULL;
} | php | public function option($name, $option = NULL, $fields = [])
{
return $name ? $this->get($name)->option($option, $fields) : NULL;
} | [
"public",
"function",
"option",
"(",
"$",
"name",
",",
"$",
"option",
"=",
"NULL",
",",
"$",
"fields",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"name",
"?",
"$",
"this",
"->",
"get",
"(",
"$",
"name",
")",
"->",
"option",
"(",
"$",
"option",
","... | 自定义字段选项信息
@param string $name 字段类别名称
@param array $option 选项值
@return string | [
"自定义字段选项信息"
] | train | https://github.com/huasituo/hstcms/blob/12819979289e58ce38e3e92540aeeb16e205e525/src/Libraries/HstcmsFields.php#L55-L58 |
huasituo/hstcms | src/Libraries/HstcmsFields.php | HstcmsFields.type | public function type()
{
$file = new Filesystem();
$path = realpath(__DIR__.'/../Libraries/Fields');
$fields = $file->glob($path.'/*.php');
$data = [];
if($fields) {
foreach ($fields as $key => $value) {
$name = substr(basename($value), 0, -4);
if($name != 'FieldAbs') {
... | php | public function type()
{
$file = new Filesystem();
$path = realpath(__DIR__.'/../Libraries/Fields');
$fields = $file->glob($path.'/*.php');
$data = [];
if($fields) {
foreach ($fields as $key => $value) {
$name = substr(basename($value), 0, -4);
if($name != 'FieldAbs') {
... | [
"public",
"function",
"type",
"(",
")",
"{",
"$",
"file",
"=",
"new",
"Filesystem",
"(",
")",
";",
"$",
"path",
"=",
"realpath",
"(",
"__DIR__",
".",
"'/../Libraries/Fields'",
")",
";",
"$",
"fields",
"=",
"$",
"file",
"->",
"glob",
"(",
"$",
"path",... | 获取可用字段类别 **
@return array | [
"获取可用字段类别",
"**"
] | train | https://github.com/huasituo/hstcms/blob/12819979289e58ce38e3e92540aeeb16e205e525/src/Libraries/HstcmsFields.php#L66-L82 |
huasituo/hstcms | src/Libraries/HstcmsFields.php | HstcmsFields.validate_filter | public function validate_filter(Request $request, $_fields, $_data = [])
{
$postData = [];
$error = [];
$requestAll = $request->all();
foreach ($_fields as $field) {
if(!$this->isadmin && isset($field['setting']['option']['isfrontshow']) && !$field['setting']['option']['isfront... | php | public function validate_filter(Request $request, $_fields, $_data = [])
{
$postData = [];
$error = [];
$requestAll = $request->all();
foreach ($_fields as $field) {
if(!$this->isadmin && isset($field['setting']['option']['isfrontshow']) && !$field['setting']['option']['isfront... | [
"public",
"function",
"validate_filter",
"(",
"Request",
"$",
"request",
",",
"$",
"_fields",
",",
"$",
"_data",
"=",
"[",
"]",
")",
"{",
"$",
"postData",
"=",
"[",
"]",
";",
"$",
"error",
"=",
"[",
"]",
";",
"$",
"requestAll",
"=",
"$",
"request",... | 表单提交数据验证和过滤
@param array $request Request
@param array $_field 字段
@param array $_data 修改前的数据
@return array | [
"表单提交数据验证和过滤"
] | train | https://github.com/huasituo/hstcms/blob/12819979289e58ce38e3e92540aeeb16e205e525/src/Libraries/HstcmsFields.php#L158-L190 |
huasituo/hstcms | src/Libraries/HstcmsFields.php | HstcmsFields.field_format_value | public function field_format_value($fields, $data)
{
if (!$fields || !$data || !is_array($data)) {
return $data;
}
foreach ($fields as $field) {
$obj = $this->get($field['fieldtype']);
if (!$obj) {
continue;
}
if ($... | php | public function field_format_value($fields, $data)
{
if (!$fields || !$data || !is_array($data)) {
return $data;
}
foreach ($fields as $field) {
$obj = $this->get($field['fieldtype']);
if (!$obj) {
continue;
}
if ($... | [
"public",
"function",
"field_format_value",
"(",
"$",
"fields",
",",
"$",
"data",
")",
"{",
"if",
"(",
"!",
"$",
"fields",
"||",
"!",
"$",
"data",
"||",
"!",
"is_array",
"(",
"$",
"data",
")",
")",
"{",
"return",
"$",
"data",
";",
"}",
"foreach",
... | 字段输出格式化
@param array $fields 可用字段集
@param array $data 数据
@return string | [
"字段输出格式化"
] | train | https://github.com/huasituo/hstcms/blob/12819979289e58ce38e3e92540aeeb16e205e525/src/Libraries/HstcmsFields.php#L199-L215 |
huasituo/hstcms | src/Libraries/HstcmsFields.php | HstcmsFields.saveAttach | public function saveAttach($appid, Request $request, $fields = [])
{
foreach ($fields as $field) {
if($field['fieldtype'] === 'File') {
$v = $request->get($field['fieldname']);
if($v) {
AttachmentModel::where('aid', $v['aid'])->update([
... | php | public function saveAttach($appid, Request $request, $fields = [])
{
foreach ($fields as $field) {
if($field['fieldtype'] === 'File') {
$v = $request->get($field['fieldname']);
if($v) {
AttachmentModel::where('aid', $v['aid'])->update([
... | [
"public",
"function",
"saveAttach",
"(",
"$",
"appid",
",",
"Request",
"$",
"request",
",",
"$",
"fields",
"=",
"[",
"]",
")",
"{",
"foreach",
"(",
"$",
"fields",
"as",
"$",
"field",
")",
"{",
"if",
"(",
"$",
"field",
"[",
"'fieldtype'",
"]",
"==="... | 附件处理 | [
"附件处理"
] | train | https://github.com/huasituo/hstcms/blob/12819979289e58ce38e3e92540aeeb16e205e525/src/Libraries/HstcmsFields.php#L218-L243 |
movoin/one-swoole | src/Support/Container.php | Container.has | public function has($id): bool
{
return isset($this->alias[$id]) ||
isset($this->bindings[$id]) ||
isset($this->objects[$id]);
} | php | public function has($id): bool
{
return isset($this->alias[$id]) ||
isset($this->bindings[$id]) ||
isset($this->objects[$id]);
} | [
"public",
"function",
"has",
"(",
"$",
"id",
")",
":",
"bool",
"{",
"return",
"isset",
"(",
"$",
"this",
"->",
"alias",
"[",
"$",
"id",
"]",
")",
"||",
"isset",
"(",
"$",
"this",
"->",
"bindings",
"[",
"$",
"id",
"]",
")",
"||",
"isset",
"(",
... | 判断是否存在对象
@param string $id
@return bool | [
"判断是否存在对象"
] | train | https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/Support/Container.php#L50-L55 |
movoin/one-swoole | src/Support/Container.php | Container.get | public function get($id)
{
if ($this->has($id)) {
return $this->make($id);
}
throw new ContainerValueNotFoundException(sprintf(
'Identifier "%s" is not defined.',
$id
));
} | php | public function get($id)
{
if ($this->has($id)) {
return $this->make($id);
}
throw new ContainerValueNotFoundException(sprintf(
'Identifier "%s" is not defined.',
$id
));
} | [
"public",
"function",
"get",
"(",
"$",
"id",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"has",
"(",
"$",
"id",
")",
")",
"{",
"return",
"$",
"this",
"->",
"make",
"(",
"$",
"id",
")",
";",
"}",
"throw",
"new",
"ContainerValueNotFoundException",
"(",
... | 获得实例
@param string $id
@return object
@throws \One\Support\Exceptions\ContainerException
@throws \One\Support\Exceptions\ContainerValueNotFoundException | [
"获得实例"
] | train | https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/Support/Container.php#L66-L76 |
movoin/one-swoole | src/Support/Container.php | Container.bind | public function bind(string $id, $concrete = null)
{
if ($concrete === null) {
$concrete = $id;
}
if (! $concrete instanceof Closure) {
$concrete = function ($container, $parameters = []) use ($id, $concrete) {
if ($id === $concrete) {
... | php | public function bind(string $id, $concrete = null)
{
if ($concrete === null) {
$concrete = $id;
}
if (! $concrete instanceof Closure) {
$concrete = function ($container, $parameters = []) use ($id, $concrete) {
if ($id === $concrete) {
... | [
"public",
"function",
"bind",
"(",
"string",
"$",
"id",
",",
"$",
"concrete",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"concrete",
"===",
"null",
")",
"{",
"$",
"concrete",
"=",
"$",
"id",
";",
"}",
"if",
"(",
"!",
"$",
"concrete",
"instanceof",
"C... | 绑定对象申明过程,对象将在调用时实例化
@param string $id
@param mixed $concrete | [
"绑定对象申明过程,对象将在调用时实例化"
] | train | https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/Support/Container.php#L95-L111 |
movoin/one-swoole | src/Support/Container.php | Container.make | public function make(string $id, array $parameters = [], bool $createNew = false)
{
if (isset($this->alias[$id])) {
$id = $this->alias[$id];
}
if ($createNew || ! isset($this->objects[$id])) {
$concrete = isset($this->bindings[$id]) ?
$this->b... | php | public function make(string $id, array $parameters = [], bool $createNew = false)
{
if (isset($this->alias[$id])) {
$id = $this->alias[$id];
}
if ($createNew || ! isset($this->objects[$id])) {
$concrete = isset($this->bindings[$id]) ?
$this->b... | [
"public",
"function",
"make",
"(",
"string",
"$",
"id",
",",
"array",
"$",
"parameters",
"=",
"[",
"]",
",",
"bool",
"$",
"createNew",
"=",
"false",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"alias",
"[",
"$",
"id",
"]",
")",
")",
"... | 获得对象实例
@param string $id
@param array $parameters
@param bool $createNew
@return object
@throws \One\Support\Exceptions\ContainerException | [
"获得对象实例"
] | train | https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/Support/Container.php#L123-L138 |
movoin/one-swoole | src/Support/Container.php | Container.resolve | public function resolve($concrete, array $parameters = [])
{
if ($concrete instanceof Closure) {
return $concrete($this, $parameters);
}
try {
$instance = Reflection::newInstance($concrete, $parameters);
} catch (ReflectionException $e) {
throw ne... | php | public function resolve($concrete, array $parameters = [])
{
if ($concrete instanceof Closure) {
return $concrete($this, $parameters);
}
try {
$instance = Reflection::newInstance($concrete, $parameters);
} catch (ReflectionException $e) {
throw ne... | [
"public",
"function",
"resolve",
"(",
"$",
"concrete",
",",
"array",
"$",
"parameters",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"$",
"concrete",
"instanceof",
"Closure",
")",
"{",
"return",
"$",
"concrete",
"(",
"$",
"this",
",",
"$",
"parameters",
")",
... | 实例化对象
@param mixed $concrete
@param array $parameters
@return object
@throws \One\Support\Exceptions\ContainerException | [
"实例化对象"
] | train | https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/Support/Container.php#L149-L166 |
o2system/html | src/Element/Attributes.php | Attributes.addAttribute | public function addAttribute($name, $value)
{
if ($name === 'class') {
$this->addAttributeClass($value);
} elseif ($name === 'style') {
$value = rtrim($value, ';') . ';';
$value = explode(';', $value);
$value = array_filter($value);
foreac... | php | public function addAttribute($name, $value)
{
if ($name === 'class') {
$this->addAttributeClass($value);
} elseif ($name === 'style') {
$value = rtrim($value, ';') . ';';
$value = explode(';', $value);
$value = array_filter($value);
foreac... | [
"public",
"function",
"addAttribute",
"(",
"$",
"name",
",",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"name",
"===",
"'class'",
")",
"{",
"$",
"this",
"->",
"addAttributeClass",
"(",
"$",
"value",
")",
";",
"}",
"elseif",
"(",
"$",
"name",
"===",
"'... | Attributes::addAttribute
@param string $name
@param string $value
@return static | [
"Attributes",
"::",
"addAttribute"
] | train | https://github.com/o2system/html/blob/b7336fb45d42603ce1064b25572a05d495887670/src/Element/Attributes.php#L52-L75 |
o2system/html | src/Element/Attributes.php | Attributes.addAttributeClass | public function addAttributeClass($classes)
{
if (is_string($classes)) {
$classes = explode(',', $classes);
}
$classes = array_map('trim', $classes);
$classes = array_filter($classes);
if ( ! $this->offsetExists('class')) {
$this->storage[ 'class' ] ... | php | public function addAttributeClass($classes)
{
if (is_string($classes)) {
$classes = explode(',', $classes);
}
$classes = array_map('trim', $classes);
$classes = array_filter($classes);
if ( ! $this->offsetExists('class')) {
$this->storage[ 'class' ] ... | [
"public",
"function",
"addAttributeClass",
"(",
"$",
"classes",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"classes",
")",
")",
"{",
"$",
"classes",
"=",
"explode",
"(",
"','",
",",
"$",
"classes",
")",
";",
"}",
"$",
"classes",
"=",
"array_map",
"(... | Attributes::addAttributeClass
@param array|string $classes
@return static | [
"Attributes",
"::",
"addAttributeClass"
] | train | https://github.com/o2system/html/blob/b7336fb45d42603ce1064b25572a05d495887670/src/Element/Attributes.php#L86-L107 |
o2system/html | src/Element/Attributes.php | Attributes.removeAttributeClass | public function removeAttributeClass($classes)
{
if ($this->offsetExists('class')) {
if (is_string($classes)) {
$classes = explode(',', $classes);
}
$classes = array_map('trim', $classes);
$classes = array_filter($classes);
foreac... | php | public function removeAttributeClass($classes)
{
if ($this->offsetExists('class')) {
if (is_string($classes)) {
$classes = explode(',', $classes);
}
$classes = array_map('trim', $classes);
$classes = array_filter($classes);
foreac... | [
"public",
"function",
"removeAttributeClass",
"(",
"$",
"classes",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"offsetExists",
"(",
"'class'",
")",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"classes",
")",
")",
"{",
"$",
"classes",
"=",
"explode",
"(",
... | Attributes::removeAttributeClass
@param array|string $classes | [
"Attributes",
"::",
"removeAttributeClass"
] | train | https://github.com/o2system/html/blob/b7336fb45d42603ce1064b25572a05d495887670/src/Element/Attributes.php#L116-L143 |
o2system/html | src/Element/Attributes.php | Attributes.addAttributeStyle | public function addAttributeStyle($styles, $value = null)
{
if (is_string($styles)) {
$styles = [$styles => $value];
}
if ( ! $this->offsetExists('style')) {
$this->storage[ 'style' ] = [];
}
foreach ($styles as $key => $value) {
if (empt... | php | public function addAttributeStyle($styles, $value = null)
{
if (is_string($styles)) {
$styles = [$styles => $value];
}
if ( ! $this->offsetExists('style')) {
$this->storage[ 'style' ] = [];
}
foreach ($styles as $key => $value) {
if (empt... | [
"public",
"function",
"addAttributeStyle",
"(",
"$",
"styles",
",",
"$",
"value",
"=",
"null",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"styles",
")",
")",
"{",
"$",
"styles",
"=",
"[",
"$",
"styles",
"=>",
"$",
"value",
"]",
";",
"}",
"if",
"... | Attributes::addAttributeStyle
@param string|array $styles
@param string|null $value
@return static | [
"Attributes",
"::",
"addAttributeStyle"
] | train | https://github.com/o2system/html/blob/b7336fb45d42603ce1064b25572a05d495887670/src/Element/Attributes.php#L155-L175 |
o2system/html | src/Element/Attributes.php | Attributes.hasAttribute | public function hasAttribute($name)
{
if ($name === 'id') {
return empty($this->storage[ 'id' ]) ? false : true;
} elseif ($name === 'class') {
return empty($this->storage[ 'class' ]) ? false : true;
} else {
return isset($this->storage[ $name ]);
... | php | public function hasAttribute($name)
{
if ($name === 'id') {
return empty($this->storage[ 'id' ]) ? false : true;
} elseif ($name === 'class') {
return empty($this->storage[ 'class' ]) ? false : true;
} else {
return isset($this->storage[ $name ]);
... | [
"public",
"function",
"hasAttribute",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"$",
"name",
"===",
"'id'",
")",
"{",
"return",
"empty",
"(",
"$",
"this",
"->",
"storage",
"[",
"'id'",
"]",
")",
"?",
"false",
":",
"true",
";",
"}",
"elseif",
"(",
"$... | Attributes::hasAttribute
@param string $name
@return bool | [
"Attributes",
"::",
"hasAttribute"
] | train | https://github.com/o2system/html/blob/b7336fb45d42603ce1064b25572a05d495887670/src/Element/Attributes.php#L186-L195 |
o2system/html | src/Element/Attributes.php | Attributes.getAttribute | public function getAttribute($name = null)
{
if (empty($name)) {
return $this->storage;
} elseif (isset($this->storage[ $name ])) {
return $this->storage[ $name ];
}
return false;
} | php | public function getAttribute($name = null)
{
if (empty($name)) {
return $this->storage;
} elseif (isset($this->storage[ $name ])) {
return $this->storage[ $name ];
}
return false;
} | [
"public",
"function",
"getAttribute",
"(",
"$",
"name",
"=",
"null",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"name",
")",
")",
"{",
"return",
"$",
"this",
"->",
"storage",
";",
"}",
"elseif",
"(",
"isset",
"(",
"$",
"this",
"->",
"storage",
"[",
... | Attributes::getAttribute
@param string|null $name
@return array|bool | [
"Attributes",
"::",
"getAttribute"
] | train | https://github.com/o2system/html/blob/b7336fb45d42603ce1064b25572a05d495887670/src/Element/Attributes.php#L206-L215 |
o2system/html | src/Element/Attributes.php | Attributes.removeAttribute | public function removeAttribute($attributes)
{
if (is_string($attributes)) {
$attributes = explode(',', $attributes);
}
$attributes = array_map('trim', $attributes);
$attributes = array_filter($attributes);
foreach ($attributes as $attribute) {
if (a... | php | public function removeAttribute($attributes)
{
if (is_string($attributes)) {
$attributes = explode(',', $attributes);
}
$attributes = array_map('trim', $attributes);
$attributes = array_filter($attributes);
foreach ($attributes as $attribute) {
if (a... | [
"public",
"function",
"removeAttribute",
"(",
"$",
"attributes",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"attributes",
")",
")",
"{",
"$",
"attributes",
"=",
"explode",
"(",
"','",
",",
"$",
"attributes",
")",
";",
"}",
"$",
"attributes",
"=",
"arr... | Attributes::removeAttribute
@param string|array $attributes | [
"Attributes",
"::",
"removeAttribute"
] | train | https://github.com/o2system/html/blob/b7336fb45d42603ce1064b25572a05d495887670/src/Element/Attributes.php#L224-L245 |
o2system/html | src/Element/Attributes.php | Attributes.hasAttributeClass | public function hasAttributeClass($className)
{
if ( ! $this->offsetExists('class')) {
$this->storage[ 'class' ] = [];
}
return in_array($className, $this->storage[ 'class' ]);
} | php | public function hasAttributeClass($className)
{
if ( ! $this->offsetExists('class')) {
$this->storage[ 'class' ] = [];
}
return in_array($className, $this->storage[ 'class' ]);
} | [
"public",
"function",
"hasAttributeClass",
"(",
"$",
"className",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"offsetExists",
"(",
"'class'",
")",
")",
"{",
"$",
"this",
"->",
"storage",
"[",
"'class'",
"]",
"=",
"[",
"]",
";",
"}",
"return",
"in_ar... | Attributes::hasAttributeClass
@param string $className
@return bool | [
"Attributes",
"::",
"hasAttributeClass"
] | train | https://github.com/o2system/html/blob/b7336fb45d42603ce1064b25572a05d495887670/src/Element/Attributes.php#L284-L291 |
o2system/html | src/Element/Attributes.php | Attributes.replaceAttributeClass | public function replaceAttributeClass($class, $replace)
{
if ($this->offsetExists('class')) {
foreach ($this->storage[ 'class' ] as $key => $value) {
if (preg_match("/\b$class\b/i", $value)) {
$this->storage[ 'class' ][ $key ] = str_replace($class, $replace, $... | php | public function replaceAttributeClass($class, $replace)
{
if ($this->offsetExists('class')) {
foreach ($this->storage[ 'class' ] as $key => $value) {
if (preg_match("/\b$class\b/i", $value)) {
$this->storage[ 'class' ][ $key ] = str_replace($class, $replace, $... | [
"public",
"function",
"replaceAttributeClass",
"(",
"$",
"class",
",",
"$",
"replace",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"offsetExists",
"(",
"'class'",
")",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"storage",
"[",
"'class'",
"]",
"as",
"$",
... | Attributes::replaceAttributeClass
@param string $class
@param string $replace | [
"Attributes",
"::",
"replaceAttributeClass"
] | train | https://github.com/o2system/html/blob/b7336fb45d42603ce1064b25572a05d495887670/src/Element/Attributes.php#L317-L330 |
o2system/html | src/Element/Attributes.php | Attributes.findAttributeClass | public function findAttributeClass($class)
{
if ($this->offsetExists('class')) {
$matches = [];
foreach ($this->storage[ 'class' ] as $key => $value) {
if (preg_match("/\b$class\b/i", $value)) {
$matches[] = $value;
}
}... | php | public function findAttributeClass($class)
{
if ($this->offsetExists('class')) {
$matches = [];
foreach ($this->storage[ 'class' ] as $key => $value) {
if (preg_match("/\b$class\b/i", $value)) {
$matches[] = $value;
}
}... | [
"public",
"function",
"findAttributeClass",
"(",
"$",
"class",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"offsetExists",
"(",
"'class'",
")",
")",
"{",
"$",
"matches",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"storage",
"[",
"'class'",
"]... | Attributes::findAttributeClass
@param string $class
@return array|bool | [
"Attributes",
"::",
"findAttributeClass"
] | train | https://github.com/o2system/html/blob/b7336fb45d42603ce1064b25572a05d495887670/src/Element/Attributes.php#L341-L359 |
o2system/html | src/Element/Attributes.php | Attributes.render | public function render(array $options = [])
{
$output = '';
if ($this->count()) {
foreach ($this->storage as $key => $value) {
$output = trim($output);
switch ($key) {
case 'style':
if (count($value) == 0) {
... | php | public function render(array $options = [])
{
$output = '';
if ($this->count()) {
foreach ($this->storage as $key => $value) {
$output = trim($output);
switch ($key) {
case 'style':
if (count($value) == 0) {
... | [
"public",
"function",
"render",
"(",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"output",
"=",
"''",
";",
"if",
"(",
"$",
"this",
"->",
"count",
"(",
")",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"storage",
"as",
"$",
"key",
"=>... | Attributes::render
@param array $options
@return string | [
"Attributes",
"::",
"render"
] | train | https://github.com/o2system/html/blob/b7336fb45d42603ce1064b25572a05d495887670/src/Element/Attributes.php#L382-L443 |
discophp/framework | core/classes/Console.class.php | Console.with | public function with($args){
$service = array_shift($args);
$method = array_shift($args);
var_dump(\App::handle($service,$method,$args));
} | php | public function with($args){
$service = array_shift($args);
$method = array_shift($args);
var_dump(\App::handle($service,$method,$args));
} | [
"public",
"function",
"with",
"(",
"$",
"args",
")",
"{",
"$",
"service",
"=",
"array_shift",
"(",
"$",
"args",
")",
";",
"$",
"method",
"=",
"array_shift",
"(",
"$",
"args",
")",
";",
"var_dump",
"(",
"\\",
"App",
"::",
"handle",
"(",
"$",
"servic... | Execute a class/service/facade and method.
eg: `with Cache set cache-key 'Some Value' 60
@param array $args The arguements. | [
"Execute",
"a",
"class",
"/",
"service",
"/",
"facade",
"and",
"method",
"."
] | train | https://github.com/discophp/framework/blob/40ff3ea5225810534195494dc6c21083da4d1356/core/classes/Console.class.php#L116-L124 |
discophp/framework | core/classes/Console.class.php | Console.gen | public function gen($args){
if($args[0]=='aes'){
$r = \Disco\manage\Manager::genAES256Key();
if(isset($args[1]) && $args[1]=='set'){
\Disco\manage\Manager::setAES256Key($r);
echo '`AES_KEY256` now set to : ' . $r . PHP_EOL;
}//if
e... | php | public function gen($args){
if($args[0]=='aes'){
$r = \Disco\manage\Manager::genAES256Key();
if(isset($args[1]) && $args[1]=='set'){
\Disco\manage\Manager::setAES256Key($r);
echo '`AES_KEY256` now set to : ' . $r . PHP_EOL;
}//if
e... | [
"public",
"function",
"gen",
"(",
"$",
"args",
")",
"{",
"if",
"(",
"$",
"args",
"[",
"0",
"]",
"==",
"'aes'",
")",
"{",
"$",
"r",
"=",
"\\",
"Disco",
"\\",
"manage",
"\\",
"Manager",
"::",
"genAES256Key",
"(",
")",
";",
"if",
"(",
"isset",
"("... | Generate a secure key for use in cryptographic methods, optionally setting it in `app/config/config.php`.
eg: `gen aes set`
eg: `gen sha 32 set-lead`
eg: `gen sha 32 set-tail`
@param array $args The arguements. | [
"Generate",
"a",
"secure",
"key",
"for",
"use",
"in",
"cryptographic",
"methods",
"optionally",
"setting",
"it",
"in",
"app",
"/",
"config",
"/",
"config",
".",
"php",
"."
] | train | https://github.com/discophp/framework/blob/40ff3ea5225810534195494dc6c21083da4d1356/core/classes/Console.class.php#L172-L206 |
discophp/framework | core/classes/Console.class.php | Console.devMode | public function devMode($args){
if(empty($args[0])){
$mode = \Disco\manage\Manager::devMode();
echo 'DEV_MODE : ' . (($mode) ? 'true' : 'false') . PHP_EOL;
exit;
}//if
else if($args[0] != 'true' && $args[0] != 'false'){
echo 'Mode takes one of two... | php | public function devMode($args){
if(empty($args[0])){
$mode = \Disco\manage\Manager::devMode();
echo 'DEV_MODE : ' . (($mode) ? 'true' : 'false') . PHP_EOL;
exit;
}//if
else if($args[0] != 'true' && $args[0] != 'false'){
echo 'Mode takes one of two... | [
"public",
"function",
"devMode",
"(",
"$",
"args",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"args",
"[",
"0",
"]",
")",
")",
"{",
"$",
"mode",
"=",
"\\",
"Disco",
"\\",
"manage",
"\\",
"Manager",
"::",
"devMode",
"(",
")",
";",
"echo",
"'DEV_MODE ... | Get the current dev mode, optionally setting it.
eg: `dev-mode`
eg: `dev-mode true`
eg: `dev-mode false`
@param array $args The arguements. | [
"Get",
"the",
"current",
"dev",
"mode",
"optionally",
"setting",
"it",
"."
] | train | https://github.com/discophp/framework/blob/40ff3ea5225810534195494dc6c21083da4d1356/core/classes/Console.class.php#L219-L234 |
discophp/framework | core/classes/Console.class.php | Console.dbBackup | public function dbBackup($args, $structureOnly = false){
$path = '/app/db/';
if(isset($args[0]) && $args[0]){
$path = $args[0];
}//if
if($structureOnly == true){
$fileName = \App::config('DB_DB') . '_STRUCTURE.sql';
}//if
else {
$file... | php | public function dbBackup($args, $structureOnly = false){
$path = '/app/db/';
if(isset($args[0]) && $args[0]){
$path = $args[0];
}//if
if($structureOnly == true){
$fileName = \App::config('DB_DB') . '_STRUCTURE.sql';
}//if
else {
$file... | [
"public",
"function",
"dbBackup",
"(",
"$",
"args",
",",
"$",
"structureOnly",
"=",
"false",
")",
"{",
"$",
"path",
"=",
"'/app/db/'",
";",
"if",
"(",
"isset",
"(",
"$",
"args",
"[",
"0",
"]",
")",
"&&",
"$",
"args",
"[",
"0",
"]",
")",
"{",
"$... | Create a new backup of the DB. If you want to alter the default dumping behavior create a configuration file
at `app/config/db-backup-settings.php` and return an array with the settings you want to alter. The full
list of settings can be found at https://github.com/ifsnop/mysqldump-php#dump-settings . By default if you... | [
"Create",
"a",
"new",
"backup",
"of",
"the",
"DB",
".",
"If",
"you",
"want",
"to",
"alter",
"the",
"default",
"dumping",
"behavior",
"create",
"a",
"configuration",
"file",
"at",
"app",
"/",
"config",
"/",
"db",
"-",
"backup",
"-",
"settings",
".",
"ph... | train | https://github.com/discophp/framework/blob/40ff3ea5225810534195494dc6c21083da4d1356/core/classes/Console.class.php#L299-L364 |
discophp/framework | core/classes/Console.class.php | Console.dbRestore | public function dbRestore($args){
$path = '/app/db/';
if(isset($args[0])){
$path = $args[0];
}//if
$path = \App::path() . '/' . trim($path,'/') . '/';
$fileName = \App::config('DB_DB');
if(isset($args[1])){
$fileName = $args[1];
}//if
... | php | public function dbRestore($args){
$path = '/app/db/';
if(isset($args[0])){
$path = $args[0];
}//if
$path = \App::path() . '/' . trim($path,'/') . '/';
$fileName = \App::config('DB_DB');
if(isset($args[1])){
$fileName = $args[1];
}//if
... | [
"public",
"function",
"dbRestore",
"(",
"$",
"args",
")",
"{",
"$",
"path",
"=",
"'/app/db/'",
";",
"if",
"(",
"isset",
"(",
"$",
"args",
"[",
"0",
"]",
")",
")",
"{",
"$",
"path",
"=",
"$",
"args",
"[",
"0",
"]",
";",
"}",
"//if",
"$",
"path... | Restore the DB from a backup.
eg: `db-restore`
eg: `db-restore /app/db/`
eg `db-restore /app/db/ BACKUP.sql`
@param array $args The arguements. | [
"Restore",
"the",
"DB",
"from",
"a",
"backup",
"."
] | train | https://github.com/discophp/framework/blob/40ff3ea5225810534195494dc6c21083da4d1356/core/classes/Console.class.php#L377-L417 |
discophp/framework | core/classes/Console.class.php | Console.create | public function create($args){
if($args[0] == 'model'){
if(!isset($args[1])){
echo 'You must specify a table to build the model from' . PHP_EOL;
exit;
}//if
$table = $args[1];
$templatePath = isset($args[2]) ? $args[2] : 'app/co... | php | public function create($args){
if($args[0] == 'model'){
if(!isset($args[1])){
echo 'You must specify a table to build the model from' . PHP_EOL;
exit;
}//if
$table = $args[1];
$templatePath = isset($args[2]) ? $args[2] : 'app/co... | [
"public",
"function",
"create",
"(",
"$",
"args",
")",
"{",
"if",
"(",
"$",
"args",
"[",
"0",
"]",
"==",
"'model'",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"args",
"[",
"1",
"]",
")",
")",
"{",
"echo",
"'You must specify a table to build the mod... | Create a model or a record. Use the special keyword `all` in place of a table name to generate records or
models for all tables.
eg: `create model user`
eg: `create model user /app/config/model.format /app/model/`
eg: `create record user`
eg: `create record user /app/config/record.format /app/record/`
@param array $... | [
"Create",
"a",
"model",
"or",
"a",
"record",
".",
"Use",
"the",
"special",
"keyword",
"all",
"in",
"place",
"of",
"a",
"table",
"name",
"to",
"generate",
"records",
"or",
"models",
"for",
"all",
"tables",
"."
] | train | https://github.com/discophp/framework/blob/40ff3ea5225810534195494dc6c21083da4d1356/core/classes/Console.class.php#L433-L486 |
discophp/framework | core/classes/Console.class.php | Console.consoleQuestion | public static function consoleQuestion($question,$options){
@ob_flush();
$orgQuestion = $question;
$opts = '';
foreach($options as $value => $statement){
$opts .= "'{$value}') echo '{$value}'; break;;";
$question .= PHP_EOL . "($value) - {$statement}";
... | php | public static function consoleQuestion($question,$options){
@ob_flush();
$orgQuestion = $question;
$opts = '';
foreach($options as $value => $statement){
$opts .= "'{$value}') echo '{$value}'; break;;";
$question .= PHP_EOL . "($value) - {$statement}";
... | [
"public",
"static",
"function",
"consoleQuestion",
"(",
"$",
"question",
",",
"$",
"options",
")",
"{",
"@",
"ob_flush",
"(",
")",
";",
"$",
"orgQuestion",
"=",
"$",
"question",
";",
"$",
"opts",
"=",
"''",
";",
"foreach",
"(",
"$",
"options",
"as",
... | Prompt the user at the console with a question and the valid options that serve as an answer to that
question.
@param string $question The question being asked.
@param array $options The possible answers to the question being asked, where the keys are the anwsers and
the values are the description of the answer.
@ret... | [
"Prompt",
"the",
"user",
"at",
"the",
"console",
"with",
"a",
"question",
"and",
"the",
"valid",
"options",
"that",
"serve",
"as",
"an",
"answer",
"to",
"that",
"question",
"."
] | train | https://github.com/discophp/framework/blob/40ff3ea5225810534195494dc6c21083da4d1356/core/classes/Console.class.php#L550-L584 |
discophp/framework | core/classes/Console.class.php | Console.consolePrompt | public function consolePrompt($question,$cannotBeBlank = false){
@ob_flush();
exec("read -p '{$question} ' answer; echo \$answer;",$answer);
if(!$answer[0] && $cannotBeBlank === true){
echo PHP_EOL . 'Answer cannot be blank! Try again...' . PHP_EOL . PHP_EOL;
return s... | php | public function consolePrompt($question,$cannotBeBlank = false){
@ob_flush();
exec("read -p '{$question} ' answer; echo \$answer;",$answer);
if(!$answer[0] && $cannotBeBlank === true){
echo PHP_EOL . 'Answer cannot be blank! Try again...' . PHP_EOL . PHP_EOL;
return s... | [
"public",
"function",
"consolePrompt",
"(",
"$",
"question",
",",
"$",
"cannotBeBlank",
"=",
"false",
")",
"{",
"@",
"ob_flush",
"(",
")",
";",
"exec",
"(",
"\"read -p '{$question} ' answer; echo \\$answer;\"",
",",
"$",
"answer",
")",
";",
"if",
"(",
"!",
"... | Prompt the user at the console to enter a free form text response to a question.
@param string $question The question that needs a response.
@param boolean $cannotBeBlank The response to the question cannot be blank.
@return string The response to the question. | [
"Prompt",
"the",
"user",
"at",
"the",
"console",
"to",
"enter",
"a",
"free",
"form",
"text",
"response",
"to",
"a",
"question",
"."
] | train | https://github.com/discophp/framework/blob/40ff3ea5225810534195494dc6c21083da4d1356/core/classes/Console.class.php#L596-L609 |
o2system/filesystem | src/Handlers/Uploader.php | Uploader.setAllowedMimes | public function setAllowedMimes($mimes)
{
if (is_string($mimes)) {
$mimes = explode(',', $mimes);
}
$this->allowedMimes = array_map('trim', $mimes);
return $this;
} | php | public function setAllowedMimes($mimes)
{
if (is_string($mimes)) {
$mimes = explode(',', $mimes);
}
$this->allowedMimes = array_map('trim', $mimes);
return $this;
} | [
"public",
"function",
"setAllowedMimes",
"(",
"$",
"mimes",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"mimes",
")",
")",
"{",
"$",
"mimes",
"=",
"explode",
"(",
"','",
",",
"$",
"mimes",
")",
";",
"}",
"$",
"this",
"->",
"allowedMimes",
"=",
"arr... | Uploader::setAllowedMimes
Set allowed mime for uploaded file.
@param string|array $mimes List of allowed file mime types.
@return static | [
"Uploader",
"::",
"setAllowedMimes"
] | train | https://github.com/o2system/filesystem/blob/58f6515f56bcc92408dc155add570c99a0abb6e8/src/Handlers/Uploader.php#L154-L163 |
o2system/filesystem | src/Handlers/Uploader.php | Uploader.setAllowedExtensions | public function setAllowedExtensions($extensions)
{
if (is_string($extensions)) {
$extensions = explode(',', $extensions);
}
$this->allowedExtensions = array_map('trim', $extensions);
return $this;
} | php | public function setAllowedExtensions($extensions)
{
if (is_string($extensions)) {
$extensions = explode(',', $extensions);
}
$this->allowedExtensions = array_map('trim', $extensions);
return $this;
} | [
"public",
"function",
"setAllowedExtensions",
"(",
"$",
"extensions",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"extensions",
")",
")",
"{",
"$",
"extensions",
"=",
"explode",
"(",
"','",
",",
"$",
"extensions",
")",
";",
"}",
"$",
"this",
"->",
"all... | Uploader::setAllowedExtensions
Set allowed extensions for uploaded file.
@param string|array $extensions List of allowed file extensions.
@return static | [
"Uploader",
"::",
"setAllowedExtensions"
] | train | https://github.com/o2system/filesystem/blob/58f6515f56bcc92408dc155add570c99a0abb6e8/src/Handlers/Uploader.php#L176-L185 |
o2system/filesystem | src/Handlers/Uploader.php | Uploader.setPath | public function setPath($path = '')
{
if (is_dir($path)) {
$this->path = $path;
} elseif (defined('PATH_STORAGE')) {
if (is_dir($path)) {
$this->path = $path;
} else {
$this->path = PATH_STORAGE . str_replace(PATH_STORAGE, '', $path... | php | public function setPath($path = '')
{
if (is_dir($path)) {
$this->path = $path;
} elseif (defined('PATH_STORAGE')) {
if (is_dir($path)) {
$this->path = $path;
} else {
$this->path = PATH_STORAGE . str_replace(PATH_STORAGE, '', $path... | [
"public",
"function",
"setPath",
"(",
"$",
"path",
"=",
"''",
")",
"{",
"if",
"(",
"is_dir",
"(",
"$",
"path",
")",
")",
"{",
"$",
"this",
"->",
"path",
"=",
"$",
"path",
";",
"}",
"elseif",
"(",
"defined",
"(",
"'PATH_STORAGE'",
")",
")",
"{",
... | Uploader::setPath
Sets uploaded file path.
@param string $path [description]
@return static | [
"Uploader",
"::",
"setPath"
] | train | https://github.com/o2system/filesystem/blob/58f6515f56bcc92408dc155add570c99a0abb6e8/src/Handlers/Uploader.php#L198-L211 |
o2system/filesystem | src/Handlers/Uploader.php | Uploader.setMinFileSize | public function setMinFileSize($fileSize, $unit = 'M')
{
switch ($unit) {
case 'B':
$fileSize = (int)$fileSize;
break;
case 'K':
$fileSize = (int)$fileSize * 1000;
break;
case 'M':
$fileSize =... | php | public function setMinFileSize($fileSize, $unit = 'M')
{
switch ($unit) {
case 'B':
$fileSize = (int)$fileSize;
break;
case 'K':
$fileSize = (int)$fileSize * 1000;
break;
case 'M':
$fileSize =... | [
"public",
"function",
"setMinFileSize",
"(",
"$",
"fileSize",
",",
"$",
"unit",
"=",
"'M'",
")",
"{",
"switch",
"(",
"$",
"unit",
")",
"{",
"case",
"'B'",
":",
"$",
"fileSize",
"=",
"(",
"int",
")",
"$",
"fileSize",
";",
"break",
";",
"case",
"'K'"... | Uploader::setMinFileSize
Set minimum file size
@param int $fileSize Allowed minimum file size.
@param string $unit Allowed minimum file size unit conversion.
@return static | [
"Uploader",
"::",
"setMinFileSize"
] | train | https://github.com/o2system/filesystem/blob/58f6515f56bcc92408dc155add570c99a0abb6e8/src/Handlers/Uploader.php#L225-L245 |
o2system/filesystem | src/Handlers/Uploader.php | Uploader.setMaxFileSize | public function setMaxFileSize($fileSize, $unit = 'M')
{
switch ($unit) {
case 'B':
$fileSize = (int)$fileSize;
break;
case 'K':
$fileSize = (int)$fileSize * 1000;
break;
case 'M':
$fileSize =... | php | public function setMaxFileSize($fileSize, $unit = 'M')
{
switch ($unit) {
case 'B':
$fileSize = (int)$fileSize;
break;
case 'K':
$fileSize = (int)$fileSize * 1000;
break;
case 'M':
$fileSize =... | [
"public",
"function",
"setMaxFileSize",
"(",
"$",
"fileSize",
",",
"$",
"unit",
"=",
"'M'",
")",
"{",
"switch",
"(",
"$",
"unit",
")",
"{",
"case",
"'B'",
":",
"$",
"fileSize",
"=",
"(",
"int",
")",
"$",
"fileSize",
";",
"break",
";",
"case",
"'K'"... | Uploader::setMaxFileSize
Set maximum file size
@param int $fileSize Allowed maximum file size.
@param string $unit Allowed maximum file size unit conversion.
@return static | [
"Uploader",
"::",
"setMaxFileSize"
] | train | https://github.com/o2system/filesystem/blob/58f6515f56bcc92408dc155add570c99a0abb6e8/src/Handlers/Uploader.php#L259-L279 |
o2system/filesystem | src/Handlers/Uploader.php | Uploader.process | public function process($field = null)
{
$uploadFiles = input()->files($field);
if ( ! is_array($uploadFiles)) {
$uploadFiles = [$uploadFiles];
}
if (count($uploadFiles)) {
foreach ($uploadFiles as $file) {
if ($file instanceof UploadFile) {
... | php | public function process($field = null)
{
$uploadFiles = input()->files($field);
if ( ! is_array($uploadFiles)) {
$uploadFiles = [$uploadFiles];
}
if (count($uploadFiles)) {
foreach ($uploadFiles as $file) {
if ($file instanceof UploadFile) {
... | [
"public",
"function",
"process",
"(",
"$",
"field",
"=",
"null",
")",
"{",
"$",
"uploadFiles",
"=",
"input",
"(",
")",
"->",
"files",
"(",
"$",
"field",
")",
";",
"if",
"(",
"!",
"is_array",
"(",
"$",
"uploadFiles",
")",
")",
"{",
"$",
"uploadFiles... | Uploader::process
@param string|null $field Field offset server uploaded files
@return bool Returns TRUE on success or FALSE on failure. | [
"Uploader",
"::",
"process"
] | train | https://github.com/o2system/filesystem/blob/58f6515f56bcc92408dc155add570c99a0abb6e8/src/Handlers/Uploader.php#L306-L370 |
o2system/filesystem | src/Handlers/Uploader.php | Uploader.setTargetFilename | public function setTargetFilename($filename, $conversionFunction = 'dash')
{
$this->targetFilename = call_user_func_array(
$conversionFunction,
[
strtolower(
trim(
pathinfo($filename, PATHINFO_FILENAME)
)... | php | public function setTargetFilename($filename, $conversionFunction = 'dash')
{
$this->targetFilename = call_user_func_array(
$conversionFunction,
[
strtolower(
trim(
pathinfo($filename, PATHINFO_FILENAME)
)... | [
"public",
"function",
"setTargetFilename",
"(",
"$",
"filename",
",",
"$",
"conversionFunction",
"=",
"'dash'",
")",
"{",
"$",
"this",
"->",
"targetFilename",
"=",
"call_user_func_array",
"(",
"$",
"conversionFunction",
",",
"[",
"strtolower",
"(",
"trim",
"(",
... | Uploader::setTargetFilename
Sets target filename.
@param string $filename The target filename.
@param string $conversionFunction Conversion function name, by default it's using dash inflector function.
@return static | [
"Uploader",
"::",
"setTargetFilename"
] | train | https://github.com/o2system/filesystem/blob/58f6515f56bcc92408dc155add570c99a0abb6e8/src/Handlers/Uploader.php#L384-L398 |
o2system/filesystem | src/Handlers/Uploader.php | Uploader.validate | protected function validate(UploadFile $file)
{
/* Validate extension */
if (is_array($this->allowedExtensions) && count($this->allowedExtensions)) {
if ( ! in_array('.' . $file->getExtension(), $this->allowedExtensions)) {
$this->errors[] = language()->getLine(
... | php | protected function validate(UploadFile $file)
{
/* Validate extension */
if (is_array($this->allowedExtensions) && count($this->allowedExtensions)) {
if ( ! in_array('.' . $file->getExtension(), $this->allowedExtensions)) {
$this->errors[] = language()->getLine(
... | [
"protected",
"function",
"validate",
"(",
"UploadFile",
"$",
"file",
")",
"{",
"/* Validate extension */",
"if",
"(",
"is_array",
"(",
"$",
"this",
"->",
"allowedExtensions",
")",
"&&",
"count",
"(",
"$",
"this",
"->",
"allowedExtensions",
")",
")",
"{",
"if... | Uploader::validate
@param \O2System\Kernel\Http\Message\UploadFile $file
@return bool | [
"Uploader",
"::",
"validate"
] | train | https://github.com/o2system/filesystem/blob/58f6515f56bcc92408dc155add570c99a0abb6e8/src/Handlers/Uploader.php#L409-L456 |
o2system/filesystem | src/Handlers/Uploader.php | Uploader.move | protected function move(UploadFile $file, $targetPath)
{
$fileInfo = [
'name' => pathinfo($targetPath, PATHINFO_BASENAME),
'path' => $targetPath,
'mime' => $file->getFileMime(),
'size' => $file->getSize(),
];
$file->moveTo($targetPath);
... | php | protected function move(UploadFile $file, $targetPath)
{
$fileInfo = [
'name' => pathinfo($targetPath, PATHINFO_BASENAME),
'path' => $targetPath,
'mime' => $file->getFileMime(),
'size' => $file->getSize(),
];
$file->moveTo($targetPath);
... | [
"protected",
"function",
"move",
"(",
"UploadFile",
"$",
"file",
",",
"$",
"targetPath",
")",
"{",
"$",
"fileInfo",
"=",
"[",
"'name'",
"=>",
"pathinfo",
"(",
"$",
"targetPath",
",",
"PATHINFO_BASENAME",
")",
",",
"'path'",
"=>",
"$",
"targetPath",
",",
... | Uploader::mode
@param \O2System\Kernel\Http\Message\UploadFile $file
@param $targetPath | [
"Uploader",
"::",
"mode"
] | train | https://github.com/o2system/filesystem/blob/58f6515f56bcc92408dc155add570c99a0abb6e8/src/Handlers/Uploader.php#L466-L482 |
datasift/datasift-php | lib/DataSift/Push/Definition.php | DataSift_Push_Definition.getOutputParam | public function getOutputParam($key)
{
if (isset($this->_output_params[$key])) {
return $this->_output_params[$key];
}
return null;
} | php | public function getOutputParam($key)
{
if (isset($this->_output_params[$key])) {
return $this->_output_params[$key];
}
return null;
} | [
"public",
"function",
"getOutputParam",
"(",
"$",
"key",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"_output_params",
"[",
"$",
"key",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"_output_params",
"[",
"$",
"key",
"]",
";",
"}",
"re... | Get an output parameter.
@param string $key The parameter to get.
@return string | [
"Get",
"an",
"output",
"parameter",
"."
] | train | https://github.com/datasift/datasift-php/blob/35282461ad3e54880e5940bb5afce26c75dc4bb9/lib/DataSift/Push/Definition.php#L132-L138 |
datasift/datasift-php | lib/DataSift/Push/Definition.php | DataSift_Push_Definition.validate | public function validate()
{
$retval = false;
$params = array('output_type' => $this->_output_type);
foreach ($this->_output_params as $key => $val) {
$params[self::OUTPUT_PARAMS_PREFIX . $key] = $val;
}
try {
$retval = $this->_user->post('push/valid... | php | public function validate()
{
$retval = false;
$params = array('output_type' => $this->_output_type);
foreach ($this->_output_params as $key => $val) {
$params[self::OUTPUT_PARAMS_PREFIX . $key] = $val;
}
try {
$retval = $this->_user->post('push/valid... | [
"public",
"function",
"validate",
"(",
")",
"{",
"$",
"retval",
"=",
"false",
";",
"$",
"params",
"=",
"array",
"(",
"'output_type'",
"=>",
"$",
"this",
"->",
"_output_type",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"_output_params",
"as",
"$",
"ke... | Validate the output type and parameters with the DataSift API.
@throws DataSift_Exception_AccessDenied
@throws DataSift_Exception_InvalidData | [
"Validate",
"the",
"output",
"type",
"and",
"parameters",
"with",
"the",
"DataSift",
"API",
"."
] | train | https://github.com/datasift/datasift-php/blob/35282461ad3e54880e5940bb5afce26c75dc4bb9/lib/DataSift/Push/Definition.php#L156-L170 |
datasift/datasift-php | lib/DataSift/Push/Definition.php | DataSift_Push_Definition.subscribe | protected function subscribe($hash_type, $hash, $name)
{
$retval = false;
// API call parameters
$params = array(
'name' => $name,
$hash_type => $hash,
'output_type' => $this->_output_type,
);
// Prefix the output parameters
foreac... | php | protected function subscribe($hash_type, $hash, $name)
{
$retval = false;
// API call parameters
$params = array(
'name' => $name,
$hash_type => $hash,
'output_type' => $this->_output_type,
);
// Prefix the output parameters
foreac... | [
"protected",
"function",
"subscribe",
"(",
"$",
"hash_type",
",",
"$",
"hash",
",",
"$",
"name",
")",
"{",
"$",
"retval",
"=",
"false",
";",
"// API call parameters",
"$",
"params",
"=",
"array",
"(",
"'name'",
"=>",
"$",
"name",
",",
"$",
"hash_type",
... | Subscribe this endpoint to a stream hash or historic playback ID. Note
that this will activate the subscription if the initial status is set
to active.
@param string $hash_type "hash" or "playback_id"
@param string $hash The hash or playback ID.
@param string $name A name for this subscription.
@return Data... | [
"Subscribe",
"this",
"endpoint",
"to",
"a",
"stream",
"hash",
"or",
"historic",
"playback",
"ID",
".",
"Note",
"that",
"this",
"will",
"activate",
"the",
"subscription",
"if",
"the",
"initial",
"status",
"is",
"set",
"to",
"active",
"."
] | train | https://github.com/datasift/datasift-php/blob/35282461ad3e54880e5940bb5afce26c75dc4bb9/lib/DataSift/Push/Definition.php#L250-L272 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.