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
nabab/bbn
src/bbn/appui/mapper.php
mapper.get_default_field_config
public function get_default_field_config($table, $column){ // Looks in the db for columns corresponding to the given table if ( $this->db && bbn\str::check_name($column) && ($table_cfg = $this->db->modelize($table)) && isset($table_cfg['fields'][$column]) ){ $col = $table_cfg['fie...
php
public function get_default_field_config($table, $column){ // Looks in the db for columns corresponding to the given table if ( $this->db && bbn\str::check_name($column) && ($table_cfg = $this->db->modelize($table)) && isset($table_cfg['fields'][$column]) ){ $col = $table_cfg['fie...
[ "public", "function", "get_default_field_config", "(", "$", "table", ",", "$", "column", ")", "{", "// Looks in the db for columns corresponding to the given table", "if", "(", "$", "this", "->", "db", "&&", "bbn", "\\", "str", "::", "check_name", "(", "$", "colum...
Creates an array for configuring an instance of input for a given field in a given table @param string $table The database's table @param string $column The table's column @return array $cfg a configuration array for bbn\html\input
[ "Creates", "an", "array", "for", "configuring", "an", "instance", "of", "input", "for", "a", "given", "field", "in", "a", "given", "table" ]
train
https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/appui/mapper.php#L610-L723
nabab/bbn
src/bbn/appui/mapper.php
mapper.update
public function update($db=''){ if ( empty($db) ){ $db = $this->db->current; } if ( bbn\str::check_name($db) ){ $this->db->clear_all_cache(); $change = $this->db->current === $db ? false : $this->db->current; if ( $change ){ $this->db->change($db); } $schema = $this->db->modelize(); ...
php
public function update($db=''){ if ( empty($db) ){ $db = $this->db->current; } if ( bbn\str::check_name($db) ){ $this->db->clear_all_cache(); $change = $this->db->current === $db ? false : $this->db->current; if ( $change ){ $this->db->change($db); } $schema = $this->db->modelize(); ...
[ "public", "function", "update", "(", "$", "db", "=", "''", ")", "{", "if", "(", "empty", "(", "$", "db", ")", ")", "{", "$", "db", "=", "$", "this", "->", "db", "->", "current", ";", "}", "if", "(", "bbn", "\\", "str", "::", "check_name", "("...
Empties the structure tables for a given database and refill them with the current structure @param string $db @return void
[ "Empties", "the", "structure", "tables", "for", "a", "given", "database", "and", "refill", "them", "with", "the", "current", "structure" ]
train
https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/appui/mapper.php#L731-L878
wenbinye/PhalconX
src/Validation/ValidatorFactory.php
ValidatorFactory.create
public function create($options, Context $context = null) { $validators = []; if (!empty($options['required'])) { $validators[] = new PresenceOf(); } $type = ArrayHelper::fetch($options, 'type'); if (isset($type)) { if ($type == 'datetime') { ...
php
public function create($options, Context $context = null) { $validators = []; if (!empty($options['required'])) { $validators[] = new PresenceOf(); } $type = ArrayHelper::fetch($options, 'type'); if (isset($type)) { if ($type == 'datetime') { ...
[ "public", "function", "create", "(", "$", "options", ",", "Context", "$", "context", "=", "null", ")", "{", "$", "validators", "=", "[", "]", ";", "if", "(", "!", "empty", "(", "$", "options", "[", "'required'", "]", ")", ")", "{", "$", "validators...
options 可指定以下选项: - required - type - pattern - element - min - max - exclusiveMinimum - exclusiveMaximum - maxLength - minLength - enum - attribute
[ "options", "可指定以下选项:", "-", "required", "-", "type", "-", "pattern", "-", "element", "-", "min", "-", "max", "-", "exclusiveMinimum", "-", "exclusiveMaximum", "-", "maxLength", "-", "minLength", "-", "enum", "-", "attribute" ]
train
https://github.com/wenbinye/PhalconX/blob/0d2e1480e722dde56ccd23b2e8a5c8ac6ac2f8e1/src/Validation/ValidatorFactory.php#L57-L121
rhosocial/yii2-user
widgets/UserListWidget.php
UserListWidget.init
public function init() { if (empty($this->dataProvider)) { throw new ServerErrorHttpException('Invalid User Provider.'); } if (is_string($this->actionColumn) && strtolower($this->actionColumn) == self::ACTION_COLUMN_DEFAULT) { $this->actionColumn = [ '...
php
public function init() { if (empty($this->dataProvider)) { throw new ServerErrorHttpException('Invalid User Provider.'); } if (is_string($this->actionColumn) && strtolower($this->actionColumn) == self::ACTION_COLUMN_DEFAULT) { $this->actionColumn = [ '...
[ "public", "function", "init", "(", ")", "{", "if", "(", "empty", "(", "$", "this", "->", "dataProvider", ")", ")", "{", "throw", "new", "ServerErrorHttpException", "(", "'Invalid User Provider.'", ")", ";", "}", "if", "(", "is_string", "(", "$", "this", ...
Initialize attributes.
[ "Initialize", "attributes", "." ]
train
https://github.com/rhosocial/yii2-user/blob/96737a9d8ca7e9c42cd2b7736d6c0a90ede6e5bc/widgets/UserListWidget.php#L63-L92
rhosocial/yii2-user
widgets/UserListWidget.php
UserListWidget.run
public function run() { return $this->render('user-list', [ 'dataProvider' => $this->dataProvider, 'additionalColumns' => $this->additionalColumns, 'actionColumn' => $this->actionColumn, 'visible' => $this->visible, 'tips' => $this->tips, ]...
php
public function run() { return $this->render('user-list', [ 'dataProvider' => $this->dataProvider, 'additionalColumns' => $this->additionalColumns, 'actionColumn' => $this->actionColumn, 'visible' => $this->visible, 'tips' => $this->tips, ]...
[ "public", "function", "run", "(", ")", "{", "return", "$", "this", "->", "render", "(", "'user-list'", ",", "[", "'dataProvider'", "=>", "$", "this", "->", "dataProvider", ",", "'additionalColumns'", "=>", "$", "this", "->", "additionalColumns", ",", "'actio...
Run action. @return string
[ "Run", "action", "." ]
train
https://github.com/rhosocial/yii2-user/blob/96737a9d8ca7e9c42cd2b7736d6c0a90ede6e5bc/widgets/UserListWidget.php#L98-L107
tylernathanreed/flash
src/Flash.php
Flash.flash
private function flash($type, $message) { // Determine the Current Session Flash Type $flash = Session::has($type) ? Session::get($type) : array(); // Prevent Duplicate Messages from Appearing if(!in_array($message, $flash)) $flash[] = $message; // Add the Message to the Flashes // Flash the Message S...
php
private function flash($type, $message) { // Determine the Current Session Flash Type $flash = Session::has($type) ? Session::get($type) : array(); // Prevent Duplicate Messages from Appearing if(!in_array($message, $flash)) $flash[] = $message; // Add the Message to the Flashes // Flash the Message S...
[ "private", "function", "flash", "(", "$", "type", ",", "$", "message", ")", "{", "// Determine the Current Session Flash Type", "$", "flash", "=", "Session", "::", "has", "(", "$", "type", ")", "?", "Session", "::", "get", "(", "$", "type", ")", ":", "ar...
Flashes a Message to the Session. @param string $type The Type of Message to Flash. @param string $message The Message to Flash. @return void
[ "Flashes", "a", "Message", "to", "the", "Session", "." ]
train
https://github.com/tylernathanreed/flash/blob/6ca4b361493e7e48e3c3cf6b1ed95f8a1b2b724c/src/Flash.php#L82-L93
nabab/bbn
src/bbn/appui/mailbox.php
mailbox.list_subscribed
private function list_subscribed($dir){ if ( $this->is_connected() ){ return imap_lsub($this->stream, $this->mbParam, $dir); } return false; }
php
private function list_subscribed($dir){ if ( $this->is_connected() ){ return imap_lsub($this->stream, $this->mbParam, $dir); } return false; }
[ "private", "function", "list_subscribed", "(", "$", "dir", ")", "{", "if", "(", "$", "this", "->", "is_connected", "(", ")", ")", "{", "return", "imap_lsub", "(", "$", "this", "->", "stream", ",", "$", "this", "->", "mbParam", ",", "$", "dir", ")", ...
Returns an array containing the names of the mailboxes that you have subscribed. (Test: ok) @param string $dir Mailbox directory @return bool|array
[ "Returns", "an", "array", "containing", "the", "names", "of", "the", "mailboxes", "that", "you", "have", "subscribed", ".", "(", "Test", ":", "ok", ")" ]
train
https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/appui/mailbox.php#L31-L36
nabab/bbn
src/bbn/appui/mailbox.php
mailbox.list_mboxes
private function list_mboxes($dir){ if ( $this->is_connected() ){ return imap_list($this->stream, $this->mbParam, $dir); } return false; }
php
private function list_mboxes($dir){ if ( $this->is_connected() ){ return imap_list($this->stream, $this->mbParam, $dir); } return false; }
[ "private", "function", "list_mboxes", "(", "$", "dir", ")", "{", "if", "(", "$", "this", "->", "is_connected", "(", ")", ")", "{", "return", "imap_list", "(", "$", "this", "->", "stream", ",", "$", "this", "->", "mbParam", ",", "$", "dir", ")", ";"...
Returns an array containing the full names of the mailboxes. (Test: ok) @param string $dir Mailbox directory @return bool|array
[ "Returns", "an", "array", "containing", "the", "full", "names", "of", "the", "mailboxes", ".", "(", "Test", ":", "ok", ")" ]
train
https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/appui/mailbox.php#L44-L49
nabab/bbn
src/bbn/appui/mailbox.php
mailbox.get_mboxes
private function get_mboxes($dir){ if ( $this->is_connected() ){ return imap_getmailboxes($this->stream, $this->mbParam, $dir); } return false; }
php
private function get_mboxes($dir){ if ( $this->is_connected() ){ return imap_getmailboxes($this->stream, $this->mbParam, $dir); } return false; }
[ "private", "function", "get_mboxes", "(", "$", "dir", ")", "{", "if", "(", "$", "this", "->", "is_connected", "(", ")", ")", "{", "return", "imap_getmailboxes", "(", "$", "this", "->", "stream", ",", "$", "this", "->", "mbParam", ",", "$", "dir", ")"...
Returns an array of objects containing detailed mailboxes information. (Test: ok) @param string $dir Mailbox directory @return array|bool
[ "Returns", "an", "array", "of", "objects", "containing", "detailed", "mailboxes", "information", ".", "(", "Test", ":", "ok", ")" ]
train
https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/appui/mailbox.php#L57-L62
nabab/bbn
src/bbn/appui/mailbox.php
mailbox.get_names_mboxes
private function get_names_mboxes($dir){ if ( $mboxes = $this->get_mboxes($dir) ){ $i = 0; $ret = []; while( list($key, $val) = each($mboxes) ){ $name = imap_utf7_decode($val->name); $name_arr = explode('}', $name); $j = \count($name_arr) - 1; $mbox_name = $name_arr...
php
private function get_names_mboxes($dir){ if ( $mboxes = $this->get_mboxes($dir) ){ $i = 0; $ret = []; while( list($key, $val) = each($mboxes) ){ $name = imap_utf7_decode($val->name); $name_arr = explode('}', $name); $j = \count($name_arr) - 1; $mbox_name = $name_arr...
[ "private", "function", "get_names_mboxes", "(", "$", "dir", ")", "{", "if", "(", "$", "mboxes", "=", "$", "this", "->", "get_mboxes", "(", "$", "dir", ")", ")", "{", "$", "i", "=", "0", ";", "$", "ret", "=", "[", "]", ";", "while", "(", "list",...
Returns a sorted array containing the simple names of the mailboxes. (Test: ok) @param string $dir Mailbox directory @return array
[ "Returns", "a", "sorted", "array", "containing", "the", "simple", "names", "of", "the", "mailboxes", ".", "(", "Test", ":", "ok", ")" ]
train
https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/appui/mailbox.php#L70-L88
nabab/bbn
src/bbn/appui/mailbox.php
mailbox.get_decode_value
private function get_decode_value($message, $coding){ if ( $coding === 0 ){ $message = imap_8bit($message); } else if ( $coding === 1 ){ $message = imap_8bit($message); } else if ( $coding === 2 ){ $message = imap_binary($message); } else if ( $coding === 3 ){ $messag...
php
private function get_decode_value($message, $coding){ if ( $coding === 0 ){ $message = imap_8bit($message); } else if ( $coding === 1 ){ $message = imap_8bit($message); } else if ( $coding === 2 ){ $message = imap_binary($message); } else if ( $coding === 3 ){ $messag...
[ "private", "function", "get_decode_value", "(", "$", "message", ",", "$", "coding", ")", "{", "if", "(", "$", "coding", "===", "0", ")", "{", "$", "message", "=", "imap_8bit", "(", "$", "message", ")", ";", "}", "else", "if", "(", "$", "coding", "=...
Decodes message. (Test: ok) @param string $message Messate to decode @param int $coding Type of encoding @return string
[ "Decodes", "message", ".", "(", "Test", ":", "ok", ")" ]
train
https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/appui/mailbox.php#L97-L117
nabab/bbn
src/bbn/appui/mailbox.php
mailbox.get_imap
public function get_imap(){ if ( $this->imap = imap_check($this->stream) ){ if ( $this->imap->Nmsgs > 0 ){ $this->last_uid = $this->get_msg_uid($this->imap->Nmsgs); $this->num_msg = $this->imap->Nmsgs; } else { $this->last_uid = 0; $this->num_msg = 0; } ...
php
public function get_imap(){ if ( $this->imap = imap_check($this->stream) ){ if ( $this->imap->Nmsgs > 0 ){ $this->last_uid = $this->get_msg_uid($this->imap->Nmsgs); $this->num_msg = $this->imap->Nmsgs; } else { $this->last_uid = 0; $this->num_msg = 0; } ...
[ "public", "function", "get_imap", "(", ")", "{", "if", "(", "$", "this", "->", "imap", "=", "imap_check", "(", "$", "this", "->", "stream", ")", ")", "{", "if", "(", "$", "this", "->", "imap", "->", "Nmsgs", ">", "0", ")", "{", "$", "this", "->...
Gets IMAP essential info (Test: ok) @return object|bool
[ "Gets", "IMAP", "essential", "info", "(", "Test", ":", "ok", ")" ]
train
https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/appui/mailbox.php#L283-L296
nabab/bbn
src/bbn/appui/mailbox.php
mailbox.create_mbox
public function create_mbox($mbox){ if ( $this->is_connected() ){ return imap_createmailbox($this->stream, $this->mbParam. $mbox); } return false; }
php
public function create_mbox($mbox){ if ( $this->is_connected() ){ return imap_createmailbox($this->stream, $this->mbParam. $mbox); } return false; }
[ "public", "function", "create_mbox", "(", "$", "mbox", ")", "{", "if", "(", "$", "this", "->", "is_connected", "(", ")", ")", "{", "return", "imap_createmailbox", "(", "$", "this", "->", "stream", ",", "$", "this", "->", "mbParam", ".", "$", "mbox", ...
Creates a mailbox (Test: ok) @param string $mbox Mailbox name @return bool
[ "Creates", "a", "mailbox", "(", "Test", ":", "ok", ")" ]
train
https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/appui/mailbox.php#L314-L319
nabab/bbn
src/bbn/appui/mailbox.php
mailbox.delete_mbox
public function delete_mbox($mbox){ if ( $this->is_connected() ){ return imap_deletemailbox($this->stream, $this->mbParam . $mbox); } return false; }
php
public function delete_mbox($mbox){ if ( $this->is_connected() ){ return imap_deletemailbox($this->stream, $this->mbParam . $mbox); } return false; }
[ "public", "function", "delete_mbox", "(", "$", "mbox", ")", "{", "if", "(", "$", "this", "->", "is_connected", "(", ")", ")", "{", "return", "imap_deletemailbox", "(", "$", "this", "->", "stream", ",", "$", "this", "->", "mbParam", ".", "$", "mbox", ...
Deletes a mailbox (Test: ok) @param string $mbox Mailbox @return bool
[ "Deletes", "a", "mailbox", "(", "Test", ":", "ok", ")" ]
train
https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/appui/mailbox.php#L327-L332
nabab/bbn
src/bbn/appui/mailbox.php
mailbox.rename_mbox
public function rename_mbox($old, $new){ if ( $this->is_connected() ){ return imap_renamemailbox($this->stream, $this->mbParam. $old, $this->mbParam. $new); } return false; }
php
public function rename_mbox($old, $new){ if ( $this->is_connected() ){ return imap_renamemailbox($this->stream, $this->mbParam. $old, $this->mbParam. $new); } return false; }
[ "public", "function", "rename_mbox", "(", "$", "old", ",", "$", "new", ")", "{", "if", "(", "$", "this", "->", "is_connected", "(", ")", ")", "{", "return", "imap_renamemailbox", "(", "$", "this", "->", "stream", ",", "$", "this", "->", "mbParam", "....
Renames a mailbox (Test: ok) @param string $old Old mailbox name @param string $new New mailbox name @return bool
[ "Renames", "a", "mailbox", "(", "Test", ":", "ok", ")" ]
train
https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/appui/mailbox.php#L341-L346
nabab/bbn
src/bbn/appui/mailbox.php
mailbox.reopen_mbox
public function reopen_mbox($mbox){ if ( $this->is_connected() ){ if ( \in_array($mbox, $this->get_all_names_mboxes()) ){ return imap_reopen($this->stream, $this->mbParam . $mbox); } else { return imap_reopen($this->stream, $mbox); } } return false; }
php
public function reopen_mbox($mbox){ if ( $this->is_connected() ){ if ( \in_array($mbox, $this->get_all_names_mboxes()) ){ return imap_reopen($this->stream, $this->mbParam . $mbox); } else { return imap_reopen($this->stream, $mbox); } } return false; }
[ "public", "function", "reopen_mbox", "(", "$", "mbox", ")", "{", "if", "(", "$", "this", "->", "is_connected", "(", ")", ")", "{", "if", "(", "\\", "in_array", "(", "$", "mbox", ",", "$", "this", "->", "get_all_names_mboxes", "(", ")", ")", ")", "{...
Reopens the desired mailbox (you can give it the simple name or the full name). (Test: ok) If the given name is not existing it opens the default inbox. @param string $mbox Simple/full mailbox name @return bool
[ "Reopens", "the", "desired", "mailbox", "(", "you", "can", "give", "it", "the", "simple", "name", "or", "the", "full", "name", ")", ".", "(", "Test", ":", "ok", ")", "If", "the", "given", "name", "is", "not", "existing", "it", "opens", "the", "defaul...
train
https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/appui/mailbox.php#L431-L441
nabab/bbn
src/bbn/appui/mailbox.php
mailbox.sort_mbox
public function sort_mbox($criteria, $reverse = 0){ if ( $this->is_connected() && !empty($criteria) ){ return imap_sort($this->stream, constant(strtoupper($criteria)), $reverse, SE_NOPREFETCH); } return false; }
php
public function sort_mbox($criteria, $reverse = 0){ if ( $this->is_connected() && !empty($criteria) ){ return imap_sort($this->stream, constant(strtoupper($criteria)), $reverse, SE_NOPREFETCH); } return false; }
[ "public", "function", "sort_mbox", "(", "$", "criteria", ",", "$", "reverse", "=", "0", ")", "{", "if", "(", "$", "this", "->", "is_connected", "(", ")", "&&", "!", "empty", "(", "$", "criteria", ")", ")", "{", "return", "imap_sort", "(", "$", "thi...
Sorts the mailbox. (Test: ok) Criteria can be one (and only one) of the following: SORTDATE - message Date SORTARRIVAL - arrival date SORTFROM - mailbox in first From address SORTSUBJECT - message subject SORTTO - mailbox in first To address SORTCC - mailbox in first cc address SORTSIZE - size of message in octets @pa...
[ "Sorts", "the", "mailbox", ".", "(", "Test", ":", "ok", ")", "Criteria", "can", "be", "one", "(", "and", "only", "one", ")", "of", "the", "following", ":", "SORTDATE", "-", "message", "Date", "SORTARRIVAL", "-", "arrival", "date", "SORTFROM", "-", "mai...
train
https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/appui/mailbox.php#L470-L475
nabab/bbn
src/bbn/appui/mailbox.php
mailbox.get_msg_header
public function get_msg_header($msgnum, $uid = false){ if ( $this->is_connected() ){ if ( $uid ){ return imap_fetchheader($this->stream, $msgnum, FT_UID); } return imap_fetchheader($this->stream, $msgnum); } return false; }
php
public function get_msg_header($msgnum, $uid = false){ if ( $this->is_connected() ){ if ( $uid ){ return imap_fetchheader($this->stream, $msgnum, FT_UID); } return imap_fetchheader($this->stream, $msgnum); } return false; }
[ "public", "function", "get_msg_header", "(", "$", "msgnum", ",", "$", "uid", "=", "false", ")", "{", "if", "(", "$", "this", "->", "is_connected", "(", ")", ")", "{", "if", "(", "$", "uid", ")", "{", "return", "imap_fetchheader", "(", "$", "this", ...
Fetches the header of the message. (Test: ok) @param int $msgnum No of the message @param int|bool $uid Set true f the msgnum is a UID @return bool|string
[ "Fetches", "the", "header", "of", "the", "message", ".", "(", "Test", ":", "ok", ")" ]
train
https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/appui/mailbox.php#L536-L544
nabab/bbn
src/bbn/appui/mailbox.php
mailbox.delete_msg
public function delete_msg($uid){ if ( $this->is_connected() ){ return imap_delete($this->stream, $this->get_msg_no($uid)); } return false; }
php
public function delete_msg($uid){ if ( $this->is_connected() ){ return imap_delete($this->stream, $this->get_msg_no($uid)); } return false; }
[ "public", "function", "delete_msg", "(", "$", "uid", ")", "{", "if", "(", "$", "this", "->", "is_connected", "(", ")", ")", "{", "return", "imap_delete", "(", "$", "this", "->", "stream", ",", "$", "this", "->", "get_msg_no", "(", "$", "uid", ")", ...
Mark the specified message for deletion from current mailbox. (Text: ok) @param int $uid UID of the message @return bool
[ "Mark", "the", "specified", "message", "for", "deletion", "from", "current", "mailbox", ".", "(", "Text", ":", "ok", ")" ]
train
https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/appui/mailbox.php#L552-L557
nabab/bbn
src/bbn/appui/mailbox.php
mailbox.move_msg
public function move_msg($uid, $tombox){ if ( $this->is_connected() ){ return imap_mail_move($this->stream, $uid, $tombox, CP_UID); } return false; }
php
public function move_msg($uid, $tombox){ if ( $this->is_connected() ){ return imap_mail_move($this->stream, $uid, $tombox, CP_UID); } return false; }
[ "public", "function", "move_msg", "(", "$", "uid", ",", "$", "tombox", ")", "{", "if", "(", "$", "this", "->", "is_connected", "(", ")", ")", "{", "return", "imap_mail_move", "(", "$", "this", "->", "stream", ",", "$", "uid", ",", "$", "tombox", ",...
Move the specified message to specified mailbox. (Test: ok) @param int $uid UID of the message @param string $tombox Destination mailbox name @return bool
[ "Move", "the", "specified", "message", "to", "specified", "mailbox", ".", "(", "Test", ":", "ok", ")" ]
train
https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/appui/mailbox.php#L566-L571
nabab/bbn
src/bbn/appui/mailbox.php
mailbox.get_msg_body
public function get_msg_body($msgno, $part){ if ( $this->is_connected() ){ if ( empty($part) ){ return imap_body($this->stream, $msgno); } return imap_fetchbody($this->stream, $msgno, $part); } return false; }
php
public function get_msg_body($msgno, $part){ if ( $this->is_connected() ){ if ( empty($part) ){ return imap_body($this->stream, $msgno); } return imap_fetchbody($this->stream, $msgno, $part); } return false; }
[ "public", "function", "get_msg_body", "(", "$", "msgno", ",", "$", "part", ")", "{", "if", "(", "$", "this", "->", "is_connected", "(", ")", ")", "{", "if", "(", "empty", "(", "$", "part", ")", ")", "{", "return", "imap_body", "(", "$", "this", "...
Fetches the body of the message. (Test: ok) @param int $msgno No of the message @param string|false $part The part number @return bool|string
[ "Fetches", "the", "body", "of", "the", "message", ".", "(", "Test", ":", "ok", ")" ]
train
https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/appui/mailbox.php#L592-L600
nabab/bbn
src/bbn/appui/mailbox.php
mailbox.set_msg_flag
public function set_msg_flag($seq, $flg, $remove=false){ if ( $this->is_connected() ){ return $remove ? imap_clearflag_full($this->stream, $seq, $flg) : imap_setflag_full($this->stream, $seq, $flg); } return false; }
php
public function set_msg_flag($seq, $flg, $remove=false){ if ( $this->is_connected() ){ return $remove ? imap_clearflag_full($this->stream, $seq, $flg) : imap_setflag_full($this->stream, $seq, $flg); } return false; }
[ "public", "function", "set_msg_flag", "(", "$", "seq", ",", "$", "flg", ",", "$", "remove", "=", "false", ")", "{", "if", "(", "$", "this", "->", "is_connected", "(", ")", ")", "{", "return", "$", "remove", "?", "imap_clearflag_full", "(", "$", "this...
Sets or removes flag/s on message/s. (Test: ok) The flags which you can set are \\Seen, \\Answered, \\Flagged, \\Deleted, and \\Draft. (Test: ok) @param string $seq A sequence of message numbers. Ex. "2,5,6" or "2:5:6" @param string $flg The flag/s. Ex. "\\Seen \\Flagged" @param bool $remove Set this to true to remove...
[ "Sets", "or", "removes", "flag", "/", "s", "on", "message", "/", "s", ".", "(", "Test", ":", "ok", ")", "The", "flags", "which", "you", "can", "set", "are", "\\\\", "Seen", "\\\\", "Answered", "\\\\", "Flagged", "\\\\", "Deleted", "and", "\\\\", "Dra...
train
https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/appui/mailbox.php#L611-L616
nabab/bbn
src/bbn/appui/mailbox.php
mailbox.search
public function search($criteria){ if ( $this->is_connected() ){ return imap_search($this->stream, $criteria, SE_UID); } return false; }
php
public function search($criteria){ if ( $this->is_connected() ){ return imap_search($this->stream, $criteria, SE_UID); } return false; }
[ "public", "function", "search", "(", "$", "criteria", ")", "{", "if", "(", "$", "this", "->", "is_connected", "(", ")", ")", "{", "return", "imap_search", "(", "$", "this", "->", "stream", ",", "$", "criteria", ",", "SE_UID", ")", ";", "}", "return",...
Search messages. (Test: ok) Returns an array of UIDs. Arguments: ALL - return all messages matching the rest of the criteria ANSWERED - match messages with the \\ANSWERED flag set BCC "string" - match messages with "string" in the Bcc: field BEFORE "date" - match messages with Date: before "date" BODY "string" - match...
[ "Search", "messages", ".", "(", "Test", ":", "ok", ")", "Returns", "an", "array", "of", "UIDs", "." ]
train
https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/appui/mailbox.php#L651-L656
nabab/bbn
src/bbn/appui/mailbox.php
mailbox.append
public function append($mbox, $msg){ if ( $this->is_connected() ){ return @imap_append($this->stream, $this->mbParam. $mbox, $msg); } return false; }
php
public function append($mbox, $msg){ if ( $this->is_connected() ){ return @imap_append($this->stream, $this->mbParam. $mbox, $msg); } return false; }
[ "public", "function", "append", "(", "$", "mbox", ",", "$", "msg", ")", "{", "if", "(", "$", "this", "->", "is_connected", "(", ")", ")", "{", "return", "@", "imap_append", "(", "$", "this", "->", "stream", ",", "$", "this", "->", "mbParam", ".", ...
Appends a string message to a specified mailbox. (Test: ok) @param string $mbox Destination mailbox name @param string $msg Message @return bool
[ "Appends", "a", "string", "message", "to", "a", "specified", "mailbox", ".", "(", "Test", ":", "ok", ")" ]
train
https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/appui/mailbox.php#L665-L670
nabab/bbn
src/bbn/appui/mailbox.php
mailbox.mbox_exists
public function mbox_exists($name){ if ( $this->is_connected() && !empty($name) ){ $names = $this->get_all_names_mboxes(); if ( !empty($names) && \in_array($name, $names) ){ return true; } } return false; }
php
public function mbox_exists($name){ if ( $this->is_connected() && !empty($name) ){ $names = $this->get_all_names_mboxes(); if ( !empty($names) && \in_array($name, $names) ){ return true; } } return false; }
[ "public", "function", "mbox_exists", "(", "$", "name", ")", "{", "if", "(", "$", "this", "->", "is_connected", "(", ")", "&&", "!", "empty", "(", "$", "name", ")", ")", "{", "$", "names", "=", "$", "this", "->", "get_all_names_mboxes", "(", ")", ";...
Check if a mailbox exists @param string $name The mailbox name @return bool
[ "Check", "if", "a", "mailbox", "exists" ]
train
https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/appui/mailbox.php#L710-L718
surebert/surebert-framework
src/sb/Gitlab/Project.php
Project.issueCreate
public function issueCreate($title, $description, $assignee_email, $labels='') { $post = [ 'id' => $this->id, 'title' => $title, 'description' => $description ]; if($assignee_email){ $user = new \sb\Gitlab\User($assignee_email, $t...
php
public function issueCreate($title, $description, $assignee_email, $labels='') { $post = [ 'id' => $this->id, 'title' => $title, 'description' => $description ]; if($assignee_email){ $user = new \sb\Gitlab\User($assignee_email, $t...
[ "public", "function", "issueCreate", "(", "$", "title", ",", "$", "description", ",", "$", "assignee_email", ",", "$", "labels", "=", "''", ")", "{", "$", "post", "=", "[", "'id'", "=>", "$", "this", "->", "id", ",", "'title'", "=>", "$", "title", ...
Adds an issue to a git repository @param string $title @param string $description @param string $assignee_email @return \Gitlab\Model\Issue @throws \Exception
[ "Adds", "an", "issue", "to", "a", "git", "repository" ]
train
https://github.com/surebert/surebert-framework/blob/f2f32eb693bd39385ceb93355efb5b2a429f27ce/src/sb/Gitlab/Project.php#L183-L200
surebert/surebert-framework
src/sb/Gitlab/Project.php
Project.issueClose
public function issueClose(\sb\Gitlab\Issue $issue){ $response = $this->_client->get("/projects/".$this->id."/issues/".$issue->id, [ 'state_event' => 'close' ], 'PUT'); if(is_object($response) && isset($response->message)){ throw new \Exception("Could not close ...
php
public function issueClose(\sb\Gitlab\Issue $issue){ $response = $this->_client->get("/projects/".$this->id."/issues/".$issue->id, [ 'state_event' => 'close' ], 'PUT'); if(is_object($response) && isset($response->message)){ throw new \Exception("Could not close ...
[ "public", "function", "issueClose", "(", "\\", "sb", "\\", "Gitlab", "\\", "Issue", "$", "issue", ")", "{", "$", "response", "=", "$", "this", "->", "_client", "->", "get", "(", "\"/projects/\"", ".", "$", "this", "->", "id", ".", "\"/issues/\"", ".", ...
Closes an issue by id within the project @param int $issue_id @return type
[ "Closes", "an", "issue", "by", "id", "within", "the", "project" ]
train
https://github.com/surebert/surebert-framework/blob/f2f32eb693bd39385ceb93355efb5b2a429f27ce/src/sb/Gitlab/Project.php#L207-L217
surebert/surebert-framework
src/sb/Gitlab/Project.php
Project.getByName
protected function getByName($project_name) { if (!strstr($project_name, ":")) { throw (new \Exception("You must search for project with namespace: prefix")); } $parts = explode(':', $project_name); $projects = $this->_client->get('/projects/search/' . urlencode($parts[1]))...
php
protected function getByName($project_name) { if (!strstr($project_name, ":")) { throw (new \Exception("You must search for project with namespace: prefix")); } $parts = explode(':', $project_name); $projects = $this->_client->get('/projects/search/' . urlencode($parts[1]))...
[ "protected", "function", "getByName", "(", "$", "project_name", ")", "{", "if", "(", "!", "strstr", "(", "$", "project_name", ",", "\":\"", ")", ")", "{", "throw", "(", "new", "\\", "Exception", "(", "\"You must search for project with namespace: prefix\"", ")",...
Loads project data by namespace:name @param string $project_name namespace:name @return \stdClass @throws \Exception
[ "Loads", "project", "data", "by", "namespace", ":", "name" ]
train
https://github.com/surebert/surebert-framework/blob/f2f32eb693bd39385ceb93355efb5b2a429f27ce/src/sb/Gitlab/Project.php#L242-L261
surebert/surebert-framework
src/sb/Gitlab/Project.php
Project.fromObject
public static function fromObject($object){ $issue = new \sb\Gitlab\P(); foreach(get_object_vars($object) as $k=>$v){ switch($k){ case 'assignee': case 'author': if(!is_object($v)){ $issue->{$k} = $v; ...
php
public static function fromObject($object){ $issue = new \sb\Gitlab\P(); foreach(get_object_vars($object) as $k=>$v){ switch($k){ case 'assignee': case 'author': if(!is_object($v)){ $issue->{$k} = $v; ...
[ "public", "static", "function", "fromObject", "(", "$", "object", ")", "{", "$", "issue", "=", "new", "\\", "sb", "\\", "Gitlab", "\\", "P", "(", ")", ";", "foreach", "(", "get_object_vars", "(", "$", "object", ")", "as", "$", "k", "=>", "$", "v", ...
Convert stdClass Object to actual \sb\Gitlab\Issue @param \stdClass $object @return \sb\Gitlab\Issue
[ "Convert", "stdClass", "Object", "to", "actual", "\\", "sb", "\\", "Gitlab", "\\", "Issue" ]
train
https://github.com/surebert/surebert-framework/blob/f2f32eb693bd39385ceb93355efb5b2a429f27ce/src/sb/Gitlab/Project.php#L277-L302
weew/http
src/Weew/Http/ReceivedHeadersParser.php
ReceivedHeadersParser.parseHeaders
public function parseHeaders(array $server, array $specialHeaders = []) { $specialHeaders = $this->getSpecialHeaders($specialHeaders); $headers = new HttpHeaders(); $this->extractPrefixedHeaders($headers, $server); $this->extractSpecialHeaders($headers, $server, $specialHeaders); ...
php
public function parseHeaders(array $server, array $specialHeaders = []) { $specialHeaders = $this->getSpecialHeaders($specialHeaders); $headers = new HttpHeaders(); $this->extractPrefixedHeaders($headers, $server); $this->extractSpecialHeaders($headers, $server, $specialHeaders); ...
[ "public", "function", "parseHeaders", "(", "array", "$", "server", ",", "array", "$", "specialHeaders", "=", "[", "]", ")", "{", "$", "specialHeaders", "=", "$", "this", "->", "getSpecialHeaders", "(", "$", "specialHeaders", ")", ";", "$", "headers", "=", ...
@param array $server @param array $specialHeaders @return HttpHeaders
[ "@param", "array", "$server", "@param", "array", "$specialHeaders" ]
train
https://github.com/weew/http/blob/fd34d3d5643ca01c8e0946e888224a8e8dcc3c0d/src/Weew/Http/ReceivedHeadersParser.php#L12-L21
weew/http
src/Weew/Http/ReceivedHeadersParser.php
ReceivedHeadersParser.formatHeaderAndRemovePrefix
public function formatHeaderAndRemovePrefix($header, $prefix = 'HTTP_') { if (str_starts_with($header, $prefix)) { $header = substr($header, strlen($prefix)); } return $this->formatHeader($header); }
php
public function formatHeaderAndRemovePrefix($header, $prefix = 'HTTP_') { if (str_starts_with($header, $prefix)) { $header = substr($header, strlen($prefix)); } return $this->formatHeader($header); }
[ "public", "function", "formatHeaderAndRemovePrefix", "(", "$", "header", ",", "$", "prefix", "=", "'HTTP_'", ")", "{", "if", "(", "str_starts_with", "(", "$", "header", ",", "$", "prefix", ")", ")", "{", "$", "header", "=", "substr", "(", "$", "header", ...
@param string $header @param string $prefix @return string
[ "@param", "string", "$header", "@param", "string", "$prefix" ]
train
https://github.com/weew/http/blob/fd34d3d5643ca01c8e0946e888224a8e8dcc3c0d/src/Weew/Http/ReceivedHeadersParser.php#L111-L117
weew/http
src/Weew/Http/ReceivedHeadersParser.php
ReceivedHeadersParser.findAuthHeader
protected function findAuthHeader(array $server) { if (array_has($server, 'HTTP_AUTHORIZATION')) { return array_get($server, 'HTTP_AUTHORIZATION'); } else if (array_has($server, 'REDIRECT_HTTP_AUTHORIZATION')) { return array_get($server, 'REDIRECT_HTTP_AUTHORIZATION'); } ...
php
protected function findAuthHeader(array $server) { if (array_has($server, 'HTTP_AUTHORIZATION')) { return array_get($server, 'HTTP_AUTHORIZATION'); } else if (array_has($server, 'REDIRECT_HTTP_AUTHORIZATION')) { return array_get($server, 'REDIRECT_HTTP_AUTHORIZATION'); } ...
[ "protected", "function", "findAuthHeader", "(", "array", "$", "server", ")", "{", "if", "(", "array_has", "(", "$", "server", ",", "'HTTP_AUTHORIZATION'", ")", ")", "{", "return", "array_get", "(", "$", "server", ",", "'HTTP_AUTHORIZATION'", ")", ";", "}", ...
@param array $server @return string|null
[ "@param", "array", "$server" ]
train
https://github.com/weew/http/blob/fd34d3d5643ca01c8e0946e888224a8e8dcc3c0d/src/Weew/Http/ReceivedHeadersParser.php#L136-L144
DevFactoryCH/api
src/Provider/RequestProvider.php
RequestProvider.put
public function put($url, $params = null) { $this->params = $params; $this->method = 'PUT'; $this->url = $url; return $this->request(); }
php
public function put($url, $params = null) { $this->params = $params; $this->method = 'PUT'; $this->url = $url; return $this->request(); }
[ "public", "function", "put", "(", "$", "url", ",", "$", "params", "=", "null", ")", "{", "$", "this", "->", "params", "=", "$", "params", ";", "$", "this", "->", "method", "=", "'PUT'", ";", "$", "this", "->", "url", "=", "$", "url", ";", "retu...
Make a PUT query @param data @return
[ "Make", "a", "PUT", "query" ]
train
https://github.com/DevFactoryCH/api/blob/ed239aac6e15cba23ae527b1d175c478d2b7d6ae/src/Provider/RequestProvider.php#L27-L33
DevFactoryCH/api
src/Provider/RequestProvider.php
RequestProvider.post
public function post($url, $params = null) { $this->params = $params; $this->method = 'POST'; $this->url = $url; return $this->request(); }
php
public function post($url, $params = null) { $this->params = $params; $this->method = 'POST'; $this->url = $url; return $this->request(); }
[ "public", "function", "post", "(", "$", "url", ",", "$", "params", "=", "null", ")", "{", "$", "this", "->", "params", "=", "$", "params", ";", "$", "this", "->", "method", "=", "'POST'", ";", "$", "this", "->", "url", "=", "$", "url", ";", "re...
Make a POST query @param data @return
[ "Make", "a", "POST", "query" ]
train
https://github.com/DevFactoryCH/api/blob/ed239aac6e15cba23ae527b1d175c478d2b7d6ae/src/Provider/RequestProvider.php#L42-L48
DevFactoryCH/api
src/Provider/RequestProvider.php
RequestProvider.get
public function get($url, $params = null) { $this->params = $params; $this->method = 'GET'; $this->url = $url; return $this->request(); }
php
public function get($url, $params = null) { $this->params = $params; $this->method = 'GET'; $this->url = $url; return $this->request(); }
[ "public", "function", "get", "(", "$", "url", ",", "$", "params", "=", "null", ")", "{", "$", "this", "->", "params", "=", "$", "params", ";", "$", "this", "->", "method", "=", "'GET'", ";", "$", "this", "->", "url", "=", "$", "url", ";", "retu...
Make a GET query @param data @return
[ "Make", "a", "GET", "query" ]
train
https://github.com/DevFactoryCH/api/blob/ed239aac6e15cba23ae527b1d175c478d2b7d6ae/src/Provider/RequestProvider.php#L57-L63
GrupaZero/api
src/Gzero/Api/Controller/Admin/BlockController.php
BlockController.index
public function index() { $this->authorize('readList', Block::class); $input = $this->validator->validate('list'); $params = $this->processor->process($input)->getProcessedFields(); $results = $this->repository->getBlocks( $params['filter'], $params['orderB...
php
public function index() { $this->authorize('readList', Block::class); $input = $this->validator->validate('list'); $params = $this->processor->process($input)->getProcessedFields(); $results = $this->repository->getBlocks( $params['filter'], $params['orderB...
[ "public", "function", "index", "(", ")", "{", "$", "this", "->", "authorize", "(", "'readList'", ",", "Block", "::", "class", ")", ";", "$", "input", "=", "$", "this", "->", "validator", "->", "validate", "(", "'list'", ")", ";", "$", "params", "=", ...
Display a listing of the resource. @return \Illuminate\Http\JsonResponse
[ "Display", "a", "listing", "of", "the", "resource", "." ]
train
https://github.com/GrupaZero/api/blob/fc544bb6057274e9d5e7b617346c3f854ea5effd/src/Gzero/Api/Controller/Admin/BlockController.php#L89-L101
GrupaZero/api
src/Gzero/Api/Controller/Admin/BlockController.php
BlockController.indexOfDeleted
public function indexOfDeleted() { $this->authorize('readList', Block::class); $input = $this->validator->validate('list'); $params = $this->processor->process($input)->getProcessedFields(); $results = $this->repository->getDeletedBlocks( $params['filter'], ...
php
public function indexOfDeleted() { $this->authorize('readList', Block::class); $input = $this->validator->validate('list'); $params = $this->processor->process($input)->getProcessedFields(); $results = $this->repository->getDeletedBlocks( $params['filter'], ...
[ "public", "function", "indexOfDeleted", "(", ")", "{", "$", "this", "->", "authorize", "(", "'readList'", ",", "Block", "::", "class", ")", ";", "$", "input", "=", "$", "this", "->", "validator", "->", "validate", "(", "'list'", ")", ";", "$", "params"...
Display list of soft deleted blocks @return \Illuminate\Http\JsonResponse
[ "Display", "list", "of", "soft", "deleted", "blocks" ]
train
https://github.com/GrupaZero/api/blob/fc544bb6057274e9d5e7b617346c3f854ea5effd/src/Gzero/Api/Controller/Admin/BlockController.php#L108-L120
GrupaZero/api
src/Gzero/Api/Controller/Admin/BlockController.php
BlockController.indexForSpecificContent
public function indexForSpecificContent($contentId) { $this->authorize('readList', Block::class); $onlyPublic = false; $content = $this->contentRepository->getById($contentId); if ($content) { $input = $this->validator->validate('listContent'); $params ...
php
public function indexForSpecificContent($contentId) { $this->authorize('readList', Block::class); $onlyPublic = false; $content = $this->contentRepository->getById($contentId); if ($content) { $input = $this->validator->validate('listContent'); $params ...
[ "public", "function", "indexForSpecificContent", "(", "$", "contentId", ")", "{", "$", "this", "->", "authorize", "(", "'readList'", ",", "Block", "::", "class", ")", ";", "$", "onlyPublic", "=", "false", ";", "$", "content", "=", "$", "this", "->", "con...
Display a listing of the resource. @param int $contentId Id of the resource @return \Illuminate\Http\JsonResponse @throws \Gzero\Validator\ValidationException
[ "Display", "a", "listing", "of", "the", "resource", "." ]
train
https://github.com/GrupaZero/api/blob/fc544bb6057274e9d5e7b617346c3f854ea5effd/src/Gzero/Api/Controller/Admin/BlockController.php#L130-L143
GrupaZero/api
src/Gzero/Api/Controller/Admin/BlockController.php
BlockController.indexOfFiles
public function indexOfFiles($blockId) { $this->authorize('readList', File::class); $input = $this->validator->validate('files'); $params = $this->processor->process($input)->getProcessedFields(); $block = $this->repository->getById($blockId); if (empty($block)) { ...
php
public function indexOfFiles($blockId) { $this->authorize('readList', File::class); $input = $this->validator->validate('files'); $params = $this->processor->process($input)->getProcessedFields(); $block = $this->repository->getById($blockId); if (empty($block)) { ...
[ "public", "function", "indexOfFiles", "(", "$", "blockId", ")", "{", "$", "this", "->", "authorize", "(", "'readList'", ",", "File", "::", "class", ")", ";", "$", "input", "=", "$", "this", "->", "validator", "->", "validate", "(", "'files'", ")", ";",...
Display a listing of the resource. @param int|null $blockId Block id for which we are displaying files @return \Illuminate\Http\JsonResponse
[ "Display", "a", "listing", "of", "the", "resource", "." ]
train
https://github.com/GrupaZero/api/blob/fc544bb6057274e9d5e7b617346c3f854ea5effd/src/Gzero/Api/Controller/Admin/BlockController.php#L152-L169
GrupaZero/api
src/Gzero/Api/Controller/Admin/BlockController.php
BlockController.show
public function show($id) { $block = $this->repository->getById($id); if (!empty($block)) { $this->authorize('read', $block); return $this->respondWithSuccess($block, new BlockTransformer); } return $this->respondNotFound(); }
php
public function show($id) { $block = $this->repository->getById($id); if (!empty($block)) { $this->authorize('read', $block); return $this->respondWithSuccess($block, new BlockTransformer); } return $this->respondNotFound(); }
[ "public", "function", "show", "(", "$", "id", ")", "{", "$", "block", "=", "$", "this", "->", "repository", "->", "getById", "(", "$", "id", ")", ";", "if", "(", "!", "empty", "(", "$", "block", ")", ")", "{", "$", "this", "->", "authorize", "(...
Display a specified resource. @param int $id Id of the resource @return \Illuminate\Http\JsonResponse
[ "Display", "a", "specified", "resource", "." ]
train
https://github.com/GrupaZero/api/blob/fc544bb6057274e9d5e7b617346c3f854ea5effd/src/Gzero/Api/Controller/Admin/BlockController.php#L178-L186
GrupaZero/api
src/Gzero/Api/Controller/Admin/BlockController.php
BlockController.store
public function store() { $this->authorize('create', Block::class); $input = $this->validator->validate('create'); try { $block = $this->repository->create($input, auth()->user()); return $this->respondWithSuccess($block, new BlockTransformer); } catch (Reposi...
php
public function store() { $this->authorize('create', Block::class); $input = $this->validator->validate('create'); try { $block = $this->repository->create($input, auth()->user()); return $this->respondWithSuccess($block, new BlockTransformer); } catch (Reposi...
[ "public", "function", "store", "(", ")", "{", "$", "this", "->", "authorize", "(", "'create'", ",", "Block", "::", "class", ")", ";", "$", "input", "=", "$", "this", "->", "validator", "->", "validate", "(", "'create'", ")", ";", "try", "{", "$", "...
Stores newly created block in database. @return \Illuminate\Http\JsonResponse
[ "Stores", "newly", "created", "block", "in", "database", "." ]
train
https://github.com/GrupaZero/api/blob/fc544bb6057274e9d5e7b617346c3f854ea5effd/src/Gzero/Api/Controller/Admin/BlockController.php#L193-L203
GrupaZero/api
src/Gzero/Api/Controller/Admin/BlockController.php
BlockController.update
public function update($id) { $block = $this->repository->getById($id); if (!empty($block)) { $this->authorize('update', $block); $input = $this->validator->validate('update'); $block = $this->repository->update($block, $input, auth()->user()); return ...
php
public function update($id) { $block = $this->repository->getById($id); if (!empty($block)) { $this->authorize('update', $block); $input = $this->validator->validate('update'); $block = $this->repository->update($block, $input, auth()->user()); return ...
[ "public", "function", "update", "(", "$", "id", ")", "{", "$", "block", "=", "$", "this", "->", "repository", "->", "getById", "(", "$", "id", ")", ";", "if", "(", "!", "empty", "(", "$", "block", ")", ")", "{", "$", "this", "->", "authorize", ...
Updates the specified resource in the database. @param int $id Block id @return \Illuminate\Http\JsonResponse
[ "Updates", "the", "specified", "resource", "in", "the", "database", "." ]
train
https://github.com/GrupaZero/api/blob/fc544bb6057274e9d5e7b617346c3f854ea5effd/src/Gzero/Api/Controller/Admin/BlockController.php#L212-L222
GrupaZero/api
src/Gzero/Api/Controller/Admin/BlockController.php
BlockController.destroy
public function destroy(Request $request, $id) { $forceDelete = $request->get('force', false); $block = $this->repository->getByIdWithTrashed($id); if (!empty($block)) { $this->authorize('delete', $block); if ($forceDelete) { $this->repository->force...
php
public function destroy(Request $request, $id) { $forceDelete = $request->get('force', false); $block = $this->repository->getByIdWithTrashed($id); if (!empty($block)) { $this->authorize('delete', $block); if ($forceDelete) { $this->repository->force...
[ "public", "function", "destroy", "(", "Request", "$", "request", ",", "$", "id", ")", "{", "$", "forceDelete", "=", "$", "request", "->", "get", "(", "'force'", ",", "false", ")", ";", "$", "block", "=", "$", "this", "->", "repository", "->", "getByI...
Removes the specified resource from database. @param Request $request Request object @param int $id Block id @return \Illuminate\Http\JsonResponse
[ "Removes", "the", "specified", "resource", "from", "database", "." ]
train
https://github.com/GrupaZero/api/blob/fc544bb6057274e9d5e7b617346c3f854ea5effd/src/Gzero/Api/Controller/Admin/BlockController.php#L232-L248
GrupaZero/api
src/Gzero/Api/Controller/Admin/BlockController.php
BlockController.restore
public function restore($id) { $block = $this->repository->getDeletedById($id); if (!empty($block)) { $this->authorize('update', $block); $block->restore(); return $this->respondWithSimpleSuccess(['success' => true]); } return $this->respondNotFoun...
php
public function restore($id) { $block = $this->repository->getDeletedById($id); if (!empty($block)) { $this->authorize('update', $block); $block->restore(); return $this->respondWithSimpleSuccess(['success' => true]); } return $this->respondNotFoun...
[ "public", "function", "restore", "(", "$", "id", ")", "{", "$", "block", "=", "$", "this", "->", "repository", "->", "getDeletedById", "(", "$", "id", ")", ";", "if", "(", "!", "empty", "(", "$", "block", ")", ")", "{", "$", "this", "->", "author...
Restore soft deleted block @param int $id Block id @return mixed
[ "Restore", "soft", "deleted", "block" ]
train
https://github.com/GrupaZero/api/blob/fc544bb6057274e9d5e7b617346c3f854ea5effd/src/Gzero/Api/Controller/Admin/BlockController.php#L257-L266
GrupaZero/api
src/Gzero/Api/Controller/Admin/BlockController.php
BlockController.syncFiles
public function syncFiles($contentId) { $block = $this->repository->getById($contentId); if (empty($block)) { return $this->respondNotFound(); } $this->authorize('update', $block); $input = $this->validator->validate('syncFiles'); $block = $this->fileRepos...
php
public function syncFiles($contentId) { $block = $this->repository->getById($contentId); if (empty($block)) { return $this->respondNotFound(); } $this->authorize('update', $block); $input = $this->validator->validate('syncFiles'); $block = $this->fileRepos...
[ "public", "function", "syncFiles", "(", "$", "contentId", ")", "{", "$", "block", "=", "$", "this", "->", "repository", "->", "getById", "(", "$", "contentId", ")", ";", "if", "(", "empty", "(", "$", "block", ")", ")", "{", "return", "$", "this", "...
Sync files with specific content @param int $contentId Content id @return mixed
[ "Sync", "files", "with", "specific", "content" ]
train
https://github.com/GrupaZero/api/blob/fc544bb6057274e9d5e7b617346c3f854ea5effd/src/Gzero/Api/Controller/Admin/BlockController.php#L275-L285
99designs/ergo-http
src/Client.php
Client.addHeader
public function addHeader($header) { if (is_string($header)) { $header = HeaderField::fromString($header); } $this->headers[] = $header; return $this; }
php
public function addHeader($header) { if (is_string($header)) { $header = HeaderField::fromString($header); } $this->headers[] = $header; return $this; }
[ "public", "function", "addHeader", "(", "$", "header", ")", "{", "if", "(", "is_string", "(", "$", "header", ")", ")", "{", "$", "header", "=", "HeaderField", "::", "fromString", "(", "$", "header", ")", ";", "}", "$", "this", "->", "headers", "[", ...
Adds an HTTP header to all requests @param mixed either a string or a HeaderField @return $this
[ "Adds", "an", "HTTP", "header", "to", "all", "requests" ]
train
https://github.com/99designs/ergo-http/blob/979b789f2e011a1cb70a00161e6b7bcd0d2e9c71/src/Client.php#L65-L72
99designs/ergo-http
src/Client.php
Client.post
function post($path, $body, $contentType = null) { return $this->dispatchRequest( $this->buildRequest('POST', $path, $body, $contentType) ); }
php
function post($path, $body, $contentType = null) { return $this->dispatchRequest( $this->buildRequest('POST', $path, $body, $contentType) ); }
[ "function", "post", "(", "$", "path", ",", "$", "body", ",", "$", "contentType", "=", "null", ")", "{", "return", "$", "this", "->", "dispatchRequest", "(", "$", "this", "->", "buildRequest", "(", "'POST'", ",", "$", "path", ",", "$", "body", ",", ...
Sends a POST request @return Response
[ "Sends", "a", "POST", "request" ]
train
https://github.com/99designs/ergo-http/blob/979b789f2e011a1cb70a00161e6b7bcd0d2e9c71/src/Client.php#L134-L139
99designs/ergo-http
src/Client.php
Client.put
function put($path, $body, $contentType = null) { return $this->dispatchRequest( $this->buildRequest('PUT', $path, $body, $contentType) ); }
php
function put($path, $body, $contentType = null) { return $this->dispatchRequest( $this->buildRequest('PUT', $path, $body, $contentType) ); }
[ "function", "put", "(", "$", "path", ",", "$", "body", ",", "$", "contentType", "=", "null", ")", "{", "return", "$", "this", "->", "dispatchRequest", "(", "$", "this", "->", "buildRequest", "(", "'PUT'", ",", "$", "path", ",", "$", "body", ",", "$...
Sends a PUT request @return Response
[ "Sends", "a", "PUT", "request" ]
train
https://github.com/99designs/ergo-http/blob/979b789f2e011a1cb70a00161e6b7bcd0d2e9c71/src/Client.php#L145-L150
99designs/ergo-http
src/Client.php
Client.buildRequest
private function buildRequest($method, $path, $body = null, $contentType = null) { // copy default headers $headers = $this->headers; // add Content-Type header if provided if ($contentType) $headers [] = new HeaderField('Content-Type', $contentType); $request =...
php
private function buildRequest($method, $path, $body = null, $contentType = null) { // copy default headers $headers = $this->headers; // add Content-Type header if provided if ($contentType) $headers [] = new HeaderField('Content-Type', $contentType); $request =...
[ "private", "function", "buildRequest", "(", "$", "method", ",", "$", "path", ",", "$", "body", "=", "null", ",", "$", "contentType", "=", "null", ")", "{", "// copy default headers", "$", "headers", "=", "$", "this", "->", "headers", ";", "// add Content-T...
Builds an Request object
[ "Builds", "an", "Request", "object" ]
train
https://github.com/99designs/ergo-http/blob/979b789f2e011a1cb70a00161e6b7bcd0d2e9c71/src/Client.php#L177-L199
99designs/ergo-http
src/Client.php
Client.dispatchRequest
private function dispatchRequest($request) { // track the number of requests across instances self::$requestCount++; $timestart = microtime(true); $response = self::transport()->send($request); // pass the response through the filter chain foreach ($this->filters as...
php
private function dispatchRequest($request) { // track the number of requests across instances self::$requestCount++; $timestart = microtime(true); $response = self::transport()->send($request); // pass the response through the filter chain foreach ($this->filters as...
[ "private", "function", "dispatchRequest", "(", "$", "request", ")", "{", "// track the number of requests across instances", "self", "::", "$", "requestCount", "++", ";", "$", "timestart", "=", "microtime", "(", "true", ")", ";", "$", "response", "=", "self", ":...
Dispatches a request via CURL
[ "Dispatches", "a", "request", "via", "CURL" ]
train
https://github.com/99designs/ergo-http/blob/979b789f2e011a1cb70a00161e6b7bcd0d2e9c71/src/Client.php#L204-L245
99designs/ergo-http
src/Client.php
Client.redirect
private function redirect($location) { $locationUrl = new Url($location); // if the location header was relative (bleh) add the host if (!$locationUrl->hasHost()) { $locationUrl = $this->url->getUrlForPath($location); } if ($this->redirects > self::MAXredirects)...
php
private function redirect($location) { $locationUrl = new Url($location); // if the location header was relative (bleh) add the host if (!$locationUrl->hasHost()) { $locationUrl = $this->url->getUrlForPath($location); } if ($this->redirects > self::MAXredirects)...
[ "private", "function", "redirect", "(", "$", "location", ")", "{", "$", "locationUrl", "=", "new", "Url", "(", "$", "location", ")", ";", "// if the location header was relative (bleh) add the host", "if", "(", "!", "$", "locationUrl", "->", "hasHost", "(", ")",...
Redirect to a new url
[ "Redirect", "to", "a", "new", "url" ]
train
https://github.com/99designs/ergo-http/blob/979b789f2e011a1cb70a00161e6b7bcd0d2e9c71/src/Client.php#L250-L268
rafalkot/yii2-settings
SettingsTrait.php
SettingsTrait.getSetting
public function getSetting($key = null, $default = null) { return $this->getSettingsComponent()->get($this->getSettingsCategory(), $key, $default); }
php
public function getSetting($key = null, $default = null) { return $this->getSettingsComponent()->get($this->getSettingsCategory(), $key, $default); }
[ "public", "function", "getSetting", "(", "$", "key", "=", "null", ",", "$", "default", "=", "null", ")", "{", "return", "$", "this", "->", "getSettingsComponent", "(", ")", "->", "get", "(", "$", "this", "->", "getSettingsCategory", "(", ")", ",", "$",...
Returns settings from current category. @param string|array $key Single or multiple keys in array @param mixed $default Default value when setting does not exist @return mixed Setting value @throws Exception
[ "Returns", "settings", "from", "current", "category", "." ]
train
https://github.com/rafalkot/yii2-settings/blob/b601b58809322f617273093766dc28c08e74d566/SettingsTrait.php#L39-L42
rafalkot/yii2-settings
SettingsTrait.php
SettingsTrait.setSetting
public function setSetting($key, $value = null) { $this->getSettingsComponent()->set($this->getSettingsCategory(), $key, $value); }
php
public function setSetting($key, $value = null) { $this->getSettingsComponent()->set($this->getSettingsCategory(), $key, $value); }
[ "public", "function", "setSetting", "(", "$", "key", ",", "$", "value", "=", "null", ")", "{", "$", "this", "->", "getSettingsComponent", "(", ")", "->", "set", "(", "$", "this", "->", "getSettingsCategory", "(", ")", ",", "$", "key", ",", "$", "valu...
Saves setting @param mixed $key Setting key or array of settings ie.: ['key' => value'', 'key2' => 'value2'] @param mixed $value Setting value @throws Exception
[ "Saves", "setting" ]
train
https://github.com/rafalkot/yii2-settings/blob/b601b58809322f617273093766dc28c08e74d566/SettingsTrait.php#L51-L54
vaibhavpandeyvpz/sandesh
src/ServerRequest.php
ServerRequest.getParsedBody
public function getParsedBody() { if ($this->parsedBody || !$this->body) { return $this->parsedBody; } $type = $this->getHeaderLine('Content-Type'); if ($type) { list($type) = explode(';', $type, 2); } $body = (string)$this->getBody(); ...
php
public function getParsedBody() { if ($this->parsedBody || !$this->body) { return $this->parsedBody; } $type = $this->getHeaderLine('Content-Type'); if ($type) { list($type) = explode(';', $type, 2); } $body = (string)$this->getBody(); ...
[ "public", "function", "getParsedBody", "(", ")", "{", "if", "(", "$", "this", "->", "parsedBody", "||", "!", "$", "this", "->", "body", ")", "{", "return", "$", "this", "->", "parsedBody", ";", "}", "$", "type", "=", "$", "this", "->", "getHeaderLine...
{@inheritdoc}
[ "{" ]
train
https://github.com/vaibhavpandeyvpz/sandesh/blob/bea2d06c7cac099ed82da973c922859de4158de0/src/ServerRequest.php#L80-L108
inhere/php-librarys
src/DI/Container.php
Container.set
public function set(string $id, $definition, array $opts = []) { $id = $this->_checkServiceId($id); // 已锁定的服务,不能更改 if ($this->isLocked($id)) { throw new \InvalidArgumentException(sprintf('Cannot override frozen service "%s".', $id)); } $args = $props = []; ...
php
public function set(string $id, $definition, array $opts = []) { $id = $this->_checkServiceId($id); // 已锁定的服务,不能更改 if ($this->isLocked($id)) { throw new \InvalidArgumentException(sprintf('Cannot override frozen service "%s".', $id)); } $args = $props = []; ...
[ "public", "function", "set", "(", "string", "$", "id", ",", "$", "definition", ",", "array", "$", "opts", "=", "[", "]", ")", "{", "$", "id", "=", "$", "this", "->", "_checkServiceId", "(", "$", "id", ")", ";", "// 已锁定的服务,不能更改", "if", "(", "$", "...
在容器注册服务 @param string $id 服务组件注册id @param mixed (string|array|object|callback) $definition 服务实例对象 | 服务信息定义 string: $definition = className array: $definition = [ // 1. 仅类名 $definition['_args']则传入对应构造方法 'target' => 'className', // 2. 类的静态方法, $definition['_args']则传入对应方法 className::staticMethod(_args...) 'target' => 'clas...
[ "在容器注册服务", "@param", "string", "$id", "服务组件注册id", "@param", "mixed", "(", "string|array|object|callback", ")", "$definition", "服务实例对象", "|", "服务信息定义", "string", ":", "$definition", "=", "className", "array", ":", "$definition", "=", "[", "//", "1", ".", "仅类名", ...
train
https://github.com/inhere/php-librarys/blob/e6ca598685469794f310e3ab0e2bc19519cd0ae6/src/DI/Container.php#L131-L201
inhere/php-librarys
src/DI/Container.php
Container.sets
public function sets(array $services) { $IServiceProvider = ServiceProviderInterface::class; foreach ($services as $id => $definition) { if (!$id || !$definition) { continue; } // string. is a Service Provider class name if (\is_strin...
php
public function sets(array $services) { $IServiceProvider = ServiceProviderInterface::class; foreach ($services as $id => $definition) { if (!$id || !$definition) { continue; } // string. is a Service Provider class name if (\is_strin...
[ "public", "function", "sets", "(", "array", "$", "services", ")", "{", "$", "IServiceProvider", "=", "ServiceProviderInterface", "::", "class", ";", "foreach", "(", "$", "services", "as", "$", "id", "=>", "$", "definition", ")", "{", "if", "(", "!", "$",...
通过设置配置的多维数组 注册多个服务. 服务详细设置请看{@see self::set()} @param array $services @example $services = [ 'service1 id' => 'xx\yy\className', 'service2 id' => ... , 'service3 id' => ... ] @return $this @throws \InvalidArgumentException @throws \Inhere\Exceptions\DependencyResolutionException
[ "通过设置配置的多维数组", "注册多个服务", ".", "服务详细设置请看", "{" ]
train
https://github.com/inhere/php-librarys/blob/e6ca598685469794f310e3ab0e2bc19519cd0ae6/src/DI/Container.php#L216-L237
inhere/php-librarys
src/DI/Container.php
Container.protect
public function protect(string $id, $definition, $share = false) { return $this->lock($id, $definition, $share); }
php
public function protect(string $id, $definition, $share = false) { return $this->lock($id, $definition, $share); }
[ "public", "function", "protect", "(", "string", "$", "id", ",", "$", "definition", ",", "$", "share", "=", "false", ")", "{", "return", "$", "this", "->", "lock", "(", "$", "id", ",", "$", "definition", ",", "$", "share", ")", ";", "}" ]
注册受保护的服务 like class::lock() @param string $id [description] @param $definition @param $share @return $this @throws \InvalidArgumentException @throws \Inhere\Exceptions\DependencyResolutionException
[ "注册受保护的服务", "like", "class", "::", "lock", "()" ]
train
https://github.com/inhere/php-librarys/blob/e6ca598685469794f310e3ab0e2bc19519cd0ae6/src/DI/Container.php#L248-L251
inhere/php-librarys
src/DI/Container.php
Container.lock
public function lock(string $id, $definition, $share = false) { return $this->set($id, $definition, [ 'shared' => $share, 'locked' => true, ]); }
php
public function lock(string $id, $definition, $share = false) { return $this->set($id, $definition, [ 'shared' => $share, 'locked' => true, ]); }
[ "public", "function", "lock", "(", "string", "$", "id", ",", "$", "definition", ",", "$", "share", "=", "false", ")", "{", "return", "$", "this", "->", "set", "(", "$", "id", ",", "$", "definition", ",", "[", "'shared'", "=>", "$", "share", ",", ...
(注册)锁定的服务,也可在注册后锁定,防止 getNew() 强制重载 @param string $id description @param $definition @param $share @return $this @throws \Inhere\Exceptions\DependencyResolutionException @throws \InvalidArgumentException
[ "(", "注册", ")", "锁定的服务,也可在注册后锁定", "防止", "getNew", "()", "强制重载" ]
train
https://github.com/inhere/php-librarys/blob/e6ca598685469794f310e3ab0e2bc19519cd0ae6/src/DI/Container.php#L262-L268
inhere/php-librarys
src/DI/Container.php
Container.createCallback
public function createCallback($target, array $arguments = [], array $props = []): callable { // a Closure OR a callable Object if (\is_object($target) && method_exists($target, '__invoke')) { return $target; } $arguments = array_values($arguments); /** @see $thi...
php
public function createCallback($target, array $arguments = [], array $props = []): callable { // a Closure OR a callable Object if (\is_object($target) && method_exists($target, '__invoke')) { return $target; } $arguments = array_values($arguments); /** @see $thi...
[ "public", "function", "createCallback", "(", "$", "target", ",", "array", "$", "arguments", "=", "[", "]", ",", "array", "$", "props", "=", "[", "]", ")", ":", "callable", "{", "// a Closure OR a callable Object", "if", "(", "\\", "is_object", "(", "$", ...
创建(类实例/类的方法)回调 @param mixed $target @param array $arguments @param array $props @return callable @throws \InvalidArgumentException @throws \Inhere\Exceptions\DependencyResolutionException
[ "创建", "(", "类实例", "/", "类的方法", ")", "回调" ]
train
https://github.com/inhere/php-librarys/blob/e6ca598685469794f310e3ab0e2bc19519cd0ae6/src/DI/Container.php#L305-L372
inhere/php-librarys
src/DI/Container.php
Container.get
public function get($id) { if (!$this->has($id)) { // a class name. if (strpos($id, '\\') && class_exists($id)) { /** @noinspection ExceptionsAnnotatingAndHandlingInspection */ $this->set($id, $id); } else { throw new \Inval...
php
public function get($id) { if (!$this->has($id)) { // a class name. if (strpos($id, '\\') && class_exists($id)) { /** @noinspection ExceptionsAnnotatingAndHandlingInspection */ $this->set($id, $id); } else { throw new \Inval...
[ "public", "function", "get", "(", "$", "id", ")", "{", "if", "(", "!", "$", "this", "->", "has", "(", "$", "id", ")", ")", "{", "// a class name.", "if", "(", "strpos", "(", "$", "id", ",", "'\\\\'", ")", "&&", "class_exists", "(", "$", "id", "...
get 获取已注册的服务组件实例 - 共享服务总是获取已存储的实例 - 其他的则总是返回新的实例 @param string $id 要获取的服务组件id @return mixed @throws \InvalidArgumentException
[ "get", "获取已注册的服务组件实例", "-", "共享服务总是获取已存储的实例", "-", "其他的则总是返回新的实例" ]
train
https://github.com/inhere/php-librarys/blob/e6ca598685469794f310e3ab0e2bc19519cd0ae6/src/DI/Container.php#L386-L399
inhere/php-librarys
src/DI/Container.php
Container.del
public function del(string $id) { $id = $this->resolveAlias($id); if (isset($this->services[$id])) { unset($this->services[$id]); } }
php
public function del(string $id) { $id = $this->resolveAlias($id); if (isset($this->services[$id])) { unset($this->services[$id]); } }
[ "public", "function", "del", "(", "string", "$", "id", ")", "{", "$", "id", "=", "$", "this", "->", "resolveAlias", "(", "$", "id", ")", ";", "if", "(", "isset", "(", "$", "this", "->", "services", "[", "$", "id", "]", ")", ")", "{", "unset", ...
删除服务 @param $id
[ "删除服务" ]
train
https://github.com/inhere/php-librarys/blob/e6ca598685469794f310e3ab0e2bc19519cd0ae6/src/DI/Container.php#L453-L460
inhere/php-librarys
src/DI/Container.php
Container.getInstance
public function getInstance(string $id, $thrErr = true, $forceNew = false) { if (!$id) { throw new \InvalidArgumentException(sprintf( 'The first parameter must be a non-empty string, %s given', \gettype($id) )); } $id = $this->resolveA...
php
public function getInstance(string $id, $thrErr = true, $forceNew = false) { if (!$id) { throw new \InvalidArgumentException(sprintf( 'The first parameter must be a non-empty string, %s given', \gettype($id) )); } $id = $this->resolveA...
[ "public", "function", "getInstance", "(", "string", "$", "id", ",", "$", "thrErr", "=", "true", ",", "$", "forceNew", "=", "false", ")", "{", "if", "(", "!", "$", "id", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "sprintf", "(", ...
get 获取已注册的服务组件实例 @param $id @param bool $thrErr @param bool $forceNew 强制获取服务的新实例 @return mixed|null @throws \InvalidArgumentException
[ "get", "获取已注册的服务组件实例" ]
train
https://github.com/inhere/php-librarys/blob/e6ca598685469794f310e3ab0e2bc19519cd0ae6/src/DI/Container.php#L483-L499
inhere/php-librarys
src/DI/Container.php
Container.getService
public function getService(string $id, $thrErr = false) { $id = $this->resolveAlias($id); if (isset($this->services[$id])) { return $this->services[$id]; } if ($thrErr) { throw new \InvalidArgumentException("The service '$id' was not found, has not been regi...
php
public function getService(string $id, $thrErr = false) { $id = $this->resolveAlias($id); if (isset($this->services[$id])) { return $this->services[$id]; } if ($thrErr) { throw new \InvalidArgumentException("The service '$id' was not found, has not been regi...
[ "public", "function", "getService", "(", "string", "$", "id", ",", "$", "thrErr", "=", "false", ")", "{", "$", "id", "=", "$", "this", "->", "resolveAlias", "(", "$", "id", ")", ";", "if", "(", "isset", "(", "$", "this", "->", "services", "[", "$...
获取某一个服务的信息 @param $id @param bool $thrErr @return Service|null @throws \InvalidArgumentException
[ "获取某一个服务的信息" ]
train
https://github.com/inhere/php-librarys/blob/e6ca598685469794f310e3ab0e2bc19519cd0ae6/src/DI/Container.php#L508-L521
inhere/php-librarys
src/DI/Container.php
Container.getIds
public function getIds($toArray = true): array { $ids = array_keys($this->services); return $toArray ? $ids : implode(', ', $ids); }
php
public function getIds($toArray = true): array { $ids = array_keys($this->services); return $toArray ? $ids : implode(', ', $ids); }
[ "public", "function", "getIds", "(", "$", "toArray", "=", "true", ")", ":", "array", "{", "$", "ids", "=", "array_keys", "(", "$", "this", "->", "services", ")", ";", "return", "$", "toArray", "?", "$", "ids", ":", "implode", "(", "', '", ",", "$",...
获取全部服务id @param bool $toArray @return array
[ "获取全部服务id" ]
train
https://github.com/inhere/php-librarys/blob/e6ca598685469794f310e3ab0e2bc19519cd0ae6/src/DI/Container.php#L576-L581
oroinc/OroLayoutComponent
StringOptionValueBuilder.php
StringOptionValueBuilder.add
public function add($value) { if (!is_string($value)) { throw new UnexpectedTypeException($value, 'string', 'value'); } if (empty($value)) { return; } if ($this->allowTokenize) { $this->values = array_merge($this->values, explode($this->de...
php
public function add($value) { if (!is_string($value)) { throw new UnexpectedTypeException($value, 'string', 'value'); } if (empty($value)) { return; } if ($this->allowTokenize) { $this->values = array_merge($this->values, explode($this->de...
[ "public", "function", "add", "(", "$", "value", ")", "{", "if", "(", "!", "is_string", "(", "$", "value", ")", ")", "{", "throw", "new", "UnexpectedTypeException", "(", "$", "value", ",", "'string'", ",", "'value'", ")", ";", "}", "if", "(", "empty",...
Requests to add new value @param string $value
[ "Requests", "to", "add", "new", "value" ]
train
https://github.com/oroinc/OroLayoutComponent/blob/682a96672393d81c63728e47c4a4c3618c515be0/StringOptionValueBuilder.php#L38-L52
oroinc/OroLayoutComponent
StringOptionValueBuilder.php
StringOptionValueBuilder.remove
public function remove($value) { if (!is_string($value)) { throw new UnexpectedTypeException($value, 'string', 'value'); } if (empty($value)) { return; } if ($this->allowTokenize) { $this->values = array_diff($this->values, explode($this->...
php
public function remove($value) { if (!is_string($value)) { throw new UnexpectedTypeException($value, 'string', 'value'); } if (empty($value)) { return; } if ($this->allowTokenize) { $this->values = array_diff($this->values, explode($this->...
[ "public", "function", "remove", "(", "$", "value", ")", "{", "if", "(", "!", "is_string", "(", "$", "value", ")", ")", "{", "throw", "new", "UnexpectedTypeException", "(", "$", "value", ",", "'string'", ",", "'value'", ")", ";", "}", "if", "(", "empt...
Requests to remove existing value @param string $value
[ "Requests", "to", "remove", "existing", "value" ]
train
https://github.com/oroinc/OroLayoutComponent/blob/682a96672393d81c63728e47c4a4c3618c515be0/StringOptionValueBuilder.php#L59-L73
oroinc/OroLayoutComponent
StringOptionValueBuilder.php
StringOptionValueBuilder.replace
public function replace($oldValue, $newValue) { if (!is_string($oldValue)) { throw new UnexpectedTypeException($oldValue, 'string', 'oldValue'); } if (empty($oldValue)) { return; } if (!is_string($newValue) && null !== $newValue) { throw ne...
php
public function replace($oldValue, $newValue) { if (!is_string($oldValue)) { throw new UnexpectedTypeException($oldValue, 'string', 'oldValue'); } if (empty($oldValue)) { return; } if (!is_string($newValue) && null !== $newValue) { throw ne...
[ "public", "function", "replace", "(", "$", "oldValue", ",", "$", "newValue", ")", "{", "if", "(", "!", "is_string", "(", "$", "oldValue", ")", ")", "{", "throw", "new", "UnexpectedTypeException", "(", "$", "oldValue", ",", "'string'", ",", "'oldValue'", ...
Requests to replace one value with another value @param string $oldValue @param string|null $newValue
[ "Requests", "to", "replace", "one", "value", "with", "another", "value" ]
train
https://github.com/oroinc/OroLayoutComponent/blob/682a96672393d81c63728e47c4a4c3618c515be0/StringOptionValueBuilder.php#L81-L101
Eresus/EresusCMS
src/core/framework/core/3rdparty/ezcomponents/Database/src/sqlabstraction/implementations/expression_sqlite.php
ezcQueryExpressionSqlite.dateExtract
public function dateExtract( $column, $type ) { switch ( $type ) { case 'SECOND': $type = '%S'; break; case 'MINUTE': $type = '%M'; break; case 'HOUR': $type = '%H'; br...
php
public function dateExtract( $column, $type ) { switch ( $type ) { case 'SECOND': $type = '%S'; break; case 'MINUTE': $type = '%M'; break; case 'HOUR': $type = '%H'; br...
[ "public", "function", "dateExtract", "(", "$", "column", ",", "$", "type", ")", "{", "switch", "(", "$", "type", ")", "{", "case", "'SECOND'", ":", "$", "type", "=", "'%S'", ";", "break", ";", "case", "'MINUTE'", ":", "$", "type", "=", "'%M'", ";",...
Returns the SQL that extracts parts from a timestamp value. @param string $column @param string $type one of SECOND, MINUTE, HOUR, DAY, MONTH, or YEAR @return string
[ "Returns", "the", "SQL", "that", "extracts", "parts", "from", "a", "timestamp", "value", "." ]
train
https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Database/src/sqlabstraction/implementations/expression_sqlite.php#L146-L177
ekuiter/feature-php
FeaturePhp/File/StoredFileContent.php
StoredFileContent.copy
public function copy($target) { if (!parent::copy($target)) return false; return copy($this->fileSource, $target); }
php
public function copy($target) { if (!parent::copy($target)) return false; return copy($this->fileSource, $target); }
[ "public", "function", "copy", "(", "$", "target", ")", "{", "if", "(", "!", "parent", "::", "copy", "(", "$", "target", ")", ")", "return", "false", ";", "return", "copy", "(", "$", "this", "->", "fileSource", ",", "$", "target", ")", ";", "}" ]
Copies the stored file's content to the local filesystem. @param string $target the file target in the filesystem
[ "Copies", "the", "stored", "file", "s", "content", "to", "the", "local", "filesystem", "." ]
train
https://github.com/ekuiter/feature-php/blob/daf4a59098802fedcfd1f1a1d07847fcf2fea7bf/FeaturePhp/File/StoredFileContent.php#L59-L63
blast-project/BaseEntitiesBundle
src/Search/SearchHandler.php
SearchHandler.batchUpdate
public function batchUpdate() { if ($this->_entityName === null) { throw new \Exception('Please call « handleEntity(ClassMetadata $class) » before using this handler'); } if (!$this->truncateTable()) { throw new \Exception('Could not truncate table ' . $this->getSearc...
php
public function batchUpdate() { if ($this->_entityName === null) { throw new \Exception('Please call « handleEntity(ClassMetadata $class) » before using this handler'); } if (!$this->truncateTable()) { throw new \Exception('Could not truncate table ' . $this->getSearc...
[ "public", "function", "batchUpdate", "(", ")", "{", "if", "(", "$", "this", "->", "_entityName", "===", "null", ")", "{", "throw", "new", "\\", "Exception", "(", "'Please call « handleEntity(ClassMetadata $class) » before using this handler');", "", "", "}", "if", ...
Does a batch update of the whole search index table.
[ "Does", "a", "batch", "update", "of", "the", "whole", "search", "index", "table", "." ]
train
https://github.com/blast-project/BaseEntitiesBundle/blob/abd06891fc38922225ab7e4fcb437a286ba2c0c4/src/Search/SearchHandler.php#L65-L103
blast-project/BaseEntitiesBundle
src/Search/SearchHandler.php
SearchHandler.indexSearch
public function indexSearch($searchText, $maxResults) { // split the phrase into words $words = SearchAnalyser::analyse($searchText); if (!$words) { return []; } $query = $this->_em->createQueryBuilder() ->select('o') ->from($this->_entity...
php
public function indexSearch($searchText, $maxResults) { // split the phrase into words $words = SearchAnalyser::analyse($searchText); if (!$words) { return []; } $query = $this->_em->createQueryBuilder() ->select('o') ->from($this->_entity...
[ "public", "function", "indexSearch", "(", "$", "searchText", ",", "$", "maxResults", ")", "{", "// split the phrase into words", "$", "words", "=", "SearchAnalyser", "::", "analyse", "(", "$", "searchText", ")", ";", "if", "(", "!", "$", "words", ")", "{", ...
Find the entities that have the appropriate keywords in their searchIndex. @param string $searchText @param int $maxResults @return Collection found entities
[ "Find", "the", "entities", "that", "have", "the", "appropriate", "keywords", "in", "their", "searchIndex", "." ]
train
https://github.com/blast-project/BaseEntitiesBundle/blob/abd06891fc38922225ab7e4fcb437a286ba2c0c4/src/Search/SearchHandler.php#L113-L141
blast-project/BaseEntitiesBundle
src/Search/SearchHandler.php
SearchHandler.truncateTable
public function truncateTable() { $connection = $this->_em->getConnection(); $dbPlatform = $connection->getDatabasePlatform(); $connection->beginTransaction(); try { $q = $dbPlatform->getTruncateTableSql($this->getSearchIndexTable()); $connection->executeUpdat...
php
public function truncateTable() { $connection = $this->_em->getConnection(); $dbPlatform = $connection->getDatabasePlatform(); $connection->beginTransaction(); try { $q = $dbPlatform->getTruncateTableSql($this->getSearchIndexTable()); $connection->executeUpdat...
[ "public", "function", "truncateTable", "(", ")", "{", "$", "connection", "=", "$", "this", "->", "_em", "->", "getConnection", "(", ")", ";", "$", "dbPlatform", "=", "$", "connection", "->", "getDatabasePlatform", "(", ")", ";", "$", "connection", "->", ...
Truncates the search index table. @return bool true if success
[ "Truncates", "the", "search", "index", "table", "." ]
train
https://github.com/blast-project/BaseEntitiesBundle/blob/abd06891fc38922225ab7e4fcb437a286ba2c0c4/src/Search/SearchHandler.php#L148-L164
php-lug/lug
src/Bundle/GridBundle/Form/Type/GridSortingType.php
GridSortingType.configureOptions
public function configureOptions(OptionsResolver $resolver) { $resolver ->setDefaults([ 'constraints' => function (Options $options) { return new GridSortingConstraint(['grid' => $options['grid']]); }, 'error_bubbling' => functi...
php
public function configureOptions(OptionsResolver $resolver) { $resolver ->setDefaults([ 'constraints' => function (Options $options) { return new GridSortingConstraint(['grid' => $options['grid']]); }, 'error_bubbling' => functi...
[ "public", "function", "configureOptions", "(", "OptionsResolver", "$", "resolver", ")", "{", "$", "resolver", "->", "setDefaults", "(", "[", "'constraints'", "=>", "function", "(", "Options", "$", "options", ")", "{", "return", "new", "GridSortingConstraint", "(...
{@inheritdoc}
[ "{" ]
train
https://github.com/php-lug/lug/blob/81c109f187eba0a60f17e8cc59984ebb31841db7/src/Bundle/GridBundle/Form/Type/GridSortingType.php#L62-L75
gordalina/mangopay-php
src/Gordalina/Mangopay/Client.php
Client.createHttpClient
protected function createHttpClient() { $this->client = new GuzzleHttpClient($this->getEndpoint()); $this->client->addSubscriber(new SignerPlugin($this->signer)); }
php
protected function createHttpClient() { $this->client = new GuzzleHttpClient($this->getEndpoint()); $this->client->addSubscriber(new SignerPlugin($this->signer)); }
[ "protected", "function", "createHttpClient", "(", ")", "{", "$", "this", "->", "client", "=", "new", "GuzzleHttpClient", "(", "$", "this", "->", "getEndpoint", "(", ")", ")", ";", "$", "this", "->", "client", "->", "addSubscriber", "(", "new", "SignerPlugi...
Initializes client @return null
[ "Initializes", "client" ]
train
https://github.com/gordalina/mangopay-php/blob/6807992416d964e25670d961b66dbccd7a46ef62/src/Gordalina/Mangopay/Client.php#L127-L131
Daursu/xero
src/Daursu/Xero/models/BaseModel.php
BaseModel.setAttribute
public function setAttribute($key, $value) { if ($value instanceof BaseModel || $value instanceof Collection) $this->setRelationship($value, $key); elseif ( !is_array($value)) $this->attributes[$key] = $value; else $this->setRelationship($value, $key); }
php
public function setAttribute($key, $value) { if ($value instanceof BaseModel || $value instanceof Collection) $this->setRelationship($value, $key); elseif ( !is_array($value)) $this->attributes[$key] = $value; else $this->setRelationship($value, $key); }
[ "public", "function", "setAttribute", "(", "$", "key", ",", "$", "value", ")", "{", "if", "(", "$", "value", "instanceof", "BaseModel", "||", "$", "value", "instanceof", "Collection", ")", "$", "this", "->", "setRelationship", "(", "$", "value", ",", "$"...
Sets the attributes for this model @param mixed $key @param mixed $value
[ "Sets", "the", "attributes", "for", "this", "model" ]
train
https://github.com/Daursu/xero/blob/f6ac2b0cd3123f9667fd07927bee6725d34df4a6/src/Daursu/Xero/models/BaseModel.php#L115-L123
Daursu/xero
src/Daursu/Xero/models/BaseModel.php
BaseModel.setRelationship
public function setRelationship($value, $key = '') { if (is_array($value)) { $class = __NAMESPACE__ . '\\' . str_singular($key); if (class_exists($class)) { // Check to see if the key value is plural or singular // if it is plural then we create a collection // otherwise we instantiate the class...
php
public function setRelationship($value, $key = '') { if (is_array($value)) { $class = __NAMESPACE__ . '\\' . str_singular($key); if (class_exists($class)) { // Check to see if the key value is plural or singular // if it is plural then we create a collection // otherwise we instantiate the class...
[ "public", "function", "setRelationship", "(", "$", "value", ",", "$", "key", "=", "''", ")", "{", "if", "(", "is_array", "(", "$", "value", ")", ")", "{", "$", "class", "=", "__NAMESPACE__", ".", "'\\\\'", ".", "str_singular", "(", "$", "key", ")", ...
Sets the relationships on this model, which in fact are collections of other models @param string $key @param array $value
[ "Sets", "the", "relationships", "on", "this", "model", "which", "in", "fact", "are", "collections", "of", "other", "models" ]
train
https://github.com/Daursu/xero/blob/f6ac2b0cd3123f9667fd07927bee6725d34df4a6/src/Daursu/Xero/models/BaseModel.php#L132-L158
Daursu/xero
src/Daursu/Xero/models/BaseModel.php
BaseModel.getAttribute
public function getAttribute($key) { if (isset($this->attributes[$key])) return $this->attributes[$key]; if (isset($this->relationships[$key])) return $this->relationships[$key]; return null; }
php
public function getAttribute($key) { if (isset($this->attributes[$key])) return $this->attributes[$key]; if (isset($this->relationships[$key])) return $this->relationships[$key]; return null; }
[ "public", "function", "getAttribute", "(", "$", "key", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "attributes", "[", "$", "key", "]", ")", ")", "return", "$", "this", "->", "attributes", "[", "$", "key", "]", ";", "if", "(", "isset", "...
Get an attribute from the model. @param string $key @return mixed
[ "Get", "an", "attribute", "from", "the", "model", "." ]
train
https://github.com/Daursu/xero/blob/f6ac2b0cd3123f9667fd07927bee6725d34df4a6/src/Daursu/Xero/models/BaseModel.php#L166-L175
Daursu/xero
src/Daursu/Xero/models/BaseModel.php
BaseModel.setAttributes
public function setAttributes(array $data) { $data = $this->stripResponseData($data); foreach ($data as $key => $value) { $this->setAttribute($key, $value); } return $this->getAttributes(); }
php
public function setAttributes(array $data) { $data = $this->stripResponseData($data); foreach ($data as $key => $value) { $this->setAttribute($key, $value); } return $this->getAttributes(); }
[ "public", "function", "setAttributes", "(", "array", "$", "data", ")", "{", "$", "data", "=", "$", "this", "->", "stripResponseData", "(", "$", "data", ")", ";", "foreach", "(", "$", "data", "as", "$", "key", "=>", "$", "value", ")", "{", "$", "thi...
Set all the attributes from an array. @param array $data
[ "Set", "all", "the", "attributes", "from", "an", "array", "." ]
train
https://github.com/Daursu/xero/blob/f6ac2b0cd3123f9667fd07927bee6725d34df4a6/src/Daursu/Xero/models/BaseModel.php#L192-L201
Daursu/xero
src/Daursu/Xero/models/BaseModel.php
BaseModel.getSingularEntityName
public static function getSingularEntityName() { if ( isset(self::$entity_singular) && ! empty(self::$entity_singular)) return self::$entity_singular; return str_singular(self::getEntityName()); }
php
public static function getSingularEntityName() { if ( isset(self::$entity_singular) && ! empty(self::$entity_singular)) return self::$entity_singular; return str_singular(self::getEntityName()); }
[ "public", "static", "function", "getSingularEntityName", "(", ")", "{", "if", "(", "isset", "(", "self", "::", "$", "entity_singular", ")", "&&", "!", "empty", "(", "self", "::", "$", "entity_singular", ")", ")", "return", "self", "::", "$", "entity_singul...
Retrieves the singular name of the entity we are querying. @return string
[ "Retrieves", "the", "singular", "name", "of", "the", "entity", "we", "are", "querying", "." ]
train
https://github.com/Daursu/xero/blob/f6ac2b0cd3123f9667fd07927bee6725d34df4a6/src/Daursu/Xero/models/BaseModel.php#L285-L291
Daursu/xero
src/Daursu/Xero/models/BaseModel.php
BaseModel.request
public function request($method, $url, $params = array(), $xml = "", $format = "") { if ( !$format) $format = $this->format; $response = $this->api->request($method, $url, $params, $xml, $format); return $this->parseResponse($response); }
php
public function request($method, $url, $params = array(), $xml = "", $format = "") { if ( !$format) $format = $this->format; $response = $this->api->request($method, $url, $params, $xml, $format); return $this->parseResponse($response); }
[ "public", "function", "request", "(", "$", "method", ",", "$", "url", ",", "$", "params", "=", "array", "(", ")", ",", "$", "xml", "=", "\"\"", ",", "$", "format", "=", "\"\"", ")", "{", "if", "(", "!", "$", "format", ")", "$", "format", "=", ...
A high level request method used from static methods. @param string $method @param string $url @param array $params @param string $xml @param string $format @return Daursu\Xero\BaseModel
[ "A", "high", "level", "request", "method", "used", "from", "static", "methods", "." ]
train
https://github.com/Daursu/xero/blob/f6ac2b0cd3123f9667fd07927bee6725d34df4a6/src/Daursu/Xero/models/BaseModel.php#L303-L309
Daursu/xero
src/Daursu/Xero/models/BaseModel.php
BaseModel.get
public static function get($params = array()) { $object = new static; $data = $object->request('GET', $object->getUrl(), $params); $data = $object->stripResponseData($data); // Initialise a collection $collection = self::newCollection(); if (isset($data[0]) && is_array($data[0])) { // This should ...
php
public static function get($params = array()) { $object = new static; $data = $object->request('GET', $object->getUrl(), $params); $data = $object->stripResponseData($data); // Initialise a collection $collection = self::newCollection(); if (isset($data[0]) && is_array($data[0])) { // This should ...
[ "public", "static", "function", "get", "(", "$", "params", "=", "array", "(", ")", ")", "{", "$", "object", "=", "new", "static", ";", "$", "data", "=", "$", "object", "->", "request", "(", "'GET'", ",", "$", "object", "->", "getUrl", "(", ")", "...
Get a collection of items @param array $params @return Daursu\Xero\BaseModel
[ "Get", "a", "collection", "of", "items" ]
train
https://github.com/Daursu/xero/blob/f6ac2b0cd3123f9667fd07927bee6725d34df4a6/src/Daursu/Xero/models/BaseModel.php#L317-L332
Daursu/xero
src/Daursu/Xero/models/BaseModel.php
BaseModel.find
public static function find($id) { $object = new static; $response = $object->request('GET', sprintf('%s/%s', $object->getUrl(), $id)); return $response ? $object : false; }
php
public static function find($id) { $object = new static; $response = $object->request('GET', sprintf('%s/%s', $object->getUrl(), $id)); return $response ? $object : false; }
[ "public", "static", "function", "find", "(", "$", "id", ")", "{", "$", "object", "=", "new", "static", ";", "$", "response", "=", "$", "object", "->", "request", "(", "'GET'", ",", "sprintf", "(", "'%s/%s'", ",", "$", "object", "->", "getUrl", "(", ...
Find a single element by its ID @param mixed $id @return Daursu\Xero\BaseModel
[ "Find", "a", "single", "element", "by", "its", "ID" ]
train
https://github.com/Daursu/xero/blob/f6ac2b0cd3123f9667fd07927bee6725d34df4a6/src/Daursu/Xero/models/BaseModel.php#L340-L346
Daursu/xero
src/Daursu/Xero/models/BaseModel.php
BaseModel.create
public function create($params = array()) { $response = $this->api->request('PUT', $this->getUrl(), $params, $this->toXML(), $this->format); return $this->parseResponse($response) ? true : false; }
php
public function create($params = array()) { $response = $this->api->request('PUT', $this->getUrl(), $params, $this->toXML(), $this->format); return $this->parseResponse($response) ? true : false; }
[ "public", "function", "create", "(", "$", "params", "=", "array", "(", ")", ")", "{", "$", "response", "=", "$", "this", "->", "api", "->", "request", "(", "'PUT'", ",", "$", "this", "->", "getUrl", "(", ")", ",", "$", "params", ",", "$", "this",...
Creates a new entity in Xero @param array $data @return boolean
[ "Creates", "a", "new", "entity", "in", "Xero" ]
train
https://github.com/Daursu/xero/blob/f6ac2b0cd3123f9667fd07927bee6725d34df4a6/src/Daursu/Xero/models/BaseModel.php#L365-L369
Daursu/xero
src/Daursu/Xero/models/BaseModel.php
BaseModel.save
public function save($params = array()) { if ( isset($this->attributes[$this->primary_column])) { return $this->update($params); } else { return $this->create($params); } }
php
public function save($params = array()) { if ( isset($this->attributes[$this->primary_column])) { return $this->update($params); } else { return $this->create($params); } }
[ "public", "function", "save", "(", "$", "params", "=", "array", "(", ")", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "attributes", "[", "$", "this", "->", "primary_column", "]", ")", ")", "{", "return", "$", "this", "->", "update", "(", ...
Save an entity. If it doesn't have the primary key set then it will create it, otherwise it will update it. @param array $params @return boolean
[ "Save", "an", "entity", ".", "If", "it", "doesn", "t", "have", "the", "primary", "key", "set", "then", "it", "will", "create", "it", "otherwise", "it", "will", "update", "it", "." ]
train
https://github.com/Daursu/xero/blob/f6ac2b0cd3123f9667fd07927bee6725d34df4a6/src/Daursu/Xero/models/BaseModel.php#L391-L399
Daursu/xero
src/Daursu/Xero/models/BaseModel.php
BaseModel.delete
public function delete() { if ( !isset($this->attributes[$this->primary_column])) throw new XeroGeneralException(sprintf("The %s attribute is required.", $this->primary_column)); $this->setAttribute($this->status_field, 'DELETED'); $response = $this->api->request('POST', $this->getUrl(), array(), $this->toX...
php
public function delete() { if ( !isset($this->attributes[$this->primary_column])) throw new XeroGeneralException(sprintf("The %s attribute is required.", $this->primary_column)); $this->setAttribute($this->status_field, 'DELETED'); $response = $this->api->request('POST', $this->getUrl(), array(), $this->toX...
[ "public", "function", "delete", "(", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "attributes", "[", "$", "this", "->", "primary_column", "]", ")", ")", "throw", "new", "XeroGeneralException", "(", "sprintf", "(", "\"The %s attribute is require...
Delete an existing entity @param mixed $id @return array
[ "Delete", "an", "existing", "entity" ]
train
https://github.com/Daursu/xero/blob/f6ac2b0cd3123f9667fd07927bee6725d34df4a6/src/Daursu/Xero/models/BaseModel.php#L407-L416
Daursu/xero
src/Daursu/Xero/models/BaseModel.php
BaseModel.toArray
public function toArray() { $output = $this->getAttributes(); foreach ($this->relationships as $key => $value) { if ($value instanceof BaseModel) { $value = array($value->getSingularEntityName() => $value->toArray()); } else { $value = $value->toArray(); } $output = array_merge($output, $...
php
public function toArray() { $output = $this->getAttributes(); foreach ($this->relationships as $key => $value) { if ($value instanceof BaseModel) { $value = array($value->getSingularEntityName() => $value->toArray()); } else { $value = $value->toArray(); } $output = array_merge($output, $...
[ "public", "function", "toArray", "(", ")", "{", "$", "output", "=", "$", "this", "->", "getAttributes", "(", ")", ";", "foreach", "(", "$", "this", "->", "relationships", "as", "$", "key", "=>", "$", "value", ")", "{", "if", "(", "$", "value", "ins...
Convert the model to an array @return array
[ "Convert", "the", "model", "to", "an", "array" ]
train
https://github.com/Daursu/xero/blob/f6ac2b0cd3123f9667fd07927bee6725d34df4a6/src/Daursu/Xero/models/BaseModel.php#L433-L450
Daursu/xero
src/Daursu/Xero/models/BaseModel.php
BaseModel.toXML
public function toXML($singular = false) { $root = ($singular) ? self::getSingularEntityName() : self::getEntityName(); $output = new SimpleXMLElement( sprintf('<%s></%s>', $root, $root) ); if ( ! $singular) { $node = $output->addChild(self::getSingularEntityName()); self::array_to_xml($this->toArra...
php
public function toXML($singular = false) { $root = ($singular) ? self::getSingularEntityName() : self::getEntityName(); $output = new SimpleXMLElement( sprintf('<%s></%s>', $root, $root) ); if ( ! $singular) { $node = $output->addChild(self::getSingularEntityName()); self::array_to_xml($this->toArra...
[ "public", "function", "toXML", "(", "$", "singular", "=", "false", ")", "{", "$", "root", "=", "(", "$", "singular", ")", "?", "self", "::", "getSingularEntityName", "(", ")", ":", "self", "::", "getEntityName", "(", ")", ";", "$", "output", "=", "ne...
Converts the model to XML @return string
[ "Converts", "the", "model", "to", "XML" ]
train
https://github.com/Daursu/xero/blob/f6ac2b0cd3123f9667fd07927bee6725d34df4a6/src/Daursu/Xero/models/BaseModel.php#L468-L485
Daursu/xero
src/Daursu/Xero/models/BaseModel.php
BaseModel.array_to_xml
public static function array_to_xml($array, &$xml) { foreach($array as $key => $value) { if(is_array($value)) { if(!is_numeric($key)){ $subnode = $xml->addChild("$key"); self::array_to_xml($value, $subnode); } elseif ($key == 0) { self::array_to_xml($value, $xml); } else { $name = ...
php
public static function array_to_xml($array, &$xml) { foreach($array as $key => $value) { if(is_array($value)) { if(!is_numeric($key)){ $subnode = $xml->addChild("$key"); self::array_to_xml($value, $subnode); } elseif ($key == 0) { self::array_to_xml($value, $xml); } else { $name = ...
[ "public", "static", "function", "array_to_xml", "(", "$", "array", ",", "&", "$", "xml", ")", "{", "foreach", "(", "$", "array", "as", "$", "key", "=>", "$", "value", ")", "{", "if", "(", "is_array", "(", "$", "value", ")", ")", "{", "if", "(", ...
Helper function to convert an array to XML @param array $array @param SimpleXMLElement $xml @return string
[ "Helper", "function", "to", "convert", "an", "array", "to", "XML" ]
train
https://github.com/Daursu/xero/blob/f6ac2b0cd3123f9667fd07927bee6725d34df4a6/src/Daursu/Xero/models/BaseModel.php#L504-L522
Daursu/xero
src/Daursu/Xero/models/BaseModel.php
BaseModel.stripResponseData
public function stripResponseData(array $data) { if (isset($data[self::getEntityName()]) && is_array($data[self::getEntityName()])) $data = $data[self::getEntityName()]; if (isset($data[self::getSingularEntityName()]) && is_array($data[self::getSingularEntityName()])) $data = $data[self::getSingularEntityNa...
php
public function stripResponseData(array $data) { if (isset($data[self::getEntityName()]) && is_array($data[self::getEntityName()])) $data = $data[self::getEntityName()]; if (isset($data[self::getSingularEntityName()]) && is_array($data[self::getSingularEntityName()])) $data = $data[self::getSingularEntityNa...
[ "public", "function", "stripResponseData", "(", "array", "$", "data", ")", "{", "if", "(", "isset", "(", "$", "data", "[", "self", "::", "getEntityName", "(", ")", "]", ")", "&&", "is_array", "(", "$", "data", "[", "self", "::", "getEntityName", "(", ...
This function removes all the unecessary data from a response and leaves us with what we need when trying to populate objects or collections with data @param array $data @return array
[ "This", "function", "removes", "all", "the", "unecessary", "data", "from", "a", "response", "and", "leaves", "us", "with", "what", "we", "need", "when", "trying", "to", "populate", "objects", "or", "collections", "with", "data" ]
train
https://github.com/Daursu/xero/blob/f6ac2b0cd3123f9667fd07927bee6725d34df4a6/src/Daursu/Xero/models/BaseModel.php#L532-L541
Daursu/xero
src/Daursu/Xero/models/BaseModel.php
BaseModel.parseResponse
protected function parseResponse($response, $setAttributes = true) { if ($response['code'] == 200) { $data = $this->api->parseResponse($response['response'], $response['format']); if ($response['format'] == 'xml') { $data = json_encode($data); $data = json_decode($data, true); } // print_r($d...
php
protected function parseResponse($response, $setAttributes = true) { if ($response['code'] == 200) { $data = $this->api->parseResponse($response['response'], $response['format']); if ($response['format'] == 'xml') { $data = json_encode($data); $data = json_decode($data, true); } // print_r($d...
[ "protected", "function", "parseResponse", "(", "$", "response", ",", "$", "setAttributes", "=", "true", ")", "{", "if", "(", "$", "response", "[", "'code'", "]", "==", "200", ")", "{", "$", "data", "=", "$", "this", "->", "api", "->", "parseResponse", ...
Parses the response retrieved from Xero, or throws an exception if it fails. @param array $response @return array
[ "Parses", "the", "response", "retrieved", "from", "Xero", "or", "throws", "an", "exception", "if", "it", "fails", "." ]
train
https://github.com/Daursu/xero/blob/f6ac2b0cd3123f9667fd07927bee6725d34df4a6/src/Daursu/Xero/models/BaseModel.php#L550-L576
phergie/phergie-irc-plugin-react-nickserv
src/Plugin.php
Plugin.handleNotice
public function handleNotice(UserEvent $event, Queue $queue) { // Ignore notices that aren't from the NickServ agent if (strcasecmp($event->getNick(), $this->botNick) !== 0) { return; } $connection = $event->getConnection(); $params = $event->getParams(); ...
php
public function handleNotice(UserEvent $event, Queue $queue) { // Ignore notices that aren't from the NickServ agent if (strcasecmp($event->getNick(), $this->botNick) !== 0) { return; } $connection = $event->getConnection(); $params = $event->getParams(); ...
[ "public", "function", "handleNotice", "(", "UserEvent", "$", "event", ",", "Queue", "$", "queue", ")", "{", "// Ignore notices that aren't from the NickServ agent", "if", "(", "strcasecmp", "(", "$", "event", "->", "getNick", "(", ")", ",", "$", "this", "->", ...
Responds to authentication requests and notifications of ghost connections being killed from NickServ. @param \Phergie\Irc\Event\UserEventInterface $event @param \Phergie\Irc\Bot\React\EventQueueInterface $queue
[ "Responds", "to", "authentication", "requests", "and", "notifications", "of", "ghost", "connections", "being", "killed", "from", "NickServ", "." ]
train
https://github.com/phergie/phergie-irc-plugin-react-nickserv/blob/0319c79314029bd1ebab0de04a67ff20705e36da/src/Plugin.php#L146-L173
phergie/phergie-irc-plugin-react-nickserv
src/Plugin.php
Plugin.handleNick
public function handleNick(UserEvent $event, Queue $queue) { $connection = $event->getConnection(); if (strcasecmp($event->getNick(), $connection->getNickname()) === 0) { $params = $event->getParams(); $connection->setNickname($params['nickname']); } }
php
public function handleNick(UserEvent $event, Queue $queue) { $connection = $event->getConnection(); if (strcasecmp($event->getNick(), $connection->getNickname()) === 0) { $params = $event->getParams(); $connection->setNickname($params['nickname']); } }
[ "public", "function", "handleNick", "(", "UserEvent", "$", "event", ",", "Queue", "$", "queue", ")", "{", "$", "connection", "=", "$", "event", "->", "getConnection", "(", ")", ";", "if", "(", "strcasecmp", "(", "$", "event", "->", "getNick", "(", ")",...
Changes the nick associated with the bot in local memory when a change to it is successfully registered with the server. @param \Phergie\Irc\Event\UserEventInterface $event @param \Phergie\Irc\Bot\React\EventQueueInterface $queue
[ "Changes", "the", "nick", "associated", "with", "the", "bot", "in", "local", "memory", "when", "a", "change", "to", "it", "is", "successfully", "registered", "with", "the", "server", "." ]
train
https://github.com/phergie/phergie-irc-plugin-react-nickserv/blob/0319c79314029bd1ebab0de04a67ff20705e36da/src/Plugin.php#L182-L189
phergie/phergie-irc-plugin-react-nickserv
src/Plugin.php
Plugin.handleNicknameInUse
public function handleNicknameInUse(ServerEvent $event, Queue $queue) { // Don't listen if ghost isn't enabled, or this isn't the first nickname-in-use error if (!$this->ghostEnabled || $this->ghostNick !== null) { return; } // Save the nick, so that we can send a ghost ...
php
public function handleNicknameInUse(ServerEvent $event, Queue $queue) { // Don't listen if ghost isn't enabled, or this isn't the first nickname-in-use error if (!$this->ghostEnabled || $this->ghostNick !== null) { return; } // Save the nick, so that we can send a ghost ...
[ "public", "function", "handleNicknameInUse", "(", "ServerEvent", "$", "event", ",", "Queue", "$", "queue", ")", "{", "// Don't listen if ghost isn't enabled, or this isn't the first nickname-in-use error", "if", "(", "!", "$", "this", "->", "ghostEnabled", "||", "$", "t...
Kick-starts the ghost process. @param \Phergie\Irc\Event\ServerEventInterface $event @param \Phergie\Irc\Bot\React\EventQueueInterface $queue
[ "Kick", "-", "starts", "the", "ghost", "process", "." ]
train
https://github.com/phergie/phergie-irc-plugin-react-nickserv/blob/0319c79314029bd1ebab0de04a67ff20705e36da/src/Plugin.php#L197-L207
phergie/phergie-irc-plugin-react-nickserv
src/Plugin.php
Plugin.handleGhost
public function handleGhost(ServerEvent $event, Queue $queue) { if ($this->ghostNick === null) { return; } // Attempt to kill the ghost connection $queue->ircPrivmsg($this->botNick, 'GHOST ' . $this->ghostNick . ' ' . $this->password); }
php
public function handleGhost(ServerEvent $event, Queue $queue) { if ($this->ghostNick === null) { return; } // Attempt to kill the ghost connection $queue->ircPrivmsg($this->botNick, 'GHOST ' . $this->ghostNick . ' ' . $this->password); }
[ "public", "function", "handleGhost", "(", "ServerEvent", "$", "event", ",", "Queue", "$", "queue", ")", "{", "if", "(", "$", "this", "->", "ghostNick", "===", "null", ")", "{", "return", ";", "}", "// Attempt to kill the ghost connection", "$", "queue", "->"...
Completes the ghost process. @param \Phergie\Irc\Event\ServerEventInterface $event @param \Phergie\Irc\Bot\React\EventQueueInterface $queue
[ "Completes", "the", "ghost", "process", "." ]
train
https://github.com/phergie/phergie-irc-plugin-react-nickserv/blob/0319c79314029bd1ebab0de04a67ff20705e36da/src/Plugin.php#L215-L223
phergie/phergie-irc-plugin-react-nickserv
src/Plugin.php
Plugin.getConfigOption
protected function getConfigOption(array $config, $key) { if (empty($config[$key]) || !is_string($config[$key])) { throw new \DomainException( "$key must be a non-empty string" ); } return $config[$key]; }
php
protected function getConfigOption(array $config, $key) { if (empty($config[$key]) || !is_string($config[$key])) { throw new \DomainException( "$key must be a non-empty string" ); } return $config[$key]; }
[ "protected", "function", "getConfigOption", "(", "array", "$", "config", ",", "$", "key", ")", "{", "if", "(", "empty", "(", "$", "config", "[", "$", "key", "]", ")", "||", "!", "is_string", "(", "$", "config", "[", "$", "key", "]", ")", ")", "{"...
Extracts a string from the config options map. @param array $config @param string $key @return string @throws \DomainException if password is unspecified or not a string
[ "Extracts", "a", "string", "from", "the", "config", "options", "map", "." ]
train
https://github.com/phergie/phergie-irc-plugin-react-nickserv/blob/0319c79314029bd1ebab0de04a67ff20705e36da/src/Plugin.php#L233-L241
maestroprog/saw-php
src/Command/AbstractCommand.php
AbstractCommand.dispatchResult
public function dispatchResult($result, int $code) { $this->accomplishedResult = $result; $this->accomplished = true; $this->successful = CommandDispatcher::CODE_SUCCESS === $code; switch ($code) { case CommandDispatcher::CODE_SUCCESS: if (is_callable($thi...
php
public function dispatchResult($result, int $code) { $this->accomplishedResult = $result; $this->accomplished = true; $this->successful = CommandDispatcher::CODE_SUCCESS === $code; switch ($code) { case CommandDispatcher::CODE_SUCCESS: if (is_callable($thi...
[ "public", "function", "dispatchResult", "(", "$", "result", ",", "int", "$", "code", ")", "{", "$", "this", "->", "accomplishedResult", "=", "$", "result", ";", "$", "this", "->", "accomplished", "=", "true", ";", "$", "this", "->", "successful", "=", ...
Метод вызывается диспетчером команд, и он реализует механизм вызова колбэков, назначаемых в @see CommandCode::onSuccess() и @see CommandCode::onError(). @param mixed $result @param int $code @return void @throws \RuntimeException Исключение бросается в случае получения неизвестного статуса выполнения команды
[ "Метод", "вызывается", "диспетчером", "команд", "и", "он", "реализует", "механизм", "вызова", "колбэков", "назначаемых", "в", "@see", "CommandCode", "::", "onSuccess", "()", "и", "@see", "CommandCode", "::", "onError", "()", "." ]
train
https://github.com/maestroprog/saw-php/blob/159215a4d7a951cca2a9c2eed3e1aa4f5b624cfb/src/Command/AbstractCommand.php#L90-L109
willishq/laravel5-flash
src/Flash.php
Flash.message
protected function message($message, $title = '', $type = 'info') { $this->message = $message; $this->title = $title; $this->type = $type; $this->session->flash($this->namespace, (array) $this); }
php
protected function message($message, $title = '', $type = 'info') { $this->message = $message; $this->title = $title; $this->type = $type; $this->session->flash($this->namespace, (array) $this); }
[ "protected", "function", "message", "(", "$", "message", ",", "$", "title", "=", "''", ",", "$", "type", "=", "'info'", ")", "{", "$", "this", "->", "message", "=", "$", "message", ";", "$", "this", "->", "title", "=", "$", "title", ";", "$", "th...
Setup the flash messsage data. @param string $message @param string $title @param string $level
[ "Setup", "the", "flash", "messsage", "data", "." ]
train
https://github.com/willishq/laravel5-flash/blob/47f436b30e5a2f5b06a742e8ed9d49251eac5589/src/Flash.php#L68-L74
FrenzelGmbH/cm-address
controllers/AddressController.php
AddressController.actionDelete
public function actionDelete($id) { $date = new DateTime('now'); $model = $this->findModel($id); $model->deleted_at = $date->format("U"); $model->save(); return $this->redirect(['index']); }
php
public function actionDelete($id) { $date = new DateTime('now'); $model = $this->findModel($id); $model->deleted_at = $date->format("U"); $model->save(); return $this->redirect(['index']); }
[ "public", "function", "actionDelete", "(", "$", "id", ")", "{", "$", "date", "=", "new", "DateTime", "(", "'now'", ")", ";", "$", "model", "=", "$", "this", "->", "findModel", "(", "$", "id", ")", ";", "$", "model", "->", "deleted_at", "=", "$", ...
Deletes an existing Address model. If deletion is successful, the browser will be redirected to the 'index' page. @param integer $id @return mixed
[ "Deletes", "an", "existing", "Address", "model", ".", "If", "deletion", "is", "successful", "the", "browser", "will", "be", "redirected", "to", "the", "index", "page", "." ]
train
https://github.com/FrenzelGmbH/cm-address/blob/4295671dc603beed4bea6c5a7f77dac9846127f3/controllers/AddressController.php#L101-L109
heidelpay/PhpDoc
src/phpDocumentor/Plugin/Core/ServiceProvider.php
ServiceProvider.register
public function register(Application $app) { $this->registerTranslationMessages($app); $this->registerWriters($app); $this->registerDependenciesOnXsltExtension($app); $app->register(new \phpDocumentor\Plugin\Graphs\ServiceProvider()); $app->register(new \phpDocumentor\Plugin...
php
public function register(Application $app) { $this->registerTranslationMessages($app); $this->registerWriters($app); $this->registerDependenciesOnXsltExtension($app); $app->register(new \phpDocumentor\Plugin\Graphs\ServiceProvider()); $app->register(new \phpDocumentor\Plugin...
[ "public", "function", "register", "(", "Application", "$", "app", ")", "{", "$", "this", "->", "registerTranslationMessages", "(", "$", "app", ")", ";", "$", "this", "->", "registerWriters", "(", "$", "app", ")", ";", "$", "this", "->", "registerDependenci...
Registers services on the given app. @param Application $app An Application instance. @return void
[ "Registers", "services", "on", "the", "given", "app", "." ]
train
https://github.com/heidelpay/PhpDoc/blob/5ac9e842cbd4cbb70900533b240c131f3515ee02/src/phpDocumentor/Plugin/Core/ServiceProvider.php#L36-L44
heidelpay/PhpDoc
src/phpDocumentor/Plugin/Core/ServiceProvider.php
ServiceProvider.registerWriters
private function registerWriters(Application $app) { $writerCollection = $this->getWriterCollection($app); $writerCollection['FileIo'] = new Writer\FileIo(); $writerCollection['checkstyle'] = new Writer\Checkstyle(); $writerCollection['sourcecode'] = new Writer\Sourcecode(); ...
php
private function registerWriters(Application $app) { $writerCollection = $this->getWriterCollection($app); $writerCollection['FileIo'] = new Writer\FileIo(); $writerCollection['checkstyle'] = new Writer\Checkstyle(); $writerCollection['sourcecode'] = new Writer\Sourcecode(); ...
[ "private", "function", "registerWriters", "(", "Application", "$", "app", ")", "{", "$", "writerCollection", "=", "$", "this", "->", "getWriterCollection", "(", "$", "app", ")", ";", "$", "writerCollection", "[", "'FileIo'", "]", "=", "new", "Writer", "\\", ...
Creates all writers for this plugin and adds them to the WriterCollection object. This action will enable transformations in templates to make use of these writers. @param Application $app @return void
[ "Creates", "all", "writers", "for", "this", "plugin", "and", "adds", "them", "to", "the", "WriterCollection", "object", "." ]
train
https://github.com/heidelpay/PhpDoc/blob/5ac9e842cbd4cbb70900533b240c131f3515ee02/src/phpDocumentor/Plugin/Core/ServiceProvider.php#L55-L68