idx
int64
0
241k
question
stringlengths
64
6.21k
target
stringlengths
5
803
226,200
public function isValid ( ) { $ hashedBody = strtoupper ( hash_hmac ( 'sha512' , $ this -> webhookJson , $ this -> signature ) ) ; return ( isset ( $ this -> headers [ 'X-ANET-SIGNATURE' ] ) && strtoupper ( explode ( '=' , $ this -> headers [ 'X-ANET-SIGNATURE' ] ) [ 1 ] ) === $ hashedBody ) ; }
Validates a webhook signature to determine if the webhook is valid
226,201
protected function getAllHeaders ( ) { if ( function_exists ( 'apache_request_headers' ) ) { $ headers = apache_request_headers ( ) ; } else { $ headers = array_filter ( $ _SERVER , function ( $ key ) { return strpos ( $ key , 'HTTP_' ) === 0 ; } , ARRAY_FILTER_USE_KEY ) ; } return $ headers ; }
Retrieves all HTTP headers of a given request
226,202
public function callStripeApi ( string $ endpoint , string $ action , array $ arguments ) { try { switch ( count ( $ arguments ) ) { case 1 : $ options = empty ( $ arguments [ 'options' ] ) ? null : $ arguments [ 'options' ] ; $ return = $ endpoint :: $ action ( $ options ) ; break ; case 2 : if ( isset ( $ arguments [...
Method to call the Stripe PHP SDK s static methods .
226,203
public function callStripeObject ( ApiResource $ object , string $ method , array $ arguments = [ ] ) { try { switch ( count ( $ arguments ) ) { case 0 : $ return = $ object -> $ method ( ) ; break ; case 1 : $ return = $ object -> $ method ( $ arguments [ 0 ] ) ; break ; case 2 : $ params = empty ( $ arguments [ 'para...
Method to call the Stripe PHP SDK s NON static methods .
226,204
public function match ( $ actual ) { if ( is_string ( $ actual ) ) { $ this -> type = 'string' ; $ this -> actual = strlen ( $ actual ) ; } elseif ( is_array ( $ actual ) ) { $ this -> type = 'array' ; $ this -> actual = count ( $ actual ) ; } else { throw new \ Exception ( 'LengthMatcher::match() requires an array or ...
Compares the length of the given array or string to the expected value . Returns true if the value is of the expected length else false .
226,205
protected function checkTransactionStatus ( $ status ) { if ( $ this -> transactionInfo instanceof TransactionResponse ) { $ match = ( int ) $ this -> transactionInfo -> getTransactionResponseField ( 'ResponseCode' ) === ( int ) $ status ; } else { $ match = ( int ) $ this -> transactionResponse -> responseCode === $ s...
Check to see if the ResponseCode matches the expected value
226,206
public function getTransactionResponseField ( $ field ) { if ( $ this -> transactionInfo instanceof TransactionResponse ) { return $ this -> transactionInfo -> getTransactionResponseField ( $ field ) ; } throw new AuthnetTransactionResponseCallException ( 'This API call does not have any transaction response data' ) ; ...
Gets the transaction response field for AIM and CIM transactions .
226,207
protected function getStringValue ( $ value ) { if ( $ value === true ) { return 'true' ; } elseif ( $ value === false ) { return 'false' ; } elseif ( $ value === null ) { return 'null' ; } elseif ( is_string ( $ value ) ) { return "\"$value\"" ; } return rtrim ( print_r ( $ value , true ) ) ; }
Returns a string representation of the given value used for printing the failure message .
226,208
public function asArray ( ) : array { $ theArray = [ static :: KEY_STATUS => $ this -> status ] ; if ( $ this -> data ) { $ theArray [ static :: KEY_DATA ] = $ this -> data ; } if ( ! $ this -> data && ! $ this -> isError ( ) ) { $ theArray [ static :: KEY_DATA ] = null ; } if ( $ this -> isError ( ) ) { $ theArray [ s...
Serializes the class into an array
226,209
public function setException ( \ Exception $ exception = null ) { $ this -> exception = $ exception ; $ this -> result = self :: FAILED ; }
Sets the spec exception also marking it as failed .
226,210
public function getHook ( $ key ) { if ( isset ( $ this -> hooks [ $ key ] ) ) { return $ this -> hooks [ $ key ] ; } return null ; }
Returns the hook found at the specified key . Usually one of before after beforeEach or afterEach .
226,211
public function addSuite ( $ suite ) { if ( true === $ this -> pending ) { $ suite -> setPending ( ) ; } $ this -> suites [ ] = $ suite ; }
Adds a suite to the list of nested suites .
226,212
public function setAmount ( MoneyInterface $ amount ) : self { if ( null === $ this -> amount ) { $ this -> amount = $ amount ; } return $ this ; }
This sets the amount only if it is null .
226,213
public function getFingerprint ( $ amount ) { if ( ! filter_var ( $ amount , FILTER_VALIDATE_FLOAT , FILTER_FLAG_ALLOW_THOUSAND ) ) { throw new AuthnetInvalidAmountException ( 'You must enter a valid amount greater than zero.' ) ; } return strtoupper ( hash_hmac ( 'sha512' , sprintf ( '%s^%s^%s^%s^' , $ this -> login ,...
Returns the hash for the SIM transaction
226,214
private function sourceExists ( StripeLocalCard $ card , Collection $ sources ) { foreach ( $ sources -> data as $ source ) { if ( $ card -> getId ( ) === $ source -> id ) { return true ; } } return false ; }
Checks if the given card is set source in the StripeCustomer object .
226,215
public function hasTrigger ( $ trigger ) { return count ( $ this -> connection -> select ( $ this -> grammar -> compileTriggerExists ( ) , [ $ trigger ] ) ) > 0 ; }
Determine if the given trigger exists .
226,216
public function dropIfExists ( $ trigger ) { $ this -> build ( tap ( $ this -> createBlueprint ( $ trigger ) , function ( $ blueprint ) { $ blueprint -> dropIfExists ( ) ; } ) ) ; }
Drop trigger .
226,217
public function callBuild ( ) { $ eventObjectTable = $ this -> getEventObjectTable ( ) ; $ callback = $ this -> getStatement ( ) ; $ actionTiming = $ this -> getActionTiming ( ) ; $ event = $ this -> getEvent ( ) ; $ this -> build ( tap ( $ this -> createBlueprint ( $ this -> trigger ) , function ( Blueprint $ blueprin...
Call build to execute blueprint to build trigger .
226,218
public function getReporterClass ( ) { $ reporter = $ this -> options [ 'reporter' ] ; if ( $ reporter === false ) { return self :: DEFAULT_REPORTER ; } $ reporterClass = ucfirst ( $ reporter ) . 'Reporter' ; $ reporterClass = "pho\\Reporter\\$reporterClass" ; try { $ reflection = new ReflectionClass ( $ reporterClass ...
Returns the namespaced name of the reporter class requested via the command line arguments defaulting to DotReporter if not specified .
226,219
public function afterSuite ( Suite $ suite ) { $ hook = $ suite -> getHook ( 'after' ) ; if ( $ hook && $ hook -> getException ( ) ) { $ this -> handleHookFailure ( $ hook ) ; } }
Ran after the containing test suite is invoked .
226,220
public function afterRun ( ) { if ( count ( $ this -> failures ) ) { $ this -> console -> writeLn ( "\nFailures:" ) ; } foreach ( $ this -> failures as $ spec ) { $ failedText = $ this -> formatter -> red ( "\n\"$spec\" FAILED" ) ; $ this -> console -> writeLn ( $ failedText ) ; $ this -> console -> writeLn ( $ spec ->...
Invoked after the test suite has ran allowing for the display of test results and related statistics .
226,221
public function alignText ( $ array , $ delimiter = '' ) { $ widths = [ ] ; foreach ( $ array as $ row ) { $ lengths = array_map ( 'strlen' , $ row ) ; for ( $ i = 0 ; $ i < count ( $ lengths ) ; $ i ++ ) { if ( isset ( $ widths [ $ i ] ) ) { $ widths [ $ i ] = max ( $ widths [ $ i ] , $ lengths [ $ i ] ) ; } else { $ ...
Given a multidimensional array formats the text such that each entry is left aligned with all other entries in the given column . The method also takes an optional delimiter for specifying a sequence of characters to separate each column .
226,222
public function watchPath ( $ path ) { if ( ! $ this -> inotify ) { $ this -> paths [ ] = $ path ; $ this -> addModifiedTimes ( $ path ) ; return ; } $ mask = IN_MODIFY | IN_ATTRIB | IN_CLOSE_WRITE | IN_MOVE | IN_CREATE | IN_DELETE | IN_DELETE_SELF | IN_MOVE_SELF ; $ directoryIterator = new \ RecursiveDirectoryIterator...
Adds the path to the list of files and folders to monitor for changes . If the path is a file its modification time is stored for comparison . If a directory the modification times for each sub - directory and file are recursively stored .
226,223
private function addModifiedTimes ( $ path ) { if ( is_file ( $ path ) ) { $ stat = stat ( $ path ) ; $ this -> modifiedTimes [ realpath ( $ path ) ] = $ stat [ 'mtime' ] ; return ; } $ directoryIterator = new \ RecursiveDirectoryIterator ( realpath ( $ path ) ) ; $ files = new \ RecursiveIteratorIterator ( $ directory...
Given the path to a file or directory recursively adds the modified times of any nested folders to the modifiedTimes property .
226,224
public function match ( $ subject ) { $ this -> subject = $ subject ; $ suffixLength = strlen ( $ this -> suffix ) ; if ( ! $ suffixLength ) { return true ; } return ( substr ( $ subject , - $ suffixLength ) === $ this -> suffix ) ; }
Returns true if the subject ends with the given suffix false otherwise .
226,225
protected function populate ( $ name , $ eventObjectTable , $ actionTiming , $ event , $ stub ) { $ stub = str_replace ( 'DummyClass' , $ this -> getClassName ( $ name ) , $ stub ) ; $ stub = str_replace ( 'DummyName' , $ name , $ stub ) ; $ stub = str_replace ( 'DummyEventObjectTable' , $ eventObjectTable , $ stub ) ;...
Populate migration stub .
226,226
public function getConsoleOption ( $ name ) { if ( isset ( $ this -> options [ $ name ] ) ) { return $ this -> options [ $ name ] ; } foreach ( $ this -> options as $ option ) { $ longName = $ option -> getLongName ( ) ; $ shortName = $ option -> getShortName ( ) ; if ( $ name == $ longName || $ name == $ shortName ) {...
Returns the ConsoleOption object either found at the key with the supplied name or whose short name or long name matches .
226,227
public function getOptions ( ) { $ options = [ ] ; foreach ( $ this -> options as $ name => $ option ) { $ options [ $ name ] = $ option -> getValue ( ) ; } return $ options ; }
Returns an associative array consisting of the names of the ConsoleOptions added to the parser and their values .
226,228
public function getOptionNames ( ) { $ names = [ ] ; foreach ( $ this -> options as $ option ) { $ names [ ] = $ option -> getLongName ( ) ; $ names [ ] = $ option -> getShortName ( ) ; } return $ names ; }
Returns an array containing the long and short names of all options .
226,229
public function match ( $ callable ) { try { $ callable ( ) ; } catch ( \ Exception $ exception ) { $ this -> thrown = $ exception ; } return ( $ this -> thrown instanceof $ this -> expected ) ; }
Compares the exception thrown by the callable if any to the expected exception . Returns true if an exception of the expected class is thrown false otherwise .
226,230
public static function getJsonApiHandler ( $ login , $ transaction_key , $ server = self :: USE_AKAMAI_SERVER ) { $ login = trim ( $ login ) ; $ transaction_key = trim ( $ transaction_key ) ; $ api_url = static :: getWebServiceURL ( $ server ) ; if ( empty ( $ login ) || empty ( $ transaction_key ) ) { throw new Authne...
Validates the Authorize . Net credentials and returns a Request object to be used to make an API call
226,231
protected static function getWebServiceURL ( $ server ) { $ urls = [ static :: USE_PRODUCTION_SERVER => 'https://api.authorize.net/xml/v1/request.api' , static :: USE_DEVELOPMENT_SERVER => 'https://apitest.authorize.net/xml/v1/request.api' , static :: USE_AKAMAI_SERVER => 'https://api2.authorize.net/xml/v1/request.api'...
Gets the API endpoint to be used for a JSON API call
226,232
public static function getSimHandler ( $ login , $ transaction_key , $ server = self :: USE_PRODUCTION_SERVER ) { $ login = trim ( $ login ) ; $ transaction_key = trim ( $ transaction_key ) ; $ api_url = static :: getSimURL ( $ server ) ; if ( empty ( $ login ) || empty ( $ transaction_key ) ) { throw new AuthnetInvali...
Validates the Authorize . Net credentials and returns a SIM object to be used to make a SIM API call
226,233
public static function getWebhooksHandler ( $ login , $ transaction_key , $ server = self :: USE_PRODUCTION_SERVER ) { $ login = trim ( $ login ) ; $ transaction_key = trim ( $ transaction_key ) ; $ api_url = static :: getWebhooksURL ( $ server ) ; if ( empty ( $ login ) || empty ( $ transaction_key ) ) { throw new Aut...
Validates the Authorize . Net credentials and returns a Webhooks Request object to be used to make an Webhook call
226,234
private function validateEvent ( Blueprint $ blueprint ) { if ( ! in_array ( strtolower ( $ blueprint -> event ) , $ this -> events ) ) { throw new InvalidArgumentException ( "Cannot use {$blueprint->event} as trigger event." ) ; } return $ blueprint -> event ; }
Validate event .
226,235
private function validateActionTiming ( Blueprint $ blueprint ) { if ( ! in_array ( strtolower ( $ blueprint -> actionTiming ) , $ this -> actionTimes ) ) { throw new InvalidArgumentException ( "Cannot use {$blueprint->actionTiming} as trigger action timing." ) ; } return $ blueprint -> actionTiming ; }
Validate action time .
226,236
public function make ( array $ config ) { $ client = new Client ( $ this -> getBuilder ( $ config ) , array_get ( $ config , 'version' ) , array_get ( $ config , 'enterprise' ) ) ; if ( ! array_key_exists ( 'method' , $ config ) ) { throw new InvalidArgumentException ( 'The github factory requires an auth method.' ) ; ...
Make a new github client .
226,237
protected function getBuilder ( array $ config ) { $ builder = new ClientBuilder ( ) ; if ( $ backoff = array_get ( $ config , 'backoff' ) ) { $ builder -> addPlugin ( new RetryPlugin ( [ 'retries' => $ backoff === true ? 2 : $ backoff ] ) ) ; } if ( $ this -> cache && class_exists ( CacheItemPool :: class ) && $ cache...
Get the http client builder .
226,238
protected function registerGitHubFactory ( ) { $ this -> app -> singleton ( 'github.factory' , function ( Container $ app ) { $ auth = $ app [ 'github.authfactory' ] ; $ cache = $ app [ 'cache' ] ; return new GitHubFactory ( $ auth , $ cache ) ; } ) ; $ this -> app -> alias ( 'github.factory' , GitHubFactory :: class )...
Register the github factory class .
226,239
protected static function getProperty ( string $ name ) { $ prop = ( new ReflectionClass ( Builder :: class ) ) -> getProperty ( $ name ) ; $ prop -> setAccessible ( true ) ; return $ prop ; }
Get the builder reflection property for the given name .
226,240
protected function normalizePHPOS ( $ name ) { if ( stripos ( $ name , 'CYGWIN' ) !== false ) { return 'CYGWIN' ; } if ( stripos ( $ name , 'MSYS' ) !== false || stripos ( $ name , 'MINGW' ) !== false ) { return 'MINGW' ; } return $ name ; }
This method normalizes some names for future compliance
226,241
public function getNoncer ( ) { if ( ! isset ( $ this -> noncer ) ) { $ this -> noncer = new self :: $ defaultNoncerClass ( $ this -> noncerLength ) ; if ( ! $ this -> noncer instanceof NoncerInterface ) { throw new \ UnexpectedValueException ( 'Noncer must implement Acquia\Rest\NoncerInterface' ) ; } } return $ this -...
Returns a noncer instantiates it if it doesn t exist .
226,242
public function getMenu ( string $ menuClass , $ options = [ ] ) : ItemInterface { $ options = array_merge ( $ this -> defaultOptions , $ options ) ; $ menu = $ this -> container -> has ( $ menuClass ) ? $ this -> container -> get ( $ menuClass ) : new $ menuClass ( ) ; if ( $ menu instanceof MenuInterface ) { return $...
Get Menu Array .
226,243
public function arrayToAttr ( array $ array = [ ] , array $ append = [ ] , array $ options = [ ] ) { $ array = array_merge_recursive ( $ array , $ append ) ; $ attr = '' ; foreach ( $ array as $ key => $ value ) { if ( \ is_array ( $ value ) ) { $ value = implode ( ' ' , $ value ) ; } if ( 'title' === mb_strtolower ( $...
Array to Html Attr Convert .
226,244
public function installDistroByProject ( $ site , $ env , $ projectName , $ version ) { $ source = 'http://ftp.drupal.org/files/projects/' . $ projectName . '-' . $ version . '-core.tar.gz' ; return $ this -> installDistro ( $ site , $ env , self :: INSTALL_PROJECT , $ source ) ; }
Install any publicly accessible standard Drupal distribution .
226,245
public function installDistroByMakefile ( $ site , $ env , $ makefileUrl ) { return $ this -> installDistro ( $ site , $ env , self :: INSTALL_MAKEFILE , $ makefileUrl ) ; }
Install a distro by passing a URL to a Drush makefile .
226,246
public function moveDomain ( $ site , $ domains , $ sourceEnv , $ targetEnv , $ skipSiteUpdate = FALSE ) { $ paths = '{+base_path}/sites/{site}/domain-move/{source}/{target}.json' ; $ update_site = '' ; if ( $ skipSiteUpdate ) { $ update_site = '1' ; $ paths .= '?skip_site_update={update_site}' ; } $ variables = array ...
Moves domains atomically from one environment to another .
226,247
public function deployCode ( $ site , $ sourceEnv , $ targetEnv ) { $ variables = array ( 'site' => $ site , 'source' => $ sourceEnv , 'target' => $ targetEnv , ) ; $ request = $ this -> post ( array ( '{+base_path}/sites/{site}/code-deploy/{source}/{target}.json' , $ variables ) ) ; return new Response \ Task ( $ requ...
Deploy code from on environment to another .
226,248
public function pushCode ( $ site , $ env , $ vcsPath ) { $ variables = array ( 'site' => $ site , 'env' => $ env , 'path' => $ vcsPath , ) ; $ request = $ this -> post ( array ( '{+base_path}/sites/{site}/envs/{env}/code-deploy.json?path={path}' , $ variables ) ) ; return new Response \ Task ( $ request ) ; }
Deploy a tag or branch to an environment .
226,249
private function resolveDataClass ( FormInterface $ form ) { if ( $ form -> isRoot ( ) ) { return $ form -> getConfig ( ) -> getDataClass ( ) ; } $ propertyPath = $ form -> getPropertyPath ( ) ; $ dataForm = $ form ; if ( $ propertyPath -> getLength ( ) === 1 && $ propertyPath -> isIndex ( 0 ) && $ form -> getConfig ( ...
Gets the form root data class used by the given form .
226,250
private function resolveDataSource ( FormInterface $ form ) { if ( $ form -> isRoot ( ) ) { $ dataForm = $ form -> getData ( ) ; } else { $ dataForm = $ form ; while ( $ dataForm -> getConfig ( ) -> getDataClass ( ) === null ) { $ dataForm = $ form -> getParent ( ) ; } } $ data = $ dataForm -> getData ( ) ; return arra...
Gets the form data to which a property path applies
226,251
private function guessProperty ( ClassMetadata $ metadata , $ element ) { if ( $ metadata -> hasPropertyMetadata ( $ element ) ) { return $ element ; } $ camelized = $ this -> camelize ( $ element ) ; if ( $ metadata -> hasPropertyMetadata ( $ camelized ) ) { return $ camelized ; } return null ; }
Guess what property a given element belongs to .
226,252
public function addCollection ( RuleCollection $ collection ) { foreach ( $ collection as $ name => $ rule ) { $ this -> set ( $ name , $ rule ) ; } }
Adds a rule collection at the end of the current set by appending all rule of the added collection .
226,253
public function compare ( $ operator , $ key , $ value ) { $ this -> conditions [ ] = $ this -> filter -> compare ( $ operator , $ key , $ value ) ; return $ this ; }
Adds generic condition for filtering
226,254
private function registerSettingsManager ( ) { $ this -> singleton ( Contracts \ Manager :: class , function ( $ app ) { return new SettingsManager ( $ app ) ; } ) ; $ this -> singleton ( Contracts \ Store :: class , function ( $ app ) { $ manager = $ app [ Contracts \ Manager :: class ] ; return $ manager -> driver ( ...
Register the Settings Manager .
226,255
public function addDatabaseCredentials ( $ acquiaDbName , $ localDbName , $ username , $ password = null , $ host = 'localhost' , $ port = 3306 ) { $ connString = $ username ; if ( $ password !== null ) { $ connString . ':' . $ password ; } $ this -> creds [ 'databases' ] [ $ acquiaDbName ] = array ( 'id' => '1' , 'rol...
Adds credentials to a database server .
226,256
public function compare ( $ operator , $ key , $ value ) { $ this -> controller -> compare ( $ operator , $ key , $ value ) ; return $ this ; }
Adds generic condition for filtering attributes
226,257
protected function buttonsViewData ( FormRuleContext $ context ) { $ buttonNames = $ context -> getButtons ( ) ; $ buttons = array ( ) ; foreach ( $ buttonNames as $ name ) { $ groups = $ context -> getGroup ( $ name ) ; $ buttons [ ] = array ( 'name' => $ name , 'cancel' => count ( $ groups ) === 0 , 'validation_group...
Transform the buttons in the given form into a array that can easily be used by twig .
226,258
public function processMenu ( ItemInterface $ menu , array $ options = [ ] ) : ItemInterface { if ( $ menu -> isEvent ( ) ) { $ this -> eventDispatcher -> dispatch ( $ menu -> getId ( ) . '.event' , new PdMenuEvent ( $ menu ) ) ; } $ this -> currentUri = $ this -> router -> getContext ( ) -> getPathInfo ( ) ; $ this ->...
Menu Processor .
226,259
private function recursiveProcess ( ItemInterface $ menu , $ options ) { $ childs = $ menu -> getChild ( ) ; if ( isset ( $ menu -> getChildAttr ( ) [ 'data-parent' ] ) ) { $ menu -> setChildAttr ( [ 'data-parent' => $ this -> router -> generate ( $ menu -> getChildAttr ( ) [ 'data-parent' ] ) ] ) ; } foreach ( $ child...
Process Menu Item .
226,260
protected function checkListRef ( $ prodId , $ domain , array $ refMap ) { if ( empty ( $ refMap ) ) { return ; } $ context = $ this -> getContext ( ) ; $ productManager = \ Aimeos \ MShop :: create ( $ context , 'product' ) ; $ search = $ productManager -> createSearch ( true ) ; $ expr = [ $ search -> getConditions (...
Checks if the reference IDs are really associated to the product
226,261
protected function createSubscriptions ( \ Aimeos \ MShop \ Order \ Item \ Base \ Iface $ basket ) { $ manager = \ Aimeos \ MShop :: create ( $ this -> getContext ( ) , 'subscription' ) ; foreach ( $ basket -> getProducts ( ) as $ orderProduct ) { if ( ( $ interval = $ orderProduct -> getAttribute ( 'interval' , 'confi...
Creates the subscription entries for the ordered products with interval attributes
226,262
protected function getOrderProductAttributes ( $ type , array $ ids , array $ values = [ ] , array $ quantities = [ ] ) { $ list = [ ] ; if ( ! empty ( $ ids ) ) { $ manager = \ Aimeos \ MShop :: create ( $ this -> getContext ( ) , 'order/base/product/attribute' ) ; foreach ( $ this -> getAttributes ( $ ids ) as $ id =...
Returns the order product attribute items for the given IDs and values
226,263
protected function getenv ( $ key ) { $ value = getenv ( $ key ) ; if ( $ value === false ) { if ( isset ( $ _ENV [ $ key ] ) ) { $ value = $ _ENV [ $ key ] ; } if ( isset ( $ _SERVER [ $ key ] ) ) { $ value = $ _SERVER [ $ key ] ; } } return $ value ; }
Acquia Cloud variables may be set in settings . inc after PHP init so make sure that we are loading them .
226,264
protected function prepareInsertData ( array $ data ) { $ dbData = [ ] ; $ extraColumns = $ this -> extraColumns ? $ this -> extraColumns : [ ] ; foreach ( $ data as $ key => $ value ) { $ dbData [ ] = array_merge ( $ extraColumns , [ $ this -> keyColumn => $ key , $ this -> valueColumn => $ value , ] ) ; } return $ db...
Transforms settings data into an array ready to be inserted into the database . Call array_dot on a multidimensional array before passing it into this method!
226,265
private function getChanges ( array $ data ) { $ changes = [ 'inserted' => Arr :: dot ( $ data ) , 'updated' => [ ] , 'deleted' => [ ] , ] ; foreach ( $ this -> newQuery ( ) -> pluck ( $ this -> keyColumn ) as $ key ) { if ( Arr :: has ( $ changes [ 'inserted' ] , $ key ) ) $ changes [ 'updated' ] [ $ key ] = $ changes...
Get the changed settings data .
226,266
private function syncUpdated ( array $ updated ) { foreach ( $ updated as $ key => $ value ) { $ this -> newQuery ( ) -> where ( $ this -> keyColumn , '=' , $ key ) -> update ( [ $ this -> valueColumn => $ value ] ) ; } }
Sync the updated records .
226,267
private function syncInserted ( array $ inserted ) { if ( ! empty ( $ inserted ) ) { $ this -> newQuery ( true ) -> insert ( $ this -> prepareInsertData ( $ inserted ) ) ; } }
Sync the inserted records .
226,268
private function syncDeleted ( array $ deleted ) { if ( ! empty ( $ deleted ) ) { $ this -> newQuery ( ) -> whereIn ( $ this -> keyColumn , $ deleted ) -> delete ( ) ; } }
Sync the deleted records .
226,269
public function code ( $ codes ) { if ( ! empty ( $ codes ) ) { $ this -> conditions [ ] = $ this -> filter -> compare ( '==' , 'stock.productcode' , $ codes ) ; } return $ this ; }
Adds the SKUs of the products for filtering
226,270
public function type ( $ types ) { if ( ! empty ( $ types ) ) { $ this -> conditions [ ] = $ this -> filter -> compare ( '==' , 'stock.type' , $ types ) ; } return $ this ; }
Adds stock types for filtering
226,271
protected function findConstraints ( FormInterface $ form ) { $ constraints = new ConstraintCollection ( ) ; $ formConstraints = $ form -> getConfig ( ) -> getOption ( 'constraints' ) ; if ( ! empty ( $ formConstraints ) ) { if ( is_array ( $ formConstraints ) ) { $ constraints -> addCollection ( new ConstraintCollecti...
Find all constraints for the given FormInterface .
226,272
public function get ( $ name ) { return isset ( $ this -> rules [ $ name ] ) ? $ this -> rules [ $ name ] : null ; }
Gets a rule list by name .
226,273
public function add ( array $ values ) { $ item = $ this -> item -> fromArray ( $ values ) ; $ addrItem = $ item -> getPaymentAddress ( ) ; if ( $ item -> getLabel ( ) === '' ) { $ label = $ addrItem -> getLastname ( ) ; if ( ( $ firstName = $ addrItem -> getFirstname ( ) ) !== '' ) { $ label = $ firstName . ' ' . $ la...
Creates a new customer item object pre - filled with the given values but not yet stored
226,274
public function createAddressItem ( array $ values = [ ] ) { $ manager = \ Aimeos \ MShop :: create ( $ this -> getContext ( ) , 'customer/address' ) ; return $ manager -> createItem ( ) -> fromArray ( $ values ) ; }
Creates a new address item object pre - filled with the given values
226,275
public function delete ( ) { if ( $ this -> item && $ this -> item -> getId ( ) ) { \ Aimeos \ MShop :: create ( $ this -> getContext ( ) , 'customer' ) -> deleteItem ( $ this -> item -> getId ( ) ) ; } return $ this ; }
Deletes a customer item that belongs to the current authenticated user
226,276
public function store ( ) { ( $ id = $ this -> item -> getId ( ) ) !== null ? $ this -> checkId ( $ id ) : $ this -> checkLimit ( ) ; $ context = $ this -> getContext ( ) ; if ( $ id === null ) { $ msg = $ this -> item -> toArray ( ) ; $ msg [ 'customer.password' ] = null ; if ( $ this -> item -> getPassword ( ) === ''...
Adds or updates a modified customer item in the storage
226,277
public function uses ( array $ domains ) { $ this -> domains = $ domains ; if ( ( $ id = $ this -> getContext ( ) -> getUserId ( ) ) !== null ) { $ this -> item = $ this -> manager -> getItem ( $ id , $ domains , true ) ; } return $ this ; }
Sets the domains that will be used when working with the customer item
226,278
protected function checkLimit ( ) { $ total = 0 ; $ context = $ this -> getContext ( ) ; $ config = $ context -> getConfig ( ) ; $ count = $ config -> get ( 'controller/frontend/customer/limit-count' , 5 ) ; $ seconds = $ config -> get ( 'controller/frontend/customer/limit-seconds' , 300 ) ; $ search = $ this -> manage...
Checks if the current user is allowed to create more customer accounts
226,279
protected function checkId ( $ id ) { if ( $ id != $ this -> getContext ( ) -> getUserId ( ) ) { $ msg = sprintf ( 'Not allowed to access customer data for ID "%1$s"' , $ id ) ; throw new \ Aimeos \ Controller \ Frontend \ Customer \ Exception ( $ msg ) ; } return $ id ; }
Checks if the current user is allowed to retrieve the customer data for the given ID
226,280
protected function defaultRequestParams ( ) { $ params = array ( 'authenticator' => $ this -> buildAuthenticator ( ) , 'ssl' => $ this -> https === true ? 1 : 0 , 'ip' => $ this -> serverAddress , 'host' => $ this -> httpHost , ) ; return $ params ; }
Returns default paramaters for request . Not every call requires these .
226,281
public function allOf ( $ attrIds ) { if ( ! empty ( $ attrIds ) && ( $ ids = array_unique ( $ this -> validateIds ( ( array ) $ attrIds ) ) ) !== [ ] ) { $ func = $ this -> filter -> createFunction ( 'index.attribute:allof' , [ $ ids ] ) ; $ this -> conditions [ ] = $ this -> filter -> compare ( '!=' , $ func , null )...
Adds attribute IDs for filtering where products must reference all IDs
226,282
public function find ( $ code ) { return $ this -> manager -> findItem ( $ code , $ this -> domains , 'product' , null , true ) ; }
Returns the product for the given product code
226,283
public function oneOf ( $ attrIds ) { $ attrIds = ( array ) $ attrIds ; foreach ( $ attrIds as $ key => $ entry ) { if ( is_array ( $ entry ) && ( $ ids = array_unique ( $ this -> validateIds ( $ entry ) ) ) !== [ ] ) { $ func = $ this -> filter -> createFunction ( 'index.attribute:oneof' , [ $ ids ] ) ; $ this -> cond...
Adds attribute IDs for filtering where products must reference at least one ID
226,284
public function product ( $ prodIds ) { if ( ! empty ( $ prodIds ) && ( $ ids = array_unique ( $ this -> validateIds ( ( array ) $ prodIds ) ) ) !== [ ] ) { $ this -> conditions [ ] = $ this -> filter -> compare ( '==' , 'product.id' , $ ids ) ; } return $ this ; }
Adds product IDs for filtering
226,285
public function resolve ( $ name ) { $ langid = $ this -> getContext ( ) -> getLocale ( ) -> getLanguageId ( ) ; $ search = $ this -> manager -> createSearch ( ) ; $ func = $ search -> createFunction ( 'index.text:url' , [ $ langid ] ) ; $ search -> setConditions ( $ search -> compare ( '==' , $ func , $ name ) ) ; $ i...
Returns the product for the given product URL name
226,286
public function search ( & $ total = null ) { $ this -> filter -> setConditions ( $ this -> filter -> combine ( '&&' , $ this -> conditions ) ) ; return $ this -> manager -> searchItems ( $ this -> filter , $ this -> domains , $ total ) ; }
Returns the products filtered by the previously assigned conditions
226,287
public function supplier ( $ supIds , $ listtype = 'default' ) { if ( ! empty ( $ supIds ) && ( $ ids = array_unique ( $ this -> validateIds ( ( array ) $ supIds ) ) ) !== [ ] ) { $ func = $ this -> filter -> createFunction ( 'index.supplier:position' , [ $ listtype , $ ids ] ) ; $ this -> conditions [ ] = $ this -> fi...
Adds supplier IDs for filtering
226,288
public function text ( $ text ) { if ( ! empty ( $ text ) ) { $ langid = $ this -> getContext ( ) -> getLocale ( ) -> getLanguageId ( ) ; $ func = $ this -> filter -> createFunction ( 'index.text:relevance' , [ $ langid , $ text ] ) ; $ this -> conditions [ ] = $ this -> filter -> compare ( '>' , $ func , 0 ) ; } retur...
Adds input string for full text search
226,289
protected function getCatalogIdsFromTree ( \ Aimeos \ MShop \ Catalog \ Item \ Iface $ item ) { if ( $ item -> getStatus ( ) < 1 ) { return [ ] ; } $ list = [ $ item -> getId ( ) ] ; foreach ( $ item -> getChildren ( ) as $ child ) { $ list = array_merge ( $ list , $ this -> getCatalogIdsFromTree ( $ child ) ) ; } retu...
Returns the list of catalog IDs for the given catalog tree
226,290
protected function validateIds ( array $ ids ) { $ list = [ ] ; foreach ( $ ids as $ id ) { if ( $ id != '' && preg_match ( '/^[A-Za-z0-9\-\_]+$/' , $ id ) === 1 ) { $ list [ ] = ( string ) $ id ; } } return $ list ; }
Validates the given IDs as integers
226,291
public static function assertNumCalls ( FBMock_Mock $ mock , $ method_name , $ expected_num_calls , $ msg = '' ) { FBMock_Utils :: assertString ( $ method_name ) ; FBMock_Utils :: assertInt ( $ expected_num_calls ) ; $ call_count = count ( $ mock -> mockGetCalls ( $ method_name ) ) ; PHPUnit \ Framework \ TestCase :: a...
Assert that the method was called a certain number of times on a mock
226,292
public static function assertNotCalled ( FBMock_Mock $ mock , $ method_name , $ msg = '' ) { FBMock_Utils :: assertString ( $ method_name ) ; self :: assertNumCalls ( $ mock , $ method_name , 0 , $ msg ) ; }
Assert that the method was not called .
226,293
public static function assertCalls ( FBMock_Mock $ mock , $ method_name ) { FBMock_Utils :: assertString ( $ method_name ) ; $ args = func_get_args ( ) ; $ msg = '' ; if ( is_string ( end ( $ args ) ) ) { $ msg = array_pop ( $ args ) ; } $ expected_calls = array_slice ( $ args , 2 ) ; self :: assertNumCalls ( $ mock , ...
Assert that the method calls match the array of calls .
226,294
public function store ( ) { $ this -> checkLimit ( $ this -> item -> getBaseId ( ) ) ; $ cntl = \ Aimeos \ Controller \ Common \ Order \ Factory :: create ( $ this -> getContext ( ) ) ; $ this -> item = $ this -> manager -> saveItem ( $ this -> item ) ; return $ cntl -> block ( $ this -> item ) ; }
Saves the modified order item in the storage and blocks the stock and coupon codes
226,295
protected function checkLimit ( $ baseId ) { $ seconds = $ this -> getContext ( ) -> getConfig ( ) -> get ( 'controller/frontend/order/limit-seconds' , 300 ) ; $ search = $ this -> manager -> createSearch ( ) -> setSlice ( 0 , 0 ) ; $ search -> setConditions ( $ search -> combine ( '&&' , [ $ search -> compare ( '==' ,...
Checks if more orders than allowed have been created by the user
226,296
public function camo ( $ url ) { return $ this -> formatter -> formatCamoUrl ( $ this -> domain , $ this -> getDigest ( $ url ) , $ url ) ; }
Camoflauge all urls
226,297
public function camoHttpOnly ( $ url ) { $ parsed = parse_url ( $ url ) ; if ( $ parsed [ 'scheme' ] == 'https' ) { return $ url ; } return $ this -> camo ( $ url ) ; }
Camoflauge only the urls that are not currently https
226,298
public function attribute ( $ attrIds ) { if ( ! empty ( $ attrIds ) ) { $ this -> conditions [ ] = $ this -> filter -> compare ( '==' , 'attribute.id' , $ attrIds ) ; } return $ this ; }
Adds attribute IDs for filtering
226,299
public function find ( $ code , $ type ) { return $ this -> manager -> findItem ( $ code , $ this -> domains , $ this -> domain , $ type , true ) ; }
Returns the attribute for the given attribute code