idx
int64
0
60.3k
question
stringlengths
99
4.85k
target
stringlengths
5
718
44,900
public function _cleanClasses ( $ node ) { if ( $ node -> getAttribute ( 'class' ) !== '' ) { $ node -> removeAttribute ( 'class' ) ; } for ( $ node = $ node -> firstChild ; $ node !== null ; $ node = $ node -> nextSibling ) { $ this -> _cleanClasses ( $ node ) ; } }
Removes the class = attribute from every element in the given subtree .
44,901
public function toArray ( ) { $ out = [ ] ; foreach ( $ this as $ key => $ value ) { $ getter = sprintf ( 'get%s' , $ key ) ; if ( ! is_object ( $ value ) && method_exists ( $ this , $ getter ) ) { $ out [ $ key ] = call_user_func ( [ $ this , $ getter ] ) ; } } return $ out ; }
Returns an array - representation of configuration .
44,902
public static function nextElement ( $ node ) { $ next = $ node ; while ( $ next && $ next -> nodeType !== XML_ELEMENT_NODE && $ next -> isWhitespace ( ) ) { $ next = $ next -> nextSibling ; } return $ next ; }
Imported from the Element class on league \ html - to - markdown .
44,903
public static function setNodeTag ( $ node , $ value , $ importAttributes = true ) { $ new = new DOMDocument ( '1.0' , 'utf-8' ) ; $ new -> appendChild ( $ new -> createElement ( $ value ) ) ; $ children = $ node -> childNodes ; for ( $ i = 0 ; $ i < $ children -> length ; $ i ++ ) { $ import = $ new -> importNode ( $ ...
Changes the node tag name . Since tagName on DOMElement is a read only value this must be done creating a new element with the new tag name and importing it to the main DOMDocument .
44,904
private function generatePatterns ( ) { foreach ( $ this -> builders as $ uri => $ builder ) { $ pattern = '/' . ltrim ( $ uri , '/' ) ; if ( preg_match_all ( '/{[\w]+}/i' , $ uri , $ matches ) ) { foreach ( array_unique ( $ matches [ 0 ] ) as $ match ) { $ pattern = str_replace ( $ match , '[\w\d\@_~\-\.]+' , $ patter...
Generate regex patterns for URI templates .
44,905
public function create ( $ uri , $ content ) { $ uri = '/' . trim ( $ uri , '/' ) ; foreach ( $ this -> patterns as $ pattern => $ key ) { if ( preg_match ( $ pattern , $ uri ) ) { return call_user_func ( $ this -> builders [ $ key ] , ( array ) $ content ) ; } } throw new RuntimeException ( sprintf ( 'Cannot create re...
Create resource object by URI template and resource data .
44,906
public static function config ( $ configName , $ config = null ) { $ _this = Purifier :: getInstance ( ) ; if ( empty ( $ config ) ) { if ( ! isset ( $ _this -> _configs [ $ configName ] ) ) { throw new \ InvalidArgumentException ( sprintf ( 'Purifier configuration `%s` does not exist!' , $ configName ) ) ; } return $ ...
Gets and sets purifier configuration sets .
44,907
public static function getPurifierInstance ( $ configName = 'default' ) { $ _this = Purifier :: getInstance ( ) ; if ( ! isset ( $ _this -> _instances [ $ configName ] ) ) { if ( ! isset ( $ _this -> _configs [ $ configName ] ) ) { throw new \ InvalidArgumentException ( sprintf ( 'Configuration and instance `%s` does n...
Gets an instance of the purifier lib only when needed lazy loading it
44,908
public static function clean ( $ markup , $ configName = 'default' ) { $ _this = Purifier :: getInstance ( ) ; if ( ! isset ( $ _this -> _configs [ $ configName ] ) ) { throw new \ InvalidArgumentException ( sprintf ( 'Invalid HtmlPurifier configuration "%s"!' , $ configName ) ) ; } return $ _this -> getPurifierInstanc...
Cleans Markup using a given config
44,909
protected function execute ( array $ options = [ ] ) { $ session = $ this -> createSession ( ) ; $ result = [ ] ; try { if ( $ session -> open ( ) === false ) { throw new RuntimeException ( 'Cannot initialize a cURL session' ) ; } $ session -> setOptions ( $ options + $ this -> options ) ; $ result = $ session -> execu...
Execute cURL session .
44,910
protected function _getTable ( ) { $ table = TableRegistry :: get ( $ this -> args [ 0 ] ) ; $ connection = $ table -> connection ( ) ; $ tables = $ connection -> schemaCollection ( ) -> listTables ( ) ; if ( ! in_array ( $ table -> table ( ) , $ tables ) ) { $ this -> abort ( __d ( 'Burzum/HtmlPurifier' , 'Table `{0}`...
Gets the table from the shell args .
44,911
protected function _loadBehavior ( Table $ table , $ fields ) { if ( ! in_array ( 'HtmlPurifier' , $ table -> behaviors ( ) -> loaded ( ) ) ) { $ table -> addBehavior ( 'Burzum/HtmlPurifier.HtmlPurifier' , [ 'fields' => $ fields , 'purifierConfig' => $ this -> param ( 'config' ) ] ) ; } }
Loads the purifier behavior for the given table if not already attached .
44,912
public function purify ( ) { $ table = $ this -> _getTable ( ) ; $ fields = $ this -> _getFields ( $ table ) ; $ this -> _loadBehavior ( $ table , $ fields ) ; $ query = $ table -> find ( ) ; if ( $ table -> hasFinder ( 'purifier' ) ) { $ query -> find ( 'purifier' ) ; } $ total = $ query -> all ( ) -> count ( ) ; $ th...
Purifies data base content .
44,913
protected function _process ( Table $ table , $ chunkCount , $ chunkSize , $ fields ) { $ query = $ table -> find ( ) ; if ( $ table -> hasFinder ( 'purifier' ) ) { $ query -> find ( 'purifier' ) ; } $ fields [ ] = $ table -> primaryKey ( ) ; $ results = $ query -> select ( $ fields ) -> offset ( $ chunkCount ) -> limi...
Processes the records .
44,914
protected function allowedTypes ( ) { return [ self :: TYPE_DEFAULT_MESSAGE , self :: TYPE_REGISTRATION_MESSAGE , self :: TYPE_RESET_PASSWORD_MESSAGE , self :: TYPE_LOGIN_MESSAGE , self :: TYPE_NOTIFICATION_MESSAGE , ] ; }
Allowed message types
44,915
public function send ( $ numbers , $ message , $ type = self :: TYPE_DEFAULT_MESSAGE ) { if ( ! in_array ( $ type , $ this -> allowedTypes ( ) ) ) { throw new NotSupportedException ( "Message type \"$type\" doesn't support." ) ; } if ( empty ( $ numbers ) || ( is_array ( $ numbers ) && count ( $ numbers ) === 0 ) || em...
Send sms message
44,916
public function getStatus ( $ id , $ phone , $ all = 2 ) { if ( empty ( $ id ) || empty ( $ phone ) ) { throw new \ InvalidArgumentException ( 'For getting sms status, please, set id and phone' ) ; } $ data = $ this -> _client -> getMessageStatus ( $ id , $ phone , $ all ) ; if ( $ this -> _logger instanceof LoggerInte...
Get sms status by id and phone
44,917
public function createRequest ( $ method , $ uri , $ payload , array $ headers = [ ] ) { return new GuzzleRequest ( $ method , $ uri , $ headers , $ payload ) ; }
Factory method to create a new Request object .
44,918
public function createUri ( $ uri , array $ params = [ ] ) { if ( $ uri instanceof GuzzleUri ) { if ( ! empty ( $ params ) ) { $ uri = $ uri -> withQuery ( http_build_query ( $ params ) ) ; } return $ uri ; } if ( preg_match_all ( '/{[\w]+}/i' , $ uri , $ matches ) ) { foreach ( array_unique ( $ matches [ 0 ] ) as $ ma...
Factory method to create a new Uri object .
44,919
public static function generateSignature ( $ apiUser , $ apiKey ) { $ serverTimezone = date_default_timezone_get ( ) ; date_default_timezone_set ( 'UTC' ) ; $ nonce = self :: generateNonce ( self :: NONCE_LENGTH ) ; $ time = time ( ) ; $ signature = hash_hmac ( 'sha1' , $ apiUser . $ nonce . $ time , $ apiKey ) ; $ dat...
This method returns an array with the header name and header values for the nonce timestamp and signature .
44,920
public static function ini ( $ profile = null , $ filename = null ) { $ filename = $ filename ? : ( self :: getHomeDir ( ) . self :: INI_DEFAULT_FILE ) ; $ profile = $ profile ? : self :: INI_PROFILE ; return function ( ) use ( $ profile , $ filename ) { if ( ! is_readable ( $ filename ) ) { throw new RuntimeException ...
APIKEY provider that read APIKEY in an ini file stored in the current user s home directory .
44,921
private static function getHomeDir ( ) { if ( $ homeDir = getenv ( 'HOME' ) ) { return $ homeDir ; } if ( ( $ homeDrive = getenv ( 'HOMEDRIVE' ) ) && ( $ homePath = getenv ( 'HOMEPATH' ) ) ) { return $ homeDrive . $ homePath ; } throw new BadMethodCallException ( 'Cannot establish the home directory' ) ; }
Gets the environment s HOME directory if available .
44,922
public function init ( ) { $ git_repo = exec ( 'basename `git rev-parse --show-toplevel`' ) ; $ readme_contents = file_get_contents ( 'README.md' ) ; $ start_string = '### Initial build (new repo)' ; $ end_string = '### Initial build (existing repo)' ; $ from = $ this -> findAllTextBetween ( $ start_string , $ end_stri...
Initialize the project for the first time .
44,923
function setUpBehat ( ) { if ( ! $ this -> taskExec ( 'which chromedriver' ) -> run ( ) -> wasSuccessful ( ) ) { $ os = exec ( 'uname' ) ; if ( $ os == 'Darwin' ) { $ this -> taskExec ( 'brew install chromedriver' ) -> run ( ) ; } else { $ version = exec ( 'curl http://chromedriver.storage.googleapis.com/LATEST_RELEASE...
Ensure that the filesystem has everything Behat needs . At present that s only chromedriver AKA Headless Chrome .
44,924
function pantheonInstall ( ) { $ admin_name = $ this -> projectProperties [ 'admin_name' ] ; $ install_cmd = 'site-install ' . $ this -> projectProperties [ 'install_profile' ] . ' --account-name=' . $ admin_name . ' -y' ; $ terminus_site_env = $ this -> getPantheonSiteEnv ( ) ; $ install_cmd = "terminus remote:drush $...
Install site on Pantheon .
44,925
protected function replaceArraySetting ( $ file , $ key , $ value ) { $ this -> taskReplaceInFile ( $ file ) -> regex ( "/'$key' => '[^'\\\\]*(?:\\\\.[^'\\\\]*)*',/s" ) -> to ( "'$key' => '" . $ value . "'," ) -> run ( ) ; }
Use regex to replace a key = > value pair in a file like a settings file .
44,926
private function findAllTextBetween ( $ beginning , $ end , $ string ) { $ beginningPos = strpos ( $ string , $ beginning ) ; $ endPos = strpos ( $ string , $ end ) ; if ( $ beginningPos === false || $ endPos === false ) { return '' ; } $ textToDelete = substr ( $ string , $ beginningPos , ( $ endPos + strlen ( $ end )...
Finds the text between two strings within a third string .
44,927
public function postDeploy ( ) { $ terminus_site_env = $ this -> getPantheonSiteEnv ( ) ; $ pantheon_prefix = getenv ( 'TERMINUS_SITE' ) ; if ( $ terminus_site_env == $ pantheon_prefix . '.develop' || $ terminus_site_env == $ pantheon_prefix . '.dev' ) { $ drush_commands = [ 'drush_partial_config_import' => "terminus r...
Clean up state of Pantheon dev & develop environments after deploying .
44,928
public function pullConfig ( ) { $ project_properties = $ this -> getProjectProperties ( ) ; $ terminus_site_env = $ this -> getPantheonSiteEnv ( $ this -> databaseSourceOfTruth ( ) ) ; $ grab_database = $ this -> confirm ( "To pull the latest config, you should create a new backup on Pantheon. Create backup now?" ) ; ...
Pull the config from the live site down to your local .
44,929
public function prepareLocal ( ) { $ do_composer_install = TRUE ; $ project_properties = $ this -> getProjectProperties ( ) ; $ grab_database = $ this -> confirm ( "Load a database backup?" ) ; if ( $ grab_database == 'y' ) { $ do_composer_install = $ this -> getDatabaseOfTruth ( ) ; } if ( $ do_composer_install ) { $ ...
Prepare your local machine for development .
44,930
public function postInstall ( ) { $ this -> say ( "The post:install command should be customized per project. Copy the postInstall() method from the `/vendor/robo-drupal/src/Tasks.php` folder into your RoboFile.php file and alter it to suit your needs." ) ; return TRUE ; $ terminus_site_env = $ this -> getPantheonSiteE...
Prepare a freshly - installed site with some dummy data for site editors .
44,931
private function getDatabaseOfTruth ( ) { $ project_properties = $ this -> getProjectProperties ( ) ; $ default_database = $ this -> databaseSourceOfTruth ( ) ; if ( file_exists ( 'vendor/database.sql.gz' ) ) { $ default_database = 'local' ; } $ this -> say ( 'This command will drop all tables in your local database an...
Helper function to pull the database of truth to your local machine .
44,932
private function downloadPantheonBackup ( $ env ) { $ project_properties = $ this -> getProjectProperties ( ) ; $ terminus_site_env = $ this -> getPantheonSiteEnv ( $ env ) ; $ terminus_url_request = $ this -> taskExec ( 'terminus backup:get ' . $ terminus_site_env . ' --element="db"' ) -> dir ( $ project_properties [ ...
Grabs a backup from Pantheon .
44,933
public function importLocal ( ) { $ project_properties = $ this -> getProjectProperties ( ) ; $ drush_commands = [ 'drush_import_database' => 'zcat < ../vendor/database.sql.gz | drush @self sqlc # Importing local copy of db.' ] ; $ database_import = $ this -> taskExec ( implode ( ' && ' , $ drush_commands ) ) -> dir ( ...
Imports a local database .
44,934
public function migrateCleanup ( $ opts = [ 'migrations' => '' ] ) { if ( $ opts [ 'migrations' ] && ( $ this -> migrationSourceFolder ( ) || $ this -> usesMigrationPlugins ) ) { $ migrations = explode ( ',' , $ opts [ 'migrations' ] ) ; $ project_properties = $ this -> getProjectProperties ( ) ; foreach ( $ migrations...
Cleanup migrations .
44,935
public static function update ( $ force = false ) { if ( ! defined ( 'SEMALT_UNIT_TESTING' ) && ! self :: isWritable ( ) ) { return ; } if ( ! $ force && ! self :: isOutdated ( ) ) { return ; } self :: doUpdate ( ) ; }
Try to update the blocked domains list .
44,936
public static function getRootDomain ( $ url ) { $ host = $ domain = self :: getHostname ( $ url ) ; $ root = false ; if ( ( $ dotsCount = substr_count ( $ host , '.' ) ) > 0 ) { $ last = $ domain ; while ( $ dotsCount > - 1 ) { if ( self :: isHostInSuffixList ( $ domain ) ) { $ root = $ last ; break ; } $ last = trim ...
Extracts lower - case ASCII root domain from URL if it is available and valid returns false otherwise .
44,937
private static function parseUrl ( $ url , $ component ) { if ( ! isset ( self :: $ cache [ $ url ] [ 'url' ] ) ) { $ scheme = parse_url ( $ url , PHP_URL_SCHEME ) ; $ url = str_replace ( $ scheme . '://' , '' , $ url ) ; $ url = str_replace ( $ scheme . ':' , '' , $ url ) ; $ host = parse_url ( 'http://' . $ url , PHP...
Checks an URL for validity and punycode encode the returned component .
44,938
public function keysgroup ( array $ keysgroup ) : self { $ this -> transaction -> asset [ 'multisignature' ] [ 'keysgroup' ] = $ keysgroup ; $ this -> transaction -> fee = ( count ( $ keysgroup ) + 1 ) * $ this -> transaction -> fee ; return $ this ; }
Set the keysgroup of signatures .
44,939
public function serialize ( ) : void { $ delegateBytes = bin2hex ( $ this -> transaction [ 'asset' ] [ 'delegate' ] [ 'username' ] ) ; $ this -> buffer -> writeUInt8 ( strlen ( $ delegateBytes ) / 2 ) ; $ this -> buffer -> writeHexBytes ( $ delegateBytes ) ; }
Handle the serialization of vote data .
44,940
public function deserialize ( ) : object { $ this -> buffer -> position ( $ this -> assetOffset / 2 ) ; $ voteLength = $ this -> buffer -> readUInt8 ( ) & 0xff ; $ this -> transaction -> asset = [ 'votes' => [ ] ] ; $ vote = null ; for ( $ i = 0 ; $ i < $ voteLength ; $ i ++ ) { $ this -> buffer -> position ( $ this ->...
Handle the deserialization of second signature registration data .
44,941
public function deserialize ( ) : object { $ this -> buffer -> position ( $ this -> assetOffset / 2 ) ; $ this -> transaction -> asset = [ 'payments' => [ ] ] ; $ count = $ this -> buffer -> readUInt16 ( ) & 0xff ; $ offset = $ this -> assetOffset / 2 + 1 ; for ( $ i = 0 ; $ i < $ count ; $ i ++ ) { $ this -> transacti...
Handle the deserialization of multi payment data .
44,942
public function deserialize ( ) : Transaction { $ transaction = new Transaction ( ) ; $ transaction -> version = $ this -> buffer -> readUInt8 ( ) ; $ transaction -> network = $ this -> buffer -> readUInt8 ( ) ; $ transaction -> type = $ this -> buffer -> readUInt8 ( ) ; $ transaction -> timestamp = $ this -> buffer ->...
Perform AIP11 compliant deserialization .
44,943
public function handleType ( int $ assetOffset , Transaction $ transaction ) : Transaction { $ deserializer = $ this -> deserializers [ $ transaction -> type ] ; return ( new $ deserializer ( $ this -> buffer , $ assetOffset , $ transaction ) ) -> deserialize ( ) ; }
Handle the deserialization of transaction data .
44,944
public function handleVersionOne ( Transaction $ transaction ) : Transaction { if ( isset ( $ transaction -> secondSignature ) ) { $ transaction -> signSignature = $ transaction -> secondSignature ; } if ( Types :: VOTE === $ transaction -> type ) { $ transaction -> recipientId = Address :: fromPublicKey ( $ transactio...
Handle the deserialization of transaction data with a version of 1 . 0 .
44,945
public function handleVersionTwo ( Transaction $ transaction ) : Transaction { $ transaction -> id = Hash :: sha256 ( $ transaction -> serialize ( ) ) -> getHex ( ) ; return $ transaction ; }
Handle the deserialization of transaction data with a version of 2 . 0 .
44,946
public function serialize ( ) : void { $ dag = $ this -> transaction [ 'asset' ] [ 'ipfs' ] [ 'dag' ] ; $ this -> buffer -> writeUInt8 ( strlen ( $ dag ) / 2 ) ; $ this -> buffer -> writeHexBytes ( $ dag ) ; }
Handle the serialization of ipfs data .
44,947
public function deserialize ( ) : object { $ this -> buffer -> position ( $ this -> assetOffset / 2 ) ; $ this -> transaction -> amount = $ this -> buffer -> readUInt64 ( ) ; $ this -> transaction -> expiration = $ this -> buffer -> readUInt32 ( ) ; $ this -> transaction -> recipientId = Base58 :: encodeCheck ( new Buf...
Handle the deserialization of transfer data .
44,948
public static function fromPassphrase ( string $ passphrase , AbstractNetwork $ network = null ) : string { return static :: fromPrivateKey ( PrivateKey :: fromPassphrase ( $ passphrase ) , $ network ) ; }
Derive the address from the given passphrase .
44,949
public static function fromPublicKey ( string $ publicKey , $ network = null ) : string { $ network = $ network ?? NetworkConfiguration :: get ( ) ; $ ripemd160 = Hash :: ripemd160 ( PublicKey :: fromHex ( $ publicKey ) -> getBuffer ( ) ) ; $ seed = Writer :: bit8 ( Helpers :: version ( $ network ) ) . $ ripemd160 -> g...
Derive the address from the given public key .
44,950
public static function fromPrivateKey ( EccPrivateKey $ privateKey , AbstractNetwork $ network = null ) : string { $ digest = Hash :: ripemd160 ( $ privateKey -> getPublicKey ( ) -> getBuffer ( ) ) ; return ( new PayToPubKeyHashAddress ( $ digest ) ) -> getAddress ( $ network ) ; }
Derive the address from the given private key .
44,951
public static function validate ( string $ address , $ network = null ) : bool { try { $ addressCreator = new AddressCreator ( ) ; $ addressCreator -> fromString ( $ address , $ network ) ; return true ; } catch ( \ Exception $ e ) { return false ; } }
Validate the given address .
44,952
public function deserialize ( ) : object { $ this -> buffer -> position ( $ this -> assetOffset / 2 ) ; $ usernameLength = $ this -> buffer -> readUInt8 ( ) ; $ this -> transaction -> asset = [ 'delegate' => [ 'username' => $ this -> buffer -> position ( $ this -> assetOffset + 2 ) -> readHexBytes ( $ usernameLength * ...
Handle the deserialization of vote data .
44,953
public function serialize ( ) : void { $ voteBytes = [ ] ; foreach ( $ this -> transaction [ 'asset' ] [ 'votes' ] as $ vote ) { $ voteBytes [ ] = '+' === substr ( $ vote , 0 , 1 ) ? '01' . substr ( $ vote , 1 ) : '00' . substr ( $ vote , 1 ) ; } $ this -> buffer -> writeUInt8 ( count ( $ this -> transaction [ 'asset' ...
Handle the serialization of second signature registration data .
44,954
public static function fromPassphrase ( string $ passphrase , AbstractNetwork $ network = null ) : string { return PrivateKey :: fromPassphrase ( $ passphrase ) -> toWif ( $ network ) ; }
Derive the WIF from the given passphrase .
44,955
public function serialize ( ) : void { $ this -> buffer -> writeUInt64 ( $ this -> transaction [ 'amount' ] ) ; $ this -> buffer -> writeUInt32 ( $ this -> transaction [ 'expiration' ] ?? 0 ) ; $ this -> buffer -> writeHex ( Base58 :: decodeCheck ( $ this -> transaction [ 'recipientId' ] ) -> getHex ( ) ) ; }
Handle the serialization of transfer data .
44,956
public function serialize ( ) : void { $ this -> buffer -> writeUInt16 ( count ( $ this -> transaction [ 'asset' ] [ 'payments' ] ) ) ; foreach ( $ this -> transaction [ 'asset' ] [ 'payments' ] as $ payment ) { $ this -> buffer -> writeUInt64 ( $ payment [ 'amount' ] ) ; $ this -> buffer -> writeHex ( Base58 :: decode...
Handle the serialization of multi payment data .
44,957
protected function parseSignatures ( int $ startOffset ) : object { return $ this -> transaction -> parseSignatures ( $ this -> buffer -> toHex ( ) , $ startOffset ) ; }
Parse the signatures of the given transaction .
44,958
public function add ( string $ recipientId , int $ amount ) : self { $ this -> transaction -> asset [ 'payments' ] [ ] = compact ( 'recipientId' , 'amount' ) ; return $ this ; }
Add a new payment to the collection .
44,959
public function serialize ( ) : void { $ keysgroup = [ ] ; if ( ! isset ( $ this -> transaction [ 'version' ] ) || 1 === $ this -> transaction [ 'version' ] ) { foreach ( $ this -> transaction [ 'asset' ] [ 'multisignature' ] [ 'keysgroup' ] as $ key ) { $ keysgroup [ ] = '+' === substr ( $ key , 0 , 1 ) ? substr ( $ k...
Handle the serialization of multi signature registration data .
44,960
public function signature ( string $ secondPassphrase ) : self { $ this -> transaction -> asset = [ 'signature' => [ 'publicKey' => PublicKey :: fromPassphrase ( $ secondPassphrase ) -> getHex ( ) , ] , ] ; return $ this ; }
Set the signature asset to register the second passphrase .
44,961
public function deserialize ( ) : object { $ this -> buffer -> position ( $ this -> assetOffset ) ; $ this -> transaction -> asset = [ 'signature' => [ 'publicKey' => $ this -> buffer -> readHexRaw ( 66 ) , ] , ] ; return $ this -> parseSignatures ( $ this -> assetOffset + 66 ) ; }
Handle the deserialization of delegate registration data .
44,962
public function deserialize ( ) : object { $ this -> buffer -> position ( $ this -> assetOffset / 2 ) ; $ this -> transaction -> asset = [ 'multisignature' => [ 'min' => $ this -> buffer -> readUInt8 ( ) & 0xff , 'lifetime' => $ this -> buffer -> skip ( 1 ) -> readUInt8 ( ) & 0xff , ] , ] ; $ count = $ this -> buffer -...
Handle the deserialization of multi signature registration data .
44,963
public function verify ( ) : bool { $ factory = new PublicKeyFactory ; $ publicKey = $ factory -> fromHex ( $ this -> senderPublicKey ) ; return $ publicKey -> verify ( Hash :: sha256 ( $ this -> toBytes ( ) ) , SignatureFactory :: fromHex ( $ this -> signature ) ) ; }
Verify the transaction .
44,964
public function secondVerify ( string $ secondPublicKey ) : bool { $ factory = new PublicKeyFactory ; $ secondPublicKey = $ factory -> fromHex ( $ secondPublicKey ) ; return $ secondPublicKey -> verify ( Hash :: sha256 ( $ this -> toBytes ( false ) ) , SignatureFactory :: fromHex ( $ this -> signSignature ) ) ; }
Verify the transaction with a second public key .
44,965
public function parseSignatures ( string $ serialized , int $ startOffset ) : self { $ this -> signature = substr ( $ serialized , $ startOffset ) ; $ multiSignatureOffset = 0 ; if ( 0 === strlen ( $ this -> signature ) ) { unset ( $ this -> signature ) ; } else { $ signatureLength = intval ( substr ( $ this -> signatu...
Parse the signature second signature and multi signatures .
44,966
public function toBytes ( bool $ skipSignature = true , bool $ skipSecondSignature = true ) : Buffer { $ buffer = new Writer ( ) ; $ buffer -> writeUInt8 ( $ this -> type ) ; $ buffer -> writeUInt32 ( $ this -> timestamp ) ; $ buffer -> writeHex ( $ this -> senderPublicKey ) ; $ skipRecipientId = $ this -> type === Typ...
Convert the transaction to its byte representation .
44,967
public function toArray ( ) : array { return array_filter ( [ 'amount' => $ this -> amount , 'asset' => $ this -> asset ?? null , 'fee' => $ this -> fee , 'id' => $ this -> id , 'network' => $ this -> network ?? Network :: get ( ) -> version ( ) , 'recipientId' => $ this -> recipientId ?? null , 'secondSignature' => $ ...
Convert the transaction to its array representation .
44,968
public function serialize ( ) : Buffer { $ buffer = new Writer ( ) ; $ buffer -> writeUInt8 ( 0xff ) ; $ buffer -> writeUInt8 ( $ this -> transaction [ 'version' ] ?? 0x01 ) ; $ buffer -> writeUInt8 ( $ this -> transaction [ 'network' ] ?? Network :: version ( ) ) ; $ buffer -> writeUInt8 ( $ this -> transaction [ 'typ...
Perform AIP11 compliant serialization .
44,969
public static function fromPassphrase ( string $ passphrase ) : EcPrivateKey { $ passphrase = Hash :: sha256 ( new Buffer ( $ passphrase ) ) ; return ( new PrivateKeyFactory ( ) ) -> fromHexCompressed ( $ passphrase -> getHex ( ) ) ; }
Derive the private key for the given passphrase .
44,970
public static function fromWif ( string $ wif , AbstractNetwork $ network = null ) : EcPrivateKey { return ( new PrivateKeyFactory ( ) ) -> fromWif ( $ wif , $ network ) ; }
Derive the private key for the given WIF .
44,971
public static function sign ( string $ message , string $ passphrase ) : self { $ keys = PrivateKey :: fromPassphrase ( $ passphrase ) ; return static :: new ( [ 'publickey' => $ keys -> getPublicKey ( ) -> getHex ( ) , 'signature' => $ keys -> sign ( Hash :: sha256 ( new Buffer ( $ message ) ) ) -> getBuffer ( ) -> ge...
Sign a message using the given passphrase .
44,972
public function verify ( ) : bool { $ factory = new PublicKeyFactory ; return $ factory -> fromHex ( $ this -> publicKey ) -> verify ( new Buffer ( hash ( 'sha256' , $ this -> message , true ) ) , SignatureFactory :: fromHex ( $ this -> signature ) ) ; }
Verify the message contents .
44,973
protected function getSearchQuery ( $ keywords , $ classes ) { $ query = new SearchQuery ( ) ; $ query -> classes = $ classes ; $ query -> addSearchTerm ( $ keywords ) ; $ query -> addExclude ( SiteTree :: class . '_ShowInSearch' , 0 ) ; $ query -> setLimit ( 100 ) ; $ this -> extend ( 'updateSearchQuery' , $ query ) ;...
Build a SearchQuery for a new search
44,974
protected function getSearchOptions ( $ spellcheck ) { $ options = $ this -> config ( ) -> get ( 'search_options' ) ; if ( $ spellcheck ) { $ options = array_merge ( $ options , $ this -> config ( ) -> get ( 'spellcheck_options' ) ) ; } return $ options ; }
Get solr search options for this query
44,975
protected function getResult ( $ keywords , $ classes , $ searchIndex , $ limit = - 1 , $ start = 0 , $ spellcheck = false ) { $ query = $ this -> getSearchQuery ( $ keywords , $ classes ) ; $ options = $ this -> getSearchOptions ( $ spellcheck ) ; $ solrResult = $ searchIndex -> search ( $ query , $ start , $ limit , ...
Get results for a search term
44,976
public function search ( $ keywords , $ classes , $ searchIndex , $ limit = - 1 , $ start = 0 , $ followSuggestions = false ) { if ( empty ( $ keywords ) ) { return null ; } try { $ result = $ this -> getResult ( $ keywords , $ classes , $ searchIndex , $ limit , $ start , true ) ; if ( ! $ followSuggestions || $ resul...
Get a CwpSearchResult for a given criterea
44,977
protected function unwrapEnvelope ( array $ body ) { if ( isset ( $ body [ 'data' ] ) ) { return $ body [ 'data' ] ; } else if ( isset ( $ body [ 'items' ] ) ) { $ items = array ( ) ; foreach ( $ body [ 'items' ] as $ item ) { $ items [ ] = $ item ; } return $ items ; } return $ body ; }
Perform envelope unwrapping
44,978
protected function encodePayload ( array $ params ) { $ encoded = [ ] ; foreach ( $ params as $ key => $ value ) { if ( is_array ( $ value ) ) $ encoded [ $ key ] = $ this -> encodePayload ( $ value ) ; else if ( $ value instanceof \ DateTime ) $ encoded [ $ key ] = $ value -> format ( \ DateTime :: ISO8601 ) ; else $ ...
Ensure consistency in encoding between native PHP types and Base API expected types .
44,979
protected function encodeQueryParams ( array $ params ) { $ encoded = [ ] ; foreach ( $ params as $ key => $ value ) { if ( is_array ( $ value ) ) $ encoded [ $ key ] = $ this -> encodeQueryParams ( $ value ) ; else if ( is_bool ( $ value ) ) $ encoded [ $ key ] = $ value ? 'true' : 'false' ; else if ( $ value instance...
Ensure consistency in encoding between native PHP types and Base API expected query type format .
44,980
public function all ( $ params = [ ] , array $ options = array ( ) ) { list ( $ code , $ tasks ) = $ this -> httpClient -> get ( "/tasks" , $ params , $ options ) ; return $ tasks ; }
Retrieve all tasks
44,981
public function create ( array $ task , array $ options = array ( ) ) { $ attributes = array_intersect_key ( $ task , array_flip ( self :: $ keysToPersist ) ) ; list ( $ code , $ createdTask ) = $ this -> httpClient -> post ( "/tasks" , $ attributes , $ options ) ; return $ createdTask ; }
Create a task
44,982
protected function getLink ( $ terms , $ format = null ) { if ( ! $ terms ) { return null ; } $ link = 'search/SearchForm?Search=' . rawurlencode ( $ terms ) ; if ( $ format ) { $ link .= '&format=' . rawurlencode ( $ format ) ; } return $ link ; }
Get a search link for given terms
44,983
public function setting ( $ setting , $ default = null ) { $ value = parent :: setting ( $ setting ) ; if ( null === $ value ) { $ value = isset ( static :: $ globalSettings [ $ setting ] ) ? static :: $ globalSettings [ $ setting ] : $ default ; } return $ value ; }
Get setting .
44,984
protected function getResultsTemplate ( $ request ) { $ templates = [ Page :: class . '_results' , Page :: class ] ; if ( $ request -> getVar ( 'format' ) == 'rss' ) { array_unshift ( $ templates , Page :: class . '_results_rss' ) ; } if ( $ request -> getVar ( 'format' ) == 'atom' ) { array_unshift ( $ templates , Pag...
Select the template to render search results with
44,985
protected function decode ( $ var ) { $ decoded = file_exists ( $ this -> filename ) ? @ parse_ini_file ( $ this -> filename ) : [ ] ; if ( $ decoded === false ) { throw new \ RuntimeException ( "Decoding file '{$this->filename}' failed'" ) ; } return $ decoded ; }
Decode INI file into contents .
44,986
public function start ( $ deviceUUID , array $ options = array ( ) ) { $ this -> checkArgument ( $ deviceUUID , 'deviceUUID' ) ; list ( $ code , $ session ) = $ this -> httpClient -> post ( '/sync/start' , null , array_merge ( $ options , [ 'headers' => $ this -> buildHeaders ( $ deviceUUID ) ] ) ) ; if ( $ code == 204...
Start synchronization flow
44,987
public function fetch ( $ deviceUUID , $ sessionId , $ queue = 'main' , array $ options = array ( ) ) { $ this -> checkArgument ( $ deviceUUID , 'deviceUUID' ) ; $ this -> checkArgument ( $ sessionId , 'sessionId' ) ; $ this -> checkArgument ( $ queue , 'queue' ) ; $ options = array_merge ( $ options , [ 'headers' => $...
Get data from queue
44,988
public function ack ( $ deviceUUID , array $ ackKeys , array $ options = array ( ) ) { $ this -> checkArgument ( $ deviceUUID , 'deviceUUID' ) ; if ( ! $ ackKeys ) return true ; $ attributes = [ 'ack_keys' => $ ackKeys ] ; list ( $ code , ) = $ this -> httpClient -> post ( '/sync/ack' , $ attributes , array_merge ( $ o...
Acknowledge received data
44,989
public function create ( array $ source , array $ options = array ( ) ) { $ attributes = array_intersect_key ( $ source , array_flip ( self :: $ keysToPersist ) ) ; list ( $ code , $ createdSource ) = $ this -> httpClient -> post ( "/sources" , $ attributes , $ options ) ; return $ createdSource ; }
Create a source
44,990
public function update ( $ id , array $ order , array $ options = array ( ) ) { $ attributes = array_intersect_key ( $ order , array_flip ( self :: $ keysToPersist ) ) ; list ( $ code , $ updatedOrder ) = $ this -> httpClient -> put ( "/orders/{$id}" , $ attributes , $ options ) ; return $ updatedOrder ; }
Update an order
44,991
public function create ( array $ lead , array $ options = array ( ) ) { $ attributes = array_intersect_key ( $ lead , array_flip ( self :: $ keysToPersist ) ) ; if ( isset ( $ attributes [ 'custom_fields' ] ) && empty ( $ attributes [ 'custom_fields' ] ) ) unset ( $ attributes [ 'custom_fields' ] ) ; list ( $ code , $ ...
Create a lead
44,992
public function update ( $ id , array $ lead , array $ options = array ( ) ) { $ attributes = array_intersect_key ( $ lead , array_flip ( self :: $ keysToPersist ) ) ; if ( isset ( $ attributes [ 'custom_fields' ] ) && empty ( $ attributes [ 'custom_fields' ] ) ) unset ( $ attributes [ 'custom_fields' ] ) ; list ( $ co...
Update a lead
44,993
public function start ( ) { if ( isset ( $ _COOKIE [ session_name ( ) ] ) && ! preg_match ( '/^[-,a-zA-Z0-9]{1,128}$/' , $ _COOKIE [ session_name ( ) ] ) ) { unset ( $ _COOKIE [ session_name ( ) ] ) ; } if ( ! session_start ( ) ) { throw new \ RuntimeException ( 'Failed to start session.' , 500 ) ; } $ this -> started ...
Starts the session storage
44,994
public function invalidate ( ) { $ params = session_get_cookie_params ( ) ; setcookie ( session_name ( ) , '' , time ( ) - 42000 , $ params [ 'path' ] , $ params [ 'domain' ] , $ params [ 'secure' ] , $ params [ 'httponly' ] ) ; session_unset ( ) ; session_destroy ( ) ; $ this -> started = false ; return $ this ; }
Invalidates the current session .
44,995
public function updateCMSFields ( FieldList $ fields ) { $ pageInfoTitle = _t ( __CLASS__ . '.PAGEINFO' , 'Page info and SEO' ) ; $ boostTitle = _t ( __CLASS__ . '.SearchBoost' , 'Boost Keywords' ) ; $ boostNote = _t ( __CLASS__ . '.SearchBoostNote' , '(Only applies to the search results on this site e.g. not on Google...
Adds boost fields to this page
44,996
public function create ( array $ lossReason , array $ options = array ( ) ) { $ attributes = array_intersect_key ( $ lossReason , array_flip ( self :: $ keysToPersist ) ) ; list ( $ code , $ createdLossReason ) = $ this -> httpClient -> post ( "/loss_reasons" , $ attributes , $ options ) ; return $ createdLossReason ; ...
Create a loss reason
44,997
public function get ( $ id , array $ options = array ( ) ) { list ( $ code , $ loss_reason ) = $ this -> httpClient -> get ( "/loss_reasons/{$id}" , null , $ options ) ; return $ loss_reason ; }
Retrieve a single reason
44,998
public function update ( $ id , array $ lossReason , array $ options = array ( ) ) { $ attributes = array_intersect_key ( $ lossReason , array_flip ( self :: $ keysToPersist ) ) ; list ( $ code , $ updatedLossReason ) = $ this -> httpClient -> put ( "/loss_reasons/{$id}" , $ attributes , $ options ) ; return $ updatedL...
Update a loss reason
44,999
public function all ( $ deal_id , $ params = [ ] , array $ options = array ( ) ) { list ( $ code , $ associated_contacts ) = $ this -> httpClient -> get ( "/deals/{$deal_id}/associated_contacts" , $ params , $ options ) ; return $ associated_contacts ; }
Retrieve deal s associated contacts