idx int64 0 241k | question stringlengths 64 6.21k | target stringlengths 5 803 |
|---|---|---|
9,300 | public function removeAttribute ( string $ key ) : void { $ this -> tag -> removeAttribute ( $ key ) ; $ this -> clear ( ) ; } | A wrapper method that simply calls the removeAttribute method on the tag of this node . |
9,301 | public function confirmMicroTransferAmounts ( $ token , $ amounts ) { try { $ path = $ this -> _config -> merchantPath ( ) . '/us_bank_account_verifications/' . $ token . '/confirm_micro_transfer_amounts' ; $ response = $ this -> _http -> put ( $ path , [ "us_bank_account_verification" => [ "deposit_amounts" => $ amoun... | complete micro transfer verification by confirming the transfer amounts |
9,302 | public function find ( $ token ) { $ this -> _validateId ( $ token ) ; try { $ path = $ this -> _config -> merchantPath ( ) . '/payment_methods/any/' . $ token ; $ response = $ this -> _http -> get ( $ path ) ; return PaymentMethodParser :: parsePaymentMethod ( $ response ) ; } catch ( Exception \ NotFound $ e ) { thro... | find a PaymentMethod by token |
9,303 | public function _doDelete ( $ subPath ) { $ fullPath = $ this -> _config -> merchantPath ( ) . $ subPath ; $ this -> _http -> delete ( $ fullPath ) ; return new Result \ Successful ( ) ; } | sends the delete request to the gateway |
9,304 | public function create ( $ params ) { Util :: verifyKeys ( self :: createSignature ( ) , $ params ) ; $ file = $ params [ 'file' ] ; if ( ! is_resource ( $ file ) ) { throw new InvalidArgumentException ( 'file must be a stream resource' ) ; } $ payload = [ 'document_upload[kind]' => $ params [ 'kind' ] ] ; $ path = $ t... | Accepts a dispute given a dispute ID |
9,305 | public function delete ( $ customerOrId = null , $ addressId = null ) { $ this -> _validateId ( $ addressId ) ; $ customerId = $ this -> _determineCustomerId ( $ customerOrId ) ; $ path = $ this -> _config -> merchantPath ( ) . '/customers/' . $ customerId . '/addresses/' . $ addressId ; $ this -> _http -> delete ( $ p... | delete an address by id |
9,306 | public function find ( $ customerOrId , $ addressId ) { $ customerId = $ this -> _determineCustomerId ( $ customerOrId ) ; $ this -> _validateId ( $ addressId ) ; try { $ path = $ this -> _config -> merchantPath ( ) . '/customers/' . $ customerId . '/addresses/' . $ addressId ; $ response = $ this -> _http -> get ( $ p... | find an address by id |
9,307 | public function update ( $ customerOrId , $ addressId , $ attributes ) { $ this -> _validateId ( $ addressId ) ; $ customerId = $ this -> _determineCustomerId ( $ customerOrId ) ; Util :: verifyKeys ( self :: updateSignature ( ) , $ attributes ) ; $ path = $ this -> _config -> merchantPath ( ) . '/customers/' . $ custo... | updates the address record |
9,308 | public function updateNoValidate ( $ customerOrId , $ addressId , $ attributes ) { $ result = $ this -> update ( $ customerOrId , $ addressId , $ attributes ) ; return Util :: returnObjectOrThrowException ( __CLASS__ , $ result ) ; } | update an address record assuming validations will pass |
9,309 | private function _validateCustomerId ( $ id = null ) { if ( empty ( $ id ) || trim ( $ id ) == "" ) { throw new InvalidArgumentException ( 'expected customer id to be set' ) ; } if ( ! preg_match ( '/^[0-9A-Za-z_-]+$/' , $ id ) ) { throw new InvalidArgumentException ( $ id . ' is an invalid customer id.' ) ; } } | verifies that a valid customer id is being used |
9,310 | private function _determineCustomerId ( $ customerOrId ) { $ customerId = ( $ customerOrId instanceof Customer ) ? $ customerOrId -> id : $ customerOrId ; $ this -> _validateCustomerId ( $ customerId ) ; return $ customerId ; } | determines if a string id or Customer object was passed |
9,311 | private function _doCreate ( $ subPath , $ params ) { $ fullPath = $ this -> _config -> merchantPath ( ) . $ subPath ; $ response = $ this -> _http -> post ( $ fullPath , $ params ) ; return $ this -> _verifyGatewayResponse ( $ response ) ; } | sends the create request to the gateway |
9,312 | public function saleNoValidate ( $ attribs ) { $ result = $ this -> sale ( $ attribs ) ; return Util :: returnObjectOrThrowException ( __CLASS__ , $ result ) ; } | roughly equivalent to the ruby bang method |
9,313 | public static function generate ( $ settlement_date , $ groupByCustomField = NULL ) { return Configuration :: gateway ( ) -> settlementBatchSummary ( ) -> generate ( $ settlement_date , $ groupByCustomField ) ; } | static method redirecting to gateway |
9,314 | private function _getPage ( $ ids ) { $ object = $ this -> _pager [ 'object' ] ; $ method = $ this -> _pager [ 'method' ] ; $ methodArgs = [ ] ; foreach ( $ this -> _pager [ 'methodArgs' ] as $ arg ) { array_push ( $ methodArgs , $ arg ) ; } array_push ( $ methodArgs , $ ids ) ; return call_user_func_array ( [ $ object... | requests the next page of results for the collection |
9,315 | public function find ( $ idealPaymentId ) { try { $ path = $ this -> _config -> merchantPath ( ) . '/ideal_payments/' . $ idealPaymentId ; $ response = $ this -> _http -> get ( $ path ) ; return IdealPayment :: factory ( $ response [ 'idealPayment' ] ) ; } catch ( Exception \ NotFound $ e ) { throw new Exception \ NotF... | find an IdealPayment by id |
9,316 | public static function arrayFromXml ( $ xml ) { $ document = new DOMDocument ( '1.0' , 'UTF-8' ) ; $ document -> loadXML ( $ xml ) ; $ root = $ document -> documentElement -> nodeName ; return Util :: delimiterToCamelCaseArray ( [ $ root => self :: _nodeToValue ( $ document -> childNodes -> item ( 0 ) ) , ] ) ; } | Converts an XML string into a multidimensional array |
9,317 | private static function _nodeToArray ( $ node ) { $ type = null ; if ( $ node instanceof DOMElement ) { $ type = $ node -> getAttribute ( 'type' ) ; } switch ( $ type ) { case 'array' : $ array = [ ] ; foreach ( $ node -> childNodes as $ child ) { $ value = self :: _nodeToValue ( $ child ) ; if ( $ value !== null ) { $... | Converts a node to an array of values or nodes |
9,318 | private static function _nodeToValue ( $ node ) { $ type = null ; if ( $ node instanceof DOMElement ) { $ type = $ node -> getAttribute ( 'type' ) ; } switch ( $ type ) { case 'datetime' : return self :: _timestampToUTC ( ( string ) $ node -> nodeValue ) ; case 'date' : return new DateTime ( ( string ) $ node -> nodeVa... | Converts a node to a PHP value |
9,319 | private static function _timestampToUTC ( $ timestamp ) { $ tz = new DateTimeZone ( 'UTC' ) ; $ dateTime = new DateTime ( $ timestamp , $ tz ) ; $ dateTime -> setTimezone ( $ tz ) ; return $ dateTime ; } | Converts XML timestamps into DateTime instances |
9,320 | public static function init ( ) { self :: $ _createCustomerSignature = [ self :: $ _transparentRedirectKeys , [ 'customer' => CustomerGateway :: createSignature ( ) ] , ] ; self :: $ _updateCustomerSignature = [ self :: $ _transparentRedirectKeys , 'customerId' , [ 'customer' => CustomerGateway :: updateSignature ( ) ]... | create signatures for different call types |
9,321 | public function createCreditCardData ( $ params ) { Util :: verifyKeys ( self :: $ _createCreditCardSignature , $ params ) ; $ params [ "kind" ] = TransparentRedirect :: CREATE_PAYMENT_METHOD ; return $ this -> _data ( $ params ) ; } | returns the trData string for creating a credit card |
9,322 | public function createCustomerData ( $ params ) { Util :: verifyKeys ( self :: $ _createCustomerSignature , $ params ) ; $ params [ "kind" ] = TransparentRedirect :: CREATE_CUSTOMER ; return $ this -> _data ( $ params ) ; } | returns the trData string for creating a customer . |
9,323 | public function transactionData ( $ params ) { Util :: verifyKeys ( self :: $ _transactionSignature , $ params ) ; $ params [ "kind" ] = TransparentRedirect :: CREATE_TRANSACTION ; $ transactionType = isset ( $ params [ 'transaction' ] [ 'type' ] ) ? $ params [ 'transaction' ] [ 'type' ] : null ; if ( $ transactionType... | returns the trData string for creating a transaction |
9,324 | public function updateCreditCardData ( $ params ) { Util :: verifyKeys ( self :: $ _updateCreditCardSignature , $ params ) ; if ( ! isset ( $ params [ 'paymentMethodToken' ] ) ) { throw new InvalidArgumentException ( 'expected params to contain paymentMethodToken.' ) ; } $ params [ "kind" ] = TransparentRedirect :: UPD... | Returns the trData string for updating a credit card . |
9,325 | public function updateCustomerData ( $ params ) { Util :: verifyKeys ( self :: $ _updateCustomerSignature , $ params ) ; if ( ! isset ( $ params [ 'customerId' ] ) ) { throw new InvalidArgumentException ( 'expected params to contain customerId of customer to update' ) ; } $ params [ "kind" ] = TransparentRedirect :: UP... | Returns the trData string for updating a customer . |
9,326 | public function set ( $ index , $ value ) { if ( $ index >= $ this -> count ( ) ) throw new OutOfRangeException ( 'Index out of range' ) ; $ this -> _collection [ $ index ] = $ value ; } | Set index s value |
9,327 | public function remove ( $ index ) { if ( $ index >= $ this -> count ( ) ) throw new OutOfRangeException ( 'Index out of range' ) ; array_splice ( $ this -> _collection , $ index , 1 ) ; } | Remove a value from the collection |
9,328 | public function isEqual ( $ other ) { return ! ( $ other instanceof self ) ? false : ( $ this -> id === $ other -> id && $ this -> customerId === $ other -> customerId ) ; } | returns false if comparing object is not a Address or is a Address with a different id |
9,329 | public function find ( $ token ) { $ this -> _validateId ( $ token ) ; try { $ path = $ this -> _config -> merchantPath ( ) . '/payment_methods/paypal_account/' . $ token ; $ response = $ this -> _http -> get ( $ path ) ; return PayPalAccount :: factory ( $ response [ 'paypalAccount' ] ) ; } catch ( Exception \ NotFoun... | find a paypalAccount by token |
9,330 | public function update ( $ token , $ attributes ) { Util :: verifyKeys ( self :: updateSignature ( ) , $ attributes ) ; $ this -> _validateId ( $ token ) ; return $ this -> _doUpdate ( 'put' , '/payment_methods/paypal_account/' . $ token , [ 'paypalAccount' => $ attributes ] ) ; } | updates the paypalAccount record |
9,331 | public function sale ( $ token , $ transactionAttribs ) { $ this -> _validateId ( $ token ) ; return Transaction :: sale ( array_merge ( $ transactionAttribs , [ 'paymentMethodToken' => $ token ] ) ) ; } | create a new sale for the current PayPal account |
9,332 | private function _validateId ( $ identifier = null , $ identifierType = 'token' ) { if ( empty ( $ identifier ) ) { throw new InvalidArgumentException ( 'expected paypal account id to be set' ) ; } if ( ! preg_match ( '/^[0-9A-Za-z_-]+$/' , $ identifier ) ) { throw new InvalidArgumentException ( $ identifier . ' is an ... | verifies that a valid paypal account identifier is being used |
9,333 | public function addFileEvidence ( $ disputeId , $ documentIdOrRequest ) { $ request = is_array ( $ documentIdOrRequest ) ? $ documentIdOrRequest : [ 'documentId' => $ documentIdOrRequest ] ; if ( trim ( $ disputeId ) == "" ) { throw new Exception \ NotFound ( 'dispute with id "' . $ disputeId . '" not found' ) ; } if (... | Adds file evidence to a dispute given a dispute ID and a document ID |
9,334 | public function addTextEvidence ( $ id , $ contentOrRequest ) { $ request = is_array ( $ contentOrRequest ) ? $ contentOrRequest : [ 'content' => $ contentOrRequest ] ; if ( trim ( $ request [ 'content' ] ) == "" ) { throw new InvalidArgumentException ( 'content cannot be blank' ) ; } try { $ evidence = [ 'comments' =>... | Adds text evidence to a dispute given a dispute ID and content |
9,335 | public function finalize ( $ id ) { try { if ( trim ( $ id ) == "" ) { throw new Exception \ NotFound ( ) ; } $ path = $ this -> _config -> merchantPath ( ) . '/disputes/' . $ id . '/finalize' ; $ response = $ this -> _http -> put ( $ path ) ; if ( isset ( $ response [ 'apiErrorResponse' ] ) ) { return new Result \ Err... | Finalize a dispute given a dispute ID |
9,336 | public function find ( $ id ) { if ( trim ( $ id ) == "" ) { throw new Exception \ NotFound ( 'dispute with id "' . $ id . '" not found' ) ; } try { $ path = $ this -> _config -> merchantPath ( ) . '/disputes/' . $ id ; $ response = $ this -> _http -> get ( $ path ) ; return Dispute :: factory ( $ response [ 'dispute' ... | Find a dispute given a dispute ID |
9,337 | public function removeEvidence ( $ disputeId , $ evidenceId ) { try { if ( trim ( $ disputeId ) == "" || trim ( $ evidenceId ) == "" ) { throw new Exception \ NotFound ( ) ; } $ path = $ this -> _config -> merchantPath ( ) . '/disputes/' . $ disputeId . '/evidence/' . $ evidenceId ; $ response = $ this -> _http -> dele... | Remove evidence from a dispute given a dispute ID and evidence ID |
9,338 | public function search ( $ query ) { $ criteria = [ ] ; foreach ( $ query as $ term ) { $ criteria [ $ term -> name ] = $ term -> toparam ( ) ; } $ pager = [ 'object' => $ this , 'method' => 'fetchDisputes' , 'query' => $ criteria ] ; return new PaginatedCollection ( $ pager ) ; } | Search for Disputes given a DisputeSearch query |
9,339 | public function rewind ( ) { $ this -> _index = 0 ; $ this -> _currentPage = 0 ; $ this -> _pageSize = 0 ; $ this -> _totalItems = 0 ; $ this -> _items = [ ] ; } | rewinds the collection to the first item when iterating with foreach |
9,340 | public static function timeout ( $ value = null ) { if ( empty ( $ value ) ) { return self :: $ global -> getTimeout ( ) ; } self :: $ global -> setTimeout ( $ value ) ; } | Sets or gets the read timeout to use for making requests . |
9,341 | public static function proxyHost ( $ value = null ) { if ( empty ( $ value ) ) { return self :: $ global -> getProxyHost ( ) ; } self :: $ global -> setProxyHost ( $ value ) ; } | Sets or gets the proxy host to use for connecting to Braintree |
9,342 | public static function proxyPort ( $ value = null ) { if ( empty ( $ value ) ) { return self :: $ global -> getProxyPort ( ) ; } self :: $ global -> setProxyPort ( $ value ) ; } | Sets or gets the port of the proxy to use for connecting to Braintree |
9,343 | public static function proxyType ( $ value = null ) { if ( empty ( $ value ) ) { return self :: $ global -> getProxyType ( ) ; } self :: $ global -> setProxyType ( $ value ) ; } | Sets or gets the proxy type to use for connecting to Braintree . This value can be any of the CURLOPT_PROXYTYPE options in PHP cURL . |
9,344 | public static function isUsingProxy ( ) { $ proxyHost = self :: $ global -> getProxyHost ( ) ; $ proxyPort = self :: $ global -> getProxyPort ( ) ; return ! empty ( $ proxyHost ) && ! empty ( $ proxyPort ) ; } | Specifies whether or not a proxy is properly configured |
9,345 | public static function isAuthenticatedProxy ( ) { $ proxyUser = self :: $ global -> getProxyUser ( ) ; $ proxyPwd = self :: $ global -> getProxyPassword ( ) ; return ! empty ( $ proxyUser ) && ! empty ( $ proxyPwd ) ; } | Specified whether or not a username and password have been provided for use with an authenticated proxy |
9,346 | public static function acceptGzipEncoding ( $ value = null ) { if ( is_null ( $ value ) ) { return self :: $ global -> getAcceptGzipEncoding ( ) ; } self :: $ global -> setAcceptGzipEncoding ( $ value ) ; } | Specify if the HTTP client is able to decode gzipped responses . |
9,347 | public function caFile ( $ sslPath = NULL ) { $ sslPath = $ sslPath ? $ sslPath : DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'ssl' . DIRECTORY_SEPARATOR ; $ caPath = __DIR__ . $ sslPath . 'api_braintreegateway_com.ca.crt' ; if ( ! file_exists ( $ caPath ) ) { throw new Exception \ SSLCaFileNotFound ( ) ; } retu... | sets the physical path for the location of the CA certs |
9,348 | protected function getSqlQuery ( $ name , array $ vars = array ( ) ) { $ sql = $ this -> sqlQueries [ $ name ] ; $ vars = array_merge ( array ( 'tablename' => $ this -> tableName ) , $ vars ) ; foreach ( $ vars as $ k => $ v ) { $ sql = str_replace ( "%$k%" , $ v , $ sql ) ; } return $ sql ; } | Get a SQL Query for a task with the variables replaced |
9,349 | public function addThrowable ( $ e ) { $ this -> exceptions [ ] = $ e ; if ( $ this -> chainExceptions && $ previous = $ e -> getPrevious ( ) ) { $ this -> addThrowable ( $ previous ) ; } } | Adds a Throwable to be profiled in the debug bar |
9,350 | public function formatThrowableData ( $ e ) { $ filePath = $ e -> getFile ( ) ; if ( $ filePath && file_exists ( $ filePath ) ) { $ lines = file ( $ filePath ) ; $ start = $ e -> getLine ( ) - 4 ; $ lines = array_slice ( $ lines , $ start < 0 ? 0 : $ start , 7 ) ; } else { $ lines = array ( "Cannot open the file ($file... | Returns Throwable data as an array |
9,351 | protected function memcachedGetMulti ( $ keys , $ flags ) { if ( $ this -> newGetMultiSignature === null ) { $ this -> newGetMultiSignature = ( new ReflectionMethod ( 'Memcached' , 'getMulti' ) ) -> getNumberOfParameters ( ) === 2 ; } if ( $ this -> newGetMultiSignature ) { return $ this -> memcached -> getMulti ( $ ke... | The memcached getMulti function changed in version 3 . 0 . 0 to only have two parameters . |
9,352 | public function setRenderSqlWithParams ( $ enabled = true , $ quotationChar = '<>' ) { $ this -> renderSqlWithParams = $ enabled ; $ this -> sqlQuotationChar = $ quotationChar ; } | Renders the SQL of traced statements with params embeded |
9,353 | public function addConnection ( TraceablePDO $ pdo , $ name = null ) { if ( $ name === null ) { $ name = spl_object_hash ( $ pdo ) ; } $ this -> connections [ $ name ] = $ pdo ; } | Adds a new PDO instance to be collector |
9,354 | protected function collectPDO ( TraceablePDO $ pdo , TimeDataCollector $ timeCollector = null , $ connectionName = null ) { if ( empty ( $ connectionName ) || $ connectionName == 'default' ) { $ connectionName = 'pdo' ; } else { $ connectionName = 'pdo ' . $ connectionName ; } $ stmts = array ( ) ; foreach ( $ pdo -> g... | Collects data from a single TraceablePDO instance |
9,355 | protected function getCloner ( ) { if ( ! $ this -> cloner ) { $ clonerOptions = $ this -> getClonerOptions ( ) ; if ( isset ( $ clonerOptions [ 'casters' ] ) ) { $ this -> cloner = new VarCloner ( $ clonerOptions [ 'casters' ] ) ; } else { $ this -> cloner = new VarCloner ( ) ; } if ( isset ( $ clonerOptions [ 'additi... | Gets the VarCloner instance with configuration options set . |
9,356 | protected function getDumper ( ) { if ( ! $ this -> dumper ) { $ this -> dumper = new DebugBarHtmlDumper ( ) ; $ dumperOptions = $ this -> getDumperOptions ( ) ; if ( isset ( $ dumperOptions [ 'styles' ] ) ) { $ this -> dumper -> setStyles ( $ dumperOptions [ 'styles' ] ) ; } } return $ this -> dumper ; } | Gets the DebugBarHtmlDumper instance with configuration options set . |
9,357 | public function getClonerOptions ( ) { if ( $ this -> clonerOptions === null ) { $ this -> clonerOptions = self :: $ defaultClonerOptions ; } return $ this -> clonerOptions ; } | Gets the array of non - default VarCloner configuration options . |
9,358 | public function mergeClonerOptions ( $ options ) { $ this -> clonerOptions = $ options + $ this -> getClonerOptions ( ) ; $ this -> cloner = null ; } | Merges an array of non - default VarCloner configuration options with the existing non - default options . |
9,359 | public function resetClonerOptions ( $ options = null ) { $ this -> clonerOptions = ( $ options ? : array ( ) ) + self :: $ defaultClonerOptions ; $ this -> cloner = null ; } | Resets the array of non - default VarCloner configuration options without retaining any of the existing non - default options . |
9,360 | public function getDumperOptions ( ) { if ( $ this -> dumperOptions === null ) { $ this -> dumperOptions = self :: $ defaultDumperOptions ; } return $ this -> dumperOptions ; } | Gets the array of non - default HtmlDumper configuration options . |
9,361 | public function mergeDumperOptions ( $ options ) { $ this -> dumperOptions = $ options + $ this -> getDumperOptions ( ) ; $ this -> dumper = null ; } | Merges an array of non - default HtmlDumper configuration options with the existing non - default options . |
9,362 | public function resetDumperOptions ( $ options = null ) { $ this -> dumperOptions = ( $ options ? : array ( ) ) + self :: $ defaultDumperOptions ; $ this -> dumper = null ; } | Resets the array of non - default HtmlDumper configuration options without retaining any of the existing non - default options . |
9,363 | protected function getDisplayOptions ( ) { $ displayOptions = array ( ) ; $ dumperOptions = $ this -> getDumperOptions ( ) ; if ( isset ( $ dumperOptions [ 'expanded_depth' ] ) ) { $ displayOptions [ 'maxDepth' ] = $ dumperOptions [ 'expanded_depth' ] ; } if ( isset ( $ dumperOptions [ 'max_string' ] ) ) { $ displayOpt... | Gets the display options for the HTML dumper . |
9,364 | public function renderCapturedVar ( $ capturedData , $ seekPath = array ( ) ) { $ data = unserialize ( $ capturedData ) ; if ( ! method_exists ( $ data , 'seek' ) ) { $ data = new SeekingData ( $ data -> getRawData ( ) ) ; } foreach ( $ seekPath as $ key ) { $ data = $ data -> seek ( $ key ) ; } return $ this -> dump (... | Renders previously - captured data from captureVar to HTML and returns it as a string . |
9,365 | protected function dump ( Data $ data ) { $ dumper = $ this -> getDumper ( ) ; $ output = fopen ( 'php://memory' , 'r+b' ) ; $ dumper -> setOutput ( $ output ) ; $ dumper -> setDumpHeader ( '' ) ; $ dumper -> dump ( $ data , null , $ this -> getDisplayOptions ( ) ) ; $ result = stream_get_contents ( $ output , - 1 , 0 ... | Helper function to dump a Data object to HTML . |
9,366 | public function getVarDumper ( ) { if ( $ this -> varDumper === null ) { $ this -> varDumper = DataCollector :: getDefaultVarDumper ( ) ; } return $ this -> varDumper ; } | Gets the variable dumper instance used by this collector |
9,367 | protected function sort ( $ data ) { if ( is_string ( $ this -> sort ) ) { $ p = $ this -> sort ; usort ( $ data , function ( $ a , $ b ) use ( $ p ) { if ( $ a [ $ p ] == $ b [ $ p ] ) { return 0 ; } return $ a [ $ p ] < $ b [ $ p ] ? - 1 : 1 ; } ) ; } elseif ( $ this -> sort === true ) { sort ( $ data ) ; } return $ ... | Sorts the collected data |
9,368 | public function setOptions ( array $ options ) { if ( array_key_exists ( 'base_path' , $ options ) ) { $ this -> setBasePath ( $ options [ 'base_path' ] ) ; } if ( array_key_exists ( 'base_url' , $ options ) ) { $ this -> setBaseUrl ( $ options [ 'base_url' ] ) ; } if ( array_key_exists ( 'include_vendors' , $ options ... | Sets options from an array |
9,369 | public function setIncludeVendors ( $ enabled = true ) { if ( is_string ( $ enabled ) ) { $ enabled = array ( $ enabled ) ; } $ this -> includeVendors = $ enabled ; if ( ! $ enabled || ( is_array ( $ enabled ) && ! in_array ( 'js' , $ enabled ) ) ) { $ this -> enableJqueryNoConflict = false ; } return $ this ; } | Whether to include vendor assets |
9,370 | public function disableVendor ( $ name ) { if ( array_key_exists ( $ name , $ this -> cssVendors ) ) { unset ( $ this -> cssVendors [ $ name ] ) ; } if ( array_key_exists ( $ name , $ this -> jsVendors ) ) { unset ( $ this -> jsVendors [ $ name ] ) ; } } | Disable a specific vendor s assets . |
9,371 | public function addControl ( $ name , array $ options ) { if ( count ( array_intersect ( array_keys ( $ options ) , array ( 'icon' , 'widget' , 'tab' , 'indicator' ) ) ) === 0 ) { throw new DebugBarException ( "Not enough options for control '$name'" ) ; } $ this -> controls [ $ name ] = $ options ; return $ this ; } | Adds a control to initialize |
9,372 | public function addAssets ( $ cssFiles , $ jsFiles , $ basePath = null , $ baseUrl = null ) { $ this -> additionalAssets [ ] = array ( 'base_path' => $ basePath , 'base_url' => $ baseUrl , 'css' => ( array ) $ cssFiles , 'js' => ( array ) $ jsFiles ) ; return $ this ; } | Add assets stored in files to render in the head |
9,373 | public function addInlineAssets ( $ inlineCss , $ inlineJs , $ inlineHead ) { $ this -> additionalAssets [ ] = array ( 'inline_css' => ( array ) $ inlineCss , 'inline_js' => ( array ) $ inlineJs , 'inline_head' => ( array ) $ inlineHead ) ; return $ this ; } | Add inline assets to render inline in the head . Ideally you should store static assets in files that you add with the addAssets function . However adding inline assets is useful when integrating with 3rd - party libraries that require static assets that are only available in an inline format . |
9,374 | protected function getRelativeRoot ( $ relativeTo , $ basePath , $ baseUrl ) { if ( $ relativeTo === self :: RELATIVE_PATH ) { return $ basePath ; } if ( $ relativeTo === self :: RELATIVE_URL ) { return $ baseUrl ; } return null ; } | Returns the correct base according to the type |
9,375 | protected function createAsseticCollection ( $ files = null , $ content = null ) { $ assets = array ( ) ; if ( $ files ) { foreach ( $ files as $ file ) { $ assets [ ] = new \ Assetic \ Asset \ FileAsset ( $ file ) ; } } if ( $ content ) { foreach ( $ content as $ item ) { $ assets [ ] = new \ Assetic \ Asset \ StringA... | Create an Assetic AssetCollection with the given content . Filenames will be converted to absolute path using the base path . |
9,376 | public function dumpCssAssets ( $ targetFilename = null ) { $ this -> dumpAssets ( $ this -> getAssets ( 'css' ) , $ this -> getAssets ( 'inline_css' ) , $ targetFilename ) ; } | Write all CSS assets to standard output or in a file |
9,377 | public function dumpJsAssets ( $ targetFilename = null ) { $ this -> dumpAssets ( $ this -> getAssets ( 'js' ) , $ this -> getAssets ( 'inline_js' ) , $ targetFilename , $ this -> useRequireJs ) ; } | Write all JS assets to standard output or in a file |
9,378 | public function renderOnShutdown ( $ here = true , $ initialize = true , $ renderStackedData = true , $ head = false ) { register_shutdown_function ( array ( $ this , "replaceTagInBuffer" ) , $ here , $ initialize , $ renderStackedData , $ head ) ; if ( ob_get_level ( ) === 0 ) { ob_start ( ) ; } return ( $ here ) ? se... | Register shutdown to display the debug bar |
9,379 | public function render ( $ initialize = true , $ renderStackedData = true ) { $ js = '' ; if ( $ initialize ) { $ js = $ this -> getJsInitializationCode ( ) ; } if ( $ renderStackedData && $ this -> debugBar -> hasStackedData ( ) ) { foreach ( $ this -> debugBar -> getStackedData ( ) as $ id => $ data ) { $ js .= $ thi... | Returns the code needed to display the debug bar |
9,380 | protected function getJsControlsDefinitionCode ( $ varname ) { $ js = '' ; $ dataMap = array ( ) ; $ excludedOptions = array ( 'indicator' , 'tab' , 'map' , 'default' , 'widget' , 'position' ) ; $ widgets = array ( ) ; foreach ( $ this -> debugBar -> getCollectors ( ) as $ collector ) { if ( ( $ collector instanceof Re... | Returns the js code needed to initialized the controls and data mapping of the debug bar |
9,381 | protected function getAddDatasetCode ( $ requestId , $ data , $ suffix = null ) { $ js = sprintf ( "%s.addDataSet(%s, \"%s\"%s);\n" , $ this -> variableName , json_encode ( $ data ) , $ requestId , $ suffix ? ", " . json_encode ( $ suffix ) : '' ) ; return $ js ; } | Returns the js code needed to add a dataset |
9,382 | public static function enablePropelProfiling ( PropelConfiguration $ config = null ) { if ( $ config === null ) { $ config = Propel :: getConfiguration ( PropelConfiguration :: TYPE_OBJECT ) ; } $ config -> setParameter ( 'debugpdo.logging.details.method.enabled' , true ) ; $ config -> setParameter ( 'debugpdo.logging.... | Sets the needed configuration option in propel to enable query logging |
9,383 | public function handle ( $ request = null , $ echo = true , $ sendHeader = true ) { if ( $ request === null ) { $ request = $ _REQUEST ; } $ op = 'find' ; if ( isset ( $ request [ 'op' ] ) ) { $ op = $ request [ 'op' ] ; if ( ! in_array ( $ op , array ( 'find' , 'get' , 'clear' ) ) ) { throw new DebugBarException ( "In... | Handles the current request |
9,384 | public function getVarDumper ( ) { if ( $ this -> varDumper === null ) { $ this -> varDumper = self :: getDefaultVarDumper ( ) ; } return $ this -> varDumper ; } | Gets the variable dumper instance used by this collector ; note that collectors using this instance need to be sure to return the static assets provided by the variable dumper . |
9,385 | public function getCollector ( $ name ) { if ( ! isset ( $ this -> collectors [ $ name ] ) ) { throw new DebugBarException ( "'$name' is not a registered collector" ) ; } return $ this -> collectors [ $ name ] ; } | Returns a data collector |
9,386 | public function getCurrentRequestId ( ) { if ( $ this -> requestId === null ) { $ this -> requestId = $ this -> getRequestIdGenerator ( ) -> generate ( ) ; } return $ this -> requestId ; } | Returns the id of the current request |
9,387 | public function getDataAsHeaders ( $ headerName = 'phpdebugbar' , $ maxHeaderLength = 4096 , $ maxTotalHeaderLength = 250000 ) { $ data = rawurlencode ( json_encode ( array ( 'id' => $ this -> getCurrentRequestId ( ) , 'data' => $ this -> getData ( ) ) ) ) ; if ( strlen ( $ data ) > $ maxTotalHeaderLength ) { $ data = ... | Returns an array of HTTP headers containing the data |
9,388 | public function sendDataInHeaders ( $ useOpenHandler = null , $ headerName = 'phpdebugbar' , $ maxHeaderLength = 4096 ) { if ( $ useOpenHandler === null ) { $ useOpenHandler = self :: $ useOpenHandlerWhenSendingDataHeaders ; } if ( $ useOpenHandler && $ this -> storage !== null ) { $ this -> getData ( ) ; $ headerName ... | Sends the data through the HTTP headers |
9,389 | public function stackData ( ) { $ http = $ this -> initStackSession ( ) ; $ data = null ; if ( ! $ this -> isDataPersisted ( ) || $ this -> stackAlwaysUseSessionStorage ) { $ data = $ this -> getData ( ) ; } elseif ( $ this -> data === null ) { $ this -> collect ( ) ; } $ stack = $ http -> getSessionValue ( $ this -> s... | Stacks the data in the session for later rendering |
9,390 | public function hasStackedData ( ) { try { $ http = $ this -> initStackSession ( ) ; } catch ( DebugBarException $ e ) { return false ; } return count ( $ http -> getSessionValue ( $ this -> stackSessionNamespace ) ) > 0 ; } | Checks if there is stacked data in the session |
9,391 | public function getStackedData ( $ delete = true ) { $ http = $ this -> initStackSession ( ) ; $ stackedData = $ http -> getSessionValue ( $ this -> stackSessionNamespace ) ; if ( $ delete ) { $ http -> deleteSessionValue ( $ this -> stackSessionNamespace ) ; } $ datasets = array ( ) ; if ( $ this -> isDataPersisted ( ... | Returns the data stacked in the session |
9,392 | public static function create ( ContainerInterface $ container , Request $ request = null ) { if ( ! isset ( $ request ) ) { $ request = $ container [ 'request' ] ; } $ view = new Smarty ( __DIR__ . '/../templates/' ) ; if ( in_array ( 'https' , $ request -> getHeader ( 'X-Forwarded-Proto' ) ) ) { $ request = $ request... | Create Smarty view object . |
9,393 | private static function getProcess ( array $ arguments ) { $ config = Config :: getInstance ( ) ; return new Process ( array_merge ( [ $ config -> python , $ config -> youtubedl ] , $ config -> params , $ arguments ) ) ; } | Return a youtube - dl process with the specified arguments . |
9,394 | private static function callYoutubedl ( array $ arguments ) { $ config = Config :: getInstance ( ) ; $ process = self :: getProcess ( $ arguments ) ; $ process -> setEnv ( [ 'PATH' => $ config -> phantomjsDir ] ) ; $ process -> inheritEnvironmentVariables ( ) ; $ process -> run ( ) ; if ( ! $ process -> isSuccessful ( ... | Call youtube - dl . |
9,395 | private function getProp ( $ prop = 'dump-json' ) { $ arguments = [ '--' . $ prop ] ; if ( isset ( $ this -> webpageUrl ) ) { $ arguments [ ] = $ this -> webpageUrl ; } if ( isset ( $ this -> requestedFormat ) ) { $ arguments [ ] = '-f' ; $ arguments [ ] = $ this -> requestedFormat ; } if ( isset ( $ this -> password )... | Get a property from youtube - dl . |
9,396 | public function getJson ( ) { if ( ! isset ( $ this -> json ) ) { $ this -> json = json_decode ( $ this -> getProp ( 'dump-single-json' ) ) ; } return $ this -> json ; } | Get all information about a video . |
9,397 | public function getUrl ( ) { if ( ! isset ( $ this -> urls ) ) { $ this -> urls = explode ( "\n" , $ this -> getProp ( 'get-url' ) ) ; if ( empty ( $ this -> urls [ 0 ] ) ) { throw new EmptyUrlException ( _ ( 'youtube-dl returned an empty URL.' ) ) ; } } return $ this -> urls ; } | Get URL of video from URL of page . |
9,398 | private function getRtmpArguments ( ) { $ arguments = [ ] ; if ( $ this -> protocol == 'rtmp' ) { foreach ( [ 'url' => '-rtmp_tcurl' , 'webpage_url' => '-rtmp_pageurl' , 'player_url' => '-rtmp_swfverify' , 'flash_version' => '-rtmp_flashver' , 'play_path' => '-rtmp_playpath' , 'app' => '-rtmp_app' , ] as $ property => ... | Return arguments used to run rtmp for a specific video . |
9,399 | private function getAvconvProcess ( $ audioBitrate , $ filetype = 'mp3' , $ audioOnly = true , $ from = null , $ to = null ) { if ( ! $ this -> checkCommand ( [ $ this -> config -> avconv , '-version' ] ) ) { throw new Exception ( _ ( 'Can\'t find avconv or ffmpeg at ' ) . $ this -> config -> avconv . '.' ) ; } $ durat... | Get a process that runs avconv in order to convert a video . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.