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
Eresus/EresusCMS
src/core/framework/core/3rdparty/ezcomponents/Mail/src/transports/imap/imap_transport.php
ezcMailImapTransport.fetchByMessageNr
public function fetchByMessageNr( $number, $deleteFromServer = false ) { if ( $this->options->uidReferencing ) { $messages = array_flip( $this->listUniqueIdentifiers() ); } else { $messages = $this->listMessages(); } if ( !isset( $mess...
php
public function fetchByMessageNr( $number, $deleteFromServer = false ) { if ( $this->options->uidReferencing ) { $messages = array_flip( $this->listUniqueIdentifiers() ); } else { $messages = $this->listMessages(); } if ( !isset( $mess...
[ "public", "function", "fetchByMessageNr", "(", "$", "number", ",", "$", "deleteFromServer", "=", "false", ")", "{", "if", "(", "$", "this", "->", "options", "->", "uidReferencing", ")", "{", "$", "messages", "=", "array_flip", "(", "$", "this", "->", "li...
Returns an {@link ezcMailImapSet} containing only the $number -th message in the current mailbox. This method supports unique IDs instead of message numbers. See {@link ezcMailImapTransportOptions} for how to enable unique IDs referencing. If $deleteFromServer is set to true the mail will be marked for deletion after...
[ "Returns", "an", "{", "@link", "ezcMailImapSet", "}", "containing", "only", "the", "$number", "-", "th", "message", "in", "the", "current", "mailbox", "." ]
train
https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Mail/src/transports/imap/imap_transport.php#L1528-L1545
Eresus/EresusCMS
src/core/framework/core/3rdparty/ezcomponents/Mail/src/transports/imap/imap_transport.php
ezcMailImapTransport.fetchFromOffset
public function fetchFromOffset( $offset, $count = 0, $deleteFromServer = false ) { if ( $count < 0 ) { throw new ezcMailInvalidLimitException( $offset, $count ); } if ( $this->options->uidReferencing ) { $messages = array_values( $this->listUniqueIde...
php
public function fetchFromOffset( $offset, $count = 0, $deleteFromServer = false ) { if ( $count < 0 ) { throw new ezcMailInvalidLimitException( $offset, $count ); } if ( $this->options->uidReferencing ) { $messages = array_values( $this->listUniqueIde...
[ "public", "function", "fetchFromOffset", "(", "$", "offset", ",", "$", "count", "=", "0", ",", "$", "deleteFromServer", "=", "false", ")", "{", "if", "(", "$", "count", "<", "0", ")", "{", "throw", "new", "ezcMailInvalidLimitException", "(", "$", "offset...
Returns an {@link ezcMailImapSet} with $count messages starting from $offset from the current mailbox. This method supports unique IDs instead of message numbers. See {@link ezcMailImapTransportOptions} for how to enable unique IDs referencing. Fetches $count messages starting from the $offset and returns them as a {...
[ "Returns", "an", "{", "@link", "ezcMailImapSet", "}", "with", "$count", "messages", "starting", "from", "$offset", "from", "the", "current", "mailbox", "." ]
train
https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Mail/src/transports/imap/imap_transport.php#L1586-L1632
Eresus/EresusCMS
src/core/framework/core/3rdparty/ezcomponents/Mail/src/transports/imap/imap_transport.php
ezcMailImapTransport.searchMailbox
public function searchMailbox( $criteria = null ) { $uid = ( $this->options->uidReferencing ) ? self::UID : self::NO_UID; if ( $this->state != self::STATE_SELECTED && $this->state != self::STATE_SELECTED_READONLY ) { throw new ezcMailTransportException( "Can't call ...
php
public function searchMailbox( $criteria = null ) { $uid = ( $this->options->uidReferencing ) ? self::UID : self::NO_UID; if ( $this->state != self::STATE_SELECTED && $this->state != self::STATE_SELECTED_READONLY ) { throw new ezcMailTransportException( "Can't call ...
[ "public", "function", "searchMailbox", "(", "$", "criteria", "=", "null", ")", "{", "$", "uid", "=", "(", "$", "this", "->", "options", "->", "uidReferencing", ")", "?", "self", "::", "UID", ":", "self", "::", "NO_UID", ";", "if", "(", "$", "this", ...
Returns an {@link ezcMailImapSet} containing the messages which match the provided $criteria from the current mailbox. This method supports unique IDs instead of message numbers. See {@link ezcMailImapTransportOptions} for how to enable unique IDs referencing. See {@link http://www.faqs.org/rfcs/rfc1730.html} - 6.4.4...
[ "Returns", "an", "{", "@link", "ezcMailImapSet", "}", "containing", "the", "messages", "which", "match", "the", "provided", "$criteria", "from", "the", "current", "mailbox", "." ]
train
https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Mail/src/transports/imap/imap_transport.php#L1680-L1717
Eresus/EresusCMS
src/core/framework/core/3rdparty/ezcomponents/Mail/src/transports/imap/imap_transport.php
ezcMailImapTransport.sortFromOffset
public function sortFromOffset( $offset, $count = 0, $sortCriteria, $reverse = false ) { if ( $count < 0 ) { throw new ezcMailInvalidLimitException( $offset, $count ); } $range = array(); if ( $this->options->uidReferencing ) { $uids = array_v...
php
public function sortFromOffset( $offset, $count = 0, $sortCriteria, $reverse = false ) { if ( $count < 0 ) { throw new ezcMailInvalidLimitException( $offset, $count ); } $range = array(); if ( $this->options->uidReferencing ) { $uids = array_v...
[ "public", "function", "sortFromOffset", "(", "$", "offset", ",", "$", "count", "=", "0", ",", "$", "sortCriteria", ",", "$", "reverse", "=", "false", ")", "{", "if", "(", "$", "count", "<", "0", ")", "{", "throw", "new", "ezcMailInvalidLimitException", ...
Returns an {@link ezcMailImapSet} containing $count messages starting from $offset sorted by $sortCriteria from the current mailbox. This method supports unique IDs instead of message numbers. See {@link ezcMailImapTransportOptions} for how to enable unique IDs referencing. It is useful for paging through a mailbox. ...
[ "Returns", "an", "{", "@link", "ezcMailImapSet", "}", "containing", "$count", "messages", "starting", "from", "$offset", "sorted", "by", "$sortCriteria", "from", "the", "current", "mailbox", "." ]
train
https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Mail/src/transports/imap/imap_transport.php#L1764-L1817
Eresus/EresusCMS
src/core/framework/core/3rdparty/ezcomponents/Mail/src/transports/imap/imap_transport.php
ezcMailImapTransport.sortMessages
public function sortMessages( $messages, $sortCriteria, $reverse = false ) { $messages = $this->sort( $messages, $sortCriteria, $reverse ); return new ezcMailImapSet( $this->connection, array_keys ( $messages ), false, array( 'uidReferencing' => $this->options->uidReferencing ) ); }
php
public function sortMessages( $messages, $sortCriteria, $reverse = false ) { $messages = $this->sort( $messages, $sortCriteria, $reverse ); return new ezcMailImapSet( $this->connection, array_keys ( $messages ), false, array( 'uidReferencing' => $this->options->uidReferencing ) ); }
[ "public", "function", "sortMessages", "(", "$", "messages", ",", "$", "sortCriteria", ",", "$", "reverse", "=", "false", ")", "{", "$", "messages", "=", "$", "this", "->", "sort", "(", "$", "messages", ",", "$", "sortCriteria", ",", "$", "reverse", ")"...
Returns an {@link ezcMailImapSet} containing messages $messages sorted by $sortCriteria from the current mailbox. This method supports unique IDs instead of message numbers. See {@link ezcMailImapTransportOptions} for how to enable unique IDs referencing. $messages is an array of message numbers, for example: <code> ...
[ "Returns", "an", "{", "@link", "ezcMailImapSet", "}", "containing", "messages", "$messages", "sorted", "by", "$sortCriteria", "from", "the", "current", "mailbox", "." ]
train
https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Mail/src/transports/imap/imap_transport.php#L1859-L1863
Eresus/EresusCMS
src/core/framework/core/3rdparty/ezcomponents/Mail/src/transports/imap/imap_transport.php
ezcMailImapTransport.fetchByFlag
public function fetchByFlag( $flag ) { $messages = $this->searchByFlag( $flag ); return new ezcMailImapSet( $this->connection, $messages, false, array( 'uidReferencing' => $this->options->uidReferencing ) ); }
php
public function fetchByFlag( $flag ) { $messages = $this->searchByFlag( $flag ); return new ezcMailImapSet( $this->connection, $messages, false, array( 'uidReferencing' => $this->options->uidReferencing ) ); }
[ "public", "function", "fetchByFlag", "(", "$", "flag", ")", "{", "$", "messages", "=", "$", "this", "->", "searchByFlag", "(", "$", "flag", ")", ";", "return", "new", "ezcMailImapSet", "(", "$", "this", "->", "connection", ",", "$", "messages", ",", "f...
Returns an {@link ezcMailImapSet} containing messages with a certain flag from the current mailbox. This method supports unique IDs instead of message numbers. See {@link ezcMailImapTransportOptions} for how to enable unique IDs referencing. $flag can be one of: Basic flags: - ANSWERED - message has been answered ...
[ "Returns", "an", "{", "@link", "ezcMailImapSet", "}", "containing", "messages", "with", "a", "certain", "flag", "from", "the", "current", "mailbox", "." ]
train
https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Mail/src/transports/imap/imap_transport.php#L1918-L1922
Eresus/EresusCMS
src/core/framework/core/3rdparty/ezcomponents/Mail/src/transports/imap/imap_transport.php
ezcMailImapTransport.countByFlag
public function countByFlag( $flag ) { $flag = $this->normalizeFlag( $flag ); $messages = $this->searchByFlag( $flag ); return count( $messages ); }
php
public function countByFlag( $flag ) { $flag = $this->normalizeFlag( $flag ); $messages = $this->searchByFlag( $flag ); return count( $messages ); }
[ "public", "function", "countByFlag", "(", "$", "flag", ")", "{", "$", "flag", "=", "$", "this", "->", "normalizeFlag", "(", "$", "flag", ")", ";", "$", "messages", "=", "$", "this", "->", "searchByFlag", "(", "$", "flag", ")", ";", "return", "count",...
Wrapper function to fetch count of messages by a certain flag. $flag can be one of: Basic flags: - ANSWERED - message has been answered - DELETED - message is marked to be deleted by later EXPUNGE - DRAFT - message is marked as a draft - FLAGGED - message is "flagged" for urgent/special attention - RECEN...
[ "Wrapper", "function", "to", "fetch", "count", "of", "messages", "by", "a", "certain", "flag", "." ]
train
https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Mail/src/transports/imap/imap_transport.php#L1960-L1965
Eresus/EresusCMS
src/core/framework/core/3rdparty/ezcomponents/Mail/src/transports/imap/imap_transport.php
ezcMailImapTransport.setFlag
public function setFlag( $messages, $flag ) { $uid = ( $this->options->uidReferencing ) ? self::UID : self::NO_UID; if ( $this->state != self::STATE_SELECTED ) { throw new ezcMailTransportException( "Can't call setFlag() when a mailbox is not selected." ); } $fl...
php
public function setFlag( $messages, $flag ) { $uid = ( $this->options->uidReferencing ) ? self::UID : self::NO_UID; if ( $this->state != self::STATE_SELECTED ) { throw new ezcMailTransportException( "Can't call setFlag() when a mailbox is not selected." ); } $fl...
[ "public", "function", "setFlag", "(", "$", "messages", ",", "$", "flag", ")", "{", "$", "uid", "=", "(", "$", "this", "->", "options", "->", "uidReferencing", ")", "?", "self", "::", "UID", ":", "self", "::", "NO_UID", ";", "if", "(", "$", "this", ...
Sets $flag on $messages. This method supports unique IDs instead of message numbers. See {@link ezcMailImapTransportOptions} for how to enable unique IDs referencing. $messages can be: - a single message number (eg. 1) - a message range (eg. 1:4) - a message list (eg. 1,2,4) $flag can be one of: - ANSWERED - messa...
[ "Sets", "$flag", "on", "$messages", "." ]
train
https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Mail/src/transports/imap/imap_transport.php#L2098-L2123
Eresus/EresusCMS
src/core/framework/core/3rdparty/ezcomponents/Mail/src/transports/imap/imap_transport.php
ezcMailImapTransport.searchByFlag
protected function searchByFlag( $flag ) { $uid = ( $this->options->uidReferencing ) ? self::UID : self::NO_UID; if ( $this->state != self::STATE_SELECTED && $this->state != self::STATE_SELECTED_READONLY ) { throw new ezcMailTransportException( "Can't call searchByF...
php
protected function searchByFlag( $flag ) { $uid = ( $this->options->uidReferencing ) ? self::UID : self::NO_UID; if ( $this->state != self::STATE_SELECTED && $this->state != self::STATE_SELECTED_READONLY ) { throw new ezcMailTransportException( "Can't call searchByF...
[ "protected", "function", "searchByFlag", "(", "$", "flag", ")", "{", "$", "uid", "=", "(", "$", "this", "->", "options", "->", "uidReferencing", ")", "?", "self", "::", "UID", ":", "self", "::", "NO_UID", ";", "if", "(", "$", "this", "->", "state", ...
Returns an array of message numbers from the selected mailbox which have a certain flag set. This method supports unique IDs instead of message numbers. See {@link ezcMailImapTransportOptions} for how to enable unique IDs referencing. $flag can be one of: Basic flags: - ANSWERED - message has been answered - DELET...
[ "Returns", "an", "array", "of", "message", "numbers", "from", "the", "selected", "mailbox", "which", "have", "a", "certain", "flag", "set", "." ]
train
https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Mail/src/transports/imap/imap_transport.php#L2241-L2278
Eresus/EresusCMS
src/core/framework/core/3rdparty/ezcomponents/Mail/src/transports/imap/imap_transport.php
ezcMailImapTransport.noop
public function noop() { if ( $this->state != self::STATE_NOT_AUTHENTICATED && $this->state != self::STATE_AUTHENTICATED && $this->state != self::STATE_SELECTED && $this->state != self::STATE_SELECTED_READONLY ) { throw new ezcMailTransportException...
php
public function noop() { if ( $this->state != self::STATE_NOT_AUTHENTICATED && $this->state != self::STATE_AUTHENTICATED && $this->state != self::STATE_SELECTED && $this->state != self::STATE_SELECTED_READONLY ) { throw new ezcMailTransportException...
[ "public", "function", "noop", "(", ")", "{", "if", "(", "$", "this", "->", "state", "!=", "self", "::", "STATE_NOT_AUTHENTICATED", "&&", "$", "this", "->", "state", "!=", "self", "::", "STATE_AUTHENTICATED", "&&", "$", "this", "->", "state", "!=", "self"...
Sends a NOOP command to the server, use it to keep the connection alive. Before calling this method, a connection to the IMAP server must be established. @throws ezcMailTransportException if there was no connection to the server or if the server sent a negative response
[ "Sends", "a", "NOOP", "command", "to", "the", "server", "use", "it", "to", "keep", "the", "connection", "alive", "." ]
train
https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Mail/src/transports/imap/imap_transport.php#L2290-L2307
Eresus/EresusCMS
src/core/framework/core/3rdparty/ezcomponents/Mail/src/transports/imap/imap_transport.php
ezcMailImapTransport.capability
public function capability() { if ( $this->state != self::STATE_NOT_AUTHENTICATED && $this->state != self::STATE_AUTHENTICATED && $this->state != self::STATE_SELECTED && $this->state != self::STATE_SELECTED_READONLY ) { throw new ezcMailTransportExc...
php
public function capability() { if ( $this->state != self::STATE_NOT_AUTHENTICATED && $this->state != self::STATE_AUTHENTICATED && $this->state != self::STATE_SELECTED && $this->state != self::STATE_SELECTED_READONLY ) { throw new ezcMailTransportExc...
[ "public", "function", "capability", "(", ")", "{", "if", "(", "$", "this", "->", "state", "!=", "self", "::", "STATE_NOT_AUTHENTICATED", "&&", "$", "this", "->", "state", "!=", "self", "::", "STATE_AUTHENTICATED", "&&", "$", "this", "->", "state", "!=", ...
Returns an array with the capabilities of the IMAP server. The returned array will be something like this: <code> array( 'IMAP4rev1', 'SASL-IR SORT', 'THREAD=REFERENCES', 'MULTIAPPEND', 'UNSELECT', 'LITERAL+', 'IDLE', 'CHILDREN', 'NAMESPACE', 'LOGIN-REFERRALS' ); </code> Before calling this method, a connection to th...
[ "Returns", "an", "array", "with", "the", "capabilities", "of", "the", "IMAP", "server", "." ]
train
https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Mail/src/transports/imap/imap_transport.php#L2328-L2356
Eresus/EresusCMS
src/core/framework/core/3rdparty/ezcomponents/Mail/src/transports/imap/imap_transport.php
ezcMailImapTransport.expunge
public function expunge() { if ( $this->state != self::STATE_SELECTED ) { throw new ezcMailTransportException( "Can not issue EXPUNGE command if a mailbox is not selected." ); } $tag = $this->getNextTag(); $this->connection->sendData( "{$tag} EXPUNGE" ); ...
php
public function expunge() { if ( $this->state != self::STATE_SELECTED ) { throw new ezcMailTransportException( "Can not issue EXPUNGE command if a mailbox is not selected." ); } $tag = $this->getNextTag(); $this->connection->sendData( "{$tag} EXPUNGE" ); ...
[ "public", "function", "expunge", "(", ")", "{", "if", "(", "$", "this", "->", "state", "!=", "self", "::", "STATE_SELECTED", ")", "{", "throw", "new", "ezcMailTransportException", "(", "\"Can not issue EXPUNGE command if a mailbox is not selected.\"", ")", ";", "}",...
Sends an EXPUNGE command to the server. This method permanently deletes the messages marked for deletion by the method {@link delete()}. Before calling this method, a connection to the IMAP server must be established and a user must be authenticated successfully, and a mailbox must be selected. @throws ezcMailTransp...
[ "Sends", "an", "EXPUNGE", "command", "to", "the", "server", "." ]
train
https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Mail/src/transports/imap/imap_transport.php#L2372-L2386
Eresus/EresusCMS
src/core/framework/core/3rdparty/ezcomponents/Mail/src/transports/imap/imap_transport.php
ezcMailImapTransport.append
public function append( $mailbox, $mail, $flags = null ) { if ( $this->state != self::STATE_AUTHENTICATED && $this->state != self::STATE_SELECTED && $this->state != self::STATE_SELECTED_READONLY ) { throw new ezcMailTransportException( "Can't call append() if no...
php
public function append( $mailbox, $mail, $flags = null ) { if ( $this->state != self::STATE_AUTHENTICATED && $this->state != self::STATE_SELECTED && $this->state != self::STATE_SELECTED_READONLY ) { throw new ezcMailTransportException( "Can't call append() if no...
[ "public", "function", "append", "(", "$", "mailbox", ",", "$", "mail", ",", "$", "flags", "=", "null", ")", "{", "if", "(", "$", "this", "->", "state", "!=", "self", "::", "STATE_AUTHENTICATED", "&&", "$", "this", "->", "state", "!=", "self", "::", ...
Appends $mail to the $mailbox mailbox. Use this method to create email messages in a mailbox such as Sent or Draft. $flags is an array of flags to be set to the $mail (if provided): $flag can be one of: - ANSWERED - message has been answered - DELETED - message is marked to be deleted by later EXPUNGE - DRAFT ...
[ "Appends", "$mail", "to", "the", "$mailbox", "mailbox", "." ]
train
https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Mail/src/transports/imap/imap_transport.php#L2417-L2463
Eresus/EresusCMS
src/core/framework/core/3rdparty/ezcomponents/Mail/src/transports/imap/imap_transport.php
ezcMailImapTransport.normalizeFlag
protected function normalizeFlag( $flag ) { $flag = strtoupper( $flag ); $flag = str_replace( '\\', '', $flag ); return trim( $flag ); }
php
protected function normalizeFlag( $flag ) { $flag = strtoupper( $flag ); $flag = str_replace( '\\', '', $flag ); return trim( $flag ); }
[ "protected", "function", "normalizeFlag", "(", "$", "flag", ")", "{", "$", "flag", "=", "strtoupper", "(", "$", "flag", ")", ";", "$", "flag", "=", "str_replace", "(", "'\\\\'", ",", "''", ",", "$", "flag", ")", ";", "return", "trim", "(", "$", "fl...
Clears $flag of unwanted characters and makes it uppercase. @param string $flag @return string
[ "Clears", "$flag", "of", "unwanted", "characters", "and", "makes", "it", "uppercase", "." ]
train
https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Mail/src/transports/imap/imap_transport.php#L2471-L2476
Eresus/EresusCMS
src/core/framework/core/3rdparty/ezcomponents/Mail/src/transports/imap/imap_transport.php
ezcMailImapTransport.sort
protected function sort( $messages, $sortCriteria, $reverse = false ) { $uid = ( $this->options->uidReferencing ) ? self::UID : self::NO_UID; if ( $this->state != self::STATE_SELECTED && $this->state != self::STATE_SELECTED_READONLY ) { throw new ezcMailTransportExc...
php
protected function sort( $messages, $sortCriteria, $reverse = false ) { $uid = ( $this->options->uidReferencing ) ? self::UID : self::NO_UID; if ( $this->state != self::STATE_SELECTED && $this->state != self::STATE_SELECTED_READONLY ) { throw new ezcMailTransportExc...
[ "protected", "function", "sort", "(", "$", "messages", ",", "$", "sortCriteria", ",", "$", "reverse", "=", "false", ")", "{", "$", "uid", "=", "(", "$", "this", "->", "options", "->", "uidReferencing", ")", "?", "self", "::", "UID", ":", "self", "::"...
Sorts message numbers array $messages by the specified $sortCriteria. This method supports unique IDs instead of message numbers. See {@link ezcMailImapTransportOptions} for how to enable unique IDs referencing. $messages is an array of message numbers, for example: <code> array( 1, 2, 4 ); </code> $sortCriteria is ...
[ "Sorts", "message", "numbers", "array", "$messages", "by", "the", "specified", "$sortCriteria", "." ]
train
https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Mail/src/transports/imap/imap_transport.php#L2507-L2584
Eresus/EresusCMS
src/core/framework/core/3rdparty/ezcomponents/Mail/src/transports/imap/imap_transport.php
ezcMailImapTransport.responseType
protected function responseType( $line ) { if ( strpos( $line, 'OK ' ) !== false && strpos( $line, 'OK ' ) == 6 ) { return self::RESPONSE_OK; } if ( strpos( $line, 'NO ' ) !== false && strpos( $line, 'NO ' ) == 6 ) { return self::RESPONSE_NO; }...
php
protected function responseType( $line ) { if ( strpos( $line, 'OK ' ) !== false && strpos( $line, 'OK ' ) == 6 ) { return self::RESPONSE_OK; } if ( strpos( $line, 'NO ' ) !== false && strpos( $line, 'NO ' ) == 6 ) { return self::RESPONSE_NO; }...
[ "protected", "function", "responseType", "(", "$", "line", ")", "{", "if", "(", "strpos", "(", "$", "line", ",", "'OK '", ")", "!==", "false", "&&", "strpos", "(", "$", "line", ",", "'OK '", ")", "==", "6", ")", "{", "return", "self", "::", "RESPON...
Parses $line to return the response code. Returns one of the following: - {@link RESPONSE_OK} - {@link RESPONSE_NO} - {@link RESPONSE_BAD} - {@link RESPONSE_UNTAGGED} - {@link RESPONSE_FEEDBACK} @throws ezcMailTransportException if the IMAP response ($line) is not recognized @param string $line @return int
[ "Parses", "$line", "to", "return", "the", "response", "code", "." ]
train
https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Mail/src/transports/imap/imap_transport.php#L2601-L2624
Eresus/EresusCMS
src/core/framework/core/3rdparty/ezcomponents/Mail/src/transports/imap/imap_transport.php
ezcMailImapTransport.getResponse
protected function getResponse( $tag, $response = null ) { if ( is_null( $response ) ) { $response = $this->connection->getLine(); } while ( strpos( $response, $tag ) === false ) { if ( strpos( $response, ' BAD ' ) !== false || strpos(...
php
protected function getResponse( $tag, $response = null ) { if ( is_null( $response ) ) { $response = $this->connection->getLine(); } while ( strpos( $response, $tag ) === false ) { if ( strpos( $response, ' BAD ' ) !== false || strpos(...
[ "protected", "function", "getResponse", "(", "$", "tag", ",", "$", "response", "=", "null", ")", "{", "if", "(", "is_null", "(", "$", "response", ")", ")", "{", "$", "response", "=", "$", "this", "->", "connection", "->", "getLine", "(", ")", ";", ...
Reads the responses from the server until encountering $tag. In IMAP, each command sent by the client is prepended with a alphanumeric tag like 'A1234'. The server sends the response to the client command as lines, and the last line in the response is prepended with the same tag, and it contains the status of the comm...
[ "Reads", "the", "responses", "from", "the", "server", "until", "encountering", "$tag", "." ]
train
https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Mail/src/transports/imap/imap_transport.php#L2651-L2667
Eresus/EresusCMS
src/core/framework/core/3rdparty/ezcomponents/Mail/src/transports/imap/imap_transport.php
ezcMailImapTransport.getNextTag
protected function getNextTag() { $tagLetter = substr( $this->currentTag, 0, 1 ); $tagNumber = intval( substr( $this->currentTag, 1 ) ); $tagNumber++; if ( $tagLetter == 'Z' && $tagNumber == 10000 ) { $tagLetter = 'A'; $tagNumber = 1; } ...
php
protected function getNextTag() { $tagLetter = substr( $this->currentTag, 0, 1 ); $tagNumber = intval( substr( $this->currentTag, 1 ) ); $tagNumber++; if ( $tagLetter == 'Z' && $tagNumber == 10000 ) { $tagLetter = 'A'; $tagNumber = 1; } ...
[ "protected", "function", "getNextTag", "(", ")", "{", "$", "tagLetter", "=", "substr", "(", "$", "this", "->", "currentTag", ",", "0", ",", "1", ")", ";", "$", "tagNumber", "=", "intval", "(", "substr", "(", "$", "this", "->", "currentTag", ",", "1",...
Generates the next IMAP tag to prepend to client commands. The structure of the IMAP tag is Axxxx, where: - A is a letter (uppercase for conformity) - x is a digit from 0 to 9 example of generated tag: T5439 It uses the class variable $this->currentTag. Everytime it is called, the tag increases by 1. If it reaches...
[ "Generates", "the", "next", "IMAP", "tag", "to", "prepend", "to", "client", "commands", "." ]
train
https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Mail/src/transports/imap/imap_transport.php#L2688-L2705
Eresus/EresusCMS
src/core/framework/core/3rdparty/ezcomponents/Mail/src/transports/imap/imap_transport.php
ezcMailImapTransport.getMessageSectionSize
protected function getMessageSectionSize( $response ) { $size = 0; preg_match( '/\{(.*)\}/', $response, $matches ); if ( count( $matches ) > 0 ) { $size = (int) $matches[1]; } return $size; }
php
protected function getMessageSectionSize( $response ) { $size = 0; preg_match( '/\{(.*)\}/', $response, $matches ); if ( count( $matches ) > 0 ) { $size = (int) $matches[1]; } return $size; }
[ "protected", "function", "getMessageSectionSize", "(", "$", "response", ")", "{", "$", "size", "=", "0", ";", "preg_match", "(", "'/\\{(.*)\\}/'", ",", "$", "response", ",", "$", "matches", ")", ";", "if", "(", "count", "(", "$", "matches", ")", ">", "...
Returns the size of a FETCH section in bytes. The section header looks like: * id FETCH (BODY[TEXT] {size} where size is the size in bytes and id is the message number or ID. Example: for " * 2 FETCH (BODY[TEXT] {377}" this function returns 377. @return int
[ "Returns", "the", "size", "of", "a", "FETCH", "section", "in", "bytes", "." ]
train
https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Mail/src/transports/imap/imap_transport.php#L2717-L2726
Eresus/EresusCMS
src/core/framework/core/3rdparty/ezcomponents/Mail/src/transports/pop3/pop3_set.php
ezcMailPop3Set.getNextLine
public function getNextLine() { if ( $this->currentMessage === null ) { $this->nextMail(); } if ( $this->hasMoreMailData ) { $data = $this->connection->getLine(); if ( rtrim( $data ) === "." ) { $this->hasMoreMai...
php
public function getNextLine() { if ( $this->currentMessage === null ) { $this->nextMail(); } if ( $this->hasMoreMailData ) { $data = $this->connection->getLine(); if ( rtrim( $data ) === "." ) { $this->hasMoreMai...
[ "public", "function", "getNextLine", "(", ")", "{", "if", "(", "$", "this", "->", "currentMessage", "===", "null", ")", "{", "$", "this", "->", "nextMail", "(", ")", ";", "}", "if", "(", "$", "this", "->", "hasMoreMailData", ")", "{", "$", "data", ...
Returns one line of data from the current mail in the set. Null is returned if there is no current mail in the set or the end of the mail is reached. @return string
[ "Returns", "one", "line", "of", "data", "from", "the", "current", "mail", "in", "the", "set", "." ]
train
https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Mail/src/transports/pop3/pop3_set.php#L101-L124
Eresus/EresusCMS
src/core/framework/core/3rdparty/ezcomponents/Mail/src/transports/pop3/pop3_set.php
ezcMailPop3Set.nextMail
public function nextMail() { if ( $this->currentMessage === null ) { $this->currentMessage = reset( $this->messages ); } else { $this->currentMessage = next( $this->messages ); } if ( $this->currentMessage !== false ) { ...
php
public function nextMail() { if ( $this->currentMessage === null ) { $this->currentMessage = reset( $this->messages ); } else { $this->currentMessage = next( $this->messages ); } if ( $this->currentMessage !== false ) { ...
[ "public", "function", "nextMail", "(", ")", "{", "if", "(", "$", "this", "->", "currentMessage", "===", "null", ")", "{", "$", "this", "->", "currentMessage", "=", "reset", "(", "$", "this", "->", "messages", ")", ";", "}", "else", "{", "$", "this", ...
Moves the set to the next mail and returns true upon success. False is returned if there are no more mail in the set. @throws ezcMailTransportException if the server sent a negative response @return bool
[ "Moves", "the", "set", "to", "the", "next", "mail", "and", "returns", "true", "upon", "success", "." ]
train
https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Mail/src/transports/pop3/pop3_set.php#L135-L160
inhere/php-librarys
src/Traits/LiteContainerTrait.php
LiteContainerTrait.register
public function register($name, $service, $replace = false) { $this->set($name, $service, $replace); return $this; }
php
public function register($name, $service, $replace = false) { $this->set($name, $service, $replace); return $this; }
[ "public", "function", "register", "(", "$", "name", ",", "$", "service", ",", "$", "replace", "=", "false", ")", "{", "$", "this", "->", "set", "(", "$", "name", ",", "$", "service", ",", "$", "replace", ")", ";", "return", "$", "this", ";", "}" ...
register a app service @param string $name the service name @param mixed $service service @param bool $replace replace exists service @return static
[ "register", "a", "app", "service" ]
train
https://github.com/inhere/php-librarys/blob/e6ca598685469794f310e3ab0e2bc19519cd0ae6/src/Traits/LiteContainerTrait.php#L40-L45
zhouyl/mellivora
Mellivora/Database/Console/Migrations/MigrateCommand.php
MigrateCommand.fire
public function fire() { if (!$this->confirmToProceed()) { return; } $this->prepareDatabase(); // Next, we will check to see if a path option has been defined. If it has // we will use the path relative to the root of this installation folder // so that ...
php
public function fire() { if (!$this->confirmToProceed()) { return; } $this->prepareDatabase(); // Next, we will check to see if a path option has been defined. If it has // we will use the path relative to the root of this installation folder // so that ...
[ "public", "function", "fire", "(", ")", "{", "if", "(", "!", "$", "this", "->", "confirmToProceed", "(", ")", ")", "{", "return", ";", "}", "$", "this", "->", "prepareDatabase", "(", ")", ";", "// Next, we will check to see if a path option has been defined. If ...
Execute the console command. @return void
[ "Execute", "the", "console", "command", "." ]
train
https://github.com/zhouyl/mellivora/blob/79f844c5c9c25ffbe18d142062e9bc3df00b36a1/Mellivora/Database/Console/Migrations/MigrateCommand.php#L35-L64
zhouyl/mellivora
Mellivora/Database/Console/Migrations/MigrateCommand.php
MigrateCommand.prepareDatabase
protected function prepareDatabase() { $this->container['migrator']->setConnection($this->option('database')); if (!$this->container['migrator']->repositoryExists()) { $this->call( 'migrate:install', ['--database' => $this->option('database')] ...
php
protected function prepareDatabase() { $this->container['migrator']->setConnection($this->option('database')); if (!$this->container['migrator']->repositoryExists()) { $this->call( 'migrate:install', ['--database' => $this->option('database')] ...
[ "protected", "function", "prepareDatabase", "(", ")", "{", "$", "this", "->", "container", "[", "'migrator'", "]", "->", "setConnection", "(", "$", "this", "->", "option", "(", "'database'", ")", ")", ";", "if", "(", "!", "$", "this", "->", "container", ...
Prepare the migration database for running. @return void
[ "Prepare", "the", "migration", "database", "for", "running", "." ]
train
https://github.com/zhouyl/mellivora/blob/79f844c5c9c25ffbe18d142062e9bc3df00b36a1/Mellivora/Database/Console/Migrations/MigrateCommand.php#L71-L81
caffeinated/beverage
src/Traits/EventDispatcher.php
EventDispatcher.registerEvent
protected function registerEvent($name, Closure $callback) { if (! isset(static::$dispatcher)) { $this->initEventDispatcher(); } static::$dispatcher->listen($name, $callback); }
php
protected function registerEvent($name, Closure $callback) { if (! isset(static::$dispatcher)) { $this->initEventDispatcher(); } static::$dispatcher->listen($name, $callback); }
[ "protected", "function", "registerEvent", "(", "$", "name", ",", "Closure", "$", "callback", ")", "{", "if", "(", "!", "isset", "(", "static", "::", "$", "dispatcher", ")", ")", "{", "$", "this", "->", "initEventDispatcher", "(", ")", ";", "}", "static...
Register an event for the dispatcher to listen for. @param string $name @param Closure $callback @return void
[ "Register", "an", "event", "for", "the", "dispatcher", "to", "listen", "for", "." ]
train
https://github.com/caffeinated/beverage/blob/c7d612a1d3bc1baddc97fec60ab17224550efaf3/src/Traits/EventDispatcher.php#L55-L62
caffeinated/beverage
src/Traits/EventDispatcher.php
EventDispatcher.fireEvent
protected function fireEvent($name, $payload = null) { if (! isset(static::$dispatcher)) { $this->initEventDispatcher(); } static::$dispatcher->fire($name, $payload); }
php
protected function fireEvent($name, $payload = null) { if (! isset(static::$dispatcher)) { $this->initEventDispatcher(); } static::$dispatcher->fire($name, $payload); }
[ "protected", "function", "fireEvent", "(", "$", "name", ",", "$", "payload", "=", "null", ")", "{", "if", "(", "!", "isset", "(", "static", "::", "$", "dispatcher", ")", ")", "{", "$", "this", "->", "initEventDispatcher", "(", ")", ";", "}", "static"...
Fire off an event. @param string $name @param mixed $payload @return mixed
[ "Fire", "off", "an", "event", "." ]
train
https://github.com/caffeinated/beverage/blob/c7d612a1d3bc1baddc97fec60ab17224550efaf3/src/Traits/EventDispatcher.php#L71-L78
tigron/skeleton-file
migration/20160503_173014_init.php
Migration_20160503_173014_Init.up
public function up() { $db = Database::get(); $table = File::trait_get_database_table(); $tables = $db->get_column("SHOW TABLES LIKE '" . $table . "'", []); if (count($tables) == 0) { $db->query(" CREATE TABLE IF NOT EXISTS `" . $table . "` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `...
php
public function up() { $db = Database::get(); $table = File::trait_get_database_table(); $tables = $db->get_column("SHOW TABLES LIKE '" . $table . "'", []); if (count($tables) == 0) { $db->query(" CREATE TABLE IF NOT EXISTS `" . $table . "` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `...
[ "public", "function", "up", "(", ")", "{", "$", "db", "=", "Database", "::", "get", "(", ")", ";", "$", "table", "=", "File", "::", "trait_get_database_table", "(", ")", ";", "$", "tables", "=", "$", "db", "->", "get_column", "(", "\"SHOW TABLES LIKE '...
Migrate up @access public
[ "Migrate", "up" ]
train
https://github.com/tigron/skeleton-file/blob/97978d49f179f07c76380ddc8919b8a7d56dee61/migration/20160503_173014_init.php#L19-L40
CupOfTea696/WordPress-Composer
src/WordPressInstallationCleaner.php
WordPressInstallationCleaner.clean
public function clean(Composer $composer) { $rootPkg = $composer->getPackage(); $extra = $rootPkg->getExtra(); if (! isset($extra['wordpress-install-dir'])) { return; } $filesystem = new Filesystem(); $filesystem->remove($extra['wordpress...
php
public function clean(Composer $composer) { $rootPkg = $composer->getPackage(); $extra = $rootPkg->getExtra(); if (! isset($extra['wordpress-install-dir'])) { return; } $filesystem = new Filesystem(); $filesystem->remove($extra['wordpress...
[ "public", "function", "clean", "(", "Composer", "$", "composer", ")", "{", "$", "rootPkg", "=", "$", "composer", "->", "getPackage", "(", ")", ";", "$", "extra", "=", "$", "rootPkg", "->", "getExtra", "(", ")", ";", "if", "(", "!", "isset", "(", "$...
Clean up the WordPress installation directory. @param \Composer\Composer $composer @return void
[ "Clean", "up", "the", "WordPress", "installation", "directory", "." ]
train
https://github.com/CupOfTea696/WordPress-Composer/blob/8c0abc10f82b8ce1db5354f6a041c7587ad3fb90/src/WordPressInstallationCleaner.php#L35-L46
ekuiter/feature-php
FeaturePhp/File/TextFileContent.php
TextFileContent.copy
public function copy($target) { if (!parent::copy($target)) return false; return file_put_contents($target, $this->content) !== false; }
php
public function copy($target) { if (!parent::copy($target)) return false; return file_put_contents($target, $this->content) !== false; }
[ "public", "function", "copy", "(", "$", "target", ")", "{", "if", "(", "!", "parent", "::", "copy", "(", "$", "target", ")", ")", "return", "false", ";", "return", "file_put_contents", "(", "$", "target", ",", "$", "this", "->", "content", ")", "!=="...
Copies the text file's content to the local filesystem. @param string $target the file target in the filesystem
[ "Copies", "the", "text", "file", "s", "content", "to", "the", "local", "filesystem", "." ]
train
https://github.com/ekuiter/feature-php/blob/daf4a59098802fedcfd1f1a1d07847fcf2fea7bf/FeaturePhp/File/TextFileContent.php#L50-L54
ShaoZeMing/laravel-merchant
src/Traits/ModelTree.php
ModelTree.boot
protected static function boot() { parent::boot(); static::saving(function (Model $branch) { $parentColumn = $branch->getParentColumn(); if (Request::has($parentColumn) && Request::input($parentColumn) == $branch->getKey()) { throw new \Exception(trans('merc...
php
protected static function boot() { parent::boot(); static::saving(function (Model $branch) { $parentColumn = $branch->getParentColumn(); if (Request::has($parentColumn) && Request::input($parentColumn) == $branch->getKey()) { throw new \Exception(trans('merc...
[ "protected", "static", "function", "boot", "(", ")", "{", "parent", "::", "boot", "(", ")", ";", "static", "::", "saving", "(", "function", "(", "Model", "$", "branch", ")", "{", "$", "parentColumn", "=", "$", "branch", "->", "getParentColumn", "(", ")...
{@inheritdoc}
[ "{" ]
train
https://github.com/ShaoZeMing/laravel-merchant/blob/20801b1735e7832a6e58b37c2c391328f8d626fa/src/Traits/ModelTree.php#L289-L312
glynnforrest/blockade
src/Blockade/Firewall.php
Firewall.setPermissionNames
public function setPermissionNames($any, $none, $user, $anon) { if ($any) { $this->any = $any; } if ($none) { $this->none = $none; } if ($user) { $this->user = $user; } if ($anon) { $this->anon = $anon; }...
php
public function setPermissionNames($any, $none, $user, $anon) { if ($any) { $this->any = $any; } if ($none) { $this->none = $none; } if ($user) { $this->user = $user; } if ($anon) { $this->anon = $anon; }...
[ "public", "function", "setPermissionNames", "(", "$", "any", ",", "$", "none", ",", "$", "user", ",", "$", "anon", ")", "{", "if", "(", "$", "any", ")", "{", "$", "this", "->", "any", "=", "$", "any", ";", "}", "if", "(", "$", "none", ")", "{...
Set the names of the permissions to use for any, none, user and anonymous rules. Set any of these to null to continue using the current name. @param string $any The rule that allows any request @param string $none The rule that blocks any request @param string $user The rule that allows any authentication @param stri...
[ "Set", "the", "names", "of", "the", "permissions", "to", "use", "for", "any", "none", "user", "and", "anonymous", "rules", ".", "Set", "any", "of", "these", "to", "null", "to", "continue", "using", "the", "current", "name", "." ]
train
https://github.com/glynnforrest/blockade/blob/5dfc8b2fa7b9f7029a1bdaa7c50e32ee8665ab3b/src/Blockade/Firewall.php#L79-L93
glynnforrest/blockade
src/Blockade/Firewall.php
Firewall.check
public function check(Request $request) { //first check the exemptions. If the request passes any of //these, skip all other rules and grant explicit access. foreach ($this->exemptions as $exemption) { try { if (true === $this->checkRule($request, $exemption)) { ...
php
public function check(Request $request) { //first check the exemptions. If the request passes any of //these, skip all other rules and grant explicit access. foreach ($this->exemptions as $exemption) { try { if (true === $this->checkRule($request, $exemption)) { ...
[ "public", "function", "check", "(", "Request", "$", "request", ")", "{", "//first check the exemptions. If the request passes any of", "//these, skip all other rules and grant explicit access.", "foreach", "(", "$", "this", "->", "exemptions", "as", "$", "exemption", ")", "...
Check if a Request has permission to access a resource. @param Request $request The request to check @return Boolean true if the request is granted explicit access via an exemption, false if the request passed but has not been granted explicit access (allowing other firewalls to check) @throws AuthenticationException...
[ "Check", "if", "a", "Request", "has", "permission", "to", "access", "a", "resource", "." ]
train
https://github.com/glynnforrest/blockade/blob/5dfc8b2fa7b9f7029a1bdaa7c50e32ee8665ab3b/src/Blockade/Firewall.php#L117-L141
mmanos/laravel-casset
src/Mmanos/Casset/Compressors/Css.php
Css._process
protected function _process($css) { $css = str_replace("\r\n", "\n", $css); // preserve empty comment after '>' // http://www.webdevout.net/css-hacks#in_css-selectors $css = preg_replace('@>/\\*\\s*\\*/@', '>/*keep*/', $css); // preserve empty comment betwee...
php
protected function _process($css) { $css = str_replace("\r\n", "\n", $css); // preserve empty comment after '>' // http://www.webdevout.net/css-hacks#in_css-selectors $css = preg_replace('@>/\\*\\s*\\*/@', '>/*keep*/', $css); // preserve empty comment betwee...
[ "protected", "function", "_process", "(", "$", "css", ")", "{", "$", "css", "=", "str_replace", "(", "\"\\r\\n\"", ",", "\"\\n\"", ",", "$", "css", ")", ";", "// preserve empty comment after '>'", "// http://www.webdevout.net/css-hacks#in_css-selectors", "$", "css", ...
Minify a CSS string @param string $css @return string
[ "Minify", "a", "CSS", "string" ]
train
https://github.com/mmanos/laravel-casset/blob/0f7db71211c1daa99bde30afa41da2692a39b81c/src/Mmanos/Casset/Compressors/Css.php#L65-L151
mmanos/laravel-casset
src/Mmanos/Casset/Compressors/Css.php
Css._commentCB
protected function _commentCB($m) { $hasSurroundingWs = (trim($m[0]) !== $m[1]); $m = $m[1]; // $m is the comment content w/o the surrounding tokens, // but the return value will replace the entire comment. if ($m === 'keep') { return '/**/'; } i...
php
protected function _commentCB($m) { $hasSurroundingWs = (trim($m[0]) !== $m[1]); $m = $m[1]; // $m is the comment content w/o the surrounding tokens, // but the return value will replace the entire comment. if ($m === 'keep') { return '/**/'; } i...
[ "protected", "function", "_commentCB", "(", "$", "m", ")", "{", "$", "hasSurroundingWs", "=", "(", "trim", "(", "$", "m", "[", "0", "]", ")", "!==", "$", "m", "[", "1", "]", ")", ";", "$", "m", "=", "$", "m", "[", "1", "]", ";", "// $m is the...
Process a comment and return a replacement @param array $m regex matches @return string
[ "Process", "a", "comment", "and", "return", "a", "replacement" ]
train
https://github.com/mmanos/laravel-casset/blob/0f7db71211c1daa99bde30afa41da2692a39b81c/src/Mmanos/Casset/Compressors/Css.php#L173-L224
sabre-io/cs
lib/FunctionDeclaration.php
FunctionDeclaration.fix
function fix(\SplFileInfo $file, $content) { $tokens = Tokens::fromCode($content); for ($index = $tokens->count() - 1; $index >= 0; --$index) { $token = $tokens[$index]; if (!$token->isGivenKind(T_FUNCTION)) { continue; } $startParenthes...
php
function fix(\SplFileInfo $file, $content) { $tokens = Tokens::fromCode($content); for ($index = $tokens->count() - 1; $index >= 0; --$index) { $token = $tokens[$index]; if (!$token->isGivenKind(T_FUNCTION)) { continue; } $startParenthes...
[ "function", "fix", "(", "\\", "SplFileInfo", "$", "file", ",", "$", "content", ")", "{", "$", "tokens", "=", "Tokens", "::", "fromCode", "(", "$", "content", ")", ";", "for", "(", "$", "index", "=", "$", "tokens", "->", "count", "(", ")", "-", "1...
{@inheritdoc}
[ "{" ]
train
https://github.com/sabre-io/cs/blob/a4c57e213bf3f5e7d6b29a2f70d1ca4b0dce6d86/lib/FunctionDeclaration.php#L41-L100
netvlies/NetvliesFormBundle
EventListener/SubmitListener.php
SubmitListener.onKernelRequest
public function onKernelRequest(GetResponseEvent $event) { $request = $event->getRequest(); if ($request->isMethod('post')) { $formId = $request->request->getInt('form[form_id]', 0, true); if ($formId > 0) { $form = $this->container->get('netvlies.form')->ge...
php
public function onKernelRequest(GetResponseEvent $event) { $request = $event->getRequest(); if ($request->isMethod('post')) { $formId = $request->request->getInt('form[form_id]', 0, true); if ($formId > 0) { $form = $this->container->get('netvlies.form')->ge...
[ "public", "function", "onKernelRequest", "(", "GetResponseEvent", "$", "event", ")", "{", "$", "request", "=", "$", "event", "->", "getRequest", "(", ")", ";", "if", "(", "$", "request", "->", "isMethod", "(", "'post'", ")", ")", "{", "$", "formId", "=...
Checks if a form post request was mad. If so, it validates the form input and upon success dispatches the form success event, which can be used for further custom handling of the received data. @param $event
[ "Checks", "if", "a", "form", "post", "request", "was", "mad", ".", "If", "so", "it", "validates", "the", "form", "input", "and", "upon", "success", "dispatches", "the", "form", "success", "event", "which", "can", "be", "used", "for", "further", "custom", ...
train
https://github.com/netvlies/NetvliesFormBundle/blob/93f9a3321d9925040111374e7c1014a6400a2d08/EventListener/SubmitListener.php#L27-L51
felipeweb11/eloquent-value-object
src/CastsValueObjects.php
CastsValueObjects.getAttribute
public function getAttribute($key) { if (! $this->isValueObject($key)) { return parent::getAttribute($key); } if (! $this->isValueObjectCached($key)) { // Allow other mutators and such to do their work first. $value = parent::getAttribute($key); ...
php
public function getAttribute($key) { if (! $this->isValueObject($key)) { return parent::getAttribute($key); } if (! $this->isValueObjectCached($key)) { // Allow other mutators and such to do their work first. $value = parent::getAttribute($key); ...
[ "public", "function", "getAttribute", "(", "$", "key", ")", "{", "if", "(", "!", "$", "this", "->", "isValueObject", "(", "$", "key", ")", ")", "{", "return", "parent", "::", "getAttribute", "(", "$", "key", ")", ";", "}", "if", "(", "!", "$", "t...
@param string $key @return mixed
[ "@param", "string", "$key" ]
train
https://github.com/felipeweb11/eloquent-value-object/blob/017d9fe3df9246f5ee9faf823b5e42fb8958c605/src/CastsValueObjects.php#L43-L65
tequila/mongodb-odm
src/Repository/Repository.php
Repository.findAll
public function findAll(array $filter = [], array $options = []): DocumentsCollection { $cursor = $this->getCollection()->find($filter, $options); return new DocumentsCollection($this->documentManager, $cursor, $this->documentClass); }
php
public function findAll(array $filter = [], array $options = []): DocumentsCollection { $cursor = $this->getCollection()->find($filter, $options); return new DocumentsCollection($this->documentManager, $cursor, $this->documentClass); }
[ "public", "function", "findAll", "(", "array", "$", "filter", "=", "[", "]", ",", "array", "$", "options", "=", "[", "]", ")", ":", "DocumentsCollection", "{", "$", "cursor", "=", "$", "this", "->", "getCollection", "(", ")", "->", "find", "(", "$", ...
@param array $filter @param array $options @return DocumentsCollection
[ "@param", "array", "$filter", "@param", "array", "$options" ]
train
https://github.com/tequila/mongodb-odm/blob/501d58529bbcb23ad7839680462f62d5c3466d23/src/Repository/Repository.php#L40-L45
tequila/mongodb-odm
src/Repository/Repository.php
Repository.findOne
public function findOne(array $filter = [], array $options = []) { $documents = $this->findAll($filter, ['limit' => 1] + $options); return $documents->valid() ? $documents->current() : null; }
php
public function findOne(array $filter = [], array $options = []) { $documents = $this->findAll($filter, ['limit' => 1] + $options); return $documents->valid() ? $documents->current() : null; }
[ "public", "function", "findOne", "(", "array", "$", "filter", "=", "[", "]", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "documents", "=", "$", "this", "->", "findAll", "(", "$", "filter", ",", "[", "'limit'", "=>", "1", "]", "+",...
@param array $filter @param array $options @return array|\MongoDB\BSON\Unserializable|null
[ "@param", "array", "$filter", "@param", "array", "$options" ]
train
https://github.com/tequila/mongodb-odm/blob/501d58529bbcb23ad7839680462f62d5c3466d23/src/Repository/Repository.php#L67-L72
tequila/mongodb-odm
src/Repository/Repository.php
Repository.findOneAndDelete
public function findOneAndDelete(array $filter, array $options = []) { $options['typeMap'] = [ 'root' => $this->documentManager->getProxyClass($this->documentClass), 'document' => 'array', ]; $document = $this->getCollection()->findOneAndDelete($filter, $options); ...
php
public function findOneAndDelete(array $filter, array $options = []) { $options['typeMap'] = [ 'root' => $this->documentManager->getProxyClass($this->documentClass), 'document' => 'array', ]; $document = $this->getCollection()->findOneAndDelete($filter, $options); ...
[ "public", "function", "findOneAndDelete", "(", "array", "$", "filter", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "options", "[", "'typeMap'", "]", "=", "[", "'root'", "=>", "$", "this", "->", "documentManager", "->", "getProxyClass", "(...
@param array $filter @param array $options @return object
[ "@param", "array", "$filter", "@param", "array", "$options" ]
train
https://github.com/tequila/mongodb-odm/blob/501d58529bbcb23ad7839680462f62d5c3466d23/src/Repository/Repository.php#L91-L104
tequila/mongodb-odm
src/Repository/Repository.php
Repository.findOneAndUpdate
public function findOneAndUpdate(array $filter, array $update, array $options = []) { $options['typeMap'] = [ 'root' => $this->documentManager->getProxyClass($this->documentClass), 'document' => 'array', ]; $document = $this->getCollection()->findOneAndUpdate($filter...
php
public function findOneAndUpdate(array $filter, array $update, array $options = []) { $options['typeMap'] = [ 'root' => $this->documentManager->getProxyClass($this->documentClass), 'document' => 'array', ]; $document = $this->getCollection()->findOneAndUpdate($filter...
[ "public", "function", "findOneAndUpdate", "(", "array", "$", "filter", ",", "array", "$", "update", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "options", "[", "'typeMap'", "]", "=", "[", "'root'", "=>", "$", "this", "->", "documentMana...
@param array $filter @param array $update @param array $options @return object
[ "@param", "array", "$filter", "@param", "array", "$update", "@param", "array", "$options" ]
train
https://github.com/tequila/mongodb-odm/blob/501d58529bbcb23ad7839680462f62d5c3466d23/src/Repository/Repository.php#L113-L126
tequila/mongodb-odm
src/Repository/Repository.php
Repository.findOneAndReplace
public function findOneAndReplace(array $filter, $replacement, array $options = []) { $options['typeMap'] = [ 'root' => $this->documentManager->getProxyClass($this->documentClass), 'document' => 'array', ]; $document = $this->getCollection()->findOneAndReplace($filte...
php
public function findOneAndReplace(array $filter, $replacement, array $options = []) { $options['typeMap'] = [ 'root' => $this->documentManager->getProxyClass($this->documentClass), 'document' => 'array', ]; $document = $this->getCollection()->findOneAndReplace($filte...
[ "public", "function", "findOneAndReplace", "(", "array", "$", "filter", ",", "$", "replacement", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "options", "[", "'typeMap'", "]", "=", "[", "'root'", "=>", "$", "this", "->", "documentManager",...
@param array $filter @param array|object $replacement @param array $options @return object
[ "@param", "array", "$filter", "@param", "array|object", "$replacement", "@param", "array", "$options" ]
train
https://github.com/tequila/mongodb-odm/blob/501d58529bbcb23ad7839680462f62d5c3466d23/src/Repository/Repository.php#L135-L148
hametuha/wpametu
src/WPametu/Service/Akismet.php
Akismet.is_spam
public static function is_spam( array $values = [] ){ $query_string = self::make_request( $values ); // If Akismet is not active, always return error if( !class_exists('Akismet') || ! \Akismet::get_api_key() ){ return new \WP_Error(500, 'Akismet is not active.'); } // Make request add_filter('akismet_ua'...
php
public static function is_spam( array $values = [] ){ $query_string = self::make_request( $values ); // If Akismet is not active, always return error if( !class_exists('Akismet') || ! \Akismet::get_api_key() ){ return new \WP_Error(500, 'Akismet is not active.'); } // Make request add_filter('akismet_ua'...
[ "public", "static", "function", "is_spam", "(", "array", "$", "values", "=", "[", "]", ")", "{", "$", "query_string", "=", "self", "::", "make_request", "(", "$", "values", ")", ";", "// If Akismet is not active, always return error", "if", "(", "!", "class_ex...
Check if data is spam @param array $values @return bool|\WP_Error
[ "Check", "if", "data", "is", "spam" ]
train
https://github.com/hametuha/wpametu/blob/0939373800815a8396291143d2a57967340da5aa/src/WPametu/Service/Akismet.php#L24-L52
hametuha/wpametu
src/WPametu/Service/Akismet.php
Akismet.make_request
public static function make_request( array $args = [] ){ $args = wp_parse_args([ 'blog' => get_option( 'home' ), 'blog_lang' => get_locale(), 'blog_charset' => get_option( 'blog_charset' ), 'user_ip' => isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '', 'user_agent' => isset($_SERVER['HTTP_...
php
public static function make_request( array $args = [] ){ $args = wp_parse_args([ 'blog' => get_option( 'home' ), 'blog_lang' => get_locale(), 'blog_charset' => get_option( 'blog_charset' ), 'user_ip' => isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '', 'user_agent' => isset($_SERVER['HTTP_...
[ "public", "static", "function", "make_request", "(", "array", "$", "args", "=", "[", "]", ")", "{", "$", "args", "=", "wp_parse_args", "(", "[", "'blog'", "=>", "get_option", "(", "'home'", ")", ",", "'blog_lang'", "=>", "get_locale", "(", ")", ",", "'...
Make request arguments @param array $args @return string
[ "Make", "request", "arguments" ]
train
https://github.com/hametuha/wpametu/blob/0939373800815a8396291143d2a57967340da5aa/src/WPametu/Service/Akismet.php#L61-L87
zhouyl/mellivora
Mellivora/Database/Console/Migrations/BaseCommand.php
BaseCommand.getMigrationPaths
protected function getMigrationPaths() { // Here, we will check to see if a path option has been defined. If it has we will // use the path relative to the root of the installation folder so our database // migrations may be run for any customized path from within the application. if...
php
protected function getMigrationPaths() { // Here, we will check to see if a path option has been defined. If it has we will // use the path relative to the root of the installation folder so our database // migrations may be run for any customized path from within the application. if...
[ "protected", "function", "getMigrationPaths", "(", ")", "{", "// Here, we will check to see if a path option has been defined. If it has we will", "// use the path relative to the root of the installation folder so our database", "// migrations may be run for any customized path from within the appl...
Get all of the migration paths. @return array
[ "Get", "all", "of", "the", "migration", "paths", "." ]
train
https://github.com/zhouyl/mellivora/blob/79f844c5c9c25ffbe18d142062e9bc3df00b36a1/Mellivora/Database/Console/Migrations/BaseCommand.php#L14-L27
surebert/surebert-framework
src/sb/Gitlab/Client.php
Client.get
public function get($url, $data = [], $method = 'post') { $ch = curl_init($this->gitlab_host . '/api/v3' . $url); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'PRIVATE-TOKEN:' . $this->private_key )); if($this->debug){ ...
php
public function get($url, $data = [], $method = 'post') { $ch = curl_init($this->gitlab_host . '/api/v3' . $url); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'PRIVATE-TOKEN:' . $this->private_key )); if($this->debug){ ...
[ "public", "function", "get", "(", "$", "url", ",", "$", "data", "=", "[", "]", ",", "$", "method", "=", "'post'", ")", "{", "$", "ch", "=", "curl_init", "(", "$", "this", "->", "gitlab_host", ".", "'/api/v3'", ".", "$", "url", ")", ";", "curl_set...
GRabs data from a URL and json_decodes it @param string $url URL to grab @param array $data http data to pass @param string $method post, put delete, default post @return object @throws Exception
[ "GRabs", "data", "from", "a", "URL", "and", "json_decodes", "it" ]
train
https://github.com/surebert/surebert-framework/blob/f2f32eb693bd39385ceb93355efb5b2a429f27ce/src/sb/Gitlab/Client.php#L63-L108
heidelpay/PhpDoc
src/phpDocumentor/Descriptor/Example/Finder.php
Finder.find
public function find(ExampleDescriptor $descriptor) { $filename = $descriptor->getFilePath(); $file = $this->getExampleFileContents($filename); if (! $file) { return "** File not found : {$filename} **"; } return implode('', array_slice($file, $descriptor->getSt...
php
public function find(ExampleDescriptor $descriptor) { $filename = $descriptor->getFilePath(); $file = $this->getExampleFileContents($filename); if (! $file) { return "** File not found : {$filename} **"; } return implode('', array_slice($file, $descriptor->getSt...
[ "public", "function", "find", "(", "ExampleDescriptor", "$", "descriptor", ")", "{", "$", "filename", "=", "$", "descriptor", "->", "getFilePath", "(", ")", ";", "$", "file", "=", "$", "this", "->", "getExampleFileContents", "(", "$", "filename", ")", ";",...
Attempts to find the example contents for the given descriptor. @param ExampleDescriptor $descriptor @return string
[ "Attempts", "to", "find", "the", "example", "contents", "for", "the", "given", "descriptor", "." ]
train
https://github.com/heidelpay/PhpDoc/blob/5ac9e842cbd4cbb70900533b240c131f3515ee02/src/phpDocumentor/Descriptor/Example/Finder.php#L34-L44
heidelpay/PhpDoc
src/phpDocumentor/Descriptor/Example/Finder.php
Finder.getExampleFileContents
private function getExampleFileContents($filename) { $normalizedPath = null; foreach ($this->exampleDirectories as $directory) { $exampleFileFromConfig = $this->constructExamplePath($directory, $filename); if (is_readable($exampleFileFromConfig)) { $normalize...
php
private function getExampleFileContents($filename) { $normalizedPath = null; foreach ($this->exampleDirectories as $directory) { $exampleFileFromConfig = $this->constructExamplePath($directory, $filename); if (is_readable($exampleFileFromConfig)) { $normalize...
[ "private", "function", "getExampleFileContents", "(", "$", "filename", ")", "{", "$", "normalizedPath", "=", "null", ";", "foreach", "(", "$", "this", "->", "exampleDirectories", "as", "$", "directory", ")", "{", "$", "exampleFileFromConfig", "=", "$", "this",...
Attempts to find the requested example file and returns its contents or null if no file was found. This method will try several methods in search of the given example file, the first one it encounters is returned: 1. Iterates through all examples folders for the given filename 2. Checks the source folder for the give...
[ "Attempts", "to", "find", "the", "requested", "example", "file", "and", "returns", "its", "contents", "or", "null", "if", "no", "file", "was", "found", "." ]
train
https://github.com/heidelpay/PhpDoc/blob/5ac9e842cbd4cbb70900533b240c131f3515ee02/src/phpDocumentor/Descriptor/Example/Finder.php#L103-L126
video-games-records/TeamBundle
Controller/GroupController.php
GroupController.rankingTeamPointsAction
public function rankingTeamPointsAction($id) { $group = $this->getDoctrine()->getRepository('VideoGamesRecordsCoreBundle:Group')->getWithGame($id); $breadcrumbs = $this->getGroupBreadcrumbs($group); $breadcrumbs->addItem('game.pointchartranking.full'); return $this->render( ...
php
public function rankingTeamPointsAction($id) { $group = $this->getDoctrine()->getRepository('VideoGamesRecordsCoreBundle:Group')->getWithGame($id); $breadcrumbs = $this->getGroupBreadcrumbs($group); $breadcrumbs->addItem('game.pointchartranking.full'); return $this->render( ...
[ "public", "function", "rankingTeamPointsAction", "(", "$", "id", ")", "{", "$", "group", "=", "$", "this", "->", "getDoctrine", "(", ")", "->", "getRepository", "(", "'VideoGamesRecordsCoreBundle:Group'", ")", "->", "getWithGame", "(", "$", "id", ")", ";", "...
@Route("/ranking-points/id/{id}", requirements={"id": "[1-9]\d*"}, name="vgr_team_group_ranking_points") @Method("GET") @Cache(smaxage="10") @param int $id @return \Symfony\Component\HttpFoundation\Response
[ "@Route", "(", "/", "ranking", "-", "points", "/", "id", "/", "{", "id", "}", "requirements", "=", "{", "id", ":", "[", "1", "-", "9", "]", "\\", "d", "*", "}", "name", "=", "vgr_team_group_ranking_points", ")", "@Method", "(", "GET", ")", "@Cache"...
train
https://github.com/video-games-records/TeamBundle/blob/4e5b73874bacb96f70ab16e74d54a1b6efc8e62f/Controller/GroupController.php#L25-L38
video-games-records/TeamBundle
Controller/GroupController.php
GroupController.rankingTeamMedalsAction
public function rankingTeamMedalsAction($id) { $group = $this->getDoctrine()->getRepository('VideoGamesRecordsCoreBundle:Group')->getWithGame($id); $breadcrumbs = $this->getGroupBreadcrumbs($group); $breadcrumbs->addItem('game.medalranking.full'); return $this->render( ...
php
public function rankingTeamMedalsAction($id) { $group = $this->getDoctrine()->getRepository('VideoGamesRecordsCoreBundle:Group')->getWithGame($id); $breadcrumbs = $this->getGroupBreadcrumbs($group); $breadcrumbs->addItem('game.medalranking.full'); return $this->render( ...
[ "public", "function", "rankingTeamMedalsAction", "(", "$", "id", ")", "{", "$", "group", "=", "$", "this", "->", "getDoctrine", "(", ")", "->", "getRepository", "(", "'VideoGamesRecordsCoreBundle:Group'", ")", "->", "getWithGame", "(", "$", "id", ")", ";", "...
@Route("/ranking-medals/id/{id}", requirements={"id": "[1-9]\d*"}, name="vgr_team_group_ranking_medals") @Method("GET") @Cache(smaxage="10") @param int $id @return \Symfony\Component\HttpFoundation\Response
[ "@Route", "(", "/", "ranking", "-", "medals", "/", "id", "/", "{", "id", "}", "requirements", "=", "{", "id", ":", "[", "1", "-", "9", "]", "\\", "d", "*", "}", "name", "=", "vgr_team_group_ranking_medals", ")", "@Method", "(", "GET", ")", "@Cache"...
train
https://github.com/video-games-records/TeamBundle/blob/4e5b73874bacb96f70ab16e74d54a1b6efc8e62f/Controller/GroupController.php#L49-L62
kbond/ControllerUtil
src/EventListener/TwigViewListener.php
TwigViewListener.getContent
protected function getContent(View $view, $format) { $template = $this->twig->resolveTemplate($view->getTemplate()); return $template->render($view->getDataAsArray()); }
php
protected function getContent(View $view, $format) { $template = $this->twig->resolveTemplate($view->getTemplate()); return $template->render($view->getDataAsArray()); }
[ "protected", "function", "getContent", "(", "View", "$", "view", ",", "$", "format", ")", "{", "$", "template", "=", "$", "this", "->", "twig", "->", "resolveTemplate", "(", "$", "view", "->", "getTemplate", "(", ")", ")", ";", "return", "$", "template...
{@inheritdoc}
[ "{" ]
train
https://github.com/kbond/ControllerUtil/blob/67375d43c73d6a3f16356f3d683f62b176766e91/src/EventListener/TwigViewListener.php#L22-L27
Humanized/yii2-location
models/location/CountrySearch.php
CountrySearch.search
public function search($params) { $this->load($params); $query = $this->_query(); $dataProvider = new ActiveDataProvider([ 'query' => $query, 'pagination' => [ 'pageSize' => 10, ], 'sort' => [ 'attributes' => [ ...
php
public function search($params) { $this->load($params); $query = $this->_query(); $dataProvider = new ActiveDataProvider([ 'query' => $query, 'pagination' => [ 'pageSize' => 10, ], 'sort' => [ 'attributes' => [ ...
[ "public", "function", "search", "(", "$", "params", ")", "{", "$", "this", "->", "load", "(", "$", "params", ")", ";", "$", "query", "=", "$", "this", "->", "_query", "(", ")", ";", "$", "dataProvider", "=", "new", "ActiveDataProvider", "(", "[", "...
Creates data provider instance with search query applied @param array $params @return ActiveDataProvider
[ "Creates", "data", "provider", "instance", "with", "search", "query", "applied" ]
train
https://github.com/Humanized/yii2-location/blob/48ac12ceab741fc4c82ac8e979415a11bf9175f2/models/location/CountrySearch.php#L41-L66
gregorybesson/PlaygroundCms
src/Entity/Slideshow.php
Slideshow.populate
public function populate($data = array()) { if (isset($data['title']) && $data['title'] != null) { $this->title = $data['title']; } if (isset($data['subtitle']) && $data['subtitle'] != null) { $this->subtitle = $data['subtitle']; } if (isset($data['a...
php
public function populate($data = array()) { if (isset($data['title']) && $data['title'] != null) { $this->title = $data['title']; } if (isset($data['subtitle']) && $data['subtitle'] != null) { $this->subtitle = $data['subtitle']; } if (isset($data['a...
[ "public", "function", "populate", "(", "$", "data", "=", "array", "(", ")", ")", "{", "if", "(", "isset", "(", "$", "data", "[", "'title'", "]", ")", "&&", "$", "data", "[", "'title'", "]", "!=", "null", ")", "{", "$", "this", "->", "title", "=...
Populate from an array. @param array $data
[ "Populate", "from", "an", "array", "." ]
train
https://github.com/gregorybesson/PlaygroundCms/blob/e929a283f2a6e82d4f248c930f7aa454ce20cbc3/src/Entity/Slideshow.php#L251-L264
Velliz/pte
lib/slicer/Slicer.php
Slicer.Lexer
public function Lexer($template, $output = array(), $position = 0) { $output = $this->PregCapture($template, $output, $position); $length = strlen($template); $lex = array(); $lex['text'] = substr($template, $position, $length); $lex['start'] = $position; $lex['end']...
php
public function Lexer($template, $output = array(), $position = 0) { $output = $this->PregCapture($template, $output, $position); $length = strlen($template); $lex = array(); $lex['text'] = substr($template, $position, $length); $lex['start'] = $position; $lex['end']...
[ "public", "function", "Lexer", "(", "$", "template", ",", "$", "output", "=", "array", "(", ")", ",", "$", "position", "=", "0", ")", "{", "$", "output", "=", "$", "this", "->", "PregCapture", "(", "$", "template", ",", "$", "output", ",", "$", "...
@param $template @param array $output @param int $position @return array Process the last of the converted html element
[ "@param", "$template", "@param", "array", "$output", "@param", "int", "$position", "@return", "array" ]
train
https://github.com/Velliz/pte/blob/8f8edc2289740d554a5942ff96eb727d838e866a/lib/slicer/Slicer.php#L30-L48
Velliz/pte
lib/slicer/Slicer.php
Slicer.PregCapture
private function PregCapture(&$template, &$output, &$position) { while (preg_match(ISlicer::PATTERN, $template, $result, PREG_OFFSET_CAPTURE, $position) > 0) { $capture = new PregOffsetCapture($result); $lex = array(); $lex['text'] = substr($template, $position, $captur...
php
private function PregCapture(&$template, &$output, &$position) { while (preg_match(ISlicer::PATTERN, $template, $result, PREG_OFFSET_CAPTURE, $position) > 0) { $capture = new PregOffsetCapture($result); $lex = array(); $lex['text'] = substr($template, $position, $captur...
[ "private", "function", "PregCapture", "(", "&", "$", "template", ",", "&", "$", "output", ",", "&", "$", "position", ")", "{", "while", "(", "preg_match", "(", "ISlicer", "::", "PATTERN", ",", "$", "template", ",", "$", "result", ",", "PREG_OFFSET_CAPTUR...
@param $template @param $output @param $position @return array Converting html file into AST in PHP array
[ "@param", "$template", "@param", "$output", "@param", "$position", "@return", "array" ]
train
https://github.com/Velliz/pte/blob/8f8edc2289740d554a5942ff96eb727d838e866a/lib/slicer/Slicer.php#L58-L92
lukasz-adamski/teamspeak3-framework
src/TeamSpeak3.php
TeamSpeak3.getAdapterName
protected static function getAdapterName($name, $namespace = 'TeamSpeak3/Adapter') { $path = self::getFilePath($namespace); $scan = scandir($path); foreach($scan as $node) { $file = Str::factory($node)->toLower(); if ($file->startsWith($name) && $file->endsWith(".php")) { return ...
php
protected static function getAdapterName($name, $namespace = 'TeamSpeak3/Adapter') { $path = self::getFilePath($namespace); $scan = scandir($path); foreach($scan as $node) { $file = Str::factory($node)->toLower(); if ($file->startsWith($name) && $file->endsWith(".php")) { return ...
[ "protected", "static", "function", "getAdapterName", "(", "$", "name", ",", "$", "namespace", "=", "'TeamSpeak3/Adapter'", ")", "{", "$", "path", "=", "self", "::", "getFilePath", "(", "$", "namespace", ")", ";", "$", "scan", "=", "scandir", "(", "$", "p...
Returns the name of an adapter class by $name. @param string $name @param string $namespace @throws AdapterException @return string
[ "Returns", "the", "name", "of", "an", "adapter", "class", "by", "$name", "." ]
train
https://github.com/lukasz-adamski/teamspeak3-framework/blob/39a56eca608da6b56b6aa386a7b5b31dc576c41a/src/TeamSpeak3.php#L447-L462
novaway/open-graph
src/Metadata/ClassMetadata.php
ClassMetadata.addGraphMetadata
public function addGraphMetadata(GraphNode $node, GraphMetadataInterface $data) { $this->nodes[] = [ 'node' => $node, 'object' => $data, ]; return $this; }
php
public function addGraphMetadata(GraphNode $node, GraphMetadataInterface $data) { $this->nodes[] = [ 'node' => $node, 'object' => $data, ]; return $this; }
[ "public", "function", "addGraphMetadata", "(", "GraphNode", "$", "node", ",", "GraphMetadataInterface", "$", "data", ")", "{", "$", "this", "->", "nodes", "[", "]", "=", "[", "'node'", "=>", "$", "node", ",", "'object'", "=>", "$", "data", ",", "]", ";...
Add OpenGraph metadata @param GraphNode $type @param GraphMetadataInterface $data @return ClassMetadata
[ "Add", "OpenGraph", "metadata" ]
train
https://github.com/novaway/open-graph/blob/19817bee4b91cf26ca3fe44883ad58b32328e464/src/Metadata/ClassMetadata.php#L51-L59
blast-project/BaseEntitiesBundle
src/Entity/Repository/TreeableRepository.php
TreeableRepository.getRootNodesWithTree
public function getRootNodesWithTree() { // $all = $this->findAll(); $all = $this->findBy([], ['sortMaterializedPath' => 'ASC']); $allRootNodes = array(); foreach ($all as $node) { if ($node->isRootNode()) { $allRootNodes[] = $node; } ...
php
public function getRootNodesWithTree() { // $all = $this->findAll(); $all = $this->findBy([], ['sortMaterializedPath' => 'ASC']); $allRootNodes = array(); foreach ($all as $node) { if ($node->isRootNode()) { $allRootNodes[] = $node; } ...
[ "public", "function", "getRootNodesWithTree", "(", ")", "{", "// $all = $this->findAll();", "$", "all", "=", "$", "this", "->", "findBy", "(", "[", "]", ",", "[", "'sortMaterializedPath'", "=>", "'ASC'", "]", ")", ";", "$", "allRootNodes", "=", "array",...
{@inheritdoc}
[ "{" ]
train
https://github.com/blast-project/BaseEntitiesBundle/blob/abd06891fc38922225ab7e4fcb437a286ba2c0c4/src/Entity/Repository/TreeableRepository.php#L24-L40
expectation-php/expect
src/matcher/ToBeFalsey.php
ToBeFalsey.match
public function match($actual) { $this->actual = $actual; $truthyMatcher = new TruthyMatcher(); return $truthyMatcher->match($actual) === false; }
php
public function match($actual) { $this->actual = $actual; $truthyMatcher = new TruthyMatcher(); return $truthyMatcher->match($actual) === false; }
[ "public", "function", "match", "(", "$", "actual", ")", "{", "$", "this", "->", "actual", "=", "$", "actual", ";", "$", "truthyMatcher", "=", "new", "TruthyMatcher", "(", ")", ";", "return", "$", "truthyMatcher", "->", "match", "(", "$", "actual", ")",...
{@inheritdoc}
[ "{" ]
train
https://github.com/expectation-php/expect/blob/1a32c5af37f3dc8dabe4e8eedeeb21aea16ce139/src/matcher/ToBeFalsey.php#L25-L32
shtrihstr/simple-rest-api
src/Router.php
Router.get
public function get( $path, callable $callback ) { $route = new Route( 'GET', $path, $callback ); $this->_routes[] = $route; return $route; }
php
public function get( $path, callable $callback ) { $route = new Route( 'GET', $path, $callback ); $this->_routes[] = $route; return $route; }
[ "public", "function", "get", "(", "$", "path", ",", "callable", "$", "callback", ")", "{", "$", "route", "=", "new", "Route", "(", "'GET'", ",", "$", "path", ",", "$", "callback", ")", ";", "$", "this", "->", "_routes", "[", "]", "=", "$", "route...
Maps a GET request to a callable. @param string $path Matched route path @param callable $callback Callback that returns the response when matched @return Route
[ "Maps", "a", "GET", "request", "to", "a", "callable", "." ]
train
https://github.com/shtrihstr/simple-rest-api/blob/e59c87a604065525729486de3081d4a44aa2468e/src/Router.php#L45-L49
shtrihstr/simple-rest-api
src/Router.php
Router.post
public function post( $path, callable $callback ) { $route = new Route( 'POST', $path, $callback ); $this->_routes[] = $route; return $route; }
php
public function post( $path, callable $callback ) { $route = new Route( 'POST', $path, $callback ); $this->_routes[] = $route; return $route; }
[ "public", "function", "post", "(", "$", "path", ",", "callable", "$", "callback", ")", "{", "$", "route", "=", "new", "Route", "(", "'POST'", ",", "$", "path", ",", "$", "callback", ")", ";", "$", "this", "->", "_routes", "[", "]", "=", "$", "rou...
Maps a POST request to a callable. @param string $path Matched route path @param callable $callback Callback that returns the response when matched @return Route
[ "Maps", "a", "POST", "request", "to", "a", "callable", "." ]
train
https://github.com/shtrihstr/simple-rest-api/blob/e59c87a604065525729486de3081d4a44aa2468e/src/Router.php#L58-L62
shtrihstr/simple-rest-api
src/Router.php
Router.put
public function put( $path, callable $callback ) { $route = new Route( 'PUT', $path, $callback ); $this->_routes[] = $route; return $route; }
php
public function put( $path, callable $callback ) { $route = new Route( 'PUT', $path, $callback ); $this->_routes[] = $route; return $route; }
[ "public", "function", "put", "(", "$", "path", ",", "callable", "$", "callback", ")", "{", "$", "route", "=", "new", "Route", "(", "'PUT'", ",", "$", "path", ",", "$", "callback", ")", ";", "$", "this", "->", "_routes", "[", "]", "=", "$", "route...
Maps a PUT request to a callable. @param string $path Matched route path @param callable $callback Callback that returns the response when matched @return Route
[ "Maps", "a", "PUT", "request", "to", "a", "callable", "." ]
train
https://github.com/shtrihstr/simple-rest-api/blob/e59c87a604065525729486de3081d4a44aa2468e/src/Router.php#L71-L75
shtrihstr/simple-rest-api
src/Router.php
Router.patch
public function patch( $path, callable $callback ) { $route = new Route( 'PATCH', $path, $callback ); $this->_routes[] = $route; return $route; }
php
public function patch( $path, callable $callback ) { $route = new Route( 'PATCH', $path, $callback ); $this->_routes[] = $route; return $route; }
[ "public", "function", "patch", "(", "$", "path", ",", "callable", "$", "callback", ")", "{", "$", "route", "=", "new", "Route", "(", "'PATCH'", ",", "$", "path", ",", "$", "callback", ")", ";", "$", "this", "->", "_routes", "[", "]", "=", "$", "r...
Maps a PATCH request to a callable. @param string $path Matched route path @param callable $callback Callback that returns the response when matched @return Route
[ "Maps", "a", "PATCH", "request", "to", "a", "callable", "." ]
train
https://github.com/shtrihstr/simple-rest-api/blob/e59c87a604065525729486de3081d4a44aa2468e/src/Router.php#L84-L88
shtrihstr/simple-rest-api
src/Router.php
Router.delete
public function delete( $path, callable $callback ) { $route = new Route( 'DELETE', $path, $callback ); $this->_routes[] = $route; return $route; }
php
public function delete( $path, callable $callback ) { $route = new Route( 'DELETE', $path, $callback ); $this->_routes[] = $route; return $route; }
[ "public", "function", "delete", "(", "$", "path", ",", "callable", "$", "callback", ")", "{", "$", "route", "=", "new", "Route", "(", "'DELETE'", ",", "$", "path", ",", "$", "callback", ")", ";", "$", "this", "->", "_routes", "[", "]", "=", "$", ...
Maps a DELETE request to a callable. @param string $path Matched route path @param callable $callback Callback that returns the response when matched @return Route
[ "Maps", "a", "DELETE", "request", "to", "a", "callable", "." ]
train
https://github.com/shtrihstr/simple-rest-api/blob/e59c87a604065525729486de3081d4a44aa2468e/src/Router.php#L97-L101
shtrihstr/simple-rest-api
src/Router.php
Router.match
public function match( $method, $path, callable $callback ) { $route = new Route( mb_strtoupper( $method ), $path, $callback ); $this->_routes[] = $route; return $route; }
php
public function match( $method, $path, callable $callback ) { $route = new Route( mb_strtoupper( $method ), $path, $callback ); $this->_routes[] = $route; return $route; }
[ "public", "function", "match", "(", "$", "method", ",", "$", "path", ",", "callable", "$", "callback", ")", "{", "$", "route", "=", "new", "Route", "(", "mb_strtoupper", "(", "$", "method", ")", ",", "$", "path", ",", "$", "callback", ")", ";", "$"...
Maps a request to a callable. @param string $method Request method @param string $path Matched route path @param callable $callback Callback that returns the response when matched @return Route
[ "Maps", "a", "request", "to", "a", "callable", "." ]
train
https://github.com/shtrihstr/simple-rest-api/blob/e59c87a604065525729486de3081d4a44aa2468e/src/Router.php#L111-L115
GrupaZero/api
src/Gzero/Api/Controller/User/AccountController.php
AccountController.update
public function update(Request $request) { if (!$request->has('password')) { $this->validator->setData($request->except(['password', 'password_confirmation'])); } $user = $this->userRepo->getById($request->user()->id); $this->authorize('update', $user); $input = ...
php
public function update(Request $request) { if (!$request->has('password')) { $this->validator->setData($request->except(['password', 'password_confirmation'])); } $user = $this->userRepo->getById($request->user()->id); $this->authorize('update', $user); $input = ...
[ "public", "function", "update", "(", "Request", "$", "request", ")", "{", "if", "(", "!", "$", "request", "->", "has", "(", "'password'", ")", ")", "{", "$", "this", "->", "validator", "->", "setData", "(", "$", "request", "->", "except", "(", "[", ...
Updates the specified resource in the database. @param Request $request Request object @return \Illuminate\Http\JsonResponse
[ "Updates", "the", "specified", "resource", "in", "the", "database", "." ]
train
https://github.com/GrupaZero/api/blob/fc544bb6057274e9d5e7b617346c3f854ea5effd/src/Gzero/Api/Controller/User/AccountController.php#L51-L63
infinity-next/sleuth
src/Traits/DetectiveTrait.php
DetectiveTrait.check
public function check($file, $verify = null) { if ($this->prepareFile($file)) { $leads = $this->leads(); if (!is_null($verify)) { if (isset($leads[$verify])) { return $this->checkLead($leads[$verify]); } return false; } else { foreach ($leads as $lead) ...
php
public function check($file, $verify = null) { if ($this->prepareFile($file)) { $leads = $this->leads(); if (!is_null($verify)) { if (isset($leads[$verify])) { return $this->checkLead($leads[$verify]); } return false; } else { foreach ($leads as $lead) ...
[ "public", "function", "check", "(", "$", "file", ",", "$", "verify", "=", "null", ")", "{", "if", "(", "$", "this", "->", "prepareFile", "(", "$", "file", ")", ")", "{", "$", "leads", "=", "$", "this", "->", "leads", "(", ")", ";", "if", "(", ...
Check the the file against our leads. @param mixed $file File to check. @param string|null $verify Extension to verify against. Checks all possible if unset. @return boolean True if we solved the case, false if not.
[ "Check", "the", "the", "file", "against", "our", "leads", "." ]
train
https://github.com/infinity-next/sleuth/blob/924b82e4d60f042fddd6b093b324cfa4bb885a13/src/Traits/DetectiveTrait.php#L63-L99
infinity-next/sleuth
src/Traits/DetectiveTrait.php
DetectiveTrait.closeCase
protected function closeCase($ext, $mime, array $meta = array()) { $this->caseClosed = true; $this->extension = $ext; $this->mime = $mime; $this->metadata = $meta; return true; }
php
protected function closeCase($ext, $mime, array $meta = array()) { $this->caseClosed = true; $this->extension = $ext; $this->mime = $mime; $this->metadata = $meta; return true; }
[ "protected", "function", "closeCase", "(", "$", "ext", ",", "$", "mime", ",", "array", "$", "meta", "=", "array", "(", ")", ")", "{", "$", "this", "->", "caseClosed", "=", "true", ";", "$", "this", "->", "extension", "=", "$", "ext", ";", "$", "t...
Closes the case by setting protected properties. @param string $ext File extension. @param string $mime Mime type. @param array $meta Meta data, optional. Must be array. @return boolean
[ "Closes", "the", "case", "by", "setting", "protected", "properties", "." ]
train
https://github.com/infinity-next/sleuth/blob/924b82e4d60f042fddd6b093b324cfa4bb885a13/src/Traits/DetectiveTrait.php#L120-L127
infinity-next/sleuth
src/Traits/DetectiveTrait.php
DetectiveTrait.leads
protected function leads() { // Pull a list of methods that have the leadEXT syntax. $leads = preg_grep('/^lead(?<ext>[A-Z0-9]+)$/', get_class_methods($this)); // Organize them as an array where keys and values are the same thing. $leads = array_combine($leads, $leads); // Try to find an extension meth...
php
protected function leads() { // Pull a list of methods that have the leadEXT syntax. $leads = preg_grep('/^lead(?<ext>[A-Z0-9]+)$/', get_class_methods($this)); // Organize them as an array where keys and values are the same thing. $leads = array_combine($leads, $leads); // Try to find an extension meth...
[ "protected", "function", "leads", "(", ")", "{", "// Pull a list of methods that have the leadEXT syntax.\r", "$", "leads", "=", "preg_grep", "(", "'/^lead(?<ext>[A-Z0-9]+)$/'", ",", "get_class_methods", "(", "$", "this", ")", ")", ";", "// Organize them as an array where k...
Returns an array of file extensions this detective has leads on. @return array Of file extensions.
[ "Returns", "an", "array", "of", "file", "extensions", "this", "detective", "has", "leads", "on", "." ]
train
https://github.com/infinity-next/sleuth/blob/924b82e4d60f042fddd6b093b324cfa4bb885a13/src/Traits/DetectiveTrait.php#L229-L250
tompedals/radish
src/Consumer/Poller.php
Poller.consume
public function consume() { if ($this->logger) { $this->logger->debug('Starting poller'); } foreach ($this->middlewares as $middleware) { if ($middleware instanceof InitializableInterface) { $middleware->initialize(); } } ...
php
public function consume() { if ($this->logger) { $this->logger->debug('Starting poller'); } foreach ($this->middlewares as $middleware) { if ($middleware instanceof InitializableInterface) { $middleware->initialize(); } } ...
[ "public", "function", "consume", "(", ")", "{", "if", "(", "$", "this", "->", "logger", ")", "{", "$", "this", "->", "logger", "->", "debug", "(", "'Starting poller'", ")", ";", "}", "foreach", "(", "$", "this", "->", "middlewares", "as", "$", "middl...
{@inheritdoc}
[ "{" ]
train
https://github.com/tompedals/radish/blob/7728567ae6226a5e3f627116118198b22d1b507d/src/Consumer/Poller.php#L41-L66
eghojansu/moe
src/Cache.php
Cache.reset
function reset($suffix=NULL,$lifetime=0) { if (!$this->dsn) return TRUE; $regex='/'.preg_quote($this->prefix.'.','/').'.+?'. preg_quote($suffix,'/').'/'; $parts=explode('=',$this->dsn,2); switch ($parts[0]) { case 'apc': case 'apcu': $info=apc_cache_info('user'); if (!empty($info['cache_list...
php
function reset($suffix=NULL,$lifetime=0) { if (!$this->dsn) return TRUE; $regex='/'.preg_quote($this->prefix.'.','/').'.+?'. preg_quote($suffix,'/').'/'; $parts=explode('=',$this->dsn,2); switch ($parts[0]) { case 'apc': case 'apcu': $info=apc_cache_info('user'); if (!empty($info['cache_list...
[ "function", "reset", "(", "$", "suffix", "=", "NULL", ",", "$", "lifetime", "=", "0", ")", "{", "if", "(", "!", "$", "this", "->", "dsn", ")", "return", "TRUE", ";", "$", "regex", "=", "'/'", ".", "preg_quote", "(", "$", "this", "->", "prefix", ...
Clear contents of cache backend @return bool @param $suffix string @param $lifetime int
[ "Clear", "contents", "of", "cache", "backend" ]
train
https://github.com/eghojansu/moe/blob/f58ec75a3116d1a572782256e2b38bb9aab95e3c/src/Cache.php#L137-L197
eghojansu/moe
src/Cache.php
Cache.load
function load($dsn) { $fw=Base::instance(); if ($dsn=trim($dsn)) { if (preg_match('/^redis=(.+)/',$dsn,$parts) && extension_loaded('redis')) { $port=6379; $parts=explode(':',$parts[1],2); if (count($parts)>1) list($host,$port)=$parts; else $host=$parts[0]; $this->ref=new Redis; ...
php
function load($dsn) { $fw=Base::instance(); if ($dsn=trim($dsn)) { if (preg_match('/^redis=(.+)/',$dsn,$parts) && extension_loaded('redis')) { $port=6379; $parts=explode(':',$parts[1],2); if (count($parts)>1) list($host,$port)=$parts; else $host=$parts[0]; $this->ref=new Redis; ...
[ "function", "load", "(", "$", "dsn", ")", "{", "$", "fw", "=", "Base", "::", "instance", "(", ")", ";", "if", "(", "$", "dsn", "=", "trim", "(", "$", "dsn", ")", ")", "{", "if", "(", "preg_match", "(", "'/^redis=(.+)/'", ",", "$", "dsn", ",", ...
Load/auto-detect cache backend @return string @param $dsn bool|string
[ "Load", "/", "auto", "-", "detect", "cache", "backend" ]
train
https://github.com/eghojansu/moe/blob/f58ec75a3116d1a572782256e2b38bb9aab95e3c/src/Cache.php#L204-L246
FrenzelGmbH/cm-address
controllers/base/CountryController.php
CountryController.actionIndex
public function actionIndex() { $searchModel = new CountrySearch; $dataProvider = $searchModel->search($_GET); Tabs::clearLocalStorage(); Url::remember(); \Yii::$app->session['__crudReturnUrl'] = null; return $this->render('index', [ 'dataProvider' => $dataProvider, 'searchModel' => $searchModel, ]); }
php
public function actionIndex() { $searchModel = new CountrySearch; $dataProvider = $searchModel->search($_GET); Tabs::clearLocalStorage(); Url::remember(); \Yii::$app->session['__crudReturnUrl'] = null; return $this->render('index', [ 'dataProvider' => $dataProvider, 'searchModel' => $searchModel, ]); }
[ "public", "function", "actionIndex", "(", ")", "{", "$", "searchModel", "=", "new", "CountrySearch", ";", "$", "dataProvider", "=", "$", "searchModel", "->", "search", "(", "$", "_GET", ")", ";", "Tabs", "::", "clearLocalStorage", "(", ")", ";", "Url", "...
Lists all Country models. @return mixed
[ "Lists", "all", "Country", "models", "." ]
train
https://github.com/FrenzelGmbH/cm-address/blob/4295671dc603beed4bea6c5a7f77dac9846127f3/controllers/base/CountryController.php#L33-L47
FrenzelGmbH/cm-address
controllers/base/CountryController.php
CountryController.actionView
public function actionView($id) { \Yii::$app->session['__crudReturnUrl'] = Url::previous(); Url::remember(); Tabs::rememberActiveState(); return $this->render('view', [ 'model' => $this->findModel($id), ]); }
php
public function actionView($id) { \Yii::$app->session['__crudReturnUrl'] = Url::previous(); Url::remember(); Tabs::rememberActiveState(); return $this->render('view', [ 'model' => $this->findModel($id), ]); }
[ "public", "function", "actionView", "(", "$", "id", ")", "{", "\\", "Yii", "::", "$", "app", "->", "session", "[", "'__crudReturnUrl'", "]", "=", "Url", "::", "previous", "(", ")", ";", "Url", "::", "remember", "(", ")", ";", "Tabs", "::", "rememberA...
Displays a single Country model. @param integer $id @return mixed
[ "Displays", "a", "single", "Country", "model", ".", "@param", "integer", "$id" ]
train
https://github.com/FrenzelGmbH/cm-address/blob/4295671dc603beed4bea6c5a7f77dac9846127f3/controllers/base/CountryController.php#L55-L64
FrenzelGmbH/cm-address
controllers/base/CountryController.php
CountryController.actionCreate
public function actionCreate() { $model = new Country; try { if ($model->load($_POST) && $model->save()) { return $this->redirect(['view', 'id' => $model->id]); } elseif (!\Yii::$app->request->isPost) { $model->load($_GET); } } catch (\Exception $e) { $msg = (isset($e->errorInfo[2]))?$e->errorInfo[2]:$e->getMessage();...
php
public function actionCreate() { $model = new Country; try { if ($model->load($_POST) && $model->save()) { return $this->redirect(['view', 'id' => $model->id]); } elseif (!\Yii::$app->request->isPost) { $model->load($_GET); } } catch (\Exception $e) { $msg = (isset($e->errorInfo[2]))?$e->errorInfo[2]:$e->getMessage();...
[ "public", "function", "actionCreate", "(", ")", "{", "$", "model", "=", "new", "Country", ";", "try", "{", "if", "(", "$", "model", "->", "load", "(", "$", "_POST", ")", "&&", "$", "model", "->", "save", "(", ")", ")", "{", "return", "$", "this",...
Creates a new Country model. If creation is successful, the browser will be redirected to the 'view' page. @return mixed
[ "Creates", "a", "new", "Country", "model", ".", "If", "creation", "is", "successful", "the", "browser", "will", "be", "redirected", "to", "the", "view", "page", "." ]
train
https://github.com/FrenzelGmbH/cm-address/blob/4295671dc603beed4bea6c5a7f77dac9846127f3/controllers/base/CountryController.php#L71-L86
FrenzelGmbH/cm-address
controllers/base/CountryController.php
CountryController.actionUpdate
public function actionUpdate($id) { $model = $this->findModel($id); if ($model->load($_POST) && $model->save()) { return $this->redirect(Url::previous()); } else { return $this->render('update', [ 'model' => $model, ]); } }
php
public function actionUpdate($id) { $model = $this->findModel($id); if ($model->load($_POST) && $model->save()) { return $this->redirect(Url::previous()); } else { return $this->render('update', [ 'model' => $model, ]); } }
[ "public", "function", "actionUpdate", "(", "$", "id", ")", "{", "$", "model", "=", "$", "this", "->", "findModel", "(", "$", "id", ")", ";", "if", "(", "$", "model", "->", "load", "(", "$", "_POST", ")", "&&", "$", "model", "->", "save", "(", "...
Updates an existing Country model. If update is successful, the browser will be redirected to the 'view' page. @param integer $id @return mixed
[ "Updates", "an", "existing", "Country", "model", ".", "If", "update", "is", "successful", "the", "browser", "will", "be", "redirected", "to", "the", "view", "page", "." ]
train
https://github.com/FrenzelGmbH/cm-address/blob/4295671dc603beed4bea6c5a7f77dac9846127f3/controllers/base/CountryController.php#L94-L105
FrenzelGmbH/cm-address
controllers/base/CountryController.php
CountryController.actionDelete
public function actionDelete($id) { try { $this->findModel($id)->delete(); } catch (\Exception $e) { $msg = (isset($e->errorInfo[2]))?$e->errorInfo[2]:$e->getMessage(); \Yii::$app->getSession()->addFlash('error', $msg); return $this->redirect(Url::previous()); } // TODO: improve detection $isPivot = strstr('$id',',');...
php
public function actionDelete($id) { try { $this->findModel($id)->delete(); } catch (\Exception $e) { $msg = (isset($e->errorInfo[2]))?$e->errorInfo[2]:$e->getMessage(); \Yii::$app->getSession()->addFlash('error', $msg); return $this->redirect(Url::previous()); } // TODO: improve detection $isPivot = strstr('$id',',');...
[ "public", "function", "actionDelete", "(", "$", "id", ")", "{", "try", "{", "$", "this", "->", "findModel", "(", "$", "id", ")", "->", "delete", "(", ")", ";", "}", "catch", "(", "\\", "Exception", "$", "e", ")", "{", "$", "msg", "=", "(", "iss...
Deletes an existing Country model. If deletion is successful, the browser will be redirected to the 'index' page. @param integer $id @return mixed
[ "Deletes", "an", "existing", "Country", "model", ".", "If", "deletion", "is", "successful", "the", "browser", "will", "be", "redirected", "to", "the", "index", "page", "." ]
train
https://github.com/FrenzelGmbH/cm-address/blob/4295671dc603beed4bea6c5a7f77dac9846127f3/controllers/base/CountryController.php#L113-L136
expectation-php/expect
src/matcher/ToThrow.php
ToThrow.match
public function match($actual) { $this->actual = $actual; try { $actual(); } catch (Exception $exception) { $this->thrownException = $exception; } return $this->thrownException instanceof $this->expected; }
php
public function match($actual) { $this->actual = $actual; try { $actual(); } catch (Exception $exception) { $this->thrownException = $exception; } return $this->thrownException instanceof $this->expected; }
[ "public", "function", "match", "(", "$", "actual", ")", "{", "$", "this", "->", "actual", "=", "$", "actual", ";", "try", "{", "$", "actual", "(", ")", ";", "}", "catch", "(", "Exception", "$", "exception", ")", "{", "$", "this", "->", "thrownExcep...
{@inheritdoc}
[ "{" ]
train
https://github.com/expectation-php/expect/blob/1a32c5af37f3dc8dabe4e8eedeeb21aea16ce139/src/matcher/ToThrow.php#L59-L70
expectation-php/expect
src/matcher/ToThrow.php
ToThrow.reportFailed
public function reportFailed(FailedMessage $message) { $explanation = 'none thrown'; if ($this->thrownException) { $class = get_class($this->thrownException); $explanation = "got $class"; } $message->appendText('Expected ') ->appendText($this->ex...
php
public function reportFailed(FailedMessage $message) { $explanation = 'none thrown'; if ($this->thrownException) { $class = get_class($this->thrownException); $explanation = "got $class"; } $message->appendText('Expected ') ->appendText($this->ex...
[ "public", "function", "reportFailed", "(", "FailedMessage", "$", "message", ")", "{", "$", "explanation", "=", "'none thrown'", ";", "if", "(", "$", "this", "->", "thrownException", ")", "{", "$", "class", "=", "get_class", "(", "$", "this", "->", "thrownE...
{@inheritdoc}
[ "{" ]
train
https://github.com/expectation-php/expect/blob/1a32c5af37f3dc8dabe4e8eedeeb21aea16ce139/src/matcher/ToThrow.php#L75-L88
alevilar/ristorantino-vendor
Printers/Lib/PrinterOutput/DatabasePrinterOutput.php
DatabasePrinterOutput.send
public function send( $printaitorViewObj ) { $printJob['PrinterJob'] = array( 'text' => $printaitorViewObj->viewTextRender, 'printer_id' => $printaitorViewObj->printerId, ); $PrinterJob = ClassRegistry::init("Printers.PrinterJob"); $save ...
php
public function send( $printaitorViewObj ) { $printJob['PrinterJob'] = array( 'text' => $printaitorViewObj->viewTextRender, 'printer_id' => $printaitorViewObj->printerId, ); $PrinterJob = ClassRegistry::init("Printers.PrinterJob"); $save ...
[ "public", "function", "send", "(", "$", "printaitorViewObj", ")", "{", "$", "printJob", "[", "'PrinterJob'", "]", "=", "array", "(", "'text'", "=>", "$", "printaitorViewObj", "->", "viewTextRender", ",", "'printer_id'", "=>", "$", "printaitorViewObj", "->", "p...
Crea un archivo y lo coloca en la carpeta /tmp @param string $texto es el texto a imprimir @param string $printer_id Id de la impresora @param string $hostname nombre o IP del host @return type boolean true si salio todo bien false caso contrario
[ "Crea", "un", "archivo", "y", "lo", "coloca", "en", "la", "carpeta", "/", "tmp" ]
train
https://github.com/alevilar/ristorantino-vendor/blob/6b91a1e20cc0ba09a1968d77e3de6512cfa2d966/Printers/Lib/PrinterOutput/DatabasePrinterOutput.php#L31-L43
chippyash/Assembly-Builder
src/chippyash/Assembler/Assembler.php
Assembler.create
public static function create(array $params = []) { $assembler = new static(); if (!empty($params)) { array_walk($params, function($v, $k) use ($assembler) { $assembler->$k(function() use($v) {return $v;}); }); $assembler->assemble(); } ...
php
public static function create(array $params = []) { $assembler = new static(); if (!empty($params)) { array_walk($params, function($v, $k) use ($assembler) { $assembler->$k(function() use($v) {return $v;}); }); $assembler->assemble(); } ...
[ "public", "static", "function", "create", "(", "array", "$", "params", "=", "[", "]", ")", "{", "$", "assembler", "=", "new", "static", "(", ")", ";", "if", "(", "!", "empty", "(", "$", "params", ")", ")", "{", "array_walk", "(", "$", "params", "...
Static Assembler constructor Returns a new Assembler @param array $params Immutable parameters to send into the assembler @return static
[ "Static", "Assembler", "constructor", "Returns", "a", "new", "Assembler" ]
train
https://github.com/chippyash/Assembly-Builder/blob/be477306b7a1c09b48ce9e100f9f6680035d0df3/src/chippyash/Assembler/Assembler.php#L48-L59
chippyash/Assembly-Builder
src/chippyash/Assembler/Assembler.php
Assembler.get
public static function get(array $params = []) { if (empty(self::$singleton)) { self::$singleton = static::create($params); } return self::$singleton; }
php
public static function get(array $params = []) { if (empty(self::$singleton)) { self::$singleton = static::create($params); } return self::$singleton; }
[ "public", "static", "function", "get", "(", "array", "$", "params", "=", "[", "]", ")", "{", "if", "(", "empty", "(", "self", "::", "$", "singleton", ")", ")", "{", "self", "::", "$", "singleton", "=", "static", "::", "create", "(", "$", "params", ...
Return Singleton instance of Assembler @param array $params Immutable parameters to send into the assembler @return Assembler
[ "Return", "Singleton", "instance", "of", "Assembler" ]
train
https://github.com/chippyash/Assembly-Builder/blob/be477306b7a1c09b48ce9e100f9f6680035d0df3/src/chippyash/Assembler/Assembler.php#L68-L75
chippyash/Assembly-Builder
src/chippyash/Assembler/Assembler.php
Assembler.release
public function release($var1) { $flip = array_flip(func_get_args()); $intersect = array_intersect_key($this->values, $flip); if (count(func_get_args()) > 1) { array_walk($flip, function(&$v, $k) use ($intersect) { $v = $intersect[$k]; }); ...
php
public function release($var1) { $flip = array_flip(func_get_args()); $intersect = array_intersect_key($this->values, $flip); if (count(func_get_args()) > 1) { array_walk($flip, function(&$v, $k) use ($intersect) { $v = $intersect[$k]; }); ...
[ "public", "function", "release", "(", "$", "var1", ")", "{", "$", "flip", "=", "array_flip", "(", "func_get_args", "(", ")", ")", ";", "$", "intersect", "=", "array_intersect_key", "(", "$", "this", "->", "values", ",", "$", "flip", ")", ";", "if", "...
Return an array of variables created else just a single value Usage: ->release('var1','varN') ->release('var1') Don't forget to call assemble() first if needed @param string $var1 Name of variable to return @param string $_ Next name of variable to retrieve - repeater @return mixed
[ "Return", "an", "array", "of", "variables", "created", "else", "just", "a", "single", "value", "Usage", ":", "-", ">", "release", "(", "var1", "varN", ")", "-", ">", "release", "(", "var1", ")" ]
train
https://github.com/chippyash/Assembly-Builder/blob/be477306b7a1c09b48ce9e100f9f6680035d0df3/src/chippyash/Assembler/Assembler.php#L109-L121
chippyash/Assembly-Builder
src/chippyash/Assembler/Assembler.php
Assembler.assemble
public function assemble() { foreach ($this->placeHolders as $name => $placeholder) { if (!isset($this->values[$name])) { $this->values[$name] = $this->addVars($placeholder); } } return $this; }
php
public function assemble() { foreach ($this->placeHolders as $name => $placeholder) { if (!isset($this->values[$name])) { $this->values[$name] = $this->addVars($placeholder); } } return $this; }
[ "public", "function", "assemble", "(", ")", "{", "foreach", "(", "$", "this", "->", "placeHolders", "as", "$", "name", "=>", "$", "placeholder", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "values", "[", "$", "name", "]", ")", ")", ...
Run the Assembly not returning any value. Assembly will not overwrite anything already assembled @return $this
[ "Run", "the", "Assembly", "not", "returning", "any", "value", ".", "Assembly", "will", "not", "overwrite", "anything", "already", "assembled" ]
train
https://github.com/chippyash/Assembly-Builder/blob/be477306b7a1c09b48ce9e100f9f6680035d0df3/src/chippyash/Assembler/Assembler.php#L129-L138
chippyash/Assembly-Builder
src/chippyash/Assembler/Assembler.php
Assembler.merge
public function merge(Assembler $other) { //N.B. reflection used so as to not expose values //via some public method $refl = new \ReflectionObject($other); $reflValues = $refl->getProperty('values'); $reflValues->setAccessible(true); $oValues = $reflValues->getValue($...
php
public function merge(Assembler $other) { //N.B. reflection used so as to not expose values //via some public method $refl = new \ReflectionObject($other); $reflValues = $refl->getProperty('values'); $reflValues->setAccessible(true); $oValues = $reflValues->getValue($...
[ "public", "function", "merge", "(", "Assembler", "$", "other", ")", "{", "//N.B. reflection used so as to not expose values", "//via some public method", "$", "refl", "=", "new", "\\", "ReflectionObject", "(", "$", "other", ")", ";", "$", "reflValues", "=", "$", "...
Merge this assembly with another. Obeys the rules of array_merge @param Assembler $other @return $this
[ "Merge", "this", "assembly", "with", "another", ".", "Obeys", "the", "rules", "of", "array_merge" ]
train
https://github.com/chippyash/Assembly-Builder/blob/be477306b7a1c09b48ce9e100f9f6680035d0df3/src/chippyash/Assembler/Assembler.php#L148-L163
chippyash/Assembly-Builder
src/chippyash/Assembler/Assembler.php
Assembler.addVars
protected function addVars(\Closure $func) { $args = (new \ReflectionFunction($func))->getParameters(); if (count($args) === 0) { return $func(); } $fArgs = array_map(function($key) { return $this->values[$key]; }, array_map(function($arg)...
php
protected function addVars(\Closure $func) { $args = (new \ReflectionFunction($func))->getParameters(); if (count($args) === 0) { return $func(); } $fArgs = array_map(function($key) { return $this->values[$key]; }, array_map(function($arg)...
[ "protected", "function", "addVars", "(", "\\", "Closure", "$", "func", ")", "{", "$", "args", "=", "(", "new", "\\", "ReflectionFunction", "(", "$", "func", ")", ")", "->", "getParameters", "(", ")", ";", "if", "(", "count", "(", "$", "args", ")", ...
Execute the function assigned to the value, binding in values created earlier in the assembly @param \Closure $func @return mixed
[ "Execute", "the", "function", "assigned", "to", "the", "value", "binding", "in", "values", "created", "earlier", "in", "the", "assembly" ]
train
https://github.com/chippyash/Assembly-Builder/blob/be477306b7a1c09b48ce9e100f9f6680035d0df3/src/chippyash/Assembler/Assembler.php#L173-L191
Eresus/EresusCMS
src/core/Admin/Controller/Content/Url.php
Eresus_Admin_Controller_Content_Url.getHtml
public function getHtml(Eresus_CMS_Request $request) { $legacyKernel = Eresus_Kernel::app()->getLegacyKernel(); $sections = $legacyKernel->sections; $args = $request->getMethod() == 'GET' ? $request->query : $request->request; $item = $sections->get($args->getInt('section')); ...
php
public function getHtml(Eresus_CMS_Request $request) { $legacyKernel = Eresus_Kernel::app()->getLegacyKernel(); $sections = $legacyKernel->sections; $args = $request->getMethod() == 'GET' ? $request->query : $request->request; $item = $sections->get($args->getInt('section')); ...
[ "public", "function", "getHtml", "(", "Eresus_CMS_Request", "$", "request", ")", "{", "$", "legacyKernel", "=", "Eresus_Kernel", "::", "app", "(", ")", "->", "getLegacyKernel", "(", ")", ";", "$", "sections", "=", "$", "legacyKernel", "->", "sections", ";", ...
Возвращает разметку области контента @param Eresus_CMS_Request $request @return string|Eresus_HTTP_Response @since 3.01
[ "Возвращает", "разметку", "области", "контента" ]
train
https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/Admin/Controller/Content/Url.php#L44-L54
Eresus/EresusCMS
src/core/Admin/Controller/Content/Url.php
Eresus_Admin_Controller_Content_Url.formAction
private function formAction(array $item) { $form = array( 'name' => 'editURL', 'caption' => ADM_EDIT, 'width' => '100%', 'fields' => array( array('type' => 'hidden', 'name' => 'update', 'value' => $item['id']), array('type' => '...
php
private function formAction(array $item) { $form = array( 'name' => 'editURL', 'caption' => ADM_EDIT, 'width' => '100%', 'fields' => array( array('type' => 'hidden', 'name' => 'update', 'value' => $item['id']), array('type' => '...
[ "private", "function", "formAction", "(", "array", "$", "item", ")", "{", "$", "form", "=", "array", "(", "'name'", "=>", "'editURL'", ",", "'caption'", "=>", "ADM_EDIT", ",", "'width'", "=>", "'100%'", ",", "'fields'", "=>", "array", "(", "array", "(", ...
Возвращает разметку диалога @param array $item @return string @since 3.01
[ "Возвращает", "разметку", "диалога" ]
train
https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/Admin/Controller/Content/Url.php#L64-L81
Eresus/EresusCMS
src/core/Admin/Controller/Content/Url.php
Eresus_Admin_Controller_Content_Url.updateAction
private function updateAction(array $item, Eresus_HTTP_Parameters $args) { $item['content'] = $args->get('url'); Eresus_Kernel::app()->getLegacyKernel()->sections->update($item); return new Eresus_HTTP_Redirect($args->get('submitURL')); }
php
private function updateAction(array $item, Eresus_HTTP_Parameters $args) { $item['content'] = $args->get('url'); Eresus_Kernel::app()->getLegacyKernel()->sections->update($item); return new Eresus_HTTP_Redirect($args->get('submitURL')); }
[ "private", "function", "updateAction", "(", "array", "$", "item", ",", "Eresus_HTTP_Parameters", "$", "args", ")", "{", "$", "item", "[", "'content'", "]", "=", "$", "args", "->", "get", "(", "'url'", ")", ";", "Eresus_Kernel", "::", "app", "(", ")", "...
Сохраняет изменения @param array $item @param Eresus_HTTP_Parameters $args @return Eresus_HTTP_Redirect
[ "Сохраняет", "изменения" ]
train
https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/Admin/Controller/Content/Url.php#L91-L96
php-lug/lug
src/Component/Grid/Handler/GridHandler.php
GridHandler.handle
public function handle(GridInterface $grid, array $filters = [], array $sorting = [], array $slicing = []) { $repository = $this->repositoryRegistry[$grid->getResource()->getName()]; $dataSourceBuilder = $repository->createDataSourceBuilder($grid->getOptions()); $this->filterer->filter($dat...
php
public function handle(GridInterface $grid, array $filters = [], array $sorting = [], array $slicing = []) { $repository = $this->repositoryRegistry[$grid->getResource()->getName()]; $dataSourceBuilder = $repository->createDataSourceBuilder($grid->getOptions()); $this->filterer->filter($dat...
[ "public", "function", "handle", "(", "GridInterface", "$", "grid", ",", "array", "$", "filters", "=", "[", "]", ",", "array", "$", "sorting", "=", "[", "]", ",", "array", "$", "slicing", "=", "[", "]", ")", "{", "$", "repository", "=", "$", "this",...
{@inheritdoc}
[ "{" ]
train
https://github.com/php-lug/lug/blob/81c109f187eba0a60f17e8cc59984ebb31841db7/src/Component/Grid/Handler/GridHandler.php#L75-L85
infinity-next/sleuth
src/Detectives/svgDetective.php
svgDetective.leadSVG
protected function leadSVG() { // Create a new sanitizer instance $sanitizer = new Sanitizer(); // Load the dirty svg $dirtySVG = file_get_contents($this->file); // Pass it to the sanitizer and get it back clean $cleanSVG = $sanitizer->sanitize($dirtySVG); if (is_string($cleanSVG)) { ...
php
protected function leadSVG() { // Create a new sanitizer instance $sanitizer = new Sanitizer(); // Load the dirty svg $dirtySVG = file_get_contents($this->file); // Pass it to the sanitizer and get it back clean $cleanSVG = $sanitizer->sanitize($dirtySVG); if (is_string($cleanSVG)) { ...
[ "protected", "function", "leadSVG", "(", ")", "{", "// Create a new sanitizer instance\r", "$", "sanitizer", "=", "new", "Sanitizer", "(", ")", ";", "// Load the dirty svg\r", "$", "dirtySVG", "=", "file_get_contents", "(", "$", "this", "->", "file", ")", ";", "...
Checks if thise file is a valid SVG. @return boolean|null
[ "Checks", "if", "thise", "file", "is", "a", "valid", "SVG", "." ]
train
https://github.com/infinity-next/sleuth/blob/924b82e4d60f042fddd6b093b324cfa4bb885a13/src/Detectives/svgDetective.php#L16-L33
brianium/nomnom
src/Nomnom/UnitResolver.php
UnitResolver.resolve
public static function resolve($key) { if ($key == 'B') return 0; $dict = static::$metric; if (preg_match(static::IEC_PATTERN, $key)) $dict = static::$binary; if (array_key_exists($key, $dict)) return $dict[$key]; throw new UnitNotFoundException(sprintf('Unit "%s"...
php
public static function resolve($key) { if ($key == 'B') return 0; $dict = static::$metric; if (preg_match(static::IEC_PATTERN, $key)) $dict = static::$binary; if (array_key_exists($key, $dict)) return $dict[$key]; throw new UnitNotFoundException(sprintf('Unit "%s"...
[ "public", "static", "function", "resolve", "(", "$", "key", ")", "{", "if", "(", "$", "key", "==", "'B'", ")", "return", "0", ";", "$", "dict", "=", "static", "::", "$", "metric", ";", "if", "(", "preg_match", "(", "static", "::", "IEC_PATTERN", ",...
Lookup the exponent based on prefix @param $key @throws UnitNotFoundException @return int
[ "Lookup", "the", "exponent", "based", "on", "prefix" ]
train
https://github.com/brianium/nomnom/blob/012e3a6ad17fe2393b6a9db1a4b14c91ab91adcd/src/Nomnom/UnitResolver.php#L57-L65
brianium/nomnom
src/Nomnom/UnitResolver.php
UnitResolver.unitsAreDifferent
public static function unitsAreDifferent($first, $second) { return (preg_match(UnitResolver::SI_PATTERN, $first) && preg_match(UnitResolver::IEC_PATTERN, $second)) || (preg_match(UnitResolver::IEC_PATTERN, $first) && preg_match(UnitResolver::SI_PATTERN, $second)); }
php
public static function unitsAreDifferent($first, $second) { return (preg_match(UnitResolver::SI_PATTERN, $first) && preg_match(UnitResolver::IEC_PATTERN, $second)) || (preg_match(UnitResolver::IEC_PATTERN, $first) && preg_match(UnitResolver::SI_PATTERN, $second)); }
[ "public", "static", "function", "unitsAreDifferent", "(", "$", "first", ",", "$", "second", ")", "{", "return", "(", "preg_match", "(", "UnitResolver", "::", "SI_PATTERN", ",", "$", "first", ")", "&&", "preg_match", "(", "UnitResolver", "::", "IEC_PATTERN", ...
Check if two units are in the same family @param string $first @param string $second @return bool
[ "Check", "if", "two", "units", "are", "in", "the", "same", "family" ]
train
https://github.com/brianium/nomnom/blob/012e3a6ad17fe2393b6a9db1a4b14c91ab91adcd/src/Nomnom/UnitResolver.php#L76-L81
inhere/php-librarys
src/Collections/Configuration.php
Configuration.set
public function set($path, $value) { // if is readonly if ($this->readonly && $this->has($path)) { throw new RuntimeException("Config data have been setting readonly. don't allow change."); } return parent::set($path, $value); }
php
public function set($path, $value) { // if is readonly if ($this->readonly && $this->has($path)) { throw new RuntimeException("Config data have been setting readonly. don't allow change."); } return parent::set($path, $value); }
[ "public", "function", "set", "(", "$", "path", ",", "$", "value", ")", "{", "// if is readonly", "if", "(", "$", "this", "->", "readonly", "&&", "$", "this", "->", "has", "(", "$", "path", ")", ")", "{", "throw", "new", "RuntimeException", "(", "\"Co...
set config value by path @param string $path @param mixed $value @return mixed @throws \RuntimeException
[ "set", "config", "value", "by", "path" ]
train
https://github.com/inhere/php-librarys/blob/e6ca598685469794f310e3ab0e2bc19519cd0ae6/src/Collections/Configuration.php#L122-L130
heidelpay/PhpDoc
src/phpDocumentor/Compiler/Pass/NamespaceTreeBuilder.php
NamespaceTreeBuilder.execute
public function execute(ProjectDescriptor $project) { $project->getIndexes()->get('elements', new Collection())->set('~\\', $project->getNamespace()); $project->getIndexes()->get('namespaces', new Collection())->add($project->getNamespace()); foreach ($project->getFiles() as $file) { ...
php
public function execute(ProjectDescriptor $project) { $project->getIndexes()->get('elements', new Collection())->set('~\\', $project->getNamespace()); $project->getIndexes()->get('namespaces', new Collection())->add($project->getNamespace()); foreach ($project->getFiles() as $file) { ...
[ "public", "function", "execute", "(", "ProjectDescriptor", "$", "project", ")", "{", "$", "project", "->", "getIndexes", "(", ")", "->", "get", "(", "'elements'", ",", "new", "Collection", "(", ")", ")", "->", "set", "(", "'~\\\\'", ",", "$", "project", ...
{@inheritDoc}
[ "{" ]
train
https://github.com/heidelpay/PhpDoc/blob/5ac9e842cbd4cbb70900533b240c131f3515ee02/src/phpDocumentor/Compiler/Pass/NamespaceTreeBuilder.php#L45-L57
heidelpay/PhpDoc
src/phpDocumentor/Compiler/Pass/NamespaceTreeBuilder.php
NamespaceTreeBuilder.addElementsOfTypeToNamespace
protected function addElementsOfTypeToNamespace(ProjectDescriptor $project, array $elements, $type) { /** @var DescriptorAbstract $element */ foreach ($elements as $element) { $namespaceName = (string) $element->getNamespace(); // ensure consistency by trimming the slash pre...
php
protected function addElementsOfTypeToNamespace(ProjectDescriptor $project, array $elements, $type) { /** @var DescriptorAbstract $element */ foreach ($elements as $element) { $namespaceName = (string) $element->getNamespace(); // ensure consistency by trimming the slash pre...
[ "protected", "function", "addElementsOfTypeToNamespace", "(", "ProjectDescriptor", "$", "project", ",", "array", "$", "elements", ",", "$", "type", ")", "{", "/** @var DescriptorAbstract $element */", "foreach", "(", "$", "elements", "as", "$", "element", ")", "{", ...
Adds the given elements of a specific type to their respective Namespace Descriptors. This method will assign the given elements to the namespace as registered in the namespace field of that element. If a namespace does not exist yet it will automatically be created. @param ProjectDescriptor $project @param Descri...
[ "Adds", "the", "given", "elements", "of", "a", "specific", "type", "to", "their", "respective", "Namespace", "Descriptors", "." ]
train
https://github.com/heidelpay/PhpDoc/blob/5ac9e842cbd4cbb70900533b240c131f3515ee02/src/phpDocumentor/Compiler/Pass/NamespaceTreeBuilder.php#L73-L99
heidelpay/PhpDoc
src/phpDocumentor/Compiler/Pass/NamespaceTreeBuilder.php
NamespaceTreeBuilder.createNamespaceDescriptorTree
protected function createNamespaceDescriptorTree(ProjectDescriptor $project, $namespaceName) { $parts = explode('\\', ltrim($namespaceName, '\\')); $fqnn = ''; // this method does not use recursion to traverse the tree but uses a pointer that will be overridden with the // next...
php
protected function createNamespaceDescriptorTree(ProjectDescriptor $project, $namespaceName) { $parts = explode('\\', ltrim($namespaceName, '\\')); $fqnn = ''; // this method does not use recursion to traverse the tree but uses a pointer that will be overridden with the // next...
[ "protected", "function", "createNamespaceDescriptorTree", "(", "ProjectDescriptor", "$", "project", ",", "$", "namespaceName", ")", "{", "$", "parts", "=", "explode", "(", "'\\\\'", ",", "ltrim", "(", "$", "namespaceName", ",", "'\\\\'", ")", ")", ";", "$", ...
Creates a tree of NamespaceDescriptors based on the provided FQNN (namespace name). This method will examine the namespace name and create a namespace descriptor for each part of the FQNN if it doesn't exist in the namespaces field of the current namespace (starting with the root Namespace in the Project Descriptor), ...
[ "Creates", "a", "tree", "of", "NamespaceDescriptors", "based", "on", "the", "provided", "FQNN", "(", "namespace", "name", ")", "." ]
train
https://github.com/heidelpay/PhpDoc/blob/5ac9e842cbd4cbb70900533b240c131f3515ee02/src/phpDocumentor/Compiler/Pass/NamespaceTreeBuilder.php#L120-L151
sergmoro1/yii2-lookup
src/models/PropertyEdit.php
PropertyEdit.beforeSave
public function beforeSave($insert) { if(parent::beforeSave($insert)) { if(!$this->id && self::find()->orderBy(['id' => SORT_DESC])->one()->id < self::BARRIER) $this->id = self::BARRIER; return true; } else return false; }
php
public function beforeSave($insert) { if(parent::beforeSave($insert)) { if(!$this->id && self::find()->orderBy(['id' => SORT_DESC])->one()->id < self::BARRIER) $this->id = self::BARRIER; return true; } else return false; }
[ "public", "function", "beforeSave", "(", "$", "insert", ")", "{", "if", "(", "parent", "::", "beforeSave", "(", "$", "insert", ")", ")", "{", "if", "(", "!", "$", "this", "->", "id", "&&", "self", "::", "find", "(", ")", "->", "orderBy", "(", "["...
This is invoked before the record is saved. @return boolean whether the record should be saved
[ "This", "is", "invoked", "before", "the", "record", "is", "saved", "." ]
train
https://github.com/sergmoro1/yii2-lookup/blob/deff08a2612b3c54d313a6c60a74fcaae1193b21/src/models/PropertyEdit.php#L51-L61
thiagodp/rtti
lib/RTTI.php
RTTI.getAttributes
static function getAttributes( $obj , $visibilityFlags = null , $getterPrefix = 'get' , $useCamelCase = true , $convertInternalObjects = false ) { if ( ! isset( $obj ) ) { return array(); } $flags = null === $visibilityFlags ? self::allFlags() : $visibilityFlags; $attributes = array(); $reflect...
php
static function getAttributes( $obj , $visibilityFlags = null , $getterPrefix = 'get' , $useCamelCase = true , $convertInternalObjects = false ) { if ( ! isset( $obj ) ) { return array(); } $flags = null === $visibilityFlags ? self::allFlags() : $visibilityFlags; $attributes = array(); $reflect...
[ "static", "function", "getAttributes", "(", "$", "obj", ",", "$", "visibilityFlags", "=", "null", ",", "$", "getterPrefix", "=", "'get'", ",", "$", "useCamelCase", "=", "true", ",", "$", "convertInternalObjects", "=", "false", ")", "{", "if", "(", "!", "...
Retrieve names and values from the attributes of a object, as a map. @param object $obj The object. @param int $visibilityFlags Filter visibility flags. Can be added. Example: RTTI::IS_PRIVATE | RTTI::IS_PROTECTED Optional, defaults to RTTI::allFlags(). @param string $getterPrefix The prefix for getter publi...
[ "Retrieve", "names", "and", "values", "from", "the", "attributes", "of", "a", "object", "as", "a", "map", "." ]
train
https://github.com/thiagodp/rtti/blob/513056bb2843bbf495a83f8a1481c9aaec120c4b/lib/RTTI.php#L56-L126
thiagodp/rtti
lib/RTTI.php
RTTI.getPrivateAttributes
static function getPrivateAttributes( $obj, $getterPrefix = 'get', $useCamelCase = true ) { return self::getAttributes( $obj, self::IS_PRIVATE, $getterPrefix, $useCamelCase ); }
php
static function getPrivateAttributes( $obj, $getterPrefix = 'get', $useCamelCase = true ) { return self::getAttributes( $obj, self::IS_PRIVATE, $getterPrefix, $useCamelCase ); }
[ "static", "function", "getPrivateAttributes", "(", "$", "obj", ",", "$", "getterPrefix", "=", "'get'", ",", "$", "useCamelCase", "=", "true", ")", "{", "return", "self", "::", "getAttributes", "(", "$", "obj", ",", "self", "::", "IS_PRIVATE", ",", "$", "...
Retrieve names and values from the private attributes of a object, as a map. This method has been kept for backward compatibility. @param object $obj The object. @param string $getterPrefix The prefix for getter public methods (defaults to 'get'). @param bool $useCamelCase If true, private attributes will be acc...
[ "Retrieve", "names", "and", "values", "from", "the", "private", "attributes", "of", "a", "object", "as", "a", "map", ".", "This", "method", "has", "been", "kept", "for", "backward", "compatibility", "." ]
train
https://github.com/thiagodp/rtti/blob/513056bb2843bbf495a83f8a1481c9aaec120c4b/lib/RTTI.php#L137-L139