idx int64 0 60.3k | question stringlengths 99 4.85k | target stringlengths 5 718 |
|---|---|---|
10,400 | private function isWritable ( ServerRequestInterface $ request , ResponseInterface $ response ) : bool { if ( $ request -> getMethod ( ) !== 'GET' ) { return false ; } if ( $ response -> getStatusCode ( ) !== 200 ) { return false ; } $ cacheControl = $ response -> getHeaderLine ( 'Cache-Control' ) ; if ( stripos ( $ ca... | Check whether the response is writable or not . |
10,401 | public function getConfiguration ( ) { $ rest = $ this -> getService ( self :: API_NAT_DMZ ) ; $ rest -> GET ( ) ; return $ rest -> getResult ( models \ NAT \ DmzConfig :: class ) ; } | Get the current Dmz configuration |
10,402 | public function setConfiguration ( models \ NAT \ DmzConfig $ dmzConfig ) { $ rest = $ this -> getService ( self :: API_NAT_DMZ ) ; $ rest -> PUT ( $ dmzConfig ) ; return $ rest -> getResult ( models \ NAT \ DmzConfig :: class ) ; } | Update the current Dmz configuration |
10,403 | public function create ( models \ Call \ ContactAddress $ contactAddress ) { $ rest = $ this -> getService ( self :: API_ADDRESS ) ; $ rest -> POST ( $ contactAddress ) ; return $ rest -> getResult ( models \ Call \ ContactAddress :: class ) ; } | Add an address |
10,404 | public function update ( models \ Call \ ContactAddress $ contactAddress ) { $ rest = $ this -> getService ( self :: API_ADDRESS . $ contactAddress -> getId ( ) ) ; $ rest -> PUT ( $ contactAddress ) ; return $ rest -> getResult ( models \ Call \ ContactAddress :: class ) ; } | Update an address |
10,405 | public function setOption ( string $ option , $ value ) : object { $ this -> options [ $ option ] = $ value ; return $ this ; } | Set a single option for configuration and connection details . |
10,406 | public function connect ( ) : object { if ( $ this -> pdo ) { return $ this ; } if ( ! isset ( $ this -> options [ "dsn" ] ) ) { throw new Exception ( "You can not connect, missing dsn." ) ; } try { $ this -> pdo = new \ PDO ( $ this -> options [ "dsn" ] , $ this -> options [ "username" ] , $ this -> options [ "passwor... | Connect to the database allow being called multiple times but ignore when connection is already made . |
10,407 | public function executeFetchClass ( string $ query , array $ params , string $ class ) : ? object { return $ this -> execute ( $ query , $ params ) -> fetchClass ( $ class ) ; } | Execute a select - query with arguments and insert the results into a new object of the class . |
10,408 | public function executeFetchInto ( string $ query , array $ params , object $ object ) : ? object { return $ this -> execute ( $ query , $ params ) -> fetchInto ( $ object ) ; } | Execute a select - query with arguments and insert the results into an existing object . |
10,409 | public function fetchClass ( string $ classname ) : ? object { $ this -> stmt -> setFetchMode ( \ PDO :: FETCH_CLASS , $ classname ) ; return $ this -> fetch ( ) ; } | Fetch one resultset as a new object from this class . |
10,410 | public function fetchAllClass ( string $ classname ) : array { $ this -> stmt -> setFetchMode ( \ PDO :: FETCH_CLASS , $ classname ) ; return $ this -> stmt -> fetchAll ( ) ; } | Fetch all rows as the resultset instantiated as new objects from this class . |
10,411 | protected function createException ( string $ msg , string $ query , array $ params ) : void { throw new Exception ( $ msg . "<br><br>SQL (" . substr_count ( $ query , "?" ) . " params):<br><pre>$query</pre><br>PARAMS (" . count ( $ params ) . "):<br><pre>" . implode ( $ params , "\n" ) . "</pre>" ) ; } | Throw exception with detailed message . |
10,412 | protected function pdoException ( string $ query , array $ params ) : void { $ this -> createException ( $ this -> pdo -> errorInfo ( ) [ 2 ] , $ query , $ params ) ; } | Throw exception when pdo failed using detailed message . |
10,413 | protected function statementException ( string $ query , array $ params ) : void { $ this -> createException ( $ this -> stmt -> errorInfo ( ) [ 2 ] , $ query , $ params ) ; } | Throw exception when statement failed using detailed message . |
10,414 | public function between ( LatLong $ pointA , LatLong $ pointB ) { if ( ! empty ( $ this -> points ) ) { throw new \ RuntimeException ( 'The between() method can only be called when it is the first set or co-ordinates.' ) ; } $ this -> addPoint ( $ pointA ) ; $ this -> addPoint ( $ pointB ) ; return $ this ; } | Helper method to get distance between two points . |
10,415 | private function calculate ( ) { if ( count ( $ this -> points ) < 2 ) { throw new \ RuntimeException ( 'There must be two or more points (co-ordinates) before a calculation can be performed.' ) ; } $ total = 0 ; foreach ( $ this -> points as $ point ) { if ( isset ( $ previous ) ) { $ total += $ this -> distanceBetwee... | Calculates the distance between each of the points . |
10,416 | public function canAccess ( string $ scope ) { $ scopes = func_get_args ( ) ; $ diff = array_diff ( $ scopes , $ this -> scope ) ; return count ( $ diff ) > 0 ; } | Check if token can access one or more scope |
10,417 | public function getAll ( ) { $ rest = $ this -> getService ( self :: API_STORAGE_DISK ) ; $ rest -> GET ( ) ; return $ rest -> getResultAsArray ( models \ Storage \ StorageDisk :: class ) ; } | Get the list of disks |
10,418 | public function getFromId ( $ diskId ) { $ rest = $ this -> getService ( self :: API_STORAGE_DISK . $ diskId ) ; $ rest -> GET ( ) ; return $ rest -> getResult ( models \ Storage \ StorageDisk :: class ) ; } | Get a given disk info |
10,419 | public function update ( models \ Storage \ StorageDisk $ storageDisk ) { $ rest = $ this -> getService ( self :: API_STORAGE_DISK . $ storageDisk -> getId ( ) ) ; $ rest -> PUT ( $ storageDisk ) ; return $ rest -> getResult ( models \ Storage \ StorageDisk :: class ) ; } | Update a disk state |
10,420 | public function format ( models \ Storage \ StorageDisk $ storageDisk , $ label , $ fsType , $ tableType ) { $ rest = $ this -> getService ( self :: API_STORAGE_DISK . $ storageDisk -> getId ( ) ) ; $ rest -> PUT ( [ 'label' => $ label , 'fs_type' => $ fsType , 'table_type' => $ tableType , ] ) ; return $ rest -> getSu... | Format the disk with the given id There will be one partition using all the available space on disk . All previous data will be lost . Parameters will be ignored if you format the Freebox internal disk |
10,421 | public function createBatch ( EntityInterface $ entity ) { if ( is_null ( $ this -> putBatch ) ) { $ this -> putBatch = WriteRequestBatch :: factory ( $ this -> dynamoDb ) ; } $ this -> putBatch -> add ( new PutRequest ( Item :: fromArray ( $ entity -> getArrayCopy ( ) ) , $ this -> getEntityTable ( $ entity ) ) ) ; } | Add entity to the batch creation |
10,422 | public function deleteBatch ( EntityInterface $ entity ) { if ( is_null ( $ this -> deleteBatch ) ) { $ this -> deleteBatch = WriteRequestBatch :: factory ( $ this -> dynamoDb ) ; } $ this -> deleteBatch -> add ( new DeleteRequest ( $ this -> formatKeyCondition ( $ entity ) , $ this -> getEntityTable ( $ entity ) ) ) ;... | Add entity to the batch deletion |
10,423 | public function setEntityArguments ( $ entityClass , array $ arguments ) { $ this -> entityArguments [ $ this -> getEntityClass ( $ entityClass ) ] = $ arguments ; return $ this ; } | Set the additional arguments used to instantiate an entity . |
10,424 | protected function getEntityClass ( $ entityClass ) { if ( ! isset ( $ this -> entityClasses [ $ entityClass ] ) ) { $ found = class_exists ( $ entityClass ) ; if ( $ found ) { $ reflection = new \ ReflectionClass ( $ entityClass ) ; $ fqcn = '\\' . $ reflection -> getName ( ) ; } elseif ( strpos ( '\\' , $ entityClass... | Returns the entity s fully qualified class name . |
10,425 | protected function getEntityTable ( $ entity ) { if ( ! $ entity instanceof EntityInterface ) { $ entity = $ this -> getEntityClass ( $ entity ) ; } return $ this -> tablePrefix . $ entity :: getTable ( ) . $ this -> tableSuffix ; } | Returns the entity s table name as defined in DynamoDB . |
10,426 | protected function initEntity ( $ entityClass , $ primaryKey ) { $ primaryKey = ( array ) $ primaryKey ; if ( ! isset ( $ primaryKey [ 0 ] ) ) { throw new \ InvalidArgumentException ( 'Hash key is required' ) ; } $ entity = $ this -> entityFactory ( $ entityClass ) -> setHashKey ( $ primaryKey [ 0 ] ) ; if ( isset ( $ ... | Initializes an entity with a primary and range key . |
10,427 | protected function formatPutItemCommandOptions ( EntityInterface $ entity , $ mustExist ) { $ attributes = array ( $ entity :: getHashKeyAttribute ( ) => $ entity -> getHashKey ( ) ) ; $ rangeKeyAttribute = $ entity :: getRangeKeyAttribute ( ) ; if ( $ rangeKeyAttribute ) { $ attributes [ $ rangeKeyAttribute ] = $ enti... | Returns baseline options for putItem commands . |
10,428 | protected function formatEntityAttributes ( EntityInterface $ entity , $ format = Attribute :: FORMAT_PUT ) { return $ this -> formatAttributes ( get_class ( $ entity ) , $ entity -> getAttributes ( ) ) ; } | Formats an entity s attributes to the SDK s native data structure . |
10,429 | protected function formatAttributes ( $ entityClass , array $ attributes , $ format = Attribute :: FORMAT_PUT ) { $ entityClass = $ this -> getEntityClass ( $ entityClass ) ; $ formatted = array ( ) ; $ mappings = $ entityClass :: getDataTypeMappings ( ) ; foreach ( $ attributes as $ attribute => $ value ) { if ( isset... | Formats an array of attributes to the SDK s native data structure . |
10,430 | protected function formatConditions ( $ entityClass , ConditionsInterface $ conditions ) { $ rendered = array ( ) ; foreach ( $ conditions -> getConditions ( ) as $ attribute => $ condition ) { $ rendered [ $ attribute ] = array ( 'ComparisonOperator' => $ condition [ 'operator' ] , ) ; if ( isset ( $ condition [ 'valu... | Renders the key conditions . |
10,431 | protected function executeSearchCommand ( $ entityClass , $ commandOptions , $ command , $ optionKey ) { if ( $ commandOptions instanceof ConditionsInterface ) { $ commandOptions = array ( $ optionKey => $ this -> formatConditions ( $ entityClass , $ commandOptions ) ) + $ commandOptions -> getOptions ( ) ; } elseif ( ... | Executes a scan or query command . |
10,432 | public static function loadContextFromFile ( string $ filePath ) : ContextInterface { if ( ! file_exists ( $ filePath ) ) { throw new Exception \ FileNotFoundException ( 'Context file not found: ' . $ filePath , 404 , null , $ filePath ) ; } $ contents = file_get_contents ( $ filePath ) ; $ context_array = json_decode ... | Load Context From file the file must have only json context inside . |
10,433 | public function getContextData ( ) : Array { return [ 'id' => $ this -> getId ( ) , 'name' => $ this -> getName ( ) , 'client_id' => $ this -> getClientId ( ) , 'client_secret' => $ this -> getClientSecret ( ) , 'application_type' => $ this -> getApplicationType ( ) , 'redirect_uris' => $ this -> getRedirectUris ( ) , ... | Get context data as array |
10,434 | public function getNetworks ( ) { $ rest = $ this -> getService ( self :: API_FREEPLUG ) ; $ rest -> GET ( ) ; return $ rest -> getResultAsArray ( models \ Freeplug \ FreeplugNetwork :: class ) ; } | Get the freeplug networks information |
10,435 | public function getFromId ( $ FreeplugId ) { $ rest = $ this -> getService ( self :: API_FREEPLUG . $ FreeplugId . DIRECTORY_SEPARATOR ) ; $ rest -> GET ( ) ; return $ rest -> getResult ( models \ Freeplug \ Freeplug :: class ) ; } | Get a particular Freeplug information |
10,436 | public function resetFromId ( $ FreeplugId ) { $ Service = sprintf ( self :: API_FREEPLUG_RESET , $ FreeplugId ) ; $ rest = $ this -> getService ( $ Service ) ; $ rest -> POST ( ) ; return $ rest -> getSuccess ( ) ; } | Reset a Freeplug |
10,437 | private function getEncodingTypeMiddleware ( ) { return static function ( callable $ handler ) { return function ( Command $ command , $ request = null ) use ( $ handler ) { $ autoSet = false ; if ( $ command -> getName ( ) === 'ListObjects' && empty ( $ command [ 'EncodingType' ] ) ) { $ command [ 'EncodingType' ] = '... | Provides a middleware that autopopulates the EncodingType parameter on ListObjects commands . |
10,438 | protected static function convertBase ( $ input , $ fromBase , $ toBase ) { if ( $ fromBase === $ toBase ) { return $ input ; } elseif ( $ fromBase === self :: BASE10 ) { return static :: fromBase10 ( $ input , $ toBase ) ; } elseif ( $ toBase === self :: BASE10 ) { return static :: toBase10 ( $ input , $ fromBase ) ; ... | Convert numerical string between bases |
10,439 | protected static function toBase10 ( $ input , $ fromBase ) { $ len = strlen ( $ fromBase ) ; $ res = '0' ; foreach ( str_split ( $ input ) as $ char ) { $ res = bcadd ( ( int ) strpos ( $ fromBase , $ char ) , bcmul ( $ res , $ len ) ) ; } return $ res ; } | Convert to decimal string |
10,440 | protected static function fromBase10 ( $ input , $ toBase ) { $ len = strlen ( $ toBase ) ; $ res = '' ; do { $ digit = bcmod ( $ input , $ len ) ; $ res = $ toBase [ ( int ) $ digit ] . $ res ; $ input = bcdiv ( $ input , $ len , 0 ) ; } while ( $ input != '0' ) ; return $ res ; } | Convert from decimal string |
10,441 | protected function getTimestamp ( ) { $ num = bcadd ( bcmul ( ( microtime ( true ) - strtotime ( static :: $ epoch ) ) , 100000000 ) , $ this -> getSequence ( ) % 10000 ) ; return substr ( '00' . static :: fromBase10 ( $ num , self :: BASE16 ) , - 15 ) ; } | Time related part |
10,442 | protected static function getFilename ( string $ path ) : string { $ parts = pathinfo ( urldecode ( $ path ) ) ; $ path = isset ( $ parts [ 'dirname' ] ) ? $ parts [ 'dirname' ] : '' ; $ filename = isset ( $ parts [ 'basename' ] ) ? $ parts [ 'basename' ] : '' ; if ( empty ( $ parts [ 'extension' ] ) ) { $ filename .= ... | Resolve the filename of the response file . |
10,443 | public function longestCommonSubsequence ( array $ sequenceA , array $ sequenceB ) { if ( func_num_args ( ) > 2 ) { $ arguments = func_get_args ( ) ; array_splice ( $ arguments , 0 , 2 , array ( $ this -> longestCommonSubsequence ( $ sequenceA , $ sequenceB ) ) ) ; return call_user_func_array ( array ( $ this , 'longes... | Returns the longest common subsequence of the given sequences . |
10,444 | public function getAll ( ) { $ rest = $ this -> getService ( self :: API_WIFI_BSS ) ; $ rest -> GET ( ) ; return $ rest -> getResultAsArray ( models \ WiFi \ Bss \ Bss :: class ) ; } | Get the list of Freebox BSS |
10,445 | public function getFromId ( $ BssId ) { $ rest = $ this -> getService ( self :: API_WIFI_BSS . $ BssId ) ; $ rest -> GET ( ) ; return $ rest -> getResult ( models \ WiFi \ Bss \ Bss :: class ) ; } | Get a specific BSS |
10,446 | public function update ( models \ WiFi \ Bss \ Bss $ Bss ) { $ rest = $ this -> getService ( self :: API_WIFI_BSS . $ Bss -> getId ( ) ) ; $ rest -> PUT ( $ Bss ) ; return $ rest -> getResult ( models \ WiFi \ Bss \ Bss :: class ) ; } | Update a BSS |
10,447 | public function getAll ( ) { $ rest = $ this -> getService ( self :: API_CONTACT ) ; $ rest -> GET ( ) ; return $ rest -> getResultAsArray ( models \ Call \ ContactEntry :: class ) ; } | List all contacts |
10,448 | public function getFromId ( $ ContactEntryId ) { $ rest = $ this -> getService ( self :: API_CONTACT . $ ContactEntryId ) ; $ rest -> GET ( ) ; return $ rest -> getResult ( models \ Call \ ContactEntry :: class ) ; } | Get a specific contact entry |
10,449 | public function create ( models \ Call \ ContactEntry $ ContactEntry ) { $ rest = $ this -> getService ( self :: API_CONTACT ) ; $ rest -> POST ( $ ContactEntry ) ; return $ rest -> getResult ( models \ Call \ ContactEntry :: class ) ; } | Add a contact entry |
10,450 | public function update ( models \ Call \ ContactEntry $ ContactEntry ) { $ rest = $ this -> getService ( self :: API_CONTACT . $ ContactEntry -> getId ( ) ) ; $ rest -> PUT ( $ ContactEntry ) ; return $ rest -> getResult ( models \ Call \ ContactEntry :: class ) ; } | Update a contact entry |
10,451 | public function getContactNumbersFromContactId ( $ ContactEntryId ) { $ service = sprintf ( self :: API_CONTACT_NUMBERS , $ ContactEntryId ) ; $ rest = $ this -> getService ( $ service ) ; $ rest -> GET ( ) ; return $ rest -> getResultAsArray ( models \ Call \ ContactNumber :: class ) ; } | Get all numbers associated to a given contact id |
10,452 | public function getContactAddressesFromContactId ( $ ContactEntryId ) { $ service = sprintf ( self :: API_CONTACT_ADDRESSES , $ ContactEntryId ) ; $ rest = $ this -> getService ( $ service ) ; $ rest -> GET ( ) ; return $ rest -> getResultAsArray ( models \ Call \ ContactAddress :: class ) ; } | Get all addresses associated to a given contact id |
10,453 | public function getContactEmailsFromContactId ( $ ContactEntryId ) { $ service = sprintf ( self :: API_CONTACT_EMAILS , $ ContactEntryId ) ; $ rest = $ this -> getService ( $ service ) ; $ rest -> GET ( ) ; return $ rest -> getResultAsArray ( models \ Call \ ContactEmail :: class ) ; } | Get all email addresses associated to a given contact id |
10,454 | public function getContactUrlsFromContactId ( $ ContactEntryId ) { $ service = sprintf ( self :: API_CONTACT_URLS , $ ContactEntryId ) ; $ rest = $ this -> getService ( $ service ) ; $ rest -> GET ( ) ; return $ rest -> getResultAsArray ( models \ Call \ ContactUrl :: class ) ; } | Get all URLs associated to a given contact id |
10,455 | public function getAll ( ) { $ rest = $ this -> getService ( self :: API_NAT_REDIR ) ; $ rest -> GET ( ) ; return $ rest -> getResultAsArray ( models \ NAT \ PortForwardingConfig :: class ) ; } | Getting the list of port forwarding |
10,456 | public function getById ( $ PortForwarding_id ) { $ rest = $ this -> getService ( self :: API_NAT_REDIR . $ PortForwarding_id ) ; $ rest -> GET ( ) ; return $ rest -> getResult ( models \ NAT \ PortForwardingConfig :: class ) ; } | Getting a specific port forwarding |
10,457 | public function update ( models \ NAT \ PortForwardingConfig $ portForwardingConfig ) { $ rest = $ this -> getService ( self :: API_NAT_REDIR . $ portForwardingConfig -> getId ( ) ) ; $ rest -> PUT ( $ portForwardingConfig ) ; return $ rest -> getResult ( models \ NAT \ PortForwardingConfig :: class ) ; } | Update a specific port forwarding |
10,458 | public function add ( models \ NAT \ PortForwardingConfig $ portForwardingConfig ) { $ rest = $ this -> getService ( self :: API_NAT_REDIR ) ; $ rest -> POST ( $ portForwardingConfig ) ; return $ rest -> getResult ( models \ NAT \ PortForwardingConfig :: class ) ; } | Add a port forwarding |
10,459 | public function deleteById ( $ PortForwardingId ) { $ rest = $ this -> getService ( self :: API_NAT_REDIR . $ PortForwardingId ) ; $ rest -> DELETE ( ) ; return $ rest -> getSuccess ( ) ; } | Delete a port forwarding with the specified id |
10,460 | public static function is_binary_data ( $ data ) { if ( preg_match ( '!!u' , $ data ) ) { return false ; } $ characters = str_split ( $ data ) ; foreach ( $ characters as $ character ) { $ ord_value = ord ( $ character ) ; if ( $ ord_value < 0x20 or $ ord_value >= 0x7f ) { return true ; } } return false ; } | Determine whether the specified data is binary or not . |
10,461 | private function queueUrl ( ) { return static function ( callable $ handler ) { return function ( CommandInterface $ c , RequestInterface $ r = null ) use ( $ handler ) { if ( $ c -> hasParam ( 'QueueUrl' ) ) { $ uri = Uri :: resolve ( $ r -> getUri ( ) , $ c [ 'QueueUrl' ] ) ; $ r = $ r -> withUri ( $ uri ) ; } return... | Moves the URI of the queue to the URI in the input parameter . |
10,462 | private function validateMd5 ( ) { return static function ( callable $ handler ) { return function ( CommandInterface $ c , RequestInterface $ r = null ) use ( $ handler ) { if ( $ c -> getName ( ) !== 'ReceiveMessage' ) { return $ handler ( $ c , $ r ) ; } return $ handler ( $ c , $ r ) -> then ( function ( $ result )... | Validates ReceiveMessage body MD5s |
10,463 | public function getAll ( ) { $ rest = $ this -> getService ( self :: API_VPN_USER ) ; $ rest -> GET ( ) ; return $ rest -> getResultAsArray ( models \ VPN \ Server \ User :: class ) ; } | Get the list of VPNUser |
10,464 | public function getFromLogin ( $ login ) { $ rest = $ this -> getService ( self :: API_VPN_USER . $ login ) ; $ rest -> GET ( ) ; return $ rest -> getResult ( models \ VPN \ Server \ User :: class ) ; } | Gets the VPNUser with the given login |
10,465 | public function add ( models \ VPN \ Server \ User $ user ) { $ rest = $ this -> getService ( self :: API_VPN_USER ) ; $ rest -> POST ( $ user ) ; return $ rest -> getResult ( models \ VPN \ Server \ User :: class ) ; } | Creates a new VPNUser |
10,466 | public function delete ( models \ VPN \ Server \ User $ user ) { return $ this -> deleteFromLogin ( $ user -> getLogin ( ) ) ; } | Deletes the VPNUser |
10,467 | public function deleteFromLogin ( $ login ) { $ rest = $ this -> getService ( self :: API_VPN_USER . $ login ) ; $ rest -> DELETE ( ) ; return $ rest -> getSuccess ( ) ; } | Deletes the VPNUser with the given id |
10,468 | public function update ( models \ VPN \ Server \ User $ user ) { $ rest = $ this -> getService ( self :: API_VPN_USER . $ user -> getLogin ( ) ) ; $ rest -> PUT ( $ user ) ; return $ rest -> getResult ( models \ VPN \ Server \ User :: class ) ; } | Update a VPN Use |
10,469 | public function getConfigurationFile ( $ serverName , $ login ) { $ service = sprintf ( self :: API_VPN_USER_CONFIG , $ serverName , $ login ) ; $ rest = $ this -> getService ( $ service ) ; $ rest -> getConfig ( ) -> setIsReturnToJsonDecode ( false ) ; $ rest -> setIsResponseToCheck ( false ) ; $ rest -> GET ( ) ; ret... | Generate a new configuration file & download it |
10,470 | public static function getAuthorizationURL ( ContextInterface $ context ) { $ queryString = [ 'client_id' => $ context -> getClientId ( ) , 'client_secret' => $ context -> getClientSecret ( ) , 'redirect_uri' => $ context -> getRedirectUri ( ) , 'response_type' => 'code' , ] ; return SumUp :: ENTRYPOINT . self :: OAUTH... | Generate an url to merchant authorization . |
10,471 | public static function getAccessToken ( ContextInterface $ context , array $ scopes = null , array $ options = [ ] ) : AccessToken { $ formParams = [ 'grant_type' => 'client_credentials' , 'client_id' => $ context -> getClientId ( ) , 'client_secret' => $ context -> getClientSecret ( ) , ] ; if ( $ scopes !== null ) { ... | Request an acess token from sumup services . |
10,472 | public static function getValidToken ( ContextInterface $ context , AccessToken $ token = null , array $ scopes = null , array $ options = [ ] ) : AccessToken { if ( $ token === null || ! $ token -> isValid ( ) ) { $ token = AuthenticationHelper :: getAccessToken ( $ context , $ scopes , $ options ) ; } return $ token ... | If available check token or generate a new token |
10,473 | public function canLogException ( & $ e ) { if ( function_exists ( 'xdebug_get_function_stack' ) ) { if ( $ e instanceof ErrorException ) { return false ; } $ selectedException = $ e ; while ( $ nestedException = $ selectedException -> getPrevious ( ) ) { if ( $ nestedException instanceof ErrorException ) { $ ref = new... | Filter exception and its previous exceptions for yii \ base \ ErrorException Raven expects normal stacktrace but yii \ base \ ErrorException may have xdebug_get_function_stack |
10,474 | public function update ( models \ SwitchPort \ Config $ config ) { $ service = sprintf ( static :: API_SWITCH_PORT_CONFIG , $ config -> getId ( ) ) ; $ rest = $ this -> getService ( $ service ) ; $ rest -> PUT ( $ config ) ; return $ rest -> getResult ( models \ SwitchPort \ Config :: class ) ; } | Update a port configuration |
10,475 | public function getAll ( ) { $ rest = $ this -> getService ( self :: API_VPN_CONNECTION ) ; $ rest -> GET ( ) ; return $ rest -> getResultAsArray ( models \ VPN \ Server \ Connection :: class ) ; } | Get the list of connections |
10,476 | public function closeFromId ( $ connectionId ) { $ rest = $ this -> getService ( self :: API_VPN_CONNECTION . $ connectionId ) ; $ rest -> DELETE ( ) ; return $ rest -> getSuccess ( ) ; } | Close a given connection |
10,477 | public function getTickers ( array $ currencyPairs = [ ] , $ ignoreInvalid = false ) { $ impl = implode ( '-' , $ currencyPairs ) ; $ urlFragment = "ticker/$impl" ; return $ this -> public ( 'v3' , $ urlFragment , [ 'ignore_invalid' => ( int ) $ ignoreInvalid , ] ) ; } | Provides statistic data for the last 24 hours . |
10,478 | public function trade ( $ pair , $ type , $ rate , $ amount ) { return $ this -> tradeRequest ( 'Trade' , [ 'pair' => $ pair , 'type' => $ type , 'rate' => $ rate , 'amount' => $ amount , ] ) ; } | Method that allows creating new orders for stock exchange trading |
10,479 | public function getTradeHistory ( array $ options = [ ] ) { return $ this -> tradeRequest ( 'TradeHistory' , [ 'from' => $ options [ 'from' ] ?? null , 'count' => $ options [ 'count' ] ?? null , 'from_id' => $ options [ 'from_id' ] ?? null , 'end_id' => $ options [ 'end_id' ] ?? null , 'order' => $ options [ 'order' ] ... | Returns transaction history . While using option since or end parameter order automatically takes the value ASC . While using option since the earliest date available to get transaction history is one week ago . |
10,480 | private function getNonceOld ( ) { try { $ dir = storage_path ( 'exchange/yobit/' ) ; if ( ! file_exists ( $ dir ) ) { mkdir ( $ dir , '0777' , true ) ; } $ file = $ dir . 'nonce.txt' ; $ nonce = ( int ) file_get_contents ( $ file ) ; if ( empty ( $ nonce ) ) { $ nonce = floor ( microtime ( true ) ) ; } $ newNonce = $ ... | Yobit allows nonces starting from 1 up till 2147483646 which is the end of unix epoch 2147483646 = somewhere in the year 2038 |
10,481 | public function promise ( ) { if ( $ this -> promise ) { return $ this -> promise ; } return $ this -> promise = Promise \ coroutine ( function ( ) { if ( $ this -> state -> isCompleted ( ) ) { throw new \ LogicException ( 'This multipart upload has already ' . 'been completed or aborted.' ) ; } elseif ( ! $ this -> st... | Upload the source asynchronously using multipart upload operations . |
10,482 | private function execCommand ( $ operation , array $ params ) { $ command = $ this -> client -> getCommand ( $ this -> info [ 'command' ] [ $ operation ] , $ params + $ this -> state -> getId ( ) ) ; if ( is_callable ( $ this -> config [ "before_{$operation}" ] ) ) { $ this -> config [ "before_{$operation}" ] ( $ comma... | Executes a MUP command with all of the parameters for the operation . |
10,483 | private function getResultHandler ( & $ errors = [ ] ) { return function ( callable $ handler ) use ( & $ errors ) { return function ( CommandInterface $ command , RequestInterface $ request = null ) use ( $ handler , & $ errors ) { return $ handler ( $ command , $ request ) -> then ( function ( ResultInterface $ resul... | Returns a middleware for processing responses of part upload operations . |
10,484 | public function getStatus ( ) { $ rest = $ this -> getService ( self :: API_VPN_CLIENT_STATUS ) ; $ rest -> GET ( ) ; return $ rest -> getResult ( models \ VPN \ Client \ Status :: class ) ; } | Get the VPN client status |
10,485 | public function getLogs ( ) { $ rest = $ this -> getService ( self :: API_VPN_CLIENT_LOGS ) ; $ rest -> GET ( ) ; return $ rest -> getResult ( ) ; } | Get the VPN client Logs |
10,486 | public function itShouldFail ( $ success ) { if ( 'fail' === $ success ) { if ( 0 === $ this -> getExitCode ( ) ) { echo 'Actual output:' . PHP_EOL . PHP_EOL . $ this -> getOutput ( ) ; } \ PHPUnit_Framework_Assert :: assertNotEquals ( 0 , $ this -> getExitCode ( ) ) ; } else { if ( 0 !== $ this -> getExitCode ( ) ) { ... | Checks whether previously runned command failed|passed . |
10,487 | private function read ( ServerRequestInterface $ request , string $ file ) : ResponseInterface { $ resource = $ this -> filesystem -> readStream ( $ file ) ; if ( $ resource === false ) { throw new RuntimeException ( sprintf ( 'Unable to read the file "%s"' , $ file ) ) ; } $ response = $ this -> createResponse ( ) -> ... | Read a file and returns a stream . |
10,488 | private static function range ( ResponseInterface $ response , string $ range ) : ResponseInterface { $ response = $ response -> withHeader ( 'Accept-Ranges' , 'bytes' ) ; if ( empty ( $ range ) || ! ( $ range = self :: parseRangeHeader ( $ range ) ) ) { return $ response ; } list ( $ first , $ last ) = $ range ; $ siz... | Handle range requests . |
10,489 | public static function getDescription ( $ code ) { if ( array_key_exists ( $ code , self :: $ codes_to_string_map ) ) { return self :: $ codes_to_string_map [ $ code ] ; } else { return false ; } } | Get the description for a given HTTP status code |
10,490 | public function disablePaymentInstrument ( CustomerInterface $ customer , PaymentInstrumentInterface $ paymentInstrument ) : bool { $ instrumentClient = new PaymentInstrumentClient ( $ this -> getContext ( ) , $ this -> getOptions ( ) ) ; $ instrumentClient -> setCustomer ( $ customer ) ; $ instrumentClient -> setToken... | Delete a customer card . |
10,491 | public function getPaymentInstruments ( CustomerInterface $ customer ) : array { $ instrumentClient = new PaymentInstrumentClient ( $ this -> getContext ( ) , $ this -> getOptions ( ) ) ; $ instrumentClient -> setCustomer ( $ customer ) ; $ instrumentClient -> setToken ( $ this -> getToken ( ) ) ; $ response = $ instru... | This must return an Array of PaymentInstrumentInterface |
10,492 | public function getConfiguration ( ) { $ rest = $ this -> getService ( self :: API_LCD_CONFIG ) ; $ rest -> GET ( ) ; return $ rest -> getResult ( models \ LCDConfig :: class ) ; } | Get the current LCD configuration |
10,493 | public function setConfiguration ( models \ LCDConfig $ lcdConfig ) { $ rest = $ this -> getService ( self :: API_LCD_CONFIG ) ; $ rest -> PUT ( $ lcdConfig ) ; return $ rest -> getResult ( models \ LCDConfig :: class ) ; } | Update the LCD configuration |
10,494 | public function getStatus ( ) { $ rest = $ this -> getService ( self :: API_SWITCH_STATUS ) ; $ rest -> GET ( ) ; return $ rest -> getResult ( models \ SwitchPort \ Status :: class ) ; } | Get the current switch status |
10,495 | public function startWithTrashed ( ) { $ this -> reset ( new Action ( __METHOD__ , [ ] , Action :: INTERNAL ) ) ; $ this -> getCurrentPlan ( ) -> startWithTrashed ( ) ; return $ this ; } | Include soft deletes for following use will triggering a Reset flow . |
10,496 | public function startWithTrashedOnly ( ) { $ this -> reset ( new Action ( __METHOD__ , [ ] , Action :: INTERNAL ) ) ; $ this -> getCurrentPlan ( ) -> startWithTrashedOnly ( ) ; return $ this ; } | Only include soft deletes for following use will triggering a Reset flow . |
10,497 | public function getPlanning ( ) { $ rest = $ this -> getService ( self :: API_WIFI_PLANNING ) ; $ rest -> GET ( ) ; return $ rest -> getResult ( models \ WiFi \ Planning :: class ) ; } | Get the wifi planning |
10,498 | public function update ( models \ WiFi \ Planning $ planning ) { $ rest = $ this -> getService ( self :: API_WIFI_PLANNING ) ; $ rest -> PUT ( $ planning ) ; return $ rest -> getResult ( models \ WiFi \ Planning :: class ) ; } | Update the wifi planning |
10,499 | public function export ( ) { $ out = array ( ) ; if ( Encoding :: is_binary_data ( $ this -> content ) ) { $ out [ 'content-bin' ] = base64_encode ( $ this -> content ) ; } else { $ out [ 'content' ] = $ this -> content ; } return $ out ; } | message content is binary or not . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.