idx
int64
0
60.3k
question
stringlengths
99
4.85k
target
stringlengths
5
718
42,800
private function prepareLabelWithOutDisplayedProperties ( ModelFormatterConfigInterface $ formatter , array $ arguments , $ label , array & $ labelList ) { $ definition = $ this -> getEnvironment ( ) -> getDataDefinition ( ) ; $ listing = $ definition -> getDefinition ( Contao2BackendViewDefinitionInterface :: NAME ) -...
Prepare labels for display without properties .
42,801
protected function generateTreeView ( $ collection , $ treeClass ) { $ content = [ ] ; foreach ( $ collection as $ model ) { $ toggleID = $ model -> getProviderName ( ) . '_' . $ treeClass . '_' . $ model -> getId ( ) ; $ content [ ] = $ this -> parseModel ( $ model , $ toggleID ) ; if ( $ model -> getMeta ( $ model ::...
Generate the tree view for a given collection .
42,802
private function parentsOf ( $ model , & $ parents ) { $ environment = $ this -> getEnvironment ( ) ; $ dataDefinition = $ environment -> getDataDefinition ( ) ; $ collector = new ModelCollector ( $ this -> getEnvironment ( ) ) ; $ relationships = new RelationshipManager ( $ dataDefinition -> getModelRelationshipDefini...
Fetch all parents of the passed model .
42,803
private function determineParentsOfValues ( ) { $ parents = [ ] ; $ environment = $ this -> getEnvironment ( ) ; $ mode = $ environment -> getDataDefinition ( ) -> getBasicDefinition ( ) -> getMode ( ) ; if ( BasicDefinitionInterface :: MODE_HIERARCHICAL !== $ mode ) { return [ ] ; } foreach ( ( array ) $ this -> varVa...
Determine all parents of all selected values .
42,804
private function handleInputNameForEditAll ( ) { if ( ( 'select' !== $ this -> getEnvironment ( ) -> getInputProvider ( ) -> getParameter ( 'act' ) ) && ( 'edit' !== $ this -> getEnvironment ( ) -> getInputProvider ( ) -> getParameter ( 'select' ) ) && ( 'edit' !== $ this -> getEnvironment ( ) -> getInputProvider ( ) -...
Handle the input name for edit all mode .
42,805
public function isChanged ( $ cache ) : bool { if ( $ this -> reusable ) { $ hash = $ this -> generateReusableHash ( ) ; if ( ! array_key_exists ( $ hash , self :: $ _reusableData ) ) { self :: $ _reusableData [ $ hash ] = $ this -> generateDependencyData ( $ cache ) ; } $ data = self :: $ _reusableData [ $ hash ] ; } ...
Checks whether the dependency is changed .
42,806
protected function generateReusableHash ( ) : string { $ data = $ this -> data ; $ this -> data = null ; $ key = sha1 ( serialize ( $ this ) ) ; $ this -> data = $ data ; return $ key ; }
Generates a unique hash that can be used for retrieving reusable dependency data .
42,807
public function handleAction ( ActionEvent $ event ) { $ GLOBALS [ 'TL_CSS' ] [ 'cca.dc-general.generalDriver' ] = 'bundles/ccadcgeneral/css/generalDriver.css' ; if ( ( null !== $ event -> getResponse ( ) ) || $ event -> getEnvironment ( ) -> getDataDefinition ( ) -> getName ( ) !== $ this -> environment -> getDataDefi...
Handle the given action .
42,808
public function handleAjaxCall ( ) { $ environment = $ this -> getEnvironment ( ) ; $ input = $ environment -> getInputProvider ( ) ; if ( true === ( $ input -> hasParameter ( 'id' ) ) ) { if ( false === \ strpos ( $ input -> getParameter ( 'id' ) , '::' ) ) { $ modelId = new ModelId ( $ input -> getParameter ( 'table'...
Handle an ajax call by passing it to the relevant handler class .
42,809
public function breadcrumb ( ) { $ environment = $ this -> getEnvironment ( ) ; $ event = new GetBreadcrumbEvent ( $ environment ) ; $ environment -> getEventDispatcher ( ) -> dispatch ( $ event :: NAME , $ event ) ; $ elements = $ event -> getElements ( ) ; if ( ! \ is_array ( $ elements ) || ! \ count ( $ elements ) ...
Get the breadcrumb navigation via event .
42,810
private function addAjaxPropertyForEditAll ( ) { $ inputProvider = $ this -> getEnvironment ( ) -> getInputProvider ( ) ; if ( ( 'select' !== $ inputProvider -> getParameter ( 'act' ) ) && ( 'edit' !== $ inputProvider -> getParameter ( 'select' ) ) && ( 'edit' !== $ inputProvider -> getParameter ( 'mode' ) ) ) { return...
Add the ajax property for edit all mode .
42,811
private function findOriginalPropertyByModelId ( $ propertyName ) { if ( null === $ propertyName ) { return null ; } $ inputProvider = $ this -> getEnvironment ( ) -> getInputProvider ( ) ; $ sessionStorage = $ this -> getEnvironment ( ) -> getSessionStorage ( ) ; $ selectAction = $ inputProvider -> getParameter ( 'sel...
Find the original property by the modelId .
42,812
public static function getCurrentSorting ( EnvironmentInterface $ environment ) { $ view = $ environment -> getView ( ) ; foreach ( $ view -> getPanel ( ) as $ panel ) { $ sort = $ panel -> getElement ( 'sort' ) ; if ( $ sort ) { return $ sort -> getSelectedDefinition ( ) ; } } $ viewSection = $ environment -> getDataD...
Retrieve the currently active sorting .
42,813
public static function initializeSorting ( $ panel , $ dataConfig , $ listingConfig ) { $ sorting = $ dataConfig -> getSorting ( ) ; $ dataConfig -> setSorting ( [ ] ) ; $ panel -> initialize ( $ dataConfig ) ; if ( $ sorting && ! $ dataConfig -> getSorting ( ) ) { $ dataConfig -> setSorting ( $ sorting ) ; } if ( ! $ ...
Initialize the sorting from the panel . Fallback to default sorting if nothing given .
42,814
public static function getGroupingMode ( EnvironmentInterface $ environment ) { $ sorting = static :: getCurrentSorting ( $ environment ) ; if ( ( ! $ sorting ) || ( ! $ sorting -> getCount ( ) ) || $ sorting -> get ( 0 ) -> getSortingMode ( ) === GroupAndSortingInformationInterface :: SORT_RANDOM ) { return null ; } $...
Retrieve the currently active grouping mode .
42,815
public static function getReadableFieldValue ( EnvironmentInterface $ environment , PropertyInterface $ property , ModelInterface $ model ) { $ event = new RenderReadablePropertyValueEvent ( $ environment , $ model , $ property , $ model -> getProperty ( $ property -> getName ( ) ) ) ; $ environment -> getEventDispatch...
Get for a field the readable value .
42,816
public static function redirectHome ( EnvironmentInterface $ environment ) { $ input = $ environment -> getInputProvider ( ) ; if ( $ input -> hasParameter ( 'table' ) && ( $ hasParentId = $ input -> hasParameter ( 'pid' ) ) ) { if ( $ hasParentId ) { $ event = new RedirectEvent ( \ sprintf ( 'contao?do=%s&table=%s&pid...
Redirects to the real back end module .
42,817
private function generateUrl ( PickerConfig $ config , $ ignoreValue ) { $ params = \ array_merge ( $ this -> getRouteParameters ( $ ignoreValue ? null : $ config ) , [ 'popup' => '1' , 'picker' => $ config -> cloneForCurrent ( $ this -> getName ( ) ) -> urlEncode ( ) , ] ) ; return $ this -> router -> generate ( 'cca_...
Generates the URL for the picker .
42,818
public function create ( MicroTX $ microTX , $ apiContext = null , $ restCall = null ) { $ payLoad = $ microTX -> toJSON ( ) ; $ chainUrlPrefix = $ this -> getChainUrlPrefix ( $ apiContext ) ; $ json = $ this -> executeCall ( "$chainUrlPrefix/txs/micro" , "POST" , $ payLoad , null , $ apiContext , $ restCall ) ; $ micr...
Create a new MicroTX .
42,819
public static function validate ( $ argument , $ argumentName = null ) { if ( ! is_array ( $ argument ) ) { throw new \ InvalidArgumentException ( "Argument with name $argumentName is not an array" ) ; } foreach ( $ argument as $ item ) { if ( $ item === null ) { throw new \ InvalidArgumentException ( "Argument with na...
Helper method for validating an argument if it is an array of GET params
42,820
public static function fromAddressesArray ( $ addresses ) { ArgumentArrayValidator :: validate ( $ addresses , 'addresses' ) ; $ addressList = new self ( ) ; $ addressList -> setAddresses ( $ addresses ) ; return $ addressList ; }
Constructor passing addresses array . Default constructor can not be overridden
42,821
public function addAddress ( $ address ) { if ( ! $ this -> getAddresses ( ) ) { return $ this -> setAddresses ( array ( $ address ) ) ; } else { return $ this -> setAddresses ( array_merge ( $ this -> getAddresses ( ) , array ( $ address ) ) ) ; } }
Append Address to the list .
42,822
private function getHttpHeaders ( ) { $ ret = array ( ) ; foreach ( $ this -> httpConfig -> getHeaders ( ) as $ k => $ v ) { $ ret [ ] = "$k: $v" ; } return $ ret ; }
Gets all Http Headers
42,823
public function getHttpConstantsFromConfigs ( $ configs = array ( ) , $ prefix ) { $ arr = array ( ) ; if ( $ prefix != null && is_array ( $ configs ) ) { foreach ( $ configs as $ k => $ v ) { if ( substr ( $ k , 0 , strlen ( $ prefix ) ) === $ prefix ) { $ newKey = ltrim ( $ k , $ prefix ) ; if ( defined ( $ newKey ) ...
Retrieves an array of constant key and value based on Prefix
42,824
public function getHeader ( $ name ) { if ( array_key_exists ( $ name , $ this -> headers ) ) { return $ this -> headers [ $ name ] ; } return null ; }
Get Header by Name
42,825
public function addHeader ( $ name , $ value , $ overWrite = true ) { if ( ! array_key_exists ( $ name , $ this -> headers ) || $ overWrite ) { $ this -> headers [ $ name ] = $ value ; } else { $ this -> headers [ $ name ] = $ this -> headers [ $ name ] . self :: HEADER_SEPARATOR . $ value ; } }
Adds a Header
42,826
public function removeAddresses ( $ addressList , $ params = array ( ) , $ apiContext = null , $ restCall = null ) { ArgumentValidator :: validate ( $ addressList , 'addressList' ) ; ArgumentGetParamsValidator :: validate ( $ params , 'params' ) ; $ allowedParams = array ( ) ; $ params = ArgumentGetParamsValidator :: s...
Remove Addresses to the Wallet . Addresses will no longer be associated with the wallet .
42,827
public static function create ( $ chain = 'main' , $ coin = 'btc' , $ version = 'v1' , $ credential = null , $ config = null , $ blockCypherPartnerAttributionId = null ) { $ apiContext = new ApiContext ( $ credential , $ chain , $ coin , $ version ) ; if ( is_array ( $ config ) ) { $ apiContext -> setConfig ( $ config ...
Create new default ApiContext .
42,828
private function generateRequestId ( ) { static $ pid = - 1 ; static $ addr = - 1 ; if ( $ pid == - 1 ) { $ pid = getmypid ( ) ; } if ( $ addr == - 1 ) { if ( array_key_exists ( 'SERVER_ADDR' , $ _SERVER ) ) { $ addr = ip2long ( $ _SERVER [ 'SERVER_ADDR' ] ) ; } else { $ addr = php_uname ( 'n' ) ; } } return $ addr . $...
Generates a unique per request id that can be used to set the BlockCypher - Request - Id header that is used for idempotency
42,829
public function getRequestId ( ) { if ( $ this -> requestId == null ) { $ this -> requestId = $ this -> generateRequestId ( ) ; } return $ this -> requestId ; }
Get Request ID
42,830
public function getInputsAddresses ( ) { $ addresses = array ( ) ; foreach ( $ this -> getTx ( ) -> getInputs ( ) as $ txInput ) { $ inputAddresses = $ txInput -> getAddresses ( ) ; if ( is_array ( $ inputAddresses ) ) { $ addresses = array_merge ( $ addresses , $ inputAddresses ) ; } } return $ addresses ; }
Return an array of all inputs addresses in the same order they are in the json tx skeleton
42,831
public function addTosign ( $ tosign ) { if ( ! $ this -> getTosign ( ) ) { return $ this -> setTosign ( array ( $ tosign ) ) ; } else { return $ this -> setTosign ( array_merge ( $ this -> getTosign ( ) , array ( $ tosign ) ) ) ; } }
Append Tosign to the list .
42,832
public function addSignature ( $ signature ) { if ( ! $ this -> getSignatures ( ) ) { return $ this -> setSignatures ( array ( $ signature ) ) ; } else { return $ this -> setSignatures ( array_merge ( $ this -> getSignatures ( ) , array ( $ signature ) ) ) ; } }
Append Signature to the list .
42,833
public function addPubkey ( $ pubkey ) { if ( ! $ this -> getPubkeys ( ) ) { return $ this -> setPubkeys ( array ( $ pubkey ) ) ; } else { return $ this -> setPubkeys ( array_merge ( $ this -> getPubkeys ( ) , array ( $ pubkey ) ) ) ; } }
Append Pubkey to the list .
42,834
function encrypt ( $ input ) { $ iv = substr ( uniqid ( "" , true ) , 0 , Cipher :: IV_SIZE ) ; $ encrypted = openssl_encrypt ( $ input , "AES-256-CBC" , $ this -> secretKey , 0 , $ iv ) ; return base64_encode ( $ iv . $ encrypted ) ; }
Encrypts the input text using the cipher key
42,835
private static function getConfigValue ( $ key , $ config ) { $ config = ( $ config && is_array ( $ config ) ) ? $ config : BlockCypherConfigManager :: getInstance ( ) -> getConfigHashmap ( ) ; return ( array_key_exists ( $ key , $ config ) ) ? trim ( $ config [ $ key ] ) : null ; }
Returns the Value of the key if found in given config or from BlockCypher Config Manager Returns null if not found
42,836
public static function cachePath ( $ config ) { $ cachePath = self :: getConfigValue ( 'cache.FileName' , $ config ) ; return empty ( $ cachePath ) ? __DIR__ . self :: $ CACHE_PATH : $ cachePath ; }
Returns the cache file path
42,837
public static function pull ( $ config = null , $ clientId = null ) { if ( ! self :: isEnabled ( $ config ) ) { return null ; } $ tokens = null ; $ cachePath = self :: cachePath ( $ config ) ; if ( file_exists ( $ cachePath ) ) { $ cachedToken = file_get_contents ( $ cachePath ) ; if ( $ cachedToken && JsonValidator ::...
A pull method which would read the persisted data based on clientId . If clientId is not provided an array with all the tokens would be passed .
42,838
public static function validate ( $ string , $ silent = false ) { @ json_decode ( $ string ) ; if ( json_last_error ( ) != JSON_ERROR_NONE ) { if ( $ silent == false ) { throw new \ InvalidArgumentException ( "Invalid JSON String" ) ; } return false ; } return true ; }
Helper method for validating if string provided is a valid json .
42,839
public function get ( $ name , $ params = array ( ) , $ apiContext = null , $ restCall = null ) { ArgumentValidator :: validate ( $ name , 'name' ) ; ArgumentGetParamsValidator :: validate ( $ params , 'params' ) ; $ allowedParams = array ( ) ; $ params = ArgumentGetParamsValidator :: sanitize ( $ params , $ allowedPar...
Obtain the Blockchain resource for the given identifier .
42,840
public function getFeature ( $ featureName , $ params = array ( ) , $ apiContext = null , $ restCall = null ) { ArgumentValidator :: validate ( $ featureName , 'featureName' ) ; ArgumentGetParamsValidator :: validate ( $ params , 'params' ) ; $ allowedParams = array ( ) ; $ params = ArgumentGetParamsValidator :: saniti...
Obtain the information about the adoption of upgrade features on a blockchain .
42,841
public static function signMultiple ( $ hexDataToSign , $ privateKey ) { ArgumentArrayValidator :: validate ( $ hexDataToSign , 'hexDataToSign' ) ; $ signatures = array ( ) ; foreach ( $ hexDataToSign as $ tosign ) { $ signatures [ ] = self :: sign ( $ tosign , $ privateKey ) ; } return $ signatures ; }
Sign array of hex data deterministically using deterministic k .
42,842
public static function sign ( $ hexDataToSign , $ privateKey ) { if ( is_string ( $ privateKey ) ) { $ privateKey = PrivateKeyManipulator :: importPrivateKey ( $ privateKey ) ; } $ data = Buffer :: hex ( $ hexDataToSign ) ; $ ecAdapter = Bitcoin :: getEcAdapter ( ) ; $ k = new Rfc6979 ( $ ecAdapter , $ privateKey , $ d...
Sign hex data deterministically using deterministic k .
42,843
public static function push ( $ hexRawTx , $ params = array ( ) , $ apiContext = null , $ restCall = null ) { ArgumentValidator :: validate ( $ hexRawTx , 'hexRawTx' ) ; ArgumentGetParamsValidator :: validate ( $ params , 'params' ) ; $ allowedParams = array ( ) ; $ params = ArgumentGetParamsValidator :: sanitize ( $ p...
Push the raw transaction to the network .
42,844
public function addInput ( $ input ) { if ( ! $ this -> getInputs ( ) ) { return $ this -> setInputs ( array ( $ input ) ) ; } else { return $ this -> setInputs ( array_merge ( $ this -> getInputs ( ) , array ( $ input ) ) ) ; } }
Append TXInput to the list .
42,845
public function addOutput ( $ output ) { if ( ! $ this -> getOutputs ( ) ) { return $ this -> setOutputs ( array ( $ output ) ) ; } else { return $ this -> setOutputs ( array_merge ( $ this -> getOutputs ( ) , array ( $ output ) ) ) ; } }
Append TXOutput to the list .
42,846
private function _convertToArray ( $ param ) { $ ret = array ( ) ; foreach ( $ param as $ k => $ v ) { if ( $ v instanceof BlockCypherModel ) { $ ret [ $ k ] = $ v -> toArray ( ) ; } else if ( sizeof ( $ v ) <= 0 && is_array ( $ v ) ) { $ ret [ $ k ] = array ( ) ; } else if ( is_array ( $ v ) ) { $ ret [ $ k ] = $ this...
Converts Params to Array
42,847
public static function propertyAnnotations ( $ class , $ propertyName ) { $ class = is_object ( $ class ) ? get_class ( $ class ) : $ class ; if ( ! class_exists ( 'ReflectionProperty' ) ) { throw new \ RuntimeException ( "Property type of " . $ class . "::{$propertyName} cannot be resolved" ) ; } if ( $ annotations = ...
Retrieves Annotations of each property
42,848
public static function isPropertyClassArray ( $ class , $ propertyName ) { if ( ! class_exists ( $ class ) || ! method_exists ( $ class , self :: getter ( $ class , $ propertyName ) ) ) { return null ; } if ( ( $ annotations = self :: propertyAnnotations ( $ class , $ propertyName ) ) && isset ( $ annotations [ 'return...
Checks if the Property is of type array or an object
42,849
private function initCredential ( $ config ) { $ suffix = 1 ; $ prefix = "acct" ; $ arr = array ( ) ; foreach ( $ config as $ k => $ v ) { if ( strstr ( $ k , $ prefix ) ) { $ arr [ $ k ] = $ v ; } } $ credArr = $ arr ; $ arr = array ( ) ; foreach ( $ config as $ key => $ value ) { $ pos = strpos ( $ key , '.' ) ; if (...
Load credentials for multiple accounts with priority given to Signature credential .
42,850
public function getCredentialObject ( $ userId = null ) { if ( $ userId == null && array_key_exists ( $ this -> defaultAccountName , $ this -> credentialHashmap ) ) { $ credObj = $ this -> credentialHashmap [ $ this -> defaultAccountName ] ; } else if ( array_key_exists ( $ userId , $ this -> credentialHashmap ) ) { $ ...
Obtain Credential Object based on UserId provided .
42,851
public function addTx ( $ tx ) { if ( ! $ this -> getTxs ( ) ) { return $ this -> setTxs ( array ( $ tx ) ) ; } else { return $ this -> setTxs ( array_merge ( $ this -> getTxs ( ) , array ( $ tx ) ) ) ; } }
Append TX to the list .
42,852
public function sign ( $ hexPrivateKey ) { $ this -> setSignatures ( Signer :: signMultiple ( $ this -> tosign , $ hexPrivateKey ) ) ; return $ this ; }
Signs MicroTX .
42,853
public static function validate ( $ token ) { if ( $ token === null ) { return false ; } if ( gettype ( $ token ) == 'string' && trim ( $ token ) == '' ) { return false ; } if ( strlen ( $ token ) < 20 ) return false ; if ( strlen ( $ token ) > 50 ) return false ; $ type0RegExpression = '/(^[a-z0-9]+$)/i' ; $ type1RegE...
Helper method for validating tokens .
42,854
public function getAll ( $ params = array ( ) , $ apiContext = null , $ restCall = null ) { ArgumentGetParamsValidator :: validate ( $ params , 'params' ) ; $ allowedParams = array ( 'token' => 1 , ) ; $ params = ArgumentGetParamsValidator :: sanitize ( $ params , $ allowedParams ) ; $ payLoad = "" ; $ chainUrlPrefix =...
Obtain all WebHook resources for the provided token .
42,855
public function get ( $ searchKey ) { if ( array_key_exists ( $ searchKey , $ this -> configs ) ) { return $ this -> configs [ $ searchKey ] ; } else { $ arr = array ( ) ; foreach ( $ this -> configs as $ k => $ v ) { if ( strstr ( $ k , $ searchKey ) ) { $ arr [ $ k ] = $ v ; } } return $ arr ; } }
Simple getter for configuration params If an exact match for key is not found does a contains search on the key
42,856
public function create ( TX $ tx , $ apiContext = null , $ restCall = null ) { $ payLoad = $ tx -> toJSON ( ) ; $ chainUrlPrefix = $ this -> getChainUrlPrefix ( $ apiContext ) ; $ json = $ this -> executeCall ( "$chainUrlPrefix/txs/new" , "POST" , $ payLoad , null , $ apiContext , $ restCall ) ; $ txSkeleton = new TXSk...
Create a new TX .
42,857
public function send ( TXSkeleton $ txSkeleton , $ apiContext = null , $ restCall = null ) { $ payLoad = $ txSkeleton -> toJSON ( ) ; $ chainUrlPrefix = $ this -> getChainUrlPrefix ( $ apiContext ) ; $ json = $ this -> executeCall ( "$chainUrlPrefix/txs/send" , "POST" , $ payLoad , null , $ apiContext , $ restCall ) ; ...
Send the transaction to the network .
42,858
public function getConfidence ( $ txhash , $ params = array ( ) , $ apiContext = null , $ restCall = null ) { ArgumentValidator :: validate ( $ txhash , 'txhash' ) ; ArgumentGetParamsValidator :: validate ( $ params , 'params' ) ; $ allowedParams = array ( ) ; $ params = ArgumentGetParamsValidator :: sanitize ( $ param...
Obtain the TXConfidence resource for the given identifier .
42,859
public function getMultipleConfidences ( $ array , $ params = array ( ) , $ apiContext = null , $ restCall = null ) { ArgumentArrayValidator :: validate ( $ array , 'array' ) ; ArgumentGetParamsValidator :: validate ( $ params , 'params' ) ; $ allowedParams = array ( ) ; $ params = ArgumentGetParamsValidator :: sanitiz...
Obtain multiple TransactionConfidences resources for the given identifiers .
42,860
public function addError ( $ error ) { if ( ! $ this -> getErrors ( ) ) { return $ this -> setErrors ( array ( $ error ) ) ; } else { return $ this -> setErrors ( array_merge ( $ this -> getErrors ( ) , array ( $ error ) ) ) ; } }
Append error to the list .
42,861
public function getOnlyAddresses ( $ walletName , $ params = array ( ) , $ apiContext = null , $ restCall = null ) { return $ this -> getWalletAddresses ( $ walletName , $ params , $ apiContext , $ restCall ) ; }
Get all addresses in a given wallet .
42,862
public function getMultiple ( $ walletNames , $ params = array ( ) , $ apiContext = null , $ restCall = null ) { ArgumentArrayValidator :: validate ( $ walletNames , 'walletNames' ) ; ArgumentGetParamsValidator :: validate ( $ params , 'params' ) ; $ allowedParams = array ( ) ; $ params = ArgumentGetParamsValidator :: ...
Obtain multiple HDWallet resources for the given wallet names list .
42,863
public function delete ( $ walletName , $ params = array ( ) , $ apiContext = null , $ restCall = null ) { ArgumentGetParamsValidator :: validate ( $ params , 'params' ) ; $ allowedParams = array ( ) ; $ params = ArgumentGetParamsValidator :: sanitize ( $ params , $ allowedParams ) ; $ payLoad = "" ; $ chainUrlPrefix =...
Deletes the HDWallet identified by wallet_id for the application associated with access token .
42,864
public static function validate ( $ argument , $ argumentName = null ) { if ( $ argument === null ) { self :: throwException ( $ argument , $ argumentName ) ; } if ( gettype ( $ argument ) != 'string' ) { self :: throwException ( $ argument , $ argumentName ) ; } if ( gettype ( $ argument ) == 'string' && trim ( $ argu...
Helper method for validating an argument if it is valid coin symbol
42,865
public function createForwardingAddress ( $ destination , $ options = array ( ) , $ apiContext = null , $ restCall = null ) { ArgumentValidator :: validate ( $ destination , 'destination' ) ; ArgumentArrayValidator :: validate ( $ options , 'options' ) ; $ paymentForward = new PaymentForward ( ) ; $ paymentForward -> s...
Create a new PaymentForward .
42,866
public function getForwardingAddress ( $ paymentForwardId , $ params = array ( ) , $ apiContext = null , $ restCall = null ) { return $ this -> get ( $ paymentForwardId , $ params , $ apiContext , $ restCall ) ; }
Obtain the PaymentForward resource for the given identifier .
42,867
public function listForwardingAddresses ( $ params = array ( ) , $ apiContext = null , $ restCall = null ) { return $ this -> getAll ( $ params , $ apiContext , $ restCall ) ; }
Obtain all PaymentForward resources for the provided token .
42,868
public static function getCoinSymbolFrom ( $ code , $ network ) { foreach ( self :: COIN_SYMBOL_MAPPINGS ( ) as $ coinSymbol => $ coinSymbolMapping ) { if ( $ coinSymbolMapping [ 'blockcypher_code' ] == $ code && $ coinSymbolMapping [ 'blockcypher_network' ] == $ network ) { return $ coinSymbol ; } } return null ; }
Reverse mapping .
42,869
public function executeCall ( $ url , $ method , $ payLoad , $ headers = array ( ) , $ apiContext = null , $ restCall = null , $ handlers = array ( 'BlockCypher\Handler\TokenRestHandler' ) ) { if ( $ apiContext === null ) { $ apiContext = $ this -> getApiContext ( ) ; } $ restCall = $ restCall ? $ restCall : new BlockC...
Execute SDK Call to BlockCypher services
42,870
public function getMultipleFullAddresses ( $ array , $ params = array ( ) , $ apiContext = null , $ restCall = null ) { ArgumentArrayValidator :: validate ( $ array , 'array' ) ; ArgumentGetParamsValidator :: validate ( $ params , 'params' ) ; $ allowedParams = array ( 'unspentOnly' => 1 , 'before' => 1 , 'after' => 1 ...
Obtain multiple FullAddress resources for the given identifiers .
42,871
public function getMultipleBalances ( $ array , $ params = array ( ) , $ apiContext = null , $ restCall = null ) { ArgumentArrayValidator :: validate ( $ array , 'array' ) ; ArgumentGetParamsValidator :: validate ( $ params , 'params' ) ; $ allowedParams = array ( 'omitWalletAddresses' => 1 , ) ; $ params = ArgumentGet...
Obtain multiple AddressBalances resources for the given identifiers .
42,872
public static function satoshisToBtc ( $ satoshis ) { if ( ! is_numeric ( $ satoshis ) ) throw new \ InvalidArgumentException ( "$satoshis must be numeric" ) ; return ( float ) ( $ satoshis ) / ( float ) ( self :: SATOSHIS_PER_BTC ) ; }
Convert satoshis to BTC
42,873
private function urlContainsToken ( $ url ) { $ query = parse_url ( $ url , PHP_URL_QUERY ) ; parse_str ( $ query , $ params ) ; if ( isset ( $ params [ "token" ] ) ) { return true ; } else { return false ; } }
Return true if the given url contains a parameter called token .
42,874
public static function create ( $ addressKeyChain = null , $ apiContext = null , $ restCall = null ) { if ( $ addressKeyChain === null ) { $ payLoad = "" ; } else { $ payLoad = $ addressKeyChain -> toJSON ( ) ; } $ chainUrlPrefix = self :: getChainUrlPrefix ( $ apiContext ) ; $ json = self :: executeCall ( "$chainUrlPr...
Create a new address .
42,875
public function addTxref ( $ txref ) { if ( ! $ this -> getTxrefs ( ) ) { return $ this -> setTxrefs ( array ( $ txref ) ) ; } else { return $ this -> setTxrefs ( array_merge ( $ this -> getTxrefs ( ) , array ( $ txref ) ) ) ; } }
Append TXRef to the list .
42,876
public function addUnconfirmedTxref ( $ unconfirmedTxref ) { if ( ! $ this -> getUnconfirmedTxrefs ( ) ) { return $ this -> setUnconfirmedTxrefs ( array ( $ unconfirmedTxref ) ) ; } else { return $ this -> setUnconfirmedTxrefs ( array_merge ( $ this -> getUnconfirmedTxrefs ( ) , array ( $ unconfirmedTxref ) ) ) ; } }
Append Unconfirmed TXRef to the list .
42,877
public function getAllTxrefs ( ) { $ allTxrefs = array ( ) ; if ( is_array ( $ this -> txrefs ) ) { $ allTxrefs = array_merge ( $ allTxrefs , $ this -> txrefs ) ; } if ( is_array ( $ this -> unconfirmed_txrefs ) ) { $ allTxrefs = array_merge ( $ allTxrefs , $ this -> unconfirmed_txrefs ) ; } if ( count ( $ allTxrefs ) ...
All transactions refs for confirmed and unconfirmed transactions .
42,878
public function addPrivateKey ( PrivateKeyInterface $ privateKey ) { $ pubKeyHex = $ privateKey -> getPublicKey ( ) -> getHex ( ) ; $ this -> privateKeys [ $ pubKeyHex ] = $ privateKey ; }
Append private key to the list .
42,879
public function addSubchainIndex ( $ subchainIndex ) { if ( ! $ this -> getSubchainIndexes ( ) ) { return $ this -> setSubchainIndexes ( array ( $ subchainIndex ) ) ; } else { return $ this -> setSubchainIndexes ( array_merge ( $ this -> getSubchainIndexes ( ) , array ( $ subchainIndex ) ) ) ; } }
Append subchain index to the list .
42,880
public function isEnabled ( SiteTree $ record ) { $ enabledResults = $ this -> extend ( 'updateIsEnabled' , $ record ) ; return ( empty ( $ enabledResults ) || min ( $ enabledResults ) !== false ) ; }
Only deactivate for pages that have a history viewer capability removed . Extensions can provide their own two cents about this criteria .
42,881
public function schema ( $ request ) { $ formName = $ request -> param ( 'FormName' ) ; if ( ! in_array ( $ formName , $ this -> formNames ) ) { return parent :: schema ( $ request ) ; } return $ this -> generateSchemaForForm ( $ formName , $ request ) ; }
Gets a JSON schema representing the current version detail form .
42,882
protected function getRecordVersion ( $ recordClass , $ recordId , $ recordVersion ) { $ record = Versioned :: get_version ( $ recordClass , $ recordId , $ recordVersion ) ; if ( ! $ record ) { $ this -> jsonError ( 404 ) ; return null ; } if ( ! $ record -> canView ( ) ) { $ this -> jsonError ( 403 , _t ( __CLASS__ . ...
Fetches record version and checks canView permission for result
42,883
protected function validateInput ( array $ context , array $ requiredFields = [ ] ) { foreach ( $ requiredFields as $ requiredField ) { if ( empty ( $ context [ $ requiredField ] ) ) { throw new InvalidArgumentException ( 'Missing required field ' . $ requiredField ) ; } } return true ; }
Perform some centralised validation checks on the input request and data within it
42,884
protected function scaffoldForm ( $ formName , array $ context = [ ] , array $ extra = [ ] ) { $ scaffolder = Injector :: inst ( ) -> get ( DataObjectVersionFormFactory :: class ) ; $ form = $ scaffolder -> getForm ( $ this , $ formName , $ context ) ; return $ form -> setRequestHandler ( LeftAndMainFormRequestHandler ...
Given some context scaffold a form using the FormFactory and return it
42,885
public function updateItemEditForm ( Form $ form ) { $ record = $ this -> owner -> getRecord ( ) ; if ( $ this -> shouldDisplayAction ( $ record ) ) { $ restoreToRoot = RestoreAction :: shouldRestoreToRoot ( $ record ) ; $ title = $ restoreToRoot ? _t ( 'SilverStripe\\Versioned\\RestoreAction.RESTORE_TO_ROOT' , 'Restor...
Updates the edit form with a restore button if it is being viewed
42,886
protected function shouldDisplayAction ( $ record ) { $ admin = $ this -> owner -> popupController ; $ hasFileSaved = $ record instanceof File ? $ record -> exists ( ) : true ; return ( $ hasFileSaved && $ admin instanceof ArchiveAdmin && DataObject :: has_extension ( $ record , Versioned :: class ) && $ record -> canR...
Returns whether the restore action should be displayed
42,887
public function doRestore ( $ data , $ form ) { $ record = $ this -> owner -> getRecord ( ) ; $ message = RestoreAction :: restore ( $ record ) ; $ controller = $ this -> owner -> popupController ; $ controller -> getRequest ( ) -> addHeader ( 'X-Pjax' , 'Content' ) ; $ controller -> getEditForm ( ) -> sessionMessage (...
Restore the record to its original place or top level if that s not possible
42,888
public function getPreviewEnabled ( ) { $ record = $ this -> getSourceRecord ( ) ; $ previewEnabled = $ record && $ record instanceof CMSPreviewable ; $ this -> extend ( 'updatePreviewEnabled' , $ previewEnabled , $ record ) ; return $ previewEnabled ; }
Get whether the record is previewable
42,889
public function getSchemaDataDefaults ( ) { $ data = parent :: getSchemaDataDefaults ( ) ; $ sourceRecord = $ this -> getSourceRecord ( ) ; $ data [ 'data' ] = array_merge ( $ data [ 'data' ] , [ 'recordId' => $ sourceRecord ? $ sourceRecord -> ID : null , 'recordClass' => $ sourceRecord ? $ sourceRecord -> ClassName :...
Provide the necessary input data for React to power the history viewer
42,890
public function getEditForm ( $ id = null , $ fields = null ) { $ fields = FieldList :: create ( ) ; $ modelClass = $ this -> request -> getVar ( 'others' ) ? 'others' : $ this -> modelClass ; $ classInst = Injector :: inst ( ) -> get ( $ this -> modelClass ) ; if ( ClassInfo :: hasMethod ( $ classInst , 'getArchiveFie...
Produces an edit form with relevant prioritised tabs for Pages Blocks and Files
42,891
public static function createArchiveGridField ( $ title , $ class ) { $ config = GridFieldConfig_Base :: create ( ) ; $ config -> removeComponentsByType ( VersionedGridFieldState :: class ) ; $ config -> removeComponentsByType ( GridFieldFilterHeader :: class ) ; $ config -> addComponent ( new GridFieldDetailForm ) ; $...
Create a gridfield which displays archived objects
42,892
public function Breadcrumbs ( $ unlinked = false ) { $ items = parent :: Breadcrumbs ( $ unlinked ) ; $ items [ 0 ] -> Title = $ this -> menu_title ( ) ; return $ items ; }
Use Archives as the top title rather than the model title
42,893
public function getManagedModels ( ) { $ models = $ this -> getVersionedModels ( ) ; foreach ( $ models as $ k => $ v ) { $ archivedModels [ $ v ] = array ( 'title' => ucfirst ( singleton ( $ v ) -> i18n_plural_name ( ) ) ) ; unset ( $ archivedModels [ $ k ] ) ; } return $ archivedModels ; }
Archive admin needs some extra logic for whether an archive tab should be shown
42,894
public function getManagedModelTabs ( ) { $ forms = ArrayList :: create ( ) ; $ mainModels = $ this -> getVersionedModels ( 'main' , true ) ; foreach ( $ mainModels as $ class => $ title ) { $ classInst = Injector :: inst ( ) -> get ( $ class ) ; if ( ClassInfo :: hasMethod ( $ classInst , 'isArchiveFieldEnabled' ) && ...
Add the special Others tab
42,895
protected function removeSelectedRightTitles ( FieldList $ fields ) { $ noRightTitle = [ 'MetaDescription' , 'ExtraMeta' ] ; foreach ( $ noRightTitle as $ fieldName ) { if ( $ field = $ fields -> dataFieldByName ( $ fieldName ) ) { $ field -> setRightTitle ( '' ) ; } } }
Remove right titles from selected form fields by default
42,896
public function getRequestToken ( $ callback = 'oob' ) { $ request = $ this -> createRequest ( '/oauth/request_token' , OAuthResponse :: FORMAT_STR ) ; $ request -> setOAuthParameter ( 'oauth_callback' , $ callback ) ; $ this -> signRequest ( $ request , new OAuthToken ( ) ) ; return $ this -> createOAuthToken ( $ this...
Gets a request token .
42,897
public function getAccessToken ( OAuthToken $ requestToken , $ verifier ) { $ request = $ this -> createRequest ( '/oauth/access_token' , OAuthResponse :: FORMAT_STR ) ; $ request -> setOAuthParameter ( 'oauth_verifier' , $ verifier ) ; $ this -> signRequest ( $ request , $ requestToken ) ; return $ this -> createOAuth...
Gets an access token .
42,898
public function getBearerToken ( $ grantType = 'client_credentials' ) { $ request = $ this -> createRequest ( '/oauth2/token' ) ; $ request -> setPostParameter ( 'grant_type' , $ grantType ) ; $ this -> signRequest ( $ request , new BasicToken ( ) ) ; return $ this -> createBearerToken ( $ this -> sendRequest ( $ reque...
Gets a bearer token .
42,899
public function invalidateBearerToken ( BearerToken $ token ) { $ request = $ this -> createRequest ( '/oauth2/invalidate_token' ) ; $ request -> setPostParameter ( 'access_token' , $ token -> getValue ( ) ) ; $ this -> signRequest ( $ request , new BasicToken ( ) ) ; $ response = $ this -> sendRequest ( $ request ) ; ...
Invalidates the bearer token .