idx int64 0 60.3k | question stringlengths 64 4.24k | target stringlengths 5 618 |
|---|---|---|
51,400 | private function _detectVisibility ( $ token ) { if ( $ this -> tokenizer -> checkToken ( $ token , T_PRIVATE ) ) { $ this -> _functionVisibility = 'PRIVATE' ; } else if ( $ this -> tokenizer -> checkToken ( $ token , T_PROTECTED ) ) { $ this -> _functionVisibility = 'PROTECTED' ; } else if ( $ this -> tokenizer -> che... | Process a function parameters to detect visibility and staticity . |
51,401 | private function _processSwitchStop ( ) { if ( $ this -> statementStack -> getCurrentStackItem ( ) -> type === StatementItem :: TYPE_CASE || $ this -> statementStack -> getCurrentStackItem ( ) -> type === StatementItem :: TYPE_DEFAULT ) { $ this -> _checkSwitchCaseNeedBreak ( ) ; $ this -> statementStack -> pop ( ) ; }... | Process the end of a switch block . |
51,402 | private function _checkSwitchNeedDefault ( ) { if ( $ this -> _isActive ( 'switchNeedDefault' ) ) { if ( ! $ this -> statementStack -> getCurrentStackItem ( ) -> switchHasDefault ) { $ this -> _writeError ( 'switchNeedDefault' , $ this -> _getMessage ( 'SWITCH_DEFAULT' ) , $ this -> _switchStartLine , $ this -> _config... | Check if the default case of a switch statement is present . |
51,403 | private function _processSwitchCase ( ) { if ( $ this -> statementStack -> getCurrentStackItem ( ) -> type === StatementItem :: TYPE_CASE || $ this -> statementStack -> getCurrentStackItem ( ) -> type === StatementItem :: TYPE_DEFAULT ) { $ this -> _checkSwitchCaseNeedBreak ( ) ; $ this -> statementStack -> pop ( ) ; }... | Process a case statement . |
51,404 | private function _processSwitchDefault ( ) { if ( $ this -> statementStack -> getCurrentStackItem ( ) -> type === StatementItem :: TYPE_CASE || $ this -> statementStack -> getCurrentStackItem ( ) -> type === StatementItem :: TYPE_DEFAULT ) { $ this -> _checkSwitchCaseNeedBreak ( ) ; $ this -> statementStack -> pop ( ) ... | Process a default statement . |
51,405 | private function _processInterfaceStatement ( ) { $ this -> _checkDocExists ( T_INTERFACE ) ; $ this -> _ncssTotalInterfaces ++ ; $ this -> _ncssFileInterfaces ++ ; if ( $ this -> _isActive ( 'oneInterfacePerFile' ) && $ this -> _ncssFileInterfaces > 1 ) { $ msg = $ this -> _getMessage ( 'ONE_INTERFACE_PER_FILE' , $ th... | Process an interface declaration statement . |
51,406 | private function _processClassStatement ( ) { $ isAfterScopeResolutionOperator = $ this -> tokenizer -> checkPreviousToken ( T_DOUBLE_COLON ) ; if ( $ isAfterScopeResolutionOperator ) { return ; } $ this -> _checkDocExists ( T_CLASS ) ; $ this -> _ncssTotalClasses ++ ; $ this -> _ncssFileClasses ++ ; if ( $ this -> _is... | Process a class declaration statement . |
51,407 | private function _checkEmptyBlock ( ) { if ( $ this -> _isActive ( 'checkEmptyBlock' ) && $ this -> _currentStatement ) { if ( $ this -> tokenizer -> checkNextValidToken ( T_BRACES_CLOSE ) ) { $ msg = $ this -> _getMessage ( 'EMPTY_BLOCK' , $ this -> _currentStatement ) ; $ this -> _writeError ( 'checkEmptyBlock' , $ m... | Check for empty block . |
51,408 | private function _checkEncapsedVariablesInsideString ( ) { if ( $ this -> _isActive ( 'encapsedVariablesInsideString' ) && ( ! $ this -> statementStack -> getCurrentStackItem ( ) -> inHeredoc || ( $ this -> _inFuncCall && ! $ this -> _config -> isException ( 'encapsedVariablesInsideString' , end ( $ this -> _currentFun... | Check for encapsed variables inside string . |
51,409 | private function _checkStrictCompare ( $ text ) { if ( $ this -> _isActive ( 'strictCompare' ) ) { $ message = $ this -> _getMessage ( 'USE_STRICT_COMPARE' , $ text ) ; $ this -> _writeError ( 'strictCompare' , $ message ) ; } } | Check for potential bugs when using comparison operator . |
51,410 | private function _checkInnerAssignment ( ) { if ( $ this -> _isActive ( 'checkInnerAssignment' ) && $ this -> _inControlStatement ) { if ( ! $ this -> _config -> isException ( 'checkInnerAssignment' , $ this -> _currentStatement ) ) { $ this -> _writeError ( 'checkInnerAssignment' , $ this -> _getMessage ( 'INSIDE_ASSI... | Check for inner assignments . |
51,411 | private function _checkEmptyStatement ( ) { if ( $ this -> _isActive ( 'checkEmptyStatement' ) ) { if ( $ this -> tokenizer -> checkNextValidToken ( T_SEMICOLON ) ) { $ this -> _writeError ( 'checkEmptyStatement' , $ this -> _getMessage ( 'EMPTY_STATEMENT' ) ) ; } } } | Check for empty statement . |
51,412 | private function _checkUnusedPrivateFunctions ( ) { if ( $ this -> _isActive ( 'checkUnusedPrivateFunctions' ) ) { $ uncalledFunctions = array_diff ( $ this -> _privateFunctions , $ this -> _usedFunctions ) ; foreach ( $ uncalledFunctions as $ uncalledFunction ) { $ msg = $ this -> _getMessage ( 'UNUSED_PRIVATE_FUNCTIO... | Check for unused functions . |
51,413 | private function _checkUnusedVariables ( ) { if ( $ this -> _isActive ( 'checkUnusedVariables' ) ) { foreach ( $ this -> _variables as $ variable ) { if ( ( ! $ variable -> isUsed ) && ! ( $ this -> _isClass || $ this -> _isView ) && ! $ this -> _config -> isException ( 'checkUnusedVariables' , $ variable -> name ) ) {... | Check for unused variables in the file . |
51,414 | private function _checkUnusedCode ( $ endToken ) { if ( $ this -> _isActive ( 'checkUnusedCode' ) ) { if ( $ this -> statementStack -> getCurrentStackItem ( ) -> type === StatementItem :: TYPE_FUNCTION ) { $ pos = $ this -> tokenizer -> findNextStringPosition ( ';' ) ; $ nextValidToken = $ this -> tokenizer -> peekNext... | Check for unused code . |
51,415 | private function _checkUnusedFunctionParameters ( ) { if ( $ this -> _isActive ( 'checkUnusedFunctionParameters' ) ) { if ( ! $ this -> statementStack -> getParentStackItem ( ) -> docblocInheritDoc ) { foreach ( $ this -> _functionParameters as $ variableName => $ value ) { if ( $ value !== "used" ) { $ msg = $ this ->... | Check for unused function parameters . |
51,416 | private function _processVariable ( $ text ) { if ( ! in_array ( $ text , $ this -> _systemVariables ) ) { $ this -> _checkVariableNaming ( $ text ) ; } $ this -> _checkVariableNameLength ( $ text ) ; $ this -> _checkDeprecation ( $ text ) ; $ this -> _checkReplacements ( $ text ) ; if ( ! empty ( $ this -> _functionPa... | Check the variable use . |
51,417 | private function _processReturn ( ) { if ( ! $ this -> tokenizer -> checkNextValidToken ( T_SEMICOLON ) ) { $ this -> _functionReturns = true ; } $ this -> _checkUnusedCode ( 'RETURN' ) ; } | Process the return token . |
51,418 | private function _checkWhiteSpaceBefore ( $ text ) { if ( $ this -> _isActive ( 'checkWhiteSpaceBefore' ) ) { if ( ! $ this -> _config -> isException ( 'checkWhiteSpaceBefore' , $ text ) ) { if ( ! $ this -> tokenizer -> checkPreviousToken ( T_WHITESPACE ) ) { $ msg = $ this -> _getMessage ( 'SPACE_BEFORE_TOKEN' , $ te... | Check for the presence of a white space before the text . |
51,419 | private function _checkNoWhiteSpaceBefore ( $ text ) { if ( $ this -> _isActive ( 'noSpaceBeforeToken' ) ) { if ( ! $ this -> _config -> isException ( 'noSpaceBeforeToken' , $ text ) ) { if ( $ this -> tokenizer -> checkPreviousToken ( T_WHITESPACE ) ) { $ prevValid = $ this -> tokenizer -> peekPrvsValidToken ( ) ; $ c... | Check for the absence of a white space before the text . |
51,420 | private function _checkWhiteSpaceAfter ( $ text ) { if ( $ this -> _isActive ( 'checkWhiteSpaceAfter' ) ) { if ( ! $ this -> _config -> isException ( 'checkWhiteSpaceAfter' , $ text ) ) { if ( ! $ this -> tokenizer -> checkNextToken ( T_WHITESPACE ) ) { if ( ! ( $ this -> tokenizer -> checkNextToken ( T_NEW_LINE ) || $... | Check for the presence of a white space after the text . |
51,421 | private function _checkNoWhiteSpaceAfter ( $ token ) { if ( $ this -> _isActive ( 'noSpaceAfterToken' ) ) { $ text = $ token -> text ; if ( ! $ this -> _config -> isException ( 'noSpaceAfterToken' , $ text ) ) { if ( $ this -> tokenizer -> checkNextToken ( T_WHITESPACE ) ) { $ tokenAfter = $ this -> tokenizer -> peekNe... | Check for the absence of a white space after the text . |
51,422 | private function _checkLargeLine ( ) { $ checkHTMLLines = $ this -> _config -> getTestProperty ( 'lineLength' , 'checkHTMLLines' ) ; if ( $ checkHTMLLines === "true" || ! $ this -> tokenizer -> checkNextValidToken ( T_INLINE_HTML ) ) { $ maxLength = $ this -> _config -> getTestProperty ( 'lineLength' , 'maxLineLength' ... | Check if the current line exceeds the maxLineLength allowed . |
51,423 | private function _checkIndentation ( $ token ) { $ whitespaceString = $ token -> text ; if ( $ this -> _isActive ( 'indentation' ) ) { $ indentationType = $ this -> _config -> getTestProperty ( 'indentation' , 'type' ) ; if ( strtolower ( $ indentationType ) === 'space' || strtolower ( $ indentationType ) === 'spaces' ... | Checks for presence of tab in the whitespace character string . |
51,424 | private function _checkIndentationLevel ( $ token ) { $ whitespaceString = $ token -> text ; $ indentationNumber = $ this -> _config -> getTestProperty ( 'indentation' , 'number' ) ; if ( empty ( $ indentationNumber ) ) { $ indentationNumber = 4 ; } if ( ! $ this -> _inClass ) { return ; } if ( $ this -> _inControlStat... | Check the indentation level . |
51,425 | private function _checkNeedBraces ( ) { if ( $ this -> _isActive ( 'needBraces' ) ) { $ stmt = strtolower ( $ this -> _currentStatement ) ; if ( in_array ( $ stmt , array ( 'if' , 'elseif' , 'do' , 'for' , 'foreach' ) ) || ( $ stmt === "while" && ! $ this -> statementStack -> getParentStackItem ( ) -> afterDoStatement ... | Checks if the block of code need braces . |
51,426 | private function _processComment ( $ token ) { if ( $ token -> id === T_COMMENT ) { $ this -> _ncssTotalSingleComment ++ ; $ this -> _ncssFileSingleComment ++ ; } else if ( $ token -> id === T_ML_COMMENT ) { $ this -> _ncssTotalMultiComment ++ ; $ this -> _ncssFileMultiComment ++ ; } else if ( $ token -> id === T_DOC_C... | Process a comment . |
51,427 | private function _processAnnotation ( $ token , $ comment ) { $ subToken = strtok ( $ comment , PHP_EOL ) ; while ( $ subToken !== false ) { $ pos = stripos ( $ subToken , "@SuppressWarnings" ) ; if ( $ pos !== false ) { $ suppressedCheck = trim ( substr ( $ subToken , $ pos + strlen ( "@SuppressWarnings" ) ) ) ; $ sup... | Process PHP_DOC looking for annotations . |
51,428 | private function _checkSilenced ( $ text ) { if ( $ this -> _isActive ( 'checkSilencedError' ) ) { if ( ! $ this -> _config -> isException ( 'checkSilencedError' , $ text ) ) { $ previousToken = $ this -> tokenizer -> peekPrvsToken ( ) ; if ( $ previousToken -> id === T_AROBAS ) { $ this -> _writeError ( 'checkSilenced... | Check for silenced call to functions . |
51,429 | private function _checkMandatoryHeader ( ) { if ( $ this -> _isActive ( 'mandatoryHeader' ) ) { $ expectedHeader = $ this -> _config -> getTestProperty ( 'mandatoryHeader' , 'header' ) ; $ expectedHeader = trim ( $ expectedHeader ) ; $ expectedHeader = preg_replace ( '~[\r\n\t ]+~' , '' , $ expectedHeader ) ; $ filecon... | Check for the presence of a mandatory header . |
51,430 | private function _checkDeprecation ( $ text ) { if ( $ this -> _isActive ( 'checkDeprecation' ) ) { $ key = strtolower ( $ text ) ; if ( array_key_exists ( $ key , $ this -> _deprecatedFunctions ) ) { $ msg = $ this -> _getMessage ( 'DEPRECATED_FUNCTION' , $ this -> _deprecatedFunctions [ $ key ] [ 'old' ] , $ this -> ... | Check for deprecated functions . |
51,431 | private function _checkProhibitedFunctions ( $ functionName ) { if ( $ this -> _isActive ( 'checkProhibitedFunctions' ) ) { if ( in_array ( $ functionName , $ this -> _prohibitedFunctions ) ) { $ msg = $ this -> _getMessage ( 'PROHIBITED_FUNCTION' , $ functionName ) ; $ this -> _writeError ( 'checkProhibitedFunctions' ... | Check for prohibited functions . |
51,432 | private function _checkAliases ( $ text ) { if ( $ this -> _isActive ( 'checkAliases' ) ) { $ key = strtolower ( $ text ) ; if ( array_key_exists ( $ key , $ this -> _aliasedFunctions ) ) { $ msg = $ this -> _getMessage ( 'ALIASED_FUNCTION' , $ this -> _aliasedFunctions [ $ key ] [ 'old' ] , $ this -> _aliasedFunctions... | Check for aliased functions . |
51,433 | private function _checkReplacements ( $ text ) { if ( $ this -> _isActive ( 'checkReplacements' ) ) { $ key = strtolower ( $ text ) ; if ( array_key_exists ( $ key , $ this -> _replacements ) ) { $ msg = $ this -> _getMessage ( 'REPLACED' , $ this -> _replacements [ $ key ] [ 'old' ] , $ this -> _replacements [ $ key ]... | Check for replaced functions . |
51,434 | private function _checkShortOpenTag ( $ token ) { if ( $ this -> _isActive ( 'noShortPhpCodeTag' ) ) { $ shortOpenTagPos = strpos ( $ token -> text , '<?php' ) ; if ( $ shortOpenTagPos === false ) { $ this -> _writeError ( 'noShortPhpCodeTag' , $ this -> _getMessage ( 'WRONG_OPEN_TAG' ) ) ; } } } | Check for short open tag . |
51,435 | private function _isActive ( $ check ) { $ test = $ this -> _config -> getTest ( $ check ) ; $ active = ! empty ( $ test ) ; $ active = $ active && ! ( in_array ( $ check , $ this -> _functionSuppressWarnings ) || in_array ( $ check , $ this -> _classSuppressWarnings ) || in_array ( $ check , $ this -> _interfaceSuppre... | Tell is a check is active . |
51,436 | private function _checkEmptyFile ( $ fileName ) { if ( $ this -> _isActive ( 'checkEmptyFile' ) ) { $ msg = $ this -> _getMessage ( 'EMPTY_FILE' , $ fileName ) ; $ this -> _writeError ( 'checkEmptyFile' , $ msg ) ; } } | Check for empty PHP files . |
51,437 | private function _writeError ( $ check , $ message , $ lineNumber = null , $ level = null ) { if ( $ lineNumber === null ) { $ lineNumber = $ this -> lineNumber ; } if ( $ level === null ) { $ level = $ this -> _config -> getTestLevel ( $ check ) ; if ( $ level === null ) { $ level = WARNING ; } } $ this -> errorCounts... | Output the error to the selected reporter . |
51,438 | private function _checkPhpTagsStartLine ( $ token ) { if ( $ this -> _isActive ( 'phpTagsStartLine' ) ) { if ( ! $ this -> _isLineStart ) { $ this -> _writeError ( 'phpTagsStartLine' , $ this -> _getMessage ( 'PHP_TAGS_START_LINE' ) ) ; } } } | Check that the PHP Open or Close tag is at the beginning of the line .. |
51,439 | private function _checkPreferQuotes ( $ token ) { if ( $ this -> _isActive ( 'preferQuotes' ) ) { $ style = $ this -> _config -> getTestProperty ( 'preferQuotes' , 'type' ) ; if ( $ style === SINGLE_QUOTE && $ token -> text === '"' ) { $ this -> _writeError ( 'preferQuotes' , $ this -> _getMessage ( "PREFER_SINGLE_QUOT... | Check the style of the quotes used . |
51,440 | private function _checkVariableNameLength ( $ name ) { if ( $ this -> _isActive ( 'localScopeVariableLength' ) ) { $ name = substr ( $ name , 1 ) ; if ( $ this -> _config -> isException ( 'localScopeVariableLength' , $ name ) ) { return ; } $ length = strlen ( $ name ) ; $ min = $ this -> _config -> getTestProperty ( '... | Check the length of a local variable name . |
51,441 | private function _extractPackageName ( $ filename ) { $ filename = str_replace ( '/' , '.' , $ filename ) ; $ filename = str_replace ( '\\' , '.' , $ filename ) ; while ( strpos ( $ filename , '.' ) === 0 ) { $ filename = substr ( $ filename , 1 ) ; } if ( strlen ( $ filename ) > 4 ) { $ filename = substr ( $ filename ... | Extract a package name from the filename . |
51,442 | private function _getMessage ( ) { set_error_handler ( array ( $ this , '_messageErrorHandler' ) , E_ALL ) ; $ args = func_get_args ( ) ; if ( isset ( $ this -> messages [ $ args [ 0 ] ] ) ) { $ msg = $ this -> messages [ $ args [ 0 ] ] ; try { array_shift ( $ args ) ; $ formattedMsg = vsprintf ( $ msg , $ args ) ; } c... | Returns the message for the language chosen . |
51,443 | private function _inArray ( $ needle , $ haystack ) { foreach ( $ haystack as $ strand ) { if ( fnmatch ( $ strand , $ needle ) ) { return true ; } } return false ; } | Checks if a string is in an array but with wildcards . |
51,444 | protected function initXml ( ) { $ this -> document = new DomDocument ( "1.0" ) ; $ this -> root = $ this -> document -> createElement ( 'checkstyle' ) ; $ this -> root -> setAttribute ( "version" , "1.0.0" ) ; $ this -> document -> appendChild ( $ this -> root ) ; } | XML header . |
51,445 | protected function startNewElement ( $ fileEl ) { $ this -> currentElement = $ this -> document -> createElement ( "file" ) ; if ( substr ( $ fileEl , 0 , 2 ) === './' ) { $ fileEl = substr ( $ fileEl , 2 ) ; } $ this -> currentElement -> setAttribute ( "name" , $ fileEl ) ; } | Creates a new file element . |
51,446 | protected function getUrlToBeCrawled ( ) { if ( ! is_null ( $ this -> option ( 'url' ) ) ) { return $ this -> option ( 'url' ) ; } if ( config ( 'laravel-link-checker.url' ) != '' ) { return config ( 'laravel-link-checker.url' ) ; } if ( config ( 'app.url' ) != '' ) { return config ( 'app.url' ) ; } throw new Exception... | Determine the url to be crawled . |
51,447 | protected function getReporter ( ) : CrawlObserver { if ( ! is_null ( $ this -> option ( 'reporter' ) ) ) { return app ( $ this -> option ( 'reporter' ) ) ; } if ( config ( 'laravel-link-checker.default_reporter' ) != '' ) { return app ( config ( 'laravel-link-checker.default_reporter' ) ) ; } throw new Exception ( 'Co... | Get the reporter . |
51,448 | protected function crawledBadUrls ( ) : bool { return collect ( $ this -> urlsGroupedByStatusCode ) -> keys ( ) -> filter ( function ( $ statusCode ) { return ! $ this -> isSuccessOrRedirect ( $ statusCode ) ; } ) -> count ( ) > 0 ; } | Determine if the crawler saw some bad urls . |
51,449 | public function setIframe ( $ value ) { $ profile = ( ( bool ) $ value ? static :: PROFILE_LOW : static :: PROFILE_NORMAL ) ; return $ this -> setParameter ( 'profile' , $ profile ) ; } | Convenience method to switch iframe mode on or off . This sets the profile parameter . |
51,450 | protected function getBaseData ( ) { $ data = array ( ) ; $ data [ 'VPSProtocol' ] = $ this -> VPSProtocol ; $ data [ 'TxType' ] = $ this -> getTxType ( ) ; $ data [ 'Vendor' ] = $ this -> getVendor ( ) ; $ data [ 'AccountType' ] = $ this -> getAccountType ( ) ? : static :: ACCOUNT_TYPE_E ; if ( $ language = $ this -> ... | Basic authorisation transaction type and protocol version . |
51,451 | protected function getAddressData ( $ type = 'Billing' ) { $ card = $ this -> getCard ( ) ; $ mapping = [ 'Firstnames' => 'FirstName' , 'Surname' => 'LastName' , 'Address1' => 'Address1' , 'Address2' => 'Address2' , 'City' => 'City' , 'PostCode' => 'Postcode' , 'State' => 'State' , 'Country' => 'Country' , 'Phone' => '... | Get either the billing or the shipping address from the card object mapped to Sage Pay field names . |
51,452 | protected function getBillingAddressData ( array $ data = [ ] ) { $ address = $ this -> getAddressData ( 'Billing' ) ; foreach ( $ address as $ name => $ value ) { $ data [ 'Billing' . $ name ] = $ value ; } return $ data ; } | Add the billing address details to the data . |
51,453 | public function sendData ( $ data ) { array_walk ( $ data , function ( & $ value ) { if ( ! isset ( $ value ) ) { $ value = '' ; } } ) ; $ httpResponse = $ this -> httpClient -> request ( 'POST' , $ this -> getEndpoint ( ) , [ 'Content-Type' => 'application/x-www-form-urlencoded' , ] , http_build_query ( $ data ) ) ; $... | Send data to the remote gateway parse the result into an array then use that to instantiate the response object . |
51,454 | public static function parseBodyData ( ResponseInterface $ httpResponse ) { $ bodyText = ( string ) $ httpResponse -> getBody ( ) ; $ lines = preg_split ( '/[\n\r]+/' , $ bodyText ) ; $ responseData = [ ] ; foreach ( $ lines as $ line ) { $ line = explode ( '=' , $ line , 2 ) ; if ( ! empty ( $ line [ 0 ] ) ) { $ respo... | The payload consists of name = > value pairs each on a separate line . |
51,455 | protected function filterItemName ( $ name ) { $ standardChars = '0-9a-zA-Z' ; $ allowedSpecialChars = " +'/\\&:,.-{}" ; $ pattern = '`[^' . $ standardChars . preg_quote ( $ allowedSpecialChars , '/' ) . ']`' ; $ name = trim ( substr ( preg_replace ( $ pattern , '' , $ name ) , 0 , 100 ) ) ; return $ name ; } | Filters out any characters that SagePay does not support from the item name . |
51,456 | protected function getItemData ( ) { $ result = '' ; $ items = $ this -> getItems ( ) ; if ( empty ( $ items ) || $ items -> all ( ) === array ( ) ) { return $ result ; } $ xml = new \ SimpleXMLElement ( '<basket/>' ) ; $ cartHasDiscounts = false ; foreach ( $ items as $ basketItem ) { if ( $ basketItem -> getPrice ( )... | Get an XML representation of the current cart items |
51,457 | protected function getItemDataNonXML ( ) { $ result = '' ; $ items = $ this -> getItems ( ) ; $ count = 0 ; foreach ( $ items as $ basketItem ) { $ description = $ this -> filterNonXmlItemName ( $ basketItem -> getName ( ) ) ; $ vat = '0.00' ; if ( $ basketItem instanceof ExtendItem ) { $ vat = $ basketItem -> getVat (... | Generate Basket string in the older non - XML format This is called if useOldBasketFormat is set to true in the gateway config |
51,458 | public function setTransactionReference ( $ value ) { $ reference = json_decode ( $ value , true ) ; if ( json_last_error ( ) === 0 ) { if ( isset ( $ reference [ 'VendorTxCode' ] ) ) { $ this -> setRelatedTransactionId ( $ reference [ 'VendorTxCode' ] ) ; } if ( isset ( $ reference [ 'VPSTxId' ] ) ) { $ this -> setVps... | A JSON transactionReference passed in is split into its component parts . |
51,459 | protected function getBaseAuthorizeData ( ) { $ this -> validate ( 'amount' , 'card' , 'transactionId' ) ; $ data = $ this -> getBaseData ( ) ; $ data [ 'Description' ] = $ this -> getDescription ( ) ; $ data [ 'Amount' ] = $ this -> getAmount ( ) ; $ data [ 'Currency' ] = $ this -> getCurrency ( ) ; $ data [ 'VendorDa... | The required fields concerning what is being authorised and who it is being authorised for . |
51,460 | public function getTokenData ( $ data = array ( ) ) { if ( $ this -> getToken ( ) || $ this -> getCardReference ( ) ) { $ data [ 'Token' ] = $ this -> getToken ( ) ? : $ this -> getCardReference ( ) ; $ storeToken = $ this -> getStoreToken ( ) ; if ( $ storeToken === null ) { if ( ( bool ) $ this -> getCardReference ( ... | If a token or cardReference is being used then include the details of the token in the data . |
51,461 | public function getCardData ( $ data = array ( ) ) { $ this -> getCard ( ) -> validate ( ) ; if ( $ this -> getCardholderName ( ) ) { $ data [ 'CardHolder' ] = $ this -> getCardholderName ( ) ; } else { $ data [ 'CardHolder' ] = $ this -> getCard ( ) -> getName ( ) ; } if ( ! $ this -> getToken ( ) ) { $ data [ 'CardNu... | If a credit card is being used then include the details of the card in the data . |
51,462 | public function getData ( ) { $ data = $ this -> getBaseAuthorizeData ( ) ; if ( $ this -> getToken ( ) || $ this -> getCardReference ( ) ) { $ data = $ this -> getTokenData ( $ data ) ; } else { $ data = $ this -> getCardData ( $ data ) ; } if ( $ this -> getCard ( ) -> getCvv ( ) !== null ) { $ data [ 'CV2' ] = $ thi... | Add the credit card or token details to the data . |
51,463 | public function sendResponse ( $ status , $ nextUrl , $ detail = null ) { $ message = "Status=$status\r\nRedirectUrl=$nextUrl" ; if ( null !== $ detail ) { $ message .= "\r\nStatusDetail=" . $ detail ; } $ this -> exitWith ( $ message ) ; } | Respond to SagePay confirming or rejecting the payment . |
51,464 | public function getData ( ) { $ this -> validate ( 'currency' , 'description' , 'encryptionKey' , 'returnUrl' ) ; return [ 'VPSProtocol' => $ this -> VPSProtocol , 'TxType' => $ this -> getTxType ( ) , 'Vendor' => $ this -> getVendor ( ) , 'Crypt' => $ this -> generateCrypt ( $ this -> getCryptData ( ) ) , 'TestMode' =... | Get the full set of Sage Pay Form data most of which is encrypted . TxType is only PAYMENT DEFERRED or AUTHENTICATE |
51,465 | public function generateCrypt ( array $ data ) { array_walk ( $ data , function ( & $ value ) { if ( ! isset ( $ value ) ) { $ value = '' ; } } ) ; $ disableUtf8Decode = ( bool ) $ this -> getDisableUtf8Decode ( ) ; $ query = [ ] ; foreach ( $ data as $ name => $ value ) { $ query [ ] = $ name . '=' . ( $ disableUtf8De... | Generate the crypt field from the source data . |
51,466 | public function getData ( ) { $ crypt = $ this -> getCrypt ( ) ? : $ this -> httpRequest -> query -> get ( 'crypt' ) ; if ( empty ( $ crypt ) || ! is_string ( $ crypt ) || substr ( $ crypt , 0 , 1 ) !== '@' ) { throw new InvalidResponseException ( 'Missing or invalid "crypt" parameter' ) ; } $ hexString = substr ( $ cr... | Data will be encrypted as a query parameter . |
51,467 | public function buildSignature ( ) { $ VPSTxId = $ this -> getVPSTxId ( ) ; if ( $ this -> getTxType ( ) === Response :: TXTYPE_TOKEN && $ this -> getStatus ( ) === Response :: SAGEPAY_STATUS_OK ) { $ VPSTxId = str_replace ( [ '{' , '}' ] , '' , $ VPSTxId ) ; } $ signatureData = array ( $ VPSTxId , $ this -> getTransac... | Create the signature calculated from the POST data and the saved SecurityKey . This signature is lower case . |
51,468 | public function getTransactionStatus ( ) { if ( ! $ this -> isValid ( ) ) { return static :: STATUS_FAILED ; } $ status = $ this -> getStatus ( ) ; if ( $ status === Response :: SAGEPAY_STATUS_OK || $ status === Response :: SAGEPAY_STATUS_OK_REPEATED || $ status === Response :: SAGEPAY_STATUS_AUTHENTICATED || $ status ... | Was the transaction successful? |
51,469 | public function getTransactionReference ( ) { $ reference = [ ] ; foreach ( [ 'TxAuthNo' , 'VPSTxId' ] as $ key ) { $ value = $ this -> getDataItem ( $ key ) ; if ( $ value !== null ) { $ reference [ $ key ] = $ value ; } } if ( empty ( $ reference ) ) { return ; } $ reference [ 'SecurityKey' ] = $ this -> getSecurityK... | Gateway Reference . |
51,470 | public function getData ( ) { if ( ! $ this -> getReturnUrl ( ) ) { $ this -> validate ( 'notifyUrl' ) ; } $ data = $ this -> getBaseAuthorizeData ( ) ; $ data = $ this -> getTokenData ( $ data ) ; $ data [ 'NotificationURL' ] = $ this -> getNotifyUrl ( ) ? : $ this -> getReturnUrl ( ) ; $ profile = strtoupper ( $ this... | Add the optional token details to the base data . The returnUrl is supported for legacy applications not using the notifyUrl . |
51,471 | public function getResponseBody ( $ status , $ nextUrl , $ detail = null ) { $ body = [ 'Status=' . $ status , 'RedirectUrl=' . $ nextUrl , ] ; if ( $ detail !== null ) { $ body [ ] = 'StatusDetail=' . $ detail ; } return implode ( static :: LINE_SEP , $ body ) ; } | Construct the response body . |
51,472 | public function sendResponse ( $ status , $ nextUrl , $ detail = null ) { $ message = $ this -> getResponseBody ( $ status , $ nextUrl , $ detail ) ; echo $ message ; if ( ( bool ) $ this -> getExitOnResponse ( ) ) { exit ; } } | Respond to SagePay confirming or rejecting the notification . |
51,473 | public function getData ( ) { $ signature = $ this -> getSignature ( ) ; $ VPSSignature = strtolower ( $ this -> httpRequest -> request -> get ( 'VPSSignature' ) ) ; if ( $ VPSSignature !== $ signature ) { throw new InvalidResponseException ; } return $ this -> httpRequest -> request -> all ( ) ; } | Get the POSTed data checking that the signature is valid . |
51,474 | public function getExpiryDate ( $ format = null ) { $ expiryDate = $ this -> getDataItem ( 'ExpiryDate' ) ; if ( $ format === null || $ expiryDate === null ) { return $ expiryDate ; } else { return gmdate ( $ format , gmmktime ( 0 , 0 , 0 , $ this -> getExpiryMonth ( ) , 1 , $ this -> getExpiryYear ( ) ) ) ; } } | Raw expiry date for the card MMYY format by default . The expiry date is available for Sage Pay Direct responses even if the remaining card details are not . Also supports custom formats . |
51,475 | public function getExpiryYear ( ) { $ expiryDate = $ this -> getDataItem ( 'ExpiryDate' ) ; if ( ! empty ( $ expiryDate ) ) { $ dateTime = \ DateTime :: createFromFormat ( 'y' , substr ( $ expiryDate , 2 , 2 ) ) ; return ( int ) $ dateTime -> format ( 'Y' ) ; } } | Get the card expiry year . |
51,476 | protected function addBladeDirectives ( ) { $ this -> app -> afterResolving ( 'blade.compiler' , function ( BladeCompiler $ bladeCompiler ) { $ bladeCompiler -> directive ( 'meta' , function ( $ arguments ) { return "<?php echo Meta::tag($arguments); ?>" ; } ) ; $ bladeCompiler -> directive ( 'metas' , function ( $ arg... | Register blade directives |
51,477 | public function customersNotesCreate ( $ note , $ site = null ) { if ( empty ( $ note [ 'customer' ] [ 'id' ] ) && empty ( $ note [ 'customer' ] [ 'externalId' ] ) ) { throw new \ InvalidArgumentException ( 'Customer identifier must be set' ) ; } return $ this -> client -> makeRequest ( '/customers/notes/create' , "POS... | Create customer note |
51,478 | public function costsCreate ( array $ cost , $ site = null ) { if ( ! count ( $ cost ) ) { throw new \ InvalidArgumentException ( 'Parameter `cost` must contains a data' ) ; } return $ this -> client -> makeRequest ( '/costs/create' , "POST" , $ this -> fillSite ( $ site , [ 'cost' => json_encode ( $ cost ) ] ) ) ; } | Create a cost |
51,479 | public function costsDelete ( array $ ids ) { if ( ! count ( $ ids ) ) { throw new \ InvalidArgumentException ( 'Parameter `ids` must contains a data' ) ; } return $ this -> client -> makeRequest ( '/costs/delete' , "POST" , [ 'ids' => json_encode ( $ ids ) ] ) ; } | Delete costs set |
51,480 | public function costsEdit ( array $ cost , $ site = null ) { if ( ! count ( $ cost ) ) { throw new \ InvalidArgumentException ( 'Parameter `cost` must contains a data' ) ; } return $ this -> client -> makeRequest ( sprintf ( '/costs/%s/edit' , $ cost [ 'id' ] ) , "POST" , $ this -> fillSite ( $ site , [ 'cost' => json_... | Edit a cost |
51,481 | public function costsDeleteById ( $ id ) { if ( ! empty ( $ id ) ) { throw new \ InvalidArgumentException ( 'Parameter `id` must contains a data' ) ; } return $ this -> client -> makeRequest ( sprintf ( '/costs/%s/delete' , $ id ) , "POST" ) ; } | Delete cost by id |
51,482 | public function deliveryShipmentsCreate ( array $ shipment , $ deliveryType , $ site = null ) { if ( ! count ( $ shipment ) ) { throw new \ InvalidArgumentException ( 'Parameter `shipment` must contains a data' ) ; } return $ this -> client -> makeRequest ( '/delivery/shipments/create' , "POST" , $ this -> fillSite ( $... | Create delivery shipment |
51,483 | public function deliveryShipmentsEdit ( array $ shipment , $ site = null ) { if ( ! count ( $ shipment ) ) { throw new \ InvalidArgumentException ( 'Parameter `shipment` must contains a data' ) ; } if ( empty ( $ shipment [ 'id' ] ) ) { throw new \ InvalidArgumentException ( 'Parameter `shipment` must contains an `id` ... | Edit delivery shipment |
51,484 | public function integrationModulesGet ( $ code ) { if ( empty ( $ code ) ) { throw new \ InvalidArgumentException ( 'Parameter `code` must be set' ) ; } return $ this -> client -> makeRequest ( sprintf ( '/integration-modules/%s' , $ code ) , "GET" ) ; } | Get module configuration |
51,485 | public function integrationModulesEdit ( array $ configuration ) { if ( ! count ( $ configuration ) || empty ( $ configuration [ 'code' ] ) ) { throw new \ InvalidArgumentException ( 'Parameter `configuration` must contains a data & configuration `code` must be set' ) ; } return $ this -> client -> makeRequest ( sprint... | Edit module configuration |
51,486 | public function telephonySettingsEdit ( $ code , $ clientId , $ active = false , $ name = false , $ makeCallUrl = false , $ image = false , $ additionalCodes = [ ] , $ externalPhones = [ ] , $ allowEdit = false , $ inputEventSupported = false , $ outputEventSupported = false , $ hangupEventSupported = false , $ changeU... | Edit telephony settings |
51,487 | public function ordersPacksCreate ( array $ pack , $ site = null ) { if ( ! count ( $ pack ) ) { throw new \ InvalidArgumentException ( 'Parameter `pack` must contains a data' ) ; } return $ this -> client -> makeRequest ( '/orders/packs/create' , "POST" , $ this -> fillSite ( $ site , [ 'pack' => json_encode ( $ pack ... | Create orders assembly |
51,488 | public function ordersPacksDelete ( $ id ) { if ( empty ( $ id ) ) { throw new \ InvalidArgumentException ( 'Parameter `id` must be set' ) ; } return $ this -> client -> makeRequest ( sprintf ( '/orders/packs/%s/delete' , $ id ) , "POST" ) ; } | Delete orders assembly by id |
51,489 | public function ordersPacksEdit ( array $ pack , $ site = null ) { if ( ! count ( $ pack ) || empty ( $ pack [ 'id' ] ) ) { throw new \ InvalidArgumentException ( 'Parameter `pack` must contains a data & pack `id` must be set' ) ; } return $ this -> client -> makeRequest ( sprintf ( '/orders/packs/%s/edit' , $ pack [ '... | Edit orders assembly |
51,490 | public function usersList ( array $ filter = [ ] , $ page = null , $ limit = null ) { $ parameters = [ ] ; if ( count ( $ filter ) ) { $ parameters [ 'filter' ] = $ filter ; } if ( null !== $ page ) { $ parameters [ 'page' ] = ( int ) $ page ; } if ( null !== $ limit ) { $ parameters [ 'limit' ] = ( int ) $ limit ; } r... | Returns users list |
51,491 | public function usersStatus ( $ id , $ status ) { $ statuses = [ "free" , "busy" , "dinner" , "break" ] ; if ( empty ( $ status ) || ! in_array ( $ status , $ statuses ) ) { throw new \ InvalidArgumentException ( 'Parameter `status` must be not empty & must be equal one of these values: free|busy|dinner|break' ) ; } re... | Change user status |
51,492 | public function customersUpload ( array $ customers , $ site = null ) { if ( ! count ( $ customers ) ) { throw new \ InvalidArgumentException ( 'Parameter `customers` must contains array of the customers' ) ; } return $ this -> client -> makeRequest ( '/customers/upload' , "POST" , $ this -> fillSite ( $ site , [ 'cust... | Upload array of the customers |
51,493 | public function customersEdit ( array $ customer , $ by = 'externalId' , $ site = null ) { if ( ! count ( $ customer ) ) { throw new \ InvalidArgumentException ( 'Parameter `customer` must contains a data' ) ; } $ this -> checkIdParameter ( $ by ) ; if ( ! array_key_exists ( $ by , $ customer ) ) { throw new \ InvalidA... | Edit a customer |
51,494 | public function ordersStatuses ( array $ ids = [ ] , array $ externalIds = [ ] ) { $ parameters = [ ] ; if ( count ( $ ids ) ) { $ parameters [ 'ids' ] = $ ids ; } if ( count ( $ externalIds ) ) { $ parameters [ 'externalIds' ] = $ externalIds ; } return $ this -> client -> makeRequest ( '/orders/statuses' , "GET" , $ ... | Returns statuses of the orders |
51,495 | public function ordersUpload ( array $ orders , $ site = null ) { if ( ! count ( $ orders ) ) { throw new \ InvalidArgumentException ( 'Parameter `orders` must contains array of the orders' ) ; } return $ this -> client -> makeRequest ( '/orders/upload' , "POST" , $ this -> fillSite ( $ site , [ 'orders' => json_encode... | Upload array of the orders |
51,496 | public function ordersGet ( $ id , $ by = 'externalId' , $ site = null ) { $ this -> checkIdParameter ( $ by ) ; return $ this -> client -> makeRequest ( "/orders/$id" , "GET" , $ this -> fillSite ( $ site , [ 'by' => $ by ] ) ) ; } | Get order by id or externalId |
51,497 | public function ordersEdit ( array $ order , $ by = 'externalId' , $ site = null ) { if ( ! count ( $ order ) ) { throw new \ InvalidArgumentException ( 'Parameter `order` must contains a data' ) ; } $ this -> checkIdParameter ( $ by ) ; if ( ! array_key_exists ( $ by , $ order ) ) { throw new \ InvalidArgumentExceptio... | Edit an order |
51,498 | public function telephonyCallManager ( $ phone , $ details ) { if ( ! isset ( $ phone ) ) { throw new \ InvalidArgumentException ( 'Phone number must be set' ) ; } $ parameters [ 'phone' ] = $ phone ; $ parameters [ 'details' ] = isset ( $ details ) ? $ details : 0 ; return $ this -> client -> makeRequest ( '/telephony... | Get call manager |
51,499 | public function customFieldsCreate ( $ entity , $ customField ) { if ( ! count ( $ customField ) || empty ( $ customField [ 'code' ] ) || empty ( $ customField [ 'name' ] ) || empty ( $ customField [ 'type' ] ) ) { throw new \ InvalidArgumentException ( 'Parameter `customField` must contain a data & fields `code`, `nam... | Create custom field |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.