idx int64 0 241k | question stringlengths 64 6.21k | target stringlengths 5 803 |
|---|---|---|
5,500 | public function removeTeamRestrictions ( $ username , $ repository , $ branch , array $ params = [ ] ) { return $ this -> delete ( '/repos/' . rawurlencode ( $ username ) . '/' . rawurlencode ( $ repository ) . '/branches/' . rawurlencode ( $ branch ) . '/protection/restrictions/teams' , $ params ) ; } | Remove team restrictions of protected branch . |
5,501 | public function showUserRestrictions ( $ username , $ repository , $ branch ) { return $ this -> get ( '/repos/' . rawurlencode ( $ username ) . '/' . rawurlencode ( $ repository ) . '/branches/' . rawurlencode ( $ branch ) . '/protection/restrictions/users' ) ; } | List user restrictions of protected branch . |
5,502 | public function replaceUserRestrictions ( $ username , $ repository , $ branch , array $ params = [ ] ) { return $ this -> put ( '/repos/' . rawurlencode ( $ username ) . '/' . rawurlencode ( $ repository ) . '/branches/' . rawurlencode ( $ branch ) . '/protection/restrictions/users' , $ params ) ; } | Replace user restrictions of protected branch . |
5,503 | public function addUserRestrictions ( $ username , $ repository , $ branch , array $ params = [ ] ) { return $ this -> post ( '/repos/' . rawurlencode ( $ username ) . '/' . rawurlencode ( $ repository ) . '/branches/' . rawurlencode ( $ branch ) . '/protection/restrictions/users' , $ params ) ; } | Add user restrictions of protected branch . |
5,504 | public function removeUserRestrictions ( $ username , $ repository , $ branch , array $ params = [ ] ) { return $ this -> delete ( '/repos/' . rawurlencode ( $ username ) . '/' . rawurlencode ( $ repository ) . '/branches/' . rawurlencode ( $ branch ) . '/protection/restrictions/users' , $ params ) ; } | Remove user restrictions of protected branch . |
5,505 | public function add ( $ emails ) { if ( is_string ( $ emails ) ) { $ emails = [ $ emails ] ; } elseif ( 0 === count ( $ emails ) ) { throw new InvalidArgumentException ( 'The user emails parameter should be a single email or an array of emails' ) ; } return $ this -> post ( '/user/emails' , $ emails ) ; } | Adds one or more email for the authenticated user . |
5,506 | public function remove ( $ emails ) { if ( is_string ( $ emails ) ) { $ emails = [ $ emails ] ; } elseif ( 0 === count ( $ emails ) ) { throw new InvalidArgumentException ( 'The user emails parameter should be a single email or an array of emails' ) ; } return $ this -> delete ( '/user/emails' , $ emails ) ; } | Removes one or more email for the authenticated user . |
5,507 | public function tag ( $ username , $ repository , $ tag ) { return $ this -> get ( '/repos/' . rawurlencode ( $ username ) . '/' . rawurlencode ( $ repository ) . '/releases/tags/' . rawurlencode ( $ tag ) ) ; } | List releases for a tag . |
5,508 | public function all ( $ username , $ repository , $ issue = null ) { if ( $ issue === null ) { $ path = '/repos/' . rawurlencode ( $ username ) . '/' . rawurlencode ( $ repository ) . '/labels' ; } else { $ path = '/repos/' . rawurlencode ( $ username ) . '/' . rawurlencode ( $ repository ) . '/issues/' . rawurlencode ( $ issue ) . '/labels' ; } return $ this -> get ( $ path ) ; } | Get all labels for a repository or the labels for a specific issue . |
5,509 | public function show ( $ username , $ repository , $ label ) { return $ this -> get ( '/repos/' . rawurlencode ( $ username ) . '/' . rawurlencode ( $ repository ) . '/labels/' . rawurlencode ( $ label ) ) ; } | Get a single label . |
5,510 | public function deleteLabel ( $ username , $ repository , $ label ) { return $ this -> delete ( '/repos/' . rawurlencode ( $ username ) . '/' . rawurlencode ( $ repository ) . '/labels/' . rawurlencode ( $ label ) ) ; } | Delete a label for a repository . |
5,511 | public function update ( $ username , $ repository , $ label , $ newName , $ color ) { $ params = [ 'name' => $ newName , 'color' => $ color , ] ; return $ this -> patch ( '/repos/' . rawurlencode ( $ username ) . '/' . rawurlencode ( $ repository ) . '/labels/' . rawurlencode ( $ label ) , $ params ) ; } | Edit a label for a repository . |
5,512 | public function add ( $ username , $ repository , $ issue , $ labels ) { if ( is_string ( $ labels ) ) { $ labels = [ $ labels ] ; } elseif ( 0 === count ( $ labels ) ) { throw new InvalidArgumentException ( 'The labels parameter should be a single label or an array of labels' ) ; } return $ this -> post ( '/repos/' . rawurlencode ( $ username ) . '/' . rawurlencode ( $ repository ) . '/issues/' . rawurlencode ( $ issue ) . '/labels' , $ labels ) ; } | Add a label to an issue . |
5,513 | public function replace ( $ username , $ repository , $ issue , array $ params ) { return $ this -> put ( '/repos/' . rawurlencode ( $ username ) . '/' . rawurlencode ( $ repository ) . '/issues/' . rawurlencode ( $ issue ) . '/labels' , $ params ) ; } | Replace labels for an issue . |
5,514 | public function remove ( $ username , $ repository , $ issue , $ label ) { return $ this -> delete ( '/repos/' . rawurlencode ( $ username ) . '/' . rawurlencode ( $ repository ) . '/issues/' . rawurlencode ( $ issue ) . '/labels/' . rawurlencode ( $ label ) ) ; } | Remove a label for an issue . |
5,515 | public function clear ( $ username , $ repository , $ issue ) { return $ this -> delete ( '/repos/' . rawurlencode ( $ username ) . '/' . rawurlencode ( $ repository ) . '/issues/' . rawurlencode ( $ issue ) . '/labels' ) ; } | Remove all labels from an issue . |
5,516 | public function allInRepository ( $ username , $ repository , array $ params = [ ] ) { return $ this -> get ( '/repos/' . rawurlencode ( $ username ) . '/' . rawurlencode ( $ repository ) . '/notifications' , $ params ) ; } | List all notifications for the authenticated user in selected repository . |
5,517 | public function markAsReadInRepository ( $ username , $ repository , array $ params = [ ] ) { return $ this -> put ( '/repos/' . rawurlencode ( $ username ) . '/' . rawurlencode ( $ repository ) . '/notifications' , $ params ) ; } | Mark all notifications for a repository as read . |
5,518 | public function create ( array $ params , $ OTPCode = null ) { $ headers = null === $ OTPCode ? [ ] : [ 'X-GitHub-OTP' => $ OTPCode ] ; return $ this -> post ( '/authorizations' , $ params , $ headers ) ; } | Create an authorization . |
5,519 | public function clearHeaders ( ) { $ this -> headers = [ ] ; $ this -> removePlugin ( Plugin \ HeaderAppendPlugin :: class ) ; $ this -> addPlugin ( new Plugin \ HeaderAppendPlugin ( $ this -> headers ) ) ; } | Clears used headers . |
5,520 | public function add ( $ type , $ listener ) { if ( ! array_key_exists ( $ type , $ this -> _eventListeners ) ) { $ this -> _eventListeners [ $ type ] = [ ] ; } array_push ( $ this -> _eventListeners [ $ type ] , $ listener ) ; } | Registers an event listener at a certain object . |
5,521 | public function remove ( $ type , $ listener ) { if ( array_key_exists ( $ type , $ this -> _eventListeners ) ) { $ index = array_search ( $ listener , $ this -> _eventListeners [ $ type ] ) ; if ( $ index !== null ) { unset ( $ this -> _eventListeners [ $ type ] [ $ index ] ) ; } $ numListeners = count ( $ this -> _eventListeners [ $ type ] ) ; if ( $ numListeners == 0 ) { unset ( $ this -> _eventListeners [ $ type ] ) ; } } } | Removes an event listener from the object . |
5,522 | protected function dispatchEvent ( $ event ) { if ( ! array_key_exists ( $ event -> type , $ this -> _eventListeners ) ) { return ; } $ this -> invokeEvent ( $ event ) ; } | Dispatches an event to all objects that have registered listeners for its type . If an event with enabled bubble property is dispatched to a display object it will travel up along the line of parents until it either hits the root object or someone stops its propagation manually . |
5,523 | public function dispatch ( $ type , $ data = null , $ onlyMyWorker = false , $ fromDispatch = false ) { if ( ! $ onlyMyWorker ) { if ( $ fromDispatch ) { get_instance ( ) -> sendToAllAsynWorks ( SwooleMarco :: DISPATCHER_NAME , [ $ type , $ data ] , EventDispatcher :: class . "::workerDispatchEventWith" ) ; return ; } if ( get_instance ( ) -> isCluster ( ) ) { ProcessManager :: getInstance ( ) -> getRpcCall ( ClusterProcess :: class , true ) -> my_dispatchEvent ( $ type , $ data ) ; } get_instance ( ) -> sendToAllAsynWorks ( SwooleMarco :: DISPATCHER_NAME , [ $ type , $ data ] , EventDispatcher :: class . "::workerDispatchEventWith" ) ; } else { self :: workerDispatchEventWith ( [ $ type , $ data ] ) ; } } | Dispatches an event with the given parameters to all objects that have registered listeners for the given type . The method uses an internal pool of event objects to avoid allocations . |
5,524 | public function getWaits ( $ message_type ) { return $ this -> isEmpty ( $ this -> command_awaits [ $ message_type ] ) ? false : $ this -> command_awaits [ $ message_type ] ; } | Get all by message_type |
5,525 | final public function build ( & $ length = 0 ) { if ( $ this -> protocol_type == self :: FIXED_ONLY ) { $ payload = $ this -> payload ( ) ; } else if ( $ this -> protocol_type == self :: WITH_VARIABLE ) { $ payload = $ this -> payload ( ) ; } else if ( $ this -> protocol_type == self :: WITH_PAYLOAD ) { $ payload = $ this -> payload ( ) ; } else { throw new Exception ( 'Invalid protocol type' ) ; } $ length = strlen ( $ payload ) ; $ this -> header -> setPayloadLength ( $ length ) ; $ length = $ this -> header -> getFullLength ( ) ; Debug :: Log ( Debug :: DEBUG , 'Message Build: total length=' . $ length ) ; return $ this -> header -> build ( ) . $ payload ; } | Build packet data |
5,526 | final protected function processReadFixedHeaderWithMsgID ( $ message ) { $ packet_length = 4 ; $ name = Message :: $ name [ $ this -> message_type ] ; if ( ! isset ( $ message [ $ packet_length - 1 ] ) ) { Debug :: Log ( Debug :: DEBUG , "Message {$name}: error on reading" ) ; return false ; } $ packet = unpack ( 'Ccmd/Clength/nmsgid' , $ message ) ; $ packet [ 'cmd' ] = Utility :: UnpackCommand ( $ packet [ 'cmd' ] ) ; if ( $ packet [ 'cmd' ] [ 'message_type' ] != $ this -> getMessageType ( ) ) { Debug :: Log ( Debug :: DEBUG , "Message {$name}: type mismatch" ) ; return false ; } else { Debug :: Log ( Debug :: DEBUG , "Message {$name}: success" ) ; return $ packet ; } } | Process packet with Fixed Header + Message Identifier only |
5,527 | public function setVersion ( $ version ) { if ( $ version == self :: VERSION_3 || $ version == self :: VERSION_3_1_1 ) { $ this -> version = $ version ; } else { throw new Exception ( 'Invalid version' ) ; } } | Set Protocol Version |
5,528 | public function setWill ( $ topic , $ message , $ qos = 0 , $ retain = 0 ) { $ this -> connect_will = new Will ( $ topic , $ message , $ qos , $ retain ) ; } | Set Will Message |
5,529 | protected function do_unsubscribe ( ) { static $ pi = null ; if ( ! $ pi ) { $ pi = $ this -> PIG ( ) ; } $ msgid = $ pi -> next ( ) ; $ unsubscribeobj = $ this -> getMessageObject ( Message :: UNSUBSCRIBE ) ; $ unsubscribeobj -> setMsgID ( $ msgid ) ; $ unsubscribe_topics = array ( ) ; foreach ( $ this -> topics_to_unsubscribe as $ tn => $ topic_filter ) { $ unsubscribeobj -> addTopic ( $ topic_filter ) ; unset ( $ this -> topics_to_unsubscribe [ $ tn ] ) ; $ unsubscribe_topics [ ] = $ topic_filter ; } $ unsubscribe_bytes_written = $ this -> message_write ( $ unsubscribeobj ) ; Debug :: Log ( Debug :: DEBUG , 'unsubscribe(): bytes written=' . $ unsubscribe_bytes_written ) ; return array ( $ msgid , $ unsubscribe_topics ) ; } | DO Unsubscribe topics |
5,530 | protected function simpleCommand ( $ type , $ msgid = 0 ) { $ msgobj = $ this -> getMessageObject ( $ type ) ; if ( $ msgid ) { $ msgobj -> setMsgID ( $ msgid ) ; } return $ this -> message_write ( $ msgobj ) ; } | Send Simple Commands |
5,531 | final public function decode ( & $ packet_data , $ remaining_length , & $ payload_pos ) { $ cmd = Utility :: ParseCommand ( ord ( $ packet_data [ 0 ] ) ) ; $ message_type = $ cmd [ 'message_type' ] ; if ( $ this -> message -> getMessageType ( ) != $ message_type ) { throw new Exception ( 'Unexpected Control Packet Type' ) ; } $ flags = $ cmd [ 'flags' ] ; $ this -> setFlags ( $ flags ) ; $ pos = 1 ; $ rl_len = strlen ( ( $ this -> remaining_length_bytes = Utility :: EncodeLength ( $ remaining_length ) ) ) ; $ pos += $ rl_len ; $ this -> remaining_length = $ remaining_length ; $ this -> decodeVariableHeader ( $ packet_data , $ pos ) ; $ payload_pos = $ pos ; } | Decode Packet Header and returns payload position . |
5,532 | public function setRemainingLength ( $ length ) { $ this -> remaining_length = $ length ; $ this -> remaining_length_bytes = Utility :: EncodeLength ( $ this -> remaining_length ) ; } | Set Remaining Length |
5,533 | public function getFullLength ( ) { $ cmd_length = 1 ; $ rl_length = strlen ( $ this -> remaining_length_bytes ) ; return $ cmd_length + $ rl_length + $ this -> remaining_length ; } | Get Full Header Length |
5,534 | protected function sendMessageInChunks ( $ rawMessage ) { $ chunks = str_split ( $ rawMessage , $ this -> chunkSize ) ; $ numChunks = count ( $ chunks ) ; if ( $ numChunks > self :: CHUNK_MAX_COUNT ) { throw new \ Exception ( sprintf ( "Message is too big. Chunk count exceeds %d" , self :: CHUNK_MAX_COUNT ) ) ; } $ messageId = substr ( md5 ( uniqid ( "" , true ) , true ) , 0 , 8 ) ; foreach ( $ chunks as $ idx => $ chunk ) { $ data = self :: CHUNK_GELF_ID . $ messageId . pack ( 'CC' , $ idx , $ numChunks ) . $ chunk ; $ this -> write ( $ data ) ; } return $ numChunks ; } | Sends given string in multiple chunks |
5,535 | protected function buildVariableHeader ( ) { $ header = '' ; $ topic = $ this -> message -> getTopic ( ) ; $ header .= Utility :: PackStringWithLength ( $ topic ) ; Debug :: Log ( Debug :: DEBUG , 'Message PUBLISH: topic=' . $ topic ) ; Debug :: Log ( Debug :: DEBUG , 'Message PUBLISH: QoS=' . $ this -> getQos ( ) ) ; Debug :: Log ( Debug :: DEBUG , 'Message PUBLISH: DUP=' . $ this -> getDup ( ) ) ; Debug :: Log ( Debug :: DEBUG , 'Message PUBLISH: RETAIN=' . $ this -> getRetain ( ) ) ; if ( $ this -> getQos ( ) ) { if ( ! $ this -> msgid ) { throw new Exception ( 'MsgID MUST be set if QoS is not 0.' ) ; } $ header .= $ this -> packPacketIdentifer ( ) ; } return $ header ; } | PUBLISH Variable Header |
5,536 | protected function decodeVariableHeader ( & $ packet_data , & $ pos ) { $ topic = Utility :: UnpackStringWithLength ( $ packet_data , $ pos ) ; $ this -> message -> setTopic ( $ topic ) ; if ( $ this -> getQos ( ) > 0 ) { $ this -> decodePacketIdentifier ( $ packet_data , $ pos ) ; } return true ; } | Decode Variable Header Topic Packet Identifier |
5,537 | static public function ASCII2Visible ( $ char , $ replace = '.' ) { $ c = ord ( $ char ) ; if ( $ c >= 0x20 && $ c <= 0x7F ) { return $ char ; } else { return $ replace ; } } | Convert ASCII Invisible Character to Visible |
5,538 | static public function PrintHex ( $ chars , $ return = false , $ width = 0 , $ with_ascii = false ) { $ output = '' ; $ hex_str = '' ; $ ascii_str = '' ; $ width = ( int ) $ width ; if ( ! $ width ) { for ( $ i = 0 ; isset ( $ chars [ $ i ] ) ; $ i ++ ) { $ hex_str .= sprintf ( '%02x ' , ord ( $ chars [ $ i ] ) ) ; $ ascii_str .= sprintf ( '%s ' , self :: ASCII2Visible ( $ chars [ $ i ] , '.' ) ) ; } $ output .= "HEX DUMP:\t" . $ hex_str . "\n" ; if ( $ with_ascii ) { $ output .= "ASCII CHR: \t" . $ ascii_str . "\n" ; } } else { for ( $ i = 0 ; isset ( $ chars [ $ i ] ) ; $ i ++ ) { $ hex_str .= sprintf ( '%02x ' , ord ( $ chars [ $ i ] ) ) ; $ ascii_str .= sprintf ( '%s' , self :: ASCII2Visible ( $ chars [ $ i ] , '.' ) ) ; } $ ph = $ pa = 0 ; $ wh = 3 ; $ wa = 1 ; $ lwh = $ wh * $ width ; $ lwa = $ wa * $ width ; do { $ output .= "DUMP\t" ; $ output .= str_pad ( substr ( $ hex_str , $ ph , $ lwh ) , $ lwh , ' ' ) ; $ output .= "\t" ; $ output .= str_pad ( substr ( $ ascii_str , $ pa , $ lwa ) , $ lwa , ' ' ) ; $ output .= "\n" ; $ ph += $ lwh ; $ pa += $ lwa ; if ( ! isset ( $ hex_str [ $ ph ] ) || ! isset ( $ ascii_str [ $ pa ] ) ) { break ; } } while ( true ) ; } if ( $ return ) { return $ output ; } else { echo $ output ; return true ; } } | Print string in Hex |
5,539 | static public function PackStringWithLength ( $ str ) { $ len = strlen ( $ str ) ; if ( ! self :: ValidateUTF8 ( $ str ) ) { throw new Exception ( 'Bad UTF-8 String' ) ; } return pack ( 'n' , $ len ) . $ str ; } | Pack string with a 16 - bit big endian length ahead . |
5,540 | static public function ExtractUShort ( $ str , & $ pos ) { $ bytes = substr ( $ str , $ pos , 2 ) ; $ ushort = Utility :: Word2UShort ( $ bytes ) ; $ pos += 2 ; return $ ushort ; } | Extract Unsigned Short from Buffer |
5,541 | static public function EncodeLength ( $ length ) { self :: CheckMessageLength ( $ length ) ; $ string = "" ; do { $ digit = $ length % 0x80 ; $ length = $ length >> 7 ; if ( $ length > 0 ) $ digit = ( $ digit | 0x80 ) ; $ string .= chr ( $ digit ) ; } while ( $ length > 0 ) ; return $ string ; } | Encode Remaining Length |
5,542 | static public function DecodeLength ( $ msg , & $ pos ) { $ multiplier = 1 ; $ value = 0 ; do { $ digit = ord ( $ msg [ $ pos ] ) ; $ value += ( $ digit & 0x7F ) * $ multiplier ; $ multiplier *= 0x80 ; $ pos ++ ; } while ( ( $ digit & 0x80 ) != 0 ) ; return $ value ; } | Decode Remaining Length |
5,543 | static public function CheckTopicFilter ( $ topic_filter ) { if ( ! isset ( $ topic_filter [ 0 ] ) || isset ( $ topic_filter [ 65535 ] ) ) { throw new Exception ( 'Topic filter must be at 1~65535 bytes long' ) ; } self :: ValidateUTF8 ( $ topic_filter ) ; if ( false !== strpos ( $ topic_filter , chr ( 0 ) ) ) { throw new Exception ( 'Null character is not allowed in topic' ) ; } $ length = strlen ( $ topic_filter ) ; if ( ( $ p = strpos ( $ topic_filter , '#' ) ) !== false ) { if ( $ p != $ length - 1 ) { throw new Exception ( '"#" MUST be the last char in topic filter' ) ; } else if ( $ length > 1 && $ topic_filter [ $ length - 2 ] != '/' ) { throw new Exception ( '"#" MUST occupy an entire level of the filter' ) ; } } $ levels = explode ( '/' , $ topic_filter ) ; foreach ( $ levels as $ l ) { if ( $ l == '' ) { continue ; } else if ( strpos ( $ l , '+' ) !== false && isset ( $ l [ 1 ] ) ) { throw new Exception ( '"+" MUST occupy an entire level of the filter' ) ; } } if ( $ topic_filter [ 0 ] == '#' ) { Debug :: Log ( Debug :: DEBUG , 'If you want to subscribe topic begin with $, please subscribe both "#" and "$SOMETOPIC/#"' ) ; } } | Check Topic Filter |
5,544 | static public function ValidateUTF8 ( $ string ) { $ pop_10s = 0 ; $ unicode_char = 0 ; for ( $ i = 0 ; isset ( $ string [ $ i ] ) ; $ i ++ ) { $ c = ord ( $ string [ $ i ] ) ; if ( $ pop_10s ) { if ( ( $ c & 0xC0 ) != 0x80 ) { throw new Exception \ BadUTF8 ( 'Following characters must be 10xxxxxx' ) ; } else { $ unicode_char <<= 6 ; $ unicode_char |= $ c & 0x3F ; -- $ pop_10s ; } } else if ( ( $ c & 0x7F ) == $ c ) { $ unicode_char = 0 ; continue ; } else if ( ( $ c & 0xFE ) == 0xFC ) { $ pop_10s = 5 ; $ unicode_char = 0 ; $ unicode_char |= $ c & 0x01 ; } else if ( ( $ c & 0xFC ) == 0xF8 ) { $ pop_10s = 4 ; $ unicode_char = 0 ; $ unicode_char |= $ c & 0x03 ; } else if ( ( $ c & 0xF8 ) == 0xF0 ) { $ pop_10s = 3 ; $ unicode_char = 0 ; $ unicode_char |= $ c & 0x07 ; } else if ( ( $ c & 0xF0 ) == 0xE0 ) { $ pop_10s = 2 ; $ unicode_char = 0 ; $ unicode_char |= $ c & 0x0F ; } else if ( ( $ c & 0xE0 ) == 0xC0 ) { $ pop_10s = 1 ; $ unicode_char = 0 ; $ unicode_char |= $ c & 0x1F ; } else { throw new Exception \ BadUTF8 ( 'Bad leading characters' ) ; } if ( $ unicode_char >= 0xD800 && $ unicode_char <= 0xDFFF ) { throw new Exception \ BadUTF8 ( 'U+D800 ~ U+DFFF CAN NOT be used in UTF-8' ) ; } } if ( $ pop_10s ) { throw new Exception \ BadUTF8 ( 'Missing UTF-8 following characters' ) ; } return true ; } | Check if string is UTF - 8 |
5,545 | public function innerJoin ( $ table , $ criteria = null , $ alias = null ) { return $ this -> join ( $ table , $ criteria , self :: INNER_JOIN , $ alias ) ; } | Add an INNER JOIN table with optional ON criteria . |
5,546 | public function join ( $ table , $ criteria = null , $ type = self :: INNER_JOIN , $ alias = null ) { if ( ! $ this -> isJoinUnique ( $ table , $ alias ) ) { return $ this ; } if ( is_string ( $ criteria ) ) { $ criteria = array ( $ criteria ) ; } $ this -> join [ ] = array ( 'table' => $ table , 'criteria' => $ criteria , 'type' => $ type , 'alias' => $ alias ) ; return $ this ; } | Add a JOIN table with optional ON criteria . |
5,547 | public function leftJoin ( $ table , $ criteria = null , $ alias = null ) { return $ this -> join ( $ table , $ criteria , self :: LEFT_JOIN , $ alias ) ; } | Add a LEFT JOIN table with optional ON criteria . |
5,548 | public function rightJoin ( $ table , $ criteria = null , $ alias = null ) { return $ this -> join ( $ table , $ criteria , self :: RIGHT_JOIN , $ alias ) ; } | Add a RIGHT JOIN table with optional ON criteria . |
5,549 | public function orWhere ( $ column , $ value , $ operator = self :: EQUALS , $ quote = null ) { return $ this -> orCriteria ( $ this -> where , $ column , $ value , $ operator , $ quote ) ; } | Add an OR WHERE condition . |
5,550 | private function orCriteria ( array & $ criteria , $ column , $ value , $ operator = self :: EQUALS , $ quote = null ) { return $ this -> criteria ( $ criteria , $ column , $ value , $ operator , self :: LOGICAL_OR , $ quote ) ; } | Add an OR condition to the specified WHERE or HAVING criteria . |
5,551 | private function criteriaIn ( array & $ criteria , $ column , array $ values , $ connector = self :: LOGICAL_AND , $ quote = null ) { return $ this -> criteria ( $ criteria , $ column , $ values , self :: IN , $ connector , $ quote ) ; } | Add an IN condition to the specified WHERE or HAVING criteria . |
5,552 | public function whereNotIn ( $ column , array $ values , $ connector = self :: LOGICAL_AND , $ quote = null ) { return $ this -> criteriaNotIn ( $ this -> where , $ column , $ values , $ connector , $ quote ) ; } | Add a NOT IN WHERE condition . |
5,553 | private function criteriaNotIn ( array & $ criteria , $ column , array $ values , $ connector = self :: LOGICAL_AND , $ quote = null ) { return $ this -> criteria ( $ criteria , $ column , $ values , self :: NOT_IN , $ connector , $ quote ) ; } | Add a NOT IN condition to the specified WHERE or HAVING criteria . |
5,554 | public function whereBetween ( $ column , $ min , $ max , $ connector = self :: LOGICAL_AND , $ quote = null ) { return $ this -> criteriaBetween ( $ this -> where , $ column , $ min , $ max , $ connector , $ quote ) ; } | Add a BETWEEN WHERE condition . |
5,555 | private function criteriaBetween ( array & $ criteria , $ column , $ min , $ max , $ connector = self :: LOGICAL_AND , $ quote = null ) { return $ this -> criteria ( $ criteria , $ column , array ( $ min , $ max ) , self :: BETWEEN , $ connector , $ quote ) ; } | Add a BETWEEN condition to the specified WHERE or HAVING criteria . |
5,556 | public function whereNotBetween ( $ column , $ min , $ max , $ connector = self :: LOGICAL_AND , $ quote = null ) { return $ this -> criteriaNotBetween ( $ this -> where , $ column , $ min , $ max , $ connector , $ quote ) ; } | Add a NOT BETWEEN WHERE condition . |
5,557 | private function criteriaNotBetween ( array & $ criteria , $ column , $ min , $ max , $ connector = self :: LOGICAL_AND , $ quote = null ) { return $ this -> criteria ( $ criteria , $ column , array ( $ min , $ max ) , self :: NOT_BETWEEN , $ connector , $ quote ) ; } | Add a NOT BETWEEN condition to the specified WHERE or HAVING criteria . |
5,558 | public function havingNotIn ( $ column , array $ values , $ connector = self :: LOGICAL_AND , $ quote = null ) { return $ this -> criteriaNotIn ( $ this -> having , $ column , $ values , $ connector , $ quote ) ; } | Add a NOT IN HAVING condition . |
5,559 | public function havingBetween ( $ column , $ min , $ max , $ connector = self :: LOGICAL_AND , $ quote = null ) { return $ this -> criteriaBetween ( $ this -> having , $ column , $ min , $ max , $ connector , $ quote ) ; } | Add a BETWEEN HAVING condition . |
5,560 | public function havingNotBetween ( $ column , $ min , $ max , $ connector = self :: LOGICAL_AND , $ quote = null ) { return $ this -> criteriaNotBetween ( $ this -> having , $ column , $ min , $ max , $ connector , $ quote ) ; } | Add a NOT BETWEEN HAVING condition . |
5,561 | public function getStatement ( $ usePlaceholders = true ) { $ statement = "" ; if ( $ this -> isSelect ( ) ) { $ statement = $ this -> getSelectStatement ( $ usePlaceholders ) ; } elseif ( $ this -> isInsert ( ) ) { $ statement = $ this -> getInsertStatement ( $ usePlaceholders ) ; } elseif ( $ this -> isReplace ( ) ) { $ statement = $ this -> getReplaceStatement ( $ usePlaceholders ) ; } elseif ( $ this -> isUpdate ( ) ) { $ statement = $ this -> getUpdateStatement ( $ usePlaceholders ) ; } elseif ( $ this -> isDelete ( ) ) { $ statement = $ this -> getDeleteStatement ( $ usePlaceholders ) ; } return $ statement ; } | Get the full SQL statement . |
5,562 | private function getSelectStatement ( $ usePlaceholders = true ) { $ statement = "" ; if ( ! $ this -> isSelect ( ) ) { return $ statement ; } $ statement .= $ this -> getSelectString ( ) ; if ( $ this -> from ) { $ statement .= " " . $ this -> getFromString ( ) ; } if ( $ this -> where ) { $ statement .= " " . $ this -> getWhereString ( $ usePlaceholders ) ; } if ( $ this -> groupBy ) { $ statement .= " " . $ this -> getGroupByString ( ) ; } if ( $ this -> having ) { $ statement .= " " . $ this -> getHavingString ( $ usePlaceholders ) ; } if ( $ this -> orderBy ) { $ statement .= " " . $ this -> getOrderByString ( ) ; } if ( $ this -> limit ) { $ statement .= " " . $ this -> getLimitString ( ) ; } return $ statement ; } | Get the full SELECT statement . |
5,563 | public function getSelectString ( $ includeText = true ) { $ statement = "" ; if ( ! $ this -> select ) { return $ statement ; } $ statement .= $ this -> getOptionsString ( true ) ; foreach ( $ this -> select as $ column => $ alias ) { $ statement .= $ column ; if ( $ alias ) { $ statement .= " AS " . $ alias ; } $ statement .= ", " ; } $ statement = substr ( $ statement , 0 , - 2 ) ; if ( $ includeText && $ statement ) { $ statement = "SELECT " . $ statement ; } return $ statement ; } | Get the SELECT portion of the statement as a string . |
5,564 | public function getOptionsString ( $ includeTrailingSpace = false ) { $ statement = "" ; if ( ! $ this -> option ) { return $ statement ; } $ statement .= implode ( ' ' , $ this -> option ) ; if ( $ includeTrailingSpace ) { $ statement .= " " ; } return $ statement ; } | Get the execution options portion of the statement as a string . |
5,565 | public function getFromString ( $ includeText = true ) { $ statement = "" ; if ( ! $ this -> from ) { return $ statement ; } $ statement .= $ this -> getFrom ( ) ; if ( $ this -> getFromAlias ( ) ) { $ statement .= " AS " . $ this -> getFromAlias ( ) ; } $ statement .= " " . $ this -> getJoinString ( ) ; $ statement = rtrim ( $ statement ) ; if ( $ includeText && $ statement ) { $ statement = "FROM " . $ statement ; } return $ statement ; } | Get the FROM portion of the statement including all JOINs as a string . |
5,566 | private function getJoinCriteriaUsingPreviousTable ( $ joinIndex , $ table , $ column ) { $ joinCriteria = "" ; $ previousJoinIndex = $ joinIndex - 1 ; if ( array_key_exists ( $ previousJoinIndex , $ this -> join ) ) { $ previousTable = $ this -> join [ $ previousJoinIndex ] [ 'alias' ] ?? $ this -> join [ $ previousJoinIndex ] [ 'table' ] ; } elseif ( $ this -> isSelect ( ) ) { $ previousTable = $ this -> getFromAlias ( ) ?? $ this -> getFrom ( ) ; } elseif ( $ this -> isUpdate ( ) ) { $ previousTable = $ this -> getUpdate ( ) ; } else { $ previousTable = false ; } if ( $ previousTable ) { $ joinCriteria .= $ previousTable . "." ; } $ joinCriteria .= $ column . " " . self :: EQUALS . " " . $ table . "." . $ column ; return $ joinCriteria ; } | Get an ON criteria string joining the specified table and column to the same column of the previous JOIN or FROM table . |
5,567 | public function getWhereString ( $ usePlaceholders = true , $ includeText = true ) { $ statement = $ this -> getCriteriaString ( $ this -> where , $ usePlaceholders , $ this -> wherePlaceholderValues ) ; if ( $ includeText && $ statement ) { $ statement = "WHERE " . $ statement ; } return $ statement ; } | Get the WHERE portion of the statement as a string . |
5,568 | public function autoQuote ( $ value , $ override = null ) { return $ this -> getAutoQuote ( $ override ) ? $ this -> quote ( $ value ) : $ value ; } | Safely escape a value if auto - quoting is enabled or do nothing if disabled . |
5,569 | public function getGroupByString ( $ includeText = true ) { $ statement = "" ; foreach ( $ this -> groupBy as $ groupBy ) { $ statement .= $ groupBy [ 'column' ] ; if ( $ groupBy [ 'order' ] ) { $ statement .= " " . $ groupBy [ 'order' ] ; } $ statement .= ", " ; } $ statement = substr ( $ statement , 0 , - 2 ) ; if ( $ includeText && $ statement ) { $ statement = "GROUP BY " . $ statement ; } return $ statement ; } | Get the GROUP BY portion of the statement as a string . |
5,570 | public function getHavingString ( $ usePlaceholders = true , $ includeText = true ) { $ statement = $ this -> getCriteriaString ( $ this -> having , $ usePlaceholders , $ this -> havingPlaceholderValues ) ; if ( $ includeText && $ statement ) { $ statement = "HAVING " . $ statement ; } return $ statement ; } | Get the HAVING portion of the statement as a string . |
5,571 | public function getOrderByString ( $ includeText = true ) { $ statement = "" ; foreach ( $ this -> orderBy as $ orderBy ) { $ statement .= $ orderBy [ 'column' ] . " " . $ orderBy [ 'order' ] . ", " ; } $ statement = substr ( $ statement , 0 , - 2 ) ; if ( $ includeText && $ statement ) { $ statement = "ORDER BY " . $ statement ; } return $ statement ; } | Get the ORDER BY portion of the statement as a string . |
5,572 | public function getLimitString ( $ includeText = true ) { $ statement = "" ; if ( ! $ this -> limit ) { return $ statement ; } $ statement .= $ this -> limit [ 'limit' ] ; if ( $ this -> limit [ 'offset' ] !== 0 ) { $ statement .= " OFFSET " . $ this -> limit [ 'offset' ] ; } if ( $ includeText && $ statement ) { $ statement = "LIMIT " . $ statement ; } return $ statement ; } | Get the LIMIT portion of the statement as a string . |
5,573 | private function getInsertStatement ( $ usePlaceholders = true ) { $ statement = "" ; if ( ! $ this -> isInsert ( ) ) { return $ statement ; } $ statement .= $ this -> getInsertString ( ) ; if ( $ this -> isInto ) { $ statement .= " " . $ this -> getIntoString ( $ usePlaceholders ) ; } else { if ( $ this -> set ) { $ statement .= " " . $ this -> getSetString ( $ usePlaceholders ) ; } } return $ statement ; } | Get the full INSERT statement . |
5,574 | public function getInsertString ( $ includeText = true ) { $ statement = "" ; if ( ! $ this -> insert ) { return $ statement ; } if ( $ this -> isInto ) { $ statement .= $ this -> getOptionsString ( true ) . 'INTO ' ; } else { $ statement .= $ this -> getOptionsString ( true ) ; } $ statement .= $ this -> getInsert ( ) ; if ( $ includeText && $ statement ) { $ statement = "INSERT " . $ statement ; } return $ statement ; } | Get the INSERT portion of the statement as a string . |
5,575 | private function getReplaceStatement ( $ usePlaceholders = true ) { $ statement = "" ; if ( ! $ this -> isReplace ( ) ) { return $ statement ; } $ statement .= $ this -> getReplaceString ( ) ; if ( $ this -> isInto ) { $ statement .= " " . $ this -> getIntoString ( $ usePlaceholders ) ; } else { if ( $ this -> set ) { $ statement .= " " . $ this -> getSetString ( $ usePlaceholders ) ; } } return $ statement ; } | Get the full REPLACE statement . |
5,576 | public function getReplaceString ( $ includeText = true ) { $ statement = "" ; if ( ! $ this -> replace ) { return $ statement ; } if ( $ this -> isInto ) { $ statement .= $ this -> getOptionsString ( true ) . 'INTO ' ; } else { $ statement .= $ this -> getOptionsString ( true ) ; } $ statement .= $ this -> getReplace ( ) ; if ( $ includeText && $ statement ) { $ statement = "REPLACE " . $ statement ; } return $ statement ; } | Get the REPLACE portion of the statement as a string . |
5,577 | private function getUpdateStatement ( $ usePlaceholders = true ) { $ statement = "" ; if ( ! $ this -> isUpdate ( ) ) { return $ statement ; } $ statement .= $ this -> getUpdateString ( ) ; if ( $ this -> isInto ) { $ statement .= " " . $ this -> getIntoString ( $ usePlaceholders ) ; } else { if ( $ this -> set ) { $ statement .= " " . $ this -> getSetString ( $ usePlaceholders ) ; } } if ( $ this -> where ) { $ statement .= " " . $ this -> getWhereString ( $ usePlaceholders ) ; } if ( ! $ this -> join ) { if ( $ this -> orderBy ) { $ statement .= " " . $ this -> getOrderByString ( ) ; } if ( $ this -> limit ) { $ statement .= " " . $ this -> getLimitString ( ) ; } } return $ statement ; } | Get the full UPDATE statement . |
5,578 | public function getUpdateString ( $ includeText = true ) { $ statement = "" ; if ( ! $ this -> update ) { return $ statement ; } if ( $ this -> isInto ) { $ statement .= $ this -> getOptionsString ( true ) . 'INTO ' ; } else { $ statement .= $ this -> getOptionsString ( true ) ; } $ statement .= $ this -> getUpdate ( ) ; $ statement .= " " . $ this -> getJoinString ( ) ; $ statement = rtrim ( $ statement ) ; if ( $ includeText && $ statement ) { $ statement = "UPDATE " . $ statement ; } return $ statement ; } | Get the UPDATE portion of the statement as a string . |
5,579 | private function getDeleteStatement ( $ usePlaceholders = true ) { $ statement = "" ; if ( ! $ this -> isDelete ( ) ) { return $ statement ; } $ statement .= $ this -> getDeleteString ( ) ; if ( $ this -> from ) { $ statement .= " " . $ this -> getFromString ( ) ; } if ( $ this -> where ) { $ statement .= " " . $ this -> getWhereString ( $ usePlaceholders ) ; } if ( $ this -> isDeleteTableFrom ( ) ) { if ( $ this -> orderBy ) { $ statement .= " " . $ this -> getOrderByString ( ) ; } if ( $ this -> limit ) { $ statement .= " " . $ this -> getLimitString ( ) ; } } return $ statement ; } | Get the full DELETE statement . |
5,580 | public function getDeleteString ( $ includeText = true ) { $ statement = "" ; if ( ! $ this -> delete && ! $ this -> isDeleteTableFrom ( ) ) { return $ statement ; } $ statement .= $ this -> getOptionsString ( true ) ; if ( is_array ( $ this -> delete ) ) { $ statement .= implode ( ', ' , $ this -> delete ) ; } if ( $ includeText && ( $ statement || $ this -> isDeleteTableFrom ( ) ) ) { $ statement = "DELETE " . $ statement ; $ statement = trim ( $ statement ) ; } return $ statement ; } | Get the DELETE portion of the statement as a string . |
5,581 | public function mergeSelectInto ( Miner $ Miner ) { $ this -> mergeOptionsInto ( $ Miner ) ; foreach ( $ this -> select as $ column => $ alias ) { $ Miner -> select ( $ column , $ alias ) ; } return $ Miner ; } | Merge this Miner s SELECT into the given Miner . |
5,582 | public function mergeOptionsInto ( Miner $ Miner ) { foreach ( $ this -> option as $ option ) { $ Miner -> option ( $ option ) ; } return $ Miner ; } | Merge this Miner s execution options into the given Miner . |
5,583 | public function mergeFromInto ( Miner $ Miner ) { if ( $ this -> from ) { $ Miner -> from ( $ this -> getFrom ( ) , $ this -> getFromAlias ( ) ) ; } return $ Miner ; } | Merge this Miner s FROM into the given Miner . |
5,584 | public function from ( $ table , $ alias = null ) { $ this -> from [ 'table' ] = $ table ; $ this -> from [ 'alias' ] = $ alias ; return $ this ; } | Set the FROM table with optional alias . |
5,585 | public function mergeJoinInto ( Miner $ Miner ) { foreach ( $ this -> join as $ join ) { $ Miner -> join ( $ join [ 'table' ] , $ join [ 'criteria' ] , $ join [ 'type' ] , $ join [ 'alias' ] ) ; } return $ Miner ; } | Merge this Miner s JOINs into the given Miner . |
5,586 | public function mergeWhereInto ( Miner $ Miner ) { foreach ( $ this -> where as $ where ) { if ( array_key_exists ( 'bracket' , $ where ) ) { if ( strcmp ( $ where [ 'bracket' ] , self :: BRACKET_OPEN ) == 0 ) { $ Miner -> openWhere ( $ where [ 'connector' ] ) ; } else { $ Miner -> closeWhere ( ) ; } } else { $ Miner -> where ( $ where [ 'column' ] , $ where [ 'value' ] , $ where [ 'operator' ] , $ where [ 'connector' ] , $ where [ 'quote' ] ) ; } } return $ Miner ; } | Merge this Miner s WHERE into the given Miner . |
5,587 | private function openCriteria ( array & $ criteria , $ connector = self :: LOGICAL_AND ) { $ criteria [ ] = array ( 'bracket' => self :: BRACKET_OPEN , 'connector' => $ connector ) ; return $ this ; } | Add an open bracket for nesting conditions to the specified WHERE or HAVING criteria . |
5,588 | public function mergeGroupByInto ( Miner $ Miner ) { foreach ( $ this -> groupBy as $ groupBy ) { $ Miner -> groupBy ( $ groupBy [ 'column' ] , $ groupBy [ 'order' ] ) ; } return $ Miner ; } | Merge this Miner s GROUP BY into the given Miner . |
5,589 | public function mergeHavingInto ( Miner $ Miner ) { foreach ( $ this -> having as $ having ) { if ( array_key_exists ( 'bracket' , $ having ) ) { if ( strcmp ( $ having [ 'bracket' ] , self :: BRACKET_OPEN ) == 0 ) { $ Miner -> openHaving ( $ having [ 'connector' ] ) ; } else { $ Miner -> closeHaving ( ) ; } } else { $ Miner -> having ( $ having [ 'column' ] , $ having [ 'value' ] , $ having [ 'operator' ] , $ having [ 'connector' ] , $ having [ 'quote' ] ) ; } } return $ Miner ; } | Merge this Miner s HAVING into the given Miner . |
5,590 | public function mergeOrderByInto ( Miner $ Miner ) { foreach ( $ this -> orderBy as $ orderBy ) { $ Miner -> orderBy ( $ orderBy [ 'column' ] , $ orderBy [ 'order' ] ) ; } return $ Miner ; } | Merge this Miner s ORDER BY into the given Miner . |
5,591 | public function orderBy ( $ column , $ order = self :: ORDER_BY_ASC ) { $ this -> orderBy [ ] = array ( 'column' => $ column , 'order' => $ order ) ; return $ this ; } | Add a column to ORDER BY . |
5,592 | public function mergeLimitInto ( Miner $ Miner ) { if ( $ this -> limit ) { $ Miner -> limit ( $ this -> getLimit ( ) , $ this -> getLimitOffset ( ) ) ; } return $ Miner ; } | Merge this Miner s LIMIT into the given Miner . |
5,593 | public function mergeIntoColumns ( Miner $ Miner ) { if ( $ this -> intoColums ) { $ Miner -> intoColumns ( $ this -> intoColums ) ; } return $ Miner ; } | Merge this Miner s INTOCOLUMS into the given Miner . |
5,594 | public function mergeIntoValues ( Miner $ Miner ) { if ( $ this -> intoValues ) { $ Miner -> intoValues ( $ this -> intoValues ) ; } return $ Miner ; } | Merge this Miner s INTOVALUES into the given Miner . |
5,595 | public function mergeSetInto ( Miner $ Miner ) { foreach ( $ this -> set as $ set ) { $ Miner -> set ( $ set [ 'column' ] , $ set [ 'value' ] , $ set [ 'quote' ] ) ; } return $ Miner ; } | Merge this Miner s SET into the given Miner . |
5,596 | public function mergeUpdateInto ( Miner $ Miner ) { $ this -> mergeOptionsInto ( $ Miner ) ; if ( $ this -> update ) { $ Miner -> update ( $ this -> getUpdate ( ) ) ; } return $ Miner ; } | Merge this Miner s UPDATE into the given Miner . |
5,597 | public function mergeDeleteInto ( Miner $ Miner ) { $ this -> mergeOptionsInto ( $ Miner ) ; if ( $ this -> isDeleteTableFrom ( ) ) { $ Miner -> delete ( ) ; } else { foreach ( $ this -> delete as $ delete ) { $ Miner -> delete ( $ delete ) ; } } return $ Miner ; } | Merge this Miner s DELETE into the given Miner . |
5,598 | public function delete ( $ table = false ) { if ( $ table === false ) { $ this -> delete = true ; } else { if ( ! is_array ( $ this -> delete ) ) { $ this -> delete = array ( ) ; } $ this -> delete [ ] = $ table ; } return $ this ; } | Add a table to DELETE from or false if deleting from the FROM table . |
5,599 | public function connect ( ) { $ sock = new Swoole \ Coroutine \ Client ( SWOOLE_SOCK_TCP ) ; if ( ! $ sock -> connect ( $ this -> host , $ this -> port , $ this -> connection_timeout ) ) { throw new AMQPRuntimeException ( sprintf ( 'Error Connecting to server(%s): %s ' , $ sock -> errCode , swoole_strerror ( $ sock -> errCode ) ) , $ sock -> errCode ) ; } $ this -> sock = $ sock ; } | Sets up the stream connection |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.