idx int64 0 60.3k | question stringlengths 101 6.21k | target stringlengths 7 803 |
|---|---|---|
41,300 | private function _exec ( $ listId , Contact $ contact ) { return $ this -> mailjet -> post ( Resources :: $ ContactslistManagecontact , [ 'id' => $ listId , 'body' => $ contact -> format ( ) ] ) ; } | An action for adding a contact to a contact list . Only POST is supported . The API will internally create the new contact if it does not exist add or update the name and properties . The properties have to be defined before they can be used . The API then adds the contact to the contact list with active = true and unsub = specified value if it is not already in the list or updates the entry with these values . On success the API returns a packet with the same format but with all properties available for that contact . |
41,301 | public function format ( ) { if ( ! is_null ( $ this -> locale ) ) { $ result [ self :: LOCALE_KEY ] = $ this -> locale ; } if ( ! is_null ( $ this -> sender ) ) { $ result [ self :: SENDER_KEY ] = $ this -> sender ; } if ( ! is_null ( $ this -> senderEmail ) ) { $ result [ self :: SENDEREMAIL_KEY ] = $ this -> senderEmail ; } if ( ! is_null ( $ this -> subject ) ) { $ result [ self :: SUBJECT_KEY ] = $ this -> subject ; } if ( ! is_null ( $ this -> contactsListID ) ) { $ result [ self :: CONTACTLISTID_KEY ] = $ this -> contactsListID ; } if ( ! is_null ( $ this -> optionalProperties ) ) { $ result = array_merge ( $ result , $ this -> optionalProperties ) ; } return $ result ; } | Format CampaignDraft for MailJet API request |
41,302 | public function format ( ) { if ( ! is_null ( $ this -> fromEmail ) ) { $ result [ self :: FROMEMAIL_KEY ] = $ this -> fromEmail ; } if ( ! is_null ( $ this -> optionalProperties ) ) { $ result = array_merge ( $ result , $ this -> optionalProperties ) ; } return $ result ; } | Format Campaign for MailJet API request |
41,303 | private function validateAction ( $ action ) { $ actionAvailable = [ self :: ACTION_ADDFORCE , self :: ACTION_ADDNOFORCE , self :: ACTION_REMOVE , self :: ACTION_UNSUB ] ; if ( in_array ( $ action , $ actionAvailable ) ) { return true ; } return false ; } | Validate if action is authorized |
41,304 | public function create ( EventCallbackUrl $ eventCallbackUrl ) { $ response = $ this -> mailjet -> post ( Resources :: $ Eventcallbackurl , [ 'body' => $ eventCallbackUrl -> format ( ) ] ) ; if ( ! $ response -> success ( ) ) { $ this -> throwError ( "EventCallbackUrlService:create() failed" , $ response ) ; } return $ response -> getData ( ) ; } | Create one EventCallbackUrl |
41,305 | public function update ( $ id , EventCallbackUrl $ eventCallbackUrl ) { $ response = $ this -> mailjet -> put ( Resources :: $ Eventcallbackurl , [ 'id' => $ id , 'body' => $ eventCallbackUrl -> format ( ) ] ) ; if ( ! $ response -> success ( ) ) { $ this -> throwError ( "EventCallbackUrlService:update() failed" , $ response ) ; } return $ response -> getData ( ) ; } | Update one EventCallbackUrl |
41,306 | private function setErrorFromResponse ( Response $ response ) { $ this -> statusCode = $ response -> getStatus ( ) ; $ body = $ response -> getBody ( ) ; if ( isset ( $ body [ 'ErrorInfo' ] ) ) { $ this -> errorInfo = $ body [ 'ErrorInfo' ] ; } if ( isset ( $ body [ 'ErrorMessage' ] ) ) { $ this -> errorMessage = $ body [ 'ErrorMessage' ] ; } if ( isset ( $ body [ 'ErrorIdentifier' ] ) ) { $ this -> errorIdentifier = $ body [ 'ErrorIdentifier' ] ; } } | Configure MailjetException from Mailjet \ Response |
41,307 | protected function registerSwiftTransport ( ) { parent :: registerSwiftTransport ( ) ; app ( 'swift.transport' ) -> extend ( 'mailjet' , function ( $ app ) { $ config = $ this -> app [ 'config' ] -> get ( 'services.mailjet' , array ( ) ) ; $ call = $ this -> app [ 'config' ] -> get ( 'services.mailjet.transactionnal.call' , true ) ; $ options = $ this -> app [ 'config' ] -> get ( 'services.mailjet.transactionnal.options' , array ( ) ) ; return new MailjetTransport ( new \ Swift_Events_SimpleEventDispatcher ( ) , $ config [ 'key' ] , $ config [ 'secret' ] , $ call , $ options ) ; } ) ; } | Extended register the Swift Transport instance . |
41,308 | public function getAllCampaignDrafts ( array $ filters = null ) { $ response = $ this -> mailjet -> get ( Resources :: $ Campaigndraft , [ 'filters' => $ filters ] ) ; if ( ! $ response -> success ( ) ) { $ this -> throwError ( "CampaignDraftService :getAllCampaignDrafts() failed" , $ response ) ; } return $ response -> getData ( ) ; } | List campaigndraft resources available for this apikey |
41,309 | public function createDetailContent ( $ id , $ contentData ) { $ response = $ this -> mailjet -> post ( Resources :: $ CampaigndraftDetailcontent , [ 'id' => $ id , 'body' => $ contentData ] ) ; if ( ! $ response -> success ( ) ) { $ this -> throwError ( "CampaignDraftService:createDetailContent failed" , $ response ) ; } return $ response -> getData ( ) ; } | Creates the content of a campaigndraft |
41,310 | public function getSchedule ( $ CampaignId ) { $ response = $ this -> mailjet -> get ( Resources :: $ CampaigndraftSchedule , [ 'id' => $ CampaignId ] ) ; if ( ! $ response -> success ( ) ) { $ this -> throwError ( "CampaignDraftService:getSchedule failed" , $ response ) ; } return $ response -> getData ( ) ; } | Return the date of the scheduled sending of the campaigndraft |
41,311 | public function scheduleCampaign ( $ CampaignId , $ date ) { $ response = $ this -> mailjet -> post ( Resources :: $ CampaigndraftSchedule , [ 'id' => $ CampaignId , 'body' => $ date ] ) ; if ( ! $ response -> success ( ) ) { $ this -> throwError ( "CampaignDraftService:scheduleCampaign failed" , $ response ) ; } return $ response -> getData ( ) ; } | Schedule when the campaigndraft will be sent |
41,312 | public function updateCampaignSchedule ( $ CampaignId , $ date ) { $ response = $ this -> mailjet -> put ( Resources :: $ CampaigndraftSchedule , [ 'id' => $ CampaignId , 'body' => $ date ] ) ; if ( ! $ response -> success ( ) ) { $ this -> throwError ( "CampaignDraftService:updateCampaignSchedule failed" , $ response ) ; } return $ response -> getData ( ) ; } | Update the date when the campaigndraft will be sent |
41,313 | public function format ( ) { if ( ! is_null ( $ this -> name ) ) { $ result [ self :: NAME_KEY ] = $ this -> name ; } if ( ! is_null ( $ this -> optionalProperties ) ) { $ result = array_merge ( $ result , $ this -> optionalProperties ) ; } return $ result ; } | Format Template for MailJet API request |
41,314 | protected function getTo ( $ notifiable ) { if ( $ notifiable -> routeNotificationFor ( 'twilio' ) ) { return $ notifiable -> routeNotificationFor ( 'twilio' ) ; } if ( isset ( $ notifiable -> phone_number ) ) { return $ notifiable -> phone_number ; } throw CouldNotSendNotification :: invalidReceiver ( ) ; } | Get the address to send a notification to . |
41,315 | public function getFrom ( ) { if ( $ this -> from ) { return $ this -> from ; } if ( $ this -> alphaNumSender && strlen ( $ this -> alphaNumSender ) > 0 ) { return $ this -> alphaNumSender ; } } | Get the from address of this message . |
41,316 | public function sendMessage ( TwilioMessage $ message , $ to , $ useAlphanumericSender = false ) { if ( $ message instanceof TwilioSmsMessage ) { if ( $ useAlphanumericSender && $ sender = $ this -> getAlphanumericSender ( ) ) { $ message -> from ( $ sender ) ; } return $ this -> sendSmsMessage ( $ message , $ to ) ; } if ( $ message instanceof TwilioCallMessage ) { return $ this -> makeCall ( $ message , $ to ) ; } throw CouldNotSendNotification :: invalidMessageObject ( $ message ) ; } | Send a TwilioMessage to the a phone number . |
41,317 | protected function sendSmsMessage ( TwilioSmsMessage $ message , $ to ) { $ params = [ 'body' => trim ( $ message -> content ) , ] ; if ( $ messagingServiceSid = $ this -> getMessagingServiceSid ( $ message ) ) { $ params [ 'messagingServiceSid' ] = $ messagingServiceSid ; } if ( $ from = $ this -> getFrom ( $ message ) ) { $ params [ 'from' ] = $ from ; } if ( ! $ from && ! $ messagingServiceSid ) { throw CouldNotSendNotification :: missingFrom ( ) ; } $ this -> fillOptionalParams ( $ params , $ message , [ 'statusCallback' , 'statusCallbackMethod' , 'applicationSid' , 'maxPrice' , 'provideFeedback' , 'validityPeriod' , ] ) ; if ( $ message instanceof TwilioMmsMessage ) { $ this -> fillOptionalParams ( $ params , $ message , [ 'mediaUrl' , ] ) ; } return $ this -> twilioService -> messages -> create ( $ to , $ params ) ; } | Send an sms message using the Twilio Service . |
41,318 | protected function makeCall ( TwilioCallMessage $ message , $ to ) { $ params = [ 'url' => trim ( $ message -> content ) , ] ; $ this -> fillOptionalParams ( $ params , $ message , [ 'statusCallback' , 'statusCallbackMethod' , 'method' , 'status' , 'fallbackUrl' , 'fallbackMethod' , ] ) ; if ( ! $ from = $ this -> getFrom ( $ message ) ) { throw CouldNotSendNotification :: missingFrom ( ) ; } return $ this -> twilioService -> calls -> create ( $ to , $ from , $ params ) ; } | Make a call using the Twilio Service . |
41,319 | public function GetPendingSettlements ( & $ pagination = null , $ sorting = null ) { return $ this -> GetList ( 'disputes_pendingsettlement' , $ pagination , '\MangoPay\Dispute' , null , null , $ sorting ) ; } | List Disputes that need settling |
41,320 | public function ResubmitDispute ( $ disputeId ) { $ dispute = new Dispute ( ) ; $ dispute -> Id = $ disputeId ; return $ this -> SaveObject ( 'disputes_save_contest_funds' , $ dispute , '\MangoPay\Dispute' ) ; } | This method is used to resubmit a Dispute if it is reopened requiring more docs |
41,321 | public function GetTransactions ( $ disputeId , & $ pagination = null , $ sorting = null , $ filter = null ) { return $ this -> GetList ( 'disputes_get_transactions' , $ pagination , 'MangoPay\Transaction' , $ disputeId , $ filter , $ sorting ) ; } | Gets dispute s transactions |
41,322 | public function GetDisputesForWallet ( $ walletId , & $ pagination = null , $ sorting = null , $ filter = null ) { return $ this -> GetList ( 'disputes_get_for_wallet' , $ pagination , 'MangoPay\Dispute' , $ walletId , $ filter , $ sorting ) ; } | Gets dispute s documents for wallet |
41,323 | public function GetDisputesForUser ( $ userId , & $ pagination = null , $ sorting = null , $ filter = null ) { return $ this -> GetList ( 'disputes_get_for_user' , $ pagination , 'MangoPay\Dispute' , $ userId , $ filter , $ sorting ) ; } | Gets user s disputes |
41,324 | public function CreateSettlementTransfer ( $ settlementTransfer , $ repudiationId , $ idempotencyKey = null ) { return $ this -> CreateObject ( 'disputes_repudiation_create_settlement' , $ settlementTransfer , '\MangoPay\Transfer' , $ repudiationId , null , $ idempotencyKey ) ; } | Creates settlement transfer |
41,325 | public function GetDocumentsForDispute ( $ disputeId , & $ pagination = null , $ sorting = null , $ filter = null ) { return $ this -> GetList ( 'disputes_document_get_for_dispute' , $ pagination , 'MangoPay\DisputeDocument' , $ disputeId , $ filter , $ sorting ) ; } | Gets documents for dispute |
41,326 | public function CreateDisputeDocument ( $ disputeId , $ disputeDocument , $ idempotencyKey = null ) { return $ this -> CreateObject ( 'disputes_document_create' , $ disputeDocument , '\MangoPay\DisputeDocument' , $ disputeId , null , $ idempotencyKey ) ; } | Creates document for dispute |
41,327 | public function CreateDisputeDocumentPage ( $ disputeId , $ disputeDocumentId , $ disputeDocumentPage , $ idempotencyKey = null ) { try { $ this -> CreateObject ( 'disputes_document_page_create' , $ disputeDocumentPage , null , $ disputeId , $ disputeDocumentId , $ idempotencyKey ) ; } catch ( \ MangoPay \ Libraries \ ResponseException $ exc ) { if ( $ exc -> getCode ( ) != 204 ) { throw $ exc ; } } } | Creates document s page for dispute |
41,328 | public function CreateDisputeDocumentPageFromFile ( $ disputeId , $ disputeDocumentId , $ file , $ idempotencyKey = null ) { $ filePath = $ file ; if ( is_array ( $ file ) ) { $ filePath = $ file [ 'tmp_name' ] ; } if ( empty ( $ filePath ) ) { throw new \ MangoPay \ Libraries \ Exception ( 'Path of file cannot be empty' ) ; } if ( ! file_exists ( $ filePath ) ) { throw new \ MangoPay \ Libraries \ Exception ( 'File not exist' ) ; } $ disputeDocumentPage = new \ MangoPay \ DisputeDocumentPage ( ) ; $ disputeDocumentPage -> File = base64_encode ( file_get_contents ( $ filePath ) ) ; if ( empty ( $ disputeDocumentPage -> File ) ) { throw new \ MangoPay \ Libraries \ Exception ( 'Content of the file cannot be empty' ) ; } $ this -> CreateDisputeDocumentPage ( $ disputeId , $ disputeDocumentId , $ disputeDocumentPage , $ idempotencyKey ) ; } | Creates document s page for dispute from file |
41,329 | public function GetTransactions ( $ bankAccountId , & $ pagination = null , $ filter = null , $ sorting = null ) { return $ this -> GetList ( 'transactions_get_for_bank_account' , $ pagination , '\MangoPay\Transaction' , $ bankAccountId , $ filter , $ sorting ) ; } | Retrieves a list of Transactions pertaining to a certain Bank Account |
41,330 | public function GetToken ( $ autenticationKey ) { $ token = $ this -> _storageStrategy -> Get ( ) ; if ( is_null ( $ token ) || false === $ token || $ token -> IsExpired ( ) || $ token -> GetAutenticationKey ( ) != $ autenticationKey ) { $ this -> StoreToken ( $ this -> _root -> AuthenticationManager -> CreateToken ( ) ) ; } return $ this -> _storageStrategy -> Get ( ) ; } | Gets the current authorization token . In the very first call this method creates a new token before returning . If currently stored token is expired this method creates a new one . |
41,331 | public function CreateToken ( ) { $ urlMethod = $ this -> GetRequestUrl ( 'authentication_oauth' ) ; $ requestType = $ this -> GetRequestType ( 'authentication_oauth' ) ; $ requestData = array ( 'grant_type' => 'client_credentials' ) ; $ rest = new RestTool ( false , $ this -> _root ) ; $ authHlp = new AuthenticationHelper ( $ this -> _root ) ; $ urlDetails = parse_url ( $ this -> _root -> Config -> BaseUrl ) ; $ rest -> AddRequestHttpHeader ( 'Host: ' . @ $ urlDetails [ 'host' ] ) ; $ rest -> AddRequestHttpHeader ( 'Authorization: Basic ' . $ authHlp -> GetHttpHeaderBasicKey ( ) ) ; $ rest -> AddRequestHttpHeader ( 'Content-Type: application/x-www-form-urlencoded' ) ; $ response = $ rest -> Request ( $ urlMethod , $ requestType , $ requestData ) ; $ token = $ this -> CastResponseToEntity ( $ response , '\MangoPay\Libraries\OAuthToken' ) ; $ token -> autentication_key = $ authHlp -> GetAutenticationKey ( ) ; return $ token ; } | Get token information to OAuth Authentication |
41,332 | public function Create ( $ bankingAlias ) { $ className = get_class ( $ bankingAlias ) ; if ( $ className == 'MangoPay\BankingAliasIBAN' ) { $ methodKey = 'banking_aliases_iban_create' ; } else { throw new Libraries \ Exception ( 'Wrong entity class for BankingAlias' ) ; } $ response = $ this -> CreateObject ( $ methodKey , $ bankingAlias , null , $ bankingAlias -> WalletId ) ; return $ this -> GetBankingAliasResponse ( $ response ) ; } | Create a banking alias |
41,333 | public function GetAll ( $ walletId , & $ pagination = null , $ sorting = null ) { $ bankingAliases = $ this -> GetList ( 'banking_aliases_all' , $ pagination , null , $ walletId , null , $ sorting ) ; return array_map ( array ( $ this , "GetBankingAliasResponse" ) , $ bankingAliases ) ; } | Get all banking aliases |
41,334 | private function GetBankingAliasResponse ( $ response ) { if ( isset ( $ response -> Type ) ) { switch ( $ response -> Type ) { case BankingAliasType :: IBAN : return $ this -> CastResponseToEntity ( $ response , '\MangoPay\BankingAliasIBAN' ) ; default : throw new Libraries \ Exception ( 'Unexpected response. Wrong BankingAlias Type value' ) ; } } else { throw new Libraries \ Exception ( 'Unexpected response. Missing BankingAlias Type property' ) ; } } | Get correct banking alias object |
41,335 | public function Create ( $ cardPreAuthorization , $ idempotencyKey = null ) { return $ this -> CreateObject ( 'preauthorization_create' , $ cardPreAuthorization , '\MangoPay\CardPreAuthorization' , null , null , $ idempotencyKey ) ; } | Create new pre - authorization object |
41,336 | public function Request ( $ urlMethod , $ requestType , $ requestData = null , $ idempotencyKey = null , & $ pagination = null , $ additionalUrlParams = null ) { $ this -> _requestType = $ requestType ; $ this -> _requestData = $ requestData ; if ( strpos ( $ urlMethod , 'consult' ) !== false && ( strpos ( $ urlMethod , 'KYC/documents' ) !== false || strpos ( $ urlMethod , 'dispute-documents' ) !== false ) ) { $ this -> _requestData = "" ; } $ logClass = $ this -> _root -> Config -> LogClass ; $ this -> logger -> debug ( "New request" ) ; if ( $ this -> _root -> Config -> DebugMode ) { $ logClass :: Debug ( '++++++++++++++++++++++ New request ++++++++++++++++++++++' , '' ) ; } $ this -> BuildRequest ( $ urlMethod , $ pagination , $ additionalUrlParams , $ idempotencyKey ) ; $ responseResult = $ this -> _root -> getHttpClient ( ) -> Request ( $ this ) ; $ logClass = $ this -> _root -> Config -> LogClass ; $ this -> logger -> debug ( 'Response JSON : ' . print_r ( $ responseResult -> Body , true ) ) ; if ( $ this -> _root -> Config -> DebugMode ) { $ logClass :: Debug ( 'Response JSON' , $ responseResult -> Body ) ; } $ response = json_decode ( $ responseResult -> Body ) ; $ this -> logger -> debug ( 'Decoded object : ' . print_r ( $ response , true ) ) ; if ( $ this -> _root -> Config -> DebugMode ) { $ logClass :: Debug ( 'Response object' , $ response ) ; } $ this -> CheckResponseCode ( $ responseResult -> ResponseCode , $ response ) ; $ this -> ReadResponseHeader ( $ responseResult -> Headers ) ; if ( ! is_null ( $ pagination ) ) { $ pagination = $ this -> _pagination ; } return $ response ; } | Call request to MangoPay API |
41,337 | private function BuildRequest ( $ urlMethod , $ pagination , $ additionalUrlParams = null , $ idempotencyKey = null ) { $ urlTool = new UrlTool ( $ this -> _root ) ; $ restUrl = $ urlTool -> GetRestUrl ( $ urlMethod , $ this -> _authRequired , $ pagination , $ additionalUrlParams ) ; $ this -> _requestUrl = $ urlTool -> GetFullUrl ( $ restUrl ) ; $ logClass = $ this -> _root -> Config -> LogClass ; $ this -> logger -> debug ( 'FullUrl : ' . $ this -> _requestUrl ) ; if ( $ this -> _root -> Config -> DebugMode ) { $ logClass :: Debug ( 'FullUrl' , $ this -> _requestUrl ) ; } if ( ! is_null ( $ pagination ) ) { $ this -> _pagination = $ pagination ; } $ this -> logger -> debug ( 'RequestType : ' . $ this -> _requestType ) ; if ( $ this -> _root -> Config -> DebugMode ) { $ logClass :: Debug ( 'RequestType' , $ this -> _requestType ) ; } $ httpHeaders = $ this -> GetHttpHeaders ( $ idempotencyKey ) ; $ this -> logger -> debug ( 'HTTP Headers : ' . print_r ( $ httpHeaders , true ) ) ; if ( $ this -> _root -> Config -> DebugMode ) { $ logClass :: Debug ( 'HTTP Headers' , $ httpHeaders ) ; } if ( ! is_null ( $ this -> _requestData ) ) { $ this -> logger -> debug ( 'RequestData object :' . print_r ( $ this -> _requestData , true ) ) ; if ( $ this -> _root -> Config -> DebugMode ) { $ logClass :: Debug ( 'RequestData object' , $ this -> _requestData ) ; } if ( in_array ( self :: $ _JSON_HEADER , $ httpHeaders ) ) { $ this -> _requestData = json_encode ( $ this -> _requestData ) ; $ this -> logger -> debug ( 'RequestData JSON :' . print_r ( $ this -> _requestData , true ) ) ; if ( $ this -> _root -> Config -> DebugMode ) { $ logClass :: Debug ( 'RequestData JSON' , $ this -> _requestData ) ; } } } } | Prepare all parameter to request |
41,338 | private function GetHttpHeaders ( $ idempotencyKey = null ) { if ( ! is_null ( $ this -> _requestHttpHeaders ) ) { return $ this -> _requestHttpHeaders ; } $ this -> _requestHttpHeaders = array ( ) ; array_push ( $ this -> _requestHttpHeaders , self :: $ _JSON_HEADER ) ; array_push ( $ this -> _requestHttpHeaders , 'User-Agent: MangoPay V2 PHP/' . self :: VERSION ) ; if ( $ this -> _authRequired ) { $ authHlp = new AuthenticationHelper ( $ this -> _root ) ; array_push ( $ this -> _requestHttpHeaders , $ authHlp -> GetHttpHeaderKey ( ) ) ; } if ( $ idempotencyKey != null ) { array_push ( $ this -> _requestHttpHeaders , 'Idempotency-Key: ' . $ idempotencyKey ) ; } return $ this -> _requestHttpHeaders ; } | Get HTTP header to use in request |
41,339 | private function CheckResponseCode ( $ responseCode , $ response ) { if ( $ responseCode < 200 || $ responseCode > 299 ) { if ( isset ( $ response ) && is_object ( $ response ) && isset ( $ response -> Message ) ) { $ error = new Error ( ) ; $ error -> Message = $ response -> Message ; $ error -> Errors = property_exists ( $ response , 'Errors' ) ? $ response -> Errors : property_exists ( $ response , 'errors' ) ? $ response -> errors : null ; $ error -> Id = property_exists ( $ response , 'Id' ) ? $ response -> Id : null ; $ error -> Type = property_exists ( $ response , 'Type' ) ? $ response -> Type : null ; $ error -> Date = property_exists ( $ response , 'Date' ) ? $ response -> Date : null ; throw new ResponseException ( $ this -> _requestUrl , $ responseCode , $ error ) ; } else { throw new ResponseException ( $ this -> _requestUrl , $ responseCode ) ; } } } | Check response code |
41,340 | public function Create ( $ reportRequest , $ idempotencyKey = null ) { $ type = $ reportRequest -> ReportType ; if ( is_null ( $ type ) || strlen ( $ type ) == 0 ) throw new Libraries \ Exception ( 'Report type property is required when create a report request.' ) ; switch ( $ type ) { case ReportType :: Transactions : return $ this -> CreateObject ( 'reports_transactions_create' , $ reportRequest , '\MangoPay\ReportRequest' , $ type , null , $ idempotencyKey ) ; case ReportType :: Wallets : return $ this -> CreateObject ( 'reports_wallets_create' , $ reportRequest , '\MangoPay\ReportRequest' , $ type , null , $ idempotencyKey ) ; default : throw new Libraries \ Exception ( 'Unexpected Report type. Wrong ReportType value.' ) ; } } | Creates new report request |
41,341 | public function Create ( $ hook , $ idempotencyKey = null ) { return $ this -> CreateObject ( 'hooks_create' , $ hook , '\MangoPay\Hook' , null , null , $ idempotencyKey ) ; } | Create new hook |
41,342 | public function GetAll ( & $ pagination = null , $ sorting = null ) { return $ this -> GetList ( 'hooks_all' , $ pagination , '\MangoPay\Hook' , null , null , $ sorting ) ; } | Get all hooks |
41,343 | private function RunRequest ( ) { $ result = curl_exec ( $ this -> _curlHandle ) ; if ( $ result === false && curl_errno ( $ this -> _curlHandle ) != 0 ) { $ this -> logger -> error ( "cURL error: " . curl_error ( $ this -> _curlHandle ) ) ; throw new Exception ( 'cURL error: ' . curl_error ( $ this -> _curlHandle ) ) ; } $ response = new HttpResponse ( ) ; $ response -> ResponseCode = ( int ) curl_getinfo ( $ this -> _curlHandle , CURLINFO_HTTP_CODE ) ; curl_close ( $ this -> _curlHandle ) ; $ explode = explode ( "\r\n\r\n" , $ result ) ; $ explode = array_slice ( $ explode , sizeof ( $ explode ) - 2 , 2 ) ; $ response -> Headers = explode ( "\n" , implode ( $ explode ) ) ; $ response -> Body = array_pop ( $ explode ) ; return $ response ; } | Execute request and check response |
41,344 | public function CreateDisputeDocumentConsult ( $ documentId , & $ pagination = null ) { return $ this -> GetList ( 'disputes_document_create_consult' , $ pagination , 'MangoPay\DocumentPageConsult' , $ documentId , null , null ) ; } | Creates temporary URLs where each page of a dispute document can be viewed . |
41,345 | protected function CreateObject ( $ methodKey , $ entity , $ responseClassName = null , $ entityId = null , $ subEntityId = null , $ idempotencyKey = null ) { if ( is_null ( $ entityId ) ) { $ urlMethod = $ this -> GetRequestUrl ( $ methodKey ) ; } elseif ( is_null ( $ subEntityId ) ) { $ urlMethod = sprintf ( $ this -> GetRequestUrl ( $ methodKey ) , $ entityId ) ; } else { $ urlMethod = sprintf ( $ this -> GetRequestUrl ( $ methodKey ) , $ entityId , $ subEntityId ) ; } $ requestData = null ; if ( ! is_null ( $ entity ) ) { $ requestData = $ this -> BuildRequestData ( $ entity ) ; } $ rest = new RestTool ( true , $ this -> _root ) ; $ response = $ rest -> Request ( $ urlMethod , $ this -> GetRequestType ( $ methodKey ) , $ requestData , $ idempotencyKey ) ; if ( ! is_null ( $ responseClassName ) ) { return $ this -> CastResponseToEntity ( $ response , $ responseClassName ) ; } return $ response ; } | Create object in API |
41,346 | protected function GetObject ( $ methodKey , $ entityId , $ responseClassName = null , $ secondEntityId = null ) { $ urlMethod = sprintf ( $ this -> GetRequestUrl ( $ methodKey ) , $ entityId , $ secondEntityId ) ; $ rest = new RestTool ( true , $ this -> _root ) ; $ response = $ rest -> Request ( $ urlMethod , $ this -> GetRequestType ( $ methodKey ) ) ; if ( ! is_null ( $ responseClassName ) ) { return $ this -> CastResponseToEntity ( $ response , $ responseClassName ) ; } return $ response ; } | Get entity object from API |
41,347 | protected function GetList ( $ methodKey , & $ pagination , $ responseClassName = null , $ entityId = null , $ filter = null , $ sorting = null , $ secondEntityId = null ) { $ urlMethod = sprintf ( $ this -> GetRequestUrl ( $ methodKey ) , $ entityId , $ secondEntityId ) ; if ( is_null ( $ pagination ) || ! is_object ( $ pagination ) || get_class ( $ pagination ) != 'MangoPay\Pagination' ) { $ pagination = new \ MangoPay \ Pagination ( ) ; } $ rest = new RestTool ( true , $ this -> _root ) ; $ additionalUrlParams = array ( ) ; if ( ! is_null ( $ filter ) ) { $ additionalUrlParams [ "filter" ] = $ filter ; } if ( ! is_null ( $ sorting ) ) { if ( ! is_a ( $ sorting , "\MangoPay\Sorting" ) ) { throw new Exception ( 'Wrong type of sorting object' ) ; } $ additionalUrlParams [ "sort" ] = $ sorting -> GetSortParameter ( ) ; } $ response = $ rest -> Request ( $ urlMethod , $ this -> GetRequestType ( $ methodKey ) , null , null , $ pagination , $ additionalUrlParams ) ; if ( ! is_null ( $ responseClassName ) ) { return $ this -> CastResponseToEntity ( $ response , $ responseClassName ) ; } return $ response ; } | Get lst with entities object from API |
41,348 | protected function SaveObject ( $ methodKey , $ entity , $ responseClassName = null , $ secondEntityId = null ) { $ entityId = null ; if ( isset ( $ entity -> Id ) ) { $ entityId = $ entity -> Id ; } if ( is_null ( $ secondEntityId ) ) { $ urlMethod = sprintf ( $ this -> GetRequestUrl ( $ methodKey ) , $ entityId ) ; } else { $ urlMethod = sprintf ( $ this -> GetRequestUrl ( $ methodKey ) , $ secondEntityId , $ entityId ) ; } $ requestData = $ this -> BuildRequestData ( $ entity ) ; $ rest = new RestTool ( true , $ this -> _root ) ; $ response = $ rest -> Request ( $ urlMethod , $ this -> GetRequestType ( $ methodKey ) , $ requestData ) ; if ( ! is_null ( $ responseClassName ) ) { return $ this -> CastResponseToEntity ( $ response , $ responseClassName ) ; } return $ response ; } | Save object in API |
41,349 | protected function CastResponseToEntity ( $ response , $ entityClassName , $ asDependentObject = false ) { if ( is_array ( $ response ) ) { $ list = array ( ) ; foreach ( $ response as $ responseObject ) { array_push ( $ list , $ this -> CastResponseToEntity ( $ responseObject , $ entityClassName ) ) ; } return $ list ; } if ( is_string ( $ entityClassName ) ) { $ entity = new $ entityClassName ( ) ; } else { throw new Exception ( 'Cannot cast response to entity object. Wrong entity class name' ) ; } $ responseReflection = new \ ReflectionObject ( $ response ) ; $ entityReflection = new \ ReflectionObject ( $ entity ) ; $ responseProperties = $ responseReflection -> getProperties ( ) ; $ subObjects = $ entity -> GetSubObjects ( ) ; $ dependsObjects = $ entity -> GetDependsObjects ( ) ; foreach ( $ responseProperties as $ responseProperty ) { $ responseProperty -> setAccessible ( true ) ; $ name = $ responseProperty -> getName ( ) ; $ value = $ responseProperty -> getValue ( $ response ) ; if ( $ entityReflection -> hasProperty ( $ name ) ) { $ entityProperty = $ entityReflection -> getProperty ( $ name ) ; $ entityProperty -> setAccessible ( true ) ; if ( $ entityProperty -> getName ( ) == "DeclaredUBOs" ) { $ declaredUbos = [ ] ; foreach ( $ value as $ declaredUboRaw ) { $ declaredUbo = new \ MangoPay \ DeclaredUbo ( ) ; $ declaredUbo -> UserId = $ declaredUboRaw -> UserId ; $ declaredUbo -> Status = $ declaredUboRaw -> Status ; $ declaredUbo -> RefusedReasonType = $ declaredUboRaw -> RefusedReasonMessage ; $ declaredUbo -> RefusedReasonMessage = $ declaredUboRaw -> RefusedReasonMessage ; array_push ( $ declaredUbos , $ declaredUbo ) ; } $ value = $ declaredUbos ; } if ( isset ( $ subObjects [ $ name ] ) ) { if ( is_null ( $ value ) ) { $ object = null ; } else { $ object = $ this -> CastResponseToEntity ( $ value , $ subObjects [ $ name ] ) ; } $ entityProperty -> setValue ( $ entity , $ object ) ; } else { $ entityProperty -> setValue ( $ entity , $ value ) ; } if ( isset ( $ dependsObjects [ $ name ] ) ) { $ dependsObject = $ dependsObjects [ $ name ] ; $ entityDependProperty = $ entityReflection -> getProperty ( $ dependsObject [ '_property_name' ] ) ; $ entityDependProperty -> setAccessible ( true ) ; $ entityDependProperty -> setValue ( $ entity , $ this -> CastResponseToEntity ( $ response , $ dependsObject [ $ value ] , true ) ) ; } } else { if ( $ asDependentObject || ! empty ( $ dependsObjects ) ) { continue ; } else { continue ; } } } return $ entity ; } | Cast response object to entity object |
41,350 | protected function BuildRequestData ( $ entity ) { if ( is_a ( $ entity , 'MangoPay\UboDeclaration' ) ) { $ declaredUboIds = [ ] ; foreach ( $ entity -> DeclaredUBOs as $ declaredUBO ) { if ( is_string ( $ declaredUBO ) ) { array_push ( $ declaredUboIds , $ declaredUBO ) ; } else { array_push ( $ declaredUboIds , $ declaredUBO -> UserId ) ; } } $ entity -> DeclaredUBOs = $ declaredUboIds ; } $ entityProperties = get_object_vars ( $ entity ) ; $ blackList = $ entity -> GetReadOnlyProperties ( ) ; $ requestData = array ( ) ; foreach ( $ entityProperties as $ propertyName => $ propertyValue ) { if ( in_array ( $ propertyName , $ blackList ) ) { continue ; } if ( $ this -> CanReadSubRequestData ( $ entity , $ propertyName ) ) { $ subRequestData = $ this -> BuildRequestData ( $ propertyValue ) ; foreach ( $ subRequestData as $ key => $ value ) { $ requestData [ $ key ] = $ value ; } } else { if ( isset ( $ propertyValue ) ) { $ requestData [ $ propertyName ] = $ propertyValue ; } } } if ( count ( $ requestData ) == 0 ) { return new \ stdClass ( ) ; } return $ requestData ; } | Get array with request data |
41,351 | public function Get ( $ idempotencyKey ) { $ response = $ this -> GetObject ( 'responses_get' , $ idempotencyKey , 'MangoPay\Response' ) ; $ className = $ this -> GetObjectForIdempotencyUrl ( $ response -> RequestURL ) ; if ( is_null ( $ className ) || empty ( $ className ) || is_null ( $ response -> Resource ) || empty ( $ response -> Resource ) ) return $ response ; $ response -> Resource = $ this -> CastResponseToEntity ( $ response -> Resource , $ className ) ; return $ response ; } | Get response from previous call by idempotency key |
41,352 | public function Create ( $ payOut , $ idempotencyKey = null ) { $ paymentKey = $ this -> GetPaymentKey ( $ payOut ) ; return $ this -> CreateObject ( 'payouts_' . $ paymentKey . '_create' , $ payOut , '\MangoPay\PayOut' , null , null , $ idempotencyKey ) ; } | Create new pay - out |
41,353 | public function GetRefunds ( $ payOutId , & $ pagination = null , $ filter = null , $ sorting = null ) { return $ this -> GetList ( 'refunds_get_for_payout' , $ pagination , '\MangoPay\Refund' , $ payOutId , $ filter , $ sorting ) ; } | Returns a list of Refunds pertaining to a certain PayOut . |
41,354 | public function GetByFingerprint ( $ fingerprint , & $ pagination = null , $ sorting = null ) { return $ this -> GetList ( 'cards_get_by_fingerprint' , $ pagination , '\MangoPay\Card' , $ fingerprint , null , $ sorting ) ; } | Gets a list of cards having the same fingerprint . The fingerprint is a hash uniquely generated per 16 - digit card number . |
41,355 | public function GetPreAuthorizations ( $ cardId , $ pagination = null , $ filter = null , $ sorting = null ) { return $ this -> GetList ( "preauthorizations_get_for_card" , $ pagination , '\MangoPay\CardPreAuthorization' , $ cardId , $ filter , $ sorting ) ; } | Gets a Card s PreAuthorizations |
41,356 | public function GetTransactions ( $ cardId , & $ pagination = null , $ filter = null , $ sorting = null ) { return $ this -> GetList ( 'transactions_get_for_card' , $ pagination , '\MangoPay\Transaction' , $ cardId , $ filter , $ sorting ) ; } | Retrieves a list of Transactions pertaining to a certain Card |
41,357 | public function GetRefunds ( $ repudiationId , & $ pagination = null , $ filter = null , $ sorting = null ) { return $ this -> GetList ( 'refunds_get_for_repudiation' , $ pagination , '\MangoPay\Repudiation' , $ repudiationId , $ filter , $ sorting ) ; } | Retrieves a list of Refunds pertaining to a certain Repudiation |
41,358 | public function Get ( ) { $ filename = $ this -> GetPathToFile ( ) ; if ( ! file_exists ( $ filename ) ) { return null ; } $ data = file_get_contents ( $ filename ) ; if ( $ data === false ) { return null ; } $ serialized = str_replace ( $ this -> _prefixContent , '' , $ data ) ; return unserialize ( $ serialized ) ; } | Gets the current authorization token . |
41,359 | public function Store ( $ token ) { if ( ! is_writable ( $ this -> GetPathToTemporaryFolder ( ) ) ) { throw new \ MangoPay \ Libraries \ Exception ( 'Cannot create or write to file ' . $ this -> GetPathToTemporaryFolder ( ) ) ; } $ serialized = serialize ( $ token ) ; $ result = file_put_contents ( $ this -> GetPathToFile ( ) , $ this -> _prefixContent . $ serialized , LOCK_EX ) ; if ( $ result === false ) { throw new \ MangoPay \ Libraries \ Exception ( 'Cannot put token to file' ) ; } } | Stores authorization token passed as an argument . |
41,360 | private function GetPathToTemporaryFolder ( ) { if ( is_null ( $ this -> _config -> TemporaryFolder ) ) { throw new \ MangoPay \ Libraries \ Exception ( 'Path to temporary folder is not defined' ) ; } return $ this -> _config -> TemporaryFolder ; } | Get path to temporary folder |
41,361 | public function CreateKycDocumentConsult ( $ kycDocumentId , & $ pagination = null ) { return $ this -> GetList ( 'kyc_documents_create_consult' , $ pagination , '\MangoPay\DocumentPageConsult' , $ kycDocumentId , null , null ) ; } | Creates temporary URLs where each page of a KYC document can be viewed . |
41,362 | public function CreateRefund ( $ transferId , $ refund , $ idempotencyKey = null ) { return $ this -> CreateObject ( 'transfers_createrefunds' , $ refund , '\MangoPay\Refund' , $ transferId , null , $ idempotencyKey ) ; } | Create refund for transfer object |
41,363 | public function GetRefunds ( $ transferId , & $ pagination = null , $ filter = null , $ sorting = null ) { return $ this -> GetList ( 'refunds_get_for_transfer' , $ pagination , '\MangoPay\Refund' , $ transferId , $ filter , $ sorting ) ; } | Retrieve list of Refunds pertaining to a certain Transfer |
41,364 | public function GetReadOnlyProperties ( ) { $ properties = parent :: GetReadOnlyProperties ( ) ; array_push ( $ properties , 'AccessKey' ) ; array_push ( $ properties , 'PreregistrationData' ) ; array_push ( $ properties , 'CardRegistrationURL' ) ; array_push ( $ properties , 'CardId' ) ; array_push ( $ properties , 'ResultCode' ) ; array_push ( $ properties , 'ResultMessage' ) ; array_push ( $ properties , 'Status' ) ; return $ properties ; } | Get array with read - only properties |
41,365 | public function GetHttpHeaderBasicKey ( ) { if ( is_null ( $ this -> _root -> Config -> ClientId ) || strlen ( $ this -> _root -> Config -> ClientId ) == 0 ) { throw new Exception ( 'MangoPayApi.Config.ClientId is not set.' ) ; } if ( is_null ( $ this -> _root -> Config -> ClientPassword ) || strlen ( $ this -> _root -> Config -> ClientPassword ) == 0 ) { throw new Exception ( 'MangoPayApi.Config.ClientPassword is not set.' ) ; } $ signature = $ this -> _root -> Config -> ClientId . ':' . $ this -> _root -> Config -> ClientPassword ; return base64_encode ( $ signature ) ; } | Get basic key for HTTP header |
41,366 | private function GetHttpHeaderStrong ( ) { $ token = $ this -> _root -> OAuthTokenManager -> GetToken ( $ this -> GetAutenticationKey ( ) ) ; if ( is_null ( $ token ) || ! isset ( $ token -> access_token ) || ! isset ( $ token -> token_type ) ) { throw new Exception ( 'OAuth token is not created (or is invalid) for strong authentication' ) ; } return 'Authorization: ' . $ token -> token_type . ' ' . $ token -> access_token ; } | Get HTTP header value with authorization string for strong authentication |
41,367 | public function Create ( $ payIn , $ idempotencyKey = null ) { $ paymentKey = $ this -> GetPaymentKey ( $ payIn ) ; $ executionKey = $ this -> GetExecutionKey ( $ payIn ) ; return $ this -> CreateObject ( 'payins_' . $ paymentKey . '-' . $ executionKey . '_create' , $ payIn , '\MangoPay\PayIn' , null , null , $ idempotencyKey ) ; } | Create new pay - in object |
41,368 | public function CreateRefund ( $ payInId , $ refund , $ idempotencyKey = null ) { return $ this -> CreateObject ( 'payins_createrefunds' , $ refund , '\MangoPay\Refund' , $ payInId , null , $ idempotencyKey ) ; } | Create refund for pay - in object |
41,369 | public function GetRefunds ( $ payInId , & $ pagination = null , $ filter = null , $ sorting = null ) { return $ this -> GetList ( 'refunds_get_for_payin' , $ pagination , '\MangoPay\Refund' , $ payInId , $ filter , $ sorting ) ; } | Retrieves a list of Refunds pertaining to a certain PayIn |
41,370 | public function Create ( $ cardRegistration , $ idempotencyKey = null ) { return $ this -> CreateObject ( 'cardregistration_create' , $ cardRegistration , '\MangoPay\CardRegistration' , null , null , $ idempotencyKey ) ; } | Create new card registration |
41,371 | public function Create ( $ mandate , $ idempotencyKey = null ) { return $ this -> CreateObject ( 'mandates_create' , $ mandate , '\MangoPay\Mandate' , null , null , $ idempotencyKey ) ; } | Create new mandate |
41,372 | public function GetTransactions ( $ mandateId , & $ pagination = null , $ filter = null , $ sorting = null ) { return $ this -> GetList ( 'transactions_get_for_mandate' , $ pagination , '\MangoPay\Transaction' , $ mandateId , $ filter , $ sorting ) ; } | Retrieves list of Transactions pertaining to a certain Mandate |
41,373 | public function UploadLogo ( $ logoUpload , $ idempotencyKey = null ) { try { $ this -> CreateObject ( 'client_upload_logo' , $ logoUpload , null , null , null , $ idempotencyKey ) ; } catch ( \ MangoPay \ Libraries \ ResponseException $ exc ) { if ( $ exc -> getCode ( ) != 204 ) { throw $ exc ; } } } | Upload a logo for client . Only GIF PNG JPG JPEG BMP PDF and DOC formats are accepted and file must be less than about 7MB |
41,374 | public function UploadLogoFromFile ( $ file , $ idempotencyKey = null ) { $ filePath = $ file ; if ( is_array ( $ file ) ) { $ filePath = $ file [ 'tmp_name' ] ; } if ( empty ( $ filePath ) ) { throw new \ MangoPay \ Libraries \ Exception ( 'Path of file cannot be empty' ) ; } if ( ! file_exists ( $ filePath ) ) { throw new \ MangoPay \ Libraries \ Exception ( 'File not exist' ) ; } $ logoUpload = new \ MangoPay \ ClientLogoUpload ( ) ; $ logoUpload -> File = base64_encode ( file_get_contents ( $ filePath ) ) ; if ( empty ( $ logoUpload -> File ) ) { throw new \ MangoPay \ Libraries \ Exception ( 'Content of the file cannot be empty' ) ; } $ this -> UploadLogo ( $ logoUpload , $ idempotencyKey ) ; } | Upload a logo for client from file . Only GIF PNG JPG JPEG BMP PDF and DOC formats are accepted and file must be less than about 7MB |
41,375 | public function GetTransactions ( $ walletId , & $ pagination = null , $ filter = null , $ sorting = null ) { return $ this -> GetList ( 'wallets_alltransactions' , $ pagination , '\MangoPay\Transaction' , $ walletId , $ filter , $ sorting ) ; } | Get transactions for the wallet |
41,376 | public function CreateBankAccount ( $ userId , $ bankAccount , $ idempotencyKey = null ) { $ type = $ this -> GetBankAccountType ( $ bankAccount ) ; return $ this -> CreateObject ( 'users_createbankaccounts_' . $ type , $ bankAccount , '\MangoPay\BankAccount' , $ userId , null , $ idempotencyKey ) ; } | Create bank account for user |
41,377 | public function CreateKycDocument ( $ userId , $ kycDocument , $ idempotencyKey = null ) { return $ this -> CreateObject ( 'kyc_documents_create' , $ kycDocument , '\MangoPay\KycDocument' , $ userId , null , $ idempotencyKey ) ; } | Create new KYC document |
41,378 | public function CreateKycPage ( $ userId , $ kycDocumentId , $ kycPage , $ idempotencyKey = null ) { $ uploaded = false ; try { $ response = $ this -> CreateObject ( 'kyc_page_create' , $ kycPage , null , $ userId , $ kycDocumentId , $ idempotencyKey ) ; $ uploaded = true ; } catch ( \ MangoPay \ Libraries \ ResponseException $ exc ) { if ( $ exc -> getCode ( ) != 204 ) { throw $ exc ; } else { $ uploaded = true ; } } return $ uploaded ; } | Create page for Kyc document |
41,379 | public function CreateKycPageFromFile ( $ userId , $ kycDocumentId , $ filePath , $ idempotencyKey = null ) { if ( empty ( $ filePath ) ) { throw new \ MangoPay \ Libraries \ Exception ( 'Path of file cannot be empty' ) ; } if ( ! file_exists ( $ filePath ) ) { throw new \ MangoPay \ Libraries \ Exception ( 'File not exist' ) ; } $ kycPage = new \ MangoPay \ KycPage ( ) ; $ kycPage -> File = base64_encode ( file_get_contents ( $ filePath ) ) ; if ( empty ( $ kycPage -> File ) ) { throw new \ MangoPay \ Libraries \ Exception ( 'Content of the file cannot be empty' ) ; } return $ this -> CreateKycPage ( $ userId , $ kycDocumentId , $ kycPage , $ idempotencyKey ) ; } | Create page for Kyc document from file |
41,380 | public function GetPreAuthorizations ( $ userId , $ pagination = null , $ filter = null , $ sorting = null ) { return $ this -> GetList ( 'preauthorizations_get_for_user' , $ pagination , '\MangoPay\CardPreAuthorization' , $ userId , $ filter , $ sorting ) ; } | Gets a list with PreAuthorizations belonging to a specific user |
41,381 | private function GetUserResponse ( $ response ) { if ( isset ( $ response -> PersonType ) ) { switch ( $ response -> PersonType ) { case PersonType :: Natural : return $ this -> CastResponseToEntity ( $ response , '\MangoPay\UserNatural' ) ; case PersonType :: Legal : return $ this -> CastResponseToEntity ( $ response , '\MangoPay\UserLegal' ) ; default : throw new Libraries \ Exception ( 'Unexpected response. Wrong PersonType value' ) ; } } else { throw new Libraries \ Exception ( 'Unexpected response. Missing PersonType property' ) ; } } | Get correct user object |
41,382 | public function GetDependsObjects ( ) { return array ( 'PaymentType' => array ( '_property_name' => 'PaymentDetails' , PayInPaymentType :: Card => '\MangoPay\PayInPaymentDetailsCard' , PayInPaymentType :: Preauthorized => '\MangoPay\PayInPaymentDetailsPreAuthorized' , PayInPaymentType :: BankWire => '\MangoPay\PayInPaymentDetailsBankWire' , PayInPaymentType :: DirectDebit => '\MangoPay\PayInPaymentDetailsDirectDebit' , PayInPaymentType :: DirectDebitDirect => '\MangoPay\PayInPaymentDetailsDirectDebitDirect' , PayInPaymentType :: PayPal => '\MangoPay\PayInPaymentDetailsPaypal' , ) , 'ExecutionType' => array ( '_property_name' => 'ExecutionDetails' , PayInExecutionType :: Web => '\MangoPay\PayInExecutionDetailsWeb' , PayInExecutionType :: Direct => '\MangoPay\PayInExecutionDetailsDirect' , PayInExecutionType :: ExternalInstruction => '\MangoPay\PayInExecutionDetailsExternalInstruction' , ) ) ; } | Get array with mapping which property depends on other property |
41,383 | public static function filterMessages ( $ messages , array $ levels = [ ] , array $ categories = [ ] , array $ except = [ ] ) : array { foreach ( $ messages as $ i => $ message ) { if ( ! empty ( $ levels ) && ! in_array ( $ message [ 0 ] , $ levels , true ) ) { unset ( $ messages [ $ i ] ) ; continue ; } $ matched = empty ( $ categories ) ; foreach ( $ categories as $ category ) { if ( $ message [ 2 ] [ 'category' ] === $ category || ! empty ( $ category ) && substr_compare ( $ category , '*' , - 1 , 1 ) === 0 && strpos ( $ message [ 2 ] [ 'category' ] , rtrim ( $ category , '*' ) ) === 0 ) { $ matched = true ; break ; } } if ( $ matched ) { foreach ( $ except as $ category ) { $ prefix = rtrim ( $ category , '*' ) ; if ( ( $ message [ 2 ] [ 'category' ] === $ category || $ prefix !== $ category ) && strpos ( $ message [ 2 ] [ 'category' ] , $ prefix ) === 0 ) { $ matched = false ; break ; } } } if ( ! $ matched ) { unset ( $ messages [ $ i ] ) ; } } return $ messages ; } | Filters the given messages according to their categories and levels . |
41,384 | public static function prepareMessage ( $ message ) { if ( method_exists ( $ message , '__toString' ) ) { return $ message -> __toString ( ) ; } if ( is_scalar ( $ message ) ) { return ( string ) $ message ; } if ( class_exists ( VarDumper :: class ) ) { return VarDumper :: export ( $ message ) ; } throw new InvalidArgumentException ( 'The log message MUST be a string or object implementing __toString()' ) ; } | Prepares message for logging . |
41,385 | public function flush ( bool $ final = false ) : void { $ messages = $ this -> messages ; $ this -> messages = [ ] ; $ this -> dispatch ( $ messages , $ final ) ; } | Flushes log messages from memory to targets . |
41,386 | public function setPageRange ( $ start , $ end ) { $ this -> page_start = $ start ; $ this -> page_end = $ end ; return $ this ; } | Set a start and end page to process . |
41,387 | public function setImageFormat ( $ imageformat , $ pngScaleFactor = null ) { if ( $ imageformat == self :: $ IMAGE_FORMAT_JPEG ) { $ this -> imageDeviceCommand = "jpeg" ; $ this -> imageExtention = "jpg" ; $ this -> pngDownScaleFactor = isset ( $ pngScaleFactor ) ? "-dDownScaleFactor=" . $ pngScaleFactor : "" ; } else if ( $ imageformat == self :: $ IMAGE_FORMAT_PNG ) { $ this -> imageDeviceCommand = "png16m" ; $ this -> imageExtention = "png" ; $ this -> pngDownScaleFactor = "" ; } return $ this ; } | Change the image format to PNG or JPEG |
41,388 | protected function getLinkLabel ( $ driverConfig , $ defaultLabel ) { return $ this -> isIconsEnabled ( ) ? Html :: tag ( 'i' , '' , [ 'class' => $ this -> configurator -> getIconSelector ( $ driverConfig [ 'class' ] ) ] ) : ( isset ( $ driverConfig [ 'label' ] ) ? $ driverConfig [ 'label' ] : $ defaultLabel ) ; } | Build label for driver . |
41,389 | private function createDriver ( $ config ) { $ fullConfig = ArrayHelper :: merge ( [ 'class' => $ config [ 'class' ] , 'url' => $ this -> url , 'title' => $ this -> title , 'description' => $ this -> description , 'imageUrl' => $ this -> imageUrl , 'registerMetaTags' => $ this -> registerMetaTags ( ) , ] , isset ( $ config [ 'config' ] ) ? $ config [ 'config' ] : [ ] , isset ( $ this -> driverProperties [ $ config [ 'class' ] ] ) ? $ this -> driverProperties [ $ config [ 'class' ] ] : [ ] ) ; return Yii :: createObject ( $ fullConfig ) ; } | Creates driver instance . |
41,390 | private function combineOptions ( $ driverConfig ) { $ options = isset ( $ driverConfig [ 'options' ] ) ? $ driverConfig [ 'options' ] : [ ] ; $ globalOptions = $ this -> configurator -> getOptions ( ) ; if ( empty ( $ globalOptions ) ) { return $ options ; } if ( isset ( $ options [ 'class' ] ) ) { Html :: addCssClass ( $ globalOptions , $ options [ 'class' ] ) ; unset ( $ options [ 'class' ] ) ; } return ArrayHelper :: merge ( $ globalOptions , $ options ) ; } | Combine global and custom HTML options . |
41,391 | public static function encodeData ( $ data ) { if ( \ is_array ( $ data ) ) { foreach ( $ data as $ key => $ value ) { $ data [ $ key ] = \ urlencode ( $ value ) ; } return $ data ; } return \ urlencode ( $ data ) ; } | Encode data for URL . |
41,392 | public static function decodeData ( $ data ) { if ( \ is_array ( $ data ) ) { foreach ( $ data as $ key => $ value ) { $ data [ $ key ] = \ urldecode ( $ value ) ; } return $ data ; } return \ urldecode ( $ data ) ; } | Decode the encoded data . |
41,393 | public function appendToData ( $ key , $ value , $ urlEncode = true ) { $ key = '{' . $ key . '}' ; $ this -> _data [ $ key ] = $ urlEncode ? static :: encodeData ( $ value ) : $ value ; } | Append value to data array . |
41,394 | public function init ( ) { $ this -> processShareData ( ) ; $ this -> _data = ArrayHelper :: merge ( [ '{url}' => $ this -> url , '{title}' => $ this -> title , '{description}' => $ this -> description , '{imageUrl}' => $ this -> imageUrl , ] , $ this -> _data ) ; $ metaTags = $ this -> getMetaTags ( ) ; if ( $ this -> registerMetaTags && ! empty ( $ metaTags ) ) { $ rawData = static :: decodeData ( $ this -> _data ) ; $ view = Yii :: $ app -> getView ( ) ; foreach ( $ metaTags as $ metaTag ) { $ metaTag [ 'content' ] = \ strtr ( $ metaTag [ 'content' ] , $ rawData ) ; $ view -> registerMetaTag ( $ metaTag , \ md5 ( \ implode ( ';' , $ metaTag ) ) ) ; } } } | Prepare data data to insert into the link . |
41,395 | final protected function addUrlParam ( & $ link , $ name , $ value ) { $ base = $ name . '=' . $ value ; if ( false !== \ strpos ( $ link , '?' ) ) { $ last = \ substr ( $ link , - 1 ) ; if ( '?' === $ last || '&' === $ last ) { $ link .= $ base ; } else { $ link .= '&' . $ base ; } } else { $ link .= '?' . $ base ; } } | Adds URL param to link . |
41,396 | public function init ( ) { if ( $ this -> isSeoEnabled ( ) && empty ( $ this -> seoOptions ) ) { $ this -> seoOptions = [ 'target' => '_blank' , 'rel' => 'noopener' , ] ; } if ( $ this -> enableIcons || $ this -> enableDefaultIcons ) { $ this -> icons = ArrayHelper :: merge ( self :: DEFAULT_ICONS_MAP , $ this -> icons ) ; } } | Set default values for special link options . |
41,397 | private function paramCommentsAlign ( $ param , $ previousParam ) { $ paramLength = strlen ( $ param [ 'type' ] ) + $ param [ 'type_space' ] + strlen ( $ param [ 'var' ] ) + $ param [ 'var_space' ] ; $ prevLength = strlen ( $ previousParam [ 'type' ] ) + $ previousParam [ 'type_space' ] + strlen ( $ previousParam [ 'var' ] ) + $ previousParam [ 'var_space' ] ; return $ paramLength === $ prevLength ; } | Ensure the method s parameter comments align |
41,398 | private function paramVarsAlign ( $ param , $ previousParam ) { $ paramStringLength = strlen ( $ param [ 'type' ] ) + $ param [ 'type_space' ] ; $ previousParamStringLength = strlen ( $ previousParam [ 'type' ] ) + $ previousParam [ 'type_space' ] ; return $ paramStringLength === $ previousParamStringLength ; } | Ensure the method s parameter variable names align |
41,399 | protected function processSubpackage ( PHP_CodeSniffer_File $ phpcsFile , array $ tags ) { $ tokens = $ phpcsFile -> getTokens ( ) ; foreach ( $ tags as $ tag ) { if ( $ tokens [ ( $ tag + 2 ) ] [ 'code' ] !== T_DOC_COMMENT_STRING ) { continue ; } $ content = $ tokens [ ( $ tag + 2 ) ] [ 'content' ] ; if ( empty ( $ content ) || $ content == '' ) { $ error = 'if included, @subpackage tag must contain a name' ; $ phpcsFile -> addError ( $ error , $ tag , 'EmptySubpackage' ) ; } } } | Process the subpackage tag . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.