idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
49,600 | public function create ( string $ code ) : array { $ stmt = $ this -> parser -> parse ( $ code ) ; return $ this -> traverser -> traverse ( $ stmt ) ; } | Will convert the provided code to nodes . |
49,601 | protected function doCreate ( $ object , StrategyContainer $ strategies , ? Context $ context = null ) { $ docBlock = $ this -> createDocBlock ( $ strategies , $ object -> getDocComment ( ) , $ context ) ; $ trait = new TraitElement ( $ object -> fqsen , $ docBlock , new Location ( $ object -> getLine ( ) ) ) ; if ( is... | Creates an TraitElement out of the given object . |
49,602 | public function download ( array $ options ) { $ requestUrl = null ; $ requestOptions = [ 'headers' => [ 'Authorization' => $ this -> authToken , ] , 'sink' => isset ( $ options [ 'SaveAs' ] ) ? $ options [ 'SaveAs' ] : null , ] ; if ( isset ( $ options [ 'FileId' ] ) ) { $ requestOptions [ 'query' ] = [ 'fileId' => $ ... | Download a file from a B2 bucket . |
49,603 | public function uploadLargeFile ( array $ options ) { if ( substr ( $ options [ 'FileName' ] , 0 , 1 ) === '/' ) { $ options [ 'FileName' ] = ltrim ( $ options [ 'FileName' ] , '/' ) ; } if ( substr ( $ options [ 'FilePath' ] , - 1 ) != '/' ) { $ options [ 'FilePath' ] = $ options [ 'FilePath' ] . '/' ; } if ( ! isset ... | Uploads a large file using b2 large file proceedure . |
49,604 | protected function startLargeFile ( $ fileName , $ contentType , $ bucketId ) { $ response = $ this -> generateAuthenticatedClient ( [ 'fileName' => $ fileName , 'contentType' => $ contentType , 'bucketId' => $ bucketId , ] ) -> request ( 'POST' , '/b2_start_large_file' ) ; return $ response ; } | starts the large file upload process . |
49,605 | protected function uploadParts ( $ filePath , $ uploadUrl , $ largeFileAuthToken ) { $ return = [ ] ; $ minimum_part_size = 100 * ( 1000 * 1000 ) ; $ local_file_size = filesize ( $ filePath ) ; $ total_bytes_sent = 0 ; $ bytes_sent_for_part = $ minimum_part_size ; $ sha1_of_parts = [ ] ; $ part_no = 1 ; $ file_handle =... | uploads the file as parts of 100MB each . |
49,606 | protected function finishLargeFile ( $ fileId , array $ sha1s ) { $ response = $ this -> generateAuthenticatedClient ( [ 'fileId' => $ fileId , 'partSha1Array' => $ sha1s , ] ) -> request ( 'POST' , '/b2_finish_large_file' ) ; return new File ( $ response [ 'fileId' ] , $ response [ 'fileName' ] , $ response [ 'content... | finishes the large file upload proceedure . |
49,607 | public function request ( $ method , $ uri = null , array $ options = [ ] , $ asJson = true ) { $ response = parent :: request ( $ method , $ uri , $ options ) ; if ( $ response -> getStatusCode ( ) !== 200 ) { ErrorHandler :: handleErrorResponse ( $ response ) ; } if ( $ asJson ) { return json_decode ( $ response -> g... | Sends a response to the B2 API automatically handling decoding JSON and errors . |
49,608 | public static function get ( $ id ) { if ( file_exists ( Utils \ get_snapshot_directory ( ) . $ id . '/meta.json' ) ) { $ meta_file_contents = file_get_contents ( Utils \ get_snapshot_directory ( ) . $ id . '/meta.json' ) ; $ meta = json_decode ( $ meta_file_contents , true ) ; } else { $ meta = [ ] ; } if ( empty ( $ ... | Given an ID create a WP Snapshots object |
49,609 | public static function download ( $ id , $ repository_name ) { if ( Utils \ is_snapshot_cached ( $ id ) ) { Log :: instance ( ) -> write ( 'Snapshot found in cache.' ) ; return self :: get ( $ id ) ; } $ create_dir = Utils \ create_snapshot_directory ( $ id ) ; if ( ! $ create_dir ) { Log :: instance ( ) -> write ( 'Ca... | Download snapshot . |
49,610 | public function push ( ) { if ( $ this -> remote ) { Log :: instance ( ) -> write ( 'Snapshot already pushed.' , 0 , 'error' ) ; return false ; } $ repository = RepositoryManager :: instance ( ) -> setup ( $ this -> repository_name ) ; if ( ! $ repository ) { Log :: instance ( ) -> write ( 'Could not setup repository.'... | Push snapshot to repository |
49,611 | private function is_text_col ( $ type ) { foreach ( array ( 'text' , 'varchar' ) as $ token ) { if ( false !== strpos ( $ type , $ token ) ) { return true ; } } return false ; } | Check if column type is text |
49,612 | private function php_handle_col ( $ col , $ primary_keys , $ table ) { global $ wpdb ; $ count = 0 ; $ table_sql = $ this -> esc_sql_ident ( $ table ) ; $ col_sql = $ this -> esc_sql_ident ( $ col ) ; $ where = " WHERE $col_sql" . $ wpdb -> prepare ( ' LIKE %s' , '%' . $ wpdb -> esc_like ( $ this -> old ) . '%' ) ; $ p... | Use PHP to run search and replace on a column . This is mostly used for serialized data . Returns number of updates made |
49,613 | private function php_search_replace ( $ data , $ serialised , $ recursion_level = 0 , $ visited_data = array ( ) ) { try { if ( $ this -> max_recursion !== 0 && $ recursion_level >= $ this -> max_recursion ) { return $ data ; } if ( is_array ( $ data ) || is_object ( $ data ) ) { if ( in_array ( $ data , $ visited_data... | Perform php search and replace on data . Returns updated data |
49,614 | public static function get ( ) { Log :: instance ( ) -> write ( 'Reading configuration from file.' , 1 ) ; $ file_path = Utils \ get_snapshot_directory ( ) . 'config.json' ; if ( ! file_exists ( $ file_path ) ) { $ file_path = $ _SERVER [ 'HOME' ] . '/.wpsnapshots.json' ; if ( ! file_exists ( $ file_path ) ) { Log :: i... | Create config from file |
49,615 | public function write ( ) { Log :: instance ( ) -> write ( 'Writing config.' , 1 ) ; $ create_dir = Utils \ create_snapshot_directory ( ) ; if ( ! $ create_dir ) { Log :: instance ( ) -> write ( 'Cannot create necessary snapshot directory.' , 0 , 'error' ) ; return false ; } file_put_contents ( Utils \ get_snapshot_dir... | Write config to current config file |
49,616 | public function offsetGet ( $ offset ) { return isset ( $ this -> config [ $ offset ] ) ? $ this -> config [ $ offset ] : null ; } | Get array value by key |
49,617 | public function insertSnapshot ( $ id , $ snapshot ) { $ marshaler = new Marshaler ( ) ; $ snapshot_item = [ 'project' => strtolower ( $ snapshot [ 'project' ] ) , 'id' => $ id , 'time' => time ( ) , 'description' => $ snapshot [ 'description' ] , 'author' => $ snapshot [ 'author' ] , 'multisite' => $ snapshot [ 'multi... | Insert a snapshot into the DB |
49,618 | public function getSnapshot ( $ id ) { try { $ result = $ this -> client -> getItem ( [ 'ConsistentRead' => true , 'TableName' => 'wpsnapshots-' . $ this -> repository , 'Key' => [ 'id' => [ 'S' => $ id , ] , ] , ] ) ; } catch ( \ Exception $ e ) { if ( 'AccessDeniedException' === $ e -> getAwsErrorCode ( ) ) { Log :: ... | Get a snapshot given an id |
49,619 | public function createTables ( ) { try { $ this -> client -> createTable ( [ 'TableName' => 'wpsnapshots-' . $ this -> repository , 'AttributeDefinitions' => [ [ 'AttributeName' => 'id' , 'AttributeType' => 'S' , ] , ] , 'KeySchema' => [ [ 'AttributeName' => 'id' , 'KeyType' => 'HASH' , ] , ] , 'ProvisionedThroughput' ... | Create default DB tables . Only need to do this once ever for repo setup . |
49,620 | public function putSnapshot ( $ id , $ project , $ db_path , $ files_path ) { try { $ db_result = $ this -> client -> putObject ( [ 'Bucket' => self :: getBucketName ( $ this -> repository ) , 'Key' => $ project . '/' . $ id . '/data.sql.gz' , 'SourceFile' => realpath ( $ db_path ) , ] ) ; $ files_result = $ this -> cl... | Upload a snapshot to S3 given a path to files . tar . gz and data . sql . gz |
49,621 | public function createBucket ( ) { $ bucket_exists = false ; try { $ result = $ this -> client -> listBuckets ( ) ; } catch ( \ Exception $ e ) { Log :: instance ( ) -> write ( 'Error Message: ' . $ e -> getMessage ( ) , 1 , 'error' ) ; Log :: instance ( ) -> write ( 'AWS Request ID: ' . $ e -> getAwsRequestId ( ) , 1 ... | Create WP Snapshots S3 bucket |
49,622 | public function setOutput ( OutputInterface $ output ) { $ this -> output = $ output ; if ( $ output -> isDebug ( ) ) { $ this -> verbosity = 3 ; } elseif ( $ output -> isVeryVerbose ( ) ) { $ this -> verbosity = 2 ; } elseif ( $ output -> isVerbose ( ) ) { $ this -> verbosity = 1 ; } } | Do we want to log to the console? If so set the output interface . |
49,623 | public function setup ( $ repository_name = null ) { if ( empty ( $ this -> config [ 'repositories' ] ) ) { Log :: instance ( ) -> write ( 'No repositories in configuration.' , 1 ) ; return false ; } if ( empty ( $ repository_name ) ) { $ repository_name = $ this -> getDefault ( ) ; } if ( ! empty ( $ this -> repositor... | Set up a repository . This does not test the connection . |
49,624 | public function getDefault ( ) { if ( empty ( $ this -> config [ 'repositories' ] ) ) { return false ; } $ config = array_values ( $ this -> config [ 'repositories' ] ) ; return $ config [ 0 ] [ 'repository' ] ; } | Get default repository |
49,625 | public function merge ( $ key , $ value ) { if ( is_array ( $ value ) && is_array ( $ old = $ this -> get ( $ key ) ) ) { $ value = array_merge_recursive ( $ old , $ value ) ; } return $ this -> set ( $ key , $ value ) ; } | Merge values recursively . |
49,626 | public function decode ( string $ json , int $ options = null ) { if ( $ options !== null ) { return ( clone $ this ) -> decode ( $ json ) ; } $ shouldBeArray = $ this -> hasOption ( \ JSON_OBJECT_AS_ARRAY ) ; return $ this -> wrap ( function ( ) use ( $ json , $ shouldBeArray ) { return @ \ json_decode ( $ json , $ sh... | Wrapper for json_decode with predefined options that throws a Railt \ Component \ Json \ Exception \ JsonException when an error occurs . |
49,627 | public function withOptions ( int ... $ options ) : OptionsInterface { foreach ( $ options as $ option ) { $ this -> options |= $ option ; } return $ this ; } | Adds a list of passed options to existing ones . |
49,628 | public function withoutOptions ( int ... $ options ) : OptionsInterface { foreach ( $ options as $ option ) { $ this -> options &= ~ $ option ; } return $ this ; } | Removes the list of passed options from existing ones . |
49,629 | protected function buildTree ( int $ i = 0 , array & $ children = [ ] ) { $ max = \ count ( $ this -> trace ) ; while ( $ i < $ max ) { $ trace = $ this -> trace [ $ i ] ; if ( $ trace instanceof Entry ) { $ ruleName = $ trace -> getRule ( ) ; $ rule = $ this -> grammar -> fetch ( $ ruleName ) ; $ isRule = $ trace -> i... | Build AST from trace . Walk through the trace iteratively and recursively . |
49,630 | private function validateFieldsExistence ( ObjectDefinition $ object , InterfaceDefinition $ interface ) : void { foreach ( $ interface -> getFields ( ) as $ field ) { $ this -> getCallStack ( ) -> push ( $ field ) ; $ exists = $ object -> hasField ( $ field -> getName ( ) ) ; if ( ! $ exists ) { $ this -> throwFieldNo... | Make sure that all the interface fields are implemented . |
49,631 | private function validateFieldCompatibility ( FieldDefinition $ interface , FieldDefinition $ object ) : void { $ this -> getValidator ( Inheritance :: class ) -> validate ( $ object , $ interface ) ; $ this -> validateArgumentExistence ( $ interface , $ object ) ; } | We are convinced that the fields have a comparable signature of the type . |
49,632 | private function validateArgumentExistence ( FieldDefinition $ interface , FieldDefinition $ object ) : void { foreach ( $ interface -> getArguments ( ) as $ argument ) { $ this -> getCallStack ( ) -> push ( $ argument ) ; $ exists = $ object -> hasArgument ( $ argument -> getName ( ) ) ; if ( ! $ exists ) { $ this -> ... | We are convinced that all the arguments of the parent fields were implemented in the child . |
49,633 | private function validateArgumentCompatibility ( ArgumentDefinition $ interface , ArgumentDefinition $ object ) : void { $ this -> getValidator ( Inheritance :: class ) -> validate ( $ object , $ interface ) ; } | We are convinced that the arguments have a comparable signature of the type . |
49,634 | private function unfold ( ) : bool { while ( 0 < \ count ( $ this -> todo ) ) { $ rule = \ array_pop ( $ this -> todo ) ; if ( $ rule instanceof Escape ) { $ this -> addTrace ( $ rule ) ; } else { $ out = $ this -> reduce ( $ this -> grammar -> fetch ( $ rule -> getRule ( ) ) , $ rule -> getData ( ) ) ; if ( $ out === ... | Unfold trace . |
49,635 | private function backtrack ( ) : bool { $ found = false ; do { $ last = \ array_pop ( $ this -> trace ) ; if ( $ last instanceof Entry ) { $ found = $ this -> grammar -> fetch ( $ last -> getRule ( ) ) instanceof Alternation ; } elseif ( $ last instanceof Escape ) { $ found = $ this -> grammar -> fetch ( $ last -> getR... | Backtrack the trace . |
49,636 | private function createStandardTypes ( ) : void { foreach ( $ this -> getStandardTypes ( ) as $ type ) { $ instance = new $ type ( $ this ) ; if ( $ instance instanceof TypeDefinition ) { $ this -> types [ $ instance -> getName ( ) ] = $ instance ; } else { $ this -> definitions [ ] = $ instance ; } } } | Creation and registration of types . |
49,637 | private function getStandardTypes ( ) : array { $ standard = [ BooleanType :: class , FloatType :: class , IDType :: class , IntType :: class , StringType :: class , AnyType :: class , DateTimeType :: class , Deprecation :: class , ] ; return \ array_merge ( $ standard , $ this -> additionalTypes ) ; } | Returns should return a list of all predefined GraphQL types . |
49,638 | public function getOptions ( ) : int { $ options = $ this -> traitGetOptions ( ) ; if ( ! ( bool ) ( $ options & \ JSON_THROW_ON_ERROR ) ) { $ options |= \ JSON_THROW_ON_ERROR ; } return $ options ; } | Returns options used while encoding and decoding JSON sources . |
49,639 | public function encode ( $ data , int $ options = null ) : string { if ( $ options !== null ) { return ( clone $ this ) -> encode ( $ data ) ; } return $ this -> wrap ( function ( ) use ( $ data ) { return @ \ json_encode ( $ data , $ this -> getOptions ( ) , $ this -> getRecursionDepth ( ) ) ; } ) ; } | Wrapper for JSON encoding logic with predefined options that throws a Railt \ Component \ Json \ Exception \ JsonException when an error occurs . |
49,640 | private function shareExceptionTrace ( ResponseInterface $ response ) : void { foreach ( $ response -> getExceptions ( ) as $ exception ) { if ( $ exception instanceof GraphQLExceptionInterface ) { $ exception -> withExtension ( new ExceptionTraceExtension ( $ exception ) ) ; } $ exception -> publish ( ) ; } } | Toggles all exceptions in response to debug mode . |
49,641 | public function setLogFile ( $ filePath ) { if ( $ this -> logFile != $ filePath && $ this -> fp ) { @ fclose ( $ this -> fp ) ; $ this -> fp = null ; } $ logDir = dirname ( $ filePath ) ; if ( ! file_exists ( $ logDir ) ) { @ mkdir ( $ logDir , 0755 , true ) ; } if ( ! file_exists ( $ logDir ) ) { throw new Exception ... | Set the log file path |
49,642 | public function log ( $ level , $ message , array $ context = [ ] ) { $ record = new LogRecord ( $ level , $ message ) ; $ this -> session -> addRecord ( $ record ) ; if ( $ this -> logLevel >= $ level ) { $ this -> write ( $ record ) ; } } | Log message of any level |
49,643 | public function write ( LogRecord $ record ) { $ logLine = array ( ) ; if ( $ record -> time ) { $ timestr = ( $ this -> logLevel >= self :: LEVEL_DEBUG ) ? $ this -> udate ( 'Y-m-d H:i:s.u T' , $ record -> time ) : date ( 'Y/m/d h:i:s' , $ record -> time ) ; $ logLine [ ] = "[ $timestr ]" ; } if ( $ record -> level !=... | Write log record into log |
49,644 | public function updateParameters ( Request $ request , array $ params ) { $ body = new Request ( [ 'asset' => [ 'params' => $ params ] ] ) ; $ this -> sendRequest ( 'PUT' , '/requests/' . $ request -> id , $ body ) ; } | Update request parameters |
49,645 | public function renderTemplate ( $ templateId , $ request ) { $ query = ( $ request instanceof Request ) ? $ request -> id : $ request ; return $ this -> sendRequest ( 'GET' , '/templates/' . $ templateId . '/render?request_id=' . $ query ) ; } | Gets Activation template for a given request |
49,646 | public function getNewItems ( ) { $ ret = array ( ) ; foreach ( $ this -> asset -> items as $ item ) { if ( ( $ item -> quantity > 0 ) && ( $ item -> old_quantity == 0 ) ) { $ ret [ ] = $ item ; } } return $ ret ; } | Get new SKUs purchased in the request |
49,647 | public function dumpTo ( LoggerInterface $ logger ) { if ( empty ( $ this -> sessionLog ) ) { return $ this ; } $ logger -> write ( new LogRecord ( null , "=== Detailed session log dump begin ==================" , null ) ) ; foreach ( $ this -> sessionLog as $ record ) { $ logger -> write ( $ record ) ; } $ logger -> w... | Dump session log to specified logger |
49,648 | public function setRuntimeServices ( $ runtimeServices ) { if ( ! in_array ( gettype ( $ runtimeServices ) , [ 'array' , 'object' ] ) ) { throw new \ InvalidArgumentException ( "The service provider list must be an array or an object, given " . gettype ( $ runtimeServices ) ) ; } $ this -> runtimeServices = array_merge... | Reconfigure the service builder list |
49,649 | public function setProducts ( $ product ) { if ( is_string ( $ product ) ) { $ product = [ $ product ] ; } if ( ! is_array ( $ product ) ) { throw new \ InvalidArgumentException ( "The product list must be an string or an array, given " . gettype ( $ product ) ) ; } $ this -> products = $ product ; } | Set the product list |
49,650 | public function listListings ( array $ filters = [ ] ) { $ query = '' ; if ( $ this -> config -> products ) { $ filters [ 'product__id' ] = $ this -> config -> products ; } if ( $ filters ) { $ query = '?' . preg_replace ( '/%5B[0-9]+%5D/simU' , '' , http_build_query ( $ filters ) ) ; } $ body = $ this -> sendRequest (... | Lists the product listings |
49,651 | public function getParameterByID ( $ id ) { $ param = current ( array_filter ( $ this -> params , function ( Param $ param ) use ( $ id ) { return ( $ param -> id === $ id ) ; } ) ) ; return ( $ param ) ? $ param : null ; } | Return a Param by ID |
49,652 | public function getItemByID ( $ id ) { $ item = current ( array_filter ( $ this -> items , function ( Item $ item ) use ( $ id ) { return ( $ item -> id === $ id ) ; } ) ) ; return ( $ item ) ? $ item : null ; } | Return a Item by ID |
49,653 | public function getItemByMPN ( $ mpn ) { $ item = current ( array_filter ( $ this -> items , function ( Item $ item ) use ( $ mpn ) { return ( $ item -> mpn === $ mpn ) ; } ) ) ; return ( $ item ) ? $ item : null ; } | Return a Item by MPN |
49,654 | public function register ( Container $ container ) { $ configuration = $ container [ 'config' ] ; $ logger = $ container [ 'logger' ] ; $ http = $ container [ 'http' ] ; return new TierConfiguration ( $ configuration , $ logger , $ http , $ container ) ; } | Create the TierConfiguration Service |
49,655 | public function register ( Container $ container ) { $ configuration = $ container [ 'config' ] ; $ client = new Client ( [ 'timeout' => $ configuration -> timeout , 'verify' => $ configuration -> sslVerifyHost , ] ) ; return $ client ; } | Create the Curl Service |
49,656 | public function updateTierConfigRequestParameters ( TierConfigRequest $ tierConfigRequest , array $ params ) { $ body = new TierConfigRequest ( [ 'params' => $ params ] ) ; $ this -> sendRequest ( 'PUT' , '/tier/config-requests/' . $ tierConfigRequest -> id , $ body ) ; } | Update tierConfig parameters |
49,657 | public function register ( Container $ container ) { $ configuration = $ container [ 'config' ] ; $ logger = $ container [ 'logger' ] ; $ http = $ container [ 'http' ] ; $ tierConfiguration = $ container [ 'tierConfiguration' ] ; $ fulfillment = $ container [ 'fulfillment' ] ; return new Usage ( $ configuration , $ log... | Create the Usage Service |
49,658 | public function hydrate ( $ source ) { foreach ( $ source as $ key => $ value ) { $ this -> set ( $ key , $ value ) ; } return $ this ; } | Populate the object recursively |
49,659 | public function set ( $ key , $ value ) { $ allowed = array_diff ( array_keys ( get_class_vars ( get_class ( $ this ) ) ) , $ this -> _hidden ) ; if ( empty ( $ allowed ) || ! empty ( $ allowed ) && in_array ( $ key , $ allowed ) ) { if ( method_exists ( $ this , 'set' . ucfirst ( $ key ) ) ) { call_user_func_array ( [... | Set the given value into the model |
49,660 | public function get ( $ key ) { $ allowed = array_diff ( array_keys ( get_class_vars ( get_class ( $ this ) ) ) , $ this -> _hidden ) ; if ( empty ( $ allowed ) || ! empty ( $ allowed ) && in_array ( $ key , $ allowed ) ) { if ( method_exists ( $ this , 'get' . ucfirst ( $ key ) ) ) { return call_user_func_array ( [ $ ... | Get the requested value from the model |
49,661 | public static function modelize ( $ key , $ value ) { switch ( gettype ( $ value ) ) { case 'object' : $ namespaces = [ '\Connect\\' , '\Connect\Usage\\' ] ; foreach ( $ namespaces as $ namespace ) { $ fqcn = $ namespace . ucfirst ( $ key ) ; if ( class_exists ( $ fqcn , true ) ) { return new $ fqcn ( $ value ) ; } $ f... | Modelize the given value into \ Connect \ Model |
49,662 | public static function arrayize ( $ value ) { $ forbidden = [ ] ; if ( $ value instanceof Model ) { $ forbidden = $ value -> getHidden ( ) ; } $ array = [ ] ; foreach ( $ value as $ key => $ item ) { if ( ! in_array ( trim ( $ key ) , $ forbidden ) ) { switch ( gettype ( $ item ) ) { case 'object' : case 'array' : $ bu... | Transform the given structure into array |
49,663 | public function register ( Container $ container ) { $ configuration = $ container [ 'config' ] ; $ logger = $ container [ 'logger' ] ; $ http = $ container [ 'http' ] ; $ tierConfiguration = $ container [ 'tierConfiguration' ] ; return new Fulfillment ( $ configuration , $ logger , $ http , $ tierConfiguration ) ; } | Create the Fulfillment Service |
49,664 | public function register ( Container $ container ) { $ configuration = $ container [ 'config' ] ; $ logger = Logger :: get ( ) ; $ logger -> setLogLevel ( $ configuration -> logLevel ) ; return $ logger ; } | Create the Logger Service |
49,665 | public function process ( ) { foreach ( $ this -> tierConfiguration -> listTierConfigs ( [ 'status' => 'pending' ] ) as $ tierConfig ) { $ this -> dispatchTierConfig ( $ tierConfig ) ; } foreach ( $ this -> fulfillment -> listRequests ( [ 'status' => 'pending' ] ) as $ request ) { $ this -> dispatch ( $ request ) ; } } | Process all requests |
49,666 | public function sendRequest ( $ verb , $ path , $ body = null ) { $ this -> logger -> info ( 'Module: ' . __CLASS__ ) ; if ( $ body instanceof Model ) { $ body = $ body -> toJSON ( true ) ; } $ headers = [ 'Authorization' => 'ApiKey ' . $ this -> config -> apiKey , 'Request-ID' => uniqid ( 'api-request-' ) , 'Content-T... | Send the actual request to the connect endpoint |
49,667 | public function getProfileUrl ( $ email , $ secure = true ) { $ hash = md5 ( strtolower ( trim ( $ email ) ) ) ; return $ this -> getProfileUrlForHash ( $ hash , $ secure ) ; } | Returns a url for a gravatar profile . |
49,668 | public function getProfileUrlForHash ( $ hash , $ secure = true ) { $ secure = $ secure ? : $ this -> defaults [ 'secure' ] ; return ( $ secure ? 'https://secure' : 'http://www' ) . '.gravatar.com/' . $ hash ; } | Returns a url for a gravatar profile for the given hash . |
49,669 | public function exists ( $ email ) { $ path = $ this -> getUrl ( $ email , null , null , '404' ) ; if ( ! $ sock = @ fsockopen ( 'gravatar.com' , 80 , $ errorNo , $ error ) ) { return ; } fwrite ( $ sock , 'HEAD ' . $ path . " HTTP/1.0\r\n\r\n" ) ; $ header = fgets ( $ sock , 128 ) ; fclose ( $ sock ) ; return strpos (... | Checks if a gravatar exists for the email . It does this by checking for the presence of 404 in the header returned . Will return null if fsockopen fails for example when the hostname cannot be resolved . |
49,670 | protected function isSecure ( $ preset = true ) { if ( null !== $ preset ) { return ( bool ) $ preset ; } if ( null === $ this -> router ) { return false ; } return 'https' == strtolower ( $ this -> router -> getContext ( ) -> getScheme ( ) ) ; } | Returns true if avatar should be fetched over secure connection . |
49,671 | public function getPackages ( ) : PackageCollection { if ( null === $ this -> packages ) { $ packages = array_merge ( array ( $ this -> getName ( ) => $ this , ) , $ this -> getInstalledPackagesFile ( ) -> getPackages ( ) -> toArray ( ) ) ; $ this -> packages = new PackageCollection ( $ packages ) ; } return $ this -> ... | Returns all packages in the project including the root one |
49,672 | public function getConfig ( $ keys = [ ] , $ default = null ) : array { if ( 2 > func_num_args ( ) ) { $ default = new \ stdClass ; } $ config = @ array_map ( function ( AbstractPackage $ package ) use ( $ keys , $ default ) { return $ package -> getConfig ( $ keys , $ default ) ; } , $ this -> packages ) ; if ( 2 > fu... | Get a config value from all packages |
49,673 | public function sortByDependencies ( ) : self { $ packages = $ this -> packages ; $ sortedPackages = [ ] ; while ( ! empty ( $ packages ) ) { foreach ( $ packages as $ packageName => $ package ) { $ dependentPackages = $ package -> getDependencies ( ) -> toArray ( ) ; if ( empty ( array_diff_key ( $ dependentPackages ,... | Returns all packages sorted based on their dependencies . Each package is guaranteed to appear after all of its dependencies in the collection |
49,674 | private static function parseResponse ( $ response ) { $ httpStatus = $ response [ 'code' ] ; if ( $ httpStatus == 500 ) { $ result = new ResultError ( ) ; $ result -> setErrorDescription ( $ response [ 'response' ] ) ; OpenPayU_Http :: throwErrorHttpStatusException ( $ httpStatus , $ result ) ; } $ message = OpenPayU_... | Parse response from PayU |
49,675 | public static function generateSignData ( array $ data , $ algorithm = 'SHA-256' , $ merchantPosId = '' , $ signatureKey = '' ) { if ( empty ( $ signatureKey ) ) throw new OpenPayU_Exception_Configuration ( 'Merchant Signature Key should not be null or empty.' ) ; if ( empty ( $ merchantPosId ) ) throw new OpenPayU_Exc... | Function generate sign data |
49,676 | public static function parseSignature ( $ data ) { if ( empty ( $ data ) ) { return null ; } $ signatureData = array ( ) ; $ list = explode ( ';' , rtrim ( $ data , ';' ) ) ; if ( empty ( $ list ) ) { return null ; } foreach ( $ list as $ value ) { $ explode = explode ( '=' , $ value ) ; if ( count ( $ explode ) != 2 )... | Function returns signature data object |
49,677 | public static function verifySignature ( $ message , $ signature , $ signatureKey , $ algorithm = 'MD5' ) { if ( isset ( $ signature ) ) { if ( $ algorithm === 'MD5' ) { $ hash = md5 ( $ message . $ signatureKey ) ; } else if ( in_array ( $ algorithm , array ( 'SHA' , 'SHA1' , 'SHA-1' ) ) ) { $ hash = sha1 ( $ message ... | Function returns signature validate |
49,678 | public static function buildJsonFromArray ( $ data , $ rootElement = '' ) { if ( ! is_array ( $ data ) ) { return null ; } if ( ! empty ( $ rootElement ) ) { $ data = array ( $ rootElement => $ data ) ; } $ data = self :: setSenderProperty ( $ data ) ; return json_encode ( $ data ) ; } | Function builds OpenPayU Json Document |
49,679 | public static function delete ( $ token ) { try { $ authType = self :: getAuth ( ) ; } catch ( OpenPayU_Exception $ e ) { throw new OpenPayU_Exception ( $ e -> getMessage ( ) , $ e -> getCode ( ) ) ; } if ( ! $ authType instanceof AuthType_Oauth ) { throw new OpenPayU_Exception_Configuration ( 'Delete token works only ... | Deleting a payment token |
49,680 | public static function payMethods ( $ lang = null ) { try { $ authType = self :: getAuth ( ) ; } catch ( OpenPayU_Exception $ e ) { throw new OpenPayU_Exception ( $ e -> getMessage ( ) , $ e -> getCode ( ) ) ; } if ( ! $ authType instanceof AuthType_Oauth ) { throw new OpenPayU_Exception_Configuration ( 'Retrieve works... | Get Pay Methods from POS |
49,681 | public static function create ( $ order ) { $ data = OpenPayU_Util :: buildJsonFromArray ( $ order ) ; if ( empty ( $ data ) ) { throw new OpenPayU_Exception ( 'Empty message OrderCreateRequest' ) ; } try { $ authType = self :: getAuth ( ) ; } catch ( OpenPayU_Exception $ e ) { throw new OpenPayU_Exception ( $ e -> get... | Creates new Order - Sends to PayU OrderCreateRequest |
49,682 | public static function retrieve ( $ orderId ) { if ( empty ( $ orderId ) ) { throw new OpenPayU_Exception ( 'Empty value of orderId' ) ; } try { $ authType = self :: getAuth ( ) ; } catch ( OpenPayU_Exception $ e ) { throw new OpenPayU_Exception ( $ e -> getMessage ( ) , $ e -> getCode ( ) ) ; } $ pathUrl = OpenPayU_Co... | Retrieves information about the order - Sends to PayU OrderRetrieveRequest |
49,683 | public static function statusUpdate ( $ orderStatusUpdate ) { if ( empty ( $ orderStatusUpdate ) ) { throw new OpenPayU_Exception ( 'Empty order status data' ) ; } try { $ authType = self :: getAuth ( ) ; } catch ( OpenPayU_Exception $ e ) { throw new OpenPayU_Exception ( $ e -> getMessage ( ) , $ e -> getCode ( ) ) ; ... | Updates Order status - Sends to PayU OrderStatusUpdateRequest |
49,684 | public static function consumeNotification ( $ data ) { if ( empty ( $ data ) ) { throw new OpenPayU_Exception ( 'Empty value of data' ) ; } $ headers = OpenPayU_Util :: getRequestHeaders ( ) ; $ incomingSignature = OpenPayU_HttpCurl :: getSignature ( $ headers ) ; self :: verifyDocumentSignature ( $ data , $ incomingS... | Consume notification message |
49,685 | public static function verifyResponse ( $ response , $ messageName ) { $ data = array ( ) ; $ httpStatus = $ response [ 'code' ] ; $ message = OpenPayU_Util :: convertJsonToArray ( $ response [ 'response' ] , true ) ; $ data [ 'status' ] = isset ( $ message [ 'status' ] [ 'statusCode' ] ) ? $ message [ 'status' ] [ 'st... | Verify response from PayU |
49,686 | public static function hostedOrderForm ( $ order , $ params = array ( ) ) { $ orderFormUrl = OpenPayU_Configuration :: getServiceUrl ( ) . 'orders' ; $ formFieldValuesAsArray = array ( ) ; $ htmlFormFields = OpenPayU_Util :: convertArrayToHtmlForm ( $ order , '' , $ formFieldValuesAsArray ) ; $ signature = OpenPayU_Uti... | Generate a form body for hosted order |
49,687 | public static function create ( $ orderId , $ description , $ amount = null , $ extCustomerId = null , $ extRefundId = null ) { if ( empty ( $ orderId ) ) { throw new OpenPayU_Exception ( 'Invalid orderId value for refund' ) ; } if ( empty ( $ description ) ) { throw new OpenPayU_Exception ( 'Invalid description of ref... | Function make refund for order |
49,688 | public function generate ( $ target , $ options ) { if ( $ options [ 'source' ] ) { $ this -> sourcePath = $ options [ 'source' ] ; } $ messages = $ this -> getMessages ( ) ; $ this -> prepareTarget ( $ target ) ; if ( $ options [ 'no-lib' ] ) { $ template = $ this -> file -> get ( __DIR__ . '/Templates/messages.js' ) ... | Generate a JS lang file from all language files . |
49,689 | protected function sortMessages ( & $ messages ) { if ( is_array ( $ messages ) ) { ksort ( $ messages ) ; foreach ( $ messages as $ key => & $ value ) { $ this -> sortMessages ( $ value ) ; } } } | Recursively sorts all messages by key . |
49,690 | protected function isMessagesExcluded ( $ filePath ) { if ( empty ( $ this -> messagesIncluded ) ) { return false ; } $ filePath = str_replace ( DIRECTORY_SEPARATOR , '/' , $ filePath ) ; $ localeDirSeparatorPosition = strpos ( $ filePath , '/' ) ; $ filePath = substr ( $ filePath , $ localeDirSeparatorPosition ) ; $ f... | If messages should be excluded from build . |
49,691 | public function factory ( ) { if ( ! $ this -> factory ) { $ options = [ ] ; $ options [ 'headers' ] [ 'X-Vault-Token' ] = $ this -> getVaultToken ( ) ; $ this -> factory = new VaultFactory ( $ options ) ; } return $ this -> factory ; } | Get the Vault Service Factory |
49,692 | public function unseal ( ) { $ file = $ this -> getVaultKeyFile ( ) ; if ( ! file_exists ( $ file ) ) { return $ this -> abort ( $ file . ' does not exist - call "create" first' ) ; } $ sysService = $ this -> sys ( ) ; $ sealed = $ sysService -> sealed ( ) ; if ( ! $ sealed ) { return $ this -> success ( 'Vault is unse... | Unseal the vault using the keys provided |
49,693 | public function login ( string $ roleId , string $ secretId ) { $ body = [ 'role_id' => $ roleId , 'secret_id' => $ secretId ] ; $ params = [ 'body' => json_encode ( $ body ) ] ; return \ GuzzleHttp \ json_decode ( $ this -> client -> post ( '/v1/auth/approle/login' , $ params ) -> getBody ( ) ) ; } | Issues a Vault token based on the presented credentials . |
49,694 | public function init ( array $ body = [ ] ) { $ body = OptionsResolver :: resolve ( $ body , [ 'secret_shares' , 'secret_threshold' , 'pgp_keys' ] ) ; $ body = OptionsResolver :: required ( $ body , [ 'secret_shares' , 'secret_threshold' ] ) ; $ params = [ 'body' => json_encode ( $ body ) ] ; return $ this -> client ->... | Initializes a new Vault . |
49,695 | public function unseal ( array $ body = [ ] ) { $ body = OptionsResolver :: resolve ( $ body , [ 'key' , 'reset' ] ) ; $ params = [ 'body' => json_encode ( $ body ) ] ; return $ this -> client -> put ( '/v1/sys/unseal' , $ params ) ; } | Enter a single master key share to progress the unsealing of the Vault . |
49,696 | public function createMount ( $ name , array $ body ) { $ body = OptionsResolver :: resolve ( $ body , [ 'type' , 'description' , 'config' ] ) ; $ params = [ 'body' => json_encode ( $ body ) ] ; return $ this -> client -> post ( '/v1/sys/mounts/' . $ name , $ params ) ; } | Mount a new secret backend to the mount point in the URL . |
49,697 | public function remount ( $ from , $ to ) { $ body = compact ( 'from' , 'to' ) ; $ params = [ 'body' => json_encode ( $ body ) ] ; return $ this -> client -> post ( '/v1/sys/remount' , $ params ) ; } | Remount an already - mounted backend to a new mount point . |
49,698 | public function tuneMount ( $ name , array $ body = [ ] ) { if ( empty ( $ body ) ) { return $ this -> client -> get ( '/v1/sys/mounts/' . $ name . '/tune' ) ; } $ params = [ 'body' => json_encode ( OptionsResolver :: resolve ( $ body , [ 'default_lease_ttl' , 'max_lease_ttl' ] ) ) ] ; return $ this -> client -> post (... | List or change the given mount s configuration . |
49,699 | public function putPolicy ( $ name , array $ body ) { $ body = OptionsResolver :: resolve ( $ body , [ 'policy' ] ) ; $ params = [ 'body' => json_encode ( $ body ) ] ; return $ this -> client -> put ( '/v1/sys/policy/' . $ name , $ params ) ; } | Add or update a policy . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.