idx int64 0 60.3k | question stringlengths 99 4.85k | target stringlengths 5 718 |
|---|---|---|
4,300 | public function render ( ) { $ result = "" ; $ params = [ ] ; $ params [ 'Host' ] = $ this -> host ; $ siteMap = $ this -> sitemap ; if ( is_array ( $ siteMap ) ) { $ siteMap = Url :: to ( $ siteMap , true ) ; } $ params [ 'Sitemap' ] = $ siteMap ; foreach ( array_filter ( $ params ) as $ key => $ value ) { $ result .=... | render robots . txt |
4,301 | public function setGenerate ( $ generate , $ gen_proc_limit = - 1 ) { $ args = [ ( bool ) $ generate , ( int ) $ gen_proc_limit ] ; return null === $ this -> rpc -> query ( __FUNCTION__ , $ args ) ; } | Sets whether the wallet should generate coins |
4,302 | public function addNode ( $ node , $ type ) { $ args = [ ( string ) $ node , ( string ) $ type ] ; return null === $ this -> rpc -> query ( __FUNCTION__ , $ args ) ; } | Attempts add or remove a node from the addnode list or try a connection to it once |
4,303 | public function getNodeInfo ( $ dns , $ node = null ) { $ args = [ ( bool ) $ dns ] ; if ( null !== $ node ) { $ args [ ] = ( string ) $ node ; } return $ this -> rpc -> query ( "getAddedNodeInfo" , $ args ) ; } | Returns information about the given added node or all added nodes |
4,304 | public function signMessage ( $ address , $ message ) { $ args = [ ( string ) $ address , ( string ) $ message ] ; return $ this -> rpc -> query ( __FUNCTION__ , $ args ) ; } | Sign a message with the private key of an address |
4,305 | public function signRawTransaction ( $ hex_data , array $ prevtxs = [ ] , array $ priv_keys = [ ] , $ sighashtype = "ALL" ) { $ args = [ ( string ) $ hex_data , ! empty ( $ prevtxs ) ? $ prevtxs : null , ! empty ( $ priv_keys ) ? $ priv_keys : null , ( string ) $ sighashtype ] ; return $ this -> rpc -> query ( __FUNCTI... | Adds signatures to a raw transaction and returns the resulting raw transaction |
4,306 | public function isSignedMessageValid ( $ address , $ signature , $ message ) { $ args = [ ( string ) $ address , ( string ) $ signature , ( string ) $ message ] ; return $ this -> rpc -> query ( "verifyMessage" , $ args ) ; } | Verify a signed message |
4,307 | public function getBalances ( $ include_empty = false ) { $ args = [ $ this -> minconf , ( bool ) $ include_empty ] ; return $ this -> rpc -> query ( "listReceivedByAddress" , $ args ) ; } | Returns balances by for every address |
4,308 | public function getBalanceByAccount ( $ account ) { $ args = [ ( string ) $ account , $ this -> minconf ] ; return $ this -> rpc -> query ( "getBalance" , $ args ) ; } | Returns the balance for the given account |
4,309 | public function getBalanceByAddress ( $ address ) { $ args = [ ( string ) $ address , $ this -> minconf ] ; return $ this -> rpc -> query ( "getReceivedByAddress" , $ args ) ; } | Returns the balance for a given address |
4,310 | public function move ( $ from_account , $ to_account , $ amount , $ comment = "" ) { $ args = [ ( string ) $ from_account , ( string ) $ to_account , ( double ) $ amount , $ this -> minconf , ( string ) $ comment ] ; return $ this -> rpc -> query ( __FUNCTION__ , $ args ) ; } | Move from one account in your wallet to another |
4,311 | public function send ( $ address , $ amount , $ comment = null , $ comment_to = null ) { $ args = [ ( string ) $ address , ( double ) $ amount , ( string ) $ comment , ( string ) $ comment_to ] ; return $ this -> rpc -> query ( "sendToAddress" , $ args ) ; } | Sends coins to the given address |
4,312 | public function sendFromAccount ( $ account , $ address , $ amount , $ comment = null , $ comment_to = null ) { $ args = [ ( string ) $ account , ( string ) $ address , ( double ) $ amount , $ this -> minconf , ( string ) $ comment , ( string ) $ comment_to ] ; return $ this -> rpc -> query ( "sendFrom" , $ args ) ; } | Sends coins from the given account to the given address |
4,313 | public function sendManyFromAccount ( $ account , array $ addresses , $ comment = null ) { $ args = [ ( string ) $ account , $ addresses , $ this -> minconf , ( string ) $ comment ] ; return $ this -> rpc -> query ( "sendMany" , $ args ) ; } | Sends coins to multiple addresses |
4,314 | public function getAccounts ( ) { $ accounts = [ ] ; $ groups = $ this -> rpc -> query ( "listAccounts" , [ 0 ] ) ; foreach ( $ groups as $ account => $ balance ) { $ accounts [ ] = $ account ; } return $ accounts ; } | Returns the wallet accounts |
4,315 | public function setAccount ( $ address , $ account ) { $ args = [ ( string ) $ address , ( string ) $ account ] ; return null === $ this -> rpc -> query ( __FUNCTION__ , $ args ) ; } | Sets the account associated with the given address |
4,316 | public function getAccountByAddress ( $ address ) { $ args = [ ( string ) $ address ] ; $ account = $ this -> rpc -> query ( "getAccount" , $ args ) ; return ! empty ( $ account ) ? $ account : null ; } | Returns the account associated with the given address |
4,317 | public function getAddresses ( ) { $ addresses = [ ] ; $ groups = $ this -> rpc -> query ( "listAddressGroupings" ) ; foreach ( $ groups as $ group ) { foreach ( $ group as $ info ) { $ addresses [ ] = $ info [ 0 ] ; } } return $ addresses ; } | Returns the wallet addresses |
4,318 | public function getAddressesByAccount ( $ account ) { $ args = [ ( string ) $ account ] ; return $ this -> rpc -> query ( __FUNCTION__ , $ args ) ; } | Returns the addresses for the given account |
4,319 | public function getRawChangeAddress ( $ account ) { $ args = [ ( string ) $ account ] ; return $ this -> rpc -> query ( __FUNCTION__ , $ args ) ; } | Returns a new address for receiving change |
4,320 | public function getNewAddress ( $ account ) { $ args = [ ( string ) $ account ] ; return $ this -> rpc -> query ( __FUNCTION__ , $ args ) ; } | Returns a new address for receiving payments |
4,321 | public function getNewMultiSignatureAddress ( $ nrequired , array $ keys ) { $ args = [ ( int ) $ nrequired , $ keys ] ; return $ this -> rpc -> query ( "createMultiSig" , $ args ) ; } | Returns a new multi - signature address |
4,322 | public function addMultiSignatureAddress ( $ nrequired , array $ keys , $ account = null ) { $ args = [ ( int ) $ nrequired , $ keys ] ; if ( null !== $ account ) { $ args [ ] = ( string ) $ account ; } return $ this -> rpc -> query ( "addMultiSigAddress" , $ args ) ; } | Add a nrequired - to - sign multisignature address to the wallet |
4,323 | public function getPrivateKeyByAddress ( $ address ) { $ args = [ ( string ) $ address ] ; $ priv_key = null ; try { $ priv_key = $ this -> rpc -> query ( "dumpPrivKey" , $ args ) ; } catch ( Exceptions \ RPCException $ e ) { if ( $ e -> getCode ( ) != RPCErrorCodes :: WALLET_ERROR ) { throw $ e ; } } return $ priv_key... | Returns the private key for the given address |
4,324 | public function addPrivateKey ( $ priv_key , $ label , $ rescan = true ) { $ args = [ ( string ) $ priv_key , ( string ) $ label , ( bool ) $ rescan ] ; return null === $ this -> rpc -> query ( "importPrivKey" , $ args ) ; } | Adds a private key to the wallet |
4,325 | public function getBlock ( $ hash , $ verbose = true ) { $ args = [ ( string ) $ hash , ( bool ) $ verbose ] ; return $ this -> rpc -> query ( __FUNCTION__ , $ args ) ; } | Returns information about the block with the given hash |
4,326 | public function getTransaction ( $ txid ) { $ args = [ ( string ) $ txid ] ; return $ this -> rpc -> query ( __FUNCTION__ , $ args ) ; } | Returns detailed information about in - wallet transaction |
4,327 | public function getRawTransaction ( $ txid , $ verbose = 0 ) { $ args = [ ( string ) $ txid , ( int ) $ verbose ] ; return $ this -> rpc -> query ( __FUNCTION__ , $ args ) ; } | Returns raw transaction representation for given transaction id |
4,328 | public function getTransactionOut ( $ txid , $ n , $ include_mem_pool = true ) { $ args = [ ( string ) $ txid , ( int ) $ n , ( bool ) $ include_mem_pool ] ; return $ this -> rpc -> query ( "getTxOut" , $ args ) ; } | Returns details about an unspent transaction output |
4,329 | public function setLockUnspent ( $ unlock , array $ objs = [ ] ) { $ args = [ ( bool ) $ unlock , $ objs ] ; return $ this -> rpc -> query ( "lockUnspent" , $ args ) ; } | Updates list of temporarily unspendable outputs |
4,330 | public function getBlockTemplate ( array $ capabilities = [ ] , $ mode = null ) { $ params = new \ stdClass ( ) ; $ params -> capabilities = $ capabilities ; if ( null !== $ mode ) { $ params -> mode = $ mode ; } $ args = [ $ params ] ; return $ this -> rpc -> query ( __FUNCTION__ , $ args ) ; } | Returns data needed to construct a block to work on |
4,331 | public function getWork ( $ data = null ) { if ( null === $ data ) { $ args = [ ] ; } else { $ args = [ ( string ) $ data ] ; } return $ this -> rpc -> query ( __FUNCTION__ , $ args ) ; } | Returns work data or works on existing data |
4,332 | public function createRawTransaction ( array $ transactions , array $ addresses ) { $ args = [ $ transactions , $ addresses ] ; return $ this -> rpc -> query ( __FUNCTION__ , $ args ) ; } | Returns a hex - encoded raw transaction spending the given inputs and sending to the given addresses |
4,333 | public function decodeRawTransaction ( $ hex_string ) { $ args = [ ( string ) $ hex_string ] ; return $ this -> rpc -> query ( __FUNCTION__ , $ args ) ; } | Decodes a raw serialized transaction |
4,334 | public function encrypt ( $ pass_phrase ) { $ args = [ ( string ) $ pass_phrase ] ; return null === $ this -> rpc -> query ( "encryptWallet" , $ args ) ; } | Encrypts the wallet with the given pass phrase |
4,335 | public function changePassPhrase ( $ old_passphrase , $ new_passphrase ) { $ args = [ ( string ) $ old_passphrase , ( string ) $ new_passphrase ] ; return null === $ this -> rpc -> query ( "walletPassPhraseChange" , $ args ) ; } | Updates the wallet passphrase |
4,336 | public function addPrefix ( $ annotation = null ) { if ( null === $ this -> ormPrefix ) { $ this -> ormPrefix = '@' . $ this -> getConfig ( ) -> get ( Formatter :: CFG_ANNOTATION_PREFIX ) ; } return $ this -> ormPrefix . ( $ annotation ? $ annotation : '' ) ; } | Get annotation prefix . |
4,337 | public function quoteIdentifier ( $ value ) { $ quote = false ; switch ( $ this -> getConfig ( ) -> get ( Formatter :: CFG_QUOTE_IDENTIFIER_STRATEGY ) ) { case Formatter :: QUOTE_IDENTIFIER_AUTO : $ quote = ReservedWords :: isReserved ( $ value ) ; break ; case Formatter :: QUOTE_IDENTIFIER_ALWAYS : $ quote = true ; br... | Quote identifier if necessary . |
4,338 | public function getAnnotation ( $ annotation , $ content = null , $ options = array ( ) ) { return new Annotation ( $ this -> addPrefix ( $ annotation ) , $ content , $ options ) ; } | Get annotation object . |
4,339 | protected function getIndexesAnnotation ( $ type = 'Index' ) { $ indices = array ( ) ; foreach ( $ this -> getTableIndices ( ) as $ index ) { switch ( true ) { case $ type === 'Index' && $ index -> isIndex ( ) : case $ type === 'UniqueConstraint' && $ index -> isUnique ( ) : $ columns = array ( ) ; foreach ( $ index ->... | Get indexes annotation . |
4,340 | public function getJoinAnnotation ( $ joinType , $ entity , $ mappedBy = null , $ inversedBy = null ) { return $ this -> getAnnotation ( $ joinType , array ( 'targetEntity' => $ entity , 'mappedBy' => $ mappedBy , 'inversedBy' => $ inversedBy ) ) ; } | Get join annotation . |
4,341 | protected function getClassFileName ( $ base = false ) { return ( $ base ? $ this -> getTableFileName ( null , array ( '%entity%' => 'Base' . DIRECTORY_SEPARATOR . 'Base' . $ this -> getModelName ( ) ) ) : $ this -> getTableFileName ( ) ) ; } | Get the generated class name . |
4,342 | protected function getUsedClasses ( ) { $ uses = array ( ) ; if ( $ orm = $ this -> getOrmUse ( ) ) { $ uses [ ] = $ orm ; } if ( count ( $ this -> getTableM2MRelations ( ) ) || count ( $ this -> getAllLocalForeignKeys ( ) ) ) { $ uses [ ] = $ this -> getCollectionClass ( ) ; } return $ uses ; } | Get used classes . |
4,343 | protected function parse ( $ command , array $ arguments = array ( ) , $ output ) { if ( null !== $ this -> parser ) { return $ this -> parser -> parse ( $ command , $ arguments , $ output ) ; } return $ output ; } | Delegate output to output parser when a parser is set otherwise returns the raw output |
4,344 | protected function getJoins ( ForeignKey $ fkey , $ owningSide = true ) { $ joins = array ( ) ; $ lcols = $ owningSide ? $ fkey -> getForeigns ( ) : $ fkey -> getLocals ( ) ; $ fcols = $ owningSide ? $ fkey -> getLocals ( ) : $ fkey -> getForeigns ( ) ; $ onDelete = $ this -> getFormatter ( ) -> getDeleteRule ( $ fkey ... | Get foreign key join descriptor . |
4,345 | public function checkout ( $ dest = null ) { $ temporary = $ this -> isTemporary ; if ( true === is_null ( $ dest ) ) { $ realdest = $ this -> cwd ; } else { $ realdest = $ dest ; } $ head = $ this -> getHead ( ) ; $ branch = $ head -> getName ( ) ; $ this -> dispatch ( VcsEvents :: PRE_CHECKOUT , new CheckoutEventData... | Perform a clone operation |
4,346 | public function get ( ) { $ rpc = null ; if ( $ this -> count > 0 ) { $ rpc = $ this -> items [ $ this -> index ] ; if ( ++ $ this -> index > $ this -> count - 1 ) { $ this -> index = 0 ; } } return $ rpc ; } | Returns an JsonRPCInterface instance from the pool |
4,347 | public function hasRelatedErrors ( $ relationName = null ) { if ( $ relationName === null ) { foreach ( $ this -> _relatedErrors as $ errors ) { if ( ! empty ( $ errors ) ) { return true ; } } return false ; } else { return ! empty ( $ this -> _relatedErrors [ $ relationName ] ) ; } } | Check if relation has error . |
4,348 | public function getEntityNamespace ( ) { $ namespace = '' ; if ( ( $ bundleNamespace = $ this -> parseComment ( 'bundleNamespace' ) ) || ( $ bundleNamespace = $ this -> getConfig ( ) -> get ( Formatter :: CFG_BUNDLE_NAMESPACE ) ) ) { $ namespace = $ bundleNamespace . '\\' ; } if ( $ entityNamespace = $ this -> getConfi... | Get the entity namespace . |
4,349 | public function getNamespace ( $ class = null , $ absolute = true , $ base = false ) { return sprintf ( '%s%s\%s' , $ absolute ? '\\' : '' , $ base ? $ this -> getBaseEntityNamespace ( ) : $ this -> getEntityNamespace ( ) , null === $ class ? $ this -> getModelName ( ) : $ class ) ; } | Get namespace of a class . |
4,350 | public function getModelNameAsFQCN ( $ referenceNamespace = null ) { $ namespace = $ this -> getEntityNamespace ( ) ; $ fqcn = ( $ namespace == $ referenceNamespace ) ? false : true ; return $ fqcn ? $ namespace . '\\' . $ this -> getModelName ( ) : $ this -> getModelName ( ) ; } | Get Model Name in FQCN format . If reference namespace is suplied and the entity namespace is equal then relative model name returned instead . |
4,351 | public function getLifecycleCallbacks ( ) { $ result = array ( ) ; if ( $ lifecycleCallbacks = trim ( $ this -> parseComment ( 'lifecycleCallbacks' ) ) ) { foreach ( explode ( "\n" , $ lifecycleCallbacks ) as $ callback ) { list ( $ method , $ handler ) = explode ( ':' , $ callback , 2 ) ; $ method = lcfirst ( trim ( $... | Get lifecycleCallbacks . |
4,352 | public function getRelatedVarName ( $ name , $ related = null , $ plural = false ) { $ nameFromCommentTag = '' ; $ relatedNames = trim ( $ this -> parseComment ( 'relatedNames' ) ) ; if ( '' !== $ relatedNames ) { foreach ( explode ( "\n" , $ relatedNames ) as $ relationMap ) { list ( $ toChange , $ replacement ) = exp... | Get identifier name formatting . |
4,353 | public function add ( $ path ) { if ( null === $ this -> wc ) { throw new \ RuntimeException ( 'Working copy not initialized, have you tried checkout()?' ) ; } return $ this -> wc -> add ( $ path ) ; } | Add to version control |
4,354 | protected function exec ( $ query ) { if ( ! $ query ) { throw new Exceptions \ RPCException ( "Empty query." ) ; } $ url = sprintf ( "http://%s:%d" , $ this -> conf [ "host" ] , $ this -> conf [ "port" ] ) ; $ web = $ this -> getWebClient ( ) ; $ web -> setMethod ( HttpMethods :: POST ) ; $ web -> addHeader ( "Content... | Sends the query string to the server and returns the response |
4,355 | protected function getResponseError ( WebResponse $ response ) { $ error = [ "message" => "" , "code" => 0 ] ; $ response_text = $ response -> getBody ( ) ; $ obj = json_decode ( $ response_text , true ) ; if ( ! $ obj ) { if ( stripos ( $ response_text , "<H1>401 Unauthorized.</H1>" ) !== false ) { $ error [ "message"... | Creates an array of error information based on the server response |
4,356 | protected function getNonceValue ( ) { if ( null === $ this -> nonce ) { $ this -> nonce = new Nonce ( ) ; } return $ this -> nonce -> generate ( ) ; } | Generates and returns a nonce value for use as a request id |
4,357 | public function add ( $ path ) { if ( ! file_exists ( $ this -> cwd . '/' . $ path ) ) { throw new NotFoundException ( sprintf ( 'Path %s not found' , $ this -> cwd . '/' . $ path ) ) ; } $ result = $ this -> status ( $ path ) ; foreach ( $ result as $ fileInfo ) { if ( $ fileInfo -> getStatus ( ) === Status :: UNVERSI... | Add file or directory to Svn |
4,358 | public function status ( $ path = null ) { $ args = array ( ) ; if ( null !== $ path ) { $ args [ ] = $ path ; } return $ this -> svn -> execute ( 'status' , $ args , $ this -> cwd ) ; } | Get the status of the working copy |
4,359 | public function parseLogOutput ( $ output , array $ arguments = array ( ) ) { if ( ! isset ( $ arguments [ '--pretty=' ] ) || Git :: PRETTY_FORMAT !== $ arguments [ '--pretty=' ] ) { return $ output ; } $ xml = '<log>' . $ output . '</log>' ; $ sxml = simplexml_load_string ( $ xml ) ; $ retval = array ( ) ; foreach ( $... | Parses the log command output to Commit objects |
4,360 | public function parseStatusOutput ( $ output , array $ arguments = array ( ) ) { if ( ! isset ( $ arguments [ '--porcelain' ] ) || false === $ arguments [ '--porcelain' ] ) { return $ output ; } if ( '' === trim ( $ output ) ) { return array ( ) ; } $ lines = explode ( "\n" , rtrim ( $ output ) ) ; $ retval = array ( )... | Parse the status command output to FileInfo objects |
4,361 | public function parseDiffOutput ( $ output , array $ arguments = array ( ) ) { if ( ! isset ( $ arguments [ '--name-status' ] ) || false === $ arguments [ '--name-status' ] ) { return $ output ; } $ lines = explode ( "\n" , rtrim ( $ output ) ) ; $ retval = array ( ) ; foreach ( $ lines as $ line ) { if ( preg_match ( ... | Parse the diff command output to FileInfo objects |
4,362 | public function addNext ( $ text , $ template = null ) { if ( ! empty ( $ text ) ) { $ this -> callToActions = [ 'message' => [ 'text' => $ text ] ] ; } if ( ! empty ( $ template ) ) { if ( $ template instanceof StructuredMessage ) { $ this -> callToActions = [ 'message' => [ $ template -> getDataForCall ( FALSE ) ] ] ... | You can set the welcome message to be text or Structured Message . |
4,363 | public function writePopulate ( WriterInterface $ writer ) { $ writer -> write ( '/**' ) -> write ( ' * Populate entity with the given data.' ) -> write ( ' * The set* method will be used to set the data.' ) -> write ( ' *' ) -> write ( ' * @param array $data' ) -> write ( ' * @return boolean' ) -> write ( ' */' ) -> w... | Write entity populate method . |
4,364 | public function writeGetArrayCopy ( WriterInterface $ writer ) { $ columns = $ this -> getColumns ( ) ; $ relations = $ this -> getTableRelations ( ) ; $ writer -> write ( '/**' ) -> write ( ' * Return a array with all fields and data.' ) -> write ( ' * Default the relations will be ignored.' ) -> write ( ' * ' ) -> wr... | Write getArrayCopy method . |
4,365 | public function node ( $ endpoint ) { $ request = new Request ( $ endpoint , $ this -> secret , 'node' , [ ] ) ; return $ this -> sendBatchRequest ( [ $ request ] ) ; } | Get information about single Centrifugo node . |
4,366 | public function generateClientToken ( $ user , $ timestamp , $ info = '' ) { $ ctx = hash_init ( 'sha256' , HASH_HMAC , $ this -> secret ) ; hash_update ( $ ctx , $ user ) ; hash_update ( $ ctx , $ timestamp ) ; hash_update ( $ ctx , $ info ) ; return hash_final ( $ ctx ) ; } | Generate client connection token . |
4,367 | public function generateChannelSign ( $ client , $ channel , $ info = '' ) { $ ctx = hash_init ( 'sha256' , HASH_HMAC , $ this -> secret ) ; hash_update ( $ ctx , $ client ) ; hash_update ( $ ctx , $ channel ) ; hash_update ( $ ctx , $ info ) ; return hash_final ( $ ctx ) ; } | Generate channel sign . |
4,368 | public function sendBatchRequest ( array $ requests ) { $ batchRequest = new BatchRequest ( $ this -> endpoint , $ this -> secret , $ requests ) ; return $ this -> lastResponse = $ this -> client -> sendBatchRequest ( $ batchRequest ) ; } | Send batch request . |
4,369 | private function buildOptionsPart ( ) : void { $ this -> optionsPart = [ ] ; if ( $ this -> message instanceof AbstractMessage && $ this -> message -> getOptions ( ) instanceof OptionsInterface ) { $ options = $ this -> message -> getOptions ( ) ; if ( ! empty ( $ options -> getCollapseKey ( ) ) ) { $ this -> optionsPa... | Build options part . |
4,370 | protected function getGlobalArguments ( ) { $ args = array ( '--non-interactive' => true , ) ; if ( $ this -> username ) $ args [ '--username' ] = $ this -> username ; if ( $ this -> password ) $ args [ '--password' ] = $ this -> password ; return $ args ; } | Global arguments for executing SVN commands |
4,371 | public function execute ( $ command , array $ arguments = array ( ) , $ cwd = null ) { $ arguments += $ this -> getGlobalArguments ( ) ; try { $ result = $ this -> adapter -> execute ( $ command , $ arguments , $ cwd ) ; } catch ( \ Exception $ e ) { if ( preg_match ( '/url \'[^\']+\' non-existent/i' , $ e -> getMessag... | Execute SVN command |
4,372 | public function getSvnUrl ( $ path ) { $ head = $ this -> head ; if ( $ path instanceof Reference ) { $ head = $ path ; $ path = '/' ; } if ( null === $ path ) { $ path = '/' ; } if ( is_string ( $ path ) ) { $ path = new VcsFileInfo ( $ path , array ( $ head -> getName ( ) , $ head -> getType ( ) ) ) ; } if ( $ path -... | Returns url for a specific path |
4,373 | protected function cmpSvnEntriesByKind ( array $ item1 , array $ item2 ) { $ item1 [ 'name' ] = strtolower ( $ item1 [ 'name' ] ) ; $ item2 [ 'name' ] = strtolower ( $ item2 [ 'name' ] ) ; return ( $ item1 [ 'kind' ] == 'dir' ? ( $ item2 [ 'kind' ] == 'dir' ? strnatcmp ( $ item1 [ 'name' ] , $ item2 [ 'name' ] ) : - 1 ... | Sort function for sorting entries |
4,374 | private function generateForm ( BundleInterface $ bundle , $ document , $ metadata ) { try { $ this -> getFormGenerator ( ) -> generate ( $ bundle , $ document , $ metadata ) ; } catch ( \ RuntimeException $ e ) { } } | Tries to generate forms if they don t exist yet and if we need write operations on documents . |
4,375 | private function createAuth ( array $ api , array $ configAttributes , array $ authorization ) : AuthInterface { if ( empty ( $ api [ 'authentication' ] [ 'type' ] ) ) { $ this -> logger -> debug ( "Using no authentication." ) ; return new Authentication \ NoAuth ( ) ; } $ this -> logger -> debug ( "Using '{$api['authe... | Create Authentication class that accepts a Guzzle client . |
4,376 | public function create ( ) { $ folder = $ this -> getBackupFolder ( ) ; $ files = $ this -> backupFiles ( $ folder ) ; $ db = $ this -> backupDatabase ( $ folder ) ; $ resultFilename = $ this -> getBackupFilename ( ) ; $ archiveFile = dirname ( $ folder ) . DIRECTORY_SEPARATOR . $ resultFilename . '.tar' ; $ archive = ... | Create dump of all directories and all databases and save result to bakup folder with timestamp named tar - archive |
4,377 | public function deleteJunk ( ) { if ( empty ( $ this -> expireTime ) ) { return true ; } $ backupsFolder = Yii :: getAlias ( $ this -> backupsFolder ) ; $ expireDate = time ( ) - $ this -> expireTime ; $ filter = function ( $ path ) use ( $ expireDate ) { if ( substr ( $ path , - 4 ) !== '.tar' ) { return false ; } if ... | Delete expired files |
4,378 | public function getBackupFilename ( ) { if ( is_callable ( $ this -> backupFilename ) ) { return call_user_func ( $ this -> backupFilename , $ this ) ; } else { return date ( $ this -> backupFilename ) ; } } | Generate backup filename |
4,379 | public function getBackupFolder ( ) { $ base = Yii :: getAlias ( $ this -> backupsFolder ) ; $ current = $ this -> getBackupFilename ( ) ; $ fullpath = $ base . DIRECTORY_SEPARATOR . $ current ; if ( ! is_dir ( $ fullpath ) && ! mkdir ( $ fullpath ) ) { throw new Exception ( 'Can not create folder for backup: "' . $ fu... | Get full path to backups folder . Directory will be automatically created . |
4,380 | public static function convertRetry ( array $ config ) { if ( isset ( $ config [ 'curlCodes' ] ) ) { $ config [ 'curl' ] = [ ] ; $ config [ 'curl' ] [ 'codes' ] = $ config [ 'curlCodes' ] ; unset ( $ config [ 'curlCodes' ] ) ; } if ( isset ( $ config [ 'headerName' ] ) || isset ( $ config [ 'httpCodes' ] ) ) { $ config... | Convert structure of config from Juicer 8 = > 9 |
4,381 | private function handleQuery ( $ associativeArray , & $ headers , $ ignoreReturn = false ) { $ result = $ this -> executeCurl ( ) ; $ continueHeader = "HTTP/1.1 100 Continue\r\n\r\n" ; if ( strpos ( $ result , $ continueHeader ) === 0 ) { $ result = str_replace ( $ continueHeader , '' , $ result ) ; } list ( $ header ,... | Handle the execution of the cURL request . This function will also save the returned HTTP headers and handle them appropriately . |
4,382 | private function configureCurl ( $ email , $ password ) { curl_setopt_array ( $ this -> cURL , array ( CURLOPT_URL => $ this -> url , CURLOPT_HEADER => true , CURLOPT_HTTPHEADER => $ this -> headers , CURLOPT_RETURNTRANSFER => true , CURLOPT_SSLVERSION => 6 ) ) ; if ( ! StringUtilities :: isNullOrEmpty ( $ email ) && !... | Configure the cURL instance and its credentials for Basic Authentication that this instance will be working with |
4,383 | private function executeCurl ( ) { $ result = curl_exec ( $ this -> cURL ) ; if ( ! $ result ) { throw new CurlException ( $ this -> cURL ) ; } return $ result ; } | Execute the finalized cURL object that has already been configured |
4,384 | private function handleResponseBody ( $ body , $ result ) { if ( ! StringUtilities :: isJson ( $ body ) ) { $ httpCode = curl_getinfo ( $ this -> cURL , CURLINFO_HTTP_CODE ) ; throw new HttpException ( $ httpCode , $ result ) ; } $ resultArray = json_decode ( $ body , true ) ; if ( array_key_exists ( 'error' , $ result... | Check for unexpected errors or SODA API errors |
4,385 | private function saveHeaders ( $ header , & $ headers ) { if ( $ headers === NULL ) { return ; } $ header = explode ( "\r\n" , $ header ) ; $ headers = array ( ) ; $ headerLength = count ( $ header ) ; for ( $ i = 1 ; $ i < $ headerLength ; $ i ++ ) { list ( $ key , $ val ) = explode ( ":" , $ header [ $ i ] ) ; $ head... | Handle the returned HTTP headers and save them into an array |
4,386 | private static function buildQuery ( $ url , $ params = array ( ) ) { $ full_url = $ url ; if ( count ( $ params ) > 0 ) { $ full_url .= "?" . implode ( "&" , $ params ) ; } return $ full_url ; } | Build a URL with GET parameters formatted into the URL |
4,387 | private static function formatParameters ( $ params ) { $ parameters = array ( ) ; foreach ( $ params as $ key => $ value ) { $ parameters [ ] = rawurlencode ( $ key ) . "=" . rawurlencode ( $ value ) ; } return $ parameters ; } | Format an array into a URL encoded values to be submitted in cURL requests |
4,388 | public function generate ( BundleInterface $ bundle , $ document , ClassMetadataInfo $ metadata ) { $ parts = explode ( '\\' , $ document ) ; $ class = array_pop ( $ parts ) ; $ this -> className = $ class . 'Type' ; $ dirPath = $ bundle -> getPath ( ) . '/Form' ; $ this -> classPath = $ dirPath . '/' . str_replace ( '... | Generates the document form class if it does not exist . |
4,389 | public function process ( ) { $ maxJobs = $ this -> scopeConfig -> getValue ( 'springbot/queue/max_jobs' ) ; if ( ! is_numeric ( $ maxJobs ) ) { $ maxJobs = 1 ; } for ( $ i = 1 ; $ i <= $ maxJobs ; $ i ++ ) { if ( $ this -> runNextJob ( ) === null ) { return null ; } } return true ; } | Process the next N jobs in the queue where N is the max_jobs value |
4,390 | public static function fromFile ( $ filename ) { if ( ! file_exists ( $ filename ) || ! is_readable ( $ filename ) ) { throw new FileNotFoundException ( $ filename ) ; } $ data = file_get_contents ( $ filename ) ; return new static ( $ data ) ; } | A convenience method to create a Converter instance from a file name without having to read the file data and then give it to the CsvConverter constructor . |
4,391 | public function run ( ) { $ this -> config -> setParams ( $ this -> buildParams ( $ this -> config ) ) ; $ parentId = $ this -> getParentId ( ) ; $ request = $ this -> firstPage ( $ this -> config ) ; while ( $ request !== false ) { $ response = $ this -> download ( $ request ) ; $ responseHash = sha1 ( serialize ( $ r... | Manages cycling through the requests as long as scroller provides next page |
4,392 | private function createChild ( JobConfig $ config , array $ parentResults ) : array { $ scroller = clone $ this -> scroller ; $ scroller -> reset ( ) ; $ params = [ ] ; $ placeholders = ! empty ( $ config -> getConfig ( ) [ 'placeholders' ] ) ? $ config -> getConfig ( ) [ 'placeholders' ] : [ ] ; if ( empty ( $ placeho... | Create a child job with current client and parser |
4,393 | private function generateConfiguration ( ) { if ( ! in_array ( $ this -> format , array ( 'yml' , 'xml' , 'php' ) ) ) { return ; } $ target = sprintf ( '%s/Resources/config/routing/%s.%s' , $ this -> bundle -> getPath ( ) , strtolower ( str_replace ( '\\' , '_' , $ this -> document ) ) , $ this -> format ) ; $ this -> ... | Generates the routing configuration . |
4,394 | private function generateNewView ( $ dir ) { $ this -> renderFile ( 'views/new.html.twig' , $ dir . '/new.html.twig' , array ( 'dir' => $ this -> skeletonDir , 'route_prefix' => $ this -> routePrefix , 'route_name_prefix' => $ this -> routeNamePrefix , 'document' => $ this -> document , 'actions' => $ this -> actions ,... | Generates the new . html . twig template in the final bundle . |
4,395 | public function __tostring ( ) { if ( is_null ( $ this -> queryElements ) ) { return "" ; } $ query = [ ] ; foreach ( $ this -> queryElements as $ soqlKey => $ value ) { $ value = ( is_array ( $ value ) ) ? implode ( self :: DELIMITER , $ value ) : $ value ; $ query [ ] = sprintf ( "%s=%s" , $ soqlKey , $ value ) ; } r... | Convert the current information into a URL encoded query that can be appended to the domain |
4,396 | public function select ( $ columns = self :: DEFAULT_SELECT ) { if ( func_num_args ( ) == 1 ) { $ this -> queryElements [ self :: SELECT_KEY ] = ( is_array ( $ columns ) ) ? $ this -> formatAssociativeArray ( "%s AS %s" , $ columns ) : array ( $ columns ) ; } else if ( func_num_args ( ) > 1 ) { $ this -> queryElements ... | Select only specific columns in your Soql Query . When this function is given no parameters or is not used in a query the Soql Query will return all of the columns by default . |
4,397 | public function limit ( $ limit ) { $ this -> handleInteger ( "limit" , $ limit ) ; $ this -> queryElements [ self :: LIMIT_KEY ] = $ limit ; return $ this ; } | Set the amount of results that can be retrieved from a dataset per query . |
4,398 | private function handleInteger ( $ variable , $ number ) { if ( ! is_integer ( $ number ) ) { throw new \ InvalidArgumentException ( sprintf ( "The %s must be an integer" , $ variable ) ) ; } if ( $ number < 0 ) { $ message = sprintf ( "The %s cannot be less than 0." , $ variable ) ; throw new \ OutOfBoundsException ( ... | Analyze a given value and ensure the value fits the criteria set by the Socrata API |
4,399 | public function getApiVersion ( ) { if ( $ this -> apiVersion == 0 ) { $ soql = new SoqlQuery ( ) ; $ soql -> limit ( 0 ) ; $ this -> getDataset ( $ soql ) ; } return $ this -> apiVersion ; } | Get the API version this dataset is using |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.