idx int64 0 60.3k | question stringlengths 99 4.85k | target stringlengths 5 718 |
|---|---|---|
9,200 | public function show ( $ folder ) { $ this -> manager -> resetPath ( $ folder ) ; if ( ! $ this -> manager -> blobExists ( ) ) { return $ this -> json ( 'File not found.' , 404 ) ; } $ list = $ this -> manager -> folderContent ( ) ; return $ this -> json ( $ list ) ; } | List folder content |
9,201 | public function update ( Request $ request , string $ folder = '' ) { if ( empty ( $ request -> name ) ) { return $ this -> json ( 'Name property is required.' , 422 ) ; } $ this -> manager -> resetPath ( $ folder ) ; if ( ! $ this -> manager -> blobExists ( ) ) { return $ this -> json ( 'Folder not found.' , 404 ) ; }... | Rename folder name |
9,202 | protected static function connect ( array $ servers , $ memcache = null ) { if ( ! $ memcache ) { $ memcache = new \ Memcached ( ) ; } foreach ( $ servers as $ server ) { $ memcache -> addServer ( $ server [ 'host' ] , $ server [ 'port' ] , $ server [ 'weight' ] ) ; } if ( $ memcache -> getVersion ( ) === false ) { thr... | Create a new Memcached connection instance . |
9,203 | public function run ( $ pretend = false ) { $ results = $ this -> prepare ( ) ; $ this -> preview ( $ results ) ; if ( $ this -> command -> confirm ( 'Everything is right?' ) ) { $ return = $ pretend ? true : $ this -> finish ( $ results ) ; if ( $ return === false ) { $ return = $ this -> repeat ( ) ; } } else { $ ret... | Run step . |
9,204 | public function repeat ( ) { if ( $ this -> repeats > self :: REPEATS ) { return false ; } if ( $ this -> command -> confirm ( 'Do you want to repeat step?' ) ) { $ this -> repeats ++ ; return $ this -> run ( ) ; } return false ; } | Repeat step . |
9,205 | public static function toDOM ( BaseElement $ element ) : \ DOMDocument { $ doc = new \ DOMDocument ( '1.0' , 'utf-8' ) ; $ doc -> appendChild ( $ element -> toDOM ( $ doc ) ) ; return $ doc ; } | Gets the xml representation of a tree . |
9,206 | public function CreateSubscription ( Request \ CreateSubscription $ CreateSubscription = null ) { $ uri = $ this -> getUri ( '/subscription' , array ( ) ) ; return $ this -> post ( $ uri , $ CreateSubscription ) ; } | Creates a new subscription for CallFire event notifications |
9,207 | public function QuerySubscriptions ( Request \ QuerySubscriptions $ QuerySubscriptions = null ) { $ uri = $ this -> getUri ( '/subscription' , array ( ) ) ; return $ this -> get ( $ uri , $ QuerySubscriptions ) ; } | Get a list of registered subscriptions |
9,208 | public function UpdateSubscription ( $ Id , Request \ UpdateSubscription $ UpdateSubscription = null ) { $ uri = $ this -> getUri ( '/subscription/%s' , array ( $ Id ) ) ; return $ this -> put ( $ uri , $ UpdateSubscription ) ; } | Updates an existing subscription |
9,209 | public function getReachable ( $ vertex ) { if ( $ this -> getState ( ) !== self :: COMPLETE ) { throw new WrongVisitorStateException ( 'Correct reachability data cannot be retrieved until traversal is complete.' ) ; } if ( ! isset ( $ this -> paths [ $ vertex ] ) ) { return FALSE ; } return $ this -> paths [ $ vertex ... | Returns an array of all vertices reachable from the given vertex . |
9,210 | public function prefix ( $ prefix , $ uri ) { $ type = WAMPProtocol :: MSG_PREFIX ; $ data = [ $ type , $ prefix , $ uri ] ; $ this -> send ( $ data ) ; } | Establish a prefix on server |
9,211 | public function call ( $ procUri , $ arguments = [ ] ) { $ args = func_get_args ( ) ; array_shift ( $ args ) ; $ type = WAMPProtocol :: MSG_CALL ; $ callId = uniqid ( "" , $ moreEntropy = TRUE ) ; $ data = array_merge ( array ( $ type , $ callId , $ procUri ) , $ args ) ; $ this -> send ( $ data ) ; } | Call a procedure on server |
9,212 | public function publish ( $ topicUri , $ payload , $ exclude = [ ] , $ eligible = [ ] ) { $ type = WAMPProtocol :: MSG_PUBLISH ; $ data = array ( $ type , $ topicUri , $ payload , $ exclude , $ eligible ) ; $ this -> send ( $ data ) ; } | The client will send an event to all clients connected to the server who have subscribed to the topicURI |
9,213 | private function filterHasEncryptedField ( array $ criteria ) { $ result = false ; if ( ! empty ( $ criteria ) ) { $ encryptedFields = array_keys ( $ this -> getEncryptedFields ( ) ) ; $ criteriaFields = array_keys ( $ criteria ) ; $ commonFields = array_intersect ( $ encryptedFields , $ criteriaFields ) ; $ result = !... | Checks if any of the fields in the filter criteria is encrypted |
9,214 | private function orderByHasEncryptedField ( array $ orderBy = null ) { $ result = false ; if ( $ orderBy && ! empty ( $ orderBy ) ) { $ encryptedFields = array_keys ( $ this -> getEncryptedFields ( ) ) ; $ orderByFields = array_keys ( $ orderBy ) ; $ commonFields = array_intersect ( $ encryptedFields , $ orderByFields ... | Checks if any of the fields in the order by clause is encrypted |
9,215 | private function filterWithEncryptedCriteria ( $ values , array $ encryptedCriteria ) { $ result = array_filter ( $ values , function ( $ value ) use ( $ encryptedCriteria ) { foreach ( $ encryptedCriteria as $ fieldName => $ fieldValue ) { if ( ! $ this -> fieldValueMatches ( $ value , $ fieldName , $ fieldValue ) ) {... | Filters the values using by one or more encrypted fields |
9,216 | private function fieldValueMatches ( $ entity , $ fieldName , $ fieldValue ) { $ value = $ this -> getFieldValue ( $ entity , $ fieldName ) ; if ( is_array ( $ fieldValue ) ) { $ matches = in_array ( $ value , $ fieldValue ) ; } else { $ matches = ( $ value == $ fieldValue ) ; } return $ matches ; } | Check if the value of the field matches the given value |
9,217 | private function sortWithEncryptedOrderBy ( $ values , array $ orderBy ) { usort ( $ values , function ( $ entity1 , $ entity2 ) use ( $ orderBy ) { foreach ( $ orderBy as $ fieldName => $ order ) { $ value1 = $ this -> getFieldValue ( $ entity1 , $ fieldName ) ; $ value2 = $ this -> getFieldValue ( $ entity2 , $ field... | Sorts the values using by one or more encrypted fields |
9,218 | private function getUserKey ( PKEncryptionEnabledUserInterface $ user ) { $ pkiKey = $ this -> findKeyByUser ( $ user ) ; if ( ! $ pkiKey ) { $ userId = $ user -> getId ( ) ; $ userClass = $ this -> getUserClass ( $ user ) ; $ pkiKey = new PKIPrivateKey ( ) ; $ pkiKey -> setUserClass ( $ userClass ) ; $ pkiKey -> setUs... | Returns the Key pair of the user or a new one if it has not already been persisted |
9,219 | private function findKeyByUser ( PKEncryptionEnabledUserInterface $ user ) { $ userClass = $ this -> getUserClass ( $ user ) ; $ userId = $ user -> getId ( ) ; $ key = $ this -> getKeyRepository ( ) -> findOneBy ( array ( 'userClass' => $ userClass , 'userId' => $ userId ) ) ; return $ key ; } | Returns the previously persisted key pair of a user |
9,220 | private function deleteUserKey ( PKEncryptionEnabledUserInterface $ user , $ flush = false ) { $ key = $ this -> findKeyByUser ( $ user ) ; if ( $ key ) { $ this -> getEntityManager ( ) -> remove ( $ key ) ; if ( $ flush ) { $ this -> getEntityManager ( ) -> flush ( ) ; } } } | Deletes the key pair of a user |
9,221 | private function encryptPrivateKey ( PKIPrivateKey $ pkiKey ) { $ iv = $ this -> cryptographyProvider -> generateIV ( CryptographyProviderInterface :: PRIVATE_KEY_ENCRYPTION ) ; $ symmetricKey = $ this -> cryptographyProvider -> generateSecureKey ( ) ; $ keyData = new KeyData ( $ symmetricKey , $ iv ) ; $ userPrivateKe... | Encrypts the private key of the user using the app master public key |
9,222 | private function decryptPrivateKey ( PKIPrivateKey $ pkiKey ) { $ encryptedKey = base64_decode ( $ pkiKey -> getKey ( ) ) ; $ privateMasterKey = $ this -> getPrivateMasterKey ( ) ; $ symmetricKey = $ this -> cryptographyProvider -> decryptWithPrivateKey ( $ encryptedKey , $ privateMasterKey ) ; if ( $ symmetricKey ) { ... | Descrypts the private key of the user using the app master private key and returns it |
9,223 | public function getPublicMasterKey ( ) { if ( ! $ this -> publicMasterKey ) { $ masterKey = $ this -> getMasterKey ( ) ; $ publicKeyDetails = openssl_pkey_get_details ( $ masterKey ) ; $ this -> publicMasterKey = $ publicKeyDetails [ 'key' ] ; } return $ this -> publicMasterKey ; } | Returns the public master key |
9,224 | public function getPrivateMasterKey ( ) { if ( ! $ this -> privateMasterKey ) { $ masterKey = $ this -> getMasterKey ( ) ; openssl_pkey_export ( $ masterKey , $ this -> privateMasterKey ) ; } return $ this -> privateMasterKey ; } | Returns the private master key |
9,225 | private function getMasterKey ( ) { if ( ! $ this -> masterKey ) { $ certificatePath = 'file://' . $ this -> masterKeyData [ 'cert_file' ] ; $ passPhrase = $ this -> masterKeyData [ 'passphrase' ] ; $ this -> masterKey = openssl_pkey_get_private ( $ certificatePath , $ passPhrase ) ; if ( ! $ this -> masterKey ) { thro... | Returns the master key resource identifier |
9,226 | private function encryptSymmetricKeyWithUserKey ( $ clearKey , $ entity ) { $ users = $ this -> accessChecker -> getAllowedUsers ( $ entity ) ; $ symmetricKey = new SymmetricKey ( ) ; foreach ( $ users as $ user ) { $ publicKey = $ this -> getPublicKey ( $ user ) ; $ encryptedKey = base64_encode ( $ this -> cryptograph... | Encrypts the Symmetric Key of the entity using Per User Encryption |
9,227 | private function encryptSymmetricKeyWithSystemKey ( $ clearKey , $ entity ) { $ publicMasterKey = $ this -> keyStore -> getPublicMasterKey ( ) ; $ symmetricKey = new SymmetricKey ( ) ; $ encryptedKey = base64_encode ( $ this -> cryptographyProvider -> encryptWithPublicKey ( $ clearKey , $ publicMasterKey ) ) ; $ symmet... | Encrypts the Symmetric Key of the entity using System Encryption |
9,228 | private function decryptSymmetricKey ( $ entity ) { $ decryptedKey = null ; $ encryptionMode = $ this -> getEncryptionMode ( $ entity ) ; switch ( $ encryptionMode ) { case EncryptionService :: MODE_PER_USER_SHAREABLE : $ decryptedKey = $ this -> decryptSymmetricKeyWithUserKey ( $ entity ) ; break ; case EncryptionServ... | Decrypts the Symmetric Key used to encrypt the fields of the entity |
9,229 | private function decryptSymmetricKeyWithUserKey ( $ entity ) { $ encryptedKey = $ entity -> getKey ( ) ; $ decryptedKey = null ; $ user = $ this -> getUser ( ) ; if ( $ user instanceof PKEncryptionEnabledUserInterface && $ userKey = $ encryptedKey -> getKey ( $ user ) ) { $ userKey = base64_decode ( $ userKey ) ; $ pri... | Decrypts the Symmetric Key of the entity using Per User Encryption |
9,230 | private function decryptSymmetricKeyWithSystemKey ( $ entity ) { $ encryptedKey = $ entity -> getKey ( ) ; $ decryptedKey = null ; $ systemKey = $ encryptedKey -> getSystemKey ( ) ; $ privateKey = $ this -> keyStore -> getPrivateMasterKey ( ) ; if ( $ systemKey ) { $ systemKey = base64_decode ( $ systemKey ) ; $ decryp... | Decrypts the Symmetric Key of the entity using System Encryption |
9,231 | private function generatePKIKeys ( ) { $ config = array ( 'digest_alg' => $ this -> settings [ 'private_key' ] [ 'digest_method' ] , 'private_key_bits' => $ this -> settings [ 'private_key' ] [ 'bits' ] , 'private_key_type' => $ this -> settings [ 'private_key' ] [ 'type' ] , ) ; $ privateKey = null ; $ resource = open... | Generates a pki keys pair |
9,232 | private function encryptPrivateKey ( PKEncryptionEnabledUserInterface $ user ) { if ( ! $ user -> isPrivateKeyEncrypted ( ) ) { $ privateKey = $ user -> getPrivateKey ( ) ; $ passwordDigest = $ this -> getUserPasswordDigest ( $ user ) ; if ( $ passwordDigest ) { $ iv = $ this -> cryptographyProvider -> generateIV ( Cry... | Encrypts the Private key of the user using his password |
9,233 | private function getUserPasswordDigest ( PKEncryptionEnabledUserInterface $ user ) { $ passwordDigest = $ user -> getPasswordDigest ( ) ; if ( ! $ passwordDigest ) { $ password = $ user -> getPlainPassword ( ) ; if ( $ password ) { $ salt = $ user -> getSalt ( ) ; $ passwordDigest = $ this -> cryptographyProvider -> ge... | Returns the password digest of the password of the user |
9,234 | private function decryptPrivateKey ( PKEncryptionEnabledUserInterface $ user , array $ params = array ( ) ) { if ( isset ( $ params [ 'password_digest' ] ) ) { $ passwordDigest = base64_decode ( $ params [ 'password_digest' ] ) ; } else { if ( isset ( $ params [ 'password' ] ) ) { $ salt = $ user -> getSalt ( ) ; $ pas... | Encrypts the Private key of the user using his password or a digest of it |
9,235 | private function getEncryptionMode ( $ entity ) { $ className = ClassUtils :: getClass ( $ entity ) ; $ classMetadata = $ this -> metadataFactory -> getMetadataFor ( $ className ) ; return $ classMetadata -> encryptionMode ; } | Returns the encryption mode for the given entity |
9,236 | public function email ( $ field ) { return ( filter_var ( trim ( $ this -> get ( $ field ) ) , FILTER_VALIDATE_EMAIL ) !== false ) ? : $ this -> error ( $ field , __FUNCTION__ ) ; } | check to see if valid email address |
9,237 | public function ip ( $ field ) { return ( filter_var ( trim ( $ this -> get ( $ field ) ) , FILTER_VALIDATE_IP ) !== false ) ? : $ this -> error ( $ field , __FUNCTION__ ) ; } | Check is a valid IP . |
9,238 | public function url ( $ field ) { return ( filter_var ( trim ( $ this -> get ( $ field ) ) , FILTER_VALIDATE_URL ) !== false ) ? : $ this -> error ( $ field , __FUNCTION__ ) ; } | Check is a valid URL . |
9,239 | public function compare ( $ field1 , $ field2 , $ caseInsensitive = false ) { $ field1value = $ this -> get ( $ field1 ) ; $ field2value = $ this -> get ( $ field2 ) ; $ valid = ( strcmp ( $ field1value , $ field2value ) == 0 ) ; if ( $ caseInsensitive ) { $ valid = ( strcmp ( strtolower ( $ field1value ) , strtolower ... | Check to see if two fields are equal . |
9,240 | public function lengthBetween ( $ field , $ min , $ max , $ inclusive = false ) { $ fieldValue = strlen ( trim ( $ this -> get ( $ field ) ) ) ; $ valid = ( $ fieldValue <= $ max && $ fieldValue >= $ min ) ; if ( ! $ inclusive ) { $ valid = ( $ fieldValue < $ max && $ fieldValue > $ min ) ; } return ( $ valid === true ... | Check to see if the length of a field is between two numbers |
9,241 | public function punctuation ( $ field ) { return ( preg_match ( "/[^\w\s\p{P}]/" , '' . $ this -> get ( $ field ) ) > 0 ) ? $ this -> error ( $ field , __FUNCTION__ ) : true ; } | Check to see if there is punctuation |
9,242 | public function digit ( $ field ) { return ( ctype_digit ( ( string ) $ this -> get ( $ field ) ) === true ) ? : $ this -> error ( $ field , __FUNCTION__ ) ; } | Check if a field contains only decimal digit |
9,243 | public function alpha ( $ field ) { return ( ctype_alpha ( ( string ) $ this -> get ( $ field ) ) === true ) ? : $ this -> error ( $ field , __FUNCTION__ ) ; } | Check if a field contains only alphabetic characters |
9,244 | public function alphaNumeric ( $ field ) { return ( ctype_alnum ( ( string ) $ this -> get ( $ field ) ) === true ) ? : $ this -> error ( $ field , __FUNCTION__ ) ; } | Check if a field contains only alphanumeric characters |
9,245 | public function date ( $ field , $ format ) { $ fieldValue = $ this -> get ( $ field ) ; try { $ date = new \ DateTime ( $ fieldValue ) ; return $ fieldValue === $ date -> format ( $ format ) ; } catch ( \ Exception $ exception ) { return $ this -> error ( $ field , __FUNCTION__ ) ; } } | Check if field is a date by specified format . |
9,246 | public function bootstrap ( ) : Source { $ connection = $ this -> getDatabaseConnection ( ) ; $ config = $ this -> config -> get ( "database.connections.$connection" ) ; if ( array_get ( $ config , 'driver' ) !== 'mysql' ) { throw new InvalidArgumentException ( "Unsupported database driver [{$config['driver']}]." ) ; }... | Bootstrap the source . |
9,247 | public function phoneme ( string $ alphabet , string $ ph , string $ text ) : ContainerElement { return $ this -> addElement ( Phoneme :: factory ( $ alphabet , $ ph , $ text ) ) ; } | Adds a phoneme element . |
9,248 | public function getLoop ( ) { if ( ! $ this -> loop ) { $ this -> loop = \ React \ EventLoop \ Factory :: create ( ) ; } return $ this -> loop ; } | Returns the event loop dependency initializing it if needed . |
9,249 | public function getResolver ( ) { if ( $ this -> resolver instanceof Resolver ) { return $ this -> resolver ; } $ factory = new Factory ( ) ; $ this -> resolver = $ factory -> createCached ( $ this -> getDnsServer ( ) , $ this -> getLoop ( ) ) ; return $ this -> resolver ; } | Get the DNS Resolver if one isn t set in instance will be created . |
9,250 | protected function addActiveConnection ( ConnectionInterface $ connection ) { if ( ! $ this -> activeConnections ) { $ this -> activeConnections = new \ SplObjectStorage ; } $ this -> activeConnections -> attach ( $ connection ) ; } | Add a connection instance to the active connection store |
9,251 | protected function getSocket ( $ remote , array $ context ) { $ socket = stream_socket_client ( $ remote , $ errno , $ errstr , ini_get ( 'default_socket_timeout' ) , STREAM_CLIENT_CONNECT , stream_context_create ( $ context ) ) ; if ( ! $ socket ) { throw new Exception ( 'Unable to connect to remote ' . $ remote . ': ... | Returns a socket configured for a specified remote . |
9,252 | protected function getRemote ( ConnectionInterface $ connection ) { $ hostname = $ connection -> getServerHostname ( ) ; $ port = $ connection -> getServerPort ( ) ; $ deferred = new Deferred ( ) ; $ this -> resolveHostname ( $ hostname ) -> then ( function ( $ ip ) use ( $ deferred , $ port ) { $ deferred -> resolve (... | Derives a remote for a given connection . |
9,253 | protected function resolveHostname ( $ hostname ) { if ( false !== filter_var ( $ hostname , FILTER_VALIDATE_IP ) ) { return \ React \ Promise \ resolve ( $ hostname ) ; } return $ this -> getResolver ( ) -> resolve ( $ hostname ) ; } | Resolve an IP address from a hostname |
9,254 | protected function getContext ( ConnectionInterface $ connection ) { $ context = array ( ) ; if ( $ this -> getForceIpv4Flag ( $ connection ) ) { $ context [ 'bindto' ] = '0.0.0.0:0' ; } $ context = array ( 'socket' => $ context ) ; return $ context ; } | Derives a set of socket context options for a given connection . |
9,255 | protected function getSecureContext ( ConnectionInterface $ connection ) { $ context = array ( ) ; if ( $ this -> getForceIpv4Flag ( $ connection ) ) { $ context [ 'bindto' ] = '0.0.0.0:0' ; } if ( $ this -> getAllowSelfSignedFlag ( $ connection ) ) { $ context [ 'allow_self_signed' ] = true ; } return $ context ; } | Derives a set of socket context options for a given secure connection . |
9,256 | protected function getStream ( $ socket ) { if ( class_exists ( DuplexResourceStream :: class ) ) { return new DuplexResourceStream ( $ socket , $ this -> getLoop ( ) ) ; } return new Stream ( $ socket , $ this -> getLoop ( ) ) ; } | Returns a stream for a socket connection . |
9,257 | protected function getOutputLogCallback ( ConnectionInterface $ connection , $ level , $ prefix = null ) { $ logger = $ this -> getLogger ( ) ; if ( ! method_exists ( $ logger , $ level ) ) { throw new \ DomainException ( "Invalid log level '$level'" ) ; } return function ( $ message ) use ( $ connection , $ level , $ ... | Generates a closure for stream output logging . |
9,258 | protected function addLogging ( EventEmitter $ emitter , ConnectionInterface $ connection ) { $ emitter -> on ( 'data' , $ this -> getOutputLogCallback ( $ connection , 'debug' ) ) ; $ emitter -> on ( 'error' , $ this -> getOutputLogCallback ( $ connection , 'notice' ) ) ; } | Adds an event listener to log data emitted by a stream . |
9,259 | protected function getReadStream ( ConnectionInterface $ connection ) { $ read = new ReadStream ( ) ; $ this -> addLogging ( $ read , $ connection ) ; $ read -> on ( 'invalid' , $ this -> getOutputLogCallback ( $ connection , 'notice' , 'Parser unable to parse line: ' ) ) ; return $ read ; } | Returns a stream instance for parsing messages from the server and emitting them as events . |
9,260 | protected function getWriteStream ( ConnectionInterface $ connection ) { $ write = new WriteStream ( ) ; $ this -> addLogging ( $ write , $ connection ) ; return $ write ; } | Returns a stream instance for sending events to the server . |
9,261 | public function getLogger ( ) { if ( ! $ this -> logger ) { if ( ! defined ( 'STDERR' ) ) { define ( 'STDERR' , fopen ( 'php://stderr' , 'w' ) ) ; } $ handler = new StreamHandler ( STDERR , Logger :: DEBUG ) ; $ handler -> setFormatter ( new LineFormatter ( "%datetime% %level_name% %message% %context%\n" ) ) ; $ this -... | Returns a stream instance for logging data on the socket connection . |
9,262 | protected function getReadCallback ( WriteStream $ write , ConnectionInterface $ connection ) { $ logger = $ this -> getLogger ( ) ; return function ( $ message ) use ( $ write , $ connection , $ logger ) { $ this -> processInput ( $ message , $ write , $ connection ) ; $ this -> emit ( 'irc.received' , array ( $ messa... | Returns a callback for proxying IRC events from the read stream to IRC listeners of the client . |
9,263 | protected function getWriteCallback ( WriteStream $ write , ConnectionInterface $ connection ) { $ logger = $ this -> getLogger ( ) ; return function ( $ message ) use ( $ write , $ connection , $ logger ) { $ this -> emit ( 'irc.sent' , array ( $ message , $ write , $ connection , $ logger ) ) ; } ; } | Returns a callback for proxying events from the write stream to IRC listeners of the client . |
9,264 | protected function getErrorCallback ( ConnectionInterface $ connection ) { $ logger = $ this -> getLogger ( ) ; return function ( $ exception ) use ( $ connection , $ logger ) { $ this -> emit ( 'connect.error' , array ( $ exception , $ connection , $ logger ) ) ; } ; } | Returns a callback for proxying connection error events to listeners of the client . |
9,265 | protected function getEndCallback ( ReadStream $ read , WriteStream $ write , ConnectionInterface $ connection , TimerInterface $ timer ) { $ logger = $ this -> getLogger ( ) ; return function ( ) use ( $ read , $ write , $ connection , $ timer , $ logger ) { $ this -> removeActiveConnection ( $ connection ) ; $ this -... | Returns a callback for when a connection is terminated whether explicitly by the bot or server or as a result of loss of connectivity . |
9,266 | protected function getTickCallback ( WriteStream $ write , ConnectionInterface $ connection ) { $ logger = $ this -> getLogger ( ) ; return function ( ) use ( $ write , $ connection , $ logger ) { $ this -> emit ( 'irc.tick' , array ( $ write , $ connection , $ logger ) ) ; } ; } | Returns a callback executed periodically to allow events to be sent asynchronously versus in response to received or sent events . |
9,267 | protected function configureStreams ( ConnectionInterface $ connection , DuplexStreamInterface $ stream , WriteStream $ write ) { $ timer = $ this -> addPeriodicTimer ( $ this -> getTickInterval ( ) , $ this -> getTickCallback ( $ write , $ connection ) ) ; $ read = $ this -> getReadStream ( $ connection ) ; $ write ->... | Configure streams to handle messages received from and sent to the server . |
9,268 | protected function identifyUser ( ConnectionInterface $ connection , WriteStream $ writeStream ) { $ password = $ connection -> getPassword ( ) ; if ( $ password ) { $ writeStream -> ircPass ( $ password ) ; } $ writeStream -> ircUser ( $ connection -> getUsername ( ) , $ connection -> getHostname ( ) , $ connection ->... | Identifies the user to a server . |
9,269 | protected function emitConnectionError ( \ Exception $ exception , ConnectionInterface $ connection ) { $ this -> emit ( 'connect.error' , array ( $ exception -> getMessage ( ) , $ connection , $ this -> getLogger ( ) ) ) ; } | Emits a connection error event . |
9,270 | protected function addUnsecuredConnection ( ConnectionInterface $ connection ) { $ this -> getRemote ( $ connection ) -> then ( function ( $ remote ) use ( $ connection ) { $ this -> initializeConnection ( $ remote , $ connection ) ; } , function ( $ error ) use ( $ connection ) { $ this -> emitConnectionError ( $ erro... | Initializes an unsecured connection . |
9,271 | protected function getSecureConnector ( $ connection ) { if ( ! $ this -> secureConnector ) { $ loop = $ this -> getLoop ( ) ; $ connector = new \ React \ Socket \ Connector ( $ loop , [ 'dns' => $ this -> getResolver ( ) , ] ) ; $ this -> secureConnector = new \ React \ Socket \ SecureConnector ( $ connector , $ loop ... | Returns a connector for establishing SSL connections . |
9,272 | protected function addSecureConnection ( ConnectionInterface $ connection ) { $ hostname = $ connection -> getServerHostname ( ) ; $ port = $ connection -> getServerPort ( ) ; $ this -> getSecureConnector ( $ connection ) -> connect ( $ hostname . ':' . $ port ) -> then ( function ( DuplexStreamInterface $ stream ) use... | Initializes a secured connection . |
9,273 | protected function initializeStream ( DuplexStreamInterface $ stream , ConnectionInterface $ connection ) { try { $ connection -> setData ( 'stream' , $ stream ) ; $ write = $ this -> getWriteStream ( $ connection ) ; $ connection -> setData ( 'write' , $ write ) ; $ this -> configureStreams ( $ connection , $ stream ,... | Configures an established stream for a given connection . |
9,274 | protected function initializeConnection ( $ remote , $ connection ) { try { $ context = $ this -> getContext ( $ connection ) ; $ socket = $ this -> getSocket ( $ remote , $ context ) ; $ stream = $ this -> getStream ( $ socket ) ; $ this -> initializeStream ( $ stream , $ connection ) ; $ this -> addActiveConnection (... | Initializes an added connection . |
9,275 | public function addConnection ( ConnectionInterface $ connection ) { $ this -> emit ( 'connect.before.each' , array ( $ connection ) ) ; if ( $ this -> getTransport ( $ connection ) === 'ssl' ) { $ this -> addSecureConnection ( $ connection ) ; } else { $ this -> addUnsecuredConnection ( $ connection ) ; } } | Initializes an IRC connection . |
9,276 | public function run ( $ connections , $ autorun = true ) { if ( ! is_array ( $ connections ) ) { $ connections = array ( $ connections ) ; } $ this -> on ( 'connect.error' , function ( $ message , $ connection , $ logger ) { $ logger -> error ( $ message ) ; } ) ; $ this -> emit ( 'connect.before.all' , array ( $ conne... | Executes the event loop which continues running until no active connections remain . |
9,277 | public function success ( ? string $ message = null ) : Log { if ( ! is_null ( $ message ) ) { $ this -> message = $ message ; } $ this -> type = 'success' ; Alertify :: flash ( ) ; return $ this ; } | Sets a success message . |
9,278 | public function delay ( int $ time ) : Log { $ this -> delay = $ time ; Alertify :: flash ( ) ; return $ this ; } | Sets the delay of the alert . |
9,279 | public function position ( string $ position ) : Log { $ acceptablePositions = [ 'top right' , 'top left' , 'bottom right' , 'bottom left' ] ; if ( array_search ( strtolower ( $ position ) , $ acceptablePositions ) === false ) { $ acceptablePositions = implode ( ', ' , $ acceptablePositions ) ; throw new \ Exception ( ... | Sets the position of the alert . |
9,280 | public static function serialize ( $ object ) { $ masked = false ; if ( false === is_object ( $ object ) ) { $ object = self :: mask ( $ object ) ; $ masked = true ; } $ capsule = new \ stdClass ( ) ; $ capsule -> type = get_class ( $ object ) ; $ capsule -> object = $ object ; $ capsule -> fake = $ masked ; if ( $ obj... | Serialize things . |
9,281 | public static function unserialize ( $ object ) { $ capsule = self :: unserializeNative ( $ object ) ; if ( true === $ capsule -> fake ) { $ capsule -> object = self :: unmask ( $ capsule -> object ) ; } if ( $ capsule -> type == 'SimpleXMLElement' ) { $ capsule -> object = simplexml_load_string ( $ capsule -> object )... | Unserialize things . |
9,282 | public function init ( ServiceBlob $ blob ) { parent :: init ( $ blob ) ; $ this -> extension = $ blob -> metadata -> getExtension ( ) ; $ this -> mime = $ blob -> getMime ( ) ; $ this -> mimeType = $ blob -> metadata -> getMimeType ( ) ; $ this -> thumbs = $ blob -> getThumbsDetails ( ) ; } | Initialize File properties from service instance . |
9,283 | public static function Rest ( $ username , $ password , $ service ) { if ( is_string ( $ service ) ) { return static :: createRestClient ( $ username , $ password , $ service ) ; } elseif ( is_array ( $ service ) ) { $ services = array ( ) ; foreach ( $ service as $ serviceName ) { $ services [ ] = static :: createRest... | Create one or more REST service clients |
9,284 | protected static function createRestClient ( $ username , $ password , $ service ) { $ serviceClass = RestClient :: ns ( ) . "\\{$service}" ; $ client = new $ serviceClass ; $ client -> setUsername ( $ username ) ; $ client -> setPassword ( $ password ) ; return $ client ; } | Instantiate a REST service client |
9,285 | public static function Soap ( $ username , $ password , $ service , $ version = 'SOAP_1_2' , $ wsdl = 'http://callfire.com/api/1.1/wsdl/callfire-service-http-soap12.wsdl' ) { $ options = array ( 'soap_version' => $ version , 'login' => $ username , 'password' => $ password ) ; $ classmap = include __DIR__ . '/Soap/clas... | Create a SOAP client |
9,286 | public function getReference ( $ data , $ type ) { $ index = array_search ( $ data , $ this -> store [ $ type ] , true ) ; if ( $ index !== false ) { return $ index ; } if ( ! $ this -> validate ( $ data ) ) { return false ; } $ this -> addReference ( $ data , $ type ) ; return false ; } | Creates or retrieves an object reference from the store |
9,287 | public function getByReference ( $ reference , $ type ) { if ( ! isset ( $ this -> store [ $ type ] ) ) { return false ; } $ count = count ( $ this -> store [ $ type ] ) ; if ( $ reference >= $ count ) { throw new DeserializationException ( 'Invalid ' . $ type . ' reference: ' . $ reference ) ; } if ( ! $ count ) { ret... | Retrieves a value of a given type by reference |
9,288 | public function addReference ( & $ data , $ type ) { if ( ! $ this -> validate ( $ data ) ) { return false ; } $ this -> store [ $ type ] [ ] = & $ data ; return $ data ; } | Adds a new reference by type |
9,289 | private function validate ( $ data ) { if ( is_null ( $ data ) || ( is_string ( $ data ) && ! strlen ( $ data ) ) ) { return false ; } return true ; } | Validates a given value and type for issues and prepares array for possible reference addition |
9,290 | private function format ( $ message , $ severity ) { $ msg = date ( "m-d-Y" ) . " " . date ( "G:i:s" ) . " " . self :: $ remoteIp ; $ IPLength = strlen ( self :: $ remoteIp ) ; $ numWhitespaces = 15 - $ IPLength ; for ( $ i = 0 ; $ i < $ numWhitespaces ; $ i ++ ) { $ msg .= " " ; } $ msg .= " " . $ severity . ": " ; $ ... | Formats the error message in representable manner . |
9,291 | public function reflect ( $ model , $ value , $ property = 'id' ) { $ attribute = new \ ReflectionProperty ( $ model , $ property ) ; $ attribute -> setAccessible ( true ) ; $ attribute -> setValue ( $ model , $ value ) ; return $ model ; } | Makes a given model - property accessible . |
9,292 | public function sayAs ( string $ interpretAs , string $ content , string $ format = null ) : ContainerElement { return $ this -> addElement ( SayAs :: factory ( $ interpretAs , $ content , $ format ) ) ; } | Adds a new say - as element . |
9,293 | public static function getChoices ( ) { $ choices = array ( ) ; $ reflect = new \ ReflectionClass ( __CLASS__ ) ; $ constants = array_keys ( $ reflect -> getConstants ( ) ) ; foreach ( $ constants as $ constant ) { $ choices [ ] = $ reflect -> getConstant ( $ constant ) ; } return $ choices ; } | Return an array of the class constants |
9,294 | public function toDOM ( \ DOMDocument $ doc ) : \ DOMNode { $ paragraph = $ doc -> createElement ( 'p' ) ; $ this -> customAttributesToDOM ( $ paragraph ) ; $ this -> containerToDOM ( $ doc , $ paragraph ) ; return $ paragraph ; } | Adds the element to the given document . |
9,295 | protected function bulk ( $ head ) { if ( $ head == '$-1' ) { return null ; } list ( $ read , $ response , $ size ) = array ( 0 , '' , substr ( $ head , 1 ) ) ; if ( $ size > 0 ) { do { $ block = ( ( $ remaining = $ size - $ read ) < 1024 ) ? $ remaining : 1024 ; $ response .= fread ( $ this -> connection , $ block ) ;... | Parse and handle a bulk response from the Redis database . |
9,296 | protected function multibulk ( $ head ) { if ( ( $ count = substr ( $ head , 1 ) ) == '-1' ) { return null ; } $ response = array ( ) ; for ( $ i = 0 ; $ i < $ count ; $ i ++ ) { $ response [ ] = $ this -> parse ( trim ( fgets ( $ this -> connection , 512 ) ) ) ; } return $ response ; } | Parse and handle a multi - bulk reply from the Redis database . |
9,297 | public static function operation ( $ name , $ signatures , $ fn = null ) { if ( ! is_array ( $ signatures ) ) { $ signatures = [ $ signatures ] ; } foreach ( $ signatures as $ signature ) { self :: $ operations [ ] = _stream_operation ( $ name , $ signature , $ fn ) ; } } | Adds a new operation to the Stream class . |
9,298 | public static function removeOperations ( $ name ) { $ names = func_get_args ( ) ; self :: $ operations = filter ( function ( $ operation ) use ( $ names ) { return ! in_array ( get ( 'name' , $ operation ) , $ names ) ; } , self :: $ operations ) ; } | Removes one or many operation from the Stream class . |
9,299 | public function getParser ( ) { if ( ! $ this -> parser ) { $ this -> parser = new \ Phergie \ Irc \ Parser ( ) ; } return $ this -> parser ; } | Returns the IRC message parser in use . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.