idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
41,100 | public function getPrimaryKeyForForeignModel ( ) { $ model = $ this -> getForeignModelInstance ( ) ; if ( $ this -> isModel ( $ model ) ) { return $ model -> getKeyName ( ) ; } return $ this -> getKeyNameFromResource ( ) ? : 'id' ; } | Gets the name of the foreign model s primary key . |
41,101 | public function getModelColumns ( ) { $ model = $ this -> getForeignModelInstance ( ) ; $ columns = [ ] ; if ( $ this -> isModel ( $ model ) ) { $ tableName = $ model -> getTable ( ) ; $ columns = DB :: getSchemaBuilder ( ) -> getColumnListing ( $ tableName ) ; } if ( count ( $ columns ) == 0 ) { $ columns = $ this -> ... | Gets the foreign model columns . |
41,102 | protected function getKeyNameFromResource ( ) { $ resource = $ this -> getForeignResource ( ) ; if ( ! is_null ( $ resource ) && ( ( $ field = $ resource -> getPrimaryField ( ) ) != null ) ) { return $ field -> name ; } return null ; } | Gets the foreign model columns from the resource file if one exists |
41,103 | protected function getForeignResource ( ) { $ modelName = $ this -> getForeignModelName ( ) ; $ resourceFile = ResourceMapper :: pluckFirst ( $ modelName ) ? : Helpers :: makeJsonFileName ( $ modelName ) ; if ( File :: exists ( Config :: getResourceFilePath ( $ resourceFile ) ) ) { return Resource :: fromFile ( $ resou... | Gets the foreign model fields from resource file |
41,104 | private function getForeignModelInstance ( ) { try { if ( ! $ this -> foreignModel ) { $ model = $ this -> getFullForeignModel ( ) ; if ( class_exists ( $ model ) ) { $ this -> foreignModel = new $ model ( ) ; } else { $ this -> foreignModel = '' ; } } return $ this -> foreignModel ; } catch ( Exception $ e ) { return ... | Gets a single instance of the foreign mode . |
41,105 | public static function get ( array $ options ) { if ( ! array_key_exists ( 'type' , $ options ) || ! array_key_exists ( 'params' , $ options ) || ! array_key_exists ( 'name' , $ options ) ) { if ( count ( $ options ) >= 3 ) { $ values = array_values ( $ options ) ; $ field = isset ( $ values [ 3 ] ) ? $ values [ 3 ] : ... | Get a foreign relationship from given array |
41,106 | public static function fromString ( $ rawRelation ) { $ parts = explode ( ';' , $ rawRelation ) ; $ collection = [ ] ; foreach ( $ parts as $ part ) { if ( ! str_contains ( $ part , ':' ) ) { continue ; } list ( $ key , $ value ) = explode ( ':' , $ part ) ; if ( $ key == 'params' || str_contains ( $ value , '|' ) ) { ... | Get a foreign relationship from given string |
41,107 | public static function predict ( $ fieldName , $ modelPath ) { $ patterns = Config :: getKeyPatterns ( ) ; if ( Helpers :: strIs ( $ patterns , $ fieldName ) ) { $ relationName = camel_case ( Helpers :: extractModelName ( $ fieldName ) ) ; $ model = Helpers :: guessModelFullName ( $ fieldName , $ modelPath ) ; $ parame... | Get a predictable foreign relation using the given field s name |
41,108 | protected function getFields ( ) { if ( is_null ( $ this -> fields ) ) { $ columns = $ this -> getColumns ( ) ; if ( empty ( $ columns ) ) { throw new Exception ( 'The table ' . $ this -> tableName . ' was not found in the ' . $ this -> databaseName . ' database.' ) ; } $ this -> fields = $ this -> transfer ( $ columns... | Gets the final fields . |
41,109 | public function getResource ( ) { $ fields = $ this -> getFields ( ) ; $ autoManage = $ this -> containsUpdateAtAndCreatedAt ( $ fields ) ; $ resource = new Resource ( $ fields , $ this -> getRelations ( ) , $ this -> getIndexes ( ) , $ autoManage ) ; $ resource -> setTableName ( $ this -> tableName ) ; return $ resour... | Gets the final resource . |
41,110 | protected function containsUpdateAtAndCreatedAt ( $ fields ) { $ autoManagedFields = array_filter ( $ fields , function ( $ field ) { return $ field -> isAutoManagedOnUpdate ( ) ; } ) ; return count ( $ autoManagedFields ) == 2 ; } | Check if the given fields contains autoManagedFields |
41,111 | protected function getHtmlType ( $ type ) { $ map = Config :: getEloquentToHtmlMap ( ) ; if ( array_key_exists ( $ type , $ map ) ) { return $ map [ $ type ] ; } return 'text' ; } | Get the html type for a given field . |
41,112 | protected function getModelName ( $ tableName ) { $ modelName = ResourceMapper :: pluckFirst ( $ tableName , 'table-name' , 'model-name' ) ; return $ modelName ? : $ this -> makeModelName ( $ tableName ) ; } | Gets the model s name from a given table name |
41,113 | protected function getDestenationFile ( $ language , $ name ) { $ path = $ this -> getLocalePath ( $ language ) ; return sprintf ( '%s%s.php' , $ path , $ name ) ; } | Gets the destenation file . |
41,114 | protected function registerMessages ( array $ messages , $ language ) { if ( count ( $ messages ) > 0 ) { $ this -> getTranslator ( ) -> addLines ( $ messages , $ language ) ; } return $ this ; } | Registers messages to the in - memory collection . |
41,115 | protected function addMessagesToFile ( $ fileFullname , $ messages , $ language ) { if ( ! $ this -> isFileExists ( $ fileFullname ) || $ this -> option ( 'force' ) ) { $ this -> createMessageToFile ( $ fileFullname , $ messages , $ language ) ; } else { $ this -> appendMessageToFile ( $ fileFullname , $ messages ) ; }... | Adds new messages to a language file . It either creates a new file or append to an existsing file . |
41,116 | protected function appendMessageToFile ( $ fileFullname , $ messages ) { $ content = $ this -> getFileContent ( $ fileFullname ) ; $ index = $ this -> getCursorPosition ( $ content ) ; $ baseFile = basename ( $ fileFullname ) ; if ( $ index === false ) { throw new Exception ( 'Could not find a position in the [' . $ ba... | Appends message to an existing language s file . |
41,117 | protected function getCursorPosition ( $ stub ) { $ position = strrpos ( $ stub , ',' ) ; return $ position !== false ? $ position : strrpos ( $ stub , '[' ) ; } | Gets the index on where to append messages to of a given stub . |
41,118 | protected function createMessageToFile ( $ fileFullname , $ messages , $ language ) { $ stub = $ this -> getStubContent ( 'language' ) ; $ this -> replaceFieldName ( $ stub , $ messages ) -> createFile ( $ fileFullname , $ stub ) ; $ this -> info ( 'The file "' . $ language . '/' . basename ( $ fileFullname ) . '" was ... | Creates a new language file with with a given messages . |
41,119 | protected function getLangPhrases ( array $ labels , array & $ messagesToRegister ) { $ messages = [ ] ; foreach ( $ labels as $ label ) { if ( ! $ this -> isMessageExists ( $ label -> localeGroup , $ label -> lang ) || $ this -> option ( 'force' ) ) { $ messages [ ] = $ this -> getMessage ( $ label ) ; $ messagesToReg... | Creates a string on phrases . |
41,120 | protected function getDestinationPath ( $ viewsDirectory ) { $ path = Config :: getViewsPath ( ) ; if ( ! empty ( $ viewsDirectory ) ) { $ path .= Helpers :: getPathWithSlash ( $ viewsDirectory ) ; } return $ path ; } | It gets the views destenation path |
41,121 | protected function getDestinationViewFullname ( $ viewsDirectory , $ routesPrefix , $ viewName = null ) { $ viewsPath = $ this -> getFullViewsPath ( $ viewsDirectory , $ routesPrefix ) ; $ filename = $ this -> getDestinationViewName ( $ viewName ? : $ this -> getViewType ( ) ) ; return $ this -> getDestinationPath ( $ ... | It generate the view including the full path |
41,122 | protected function replaceCommonTemplates ( & $ stub , ViewInput $ input , array $ fields ) { $ viewLabels = new ViewLabelsGenerator ( $ input -> modelName , $ fields , $ this -> isCollectiveTemplate ( ) ) ; $ standardLabels = $ viewLabels -> getLabels ( ) ; $ this -> replaceModelName ( $ stub , $ input -> modelName ) ... | It Replaces the primaryKey modelNames routeNames in a given stub |
41,123 | protected function replaceFileUpload ( & $ stub , array $ fields ) { $ code = $ this -> containsfile ( $ fields ) ? $ this -> getFileUploadAttribute ( $ this -> getTemplateName ( ) ) : '' ; return $ this -> replaceTemplate ( 'upload_files' , $ code , $ stub ) ; } | It Replaces fieldUpload in the given stub . |
41,124 | protected function createMissingViews ( ViewInput $ input , array $ views = [ 'form' ] ) { foreach ( $ views as $ view ) { if ( ! $ this -> isViewExists ( $ input -> viewsDirectory , $ input -> prefix , $ view ) ) { $ this -> callSilent ( $ this -> getViewCommand ( $ view ) , $ input -> getArrguments ( ) ) ; } } return... | It creates given views is they don t already exists |
41,125 | protected function isViewExists ( $ viewsDirectory , $ routesPrefix , $ viewName ) { $ destenatioFile = $ this -> getDestinationViewFullname ( $ viewsDirectory , $ routesPrefix , $ viewName ) ; return $ this -> alreadyExists ( $ destenatioFile ) ; } | It checks of a destination view exists or not |
41,126 | protected function createLanguageFile ( $ langFile , $ resourceFile , $ modelName ) { $ this -> callSilent ( 'create:language' , [ 'model-name' => $ modelName , '--language-filename' => $ langFile , '--resource-file' => $ resourceFile , '--template-name' => $ this -> getTemplateName ( ) , ] ) ; return $ this ; } | It called tha create - locale command to generate the locale config |
41,127 | protected function getFullViewsPath ( $ viewsDirectory , $ routesPrefix ) { $ path = ! empty ( $ routesPrefix ) ? Helpers :: getPathWithSlash ( str_replace ( '.' , '-' , $ routesPrefix ) ) : '' ; if ( ! empty ( $ viewsDirectory ) ) { $ path .= Helpers :: getPathWithSlash ( $ viewsDirectory ) ; } return $ path ; } | Gets destenation view path |
41,128 | protected function getHtmlGenerator ( array $ fields , $ modelName , $ template ) { if ( $ this -> isCollectiveTemplate ( $ template ) ) { return new LaravelCollectiveHtml ( $ fields , $ modelName , $ template ) ; } return new StandardHtml ( $ fields , $ modelName , $ template ) ; } | Gets a new instance of the proper html generator . |
41,129 | protected function getValidationRules ( array $ fields ) { $ validations = '' ; foreach ( $ fields as $ field ) { $ rules = $ field -> getValidationRule ( ) ; $ customRules = $ this -> extractCustomValidationRules ( $ rules ) ; if ( ! empty ( $ rules ) ) { if ( $ field -> isFile ( ) ) { $ rules = array_filter ( $ rules... | Gets laravel ready field validation format from a given string |
41,130 | protected function extractCustomValidationRules ( array $ rules ) { $ customRules = array_filter ( $ rules , function ( $ rule ) { return $ this -> isCustomRule ( $ rule ) ; } ) ; return $ customRules ; } | Extracts the custom validation rules from the given rules array . |
41,131 | protected function getBooleanSnippet ( array $ fields , $ requestVariable = '$this' ) { $ code = '' ; foreach ( $ fields as $ field ) { if ( $ field -> isBoolean ( ) && $ field -> isCheckbox ( ) ) { $ code .= sprintf ( " \$data['%s'] = %s->has('%s');" , $ field -> name , $ requestVariable , $ field -> name ) . P... | Gets the code that is needed to check for bool property . |
41,132 | protected function getFileValidationSnippet ( array $ fields , $ input , $ requestVariable = '$this' ) { $ validation = [ ] ; $ stub = <<<EOF if ([% request_variable %]->route()->getAction()['as'] == '[% store_route_name %]' || [% request_variable %]->has('custom_delete_[% field_name %]')) { array_pu... | Gets the validation rules for the attachment files |
41,133 | protected function getStringToNullSnippet ( array $ fields ) { if ( $ this -> isConvertEmptyStringsToNullRegistered ( ) ) { return '' ; } $ code = '' ; foreach ( $ fields as $ field ) { if ( $ field -> isNullable && ! $ field -> isPrimary && ! $ field -> isAutoIncrement && ! $ field -> isRequired ( ) && ! $ field -> is... | Gets the code that is needed to convert empty string to null . |
41,134 | protected function getUploadFileMethod ( array $ fields , $ withFormRequest = false ) { if ( ! $ withFormRequest && Config :: createMoveFileMethod ( ) && $ this -> containsfile ( $ fields ) ) { $ stubName = 'controller-upload-method' ; if ( Helpers :: isNewerThanOrEqualTo ( ) ) { $ stubName .= '-5.3' ; } return $ this ... | Gets the method s stub that handels the file uploading . |
41,135 | protected function replaceModelName ( & $ stub , $ modelName , $ prefix = 'model_' ) { $ englishSingle = $ this -> modelNamePlainEnglish ( $ modelName ) ; $ plural = Str :: plural ( $ englishSingle ) ; $ stub = $ this -> strReplace ( $ prefix . 'name' , $ englishSingle , $ stub ) ; $ stub = $ this -> strReplace ( $ pre... | Replace the modelName fo the given stub . |
41,136 | public function getNameInput ( ) { $ name = Helpers :: upperCaseEveyWord ( trim ( $ this -> argument ( 'controller-name' ) ) ) ; $ path = Config :: getControllersPath ( ) ; $ directory = trim ( $ this -> option ( 'controller-directory' ) ) ; if ( ! empty ( $ directory ) ) { $ path .= Helpers :: getPathWithSlash ( $ dir... | Gets the desired class name from the command - line . |
41,137 | protected function getAffirmMethod ( $ withFormRequest , array $ fields , $ requestNamespace , $ input ) { if ( $ withFormRequest || Helpers :: isNewerThanOrEqualTo ( '5.5' ) ) { return '' ; } $ stub = $ this -> getStubContent ( 'controller-affirm-method' ) ; $ this -> replaceValidationRules ( $ stub , $ this -> getVal... | Gets the affirm method . |
41,138 | protected function getCommandInput ( ) { $ modelName = trim ( $ this -> argument ( 'model-name' ) ) ; $ cName = trim ( $ this -> option ( 'controller-name' ) ) ; $ controllerName = $ cName ? str_finish ( $ cName , Config :: getControllerNamePostFix ( ) ) : Helpers :: makeControllerName ( $ modelName ) ; $ viewDirectory... | Gets a clean command - line arguments and options . |
41,139 | protected function getConstructor ( $ withAuth ) { $ stub = $ this -> getStubContent ( 'controller-constructor' ) ; $ middleware = $ withAuth ? '$this->middleware(\'auth\');' : '' ; $ this -> replaceAuthMiddlewear ( $ stub , $ middleware ) ; $ starts = strpos ( $ stub , '{' ) ; $ ends = strrpos ( $ stub , '}' ) ; if ( ... | Gets controller s constructor . |
41,140 | protected function getControllersNamespace ( $ path ) { $ path = Helpers :: getAppNamespace ( ) . Config :: getControllersPath ( $ path ) ; return rtrim ( Helpers :: convertSlashToBackslash ( $ path ) , '\\' ) ; } | Gets the controllers namespace |
41,141 | protected function getFullClassToExtend ( $ extend ) { if ( empty ( $ extend ) ) { return '' ; } $ appNamespace = Helpers :: getAppNamespace ( ) ; if ( starts_with ( $ extend , $ appNamespace ) ) { $ extend = str_replace ( $ appNamespace , '' , $ extend ) ; } return $ appNamespace . trim ( $ extend , '\\' ) ; } | Gets the full class name to extend |
41,142 | protected function getModelNamespace ( $ modelName , $ modelDirectory ) { if ( ! empty ( $ modelDirectory ) ) { $ modelDirectory = str_finish ( $ modelDirectory , '\\' ) ; } $ namespace = Helpers :: getAppNamespace ( ) . ltrim ( Config :: getModelsPath ( $ modelDirectory . $ modelName ) , '\\' ) ; return rtrim ( Helper... | Gets the namespace of the model |
41,143 | protected function getOnStoreAction ( array $ fields ) { $ final = [ ] ; foreach ( $ fields as $ field ) { $ action = $ this -> extractClassFromString ( $ field -> onStore ) ; if ( ! empty ( $ action ) ) { $ final [ ] = $ this -> getArrayReadyString ( $ field -> name , $ action ) ; } } return implode ( PHP_EOL , $ fina... | Gets the setter action for the given field on - store . |
41,144 | protected function getOnUpdateAction ( array $ fields ) { $ final = [ ] ; foreach ( $ fields as $ field ) { $ action = $ this -> extractClassFromString ( $ field -> onUpdate ) ; if ( ! empty ( $ action ) ) { $ final [ ] = $ this -> getArrayReadyString ( $ field -> name , $ action ) ; } } return implode ( PHP_EOL , $ fi... | Gets the setter action for the given field on - update . |
41,145 | protected function getRelationAccessor ( ForeignRelationship $ collection ) { return sprintf ( '$%s = %s::pluck(\'%s\',\'%s\')->all();' , $ collection -> getCollectionName ( ) , $ collection -> getForeignModel ( ) , $ collection -> getField ( ) , $ collection -> getPrimaryKeyForForeignModel ( ) ) ; } | Gets the relation accessor for the given foreign renationship . |
41,146 | protected function getRequiredUseClasses ( array $ fields , array $ additions = [ ] ) { $ commands = [ ] ; foreach ( $ additions as $ addition ) { $ commands [ ] = $ this -> getUseClassCommand ( $ addition ) ; } $ collections = $ this -> getRelationCollections ( $ fields , 'form' ) ; foreach ( $ collections as $ collec... | Gets the needed models to use for in the controller . |
41,147 | protected function isContainMultipleAnswers ( array $ fields ) { $ filtered = array_filter ( $ fields , function ( $ field ) { return $ field -> isMultipleAnswers ( ) ; } ) ; return count ( $ filtered ) > 0 ; } | Checks if a given fields array conatins at least one multiple answers field . |
41,148 | public static function getSystemPath ( $ file = null ) { $ path = self :: getStringBaseValue ( 'system_files_path' , 'resources/laravel-code-generator/system' ) ; return Helpers :: getPathWithSlash ( $ path ) . $ file ; } | Gets the default value of the system path |
41,149 | public static function shouldBePlural ( $ key ) { $ config = self :: getArrayBaseValue ( 'plural_names_for' , [ 'controller-name' => true , 'request-form-name' => true , 'route-group' => true , 'language-file-name' => true , 'resource-file-name' => true , 'table-name' => true , ] ) ; if ( isset ( $ config [ $ key ] ) )... | Checks if a given file type should be a plural or not . |
41,150 | public static function get ( $ index , $ default = null ) { $ key = self :: getKey ( $ index ) ; return LaravelConfig :: get ( $ key , $ default ) ; } | Get the config value of the given index using the default configs . |
41,151 | public static function getCustom ( $ index , $ default = null ) { $ key = self :: getCustomKey ( $ index ) ; return LaravelConfig :: get ( $ key , $ default ) ; } | Get the config value of the given index using the custom configs . |
41,152 | public static function getArrayBaseValue ( $ index , $ default = [ ] ) { $ values = ( array ) self :: getCustom ( $ index , [ ] ) ; return array_merge ( ( array ) self :: get ( $ index , $ default ) , $ values ) ; } | Get the proper array - based value from the config |
41,153 | public static function getBoolBaseValue ( $ index , $ default ) { if ( self :: hasCustom ( $ index ) ) { return ( bool ) self :: getCustom ( $ index ) ; } return ( bool ) self :: get ( $ index , true ) ; } | Get the proper bool - based value from the config |
41,154 | public static function getStringBaseValue ( $ index , $ default ) { if ( self :: hasCustom ( $ index ) ) { return ( string ) self :: getCustom ( $ index ) ; } return ( string ) self :: get ( $ index , $ default ) ; } | Get the proper string - based value from the config |
41,155 | public static function getCommonDefinitions ( ) { $ customValues = ( array ) self :: getCustom ( 'common_definitions' , [ ] ) ; $ defaultValues = self :: get ( 'common_definitions' , [ ] ) ; $ final = [ ] ; $ finalMatchingKeys = [ ] ; foreach ( $ defaultValues as $ key => $ defaultValue ) { if ( is_array ( $ defaultVal... | Gets the common definitions . |
41,156 | protected static function mergeDefinitions ( array $ keys , array $ customs , array $ defaultValues ) { $ final = $ defaultValues ; foreach ( $ customs as $ key => $ custom ) { if ( ! is_array ( $ custom ) || ! array_key_exists ( 'match' , $ custom ) || ! array_key_exists ( 'set' , $ custom ) ) { continue ; } $ matches... | Merges the field definition |
41,157 | protected function getOnlyViews ( ) { $ viewsToCreate = Helpers :: removeEmptyItems ( explode ( ',' , $ this -> option ( 'only-views' ) ) ) ; return array_intersect ( $ this -> views , $ viewsToCreate ) ; } | Gets the valid view names after checking the user s only - views option . |
41,158 | public static function configure ( ServicesConfig $ config ) { $ config -> validate ( ) ; $ gateway = null ; if ( isset ( $ config -> merchantId ) && ! empty ( $ config -> merchantId ) ) { $ gateway = new RealexConnector ( ) ; $ gateway -> merchantId = $ config -> merchantId ; $ gateway -> sharedSecret = $ config -> sh... | Configures the ServicesContainer singleton |
41,159 | public function check ( $ targetProperty ) { $ this -> property = $ targetProperty ; $ this -> clause = new ValidationClause ( $ this -> parent , $ this ) ; return $ this -> clause ; } | Creates a new ValidationClause to specify validations on the given property . |
41,160 | public function when ( $ targetProperty ) { $ this -> property = $ targetProperty ; $ this -> clause = new ValidationClause ( $ this -> parent , $ this , true ) ; return $ this -> clause ; } | Creates a new ValidationClause to specify conditions for future validations checked against the given property . |
41,161 | public function balanceInquiry ( $ inquiry = InquiryType :: FOODSTAMP ) { return ( new AuthorizationBuilder ( TransactionType :: BALANCE , $ this ) ) -> withBalanceInquiryType ( $ inquiry ) -> withAmount ( 0 ) ; } | Inquires the balance of the payment method |
41,162 | public function of ( $ type , $ modifier = TransactionModifier :: NONE ) { if ( ! array_key_exists ( $ type , $ this -> rules ) ) { $ this -> rules [ $ type ] = [ ] ; } $ target = new ValidationTarget ( $ this , $ type , $ modifier ) ; $ this -> rules [ $ type ] [ ] = $ target ; return $ target ; } | Creates a new ValidationTarget for the given transaction type mask . |
41,163 | public function withAddress ( Address $ address , $ type = AddressType :: BILLING ) { $ address -> type = $ type ; if ( $ type === AddressType :: BILLING ) { $ this -> billingAddress = $ address ; } else { $ this -> shippingAddress = $ address ; } return $ this ; } | Set an address value ; where applicable . |
41,164 | public function withAlias ( $ aliasAction , $ alias ) { $ this -> aliasAction = $ aliasAction ; $ this -> alias = $ alias ; return $ this ; } | Set the request alias |
41,165 | public function withCashBack ( $ cashBackAmount ) { $ this -> cashBackAmount = $ cashBackAmount ; $ this -> transactionModifier = TransactionModifier :: CASH_BACK ; return $ this ; } | Set the request cashback amount |
41,166 | public function withOfflineAuthCode ( $ offlineAuthCode ) { $ this -> offlineAuthCode = $ offlineAuthCode ; $ this -> transactionModifier = TransactionModifier :: OFFLINE ; return $ this ; } | Set the request offline authorization code |
41,167 | public function withOneTimePayment ( $ value ) { $ this -> oneTimePayment = $ value ; $ this -> transactionModifier = TransactionModifier :: RECURRING ; return $ this ; } | Sets the one - time payment flag ; where applicable . |
41,168 | public function withPaymentMethod ( $ paymentMethod ) { $ this -> paymentMethod = $ paymentMethod ; if ( $ paymentMethod instanceof EBTCardData && $ paymentMethod -> serialNumber !== null ) { $ this -> transactionModifier = TransactionModifier :: VOUCHER ; } return $ this ; } | Set the request payment method |
41,169 | public function withRecurringInfo ( $ recurringType , $ recurringSequence ) { $ this -> recurringType = $ recurringType ; $ this -> recurringSequence = $ recurringSequence ; return $ this ; } | Set the request recurringType and recurringSequence |
41,170 | public function charge ( $ amount = null ) { return ( new AuthorizationBuilder ( TransactionType :: SALE , $ this ) ) -> withModifier ( TransactionModifier :: ALTERNATIVE_PAYMENT_METHOD ) -> withAmount ( $ amount ) ; } | This is a mandatory request used to initiate an APM transaction the payment - set is used to advise the payment scheme of the details of a new transaction and to retrieve the necessary information required to facilitate authentication |
41,171 | public function isNotNull ( $ message = null , $ subProperty = null ) { $ this -> callback = function ( $ builder ) use ( $ subProperty ) { $ builder = ( $ subProperty !== null && ! empty ( $ builder -> { $ subProperty } ) ) ? $ builder -> { $ subProperty } : $ builder ; if ( ! property_exists ( $ builder , $ this -> t... | Validates the target property is not null |
41,172 | public static function version2 ( $ ktb , $ trackNumber = null ) { $ data = new EncryptionData ( ) ; $ data -> version = '02' ; $ data -> trackNumber = $ trackNumber ; $ data -> ktb = $ ktb ; return $ data ; } | Convenience method for creating version 02 encryption data . |
41,173 | public function getCardType ( ) { $ number = str_replace ( [ ' ' , '-' ] , '' , $ this -> number ) ; foreach ( static :: $ cardTypes as $ type => $ regex ) { if ( 1 === preg_match ( $ regex , $ this -> number ) ) { return $ type ; } } return 'Unknown' ; } | Gets a card s type based on the BIN |
41,174 | public function verifyEnrolled ( $ amount , $ currency , $ orderId = null ) { $ response = ( new AuthorizationBuilder ( TransactionType :: VERIFY_ENROLLED , $ this ) ) -> withAmount ( $ amount ) -> withCurrency ( $ currency ) -> withOrderId ( $ orderId ) -> execute ( ) ; if ( ! empty ( $ response -> threeDSecure ) ) { ... | Verify whether the cardholder is enrolled in 3DS |
41,175 | public static function generateHash ( $ secret , $ toHash = null ) { if ( $ toHash === null ) { return sha1 ( $ secret ) ; } $ toHashFirstPass = sha1 ( $ toHash ) ; $ toHashSecondPass = $ toHashFirstPass . '.' . $ secret ; return sha1 ( $ toHashSecondPass ) ; } | Generate a hash required for all messages sent to Realex to prove it was not tampered with . |
41,176 | public function addAlias ( $ alias = null ) { return ( new AuthorizationBuilder ( TransactionType :: ALIAS , $ this ) ) -> withAlias ( AliasAction :: ADD , $ alias ) ; } | Adds an alias to the payment method |
41,177 | public function removeAlias ( $ alias = null ) { return ( new AuthorizationBuilder ( TransactionType :: ALIAS , $ this ) ) -> withAlias ( AliasAction :: DELETE , $ alias ) ; } | Removes an alias to the payment method |
41,178 | public static function create ( $ alias = null ) { $ card = new static ( ) ; $ response = ( new AuthorizationBuilder ( TransactionType :: ALIAS , $ card ) ) -> withAlias ( AliasAction :: CREATE , $ alias ) -> execute ( ) ; if ( $ response -> responseCode === '00' ) { return $ response -> giftCard ; } throw new ApiExcep... | Creates a new payment method |
41,179 | public function addPaymentMethod ( $ paymentId , IPaymentMethod $ paymentMethod ) { $ nameOnAccount = sprintf ( '%s %s' , $ this -> firstName , $ this -> lastName ) ; if ( empty ( str_replace ( ' ' , '' , $ nameOnAccount ) ) ) { $ nameOnAccount = $ this -> company ; } $ payment = new RecurringPaymentMethod ( $ paymentM... | Adds a payment method to the customer |
41,180 | protected function generateHash ( $ timestamp , $ orderId , $ amount , $ currency , $ paymentData = null , $ verify = false ) { $ data = [ $ timestamp , $ this -> merchantId , $ orderId , ] ; if ( false === $ verify ) { $ data [ ] = $ amount ; $ data [ ] = $ currency ; } $ data [ ] = $ paymentData ; return GenerationUt... | Generates a request hash from the request data |
41,181 | public static function fromId ( $ transactionId , $ orderId = null , $ paymentMethodType = null ) { try { $ paymentMethodType = PaymentMethodType :: validate ( $ orderId ) ; } catch ( ArgumentException $ ex ) { } if ( $ orderId === null && $ paymentMethodType === null ) { $ paymentMethodType = PaymentMethodType :: CRED... | Creates a Transaction object from a stored transaction ID . |
41,182 | public function additionalAuth ( $ amount = null ) { return ( new AuthorizationBuilder ( TransactionType :: AUTH ) ) -> withPaymentMethod ( $ this -> transactionReference ) -> withAmount ( $ amount ) ; } | Creates an additional authorization against the original transaction . |
41,183 | public function capture ( $ amount = null ) { return ( new ManagementBuilder ( TransactionType :: CAPTURE ) ) -> withPaymentMethod ( $ this -> transactionReference ) -> withAmount ( $ amount ) ; } | Captures the original transaction . |
41,184 | public function edit ( ) { $ builder = ( new ManagementBuilder ( TransactionType :: EDIT ) ) -> withPaymentMethod ( $ this -> transactionReference ) ; if ( $ this -> commercialIndicator !== null ) { $ builder = $ builder -> withModifier ( TransactionModifier :: LEVEL_II ) ; } return $ builder ; } | Edits the original transaction . |
41,185 | public function reverse ( $ amount = null ) { return ( new ManagementBuilder ( TransactionType :: REVERSAL ) ) -> withPaymentMethod ( $ this -> transactionReference ) -> withAmount ( $ amount ) ; } | Reverses the original transaction . |
41,186 | public function authorize ( $ amount = null ) { return ( new AuthorizationBuilder ( TransactionType :: AUTH , $ this ) ) -> withAmount ( $ amount ) -> withOneTimePayment ( true ) ; } | Creates an authorization against the payment method . |
41,187 | public function addSchedule ( $ scheduleId ) { $ schedule = new Schedule ( $ this -> customerKey , $ this -> key ) ; $ schedule -> id = $ scheduleId ; return $ schedule ; } | Creates a recurring schedule using the payment method . |
41,188 | protected function buildEnvelope ( DOMDocument $ xml , DOMElement $ transaction ) { $ soapEnvelope = $ xml -> createElement ( 'soapenv:Envelope' ) ; $ soapEnvelope -> setAttribute ( 'xmlns:soapenv' , 'http://schemas.xmlsoap.org/soap/envelope/' ) ; $ soapEnvelope -> setAttribute ( 'xmlns' , static :: XML_NAMESPACE ) ; $... | Wraps a transaction with a SOAP envelope |
41,189 | protected function xml2object ( $ xml ) { $ envelope = simplexml_load_string ( $ xml , 'SimpleXMLElement' , 0 , 'http://schemas.xmlsoap.org/soap/envelope/' ) ; foreach ( $ envelope -> Body as $ response ) { $ children = $ response -> children ( static :: XML_NAMESPACE ) ; foreach ( $ children as $ item ) { return $ ite... | Converts a XML string to a simple object for use removing extra nodes that are not necessary for handling the response |
41,190 | protected function hasToken ( IPaymentMethod $ paymentMethod ) { $ tokenValue = null ; if ( $ paymentMethod instanceof ITokenizable && ! empty ( $ paymentMethod -> token ) ) { $ tokenValue = $ paymentMethod -> token ; return [ true , $ tokenValue ] ; } return [ false , $ tokenValue ] ; } | Tests the payment method for a token value |
41,191 | protected function sendRequest ( $ verb , $ endpoint , $ data = null , array $ queryStringParams = null ) { try { $ queryString = $ this -> buildQueryString ( $ queryStringParams ) ; $ request = curl_init ( $ this -> serviceUrl . $ endpoint . $ queryString ) ; $ this -> headers = array_merge ( $ this -> headers , [ 'Co... | Uses cURL to communicate with the gateway service |
41,192 | public static function validate ( $ value ) { $ reflector = new ReflectionClass ( static :: class ) ; foreach ( $ reflector -> getConstants ( ) as $ allowedValue ) { if ( $ value === $ allowedValue ) { return $ allowedValue ; } } throw new ArgumentException ( sprintf ( 'Invalid value `%s` on enum `%s`' , $ value , stat... | Validates a desired value exists as a constant on the class |
41,193 | public function registerCommands ( ) { $ this -> addCommands ( [ new Model ( ) , new Controller ( ) , new Routing ( ) , new Config ( ) , new Migration ( ) , ] ) ; $ consoles = config ( ) -> get ( 'consoles' , [ ] ) ; $ consoles = array_unique ( $ consoles ) ; foreach ( $ consoles as $ console ) { $ this -> add ( new $ ... | Scan commands . |
41,194 | public function bootstrap ( ) { if ( ! $ this -> booted ) { $ config = load ( $ this -> path . '/config/app.php' ) ; $ this -> name = $ config [ 'name' ] ; date_default_timezone_set ( isset ( $ config [ 'timezone' ] ) ? $ config [ 'timezone' ] : 'UTC' ) ; $ this -> add ( 'config' , new Config ( $ config ) ) ; $ this ->... | Application bootstrap . |
41,195 | public function actionClearDeprecated ( $ interval ) { $ ids = PushRecord :: find ( ) -> deprecated ( $ interval ) -> done ( ) -> select ( 'push.id' ) -> asArray ( ) -> column ( ) ; $ count = count ( $ ids ) ; if ( $ count && $ this -> confirm ( "Do you want to delete $count records?" ) ) { $ count = PushRecord :: getD... | Clear deprecated records . |
41,196 | public function actionClearAll ( ) { if ( $ this -> confirm ( 'Are you sure?' ) ) { $ count = PushRecord :: getDb ( ) -> transaction ( function ( ) { WorkerRecord :: deleteAll ( ) ; ExecRecord :: deleteAll ( ) ; return PushRecord :: deleteAll ( ) ; } ) ; $ this -> stdout ( "$count records deleted.\n" ) ; } } | Clear all records . |
41,197 | public function actionStop ( $ id ) { if ( ! $ this -> module -> canWorkerStop ) { throw new ForbiddenHttpException ( Module :: t ( 'notice' , 'Stop is forbidden.' ) ) ; } $ record = $ this -> findRecord ( $ id ) ; $ record -> stop ( ) ; return $ this -> success ( Module :: t ( 'notice' , 'The worker will be stopped wi... | Stops a worker |
41,198 | public function actionPush ( $ id ) { if ( ! $ this -> module -> canPushAgain ) { throw new ForbiddenHttpException ( Module :: t ( 'notice' , 'Push is forbidden.' ) ) ; } $ record = $ this -> findRecord ( $ id ) ; if ( ! $ record -> isSenderValid ( ) ) { $ error = Module :: t ( 'notice' , 'The job isn\'t pushed because... | Pushes a job again |
41,199 | public function actionStop ( $ id ) { if ( ! $ this -> module -> canExecStop ) { throw new ForbiddenHttpException ( Module :: t ( 'notice' , 'Stop is forbidden.' ) ) ; } $ record = $ this -> findRecord ( $ id ) ; if ( $ record -> isStopped ( ) ) { return $ this -> error ( Module :: t ( 'notice' , 'The job is already st... | Stop a job |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.