idx int64 0 60.3k | question stringlengths 99 4.85k | target stringlengths 5 718 |
|---|---|---|
45,300 | 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 |
45,301 | 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 |
45,302 | 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 |
45,303 | 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 |
45,304 | 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 . |
45,305 | 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 . |
45,306 | 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 . |
45,307 | 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 . |
45,308 | 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 . |
45,309 | 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 . |
45,310 | 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 |
45,311 | 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 . |
45,312 | 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 . |
45,313 | 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 . |
45,314 | 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 . |
45,315 | 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 . |
45,316 | 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 . |
45,317 | 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 . |
45,318 | 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 . |
45,319 | 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 . |
45,320 | 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 |
45,321 | 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 . |
45,322 | 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 . |
45,323 | public function compare ( $ operator , $ key , $ value ) { $ this -> conditions [ ] = $ this -> filter -> compare ( $ operator , $ key , $ value ) ; return $ this ; } | Adds generic condition for filtering |
45,324 | 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 . |
45,325 | 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 . |
45,326 | public function compare ( $ operator , $ key , $ value ) { $ this -> controller -> compare ( $ operator , $ key , $ value ) ; return $ this ; } | Adds generic condition for filtering attributes |
45,327 | 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 . |
45,328 | 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 . |
45,329 | 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 . |
45,330 | 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 |
45,331 | 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 |
45,332 | 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 |
45,333 | 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 . |
45,334 | 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! |
45,335 | 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 . |
45,336 | private function syncUpdated ( array $ updated ) { foreach ( $ updated as $ key => $ value ) { $ this -> newQuery ( ) -> where ( $ this -> keyColumn , '=' , $ key ) -> update ( [ $ this -> valueColumn => $ value ] ) ; } } | Sync the updated records . |
45,337 | private function syncInserted ( array $ inserted ) { if ( ! empty ( $ inserted ) ) { $ this -> newQuery ( true ) -> insert ( $ this -> prepareInsertData ( $ inserted ) ) ; } } | Sync the inserted records . |
45,338 | private function syncDeleted ( array $ deleted ) { if ( ! empty ( $ deleted ) ) { $ this -> newQuery ( ) -> whereIn ( $ this -> keyColumn , $ deleted ) -> delete ( ) ; } } | Sync the deleted records . |
45,339 | 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 |
45,340 | public function type ( $ types ) { if ( ! empty ( $ types ) ) { $ this -> conditions [ ] = $ this -> filter -> compare ( '==' , 'stock.type' , $ types ) ; } return $ this ; } | Adds stock types for filtering |
45,341 | 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 . |
45,342 | public function get ( $ name ) { return isset ( $ this -> rules [ $ name ] ) ? $ this -> rules [ $ name ] : null ; } | Gets a rule list by name . |
45,343 | 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 |
45,344 | 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 |
45,345 | 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 |
45,346 | 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 |
45,347 | 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 |
45,348 | 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 |
45,349 | 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 |
45,350 | 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 . |
45,351 | 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 |
45,352 | public function find ( $ code ) { return $ this -> manager -> findItem ( $ code , $ this -> domains , 'product' , null , true ) ; } | Returns the product for the given product code |
45,353 | 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 |
45,354 | 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 |
45,355 | 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 |
45,356 | 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 |
45,357 | 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 |
45,358 | 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 |
45,359 | 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 |
45,360 | 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 |
45,361 | 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 |
45,362 | 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 . |
45,363 | 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 . |
45,364 | 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 |
45,365 | 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 |
45,366 | public function camo ( $ url ) { return $ this -> formatter -> formatCamoUrl ( $ this -> domain , $ this -> getDigest ( $ url ) , $ url ) ; } | Camoflauge all urls |
45,367 | 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 |
45,368 | public function attribute ( $ attrIds ) { if ( ! empty ( $ attrIds ) ) { $ this -> conditions [ ] = $ this -> filter -> compare ( '==' , 'attribute.id' , $ attrIds ) ; } return $ this ; } | Adds attribute IDs for filtering |
45,369 | public function find ( $ code , $ type ) { return $ this -> manager -> findItem ( $ code , $ this -> domains , $ this -> domain , $ type , true ) ; } | Returns the attribute for the given attribute code |
45,370 | public function search ( & $ total = null ) { $ expr = array_merge ( $ this -> conditions , [ $ this -> filter -> compare ( '==' , 'attribute.domain' , $ this -> domain ) ] ) ; $ this -> filter -> setConditions ( $ this -> filter -> combine ( '&&' , $ expr ) ) ; return $ this -> manager -> searchItems ( $ this -> filte... | Returns the attributes filtered by the previously assigned conditions |
45,371 | public function getIterator ( ) { $ array = $ this -> getArrayCopy ( ) ; if ( isset ( $ this -> collectionProperty ) ) { $ collectionFound = false ; $ property = NULL ; foreach ( ( array ) $ this -> collectionProperty as $ property ) { if ( isset ( $ array [ $ property ] ) ) { $ collectionFound = true ; break ; } } if ... | Keys the array of objects by their identifier constructs and returns and array object . |
45,372 | public function add ( array $ values ) { $ this -> baskets [ $ this -> type ] = $ this -> get ( ) -> fromArray ( $ values ) ; return $ this ; } | Adds values like comments to the basket |
45,373 | public function get ( ) { if ( ! isset ( $ this -> baskets [ $ this -> type ] ) ) { $ this -> baskets [ $ this -> type ] = $ this -> manager -> getSession ( $ this -> type ) ; $ this -> checkLocale ( $ this -> baskets [ $ this -> type ] -> getLocale ( ) , $ this -> type ) ; } return $ this -> baskets [ $ this -> type ]... | Returns the basket object . |
45,374 | public function save ( ) { if ( isset ( $ this -> baskets [ $ this -> type ] ) && $ this -> baskets [ $ this -> type ] -> isModified ( ) ) { $ this -> manager -> setSession ( $ this -> baskets [ $ this -> type ] , $ this -> type ) ; } return $ this ; } | Explicitely persists the basket content |
45,375 | public function store ( ) { $ total = 0 ; $ context = $ this -> getContext ( ) ; $ config = $ context -> getConfig ( ) ; $ count = $ config -> get ( 'controller/frontend/basket/limit-count' , 5 ) ; $ seconds = $ config -> get ( 'controller/frontend/basket/limit-seconds' , 300 ) ; $ search = $ this -> manager -> createS... | Creates a new order base object from the current basket |
45,376 | public function dsn ( ) { if ( ! isset ( $ this [ 'name' ] ) ) { throw new \ OutOfBoundsException ( 'Malformed response: expecting "name" property' ) ; } if ( ! isset ( $ this [ 'host' ] ) ) { throw new \ OutOfBoundsException ( 'Malformed response: expecting "host" property' ) ; } if ( ! isset ( $ this [ 'port' ] ) ) {... | Returns the DSN for the active host . |
45,377 | public function getPath ( $ id ) { $ list = $ this -> manager -> getPath ( $ id , $ this -> domains ) ; if ( $ this -> root ) { foreach ( $ list as $ key => $ item ) { if ( $ key == $ this -> root ) { break ; } unset ( $ list [ $ key ] ) ; } } return $ list ; } | Returns the list of categories up to the root node including the node given by its ID |
45,378 | public function visible ( array $ catIds ) { if ( empty ( $ catIds ) ) { return $ this ; } $ config = $ this -> getContext ( ) -> getConfig ( ) ; $ expr = [ $ this -> filter -> compare ( '==' , 'catalog.parentid' , $ catIds ) , $ this -> filter -> compare ( '==' , 'catalog.id' , $ catIds ) ] ; if ( ( $ levels = $ confi... | Limits categories returned to only visible ones depending on the given category IDs |
45,379 | public static function parseFile ( $ filepath ) { if ( ! is_file ( $ filepath ) ) { throw new \ RuntimeException ( 'File not found: ' . $ filepath ) ; } if ( ! $ filedata = static :: readFiledata ( $ filepath ) ) { throw new \ RuntimeException ( 'Error reading file: ' . $ filepath ) ; } if ( ! $ json = self :: decode (... | Parses a file into a PHP array . |
45,380 | public function add ( $ view , RuleCollection $ collection ) { $ name = FormHelper :: getFormName ( $ view ) ; if ( isset ( $ this -> rules [ $ name ] ) ) { $ this -> rules [ $ name ] -> addCollection ( $ collection ) ; } else { $ this -> rules [ $ name ] = $ collection ; } } | Adds a rule collection . |
45,381 | public function save ( $ overwrite = false ) { foreach ( $ this as $ group => $ builder ) { $ this -> saveServiceGroup ( $ group , $ overwrite ) ; } } | Writes all service group configurations to the backend . |
45,382 | public function cancel ( $ id ) { $ item = $ this -> manager -> getItem ( $ id ) ; $ item = $ item -> setDateEnd ( $ item -> getDateNext ( ) ) -> setReason ( \ Aimeos \ MShop \ Subscription \ Item \ Iface :: REASON_CANCEL ) ; return $ this -> manager -> saveItem ( $ item ) ; } | Cancels an active subscription |
45,383 | public function get ( $ id ) { $ context = $ this -> getContext ( ) ; $ filter = $ this -> manager -> createSearch ( true ) ; $ expr = [ $ filter -> compare ( '==' , 'subscription.id' , $ id ) , $ filter -> compare ( '==' , 'order.base.customerid' , $ context -> getUserId ( ) ) , $ filter -> getConditions ( ) , ] ; $ f... | Returns the subscription item for the given ID |
45,384 | public function getIntervals ( ) { $ manager = \ Aimeos \ MShop :: create ( $ this -> getContext ( ) , 'attribute' ) ; $ search = $ manager -> createSearch ( true ) ; $ expr = array ( $ search -> compare ( '==' , 'attribute.domain' , 'product' ) , $ search -> compare ( '==' , 'attribute.type' , 'interval' ) , $ search ... | Returns the available interval attribute items |
45,385 | public function getProvider ( $ serviceId ) { $ item = $ this -> manager -> getItem ( $ serviceId , $ this -> domains , true ) ; return $ this -> manager -> getProvider ( $ item , $ item -> getType ( ) ) ; } | Returns the service item for the given ID |
45,386 | public function getProviders ( ) { $ list = [ ] ; $ this -> filter -> setConditions ( $ this -> filter -> combine ( '&&' , $ this -> conditions ) ) ; foreach ( $ this -> manager -> searchItems ( $ this -> filter , $ this -> domains ) as $ id => $ item ) { $ list [ $ id ] = $ this -> manager -> getProvider ( $ item , $ ... | Returns the service providers of the given type |
45,387 | protected function read ( ) { $ contents = $ this -> filesystem ( ) -> get ( $ this -> path ) ; $ data = json_decode ( $ contents , true ) ; if ( is_null ( $ data ) ) { throw new RuntimeException ( "Invalid JSON file in [{$this->path}]" ) ; } return ( array ) $ data ; } | Read the data from the store . |
45,388 | public static function create ( \ Aimeos \ MShop \ Context \ Item \ Iface $ context , $ path ) { if ( empty ( $ path ) ) { throw new \ Aimeos \ Controller \ Frontend \ Exception ( sprintf ( 'Controller path is empty' ) ) ; } if ( self :: $ cache === false || ! isset ( self :: $ objects [ $ path ] ) ) { if ( ctype_alnum... | Creates the required controller specified by the given path of controller names |
45,389 | public static function inject ( $ path , \ Aimeos \ Controller \ Frontend \ Iface $ object = null ) { self :: $ objects [ $ path ] = $ object ; } | Injects a manager object for the given path of manager names |
45,390 | public function parseLines ( array $ lines , string $ vcsType = '' ) : Changeset { $ parser = $ this -> getParser ( $ vcsType ) ; return $ parser -> parse ( $ lines ) ; } | Accepts an array of diff lines & returns a Changeset instance . |
45,391 | public function parseFile ( string $ filename , string $ vcsType = '' ) : Changeset { $ parser = $ this -> getParser ( $ vcsType ) ; if ( ! file_exists ( $ filename ) ) { throw new \ RuntimeException ( 'File "' . $ filename . '" not found.' ) ; } return $ parser -> parse ( file ( $ filename , FILE_IGNORE_NEW_LINES ) ) ... | Accepts an filename for a diff & returns a Changeset instance . |
45,392 | private function getNormalizer ( string $ vcsType ) : DiffNormalizerInterface { $ normalizer = new GitDiffNormalizer ( ) ; if ( self :: VCS_SVN === $ vcsType ) { $ normalizer = new SvnDiffNormalizer ( ) ; } return $ normalizer ; } | Returns an appropriate normalizer for the VCS type . |
45,393 | public function getFilename ( string $ fileStartLine ) : string { if ( ! preg_match ( static :: FILENAME_REGEX , $ fileStartLine , $ matches ) ) { return substr ( $ fileStartLine , 4 ) ; } return $ matches [ 'filename' ] ; } | Accepts a raw file start line from a unified diff & returns a normalized version of the filename . |
45,394 | public function tokenize ( array $ diffLineList ) { $ tokenList = [ ] ; $ hasStarted = false ; $ lineCount = count ( $ diffLineList ) ; for ( $ i = 0 ; $ i < $ lineCount ; $ i ++ ) { if ( $ this -> isFileStart ( $ diffLineList , $ i ) ) { $ hasStarted = true ; $ tokenList = array_merge ( $ tokenList , $ this -> getFile... | Tokenize a unified diff |
45,395 | private function getHunkTokens ( array $ diffLineList , int & $ currentLine ) : array { $ tokenList = [ ] ; $ hunkTokens = $ this -> getHunkStartTokens ( $ diffLineList [ $ currentLine ] ) ; if ( $ this -> isHunkStart ( $ hunkTokens ) ) { $ currentLine ++ ; [ $ originalLineCount , $ newLineCount ] = $ this -> getHunkLi... | Process a hunk . |
45,396 | private function isFileStart ( array $ diffLineList , int $ currentLine ) : bool { return $ currentLine + 1 < count ( $ diffLineList ) && '---' === substr ( $ diffLineList [ $ currentLine ] , 0 , 3 ) && '+++' === substr ( $ diffLineList [ $ currentLine + 1 ] , 0 , 3 ) ; } | Returns true if the current line is the beginning of a file section . |
45,397 | private function getHunkStartTokens ( string $ diffLine ) : array { $ tokenList = [ ] ; if ( preg_match ( self :: HUNK_START_REGEX , $ diffLine , $ matches ) ) { if ( $ this -> hasToken ( $ matches , Token :: FILE_DELETION_LINE_COUNT ) ) { $ tokenList = [ new Token ( Token :: FILE_DELETION_LINE_COUNT , $ matches [ Toke... | Parses the hunk start into appropriate tokens . |
45,398 | private function getFilenameTokens ( array $ diffLineList , int $ currentLine ) : array { $ filenameTokens = [ ] ; $ hunkTokens = $ this -> getHunkStartTokens ( $ diffLineList [ $ currentLine + 2 ] ) ; if ( count ( $ hunkTokens ) ) { if ( 4 == count ( $ hunkTokens ) ) { $ originalFilename = $ this -> diffNormalizer -> ... | Get tokens for original & new filenames . |
45,399 | private function getHunkLineToken ( int & $ addedCount , int & $ removedCount , int & $ unchangedCount , string $ diffLine ) : Token { if ( '+' === substr ( $ diffLine , 0 , 1 ) ) { $ tokenType = Token :: SOURCE_LINE_ADDED ; $ addedCount ++ ; } elseif ( '-' === substr ( $ diffLine , 0 , 1 ) ) { $ tokenType = Token :: S... | Get a single line for a hunk . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.