idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
52,200 | public static function rewindBody ( $ message ) { if ( $ message [ 'body' ] instanceof StreamInterface ) { return $ message [ 'body' ] -> seek ( 0 ) ; } if ( $ message [ 'body' ] instanceof \ Generator ) { return false ; } if ( $ message [ 'body' ] instanceof \ Iterator ) { $ message [ 'body' ] -> rewind ( ) ; return t... | Rewind the body of the provided message if possible . |
52,201 | public static function describeType ( $ input ) { switch ( gettype ( $ input ) ) { case 'object' : return 'object(' . get_class ( $ input ) . ')' ; case 'array' : return 'array(' . count ( $ input ) . ')' ; default : ob_start ( ) ; var_dump ( $ input ) ; return str_replace ( 'double(' , 'float(' , rtrim ( ob_get_clean ... | Debug function used to describe the provided value type and class . |
52,202 | public static function proxy ( FutureArrayInterface $ future , callable $ onFulfilled = null , callable $ onRejected = null , callable $ onProgress = null ) { return new FutureArray ( $ future -> then ( $ onFulfilled , $ onRejected , $ onProgress ) , [ $ future , 'wait' ] , [ $ future , 'cancel' ] ) ; } | Returns a proxied future that modifies the dereferenced value of another future using a promise . |
52,203 | public function plural ( $ key , $ count , array $ vars = [ ] ) { if ( $ count === 1 ) { return $ this -> singular ( $ key , $ vars ) ; } return $ this -> singular ( $ key . '_plural' , [ 'count' => $ count ] + $ vars ) ; } | Get a plural message . |
52,204 | public function singular ( $ key , array $ vars = [ ] ) { if ( isset ( static :: $ strings [ $ key ] ) ) { $ varKeys = array_keys ( $ vars ) ; foreach ( $ varKeys as $ i => $ k ) { $ varKeys [ $ i ] = '{' . $ k . '}' ; } return str_replace ( $ varKeys , $ vars , static :: $ strings [ $ key ] ) ; } return '' ; } | Get a singular message . |
52,205 | public function toQuarter ( $ range = false ) { $ quarter = ceil ( $ this -> format ( 'm' ) / 3 ) ; if ( $ range === false ) { return $ quarter ; } $ year = $ this -> format ( 'Y' ) ; switch ( $ quarter ) { case 1 : return [ $ year . '-01-01' , $ year . '-03-31' ] ; case 2 : return [ $ year . '-04-01' , $ year . '-06-3... | Returns the quarter |
52,206 | public function diffInDaysFiltered ( callable $ callback , ChronosInterface $ dt = null , $ abs = true ) { return $ this -> diffFiltered ( ChronosInterval :: day ( ) , $ callback , $ dt , $ abs ) ; } | Get the difference in days using a filter callable |
52,207 | public function diffInHoursFiltered ( callable $ callback , ChronosInterface $ dt = null , $ abs = true ) { return $ this -> diffFiltered ( ChronosInterval :: hour ( ) , $ callback , $ dt , $ abs ) ; } | Get the difference in hours using a filter callable |
52,208 | public function diffFiltered ( ChronosInterval $ ci , callable $ callback , ChronosInterface $ dt = null , $ abs = true ) { $ start = $ this ; $ end = $ dt === null ? static :: now ( $ this -> tz ) : $ dt ; $ inverse = false ; if ( defined ( 'HHVM_VERSION' ) ) { $ start = new DateTimeImmutable ( $ this -> toIso8601Stri... | Get the difference by the given interval using a filter callable |
52,209 | public static function createFromTime ( $ hour = null , $ minute = null , $ second = null , $ tz = null ) { return static :: create ( null , null , null , $ hour , $ minute , $ second , $ tz ) ; } | Create a ChronosInterface instance from just a time . The date portion is set to today . |
52,210 | protected function stripTime ( $ time ) { if ( is_int ( $ time ) || ctype_digit ( $ time ) ) { return gmdate ( 'Y-m-d 00:00:00' , $ time ) ; } if ( $ time instanceof DateTimeInterface ) { $ time = $ time -> format ( 'Y-m-d 00:00:00' ) ; } if ( substr ( $ time , 0 , 1 ) === '@' ) { return gmdate ( 'Y-m-d 00:00:00' , sub... | Removes the time components from an input string . |
52,211 | public function setTime ( $ hours , $ minutes , $ seconds = null , $ microseconds = null ) { if ( CHRONOS_SUPPORTS_MICROSECONDS ) { return parent :: setTime ( 0 , 0 , 0 , 0 ) ; } return parent :: setTime ( 0 , 0 , 0 ) ; } | Modify the time on the Date . |
52,212 | public function modify ( $ relative ) { if ( preg_match ( '/hour|minute|second/' , $ relative ) ) { return $ this ; } $ new = parent :: modify ( $ relative ) ; if ( $ new -> format ( 'H:i:s' ) !== '00:00:00' ) { return $ new -> setTime ( 0 , 0 , 0 ) ; } return $ new ; } | Overloaded to ignore time changes . |
52,213 | public function setDate ( $ year , $ month , $ day ) { return $ this -> modify ( '+0 day' ) -> setDateParent ( $ year , $ month , $ day ) ; } | Set the date to a different date . |
52,214 | public static function open ( $ filename , $ mode ) { $ ex = null ; set_error_handler ( function ( ) use ( $ filename , $ mode , & $ ex ) { $ ex = new \ RuntimeException ( sprintf ( 'Unable to open %s using mode %s: %s' , $ filename , $ mode , func_get_args ( ) [ 1 ] ) ) ; } ) ; $ handle = fopen ( $ filename , $ mode )... | Safely opens a PHP stream resource using a filename . |
52,215 | public function close ( ) { $ this -> pos = $ this -> current = 0 ; foreach ( $ this -> streams as $ stream ) { $ stream -> close ( ) ; } $ this -> streams = [ ] ; } | Closes each attached stream . |
52,216 | public function write ( $ string ) { $ this -> buffer .= $ string ; if ( strlen ( $ this -> buffer ) >= $ this -> hwm ) { return false ; } return strlen ( $ string ) ; } | Writes data to the buffer . |
52,217 | public static function create ( array $ options = [ ] ) { $ maxBuffer = isset ( $ options [ 'max_buffer' ] ) ? $ options [ 'max_buffer' ] : null ; if ( $ maxBuffer === 0 ) { $ buffer = new NullStream ( ) ; } elseif ( isset ( $ options [ 'buffer' ] ) ) { $ buffer = $ options [ 'buffer' ] ; } else { $ hwm = isset ( $ opt... | Factory method used to create new async stream and an underlying buffer if no buffer is provided . |
52,218 | protected function baseString ( Uri $ url , $ method = 'POST' , array $ parameters = array ( ) ) { $ baseString = rawurlencode ( $ method ) . '&' ; $ schemeHostPath = Uri :: fromParts ( array ( 'scheme' => $ url -> getScheme ( ) , 'host' => $ url -> getHost ( ) , 'path' => $ url -> getPath ( ) , ) ) ; $ baseString .= r... | Generate a base string for a HMAC - SHA1 signature based on the given a url method and any parameters . |
52,219 | public function getRsaPublicKey ( ) { if ( $ this -> rsaPublicKey ) { return $ this -> rsaPublicKey ; } if ( ! file_exists ( $ this -> rsaPublicKeyFile ) ) { throw new CredentialsException ( 'Could not read the public key file.' ) ; } $ this -> rsaPublicKey = openssl_get_publickey ( file_get_contents ( $ this -> rsaPub... | Gets the RSA public key . |
52,220 | public function getRsaPrivateKey ( ) { if ( $ this -> rsaPrivateKey ) { return $ this -> rsaPrivateKey ; } if ( ! file_exists ( $ this -> rsaPrivateKeyFile ) ) { throw new CredentialsException ( 'Could not read the private key file.' ) ; } $ this -> rsaPrivateKey = openssl_pkey_get_private ( file_get_contents ( $ this ... | Gets the RSA private key . |
52,221 | protected function key ( ) { $ key = rawurlencode ( $ this -> clientCredentials -> getSecret ( ) ) . '&' ; if ( $ this -> credentials !== null ) { $ key .= rawurlencode ( $ this -> credentials -> getSecret ( ) ) ; } return $ key ; } | Generate a signing key . |
52,222 | public function getTemporaryCredentials ( ) { $ uri = $ this -> urlTemporaryCredentials ( ) ; $ client = $ this -> createHttpClient ( ) ; $ header = $ this -> temporaryCredentialsProtocolHeader ( $ uri ) ; $ authorizationHeader = array ( 'Authorization' => $ header ) ; $ headers = $ this -> buildHttpClientHeaders ( $ a... | Gets temporary credentials by performing a request to the server . |
52,223 | public function getAuthorizationUrl ( $ temporaryIdentifier ) { if ( $ temporaryIdentifier instanceof TemporaryCredentials ) { $ temporaryIdentifier = $ temporaryIdentifier -> getIdentifier ( ) ; } $ parameters = array ( 'oauth_token' => $ temporaryIdentifier ) ; $ url = $ this -> urlAuthorization ( ) ; $ queryString =... | Get the authorization URL by passing in the temporary credentials identifier or an object instance . |
52,224 | public function getUserDetails ( TokenCredentials $ tokenCredentials , $ force = false ) { $ data = $ this -> fetchUserDetails ( $ tokenCredentials , $ force ) ; return $ this -> userDetails ( $ data , $ tokenCredentials ) ; } | Get user details by providing valid token credentials . |
52,225 | public function getUserEmail ( TokenCredentials $ tokenCredentials , $ force = false ) { $ data = $ this -> fetchUserDetails ( $ tokenCredentials , $ force ) ; return $ this -> userEmail ( $ data , $ tokenCredentials ) ; } | Get the user s email if available . |
52,226 | protected function fetchUserDetails ( TokenCredentials $ tokenCredentials , $ force = true ) { if ( ! $ this -> cachedUserDetailsResponse || $ force ) { $ url = $ this -> urlUserDetails ( ) ; $ client = $ this -> createHttpClient ( ) ; $ headers = $ this -> getHeaders ( $ tokenCredentials , 'GET' , $ url ) ; try { $ re... | Fetch user details from the remote service . |
52,227 | public function getHeaders ( CredentialsInterface $ credentials , $ method , $ url , array $ bodyParameters = array ( ) ) { $ header = $ this -> protocolHeader ( strtoupper ( $ method ) , $ url , $ credentials , $ bodyParameters ) ; $ authorizationHeader = array ( 'Authorization' => $ header ) ; $ headers = $ this -> b... | Get all headers required to created an authenticated request . |
52,228 | protected function createClientCredentials ( array $ clientCredentials ) { $ keys = array ( 'identifier' , 'secret' ) ; foreach ( $ keys as $ key ) { if ( ! isset ( $ clientCredentials [ $ key ] ) ) { throw new \ InvalidArgumentException ( "Missing client credentials key [$key] from options." ) ; } } if ( isset ( $ cli... | Creates a client credentials instance from an array of credentials . |
52,229 | protected function handleTemporaryCredentialsBadResponse ( BadResponseException $ e ) { $ response = $ e -> getResponse ( ) ; $ body = $ response -> getBody ( ) ; $ statusCode = $ response -> getStatusCode ( ) ; throw new CredentialsException ( "Received HTTP status code [$statusCode] with message \"$body\" when gettin... | Handle a bad response coming back when getting temporary credentials . |
52,230 | protected function createTemporaryCredentials ( $ body ) { parse_str ( $ body , $ data ) ; if ( ! $ data || ! is_array ( $ data ) ) { throw new CredentialsException ( 'Unable to parse temporary credentials response.' ) ; } if ( ! isset ( $ data [ 'oauth_callback_confirmed' ] ) || $ data [ 'oauth_callback_confirmed' ] !... | Creates temporary credentials from the body response . |
52,231 | protected function createTokenCredentials ( $ body ) { parse_str ( $ body , $ data ) ; if ( ! $ data || ! is_array ( $ data ) ) { throw new CredentialsException ( 'Unable to parse token credentials response.' ) ; } if ( isset ( $ data [ 'error' ] ) ) { throw new CredentialsException ( "Error [{$data['error']}] in retri... | Creates token credentials from the body response . |
52,232 | protected function baseProtocolParameters ( ) { $ dateTime = new \ DateTime ( ) ; return array ( 'oauth_consumer_key' => $ this -> clientCredentials -> getIdentifier ( ) , 'oauth_nonce' => $ this -> nonce ( ) , 'oauth_signature_method' => $ this -> signature -> method ( ) , 'oauth_timestamp' => $ dateTime -> format ( '... | Get the base protocol parameters for an OAuth request . Each request builds on these parameters . |
52,233 | protected function temporaryCredentialsProtocolHeader ( $ uri ) { $ parameters = array_merge ( $ this -> baseProtocolParameters ( ) , array ( 'oauth_callback' => $ this -> clientCredentials -> getCallbackUri ( ) , ) ) ; $ parameters [ 'oauth_signature' ] = $ this -> signature -> sign ( $ uri , $ parameters , 'POST' ) ;... | Generate the OAuth protocol header for a temporary credentials request based on the URI . |
52,234 | protected function protocolHeader ( $ method , $ uri , CredentialsInterface $ credentials , array $ bodyParameters = array ( ) ) { $ parameters = array_merge ( $ this -> baseProtocolParameters ( ) , $ this -> additionalProtocolParameters ( ) , array ( 'oauth_token' => $ credentials -> getIdentifier ( ) , ) ) ; $ this -... | Generate the OAuth protocol header for requests other than temporary credentials based on the URI method given credentials & body query string . |
52,235 | protected function normalizeProtocolParameters ( array $ parameters ) { array_walk ( $ parameters , function ( & $ value , $ key ) { $ value = rawurlencode ( $ key ) . '="' . rawurlencode ( $ value ) . '"' ; } ) ; return 'OAuth ' . implode ( ', ' , $ parameters ) ; } | Takes an array of protocol parameters and normalizes them to be used as a HTTP header . |
52,236 | private function buildAuthorizationQueryParameters ( ) { $ params = array ( 'response_type' => 'fragment' , 'scope' => $ this -> getApplicationScope ( ) , 'expiration' => $ this -> getApplicationExpiration ( ) , 'name' => $ this -> getApplicationName ( ) , ) ; return http_build_query ( $ params ) ; } | Build authorization query parameters . |
52,237 | public function getDocComment ( $ type = 'class' , $ name = '' ) { $ this -> parse ( ) ; return $ name ? $ this -> docComment [ $ type ] [ $ name ] : $ this -> docComment [ $ type ] ; } | Gets the doc comment . |
52,238 | public function getStaticReflectionParserForDeclaringClass ( $ type , $ name ) { $ this -> parse ( ) ; if ( isset ( $ this -> docComment [ $ type ] [ $ name ] ) ) { return $ this ; } if ( ! empty ( $ this -> parentClassName ) ) { return $ this -> getParentStaticReflectionParser ( ) -> getStaticReflectionParserForDeclar... | Gets the PSR - 0 parser for the declaring class . |
52,239 | public function parse ( ) : int { $ this -> expression = $ this -> convertErrorConstants ( $ this -> expression ) ; $ this -> expression = str_replace ( [ ',' , ' ' ] , [ '.' , '' ] , $ this -> expression ) ; return $ this -> compute ( $ this -> expression ) ; } | Parse and compute the error types expression |
52,240 | private function convertErrorConstants ( string $ expression ) : string { $ output = preg_replace_callback ( '/(E_[a-zA-Z_]+)/' , function ( $ errorConstant ) { if ( defined ( $ errorConstant [ 1 ] ) ) { return constant ( $ errorConstant [ 1 ] ) ; } return $ errorConstant [ 0 ] ; } , $ expression ) ; if ( null === $ ou... | Converts error constants from string to int . |
52,241 | private function compute ( string $ expression ) : int { if ( 0 !== preg_match ( "/[^\d.+*%^|&~<>\/()-]/" , $ this -> expression ) ) { throw new \ InvalidArgumentException ( 'Wrong value in error types config value:' . $ this -> expression ) ; } return 0 + ( int ) eval ( 'return ' . $ expression . ';' ) ; } | Let PHP compute the prepared expression for us . |
52,242 | public function onKernelRequest ( GetResponseEvent $ event ) : void { if ( ! $ event -> isMasterRequest ( ) ) { return ; } $ currentClient = Hub :: getCurrent ( ) -> getClient ( ) ; if ( null === $ currentClient || ! $ currentClient -> getOptions ( ) -> shouldSendDefaultPii ( ) ) { return ; } $ token = null ; if ( $ th... | Set the username from the security context by listening on core . request |
52,243 | public function onConsoleCommand ( ConsoleCommandEvent $ event ) : void { $ command = $ event -> getCommand ( ) ; Hub :: getCurrent ( ) -> configureScope ( function ( Scope $ scope ) use ( $ command ) : void { $ scope -> setTag ( 'command' , $ command ? $ command -> getName ( ) : 'N/A' ) ; } ) ; } | This method ensures that the client and error handlers are registered at the start of the command execution cycle and not only on exceptions |
52,244 | protected function printClassName ( ) { if ( $ this -> hideClassName ) { return ; } if ( $ this -> lastClassName === $ this -> className ) { return ; } echo PHP_EOL ; $ className = $ this -> formatClassName ( $ this -> className ) ; $ this -> colorsTool ? $ this -> writeWithColor ( 'fg-cyan,bold' , $ className , false ... | Prints the Class Name if it has changed . |
52,245 | public function getMinkParameter ( $ name ) { return isset ( $ this -> minkParameters [ $ name ] ) ? $ this -> minkParameters [ $ name ] : null ; } | Returns specific mink parameter . |
52,246 | public function visitPath ( $ path , $ sessionName = null ) { $ this -> getSession ( $ sessionName ) -> visit ( $ this -> locatePath ( $ path ) ) ; } | Visits provided relative path using provided or default session . |
52,247 | public function saveScreenshot ( $ filename = null , $ filepath = null ) { $ filename = $ filename ? : sprintf ( '%s_%s_%s.%s' , $ this -> getMinkParameter ( 'browser_name' ) , date ( 'c' ) , uniqid ( '' , true ) , 'png' ) ; $ filepath = $ filepath ? : ( ini_get ( 'upload_tmp_dir' ) ? ini_get ( 'upload_tmp_dir' ) : sys... | Save a screenshot of the current window to the file system . |
52,248 | public function showFailedStepResponse ( AfterStepTested $ event ) { $ testResult = $ event -> getTestResult ( ) ; if ( ! $ testResult instanceof ExceptionResult ) { return ; } if ( ! $ testResult -> getException ( ) instanceof MinkException ) { return ; } if ( null === $ this -> parameters [ 'show_cmd' ] ) { throw new... | Shows last response of failed step with preconfigured command . |
52,249 | public function emit ( $ signal , $ params = null ) { if ( ! $ this -> hasHandlers ( $ signal ) ) { return ; } if ( ! is_array ( $ params ) ) { $ params = func_get_args ( ) ; $ params = array_slice ( $ params , 1 ) ; } foreach ( $ this -> sigslots [ $ signal ] as $ slot ) { $ return = $ slot -> call ( $ params ) ; } re... | Emits a signal with a given set of parameters . |
52,250 | public function unsubscribe ( $ signal , $ callback = null ) { if ( ! $ this -> hasHandlers ( $ signal ) ) { return ; } if ( $ callback !== null ) { $ index = $ this -> getCallbackHash ( $ callback ) ; if ( ! array_key_exists ( $ index , $ this -> sigslots [ $ signal ] ) ) { return ; } unset ( $ this -> sigslots [ $ si... | Unsubscribes from a signal . |
52,251 | protected function getPrefix ( ) { $ prefix = "" ; if ( count ( $ this -> currSib ) ) { $ last = array_pop ( $ this -> currSib ) ; foreach ( $ this -> currSib as $ sibling ) { $ prefix .= ( $ sibling ) ? "| " : " " ; } $ prefix .= ( $ last ) ? "\\-" : "|-" ; } return $ prefix ; } | Returns the ASCII string to display the prefix of the current node . |
52,252 | public function getProperty ( $ property , $ default = null ) { if ( ! $ this -> offsetExists ( $ property ) ) { $ this -> fetchNodeInfo ( ) ; } if ( ! $ this -> offsetExists ( $ property ) ) { return $ default ; } return $ this -> nodeInfo [ ( string ) $ property ] ; } | Returns the specified property or a pre - defined default value from the node info array . |
52,253 | protected function getStorage ( $ key , $ default = null ) { return ! empty ( $ this -> storage [ $ key ] ) ? $ this -> storage [ $ key ] : $ default ; } | Returns data from the internal storage array . |
52,254 | public function modify ( array $ properties ) { $ properties [ "clid" ] = $ this -> getId ( ) ; $ this -> execute ( "clientedit" , $ properties ) ; $ this -> resetNodeInfo ( ) ; } | Changes the clients properties using given properties . |
52,255 | public function move ( $ cid , $ cpw = null ) { $ this -> getParent ( ) -> clientMove ( $ this -> getId ( ) , $ cid , $ cpw ) ; } | Moves the client to another channel . |
52,256 | public function kick ( $ reasonid = TeamSpeak3 :: KICK_CHANNEL , $ reasonmsg = null ) { $ this -> getParent ( ) -> clientKick ( $ this -> getId ( ) , $ reasonid , $ reasonmsg ) ; } | Kicks the client from his currently joined channel or from the server . |
52,257 | public function ban ( $ timeseconds = null , $ reason = null ) { return $ this -> getParent ( ) -> clientBan ( $ this -> getId ( ) , $ timeseconds , $ reason ) ; } | Bans the client from the server . Please note that this will create two separate ban rules for the targeted clients IP address and his unique identifier . |
52,258 | public function permAssign ( $ permid , $ permvalue , $ permskip = FALSE ) { $ this -> getParent ( ) -> clientPermAssign ( $ this [ "client_database_id" ] , $ permid , $ permvalue , $ permskip ) ; } | Adds a set of specified permissions to the client . Multiple permissions can be added by providing the three parameters of each permission . |
52,259 | public function getBadges ( ) { $ badges = array ( ) ; foreach ( explode ( ":" , $ this [ "client_badges" ] ) as $ set ) { if ( substr ( $ set , 0 , 7 ) == "badges=" ) { $ badges [ ] = array_map ( "trim" , explode ( "," , substr ( $ set , 7 ) ) ) ; } } return $ badges ; } | Returns a list of equipped badges for this client . |
52,260 | public function memberOf ( ) { $ cgroups = array ( $ this -> getParent ( ) -> channelGroupGetById ( $ this [ "client_channel_group_id" ] ) ) ; $ sgroups = array ( ) ; foreach ( explode ( "," , $ this [ "client_servergroups" ] ) as $ sgid ) { $ sgroups [ ] = $ this -> getParent ( ) -> serverGroupGetById ( $ sgid ) ; } u... | Returns all server and channel groups the client is currently residing in . |
52,261 | public function getIcon ( ) { if ( $ this [ "client_type" ] ) { return "client_query" ; } elseif ( $ this [ "client_away" ] ) { return "client_away" ; } elseif ( ! $ this [ "client_output_hardware" ] ) { return "client_snd_disabled" ; } elseif ( $ this [ "client_output_muted" ] ) { return "client_snd_muted" ; } elseif ... | Returns the name of a possible icon to display the node object . |
52,262 | public function isValid ( ) { return ( $ this -> checkUser ( ) && $ this -> checkPass ( ) && $ this -> checkHost ( ) && $ this -> checkPort ( ) && $ this -> checkPath ( ) && $ this -> checkQuery ( ) && $ this -> checkFragment ( ) ) ; } | Validate the current URI from the instance variables . |
52,263 | public function checkUser ( $ username = null ) { if ( $ username === null ) { $ username = $ this -> user ; } if ( strlen ( $ username ) == 0 ) { return TRUE ; } $ pattern = "/^(" . $ this -> regex [ "alphanum" ] . "|" . $ this -> regex [ "mark" ] . "|" . $ this -> regex [ "escaped" ] . "|[;:&=+$,])+$/" ; $ status = @... | Returns TRUE if the username is valid . |
52,264 | public function checkPass ( $ password = null ) { if ( $ password === null ) { $ password = $ this -> pass ; } if ( strlen ( $ password ) == 0 ) { return TRUE ; } $ pattern = "/^(" . $ this -> regex [ "alphanum" ] . "|" . $ this -> regex [ "mark" ] . "|" . $ this -> regex [ "escaped" ] . "|[;:&=+$,])+$/" ; $ status = @... | Returns TRUE if the password is valid . |
52,265 | public function checkQuery ( $ query = null ) { if ( $ query === null ) { $ query = $ this -> query ; } if ( strlen ( $ query ) == 0 ) { return TRUE ; } $ pattern = "/^" . $ this -> regex [ "uric" ] . "*$/" ; $ status = @ preg_match ( $ pattern , $ query ) ; if ( $ status === FALSE ) { throw new TeamSpeak3_Helper_Excep... | Returns TRUE if the query string is valid . |
52,266 | public function hasQueryVar ( $ key ) { if ( ! $ this -> hasQuery ( ) ) return FALSE ; parse_str ( $ this -> query , $ queryArray ) ; return array_key_exists ( $ key , $ queryArray ) ? TRUE : FALSE ; } | Returns TRUE if the URI has a query variable . |
52,267 | public function checkFragment ( $ fragment = null ) { if ( $ fragment === null ) { $ fragment = $ this -> fragment ; } if ( strlen ( $ fragment ) == 0 ) { return TRUE ; } $ pattern = "/^" . $ this -> regex [ "uric" ] . "*$/" ; $ status = @ preg_match ( $ pattern , $ fragment ) ; if ( $ status === FALSE ) { throw new Te... | Returns TRUE if the fragment string is valid . |
52,268 | public function channelSpacerGetAlign ( $ cid ) { $ channel = $ this -> channelGetById ( $ cid ) ; if ( ! $ this -> channelIsSpacer ( $ channel ) || ! preg_match ( "/\[(.*)spacer.*\]/" , $ channel , $ matches ) || ! isset ( $ matches [ 1 ] ) ) { throw new TeamSpeak3_Adapter_ServerQuery_Exception ( "invalid channel flag... | Returns the possible alignment of a channel spacer . |
52,269 | public function channelPermList ( $ cid , $ permsid = FALSE ) { return $ this -> execute ( "channelpermlist" , array ( "cid" => $ cid , $ permsid ? "-permsid" : null ) ) -> toAssocArray ( $ permsid ? "permsid" : "permid" ) ; } | Returns a list of permissions defined for a specific channel . |
52,270 | public function channelPermAssign ( $ cid , $ permid , $ permvalue ) { if ( ! is_array ( $ permid ) ) { $ permident = ( is_numeric ( $ permid ) ) ? "permid" : "permsid" ; } else { $ permident = ( is_numeric ( current ( $ permid ) ) ) ? "permid" : "permsid" ; } $ this -> execute ( "channeladdperm" , array ( "cid" => $ c... | Adds a set of specified permissions to a channel . Multiple permissions can be added by providing the two parameters of each permission . |
52,271 | public function channelPermRemove ( $ cid , $ permid ) { if ( ! is_array ( $ permid ) ) { $ permident = ( is_numeric ( $ permid ) ) ? "permid" : "permsid" ; } else { $ permident = ( is_numeric ( current ( $ permid ) ) ) ? "permid" : "permsid" ; } $ this -> execute ( "channeldelperm" , array ( "cid" => $ cid , $ permide... | Removes a set of specified permissions from a channel . Multiple permissions can be removed at once . |
52,272 | public function channelClientPermRemove ( $ cid , $ cldbid , $ permid ) { if ( ! is_array ( $ permid ) ) { $ permident = ( is_numeric ( $ permid ) ) ? "permid" : "permsid" ; } else { $ permident = ( is_numeric ( current ( $ permid ) ) ) ? "permid" : "permsid" ; } $ this -> execute ( "channelclientdelperm" , array ( "ci... | Removes a set of specified permissions from a client in a specific channel . Multiple permissions can be removed at once . |
52,273 | public function channelFileInfo ( $ cid , $ cpw = "" , $ name = "/" ) { $ info = $ this -> execute ( "ftgetfileinfo" , array ( "cid" => $ cid , "cpw" => $ cpw , "name" => $ name ) ) -> toArray ( ) ; return array_pop ( $ info ) ; } | Returns detailed information about the specified file stored in a channels file repository . |
52,274 | public function channelGetLevel ( $ cid ) { $ channel = $ this -> channelGetById ( $ cid ) ; $ levelno = 0 ; if ( $ channel [ "pid" ] ) { $ levelno = $ this -> channelGetLevel ( $ channel [ "pid" ] ) + 1 ; } return $ levelno ; } | Returns the level of a channel . |
52,275 | public function channelGetPathway ( $ cid ) { $ channel = $ this -> channelGetById ( $ cid ) ; $ pathway = $ channel [ "channel_name" ] ; if ( $ channel [ "pid" ] ) { $ pathway = $ this -> channelGetPathway ( $ channel [ "pid" ] ) . "/" . $ channel [ "channel_name" ] ; } return $ pathway ; } | Returns the pathway of a channel which can be used as a clients default channel . |
52,276 | public function clientListDb ( $ offset = null , $ limit = null ) { return $ this -> execute ( "clientdblist -count" , array ( "start" => $ offset , "duration" => $ limit ) ) -> toAssocArray ( "cldbid" ) ; } | Returns a list of client identities known by the virtual server . By default the server spits out 25 entries at once . |
52,277 | public function clientGetByUid ( $ uid ) { foreach ( $ this -> clientList ( ) as $ client ) { if ( $ client [ "client_unique_identifier" ] == $ uid ) return $ client ; } throw new TeamSpeak3_Adapter_ServerQuery_Exception ( "invalid clientID" , 0x200 ) ; } | Returns the TeamSpeak3_Node_Client object matching the given unique identifier . |
52,278 | public function clientGetByDbid ( $ dbid ) { foreach ( $ this -> clientList ( ) as $ client ) { if ( $ client [ "client_database_id" ] == $ dbid ) return $ client ; } throw new TeamSpeak3_Adapter_ServerQuery_Exception ( "invalid clientID" , 0x200 ) ; } | Returns the TeamSpeak3_Node_Client object matching the given database ID . |
52,279 | public function clientPermList ( $ cldbid , $ permsid = FALSE ) { $ this -> clientListReset ( ) ; return $ this -> execute ( "clientpermlist" , array ( "cldbid" => $ cldbid , $ permsid ? "-permsid" : null ) ) -> toAssocArray ( $ permsid ? "permsid" : "permid" ) ; } | Returns a list of permissions defined for a client . |
52,280 | public function clientPermAssign ( $ cldbid , $ permid , $ permvalue , $ permskip = FALSE ) { if ( ! is_array ( $ permid ) ) { $ permident = ( is_numeric ( $ permid ) ) ? "permid" : "permsid" ; } else { $ permident = ( is_numeric ( current ( $ permid ) ) ) ? "permid" : "permsid" ; } $ this -> execute ( "clientaddperm" ... | Adds a set of specified permissions to a client . Multiple permissions can be added by providing the three parameters of each permission . |
52,281 | public function clientPermRemove ( $ cldbid , $ permid ) { if ( ! is_array ( $ permid ) ) { $ permident = ( is_numeric ( $ permid ) ) ? "permid" : "permsid" ; } else { $ permident = ( is_numeric ( current ( $ permid ) ) ) ? "permid" : "permsid" ; } $ this -> execute ( "clientdelperm" , array ( "cldbid" => $ cldbid , $ ... | Removes a set of specified permissions from a client . Multiple permissions can be removed at once . |
52,282 | public function serverGroupList ( array $ filter = array ( ) ) { if ( $ this -> sgroupList === null ) { $ this -> sgroupList = $ this -> request ( "servergrouplist" ) -> toAssocArray ( "sgid" ) ; foreach ( $ this -> sgroupList as $ sgid => $ group ) { $ this -> sgroupList [ $ sgid ] = new TeamSpeak3_Node_Servergroup ( ... | Returns a list of server groups available . |
52,283 | public function serverGroupPermList ( $ sgid , $ permsid = FALSE ) { return $ this -> execute ( "servergrouppermlist" , array ( "sgid" => $ sgid , $ permsid ? "-permsid" : null ) ) -> toAssocArray ( $ permsid ? "permsid" : "permid" ) ; } | Returns a list of permissions assigned to the server group specified . |
52,284 | public function channelGroupPermList ( $ cgid , $ permsid = FALSE ) { return $ this -> execute ( "channelgrouppermlist" , array ( "cgid" => $ cgid , $ permsid ? "-permsid" : null ) ) -> toAssocArray ( $ permsid ? "permsid" : "permid" ) ; } | Returns a list of permissions assigned to the channel group specified . |
52,285 | public function channelGroupPermAssign ( $ cgid , $ permid , $ permvalue ) { if ( ! is_array ( $ permid ) ) { $ permident = ( is_numeric ( $ permid ) ) ? "permid" : "permsid" ; } else { $ permident = ( is_numeric ( current ( $ permid ) ) ) ? "permid" : "permsid" ; } $ this -> execute ( "channelgroupaddperm" , array ( "... | Adds a set of specified permissions to the channel group specified . Multiple permissions can be added by providing the two parameters of each permission in separate arrays . |
52,286 | public function permReset ( ) { $ token = $ this -> request ( "permreset" ) -> toList ( ) ; TeamSpeak3_Helper_Signal :: getInstance ( ) -> emit ( "notifyTokencreated" , $ this , $ token [ "token" ] ) ; return $ token [ "token" ] ; } | Restores the default permission settings on the virtual server and returns a new initial administrator privilege key . |
52,287 | public function tempPasswordList ( $ resolve = FALSE ) { $ passwords = $ this -> request ( "servertemppasswordlist" ) -> toAssocArray ( "pw_clear" ) ; if ( $ resolve ) { foreach ( $ passwords as $ password => $ array ) { try { $ channel = $ this -> channelGetById ( $ array [ "tcid" ] ) ; $ passwords [ $ password ] [ "t... | Returns a list of temporary server passwords . |
52,288 | public function selfUpdate ( array $ properties ) { $ this -> execute ( "clientupdate" , $ properties ) ; foreach ( $ properties as $ ident => $ value ) { $ this -> whoamiSet ( $ ident , $ value ) ; } } | Changes the properties of your own client connection . |
52,289 | public static function start ( $ name = "default" ) { if ( array_key_exists ( $ name , self :: $ timers ) ) { self :: $ timers [ $ name ] -> start ( ) ; } else { self :: $ timers [ $ name ] = new TeamSpeak3_Helper_Profiler_Timer ( $ name ) ; } } | Starts a timer . |
52,290 | public static function stop ( $ name = "default" ) { if ( ! array_key_exists ( $ name , self :: $ timers ) ) { self :: init ( $ name ) ; } self :: $ timers [ $ name ] -> stop ( ) ; } | Stops a timer . |
52,291 | public static function get ( $ name = "default" ) { if ( ! array_key_exists ( $ name , self :: $ timers ) ) { self :: init ( $ name ) ; } return self :: $ timers [ $ name ] ; } | Returns a timer . |
52,292 | public function arg ( array $ args , $ char = "%" ) { $ args = array_reverse ( $ args , TRUE ) ; foreach ( $ args as $ key => $ val ) { $ args [ $ char . $ key ] = $ val ; unset ( $ args [ $ key ] ) ; } $ this -> string = strtr ( $ this -> string , $ args ) ; return $ this ; } | This function replaces indexed or associative signs with given values . |
52,293 | public function escape ( ) { foreach ( TeamSpeak3 :: getEscapePatterns ( ) as $ search => $ replace ) { $ this -> string = str_replace ( $ search , $ replace , $ this -> string ) ; } return $ this ; } | Escapes a string using the TeamSpeak 3 escape patterns . |
52,294 | public function isInt ( ) { return ( is_numeric ( $ this -> string ) && ! $ this -> contains ( "." ) && ! $ this -> contains ( "x" ) ) ? TRUE : FALSE ; } | Returns TRUE if the string is a numeric value . |
52,295 | public function toInt ( ) { if ( $ this -> string == pow ( 2 , 63 ) || $ this -> string == pow ( 2 , 64 ) ) { return - 1 ; } return ( $ this -> string > pow ( 2 , 31 ) ) ? floatval ( $ this -> string ) : intval ( $ this -> string ) ; } | Returns the integer value of the string . |
52,296 | public function uriSafe ( $ spacer = "-" ) { $ this -> string = str_replace ( $ spacer , " " , $ this -> string ) ; $ this -> string = $ this -> transliterate ( ) ; $ this -> string = preg_replace ( "/(\s|[^A-Za-z0-9\-])+/" , $ spacer , trim ( strtolower ( $ this -> string ) ) ) ; $ this -> string = trim ( $ this -> st... | Processes the string and replaces all accented UTF - 8 characters by unaccented ASCII - 7 equivalents whitespaces are replaced by a pre - defined spacer and the string is lowercase . |
52,297 | public function toUnicode ( ) { $ h = ord ( $ this -> char { 0 } ) ; if ( $ h <= 0x7F ) { return $ h ; } else if ( $ h < 0xC2 ) { return FALSE ; } else if ( $ h <= 0xDF ) { return ( $ h & 0x1F ) << 6 | ( ord ( $ this -> char { 1 } ) & 0x3F ) ; } else if ( $ h <= 0xEF ) { return ( $ h & 0x0F ) << 12 | ( ord ( $ this -> ... | Returns the Unicode value of the character . |
52,298 | public static function fromHex ( $ hex ) { if ( strlen ( $ hex ) != 2 ) { throw new TeamSpeak3_Helper_Exception ( "given parameter '" . $ hex . "' is not a valid hexadecimal number" ) ; } return new self ( chr ( hexdec ( $ hex ) ) ) ; } | Returns the TeamSpeak3_Helper_Char based on a given hex value . |
52,299 | public function sendLine ( $ data , $ separator = "\n" ) { $ size = strlen ( $ data ) ; $ pack = 4096 ; for ( $ seek = 0 ; $ seek < $ size ; ) { $ rest = $ size - $ seek ; $ pack = $ rest < $ pack ? $ rest : $ pack ; $ buff = substr ( $ data , $ seek , $ pack ) ; $ seek = $ seek + $ pack ; if ( $ seek >= $ size ) $ buf... | Writes a line of data to the stream . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.