idx int64 0 60.3k | question stringlengths 99 4.85k | target stringlengths 5 718 |
|---|---|---|
46,500 | public function setTimezones ( $ sTzNails = null , $ sTzUser = null ) { $ this -> setNailsTimezone ( $ sTzNails ) ; $ this -> setUserTimezone ( $ sTzUser ) ; } | Sets the Nails and User timezones simultaneously |
46,501 | public function getAllTimezone ( ) { $ aZones = \ DateTimeZone :: listIdentifiers ( ) ; $ aLocations = [ 'UTC' => 'Coordinated Universal Time (UTC/GMT)' ] ; foreach ( $ aZones as $ sZone ) { $ aZoneExploded = explode ( '/' , $ sZone ) ; $ aZoneAcceptable = [ 'Africa' , 'America' , 'Antarctica' , 'Arctic' , 'Asia' , 'At... | Returns a multi - dimensional array of supported timezones |
46,502 | public function getAllTimezoneFlat ( ) { $ aTimezones = $ this -> getAllTimezone ( ) ; $ aOut = [ ] ; foreach ( $ aTimezones as $ sKey => $ mValue ) { if ( is_array ( $ mValue ) ) { foreach ( $ mValue as $ subKey => $ subValue ) { if ( is_string ( $ subValue ) ) { $ aOut [ $ subKey ] = $ sKey . ' - ' . $ subValue ; } }... | Returns all the supported timezones as a flat array |
46,503 | public static function getCodeFromTimezone ( $ sTimezone ) { $ aAbbreviations = \ DateTimeZone :: listAbbreviations ( ) ; foreach ( $ aAbbreviations as $ sCode => $ aValues ) { foreach ( $ aValues as $ aValue ) { if ( $ aValue [ 'timezone_id' ] == $ sTimezone ) { return strtoupper ( $ sCode ) ; } } } return false ; } | Get the timezone code from the timezone string |
46,504 | public static function getTimezoneFromCode ( $ sCode ) { $ aAbbreviations = \ DateTimeZone :: listAbbreviations ( ) ; foreach ( $ aAbbreviations as $ sTzCode => $ aValues ) { if ( strtolower ( $ sCode ) == $ sTzCode ) { $ aTimeZone = reset ( $ aValues ) ; return getFromArray ( 'timezone_id' , $ aTimeZone , false ) ; } ... | Get the timezone string from the timezone code |
46,505 | public static function convert ( $ mTimestamp , $ sToTz , $ sFromTz = 'UTC' ) { if ( is_null ( $ mTimestamp ) ) { $ oDateTime = Factory :: factory ( 'DateTime' ) ; } elseif ( is_numeric ( $ mTimestamp ) ) { $ oDateTime = Factory :: factory ( 'DateTime' ) ; $ oDateTime -> setTimestamp ( $ mTimestamp ) ; } elseif ( $ mTi... | Arbitrarily convert a timestamp between timezones |
46,506 | public function preProcessConfiguration ( array $ configs ) : array { $ newConfigs = $ configs ; $ prependConfigs = [ ] ; foreach ( $ configs as $ index => $ config ) { if ( isset ( $ config [ 'system' ] ) ) { $ prependConfigs [ ] = [ 'system' => $ config [ 'system' ] ] ; unset ( $ config [ 'system' ] ) ; $ newConfigs ... | Pre - processes the configuration before it is resolved . |
46,507 | public function postProcessConfiguration ( array $ config ) : array { $ config = $ this -> fixUpViewConfig ( $ config ) ; $ processor = new ConfigurationProcessor ( $ this -> container , $ this -> extension -> getAlias ( ) ) ; foreach ( array_keys ( $ config ) as $ key ) { if ( $ key === 'system' || ! in_array ( $ key ... | Post - processes the resolved configuration . |
46,508 | private function fixUpViewConfig ( array $ config ) : array { foreach ( $ config [ 'system' ] as $ scope => $ scopeConfig ) { if ( $ scope === 'default' ) { continue ; } foreach ( array_keys ( $ scopeConfig [ 'view' ] ) as $ viewName ) { if ( isset ( $ config [ 'system' ] [ 'default' ] [ 'view' ] [ $ viewName ] ) ) { f... | Ugly hack to support semantic view config . The problem is eZ semantic config supports only merging arrays up to second level but in view config we have three . |
46,509 | private function buildSectionFilterParameters ( ParameterBuilderInterface $ builder , array $ groups = [ ] ) : void { $ builder -> add ( 'filter_by_section' , ParameterType \ Compound \ BooleanType :: class , [ 'groups' => $ groups , ] ) ; $ builder -> get ( 'filter_by_section' ) -> add ( 'sections' , EzParameterType \... | Builds the parameters for filtering by sections . |
46,510 | private function getSectionFilterCriteria ( ParameterCollectionInterface $ parameterCollection ) : ? Criterion { if ( $ parameterCollection -> getParameter ( 'filter_by_section' ) -> getValue ( ) !== true ) { return null ; } $ sections = $ parameterCollection -> getParameter ( 'sections' ) -> getValue ( ) ?? [ ] ; if (... | Returns the criteria used to filter content by section . |
46,511 | private function getSectionIds ( array $ sectionIdentifiers ) : array { $ idList = [ ] ; foreach ( $ sectionIdentifiers as $ identifier ) { try { $ section = $ this -> sectionHandler -> loadByIdentifier ( $ identifier ) ; $ idList [ ] = $ section -> id ; } catch ( NotFoundException $ e ) { continue ; } } return $ idLis... | Returns section IDs for all provided section identifiers . |
46,512 | private function addLayoutsSubMenu ( ItemInterface $ menu ) : void { $ menuOrder = $ this -> getNewMenuOrder ( $ menu ) ; $ layouts = $ menu -> addChild ( 'nglayouts' ) -> setLabel ( 'menu.main_menu.header' ) -> setExtra ( 'translation_domain' , 'ngbm_admin' ) ; $ layouts -> addChild ( 'layout_resolver' , [ 'route' => ... | Adds the Netgen Layouts submenu to eZ Platform admin interface . |
46,513 | public function fix ( $ module , $ oConfig = null ) { if ( $ oConfig !== null ) { $ this -> setConfig ( $ oConfig ) ; } $ moduleId = $ module -> getId ( ) ; if ( ! $ this -> initialCacheClearDone ) { ModuleVariablesLocator :: resetModuleVariables ( ) ; if ( extension_loaded ( 'apc' ) && ini_get ( 'apc.enabled' ) ) { ap... | Fix module states task runs version extend files templates blocks settings and events information fix tasks |
46,514 | public function parseResponse ( $ response ) { $ this -> responseRaw = $ response ; try { $ parser = new \ Genesis \ Parser ( 'xml' ) ; $ parser -> skipRootNode ( ) ; $ parser -> parseDocument ( $ response ) ; $ this -> responseObj = $ parser -> getObject ( ) ; } catch ( \ Exception $ e ) { throw new \ Genesis \ Except... | Parse Genesis response to stdClass and apply transformation to known fields |
46,515 | public function isSuccessful ( ) { $ status = new Constants \ Transaction \ States ( isset ( $ this -> responseObj -> status ) ? $ this -> responseObj -> status : '' ) ; if ( $ status -> isValid ( ) ) { return ! $ status -> isError ( ) ; } return null ; } | Check whether the request was successful |
46,516 | public function isPartiallyApproved ( ) { if ( isset ( $ this -> responseObj -> partial_approval ) ) { return \ Genesis \ Utils \ Common :: stringToBoolean ( $ this -> responseObj -> partial_approval ) ; } return null ; } | Check whether the transaction was partially approved |
46,517 | public function suppressReconciliationException ( ) { $ instances = [ new \ Genesis \ API \ Request \ NonFinancial \ Reconcile \ DateRange ( ) , new \ Genesis \ API \ Request \ NonFinancial \ Reconcile \ Transaction ( ) , new \ Genesis \ API \ Request \ WPF \ Reconcile ( ) ] ; if ( isset ( $ this -> requestCtx ) && iss... | Suppress Reconciliation responses as their statuses reflect their transactions |
46,518 | public function getErrorDescription ( ) { if ( isset ( $ this -> responseObj -> code ) && ! empty ( $ this -> responseObj -> code ) ) { return Constants \ Errors :: getErrorDescription ( $ this -> responseObj -> code ) ; } if ( isset ( $ this -> responseObj -> response_code ) && ! empty ( $ this -> responseObj -> respo... | Try to fetch a description of the received Error Code |
46,519 | public static function transform ( $ obj ) { if ( is_array ( $ obj ) || is_object ( $ obj ) ) { foreach ( $ obj as & $ object ) { if ( isset ( $ object -> status ) ) { self :: transformObject ( $ object ) ; } self :: transform ( $ object ) ; } } } | Iterate and transform object |
46,520 | public static function transformObject ( & $ entry ) { $ filters = [ 'transformFilterAmounts' , 'transformFilterTimestamp' ] ; foreach ( $ filters as $ filter ) { if ( method_exists ( __CLASS__ , $ filter ) ) { $ result = call_user_func ( [ __CLASS__ , $ filter ] , $ entry ) ; if ( $ result ) { $ entry = $ result ; } }... | Apply filters to an entry object |
46,521 | public static function transformFilterTimestamp ( $ transaction ) { if ( isset ( $ transaction -> timestamp ) ) { try { $ transaction -> timestamp = new \ DateTime ( $ transaction -> timestamp ) ; } catch ( \ Exception $ e ) { error_log ( $ e -> getMessage ( ) ) ; } } return $ transaction ; } | Get DateTime object from the timestamp inside the response |
46,522 | public static function getCertificateBundle ( ) { $ bundle = dirname ( __FILE__ ) . DIRECTORY_SEPARATOR . 'Certificates' . DIRECTORY_SEPARATOR . 'ca-bundle.pem' ; if ( ! file_exists ( $ bundle ) ) { throw new \ Genesis \ Exceptions \ InvalidArgument ( 'CA Bundle file is missing or inaccessible' ) ; } return $ bundle ; ... | Get the CA PEM |
46,523 | public static function getInterface ( $ type ) { if ( array_key_exists ( $ type , self :: $ interfaces ) ) { return self :: $ interfaces [ $ type ] ; } return false ; } | Get configuration for an interface |
46,524 | public static function setInterface ( $ interface , $ value ) { if ( array_key_exists ( $ interface , self :: $ interfaces ) ) { self :: $ interfaces [ $ interface ] = $ value ; return true ; } return false ; } | Set an interface |
46,525 | public static function setEndpoint ( $ endpointArg ) { $ endpointArg = strtolower ( trim ( $ endpointArg ) ) ; $ aliases = [ \ Genesis \ API \ Constants \ Endpoints :: EMERCHANTPAY => [ 'emp' , 'emerchantpay' , \ Genesis \ API \ Constants \ Endpoints :: EMERCHANTPAY ] , \ Genesis \ API \ Constants \ Endpoints :: ECOMPR... | Set Genesis Endpoint |
46,526 | public static function getSubDomain ( $ sub ) { if ( isset ( self :: $ domains [ $ sub ] ) ) { return self :: $ domains [ $ sub ] [ self :: getEnvironment ( ) ] ; } return null ; } | Get a sub - domain host based on the environment |
46,527 | public static function loadSettings ( $ iniFile ) { if ( ! file_exists ( $ iniFile ) ) { throw new \ Genesis \ Exceptions \ InvalidArgument ( 'The provided configuration file is invalid or inaccessible!' ) ; } $ settings = parse_ini_file ( $ iniFile , true ) ; foreach ( $ settings [ 'Genesis' ] as $ option => $ value )... | Load settings from an ini File |
46,528 | public static function getCountryName ( $ iso_code ) { if ( isset ( self :: $ countries [ $ iso_code ] ) ) { return self :: $ countries [ $ iso_code ] ; } return false ; } | Get a country s name by its ISO Code |
46,529 | protected function _goUp ( AbstractQuery $ oQuery , outputInterface $ oOutput = null ) { if ( $ this -> isExecuted ( $ oQuery ) ) { return false ; } if ( $ oOutput ) { $ oOutput -> writeLn ( sprintf ( '[DEBUG] Migrating up %s %s' , $ oQuery -> getTimestamp ( ) , $ oQuery -> getClassName ( ) ) ) ; } $ oQuery -> up ( ) ;... | Executes an UP Migration |
46,530 | protected function _goDown ( AbstractQuery $ oQuery , OutputInterface $ oOutput = null ) { if ( ! $ this -> isExecuted ( $ oQuery ) ) { return false ; } if ( $ oOutput ) { $ oOutput -> writeLn ( sprintf ( '[DEBUG] Migrating down %s %s' , $ oQuery -> getTimestamp ( ) , $ oQuery -> getClassName ( ) ) ) ; } $ oQuery -> do... | Executes a DOWN Migration |
46,531 | public function isExecuted ( AbstractQuery $ oQuery ) { foreach ( $ this -> _aExecutedQueryNames as $ executedQuery ) { if ( $ oQuery -> getFilename ( ) == $ executedQuery [ 'version' ] ) { return true ; } } return false ; } | Is query already executed? |
46,532 | public function setExecuted ( AbstractQuery $ oQuery ) { $ sSQL = 'REPLACE INTO oxmigrationstatus SET version = ?' ; DatabaseProvider :: getDb ( ) -> execute ( $ sSQL , array ( $ oQuery -> getFilename ( ) ) ) ; } | Set query as executed |
46,533 | public function setUnexecuted ( AbstractQuery $ oQuery ) { $ sSQL = 'DELETE FROM oxmigrationstatus WHERE version = ?' ; DatabaseProvider :: getDb ( ) -> execute ( $ sSQL , array ( $ oQuery -> getFilename ( ) ) ) ; } | Set query as not executed |
46,534 | protected function _buildMigrationQueries ( ) { if ( ! is_dir ( $ this -> _sMigrationQueriesDir ) ) { return false ; } $ oDirectory = new \ RecursiveDirectoryIterator ( $ this -> _sMigrationQueriesDir ) ; $ oFlattened = new \ RecursiveIteratorIterator ( $ oDirectory ) ; $ aFiles = new \ RegexIterator ( $ oFlattened , A... | Load and build migration files |
46,535 | protected function _getClassNameFromFilePath ( $ sFilePath ) { $ sFileName = basename ( $ sFilePath ) ; $ aMatches = array ( ) ; if ( ! preg_match ( AbstractQuery :: REGEXP_FILE , $ sFileName , $ aMatches ) ) { throw new MigrationException ( 'Could not extract class name from file name' ) ; } return $ aMatches [ 2 ] . ... | Get migration queries class name parsed from file path |
46,536 | protected function _buildMigrationName ( array $ words ) { $ sMigrationName = '' ; foreach ( $ words as $ word ) { if ( ! $ word ) { continue ; } $ sMigrationName .= ucfirst ( $ word ) ; } return $ sMigrationName ; } | Build migration name from tokens |
46,537 | protected function verifyRequiredField ( $ field , $ value ) { if ( empty ( $ value ) ) { throw new \ Genesis \ Exceptions \ ErrorParameter ( sprintf ( 'Empty (null) item required parameter: %s' , $ field ) ) ; } } | Verify required field |
46,538 | protected function verifyNonNegativeField ( $ field , $ value ) { if ( ! empty ( $ value ) && $ value <= 0 ) { throw new \ Genesis \ Exceptions \ ErrorParameter ( sprintf ( 'Item parameter %s is set to %s, but expected to be positive number' , $ field , $ value ) ) ; } } | Verify non - negative filed |
46,539 | protected function verifyNegativeField ( $ field , $ value ) { if ( ! empty ( $ value ) && $ value > 0 ) { throw new \ Genesis \ Exceptions \ ErrorParameter ( sprintf ( 'Item parameter %s is set to %s, but expected to be negative number' , $ field , $ value ) ) ; } } | Verify negative filed |
46,540 | protected function verifyUnitPriceField ( $ value ) { $ this -> verifyRequiredField ( 'unit_price' , $ value ) ; if ( in_array ( $ this -> item_type , [ self :: ITEM_TYPE_DISCOUNT , self :: ITEM_TYPE_STORE_CREDIT ] ) ) { $ this -> verifyNegativeField ( 'unit_price' , $ value ) ; return ; } $ this -> verifyNonNegativeFi... | Verify unit_price filed |
46,541 | public function setItemType ( $ value ) { $ this -> verifyRequiredField ( 'item_type' , $ value ) ; $ item_types = array ( self :: ITEM_TYPE_PHYSICAL , self :: ITEM_TYPE_DISCOUNT , self :: ITEM_TYPE_SHIPPING_FEE , self :: ITEM_TYPE_DIGITAL , self :: ITEM_TYPE_GIFT_CARD , self :: ITEM_TYPE_STORE_CREDIT , self :: ITEM_TY... | Set item type |
46,542 | public function setQuantityUnit ( $ value ) { if ( ! empty ( $ value ) && strlen ( $ value ) > 8 ) { throw new \ Genesis \ Exceptions \ ErrorParameter ( sprintf ( 'Item parameter quantity_unit is set to %s, but expected to be string with max length 8 characters' , $ value ) ) ; } $ this -> quantity_unit = $ value ; ret... | Set item quantity unit |
46,543 | public function getTotalAmount ( ) { $ total_amount = $ this -> unit_price * $ this -> quantity ; if ( ! empty ( $ this -> total_discount_amount ) ) { return $ total_amount - $ this -> total_discount_amount ; } return $ total_amount ; } | Calculate order item total amount |
46,544 | public function getTotalTaxAmount ( ) { $ total_amount = CurrencyUtils :: amountToExponent ( $ this -> getTotalAmount ( ) , $ this -> currency ) ; $ tax_rate = CurrencyUtils :: amountToExponent ( $ this -> tax_rate , $ this -> currency ) ; $ total_tax_amount = ceil ( $ total_amount - ( ( $ total_amount * 10000 ) / ( 10... | Calculate order item total tax amount . Round it up to next whole number |
46,545 | public function toArray ( ) { return [ 'name' => $ this -> name , 'item_type' => $ this -> item_type , 'quantity' => $ this -> quantity , 'unit_price' => CurrencyUtils :: amountToExponent ( $ this -> unit_price , $ this -> currency ) , 'tax_rate' => CurrencyUtils :: amountToExponent ( $ this -> tax_rate , $ this -> cur... | Convert item to array |
46,546 | public static function getAll ( ) { $ aShopIds = DatabaseProvider :: getDb ( ) -> getCol ( 'SELECT oxid FROM oxshops' ) ; $ aConfigs = array ( ) ; foreach ( $ aShopIds as $ mShopId ) { $ aConfigs [ ] = new ShopConfig ( $ mShopId ) ; } return $ aConfigs ; } | Returns config arrays for all shops |
46,547 | public static function get ( $ mShopId ) { $ sSQL = 'SELECT 1 FROM oxshops WHERE oxid = %s' ; $ oDb = DatabaseProvider :: getDb ( ) ; if ( ! $ oDb -> getOne ( sprintf ( $ sSQL , $ oDb -> quote ( $ mShopId ) ) ) ) { return null ; } return new ShopConfig ( $ mShopId ) ; } | Get config object of given shop id |
46,548 | public function saveShopConfVar ( $ sVarType , $ sVarName , $ sVarVal , $ sShopId = null , $ sModule = '' ) { $ sShopId = $ sShopId === null ? $ this -> _iShopId : $ sShopId ; if ( $ sShopId == $ this -> _iShopId ) { $ storedType = $ this -> getShopConfType ( $ sVarName , $ sModule ) ; if ( $ sModule == Config :: OXMOD... | overwritten method for performance reasons |
46,549 | public function setLifetime ( $ lifetime ) { $ lifetime = intval ( $ lifetime ) ; if ( $ lifetime < 1 || $ lifetime > 44640 ) { throw new InvalidArgument ( 'Valid value ranges between 1 minute and 31 days given in minutes' ) ; } $ this -> lifetime = $ lifetime ; return $ this ; } | Number of minutes determining how long the WPF will be valid . Will be set to 30 minutes by default . Valid value ranges between 1 minute and 31 days given in minutes |
46,550 | public function addTransactionType ( $ name , $ parameters = [ ] ) { $ this -> verifyTransactionType ( $ name , $ parameters ) ; $ structure = [ 'transaction_type' => [ '@attributes' => [ 'name' => $ name ] , $ parameters ] ] ; array_push ( $ this -> transaction_types , $ structure ) ; return $ this ; } | Add transaction type to the list of available types |
46,551 | protected function verifyTransactionType ( $ transactionType , $ parameters = [ ] ) { if ( ! Types :: isValidWPFTransactionType ( $ transactionType ) ) { throw new \ Genesis \ Exceptions \ ErrorParameter ( sprintf ( 'Transaction type (%s) is not valid. Valid WPF transactions are: %s.' , $ transactionType , implode ( ',... | Verify that transaction type parameters are populated correctly |
46,552 | protected function checkEmptyRequiredParamsFor ( $ transactionType , $ customRequiredParam , $ txnParameters = [ ] ) { if ( CommonUtils :: isArrayKeyExists ( $ customRequiredParam , $ txnParameters ) && ! empty ( $ txnParameters [ $ customRequiredParam ] ) ) { return ; } foreach ( $ txnParameters as $ parameter ) { if ... | Performs a check there is an empty required param for the passed transaction type |
46,553 | public function setLanguage ( $ language = \ Genesis \ API \ Constants \ i18n :: EN ) { $ language = substr ( strtolower ( $ language ) , 0 , 2 ) ; if ( ! \ Genesis \ API \ Constants \ i18n :: isValidLanguageCode ( $ language ) ) { throw new \ Genesis \ Exceptions \ InvalidArgument ( 'The provided argument is not a val... | Add ISO 639 - 1 language code to the URL |
46,554 | public static function getSplitPaymentsTrxTypes ( ) { return [ self :: SALE , self :: SALE_3D , self :: TCS , self :: FASHIONCHEQUE , self :: INTERSOLVE ] ; } | Get valid split payment transaction types |
46,555 | public static function getCustomRequiredParameters ( $ type ) { $ method = 'for' . Common :: snakeCaseToCamelCase ( $ type ) ; if ( ! method_exists ( CustomRequiredParameters :: class , $ method ) ) { return false ; } return CustomRequiredParameters :: $ method ( ) ; } | Get custom required parameters with values per transaction |
46,556 | public static function amountToExponent ( $ amount , $ iso ) { $ iso = strtoupper ( $ iso ) ; if ( array_key_exists ( $ iso , self :: $ iso4217 ) ) { $ exp = intval ( self :: $ iso4217 [ $ iso ] [ 'exponent' ] ) ; if ( $ exp > 0 ) { return bcmul ( $ amount , pow ( 10 , $ exp ) , 0 ) ; } } return strval ( $ amount ) ; } | Convert amount to ISO - 4217 minor currency unit |
46,557 | public static function exponentToAmount ( $ amount , $ iso ) { $ iso = strtoupper ( $ iso ) ; if ( array_key_exists ( $ iso , self :: $ iso4217 ) ) { $ exp = intval ( self :: $ iso4217 [ $ iso ] [ 'exponent' ] ) ; if ( $ exp > 0 ) { return bcdiv ( $ amount , pow ( 10 , $ exp ) , $ exp ) ; } } return strval ( $ amount )... | Convert ISO - 4217 minor currency unit to amount |
46,558 | public function getDocument ( ) { $ this -> processRequestParameters ( ) ; if ( $ this -> treeStructure instanceof \ ArrayObject ) { $ this -> builderContext = new \ Genesis \ Builder ( ) ; $ this -> builderContext -> parseStructure ( $ this -> treeStructure -> getArrayCopy ( ) ) ; return $ this -> builderContext -> ge... | Generate the XML output |
46,559 | protected function verifyFieldRequirements ( ) { if ( isset ( $ this -> requiredFields ) ) { $ this -> requiredFields -> setIteratorClass ( 'RecursiveArrayIterator' ) ; $ iterator = new \ RecursiveIteratorIterator ( $ this -> requiredFields -> getIterator ( ) ) ; foreach ( $ iterator as $ fieldName ) { if ( empty ( $ t... | Verify that all required fields are populated |
46,560 | protected function verifyFieldValuesRequirements ( ) { if ( ! isset ( $ this -> requiredFieldValues ) ) { return ; } $ iterator = $ this -> requiredFieldValues -> getArrayCopy ( ) ; foreach ( $ iterator as $ fieldName => $ validator ) { if ( $ validator instanceof RequestValidator ) { $ validator -> run ( $ this , $ fi... | Verify that all required fields are populated with expected values |
46,561 | protected function verifyGroupRequirements ( ) { if ( isset ( $ this -> requiredFieldsGroups ) ) { $ fields = $ this -> requiredFieldsGroups -> getArrayCopy ( ) ; $ emptyFlag = false ; $ groupsFormatted = [ ] ; foreach ( $ fields as $ group => $ groupFields ) { $ groupsFormatted [ ] = sprintf ( '%s (%s)' , ucfirst ( $ ... | Verify that the group fields in the request are populated |
46,562 | protected function verifyConditionalFields ( ) { if ( isset ( $ this -> requiredFieldsOR ) ) { $ fields = $ this -> requiredFieldsOR -> getArrayCopy ( ) ; $ status = false ; foreach ( $ fields as $ fieldName ) { if ( isset ( $ this -> $ fieldName ) && ! empty ( $ this -> $ fieldName ) ) { $ status = true ; } } if ( ! $... | Verify conditional requirement where either one of the fields are populated |
46,563 | protected function transform ( $ method , $ args , $ prefix = 'transform' ) { $ method = $ prefix . CommonUtils :: snakeCaseToCamelCase ( $ method ) ; if ( method_exists ( $ this , $ method ) ) { $ result = call_user_func_array ( [ $ this , $ method ] , $ args ) ; if ( $ result ) { return $ result ; } } return reset ( ... | Perform a field transformation and return the result |
46,564 | protected function buildRequestURL ( $ sub = 'gateway' , $ path = '' , $ token = '' ) { $ protocol = ( $ this -> getApiConfig ( 'protocol' ) ) ? $ this -> getApiConfig ( 'protocol' ) : 'https' ; $ sub = \ Genesis \ Config :: getSubDomain ( $ sub ) ; $ domain = \ Genesis \ Config :: getEndpoint ( ) ; $ port = ( $ this -... | Build the complete URL for the request |
46,565 | protected function initApiGatewayConfiguration ( $ requestPath = 'process' , $ includeToken = true ) { $ this -> setApiConfig ( 'url' , $ this -> buildRequestURL ( 'gateway' , $ requestPath , ( $ includeToken ? \ Genesis \ Config :: getToken ( ) : false ) ) ) ; } | Initializes Api EndPoint Url with request path & terminal token |
46,566 | public function setCryptoAddress ( $ address ) { if ( ! $ this -> checkAddress ( $ address ) || ! preg_match ( static :: CRYPTO_ADDRESS_VALIDATION_REGEX , $ address ) ) { throw new ErrorParameter ( 'Invalid crypto address provided' ) ; } $ this -> crypto_address = $ address ; return $ this ; } | Valid crypto address where the funds will be received |
46,567 | private function decodeBase58 ( $ base58 ) { $ origbase58 = $ base58 ; $ base58chars = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz' ; $ return = '0' ; for ( $ i = 0 ; $ i < strlen ( $ base58 ) ; $ i ++ ) { $ current = ( string ) strpos ( $ base58chars , $ base58 [ $ i ] ) ; $ return = ( string ) bcmul (... | Convert a Base58 - encoded integer into the equivalent hex string representation |
46,568 | public function remove ( $ value ) { $ hash = self :: hash ( $ value ) ; if ( array_key_exists ( $ hash , $ this -> objects ) ) { unset ( $ this -> objects [ $ hash ] ) ; return true ; } return false ; } | If the value is in the set it will be removed and true is returned . otherwise false is returned . |
46,569 | public function contains ( $ value ) { $ hash = self :: hash ( $ value ) ; return array_key_exists ( $ hash , $ this -> objects ) ; } | Returns true if the value exist in the set . Otherwise false . |
46,570 | private function find ( $ value , $ add = false ) { $ hash = self :: hash ( $ value ) ; if ( array_key_exists ( $ hash , $ this -> objects ) ) { return true ; } else if ( $ add ) { $ this -> objects [ $ hash ] = $ value ; } return false ; } | Finds the given value and returns true if it was found . Otherwise return false . |
46,571 | protected function _generateModule ( $ oScaffold ) { $ oSmarty = $ this -> _getSmarty ( ) ; $ oSmarty -> assign ( 'oScaffold' , $ oScaffold ) ; if ( $ oScaffold -> sVendor ) { $ this -> _generateVendorDir ( $ oScaffold -> sVendor ) ; } $ sModuleDir = $ this -> _getModuleDir ( $ oScaffold -> sVendor , $ oScaffold -> sMo... | Generate module from scaffold object |
46,572 | protected function _copyAndParseDir ( $ sFrom , $ sTo , array $ aNameMap = array ( ) ) { $ oFileInfos = new \ RecursiveIteratorIterator ( new \ RecursiveDirectoryIterator ( $ sFrom , \ RecursiveDirectoryIterator :: SKIP_DOTS ) ) ; if ( ! file_exists ( $ sTo ) ) { mkdir ( $ sTo ) ; } foreach ( $ oFileInfos as $ oFileInf... | Copies files from directory parses all files and puts parsed content to another directory |
46,573 | protected function _copyAndParseFile ( $ sFrom , $ sTo ) { $ this -> _createMissingFolders ( $ sTo ) ; $ sTo = preg_replace ( '/\.tpl$/' , '' , $ sTo ) ; if ( preg_match ( '/\.tpl$/' , $ sFrom ) ) { $ oSmarty = $ this -> _getSmarty ( ) ; $ sContent = $ oSmarty -> fetch ( $ sFrom ) ; } else { $ sContent = file_get_conte... | Copies file from one directory to another parses file if original file extension is . tpl |
46,574 | protected function _createMissingFolders ( $ sFilePath ) { $ sPath = dirname ( $ sFilePath ) ; if ( ! file_exists ( $ sPath ) ) { mkdir ( $ sPath , 0777 , true ) ; } } | Create missing folders of file path |
46,575 | protected function _generateVendorDir ( $ sVendor ) { $ sVendorDir = $ this -> _sModuleDir . $ sVendor . DIRECTORY_SEPARATOR ; if ( ! file_exists ( $ sVendorDir ) ) { mkdir ( $ sVendorDir ) ; file_put_contents ( $ sVendorDir . 'vendormetadata.php' , '<?php' ) ; } } | Generate vendor directory |
46,576 | protected function _buildScaffold ( ) { $ oScaffold = new \ stdClass ( ) ; $ oScaffold -> sVendor = strtolower ( $ this -> _getUserInput ( 'Vendor Prefix' , true ) ) ; $ blFirstRequest = true ; do { if ( ! $ blFirstRequest ) { $ this -> output -> writeLn ( 'Module path or id is taken with given title' ) ; } else { $ bl... | Build scaffold object from user inputs |
46,577 | protected function _getUserInput ( $ sText , $ bAllowEmpty = false ) { $ questionHelper = $ this -> getHelper ( 'question' ) ; do { $ sTitle = "$sText: " . ( $ bAllowEmpty ? '[optional] ' : '[required] ' ) ; $ question = new Question ( $ sTitle ) ; $ sInput = $ questionHelper -> ask ( $ this -> input , $ this -> output... | Get user input |
46,578 | protected function _parseTimestamp ( $ timestamp ) { if ( is_null ( $ timestamp ) ) return AbstractQuery :: getCurrentTimestamp ( ) ; if ( ! AbstractQuery :: isValidTimestamp ( $ timestamp ) ) { if ( $ sTime = strtotime ( $ timestamp ) ) { $ timestamp = date ( 'YmdHis' , $ sTime ) ; } else { throw oxNew ( ConsoleExcept... | Parse timestamp from user input |
46,579 | public function parseNotification ( $ notification = [ ] , $ authenticate = true ) { $ notificationWalk = [ ] ; array_walk ( $ notification , function ( $ val , $ key ) use ( & $ notificationWalk ) { $ key = trim ( rawurldecode ( $ key ) ) ; $ val = trim ( rawurldecode ( $ val ) ) ; $ notificationWalk [ $ key ] = $ val... | Parse and Authenticate the incoming notification from Genesis |
46,580 | public function initReconciliation ( ) { $ type = '' ; if ( $ this -> isAPINotification ( ) ) { $ type = 'NonFinancial\Reconcile\Transaction' ; } elseif ( $ this -> isWPFNotification ( ) ) { $ type = 'WPF\Reconcile' ; } $ request = new \ Genesis \ Genesis ( $ type ) ; try { $ request -> request ( ) -> setUniqueId ( $ t... | Reconcile with the Payment Gateway to get the latest status on the transaction |
46,581 | public function isAuthentic ( ) { if ( ! isset ( $ this -> unique_id ) || ! isset ( $ this -> notificationObj -> signature ) ) { throw new \ Genesis \ Exceptions \ InvalidArgument ( 'Missing field(s), required for validation!' ) ; } $ messageSig = trim ( $ this -> notificationObj -> signature ) ; $ customerPwd = trim (... | Verify the signature on the parsed Notification |
46,582 | public function isAPINotification ( ) { return ( bool ) ( isset ( $ this -> notificationObj -> unique_id ) && ! empty ( $ this -> notificationObj -> unique_id ) ) ; } | Is this API notification? |
46,583 | public function isWPFNotification ( ) { return ( bool ) ( isset ( $ this -> notificationObj -> wpf_unique_id ) && ! empty ( $ this -> notificationObj -> wpf_unique_id ) ) ; } | Is this WPF Notification? |
46,584 | public function checkForErrors ( ) { $ errNo = curl_errno ( $ this -> curlHandle ) ; $ errStr = curl_error ( $ this -> curlHandle ) ; if ( $ errNo > 0 ) { throw new \ Genesis \ Exceptions \ ErrorNetwork ( $ errStr , $ errNo ) ; } } | Check whether or not a cURL request is successful |
46,585 | public function setNationalId ( $ value ) { if ( strlen ( $ value ) > $ this -> getNationalIdLen ( ) ) { throw new ErrorParameter ( "National Identifier can be max {$this->getNationalIdLen()} characters." ) ; } $ this -> national_id = $ value ; return $ this ; } | National Identifier number of the customer |
46,586 | public function parseDocument ( $ xmlDocument ) { $ reader = new \ XMLReader ( ) ; $ reader -> open ( 'data:text/plain;base64,' . base64_encode ( $ xmlDocument ) ) ; if ( $ this -> skipRootNode ) { $ reader -> read ( ) ; } $ this -> stdClassObj = self :: readerLoop ( $ reader ) ; } | Parse a document to an stdClass |
46,587 | public function readerLoop ( $ reader ) { $ tree = new \ stdClass ( ) ; while ( $ reader -> read ( ) ) { switch ( $ reader -> nodeType ) { case \ XMLReader :: END_ELEMENT : return $ tree ; break ; case \ XMLReader :: ELEMENT : $ this -> processElement ( $ reader , $ tree ) ; if ( $ reader -> hasAttributes ) { $ this ->... | Read through the entire document |
46,588 | public function processElement ( & $ reader , & $ tree ) { $ name = $ reader -> name ; if ( isset ( $ tree -> $ name ) ) { if ( is_a ( $ tree -> $ name , 'stdClass' ) ) { $ currentEl = $ tree -> $ name ; $ tree -> $ name = new \ ArrayObject ( ) ; $ tree -> $ name -> append ( $ currentEl ) ; } if ( is_a ( $ tree -> $ na... | Process XMLReader element |
46,589 | public function processAttributes ( & $ reader , & $ tree ) { $ name = $ reader -> name ; $ node = new \ stdClass ( ) ; $ node -> attr = new \ stdClass ( ) ; while ( $ reader -> moveToNextAttribute ( ) ) { $ node -> attr -> $ name = $ reader -> value ; } if ( isset ( $ tree -> $ name ) && is_a ( $ tree -> $ name , 'Arr... | Process element attributes |
46,590 | public function getAllCommands ( ) { if ( ! class_exists ( 'oxConsoleCommand' ) ) class_alias ( Command :: class , 'oxConsoleCommand' ) ; $ commands = $ this -> getCommandsFromCore ( ) ; $ commandsFromModules = $ this -> getCommandsFromModules ( ) ; $ commandsFromComposer = $ this -> getCommandsFromComposer ( ) ; retur... | Get all available command objects . |
46,591 | private function getCommandsFromModules ( ) { $ oConfig = Registry :: getConfig ( ) ; if ( ! class_exists ( ModuleList :: class ) ) { print "ERROR: Oxid ModuleList class can not be loaded, please run vendor/bin/oe-eshop-unified_namespace_generator" ; } else { try { $ moduleList = oxNew ( ModuleList :: class ) ; $ modul... | Collect all available commands from modules . |
46,592 | private function getPathsOfAvailableModules ( ) { $ config = Registry :: getConfig ( ) ; $ modulesRootPath = $ config -> getModulesDir ( ) ; $ modulePaths = $ config -> getConfigParam ( 'aModulePaths' ) ; if ( ! is_dir ( $ modulesRootPath ) ) return [ ] ; if ( ! is_array ( $ modulePaths ) ) return [ ] ; $ fullModulePat... | Return list of paths to all available modules . |
46,593 | private function getPhpFilesMatchingPatternForCommandFromGivenPath ( $ path ) { $ folders = [ 'Commands' , 'commands' , 'Command' ] ; foreach ( $ folders as $ f ) { $ cPath = $ path . DIRECTORY_SEPARATOR . $ f . DIRECTORY_SEPARATOR ; if ( ! is_dir ( $ cPath ) ) { continue ; } $ files = glob ( "$cPath*[cC]ommand\.php" )... | Return list of PHP files matching Command specific pattern . |
46,594 | private function getPhpFilesMatchingPatternForCommandFromGivenPaths ( $ paths ) { return $ this -> getFlatArray ( array_map ( function ( $ path ) { return $ this -> getPhpFilesMatchingPatternForCommandFromGivenPath ( $ path ) ; } , $ paths ) ) ; } | Helper method for getPhpFilesMatchingPatternForCommandFromGivenPath |
46,595 | private function getAllClassesFromPhpFile ( $ pathToPhpFile ) { $ classesBefore = get_declared_classes ( ) ; try { require_once $ pathToPhpFile ; } catch ( \ Throwable $ exception ) { print "Can not add Command $pathToPhpFile:\n" ; print $ exception -> getMessage ( ) . "\n" ; } $ classesAfter = get_declared_classes ( )... | Get list of defined classes from given PHP file . |
46,596 | private function getAllClassesFromPhpFiles ( $ pathToPhpFiles ) { return $ this -> getFlatArray ( array_map ( function ( $ pathToPhpFile ) { return $ this -> getAllClassesFromPhpFile ( $ pathToPhpFile ) ; } , $ pathToPhpFiles ) ) ; } | Helper method for getAllClassesFromPhpFile |
46,597 | private function getObjectsFromClasses ( $ classes ) { $ objects = array_map ( function ( $ class ) { try { return new $ class ; } catch ( \ Throwable $ ex ) { print "Can not add command from class $class:\n" ; print $ ex -> getMessage ( ) . "\n" ; } } , $ classes ) ; $ objects = array_filter ( $ objects , function ( $... | Convert given list of classes to objects . |
46,598 | public function getHydratorForEntity ( $ value ) { $ entityMetadata = $ this -> getMetadataMap ( ) [ ClassUtils :: getRealClass ( get_class ( $ value ) ) ] ; $ objectManagerClass = $ this -> getDoctrineHydratorConfig ( ) [ $ entityMetadata [ 'hydrator' ] ] [ 'object_manager' ] ; return new DoctrineHydrator ( $ this -> ... | Look up the object manager for the given entity and create a basic hydrator |
46,599 | public function extract ( $ value ) { if ( is_null ( $ value ) ) { return $ value ; } $ entityValues = $ this -> getHydratorForEntity ( $ value ) -> extract ( $ value ) ; $ entityMetadata = $ this -> getMetadataMap ( ) [ ClassUtils :: getRealClass ( get_class ( $ value ) ) ] ; $ link = new Link ( 'self' ) ; $ link -> s... | Return a HAL entity with just a self link |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.