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
DreadLabs/VantomasWebsite
src/Page/TypeCollection.php
TypeCollection.offsetUnset
public function offsetUnset($offset) { if ($offset instanceof Type) { $this->types = array_filter($this->types, function ($type) use ($offset) { return $type !== $offset; }); return; } unset($this->types[$offset]); }
php
public function offsetUnset($offset) { if ($offset instanceof Type) { $this->types = array_filter($this->types, function ($type) use ($offset) { return $type !== $offset; }); return; } unset($this->types[$offset]); }
[ "public", "function", "offsetUnset", "(", "$", "offset", ")", "{", "if", "(", "$", "offset", "instanceof", "Type", ")", "{", "$", "this", "->", "types", "=", "array_filter", "(", "$", "this", "->", "types", ",", "function", "(", "$", "type", ")", "us...
Offset to unset @param mixed $offset The offset to unset. @return void
[ "Offset", "to", "unset" ]
train
https://github.com/DreadLabs/VantomasWebsite/blob/7f85f2b45bdf5ed9fa9d320c805c416bf99cd668/src/Page/TypeCollection.php#L89-L100
KDF5000/EasyThink
src/ThinkPHP/Library/Vendor/SmartTemplate/class.smarttemplatedebugger.php
SmartTemplateDebugger.SmartTemplateDebugger
function SmartTemplateDebugger ( $template_filename ) { $this->filename = $template_filename; // Load Template if ($hd = @fopen($template_filename, "r")) { $this->template = fread($hd, filesize($template_filename)); fclose($hd); } else { $t...
php
function SmartTemplateDebugger ( $template_filename ) { $this->filename = $template_filename; // Load Template if ($hd = @fopen($template_filename, "r")) { $this->template = fread($hd, filesize($template_filename)); fclose($hd); } else { $t...
[ "function", "SmartTemplateDebugger", "(", "$", "template_filename", ")", "{", "$", "this", "->", "filename", "=", "$", "template_filename", ";", "//\tLoad Template", "if", "(", "$", "hd", "=", "@", "fopen", "(", "$", "template_filename", ",", "\"r\"", ")", "...
SmartTemplateParser Constructor @param string $template_filename HTML Template Filename
[ "SmartTemplateParser", "Constructor" ]
train
https://github.com/KDF5000/EasyThink/blob/86efc9c8a0d504e01e2fea55868227fdc8928841/src/ThinkPHP/Library/Vendor/SmartTemplate/class.smarttemplatedebugger.php#L34-L52
KDF5000/EasyThink
src/ThinkPHP/Library/Vendor/SmartTemplate/class.smarttemplatedebugger.php
SmartTemplateDebugger.start
function start ( $vars ) { $page = $this->template; $page = preg_replace("/(<!-- BEGIN [ a-zA-Z0-9_.]* -->)/", "\n$1\n", $page); $page = preg_replace("/(<!-- IF .+? -->)/", "\n$1\n", $page); $page = preg_replace("/(<!-- END.*? -->)/", "\n$1\n", $page); $page = preg_replace("/(<!-- ELSE...
php
function start ( $vars ) { $page = $this->template; $page = preg_replace("/(<!-- BEGIN [ a-zA-Z0-9_.]* -->)/", "\n$1\n", $page); $page = preg_replace("/(<!-- IF .+? -->)/", "\n$1\n", $page); $page = preg_replace("/(<!-- END.*? -->)/", "\n$1\n", $page); $page = preg_replace("/(<!-- ELSE...
[ "function", "start", "(", "$", "vars", ")", "{", "$", "page", "=", "$", "this", "->", "template", ";", "$", "page", "=", "preg_replace", "(", "\"/(<!-- BEGIN [ a-zA-Z0-9_.]* -->)/\"", ",", "\"\\n$1\\n\"", ",", "$", "page", ")", ";", "$", "page", "=", "pr...
Main Template Parser @param string $compiled_template_filename Compiled Template Filename @desc Creates Compiled PHP Template
[ "Main", "Template", "Parser" ]
train
https://github.com/KDF5000/EasyThink/blob/86efc9c8a0d504e01e2fea55868227fdc8928841/src/ThinkPHP/Library/Vendor/SmartTemplate/class.smarttemplatedebugger.php#L61-L332
KDF5000/EasyThink
src/ThinkPHP/Library/Vendor/SmartTemplate/class.smarttemplatedebugger.php
SmartTemplateDebugger.toggleview
function toggleview ( $suffix = '') { global $spancnt; $spancnt++; if ($suffix) { $suffix .= ':'; } $ret = '[' . $suffix . '<a href="javascript:void(\'\');" onclick="toggleVisibility(document.getElementById(\'Block' . $spancnt . '\'), this); return false">Hide Block</a>]<span id="Block' . $s...
php
function toggleview ( $suffix = '') { global $spancnt; $spancnt++; if ($suffix) { $suffix .= ':'; } $ret = '[' . $suffix . '<a href="javascript:void(\'\');" onclick="toggleVisibility(document.getElementById(\'Block' . $spancnt . '\'), this); return false">Hide Block</a>]<span id="Block' . $s...
[ "function", "toggleview", "(", "$", "suffix", "=", "''", ")", "{", "global", "$", "spancnt", ";", "$", "spancnt", "++", ";", "if", "(", "$", "suffix", ")", "{", "$", "suffix", ".=", "':'", ";", "}", "$", "ret", "=", "'['", ".", "$", "suffix", "...
Insert Hide/Show Layer Switch @param string $suffix Additional Text @desc Insert Hide/Show Layer Switch
[ "Insert", "Hide", "/", "Show", "Layer", "Switch" ]
train
https://github.com/KDF5000/EasyThink/blob/86efc9c8a0d504e01e2fea55868227fdc8928841/src/ThinkPHP/Library/Vendor/SmartTemplate/class.smarttemplatedebugger.php#L341-L352
KDF5000/EasyThink
src/ThinkPHP/Library/Vendor/SmartTemplate/class.smarttemplatedebugger.php
SmartTemplateDebugger.vardump
function vardump($var, $depth = 0) { if (is_array($var)) { $result = "Array (" . count($var) . ")<BR>"; foreach(array_keys($var) as $key) { $result .= $this->tab[$depth] . "<B>$key</B>: " . $this->vardump($var[$key], $depth+1); ...
php
function vardump($var, $depth = 0) { if (is_array($var)) { $result = "Array (" . count($var) . ")<BR>"; foreach(array_keys($var) as $key) { $result .= $this->tab[$depth] . "<B>$key</B>: " . $this->vardump($var[$key], $depth+1); ...
[ "function", "vardump", "(", "$", "var", ",", "$", "depth", "=", "0", ")", "{", "if", "(", "is_array", "(", "$", "var", ")", ")", "{", "$", "result", "=", "\"Array (\"", ".", "count", "(", "$", "var", ")", ".", "\")<BR>\"", ";", "foreach", "(", ...
Recursive Variable Display Output @param mixed $var Content @param int $depth Incremented Indent Counter for Recursive Calls @return string Variable Content @access private @desc Recursive Variable Display Output
[ "Recursive", "Variable", "Display", "Output" ]
train
https://github.com/KDF5000/EasyThink/blob/86efc9c8a0d504e01e2fea55868227fdc8928841/src/ThinkPHP/Library/Vendor/SmartTemplate/class.smarttemplatedebugger.php#L384-L400
KDF5000/EasyThink
src/ThinkPHP/Library/Vendor/SmartTemplate/class.smarttemplatedebugger.php
SmartTemplateDebugger.var_name
function var_name($tag) { $parent_level = 0; while (substr($tag, 0, 7) == 'parent.') { $tag = substr($tag, 7); $parent_level++; } if (substr($tag, 0, 4) == 'top.') { $ret = array('_stack[0]', substr($tag,4)); return $ret; } elseif ($parent_level) { $ret = array('_sta...
php
function var_name($tag) { $parent_level = 0; while (substr($tag, 0, 7) == 'parent.') { $tag = substr($tag, 7); $parent_level++; } if (substr($tag, 0, 4) == 'top.') { $ret = array('_stack[0]', substr($tag,4)); return $ret; } elseif ($parent_level) { $ret = array('_sta...
[ "function", "var_name", "(", "$", "tag", ")", "{", "$", "parent_level", "=", "0", ";", "while", "(", "substr", "(", "$", "tag", ",", "0", ",", "7", ")", "==", "'parent.'", ")", "{", "$", "tag", "=", "substr", "(", "$", "tag", ",", "7", ")", "...
Splits Template-Style Variable Names into an Array-Name/Key-Name Components @param string $tag Variale Name used in Template @return array Array Name, Key Name @access private @desc Splits Template-Style Variable Names into an Array-Name/Key-Name Components
[ "Splits", "Template", "-", "Style", "Variable", "Names", "into", "an", "Array", "-", "Name", "/", "Key", "-", "Name", "Components" ]
train
https://github.com/KDF5000/EasyThink/blob/86efc9c8a0d504e01e2fea55868227fdc8928841/src/ThinkPHP/Library/Vendor/SmartTemplate/class.smarttemplatedebugger.php#L411-L434
KDF5000/EasyThink
src/ThinkPHP/Library/Vendor/SmartTemplate/class.smarttemplatedebugger.php
SmartTemplateDebugger.highlight_html
function highlight_html ( $code ) { $code = htmlentities($code); $code = preg_replace('/([a-zA-Z_]+)=/', '<font color="#FF0000">$1=</font>', $code); $code = preg_replace('/(&lt;[\/a-zA-Z0-9&;]+)/', '<font color="#0000FF">$1</font>', $code); $code = str_replace('&lt;!--', '<font color="#008080...
php
function highlight_html ( $code ) { $code = htmlentities($code); $code = preg_replace('/([a-zA-Z_]+)=/', '<font color="#FF0000">$1=</font>', $code); $code = preg_replace('/(&lt;[\/a-zA-Z0-9&;]+)/', '<font color="#0000FF">$1</font>', $code); $code = str_replace('&lt;!--', '<font color="#008080...
[ "function", "highlight_html", "(", "$", "code", ")", "{", "$", "code", "=", "htmlentities", "(", "$", "code", ")", ";", "$", "code", "=", "preg_replace", "(", "'/([a-zA-Z_]+)=/'", ",", "'<font color=\"#FF0000\">$1=</font>'", ",", "$", "code", ")", ";", "$", ...
Highlight HTML Source @param string $code HTML Source @return string Hightlighte HTML Source @access private @desc Highlight HTML Source
[ "Highlight", "HTML", "Source" ]
train
https://github.com/KDF5000/EasyThink/blob/86efc9c8a0d504e01e2fea55868227fdc8928841/src/ThinkPHP/Library/Vendor/SmartTemplate/class.smarttemplatedebugger.php#L445-L454
qingbing/php-database
src/supports/ColumnSchema.php
ColumnSchema.extractLimit
protected function extractLimit($dbType) { if (0 === strncmp($dbType, 'enum', 4) && preg_match('/\(([\'"])(.*)\\1\)/', $dbType, $matches)) { // explode by (single or double) quote and comma (ENUM values may contain commas) $values = explode($matches[1] . ',' . $matches[1], $match...
php
protected function extractLimit($dbType) { if (0 === strncmp($dbType, 'enum', 4) && preg_match('/\(([\'"])(.*)\\1\)/', $dbType, $matches)) { // explode by (single or double) quote and comma (ENUM values may contain commas) $values = explode($matches[1] . ',' . $matches[1], $match...
[ "protected", "function", "extractLimit", "(", "$", "dbType", ")", "{", "if", "(", "0", "===", "strncmp", "(", "$", "dbType", ",", "'enum'", ",", "4", ")", "&&", "preg_match", "(", "'/\\(([\\'\"])(.*)\\\\1\\)/'", ",", "$", "dbType", ",", "$", "matches", "...
从列的数据库类型中提取大小、精度、标度信息 @param string $dbType
[ "从列的数据库类型中提取大小、精度、标度信息" ]
train
https://github.com/qingbing/php-database/blob/cfd915c9d25dbe5d5cdd9b4c93eca5fd63cb7015/src/supports/ColumnSchema.php#L82-L103
spryker/shopping-list-data-import
src/Spryker/Zed/ShoppingListDataImport/Business/ShoppingListDataImportStep/ShoppingListItemWriterStep.php
ShoppingListItemWriterStep.execute
public function execute(DataSetInterface $dataSet): void { $shoppingListItemEntity = $this->createShoppingListItemQuery() ->filterByFkShoppingList($dataSet[ShoppingListItemDataSetInterface::ID_SHOPPING_LIST]) ->filterBySku($dataSet[ShoppingListItemDataSetInterface::COLUMN_PRODUCT_SKU...
php
public function execute(DataSetInterface $dataSet): void { $shoppingListItemEntity = $this->createShoppingListItemQuery() ->filterByFkShoppingList($dataSet[ShoppingListItemDataSetInterface::ID_SHOPPING_LIST]) ->filterBySku($dataSet[ShoppingListItemDataSetInterface::COLUMN_PRODUCT_SKU...
[ "public", "function", "execute", "(", "DataSetInterface", "$", "dataSet", ")", ":", "void", "{", "$", "shoppingListItemEntity", "=", "$", "this", "->", "createShoppingListItemQuery", "(", ")", "->", "filterByFkShoppingList", "(", "$", "dataSet", "[", "ShoppingList...
@param \Spryker\Zed\DataImport\Business\Model\DataSet\DataSetInterface $dataSet @return void
[ "@param", "\\", "Spryker", "\\", "Zed", "\\", "DataImport", "\\", "Business", "\\", "Model", "\\", "DataSet", "\\", "DataSetInterface", "$dataSet" ]
train
https://github.com/spryker/shopping-list-data-import/blob/6313fc39e8ee79a08f7b97d81da7f4056c066674/src/Spryker/Zed/ShoppingListDataImport/Business/ShoppingListDataImportStep/ShoppingListItemWriterStep.php#L22-L32
KDF5000/EasyThink
src/ThinkPHP/Library/Think/Controller/RestController.php
RestController.getAcceptType
protected function getAcceptType(){ $type = array( 'xml' => 'application/xml,text/xml,application/x-xml', 'json' => 'application/json,text/x-json,application/jsonrequest,text/json', 'js' => 'text/javascript,application/javascript,application/x-javascript', ...
php
protected function getAcceptType(){ $type = array( 'xml' => 'application/xml,text/xml,application/x-xml', 'json' => 'application/json,text/x-json,application/jsonrequest,text/json', 'js' => 'text/javascript,application/javascript,application/x-javascript', ...
[ "protected", "function", "getAcceptType", "(", ")", "{", "$", "type", "=", "array", "(", "'xml'", "=>", "'application/xml,text/xml,application/x-xml'", ",", "'json'", "=>", "'application/json,text/x-json,application/jsonrequest,text/json'", ",", "'js'", "=>", "'text/javascr...
获取当前请求的Accept头信息 @return string
[ "获取当前请求的Accept头信息" ]
train
https://github.com/KDF5000/EasyThink/blob/86efc9c8a0d504e01e2fea55868227fdc8928841/src/ThinkPHP/Library/Think/Controller/RestController.php#L97-L124
KDF5000/EasyThink
src/ThinkPHP/Library/Think/Controller/RestController.php
RestController.setContentType
public function setContentType($type, $charset=''){ if(headers_sent()) return; if(empty($charset)) $charset = C('DEFAULT_CHARSET'); $type = strtolower($type); if(isset($this->allowOutputType[$type])) //过滤content_type header('Content-Type: '.$this->allowOutputType[$type].'; c...
php
public function setContentType($type, $charset=''){ if(headers_sent()) return; if(empty($charset)) $charset = C('DEFAULT_CHARSET'); $type = strtolower($type); if(isset($this->allowOutputType[$type])) //过滤content_type header('Content-Type: '.$this->allowOutputType[$type].'; c...
[ "public", "function", "setContentType", "(", "$", "type", ",", "$", "charset", "=", "''", ")", "{", "if", "(", "headers_sent", "(", ")", ")", "return", ";", "if", "(", "empty", "(", "$", "charset", ")", ")", "$", "charset", "=", "C", "(", "'DEFAULT...
设置页面输出的CONTENT_TYPE和编码 @access public @param string $type content_type 类型对应的扩展名 @param string $charset 页面输出编码 @return void
[ "设置页面输出的CONTENT_TYPE和编码" ]
train
https://github.com/KDF5000/EasyThink/blob/86efc9c8a0d504e01e2fea55868227fdc8928841/src/ThinkPHP/Library/Think/Controller/RestController.php#L214-L220
KDF5000/EasyThink
src/ThinkPHP/Library/Think/Controller/RestController.php
RestController.response
protected function response($data,$type='',$code=200) { $this->sendHttpStatus($code); exit($this->encodeData($data,strtolower($type))); }
php
protected function response($data,$type='',$code=200) { $this->sendHttpStatus($code); exit($this->encodeData($data,strtolower($type))); }
[ "protected", "function", "response", "(", "$", "data", ",", "$", "type", "=", "''", ",", "$", "code", "=", "200", ")", "{", "$", "this", "->", "sendHttpStatus", "(", "$", "code", ")", ";", "exit", "(", "$", "this", "->", "encodeData", "(", "$", "...
输出返回数据 @access protected @param mixed $data 要返回的数据 @param String $type 返回类型 JSON XML @param integer $code HTTP状态 @return void
[ "输出返回数据" ]
train
https://github.com/KDF5000/EasyThink/blob/86efc9c8a0d504e01e2fea55868227fdc8928841/src/ThinkPHP/Library/Think/Controller/RestController.php#L230-L233
ndavison/groundwork-framework
src/Groundwork/Classes/Response.php
Response.send
public function send($code, $body = '') { if (!isset($this->codes[$code])) { $statusCode = 500; $body = 'API attempted to return an unknown HTTP status.'; } // if the body wasn't defined, default to the inbuilt response if (!$body) $body = $this->codes[$code];...
php
public function send($code, $body = '') { if (!isset($this->codes[$code])) { $statusCode = 500; $body = 'API attempted to return an unknown HTTP status.'; } // if the body wasn't defined, default to the inbuilt response if (!$body) $body = $this->codes[$code];...
[ "public", "function", "send", "(", "$", "code", ",", "$", "body", "=", "''", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "codes", "[", "$", "code", "]", ")", ")", "{", "$", "statusCode", "=", "500", ";", "$", "body", "=", "'API...
Output a JSON formatted response of the supplied body param, along with the supplied code param as the HTTP status code. @param int $code @param mixed $body
[ "Output", "a", "JSON", "formatted", "response", "of", "the", "supplied", "body", "param", "along", "with", "the", "supplied", "code", "param", "as", "the", "HTTP", "status", "code", "." ]
train
https://github.com/ndavison/groundwork-framework/blob/c3d22a1410c8d8a07b4ca1f99a35a1181516cd6c/src/Groundwork/Classes/Response.php#L46-L58
praxigento/mobi_mod_pv
Plugin/Magento/Sales/Model/ResourceModel/Order/Collection.php
Collection.aroundAddFieldToSelect
public function aroundAddFieldToSelect( \Magento\Sales\Model\ResourceModel\Order\Collection $subject, \Closure $proceed, $field, $alias = null ) { /** @var \Magento\Sales\Model\ResourceModel\Order\Collection $result */ $result = $proceed($field, $alias); if ($...
php
public function aroundAddFieldToSelect( \Magento\Sales\Model\ResourceModel\Order\Collection $subject, \Closure $proceed, $field, $alias = null ) { /** @var \Magento\Sales\Model\ResourceModel\Order\Collection $result */ $result = $proceed($field, $alias); if ($...
[ "public", "function", "aroundAddFieldToSelect", "(", "\\", "Magento", "\\", "Sales", "\\", "Model", "\\", "ResourceModel", "\\", "Order", "\\", "Collection", "$", "subject", ",", "\\", "Closure", "$", "proceed", ",", "$", "field", ",", "$", "alias", "=", "...
Add PV data to sales orders collection when all fields are added ('*'). Method 'addFieldToSelect' is called from method 'addAttributeToSelect'. @param \Magento\Sales\Model\ResourceModel\Order\Collection $subject @param \Closure $proceed @param $field @param null $alias @return \Magento\Sales\Model\ResourceModel\Order...
[ "Add", "PV", "data", "to", "sales", "orders", "collection", "when", "all", "fields", "are", "added", "(", "*", ")", "." ]
train
https://github.com/praxigento/mobi_mod_pv/blob/d1540b7e94264527006e8b9fa68904a72a63928e/Plugin/Magento/Sales/Model/ResourceModel/Order/Collection.php#L38-L51
praxigento/mobi_mod_pv
Plugin/Magento/Sales/Model/ResourceModel/Order/Collection.php
Collection.queryAddPv
private function queryAddPv($query) { $asSales = $this->getAliasForMainTable($query); if ($asSales) { /* there is 'sales_order' table - we can JOIN our tables to get PV */ $tbl = $this->resource->getTableName(EPvSale::ENTITY_NAME); $as = self::AS_PV_SALE; ...
php
private function queryAddPv($query) { $asSales = $this->getAliasForMainTable($query); if ($asSales) { /* there is 'sales_order' table - we can JOIN our tables to get PV */ $tbl = $this->resource->getTableName(EPvSale::ENTITY_NAME); $as = self::AS_PV_SALE; ...
[ "private", "function", "queryAddPv", "(", "$", "query", ")", "{", "$", "asSales", "=", "$", "this", "->", "getAliasForMainTable", "(", "$", "query", ")", ";", "if", "(", "$", "asSales", ")", "{", "/* there is 'sales_order' table - we can JOIN our tables to get PV ...
Add PV to original query. @param $query @throws \Zend_Db_Select_Exception
[ "Add", "PV", "to", "original", "query", "." ]
train
https://github.com/praxigento/mobi_mod_pv/blob/d1540b7e94264527006e8b9fa68904a72a63928e/Plugin/Magento/Sales/Model/ResourceModel/Order/Collection.php#L81-L96
benjamindulau/BarbeQ
src/BarbeQ/Adapter/PDOAdapter.php
PdoAdapter.publish
public function publish($queue, MessageInterface $message) { $sql = 'INSERT INTO %s (%s, %s, %s, %s, %s)' . ' VALUES (:body, :queue, :state, :priority, :metadata)'; $sql = sprintf($sql, $this->dbOptions['table'], $this->dbOptions['body'], $this->d...
php
public function publish($queue, MessageInterface $message) { $sql = 'INSERT INTO %s (%s, %s, %s, %s, %s)' . ' VALUES (:body, :queue, :state, :priority, :metadata)'; $sql = sprintf($sql, $this->dbOptions['table'], $this->dbOptions['body'], $this->d...
[ "public", "function", "publish", "(", "$", "queue", ",", "MessageInterface", "$", "message", ")", "{", "$", "sql", "=", "'INSERT INTO %s (%s, %s, %s, %s, %s)'", ".", "' VALUES (:body, :queue, :state, :priority, :metadata)'", ";", "$", "sql", "=", "sprintf", "(", "$", ...
{@inheritDoc}
[ "{" ]
train
https://github.com/benjamindulau/BarbeQ/blob/d1fd7caa1ba700ac317282948c6fc9d62fe6d523/src/BarbeQ/Adapter/PDOAdapter.php#L39-L62
deesoft/yii2-rest
BasicController.php
BasicController.viewDetail
protected function viewDetail($id, $field) { $model = $this->findModel($id); $definition = array_merge($model->fields(), $model->extraFields()); if (isset($definition[$field])) { return is_string($definition[$field]) ? $model->{$definition[$field]} : call_user_func($definition[$f...
php
protected function viewDetail($id, $field) { $model = $this->findModel($id); $definition = array_merge($model->fields(), $model->extraFields()); if (isset($definition[$field])) { return is_string($definition[$field]) ? $model->{$definition[$field]} : call_user_func($definition[$f...
[ "protected", "function", "viewDetail", "(", "$", "id", ",", "$", "field", ")", "{", "$", "model", "=", "$", "this", "->", "findModel", "(", "$", "id", ")", ";", "$", "definition", "=", "array_merge", "(", "$", "model", "->", "fields", "(", ")", ","...
Displays a single filed of model. @param integer $id @return mixed
[ "Displays", "a", "single", "filed", "of", "model", "." ]
train
https://github.com/deesoft/yii2-rest/blob/c33f145fbfa2bc138dffdd2f9408a2a461153128/BasicController.php#L72-L82
deesoft/yii2-rest
BasicController.php
BasicController.actionCreate
public function actionCreate() { /* @var $model ActiveRecord */ $model = $this->createModel(); $model->load(Yii::$app->request->post(), ''); $model->save(); return $model; }
php
public function actionCreate() { /* @var $model ActiveRecord */ $model = $this->createModel(); $model->load(Yii::$app->request->post(), ''); $model->save(); return $model; }
[ "public", "function", "actionCreate", "(", ")", "{", "/* @var $model ActiveRecord */", "$", "model", "=", "$", "this", "->", "createModel", "(", ")", ";", "$", "model", "->", "load", "(", "Yii", "::", "$", "app", "->", "request", "->", "post", "(", ")", ...
Creates a new model. If creation is successful, the browser will be redirected to the 'view' page. @return mixed
[ "Creates", "a", "new", "model", ".", "If", "creation", "is", "successful", "the", "browser", "will", "be", "redirected", "to", "the", "view", "page", "." ]
train
https://github.com/deesoft/yii2-rest/blob/c33f145fbfa2bc138dffdd2f9408a2a461153128/BasicController.php#L89-L97
deesoft/yii2-rest
BasicController.php
BasicController.actionPatch
public function actionPatch($id) { $model = $this->findModel($id); $patchs = Yii::$app->request->post(); foreach ($patchs as $patch) { $this->doPatch($model, $patch); } $model->save(); return $model; }
php
public function actionPatch($id) { $model = $this->findModel($id); $patchs = Yii::$app->request->post(); foreach ($patchs as $patch) { $this->doPatch($model, $patch); } $model->save(); return $model; }
[ "public", "function", "actionPatch", "(", "$", "id", ")", "{", "$", "model", "=", "$", "this", "->", "findModel", "(", "$", "id", ")", ";", "$", "patchs", "=", "Yii", "::", "$", "app", "->", "request", "->", "post", "(", ")", ";", "foreach", "(",...
Updates an existing model. If update is successful, the browser will be redirected to the 'view' page. @param integer $id @return mixed
[ "Updates", "an", "existing", "model", ".", "If", "update", "is", "successful", "the", "browser", "will", "be", "redirected", "to", "the", "view", "page", "." ]
train
https://github.com/deesoft/yii2-rest/blob/c33f145fbfa2bc138dffdd2f9408a2a461153128/BasicController.php#L120-L131
Danack/Jig
src/Jig/JigBase.php
JigBase.callFunction
protected function callFunction($functionName) { $functionArgs = func_get_args(); $params = array_splice($functionArgs, 1); foreach ($this->plugins as $plugin) { $functionList = $plugin->getFunctionList(); if (in_array($functionName, $functionList) === true) ...
php
protected function callFunction($functionName) { $functionArgs = func_get_args(); $params = array_splice($functionArgs, 1); foreach ($this->plugins as $plugin) { $functionList = $plugin->getFunctionList(); if (in_array($functionName, $functionList) === true) ...
[ "protected", "function", "callFunction", "(", "$", "functionName", ")", "{", "$", "functionArgs", "=", "func_get_args", "(", ")", ";", "$", "params", "=", "array_splice", "(", "$", "functionArgs", ",", "1", ")", ";", "foreach", "(", "$", "this", "->", "p...
Used to call a function in a template @param $functionName @return mixed @throws JigException
[ "Used", "to", "call", "a", "function", "in", "a", "template" ]
train
https://github.com/Danack/Jig/blob/b11106bc7d634add9873bf246eda1dadb059ed7a/src/Jig/JigBase.php#L59-L72
Danack/Jig
src/Jig/JigBase.php
JigBase.startRenderBlock
protected function startRenderBlock($blockName, $segmentText) { foreach ($this->plugins as $plugin) { $blockRenderList = $plugin->getBlockRenderList(); if (in_array($blockName, $blockRenderList) === true) { echo $plugin->callBlockRenderStart($blockName, $segmentText);...
php
protected function startRenderBlock($blockName, $segmentText) { foreach ($this->plugins as $plugin) { $blockRenderList = $plugin->getBlockRenderList(); if (in_array($blockName, $blockRenderList) === true) { echo $plugin->callBlockRenderStart($blockName, $segmentText);...
[ "protected", "function", "startRenderBlock", "(", "$", "blockName", ",", "$", "segmentText", ")", "{", "foreach", "(", "$", "this", "->", "plugins", "as", "$", "plugin", ")", "{", "$", "blockRenderList", "=", "$", "plugin", "->", "getBlockRenderList", "(", ...
Called when a block is started in a template. @param $blockName @param $segmentText @throws JigException
[ "Called", "when", "a", "block", "is", "started", "in", "a", "template", "." ]
train
https://github.com/Danack/Jig/blob/b11106bc7d634add9873bf246eda1dadb059ed7a/src/Jig/JigBase.php#L81-L92
Danack/Jig
src/Jig/JigBase.php
JigBase.endRenderBlock
protected function endRenderBlock($blockName) { $contents = ob_get_contents(); ob_end_clean(); foreach ($this->plugins as $plugin) { $blockRenderList = $plugin->getBlockRenderList(); if (in_array($blockName, $blockRenderList) === true) { echo $plugin->...
php
protected function endRenderBlock($blockName) { $contents = ob_get_contents(); ob_end_clean(); foreach ($this->plugins as $plugin) { $blockRenderList = $plugin->getBlockRenderList(); if (in_array($blockName, $blockRenderList) === true) { echo $plugin->...
[ "protected", "function", "endRenderBlock", "(", "$", "blockName", ")", "{", "$", "contents", "=", "ob_get_contents", "(", ")", ";", "ob_end_clean", "(", ")", ";", "foreach", "(", "$", "this", "->", "plugins", "as", "$", "plugin", ")", "{", "$", "blockRen...
Called when a block is ended in a template. @param $blockName @throws JigException
[ "Called", "when", "a", "block", "is", "ended", "in", "a", "template", "." ]
train
https://github.com/Danack/Jig/blob/b11106bc7d634add9873bf246eda1dadb059ed7a/src/Jig/JigBase.php#L99-L112
eureka-framework/component-host
src/Host/Host.php
Host.uri
public function uri($name, $baseUri = null) { if (empty($baseUri)) { $baseUri = $this->baseUri; } return $baseUri . $this->get($name); }
php
public function uri($name, $baseUri = null) { if (empty($baseUri)) { $baseUri = $this->baseUri; } return $baseUri . $this->get($name); }
[ "public", "function", "uri", "(", "$", "name", ",", "$", "baseUri", "=", "null", ")", "{", "if", "(", "empty", "(", "$", "baseUri", ")", ")", "{", "$", "baseUri", "=", "$", "this", "->", "baseUri", ";", "}", "return", "$", "baseUri", ".", "$", ...
Get uri @param string $name @param string $baseUri @return string
[ "Get", "uri" ]
train
https://github.com/eureka-framework/component-host/blob/ba5b3bd2b0c053635d91a783f34ebe0b376fa736/src/Host/Host.php#L80-L88
Hnto/nuki
src/Handlers/Process/Authentication.php
Authentication.searchValue
private function searchValue(array $values = [], array $requestInputs = []) { foreach($values as $value) { if (!array_key_exists($value, $requestInputs)) { continue; } return $requestInputs[$value]; } return null; }
php
private function searchValue(array $values = [], array $requestInputs = []) { foreach($values as $value) { if (!array_key_exists($value, $requestInputs)) { continue; } return $requestInputs[$value]; } return null; }
[ "private", "function", "searchValue", "(", "array", "$", "values", "=", "[", "]", ",", "array", "$", "requestInputs", "=", "[", "]", ")", "{", "foreach", "(", "$", "values", "as", "$", "value", ")", "{", "if", "(", "!", "array_key_exists", "(", "$", ...
Search given value from ids of values @param array $values @param array $requestInputs @return mixed
[ "Search", "given", "value", "from", "ids", "of", "values" ]
train
https://github.com/Hnto/nuki/blob/c3fb16244e8d611c335a88e3b9c9ee7d81fafc0c/src/Handlers/Process/Authentication.php#L102-L112
enikeishik/ufoframework
src/Ufo/StorableCache/MysqlStorage.php
MysqlStorage.has
public function has(string $key): bool { $sql = 'SELECT COUNT(*) AS Cnt FROM #__' . $this->table . " WHERE `" . $this->keyField . "`='" . $this->db->addEscape($key) . "'"; $cnt = $this->db->getValue($sql, 'Cnt'); if (null === $cnt) { return false; } ...
php
public function has(string $key): bool { $sql = 'SELECT COUNT(*) AS Cnt FROM #__' . $this->table . " WHERE `" . $this->keyField . "`='" . $this->db->addEscape($key) . "'"; $cnt = $this->db->getValue($sql, 'Cnt'); if (null === $cnt) { return false; } ...
[ "public", "function", "has", "(", "string", "$", "key", ")", ":", "bool", "{", "$", "sql", "=", "'SELECT COUNT(*) AS Cnt FROM #__'", ".", "$", "this", "->", "table", ".", "\" WHERE `\"", ".", "$", "this", "->", "keyField", ".", "\"`='\"", ".", "$", "this...
Determines whether an item is present in the cache. @param string $key @return bool
[ "Determines", "whether", "an", "item", "is", "present", "in", "the", "cache", "." ]
train
https://github.com/enikeishik/ufoframework/blob/fb44461bcb0506dbc3257724a2281f756594f62f/src/Ufo/StorableCache/MysqlStorage.php#L104-L113
enikeishik/ufoframework
src/Ufo/StorableCache/MysqlStorage.php
MysqlStorage.getPacket
public function getPacket(string $key): Packet { $sql = 'SELECT ' . '`' . $this->valueField . '`, `' . $this->timestampField . '`,' . '`' . $this->lifetimeField . '`, `' . $this->savetimeField . '`' . ' FROM `' . $this->table . '`' . ' WHERE `...
php
public function getPacket(string $key): Packet { $sql = 'SELECT ' . '`' . $this->valueField . '`, `' . $this->timestampField . '`,' . '`' . $this->lifetimeField . '`, `' . $this->savetimeField . '`' . ' FROM `' . $this->table . '`' . ' WHERE `...
[ "public", "function", "getPacket", "(", "string", "$", "key", ")", ":", "Packet", "{", "$", "sql", "=", "'SELECT '", ".", "'`'", ".", "$", "this", "->", "valueField", ".", "'`, `'", ".", "$", "this", "->", "timestampField", ".", "'`,'", ".", "'`'", "...
Fetches an item (packet) from the cache. @param string $key @return \Ufo\StorableCache\Packet @throws \Ufo\StorableCache\BadPacketException
[ "Fetches", "an", "item", "(", "packet", ")", "from", "the", "cache", "." ]
train
https://github.com/enikeishik/ufoframework/blob/fb44461bcb0506dbc3257724a2281f756594f62f/src/Ufo/StorableCache/MysqlStorage.php#L124-L142
enikeishik/ufoframework
src/Ufo/StorableCache/MysqlStorage.php
MysqlStorage.set
public function set(string $key, string $value, int $lifetime, int $savetime): bool { if (!$this->has($key)) { $sql = 'INSERT INTO #__' . $this->table . '(' . '`' . $this->keyField . '`, ' . '`' . $this->valueField . '`, ' ...
php
public function set(string $key, string $value, int $lifetime, int $savetime): bool { if (!$this->has($key)) { $sql = 'INSERT INTO #__' . $this->table . '(' . '`' . $this->keyField . '`, ' . '`' . $this->valueField . '`, ' ...
[ "public", "function", "set", "(", "string", "$", "key", ",", "string", "$", "value", ",", "int", "$", "lifetime", ",", "int", "$", "savetime", ")", ":", "bool", "{", "if", "(", "!", "$", "this", "->", "has", "(", "$", "key", ")", ")", "{", "$",...
Persists data in the cache, uniquely referenced by a key with an optional lifetime and time to save. @param string $key The key of the item to store. @param string $value The value of the item to store. @param int $lifetime The lifetime value of this item. The library must store items with expired lifetime. @param i...
[ "Persists", "data", "in", "the", "cache", "uniquely", "referenced", "by", "a", "key", "with", "an", "optional", "lifetime", "and", "time", "to", "save", "." ]
train
https://github.com/enikeishik/ufoframework/blob/fb44461bcb0506dbc3257724a2281f756594f62f/src/Ufo/StorableCache/MysqlStorage.php#L156-L185
enikeishik/ufoframework
src/Ufo/StorableCache/MysqlStorage.php
MysqlStorage.delete
public function delete(string $key): bool { $sql = 'DELETE FROM #__' . $this->table . " WHERE `" . $this->keyField . "`='" . $this->db->addEscape($key) . "'"; return $this->db->query($sql); }
php
public function delete(string $key): bool { $sql = 'DELETE FROM #__' . $this->table . " WHERE `" . $this->keyField . "`='" . $this->db->addEscape($key) . "'"; return $this->db->query($sql); }
[ "public", "function", "delete", "(", "string", "$", "key", ")", ":", "bool", "{", "$", "sql", "=", "'DELETE FROM #__'", ".", "$", "this", "->", "table", ".", "\" WHERE `\"", ".", "$", "this", "->", "keyField", ".", "\"`='\"", ".", "$", "this", "->", ...
Delete an item from the cache by its unique key. @param string $key The unique cache key of the item to delete. @return bool True if the item was successfully removed. False if there was an error.
[ "Delete", "an", "item", "from", "the", "cache", "by", "its", "unique", "key", "." ]
train
https://github.com/enikeishik/ufoframework/blob/fb44461bcb0506dbc3257724a2281f756594f62f/src/Ufo/StorableCache/MysqlStorage.php#L194-L200
enikeishik/ufoframework
src/Ufo/StorableCache/MysqlStorage.php
MysqlStorage.deleteOutdated
public function deleteOutdated(): bool { $sql = 'DELETE FROM `' . $this->table . '`' . ' WHERE `' . $this->savetimeField . '`<' . '(' . time() . '-`' . $this->timestampField . '`)'; return $this->db->query($sql); }
php
public function deleteOutdated(): bool { $sql = 'DELETE FROM `' . $this->table . '`' . ' WHERE `' . $this->savetimeField . '`<' . '(' . time() . '-`' . $this->timestampField . '`)'; return $this->db->query($sql); }
[ "public", "function", "deleteOutdated", "(", ")", ":", "bool", "{", "$", "sql", "=", "'DELETE FROM `'", ".", "$", "this", "->", "table", ".", "'`'", ".", "' WHERE `'", ".", "$", "this", "->", "savetimeField", ".", "'`<'", ".", "'('", ".", "time", "(", ...
Deletes all outdated (time to save expired) cache items in a single operation. @return bool True on success and false on failure.
[ "Deletes", "all", "outdated", "(", "time", "to", "save", "expired", ")", "cache", "items", "in", "a", "single", "operation", "." ]
train
https://github.com/enikeishik/ufoframework/blob/fb44461bcb0506dbc3257724a2281f756594f62f/src/Ufo/StorableCache/MysqlStorage.php#L207-L213
yii2module/yii2-article
src/widgets/PostList.php
PostList.run
public function run() { $collection = \App::$domain->article->article->allByNames($this->names); return $this->render('list', ['collection' => $collection]); }
php
public function run() { $collection = \App::$domain->article->article->allByNames($this->names); return $this->render('list', ['collection' => $collection]); }
[ "public", "function", "run", "(", ")", "{", "$", "collection", "=", "\\", "App", "::", "$", "domain", "->", "article", "->", "article", "->", "allByNames", "(", "$", "this", "->", "names", ")", ";", "return", "$", "this", "->", "render", "(", "'list'...
Runs the widget
[ "Runs", "the", "widget" ]
train
https://github.com/yii2module/yii2-article/blob/f9468a892eaa5186393a26356e696e3cc9fa1441/src/widgets/PostList.php#L16-L20
eventerza/module-sql-storage
src/Services/MysqlClient.php
MysqlClient.getAll
public function getAll(string $table, int $page = 0): array { try { $this->db->beginTransaction(); $sql = "SELECT * FROM $table"; if ($page > 0) { $sql = $sql . " LIMIT " . self::LIMIT . " OFFSET " . self::LIMIT * ($page - 1); } /...
php
public function getAll(string $table, int $page = 0): array { try { $this->db->beginTransaction(); $sql = "SELECT * FROM $table"; if ($page > 0) { $sql = $sql . " LIMIT " . self::LIMIT . " OFFSET " . self::LIMIT * ($page - 1); } /...
[ "public", "function", "getAll", "(", "string", "$", "table", ",", "int", "$", "page", "=", "0", ")", ":", "array", "{", "try", "{", "$", "this", "->", "db", "->", "beginTransaction", "(", ")", ";", "$", "sql", "=", "\"SELECT * FROM $table\"", ";", "i...
@param string $table @param int $page @return array
[ "@param", "string", "$table" ]
train
https://github.com/eventerza/module-sql-storage/blob/4eaf8f064c86de94dfba100c160146f86524ff8b/src/Services/MysqlClient.php#L41-L64
eventerza/module-sql-storage
src/Services/MysqlClient.php
MysqlClient.getBy
public function getBy(string $table, string $field, $value): array { $result = $this->getByFilter($table, array($field), array($value)); if (empty($result)) { throw new NotFoundException($value . ' not found.'); } return $result[0]; }
php
public function getBy(string $table, string $field, $value): array { $result = $this->getByFilter($table, array($field), array($value)); if (empty($result)) { throw new NotFoundException($value . ' not found.'); } return $result[0]; }
[ "public", "function", "getBy", "(", "string", "$", "table", ",", "string", "$", "field", ",", "$", "value", ")", ":", "array", "{", "$", "result", "=", "$", "this", "->", "getByFilter", "(", "$", "table", ",", "array", "(", "$", "field", ")", ",", ...
@param string $table @param string $field @param string $value @return array
[ "@param", "string", "$table", "@param", "string", "$field", "@param", "string", "$value" ]
train
https://github.com/eventerza/module-sql-storage/blob/4eaf8f064c86de94dfba100c160146f86524ff8b/src/Services/MysqlClient.php#L73-L82
eventerza/module-sql-storage
src/Services/MysqlClient.php
MysqlClient.getNumberOf
public function getNumberOf(string $table, array $fields, array $values, string $connectionPhrase = "AND"): int { try { $this->db->beginTransaction(); $query = "SELECT count(*) as numberOfEntities FROM $table "; $query = $query . $this->buildWhereCondition($fields, $con...
php
public function getNumberOf(string $table, array $fields, array $values, string $connectionPhrase = "AND"): int { try { $this->db->beginTransaction(); $query = "SELECT count(*) as numberOfEntities FROM $table "; $query = $query . $this->buildWhereCondition($fields, $con...
[ "public", "function", "getNumberOf", "(", "string", "$", "table", ",", "array", "$", "fields", ",", "array", "$", "values", ",", "string", "$", "connectionPhrase", "=", "\"AND\"", ")", ":", "int", "{", "try", "{", "$", "this", "->", "db", "->", "beginT...
@param string $table @param array $fields @param array $values @param string $connectionPhrase @return int
[ "@param", "string", "$table", "@param", "array", "$fields", "@param", "array", "$values", "@param", "string", "$connectionPhrase" ]
train
https://github.com/eventerza/module-sql-storage/blob/4eaf8f064c86de94dfba100c160146f86524ff8b/src/Services/MysqlClient.php#L127-L148
eventerza/module-sql-storage
src/Services/MysqlClient.php
MysqlClient.getWhereIn
public function getWhereIn(string $table, string $field, array $values): array { try { $this->db->beginTransaction(); $query = "SELECT * FROM $table WHERE $field IN (" . implode(',', $values) . ")"; /** @var PDOStatement $stmt */ $stmt = $this->db->prepare($...
php
public function getWhereIn(string $table, string $field, array $values): array { try { $this->db->beginTransaction(); $query = "SELECT * FROM $table WHERE $field IN (" . implode(',', $values) . ")"; /** @var PDOStatement $stmt */ $stmt = $this->db->prepare($...
[ "public", "function", "getWhereIn", "(", "string", "$", "table", ",", "string", "$", "field", ",", "array", "$", "values", ")", ":", "array", "{", "try", "{", "$", "this", "->", "db", "->", "beginTransaction", "(", ")", ";", "$", "query", "=", "\"SEL...
@param string $table @param string $field @param array $values @return array @throws NotFoundException
[ "@param", "string", "$table", "@param", "string", "$field", "@param", "array", "$values" ]
train
https://github.com/eventerza/module-sql-storage/blob/4eaf8f064c86de94dfba100c160146f86524ff8b/src/Services/MysqlClient.php#L158-L181
eventerza/module-sql-storage
src/Services/MysqlClient.php
MysqlClient.save
public function save(string $table, array $data): array { try { $this->db->beginTransaction(); $query = "INSERT INTO $table (" . implode(', ', array_keys($data)) . ") VALUES (" . substr(str_repeat(', ?', count($data)), 1) . ...
php
public function save(string $table, array $data): array { try { $this->db->beginTransaction(); $query = "INSERT INTO $table (" . implode(', ', array_keys($data)) . ") VALUES (" . substr(str_repeat(', ?', count($data)), 1) . ...
[ "public", "function", "save", "(", "string", "$", "table", ",", "array", "$", "data", ")", ":", "array", "{", "try", "{", "$", "this", "->", "db", "->", "beginTransaction", "(", ")", ";", "$", "query", "=", "\"INSERT INTO $table (\"", ".", "implode", "...
@param string $table @param array $data @return array
[ "@param", "string", "$table", "@param", "array", "$data" ]
train
https://github.com/eventerza/module-sql-storage/blob/4eaf8f064c86de94dfba100c160146f86524ff8b/src/Services/MysqlClient.php#L200-L226
eventerza/module-sql-storage
src/Services/MysqlClient.php
MysqlClient.delete
public function delete(string $table, string $id): bool { return $this->deleteWhere($table, 'id', $id); }
php
public function delete(string $table, string $id): bool { return $this->deleteWhere($table, 'id', $id); }
[ "public", "function", "delete", "(", "string", "$", "table", ",", "string", "$", "id", ")", ":", "bool", "{", "return", "$", "this", "->", "deleteWhere", "(", "$", "table", ",", "'id'", ",", "$", "id", ")", ";", "}" ]
@param string $table @param string $id @return bool
[ "@param", "string", "$table", "@param", "string", "$id" ]
train
https://github.com/eventerza/module-sql-storage/blob/4eaf8f064c86de94dfba100c160146f86524ff8b/src/Services/MysqlClient.php#L234-L237
eventerza/module-sql-storage
src/Services/MysqlClient.php
MysqlClient.deleteWhere
public function deleteWhere(string $table, string $field, string $value): bool { try { $this->db->beginTransaction(); /** @var PDOStatement $stmt */ $stmt = $this->db->prepare("DELETE FROM $table WHERE $field = ?"); $stmt->execute(array($value)); ...
php
public function deleteWhere(string $table, string $field, string $value): bool { try { $this->db->beginTransaction(); /** @var PDOStatement $stmt */ $stmt = $this->db->prepare("DELETE FROM $table WHERE $field = ?"); $stmt->execute(array($value)); ...
[ "public", "function", "deleteWhere", "(", "string", "$", "table", ",", "string", "$", "field", ",", "string", "$", "value", ")", ":", "bool", "{", "try", "{", "$", "this", "->", "db", "->", "beginTransaction", "(", ")", ";", "/** @var PDOStatement $stmt */...
@param string $table @param string $field @param string $value @return bool
[ "@param", "string", "$table", "@param", "string", "$field", "@param", "string", "$value" ]
train
https://github.com/eventerza/module-sql-storage/blob/4eaf8f064c86de94dfba100c160146f86524ff8b/src/Services/MysqlClient.php#L246-L266
eventerza/module-sql-storage
src/Services/MysqlClient.php
MysqlClient.buildWhereCondition
private function buildWhereCondition(array $fields, string $connectionPhrase): string { $query = ""; foreach ($fields as $key => $field) { if ($key == 0) { $connectionPhrase = "WHERE"; } $query = $query . " " . $connectionPhrase . " $field = ?"; ...
php
private function buildWhereCondition(array $fields, string $connectionPhrase): string { $query = ""; foreach ($fields as $key => $field) { if ($key == 0) { $connectionPhrase = "WHERE"; } $query = $query . " " . $connectionPhrase . " $field = ?"; ...
[ "private", "function", "buildWhereCondition", "(", "array", "$", "fields", ",", "string", "$", "connectionPhrase", ")", ":", "string", "{", "$", "query", "=", "\"\"", ";", "foreach", "(", "$", "fields", "as", "$", "key", "=>", "$", "field", ")", "{", "...
@param array $fields @param string $connectionPhrase @param $query @return string
[ "@param", "array", "$fields", "@param", "string", "$connectionPhrase", "@param", "$query" ]
train
https://github.com/eventerza/module-sql-storage/blob/4eaf8f064c86de94dfba100c160146f86524ff8b/src/Services/MysqlClient.php#L275-L286
oliverde8/MPDedicatedServerBundle
Service/DedicatedServer.php
DedicatedServer.getServerInfo
public function getServerInfo($login) { static $lockAcquired = false; if (isset($this->servers[$login])) { $cacheKey = $this->_getServerInfoCacheKey($login); $cacheResult = $this->serverInfoCache->fetch($cacheKey); if ($cacheResult) { return $cach...
php
public function getServerInfo($login) { static $lockAcquired = false; if (isset($this->servers[$login])) { $cacheKey = $this->_getServerInfoCacheKey($login); $cacheResult = $this->serverInfoCache->fetch($cacheKey); if ($cacheResult) { return $cach...
[ "public", "function", "getServerInfo", "(", "$", "login", ")", "{", "static", "$", "lockAcquired", "=", "false", ";", "if", "(", "isset", "(", "$", "this", "->", "servers", "[", "$", "login", "]", ")", ")", "{", "$", "cacheKey", "=", "$", "this", "...
Returns server information. If server information not in cache will make call to the dedicated server. Try to use this with ajax calls in order to have a faster website. @param string $login Login of the server @return ServerInfo|null
[ "Returns", "server", "information", ".", "If", "server", "information", "not", "in", "cache", "will", "make", "call", "to", "the", "dedicated", "server", ".", "Try", "to", "use", "this", "with", "ajax", "calls", "in", "order", "to", "have", "a", "faster", ...
train
https://github.com/oliverde8/MPDedicatedServerBundle/blob/c0cab0b0089a1273032ddf4bbf0287e7aee8fceb/Service/DedicatedServer.php#L73-L107
oliverde8/MPDedicatedServerBundle
Service/DedicatedServer.php
DedicatedServer.getServerChatLines
public function getServerChatLines($login) { static $lockAcquired = false; if (isset($this->servers[$login])) { $cacheKey = $this->_getServerChatCacheKey($login); $cacheResult = $this->serverInfoCache->fetch($cacheKey); if ($cacheResult) { return ...
php
public function getServerChatLines($login) { static $lockAcquired = false; if (isset($this->servers[$login])) { $cacheKey = $this->_getServerChatCacheKey($login); $cacheResult = $this->serverInfoCache->fetch($cacheKey); if ($cacheResult) { return ...
[ "public", "function", "getServerChatLines", "(", "$", "login", ")", "{", "static", "$", "lockAcquired", "=", "false", ";", "if", "(", "isset", "(", "$", "this", "->", "servers", "[", "$", "login", "]", ")", ")", "{", "$", "cacheKey", "=", "$", "this"...
Returns chat lines. Try to use this with ajax calls in order to have a faster website. @param string $login Login of the server @return ServerInfo|null
[ "Returns", "chat", "lines", ".", "Try", "to", "use", "this", "with", "ajax", "calls", "in", "order", "to", "have", "a", "faster", "website", "." ]
train
https://github.com/oliverde8/MPDedicatedServerBundle/blob/c0cab0b0089a1273032ddf4bbf0287e7aee8fceb/Service/DedicatedServer.php#L117-L158
oliverde8/MPDedicatedServerBundle
Service/DedicatedServer.php
DedicatedServer.getMapList
public function getMapList($login) { static $lockAcquired = false; if (isset($this->servers[$login])) { $cacheKey = $this->_getServerMapsCacheKey($login); $cacheResult = $this->serverInfoCache->fetch($cacheKey); if ($cacheResult) { return $cacheResult...
php
public function getMapList($login) { static $lockAcquired = false; if (isset($this->servers[$login])) { $cacheKey = $this->_getServerMapsCacheKey($login); $cacheResult = $this->serverInfoCache->fetch($cacheKey); if ($cacheResult) { return $cacheResult...
[ "public", "function", "getMapList", "(", "$", "login", ")", "{", "static", "$", "lockAcquired", "=", "false", ";", "if", "(", "isset", "(", "$", "this", "->", "servers", "[", "$", "login", "]", ")", ")", "{", "$", "cacheKey", "=", "$", "this", "->"...
Returns list of maps on the server. If list of map not in cache will make a call to the dedicatd server. Try to use this with ajax calls in order to have a faster website. @param string $login Login of the server @return \Maniaplanet\DedicatedServer\Structures\Map[]
[ "Returns", "list", "of", "maps", "on", "the", "server", ".", "If", "list", "of", "map", "not", "in", "cache", "will", "make", "a", "call", "to", "the", "dedicatd", "server", ".", "Try", "to", "use", "this", "with", "ajax", "calls", "in", "order", "to...
train
https://github.com/oliverde8/MPDedicatedServerBundle/blob/c0cab0b0089a1273032ddf4bbf0287e7aee8fceb/Service/DedicatedServer.php#L168-L207
oliverde8/MPDedicatedServerBundle
Service/DedicatedServer.php
DedicatedServer.getServerNames
public function getServerNames() { $serverNames = array(); foreach($this->servers as $login => $data) { $serverNames[$login] = $data['name']; } return $serverNames; }
php
public function getServerNames() { $serverNames = array(); foreach($this->servers as $login => $data) { $serverNames[$login] = $data['name']; } return $serverNames; }
[ "public", "function", "getServerNames", "(", ")", "{", "$", "serverNames", "=", "array", "(", ")", ";", "foreach", "(", "$", "this", "->", "servers", "as", "$", "login", "=>", "$", "data", ")", "{", "$", "serverNames", "[", "$", "login", "]", "=", ...
Returns login, server name association. This is the name you defined in the config and therfore won't make any dedicated calls. @return String[]
[ "Returns", "login", "server", "name", "association", ".", "This", "is", "the", "name", "you", "defined", "in", "the", "config", "and", "therfore", "won", "t", "make", "any", "dedicated", "calls", "." ]
train
https://github.com/oliverde8/MPDedicatedServerBundle/blob/c0cab0b0089a1273032ddf4bbf0287e7aee8fceb/Service/DedicatedServer.php#L215-L221
oliverde8/MPDedicatedServerBundle
Service/DedicatedServer.php
DedicatedServer.getConnection
public function getConnection($login) { if (isset($this->servers[$login])) { if (!isset($this->connections[$login])) { $conf = $this->servers[$login]; $this->connections[$login] = Connection::factory($conf['host'], $conf['port'], 1, $conf['user'], $conf['password']);...
php
public function getConnection($login) { if (isset($this->servers[$login])) { if (!isset($this->connections[$login])) { $conf = $this->servers[$login]; $this->connections[$login] = Connection::factory($conf['host'], $conf['port'], 1, $conf['user'], $conf['password']);...
[ "public", "function", "getConnection", "(", "$", "login", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "servers", "[", "$", "login", "]", ")", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "connections", "[", "$", "login", "...
Connects to the dedicated server API, if connection already established will send existing connextion @param string $login Server to connect to @return Connection
[ "Connects", "to", "the", "dedicated", "server", "API", "if", "connection", "already", "established", "will", "send", "existing", "connextion" ]
train
https://github.com/oliverde8/MPDedicatedServerBundle/blob/c0cab0b0089a1273032ddf4bbf0287e7aee8fceb/Service/DedicatedServer.php#L301-L312
TransformCore/CSR-Fast-Stream-Domain-Model
src/TransformCore/Bundle/CsrFastStreamBundle/Form/Validation/Applicant.php
Applicant.validate
public static function validate(FormInterface $form) { $groups = array('CsrProfile'); $groups[] = self::password($form); return array_filter( array_unique($groups) ); }
php
public static function validate(FormInterface $form) { $groups = array('CsrProfile'); $groups[] = self::password($form); return array_filter( array_unique($groups) ); }
[ "public", "static", "function", "validate", "(", "FormInterface", "$", "form", ")", "{", "$", "groups", "=", "array", "(", "'CsrProfile'", ")", ";", "$", "groups", "[", "]", "=", "self", "::", "password", "(", "$", "form", ")", ";", "return", "array_fi...
@param FormInterface $form @return array
[ "@param", "FormInterface", "$form" ]
train
https://github.com/TransformCore/CSR-Fast-Stream-Domain-Model/blob/cb8e4c446f814082663a20f3c5d4cea8292bd8d6/src/TransformCore/Bundle/CsrFastStreamBundle/Form/Validation/Applicant.php#L18-L27
TransformCore/CSR-Fast-Stream-Domain-Model
src/TransformCore/Bundle/CsrFastStreamBundle/Form/Validation/Applicant.php
Applicant.password
private static function password(FormInterface $form) { if ($form->has('credentials_group')) { $credentialsGroup = $form->get('credentials_group'); if ($credentialsGroup->has('plainPassword')) { $plainPasswordElement = $credentialsGroup->get('plainPassword'); ...
php
private static function password(FormInterface $form) { if ($form->has('credentials_group')) { $credentialsGroup = $form->get('credentials_group'); if ($credentialsGroup->has('plainPassword')) { $plainPasswordElement = $credentialsGroup->get('plainPassword'); ...
[ "private", "static", "function", "password", "(", "FormInterface", "$", "form", ")", "{", "if", "(", "$", "form", "->", "has", "(", "'credentials_group'", ")", ")", "{", "$", "credentialsGroup", "=", "$", "form", "->", "get", "(", "'credentials_group'", ")...
@param FormInterface $form @return mixed
[ "@param", "FormInterface", "$form" ]
train
https://github.com/TransformCore/CSR-Fast-Stream-Domain-Model/blob/cb8e4c446f814082663a20f3c5d4cea8292bd8d6/src/TransformCore/Bundle/CsrFastStreamBundle/Form/Validation/Applicant.php#L34-L47
balintsera/evista-perform
src/FormMarkupTranspiler.php
FormMarkupTranspiler.findFormClassName
public function findFormClassName() { $this->runIfNotCached( 'formClassName', function () { return $this->findFormTag()->attr(self:: FORM_CLASS_NAME_ATTR_NAME); } ); return $this->formClassName; }
php
public function findFormClassName() { $this->runIfNotCached( 'formClassName', function () { return $this->findFormTag()->attr(self:: FORM_CLASS_NAME_ATTR_NAME); } ); return $this->formClassName; }
[ "public", "function", "findFormClassName", "(", ")", "{", "$", "this", "->", "runIfNotCached", "(", "'formClassName'", ",", "function", "(", ")", "{", "return", "$", "this", "->", "findFormTag", "(", ")", "->", "attr", "(", "self", "::", "FORM_CLASS_NAME_ATT...
Get class-name for the form
[ "Get", "class", "-", "name", "for", "the", "form" ]
train
https://github.com/balintsera/evista-perform/blob/2b8723852ebe824ed721f30293e1e0d2c14f4b21/src/FormMarkupTranspiler.php#L70-L80
balintsera/evista-perform
src/FormMarkupTranspiler.php
FormMarkupTranspiler.transpileFields
private function transpileFields() { $formElements = 'input, select, textarea, button'; $this->findFormTag()->filter($formElements)->each( function (Crawler $node, $i) { // If it has a type attr, use as type if (null !== $node->attr('type')) { ...
php
private function transpileFields() { $formElements = 'input, select, textarea, button'; $this->findFormTag()->filter($formElements)->each( function (Crawler $node, $i) { // If it has a type attr, use as type if (null !== $node->attr('type')) { ...
[ "private", "function", "transpileFields", "(", ")", "{", "$", "formElements", "=", "'input, select, textarea, button'", ";", "$", "this", "->", "findFormTag", "(", ")", "->", "filter", "(", "$", "formElements", ")", "->", "each", "(", "function", "(", "Crawler...
Find fields in markup
[ "Find", "fields", "in", "markup" ]
train
https://github.com/balintsera/evista-perform/blob/2b8723852ebe824ed721f30293e1e0d2c14f4b21/src/FormMarkupTranspiler.php#L112-L161
balintsera/evista-perform
src/FormMarkupTranspiler.php
FormMarkupTranspiler.runIfNotCached
private function runIfNotCached($variableName, callable $function) { if (null === $this->{$variableName}) { // Only assign that don't returns if (null !== $result = $function()) { $this->{$variableName} = $result; } } }
php
private function runIfNotCached($variableName, callable $function) { if (null === $this->{$variableName}) { // Only assign that don't returns if (null !== $result = $function()) { $this->{$variableName} = $result; } } }
[ "private", "function", "runIfNotCached", "(", "$", "variableName", ",", "callable", "$", "function", ")", "{", "if", "(", "null", "===", "$", "this", "->", "{", "$", "variableName", "}", ")", "{", "// Only assign that don't returns", "if", "(", "null", "!=="...
Check if a variable is empty and run function to @param $variableName @param callable $function
[ "Check", "if", "a", "variable", "is", "empty", "and", "run", "function", "to" ]
train
https://github.com/balintsera/evista-perform/blob/2b8723852ebe824ed721f30293e1e0d2c14f4b21/src/FormMarkupTranspiler.php#L248-L256
DeimosProject/Controller
src/Controller/Controller.php
Controller.execute
public function execute() { $this->configure(); $this->before(); $name = $this->request()->attribute($this->attribute); if (!$this->methodExists($name)) { throw new NotFound('Action \'' . $name . '\' not found!'); } $data = $this->instance($name...
php
public function execute() { $this->configure(); $this->before(); $name = $this->request()->attribute($this->attribute); if (!$this->methodExists($name)) { throw new NotFound('Action \'' . $name . '\' not found!'); } $data = $this->instance($name...
[ "public", "function", "execute", "(", ")", "{", "$", "this", "->", "configure", "(", ")", ";", "$", "this", "->", "before", "(", ")", ";", "$", "name", "=", "$", "this", "->", "request", "(", ")", "->", "attribute", "(", "$", "this", "->", "attri...
@return mixed @throws \InvalidArgumentException @throws RequestNotFound @throws DisplayNone @throws NotFound
[ "@return", "mixed" ]
train
https://github.com/DeimosProject/Controller/blob/b16e3c14ca26d7da1d9be6a953782e401ffdcc0d/src/Controller/Controller.php#L22-L39
DeimosProject/Controller
src/Controller/Controller.php
Controller.display
protected function display($data) { if (is_string($data)) { return $data; } if (is_array($data) || $data instanceof \stdClass) { return $this->helper()->json()->encode($data); } throw new DisplayNone('Undefined value \'' . $data . '\'...
php
protected function display($data) { if (is_string($data)) { return $data; } if (is_array($data) || $data instanceof \stdClass) { return $this->helper()->json()->encode($data); } throw new DisplayNone('Undefined value \'' . $data . '\'...
[ "protected", "function", "display", "(", "$", "data", ")", "{", "if", "(", "is_string", "(", "$", "data", ")", ")", "{", "return", "$", "data", ";", "}", "if", "(", "is_array", "(", "$", "data", ")", "||", "$", "data", "instanceof", "\\", "stdClass...
@inheritdoc @throws \InvalidArgumentException @throws DisplayNone
[ "@inheritdoc" ]
train
https://github.com/DeimosProject/Controller/blob/b16e3c14ca26d7da1d9be6a953782e401ffdcc0d/src/Controller/Controller.php#L47-L60
yuncms/yii2-ueditor-widget
UEditor.php
UEditor.init
public function init() { parent::init(); if (!isset ($this->options ['id'])) { $this->options ['id'] = $this->getId(); } $this->clientOptions = array_merge([ 'autoHeightEnabled' => true, 'initialFrameWidth' => '100%', 'initialFrameHeig...
php
public function init() { parent::init(); if (!isset ($this->options ['id'])) { $this->options ['id'] = $this->getId(); } $this->clientOptions = array_merge([ 'autoHeightEnabled' => true, 'initialFrameWidth' => '100%', 'initialFrameHeig...
[ "public", "function", "init", "(", ")", "{", "parent", "::", "init", "(", ")", ";", "if", "(", "!", "isset", "(", "$", "this", "->", "options", "[", "'id'", "]", ")", ")", "{", "$", "this", "->", "options", "[", "'id'", "]", "=", "$", "this", ...
{@inheritDoc} @see \yii\base\Object::init()
[ "{" ]
train
https://github.com/yuncms/yii2-ueditor-widget/blob/0adc733d60f2cd4777227a0237605965495a9b47/UEditor.php#L33-L47
black-lamp/blcms-cart
models/SearchOrder.php
SearchOrder.search
public function search($params) { $query = Order::find()->where(['not in','status', [OrderStatus::STATUS_INCOMPLETE]]); $query->orderBy(['status' => SORT_ASC, 'id' => SORT_DESC]); // add conditions that should always apply here $dataProvider = new ActiveDataProvider([ ...
php
public function search($params) { $query = Order::find()->where(['not in','status', [OrderStatus::STATUS_INCOMPLETE]]); $query->orderBy(['status' => SORT_ASC, 'id' => SORT_DESC]); // add conditions that should always apply here $dataProvider = new ActiveDataProvider([ ...
[ "public", "function", "search", "(", "$", "params", ")", "{", "$", "query", "=", "Order", "::", "find", "(", ")", "->", "where", "(", "[", "'not in'", ",", "'status'", ",", "[", "OrderStatus", "::", "STATUS_INCOMPLETE", "]", "]", ")", ";", "$", "quer...
Creates data provider instance with search query applied @param array $params @return ActiveDataProvider
[ "Creates", "data", "provider", "instance", "with", "search", "query", "applied" ]
train
https://github.com/black-lamp/blcms-cart/blob/314796eecae3ca4ed5fecfdc0231a738af50eba7/models/SearchOrder.php#L44-L74
DeimosProject/Helper
src/Helper/Traits/Helper.php
Helper.instanceHelper
protected function instanceHelper() { if (method_exists($this->builder, 'helper')) { return $this->builder->helper(); } return new DeimosHelper($this->builder); }
php
protected function instanceHelper() { if (method_exists($this->builder, 'helper')) { return $this->builder->helper(); } return new DeimosHelper($this->builder); }
[ "protected", "function", "instanceHelper", "(", ")", "{", "if", "(", "method_exists", "(", "$", "this", "->", "builder", ",", "'helper'", ")", ")", "{", "return", "$", "this", "->", "builder", "->", "helper", "(", ")", ";", "}", "return", "new", "Deimo...
@return DeimosHelper @throws \InvalidArgumentException
[ "@return", "DeimosHelper" ]
train
https://github.com/DeimosProject/Helper/blob/39c67de21a87c7c6391b2f98416063f41c94e26f/src/Helper/Traits/Helper.php#L41-L49