idx int64 0 241k | question stringlengths 64 6.21k | target stringlengths 5 803 |
|---|---|---|
8,600 | public function select ( $ columns ) { $ columns = self :: removeKeyword ( $ columns , self :: SELECT ) ; $ this -> select = $ columns ; return $ this ; } | Sets the statement SELECT clause in the form of a b ... . |
8,601 | public function from ( $ table ) { $ table = self :: removeKeyword ( $ table , self :: FROM ) ; $ this -> from = $ table ; return $ this ; } | Sets the statement FROM clause in the form of table . |
8,602 | public function increaseOffsetBy ( $ amount ) { if ( $ this -> offset === null ) { $ this -> offset = 0 ; } $ this -> offset += $ amount ; return $ this ; } | Increases the offset by the specified amount . |
8,603 | private function buildQuery ( ) { $ this -> validateQuery ( ) ; $ statement = "" ; if ( $ this -> select !== null ) { $ statement .= sprintf ( "%s %s " , self :: SELECT , $ this -> select ) ; } if ( $ this -> from !== null ) { $ statement .= sprintf ( "%s %s " , self :: FROM , $ this -> from ) ; } if ( $ this -> where ... | Builds the query from the clauses . |
8,604 | private static function validate ( $ awqlString , $ startIndex , $ pageSize ) { $ validationResult = QueryValidator :: validateServiceQuery ( $ awqlString , false ) ; if ( $ validationResult -> isFailed ( ) ) { throw new InvalidArgumentException ( 'The service query string is invalid. Validation fail reason: ' . $ vali... | Validates the arguments for constructing a service query object . |
8,605 | private static function countLandscapePoints ( Page $ page ) { $ entries = $ page -> getEntries ( ) ; if ( is_null ( $ entries ) ) { return 0 ; } $ totalLandscapePointsInPage = 0 ; foreach ( $ entries as $ entry ) { $ totalLandscapePointsInPage += count ( $ entry -> getLandscapePoints ( ) ) ; } return $ totalLandscapeP... | Counts the number of landscape points in a AdGroupBidLandscapePage or AdGroupBidLandscapePage page . |
8,606 | public function nextPage ( Page $ previousPage = null ) { if ( is_null ( $ previousPage ) ) { $ this -> startIndex = $ this -> startIndex + $ this -> pageSize ; return $ this ; } if ( ! ( $ previousPage instanceof AdGroupBidLandscapePage ) && ! ( $ previousPage instanceof CriterionBidLandscapePage ) ) { throw new Inval... | Increases the start index by the current page size . |
8,607 | public function hasNext ( Page $ previousPage ) { if ( $ previousPage instanceof AdGroupBidLandscapePage || $ previousPage instanceof CriterionBidLandscapePage ) { return $ this -> pageSize <= self :: countLandscapePoints ( $ previousPage ) ; } if ( is_null ( $ this -> totalNumEntries ) ) { $ this -> totalNumEntries = ... | Checks if there are still entries to be fetched on the next page . |
8,608 | public static function runExample ( ServiceFactory $ serviceFactory , AdManagerSession $ session ) { $ networkService = $ serviceFactory -> createNetworkService ( $ session ) ; $ networks = $ networkService -> getAllNetworks ( ) ; if ( empty ( $ networks ) ) { printf ( 'No accessible networks found.' . PHP_EOL ) ; retu... | Gets all networks . |
8,609 | public function getHome ( ) { $ home = null ; if ( ! empty ( getenv ( 'HOME' ) ) ) { $ home = getenv ( 'HOME' ) ; } elseif ( ! empty ( $ _SERVER [ 'HOME' ] ) ) { $ home = $ _SERVER [ 'HOME' ] ; } elseif ( ! empty ( getenv ( 'HOMEDRIVE' ) ) && ! empty ( getenv ( 'HOMEPATH' ) ) ) { $ home = getenv ( 'HOMEDRIVE' ) . geten... | Attempts to find the home directory of the user running the PHP script . |
8,610 | public static function copyFrom ( ReportQueryBuilderDelegate $ otherInstance , ReportQueryBuilder $ queryBuilder ) { $ copyingInstance = new self ( ) ; $ copyingInstance -> selectFields = $ otherInstance -> selectFields ; $ copyingInstance -> fromReportType = $ otherInstance -> fromReportType ; $ copyingInstance -> dur... | Creates a new query builder delegate object by copying field names WHERE FROM and DURING clauses from another query builder delegate object . |
8,611 | public function during ( $ startDate , $ endDate ) { $ validationResult = QueryValidator :: validateCustomDateRange ( $ startDate , $ endDate ) ; if ( $ validationResult -> isFailed ( ) ) { throw new InvalidArgumentException ( 'The start or end date is' . ' invalid. Validation fail reasons: ' . $ validationResult -> ge... | Sets a custom date range by specifying the start and end dates . |
8,612 | public static function fromDateTime ( DateTime $ dateTime ) { $ date = new Date ( ) ; $ date -> setYear ( intval ( $ dateTime -> format ( 'Y' ) ) ) ; $ date -> setMonth ( intval ( $ dateTime -> format ( 'm' ) ) ) ; $ date -> setDay ( intval ( $ dateTime -> format ( 'd' ) ) ) ; $ result = new AdManagerDateTime ( ) ; $ r... | Creates a Ad Manager date time from a PHP date time . |
8,613 | public static function toDateTime ( AdManagerDateTime $ adManagerDateTime ) { $ dateTimeString = sprintf ( '%sT%02d:%02d:%02d' , AdManagerDates :: toDateString ( $ adManagerDateTime -> getDate ( ) ) , $ adManagerDateTime -> getHour ( ) , $ adManagerDateTime -> getMinute ( ) , $ adManagerDateTime -> getSecond ( ) ) ; re... | Converts a Ad Manager date time to a PHP date time . |
8,614 | public static function toDateTimeString ( AdManagerDateTime $ adManagerDateTime , $ timeZoneId = null ) { $ dateTime = self :: toDateTime ( $ adManagerDateTime ) ; if ( $ timeZoneId !== null ) { $ dateTime -> setTimezone ( new DateTimeZone ( $ timeZoneId ) ) ; } return $ dateTime -> format ( DateTime :: ATOM ) ; } | Returns an ISO 8601 string representation of the specified Ad Manager date time . |
8,615 | public static function validateFieldName ( $ fieldName ) { if ( ! is_string ( $ fieldName ) ) { return ValidationResult :: fail ( 'The field name must be a' . ' string.' ) ; } if ( empty ( trim ( $ fieldName ) ) ) { return ValidationResult :: fail ( 'The field name must not be' . ' null, empty, white spaces or zero.' )... | Validates a field name for using in the SELECT WHERE or ORDER BY clauses of an AWQL string . |
8,616 | public static function validateCustomDateRange ( $ startDateString , $ endDateString ) { $ startDate = DateTime :: createFromFormat ( 'Ymd' , $ startDateString ) ; $ warningsFound = ! empty ( DateTime :: getLastErrors ( ) [ 'warnings' ] ) ; if ( false === $ startDate || $ warningsFound ) { return ValidationResult :: fa... | Validates the start and end dates of a custom date range in the DURING clause of an AWQL string . |
8,617 | private static function containKeywords ( $ awqlString , $ clauseKeywords , $ containAll ) { $ patterns = array_map ( function ( $ keyword ) { return "/\w+$keyword\w+/i" ; } , $ clauseKeywords ) ; array_unshift ( $ patterns , self :: PATTERN_LITERAL_STRING ) ; $ awqlStringWithoutLiteralStrings = preg_replace ( $ patter... | Checks if an AWQL string contains certain clauses by searching for the clause opening keywords . |
8,618 | private static function validateQuery ( $ awqlString , $ requiredKeywords , $ forbiddenKeywords ) { if ( empty ( $ awqlString ) ) { return ValidationResult :: fail ( 'The AWQL string must not be' . ' null or empty' ) ; } if ( ! self :: containAllKeywords ( $ awqlString , $ requiredKeywords ) ) { return ValidationResult... | Checks if the AWQL string contains the required clause opening keywords but not the forbidden ones . |
8,619 | public static function validateServiceQuery ( $ awqlString , $ allowPagination = true ) { $ forbiddenKeywords = [ 'FROM' , 'DURING' ] ; if ( ! $ allowPagination ) { $ forbiddenKeywords [ ] = 'LIMIT' ; } return self :: validateQuery ( $ awqlString , [ 'SELECT' ] , $ forbiddenKeywords ) ; } | Validates a service query AWQL string . |
8,620 | private static function createSitelinksFeed ( AdWordsServices $ adWordsServices , AdWordsSession $ session ) { $ feedService = $ adWordsServices -> get ( $ session , FeedService :: class ) ; $ sitelinksData = [ ] ; $ textAttribute = new FeedAttribute ( ) ; $ textAttribute -> setType ( FeedAttributeType :: STRING ) ; $ ... | Creates the feed that holds the sitelinks data . |
8,621 | private static function createSitelinksFeedItems ( AdWordsServices $ adWordsServices , AdWordsSession $ session , array $ sitelinksData ) { $ feedItemService = $ adWordsServices -> get ( $ session , FeedItemService :: class ) ; $ home = self :: newSitelinkFeedItemAddOperation ( $ sitelinksData , 'Home' , 'http://www.ex... | Creates sitelinks feed items and add it to the feed . |
8,622 | private static function createSitelinksFeedMapping ( AdWordsServices $ adWordsServices , AdWordsSession $ session , array $ sitelinksData ) { $ feedMappingService = $ adWordsServices -> get ( $ session , FeedMappingService :: class ) ; $ linkTextFieldMapping = new AttributeFieldMapping ( ) ; $ linkTextFieldMapping -> s... | Maps the feed attributes to the sitelink placeholders . |
8,623 | private static function createSitelinksCampaignFeed ( AdWordsServices $ adWordsServices , AdWordsSession $ session , array $ sitelinksData , $ campaignId ) { $ campaignFeedService = $ adWordsServices -> get ( $ session , CampaignFeedService :: class ) ; $ matchingFunctionString = sprintf ( 'AND( IN(FEED_ITEM_ID, {%s}),... | Creates the campaign feed associated to the populated feed data for the specified campaign ID . |
8,624 | private static function restrictFeedItemToAdGroup ( AdWordsServices $ adWordsServices , AdWordsSession $ session , $ feedId , $ feedItemId , $ adGroupId ) { $ feedItemTargetService = $ adWordsServices -> get ( $ session , FeedItemTargetService :: class ) ; $ feedItemAdGroupTarget = new FeedItemAdGroupTarget ( ) ; $ fee... | Creates feed item ad group target for a specified feed ID feed item ID and ad group ID . |
8,625 | private static function restrictFeedItemToGeoTarget ( AdWordsServices $ adWordsServices , AdWordsSession $ session , FeedItem $ feedItem , $ locationId ) { $ feedItemTargetService = $ adWordsServices -> get ( $ session , FeedItemTargetService :: class ) ; $ feedItemCriterionTarget = new FeedItemCriterionTarget ( ) ; $ ... | Restricts the first feed item to only serve with ads for the specified location ID . |
8,626 | private static function newSitelinkFeedItemAddOperation ( array $ sitelinksData , $ text , $ finalUrl , $ line2 , $ line3 , $ restrictToLop = null ) { $ linkTextAttributeValue = new FeedItemAttributeValue ( ) ; $ linkTextAttributeValue -> setFeedAttributeId ( $ sitelinksData [ 'linkTextFeedAttributeId' ] ) ; $ linkText... | Creates a site link feed item and wraps it in an ADD operation . |
8,627 | public static function toDateString ( Date $ adManagerDate ) { return sprintf ( '%d-%02d-%02d' , $ adManagerDate -> getYear ( ) , $ adManagerDate -> getMonth ( ) , $ adManagerDate -> getDay ( ) ) ; } | Returns string representation of the specified Ad Manager date in yyyy - MM - dd format . |
8,628 | public static function replaceReferences ( $ request ) { $ requestDom = new DOMDocument ( ) ; try { set_error_handler ( [ self :: class , 'handleLoadXmlWarnings' ] ) ; $ requestDom -> loadXML ( $ request ) ; } catch ( DOMException $ e ) { return $ request ; } finally { restore_error_handler ( ) ; } $ xpath = new DOMXPa... | Iterates through all nodes with an href attribute in the specified request SOAP XML string and replaces them with the node they are referencing . |
8,629 | public static function appendWhereClause ( $ whereBuilders , $ awql ) { if ( empty ( $ whereBuilders ) ) { return $ awql ; } $ conditions = [ ] ; foreach ( $ whereBuilders as $ whereBuilder ) { $ conditions [ ] = $ whereBuilder -> buildWhere ( ) ; } return sprintf ( '%s WHERE %s' , $ awql , implode ( ' AND ' , $ condit... | Builds and appends a WHERE clause to a partial AWQL string . If there is no expressions specified the input AWQL string will be returned without modifications . |
8,630 | private static function createSmartCampaign ( AdWordsServices $ adWordsServices , AdWordsSession $ session , $ budgetId , $ merchantId ) { $ campaignService = $ adWordsServices -> get ( $ session , CampaignService :: class ) ; $ campaign = new Campaign ( ) ; $ campaign -> setName ( 'Smart Shopping campaign #' . uniqid ... | Creates a Smart Shopping campaign . |
8,631 | private static function createSmartShoppingAdGroup ( AdWordsServices $ adWordsServices , AdWordsSession $ session , $ campaignId ) { $ adGroupService = $ adWordsServices -> get ( $ session , AdGroupService :: class ) ; $ adGroup = new AdGroup ( ) ; $ adGroup -> setCampaignId ( $ campaignId ) ; $ adGroup -> setName ( 'S... | Creates a Smart Shopping ad group by setting the ad group type to SHOPPING_GOAL_OPTIMIZED_ADS . |
8,632 | private static function createSmartShoppingAd ( AdWordsServices $ adWordsServices , AdWordsSession $ session , $ adGroupId ) { $ adGroupAdService = $ adWordsServices -> get ( $ session , AdGroupAdService :: class ) ; $ smartShoppingAd = new GoalOptimizedShoppingAd ( ) ; $ adGroupAd = new AdGroupAd ( ) ; $ adGroupAd -> ... | Creates a Smart Shopping ad . |
8,633 | private static function createDefaultPartition ( AdWordsServices $ adWordsServices , AdWordsSession $ session , $ adGroupId ) { $ adGroupCriterionService = $ adWordsServices -> get ( $ session , AdGroupCriterionService :: class ) ; $ productPartition = new ProductPartition ( ) ; $ productPartition -> setPartitionType (... | Creates a default product partition as an ad group criterion . |
8,634 | public function createRequestOptionsWithReportDefinition ( ReportDefinition $ reportDefinition , ReportSettings $ reportSettingsOverride = null ) { $ params = [ ] ; $ context = [ 'xml_root_node_name' => 'reportDefinition' ] ; $ params [ '__rdxml' ] = $ this -> reportDefinitionSerializer -> serialize ( $ reportDefinitio... | Creates request options for downloading a report using an XML - based report definition . |
8,635 | public function createRequestOptionsWithAwqlQuery ( $ reportDefinition , $ reportFormat , ReportSettings $ reportSettingsOverride = null ) { $ params = [ '__rdquery' => $ reportDefinition , '__fmt' => $ reportFormat ] ; return array_merge ( $ this -> options , [ RequestOptions :: HEADERS => $ this -> createHeaders ( $ ... | Creates request options for downloading a report using an AWQL - based report definition . |
8,636 | private static function buildAdGroupAdOperations ( array $ adGroupOperations ) { $ operations = [ ] ; foreach ( $ adGroupOperations as $ adGroupOperation ) { $ adGroupId = $ adGroupOperation -> getOperand ( ) -> getId ( ) ; $ adGroupAd = new AdGroupAd ( ) ; $ adGroupAd -> setAdGroupId ( $ adGroupId ) ; $ expandedTextAd... | Builds objects of AdGroupAdOperation for creating an ad group ad for ad groups in the specified ad group operations . |
8,637 | private static function buildAdGroupOperations ( $ namePrefix , array $ campaignOperations ) { $ operations = [ ] ; foreach ( $ campaignOperations as $ campaignOperation ) { for ( $ i = 0 ; $ i < self :: NUMBER_OF_ADGROUPS_TO_ADD ; $ i ++ ) { $ adGroup = new AdGroup ( ) ; $ adGroup -> setCampaignId ( $ campaignOperatio... | Builds objects of AdGroupOperation for creating ad groups for campaigns in the specified campaign operations . |
8,638 | private static function buildCampaignOperations ( $ namePrefix , BudgetOperation $ budgetOperation ) { $ budgetId = $ budgetOperation -> getOperand ( ) -> getBudgetId ( ) ; $ operations = [ ] ; for ( $ i = 0 ; $ i < self :: NUMBER_OF_CAMPAIGNS_TO_ADD ; $ i ++ ) { $ campaign = new Campaign ( ) ; $ campaign -> setId ( --... | Builds objects of CampaignOperation for creating a campaign using the ID of budget in the specified budget operation . |
8,639 | private static function buildBudgetOperation ( $ namePrefix ) { $ budget = new Budget ( ) ; $ budget -> setBudgetId ( -- self :: $ temporaryId ) ; $ budget -> setName ( 'Interplanetary Cruise #' . $ namePrefix ) ; $ budgetAmount = new Money ( ) ; $ budgetAmount -> setMicroAmount ( 50000000 ) ; $ budget -> setAmount ( $... | Builds BudgetOperation for creating a budget . |
8,640 | private static function createOfflineData ( \ DateTime $ transactionTime , $ transactionMicroAmount , $ transactionCurrency , $ conversionName , array $ userIdentifierList ) { $ storeSalesTransaction = new StoreSalesTransaction ( ) ; $ storeSalesTransaction -> setTransactionTime ( $ transactionTime -> format ( 'Ymd His... | Creates the offline data from the specified transaction time transaction micro amount transaction currency conversion name and user identifier list . |
8,641 | private static function createUserIdentifier ( $ type , $ value ) { if ( 0 === strpos ( $ type , 'HASHED_' ) ) { $ value = hash ( 'sha256' , strtolower ( trim ( $ value ) ) ) ; } $ userIdentifier = new UserIdentifier ( ) ; $ userIdentifier -> setUserIdentifierType ( $ type ) ; $ userIdentifier -> setValue ( $ value ) ;... | Creates a user identifier from the specified type and value . |
8,642 | private static function createBiddingStrategy ( AdWordsServices $ adWordsServices , AdWordsSession $ session ) { $ biddingStrategyService = $ adWordsServices -> get ( $ session , BiddingStrategyService :: class ) ; $ biddingStrategy = new SharedBiddingStrategy ( ) ; $ biddingStrategy -> setName ( "Maximize Clicks " . u... | Creates a shared bidding strategy . |
8,643 | private static function createCampaignWithBiddingStrategy ( AdWordsServices $ adWordsServices , AdWordsSession $ session , $ biddingStrategyId , $ sharedBudgetId ) { $ campaignService = $ adWordsServices -> get ( $ session , CampaignService :: class ) ; $ campaign = new Campaign ( ) ; $ campaign -> setName ( 'Interplan... | Create a campaign with a portfolio bidding strategy . |
8,644 | private function createSoapHeaderObject ( AdsServiceDescriptor $ serviceDescriptor ) { $ reflectionClass = new ReflectionClass ( $ serviceDescriptor -> getServiceClass ( ) ) ; $ namespaceParts = explode ( '\\' , trim ( $ reflectionClass -> getNamespaceName ( ) , '\\' ) ) ; array_pop ( $ namespaceParts ) ; $ soapHeaderC... | Creates a new instance of the SOAP header object used by the AdWords API . |
8,645 | private static function createBudget ( AdWordsServices $ adWordsServices , AdWordsSession $ session ) { $ budgetService = $ adWordsServices -> get ( $ session , BudgetService :: class ) ; $ sharedBudget = new Budget ( ) ; $ sharedBudget -> setName ( 'Interplanetary Cruise #' . uniqid ( ) ) ; $ money = new Money ( ) ; $... | Creates the budget . |
8,646 | private static function createCampaign ( AdWordsServices $ adWordsServices , AdWordsSession $ session , Budget $ budget ) { $ campaignService = $ adWordsServices -> get ( $ session , CampaignService :: class ) ; $ campaign = new Campaign ( ) ; $ campaign -> setName ( 'Interplanetary Cruise #' . uniqid ( ) ) ; $ campaig... | Creates the campaign . |
8,647 | private static function createAdGroup ( AdWordsServices $ adWordsServices , AdWordsSession $ session , Campaign $ campaign ) { $ adGroupService = $ adWordsServices -> get ( $ session , AdGroupService :: class ) ; $ adGroup = new AdGroup ( ) ; $ adGroup -> setAdGroupType ( AdGroupType :: SEARCH_DYNAMIC_ADS ) ; $ adGroup... | Creates the ad group . |
8,648 | private static function createExpandedDSA ( AdWordsServices $ adWordsServices , AdWordsSession $ session , AdGroup $ adGroup ) { $ adGroupAdService = $ adWordsServices -> get ( $ session , AdGroupAdService :: class ) ; $ expandedDSA = new ExpandedDynamicSearchAd ( ) ; $ expandedDSA -> setDescription ( 'Buy your tickets... | Creates the expanded Dynamic Search Ad . |
8,649 | private static function addWebPageCriteria ( AdWordsServices $ adWordsServices , AdWordsSession $ session , AdGroup $ adGroup ) { $ adGroupCriterionService = $ adWordsServices -> get ( $ session , AdGroupCriterionService :: class ) ; $ param = new WebpageParameter ( ) ; $ param -> setCriterionName ( 'Special offers' ) ... | Adds a web page criteria to target Dynamic Search Ads . |
8,650 | public static function createWithField ( $ field , ServiceQueryBuilder $ queryBuilder ) { $ validationResult = QueryValidator :: validateFieldName ( $ field ) ; if ( $ validationResult -> isFailed ( ) ) { throw new InvalidArgumentException ( 'The field name for building the WHERE clause is invalid.' . ' Validation fail... | Creates a where builder object to start a logic expression with a field name . |
8,651 | public static function scrubRequestHttpHeaders ( $ httpHeaders , array $ headersToScrub ) { foreach ( $ headersToScrub as $ header ) { $ regex = sprintf ( self :: $ HTTP_REQUEST_HEADER_REGEX , $ header ) ; $ httpHeaders = preg_replace ( $ regex , '\1' . self :: $ REDACTED , $ httpHeaders , 1 ) ; } return $ httpHeaders ... | Scrubs the specified header values replacing all occurrences in the specified request HTTP headers with a redacted token . |
8,652 | public static function scrubRequestSoapHeaders ( $ soapXml , array $ headersToScrub ) { foreach ( $ headersToScrub as $ header ) { $ regex = sprintf ( self :: $ SOAP_REQUEST_HEADER_TAG_REGEX , $ header ) ; $ soapXml = preg_replace ( $ regex , '\1' . self :: $ REDACTED . '\2' , $ soapXml , 1 ) ; } return $ soapXml ; } | Scrubs the specified header values replacing their occurrences in the specified request SOAP XML with a redacted token . |
8,653 | public static function scrubRequestSoapBodyTags ( $ soapXml , array $ tagsToScrub ) { foreach ( $ tagsToScrub as $ tag ) { $ regex = sprintf ( self :: $ SOAP_REQUEST_BODY_TAG_REGEX , $ tag ) ; $ soapXml = preg_replace ( $ regex , '\1' . self :: $ REDACTED . '\2' , $ soapXml , 1 ) ; } return $ soapXml ; } | Scrubs the values of specified tags replacing their occurrences in the specified request SOAP XML with a redacted token . |
8,654 | public static function scrubHttpHeadersArray ( array $ httpHeaders , array $ headersToScrub ) { foreach ( $ headersToScrub as $ header ) { $ httpHeaders [ $ header ] = self :: $ REDACTED ; } return $ httpHeaders ; } | Scrubs an array of HTTP headers by replacing their values with a redacted token . |
8,655 | public function get ( \ Google \ AdsApi \ AdWords \ v201809 \ ch \ CustomerSyncSelector $ selector ) { return $ this -> __soapCall ( 'get' , array ( array ( 'selector' => $ selector ) ) ) -> getRval ( ) ; } | Returns information about changed entities inside a customer s account . |
8,656 | public function getPendingInvitations ( \ Google \ AdsApi \ AdWords \ v201809 \ mcm \ PendingInvitationSelector $ selector ) { return $ this -> __soapCall ( 'getPendingInvitations' , array ( array ( 'selector' => $ selector ) ) ) -> getRval ( ) ; } | Returns the pending invitations for the customer IDs in the selector . |
8,657 | private static function uploadImageAsset ( AssetService $ assetService , $ url ) { $ imageAsset = new ImageAsset ( ) ; $ imageAsset -> setImageData ( file_get_contents ( $ url ) ) ; $ operation = new AssetOperation ( ) ; $ operation -> setOperand ( $ imageAsset ) ; $ operation -> setOperator ( Operator :: ADD ) ; retur... | Upload an image asset using AssetService and provided URL . |
8,658 | private static function createBudget ( AdWordsServices $ adWordsServices , AdWordsSession $ session ) { $ budgetService = $ adWordsServices -> get ( $ session , BudgetService :: class ) ; $ budget = new Budget ( ) ; $ budget -> setName ( 'Interplanetary Cruise Budget #' . uniqid ( ) ) ; $ money = new Money ( ) ; $ mone... | Creates the budget for the campaign . |
8,659 | private static function setCampaignTargetingCriteria ( $ campaignId , AdWordsServices $ adWordsServices , AdWordsSession $ session ) { $ campaignCriterionService = $ adWordsServices -> get ( $ session , CampaignCriterionService :: class ) ; $ campaignCriteria = [ ] ; $ california = new Location ( ) ; $ california -> se... | Sets the campaign s targeting criteria . |
8,660 | public static function createFromCurrencies ( Currency $ baseCurrency , Currency $ counterCurrency ) { $ message = sprintf ( 'Cannot resolve a currency pair for currencies: %s/%s' , $ baseCurrency -> getCode ( ) , $ counterCurrency -> getCode ( ) ) ; return new self ( $ message ) ; } | Creates an exception from Currency objects . |
8,661 | public function equals ( CurrencyPair $ other ) { return $ this -> baseCurrency -> equals ( $ other -> baseCurrency ) && $ this -> counterCurrency -> equals ( $ other -> counterCurrency ) && $ this -> conversionRatio === $ other -> conversionRatio ; } | Checks if an other CurrencyPair has the same parameters as this . |
8,662 | public function equals ( Money $ other ) { return $ this -> isSameCurrency ( $ other ) && $ this -> amount === $ other -> amount ; } | Checks whether the value represented by this object equals to the other . |
8,663 | public function compare ( Money $ other ) { $ this -> assertSameCurrency ( $ other ) ; return $ this -> getCalculator ( ) -> compare ( $ this -> amount , $ other -> amount ) ; } | Returns an integer less than equal to or greater than zero if the value of this object is considered to be respectively less than equal to or greater than the other . |
8,664 | public function add ( Money ... $ addends ) { $ amount = $ this -> amount ; $ calculator = $ this -> getCalculator ( ) ; foreach ( $ addends as $ addend ) { $ this -> assertSameCurrency ( $ addend ) ; $ amount = $ calculator -> add ( $ amount , $ addend -> amount ) ; } return new self ( $ amount , $ this -> currency ) ... | Returns a new Money object that represents the sum of this and an other Money object . |
8,665 | public function subtract ( Money ... $ subtrahends ) { $ amount = $ this -> amount ; $ calculator = $ this -> getCalculator ( ) ; foreach ( $ subtrahends as $ subtrahend ) { $ this -> assertSameCurrency ( $ subtrahend ) ; $ amount = $ calculator -> subtract ( $ amount , $ subtrahend -> amount ) ; } return new self ( $ ... | Returns a new Money object that represents the difference of this and an other Money object . |
8,666 | private function assertOperand ( $ operand ) { if ( ! is_numeric ( $ operand ) ) { throw new \ InvalidArgumentException ( sprintf ( 'Operand should be a numeric value, "%s" given.' , is_object ( $ operand ) ? get_class ( $ operand ) : gettype ( $ operand ) ) ) ; } } | Asserts that the operand is integer or float . |
8,667 | private function assertRoundingMode ( $ roundingMode ) { if ( ! in_array ( $ roundingMode , [ self :: ROUND_HALF_DOWN , self :: ROUND_HALF_EVEN , self :: ROUND_HALF_ODD , self :: ROUND_HALF_UP , self :: ROUND_UP , self :: ROUND_DOWN , self :: ROUND_HALF_POSITIVE_INFINITY , self :: ROUND_HALF_NEGATIVE_INFINITY , ] , tru... | Asserts that rounding mode is a valid integer value . |
8,668 | public function multiply ( $ multiplier , $ roundingMode = self :: ROUND_HALF_UP ) { $ this -> assertOperand ( $ multiplier ) ; $ this -> assertRoundingMode ( $ roundingMode ) ; $ product = $ this -> round ( $ this -> getCalculator ( ) -> multiply ( $ this -> amount , $ multiplier ) , $ roundingMode ) ; return $ this -... | Returns a new Money object that represents the multiplied value by the given factor . |
8,669 | public function divide ( $ divisor , $ roundingMode = self :: ROUND_HALF_UP ) { $ this -> assertOperand ( $ divisor ) ; $ this -> assertRoundingMode ( $ roundingMode ) ; $ divisor = ( string ) Number :: fromNumber ( $ divisor ) ; if ( $ this -> getCalculator ( ) -> compare ( $ divisor , '0' ) === 0 ) { throw new \ Inva... | Returns a new Money object that represents the divided value by the given factor . |
8,670 | public function mod ( Money $ divisor ) { $ this -> assertSameCurrency ( $ divisor ) ; return new self ( $ this -> getCalculator ( ) -> mod ( $ this -> amount , $ divisor -> amount ) , $ this -> currency ) ; } | Returns a new Money object that represents the remainder after dividing the value by the given factor . |
8,671 | public function allocate ( array $ ratios ) { if ( count ( $ ratios ) === 0 ) { throw new \ InvalidArgumentException ( 'Cannot allocate to none, ratios cannot be an empty array' ) ; } $ remainder = $ this -> amount ; $ results = [ ] ; $ total = array_sum ( $ ratios ) ; if ( $ total <= 0 ) { throw new \ InvalidArgumentE... | Allocate the money according to a list of ratios . |
8,672 | public function allocateTo ( $ n ) { if ( ! is_int ( $ n ) ) { throw new \ InvalidArgumentException ( 'Number of targets must be an integer' ) ; } if ( $ n <= 0 ) { throw new \ InvalidArgumentException ( 'Cannot allocate to none, target must be greater than zero' ) ; } return $ this -> allocate ( array_fill ( 0 , $ n ,... | Allocate the money among N targets . |
8,673 | public function numericCodeFor ( Currency $ currency ) { if ( ! $ this -> contains ( $ currency ) ) { throw new UnknownCurrencyException ( 'Cannot find ISO currency ' . $ currency -> getCode ( ) ) ; } return $ this -> getCurrencies ( ) [ $ currency -> getCode ( ) ] [ 'numericCode' ] ; } | Returns the numeric code for a currency . |
8,674 | private function getCurrencies ( ) { if ( null === self :: $ currencies ) { self :: $ currencies = $ this -> loadCurrencies ( ) ; } return self :: $ currencies ; } | Returns a map of known currencies indexed by code . |
8,675 | public function overview ( ) { $ migrations = $ this -> getMigrations ( ) ; $ dbMigrations = $ this -> getExecutedMigrations ( ) ; return view ( 'vendor.installer.update.overview' , [ 'numberOfUpdatesPending' => count ( $ migrations ) - count ( $ dbMigrations ) ] ) ; } | Display the updater overview page . |
8,676 | public function database ( ) { $ databaseManager = new DatabaseManager ; $ response = $ databaseManager -> migrateAndSeed ( ) ; return redirect ( ) -> route ( 'LaravelUpdater::final' ) -> with ( [ 'message' => $ response ] ) ; } | Migrate and seed the database . |
8,677 | public function create ( ) { $ installedLogFile = storage_path ( 'installed' ) ; $ dateStamp = date ( "Y/m/d h:i:sa" ) ; if ( ! file_exists ( $ installedLogFile ) ) { $ message = trans ( 'installer_messages.installed.success_log_message' ) . $ dateStamp . "\n" ; file_put_contents ( $ installedLogFile , $ message ) ; } ... | Create installed file . |
8,678 | public function requirements ( ) { $ phpSupportInfo = $ this -> requirements -> checkPHPversion ( config ( 'installer.core.minPhpVersion' ) ) ; $ requirements = $ this -> requirements -> check ( config ( 'installer.requirements' ) ) ; return view ( 'vendor.installer.requirements' , compact ( 'requirements' , 'phpSuppor... | Display the requirements page . |
8,679 | public function runFinal ( ) { $ outputLog = new BufferedOutput ; $ this -> generateKey ( $ outputLog ) ; $ this -> publishVendorAssets ( $ outputLog ) ; return $ outputLog -> fetch ( ) ; } | Run final commands . |
8,680 | private static function publishVendorAssets ( BufferedOutput $ outputLog ) { try { if ( config ( 'installer.final.publish' ) ) { Artisan :: call ( 'vendor:publish' , [ '--all' => true ] , $ outputLog ) ; } } catch ( Exception $ e ) { return static :: response ( $ e -> getMessage ( ) , $ outputLog ) ; } return $ outputL... | Publish vendor assets . |
8,681 | public function alreadyUpdated ( ) { $ migrations = $ this -> getMigrations ( ) ; $ dbMigrations = $ this -> getExecutedMigrations ( ) ; if ( count ( $ migrations ) == count ( $ dbMigrations ) ) { return true ; } return false ; } | If application is already updated . |
8,682 | public function check ( array $ folders ) { foreach ( $ folders as $ folder => $ permission ) { if ( ! ( $ this -> getPermission ( $ folder ) >= $ permission ) ) { $ this -> addFileAndSetErrors ( $ folder , $ permission , false ) ; } else { $ this -> addFile ( $ folder , $ permission , true ) ; } } return $ this -> res... | Check for the folders permissions . |
8,683 | private function addFile ( $ folder , $ permission , $ isSet ) { array_push ( $ this -> results [ 'permissions' ] , [ 'folder' => $ folder , 'permission' => $ permission , 'isSet' => $ isSet ] ) ; } | Add the file to the list of results . |
8,684 | private function addFileAndSetErrors ( $ folder , $ permission , $ isSet ) { $ this -> addFile ( $ folder , $ permission , $ isSet ) ; $ this -> results [ 'errors' ] = true ; } | Add the file and set the errors . |
8,685 | public function check ( array $ requirements ) { $ results = [ ] ; foreach ( $ requirements as $ type => $ requirement ) { switch ( $ type ) { case 'php' : foreach ( $ requirements [ $ type ] as $ requirement ) { $ results [ 'requirements' ] [ $ type ] [ $ requirement ] = true ; if ( ! extension_loaded ( $ requirement ... | Check for the server requirements . |
8,686 | public function checkPHPversion ( string $ minPhpVersion = null ) { $ minVersionPhp = $ minPhpVersion ; $ currentPhpVersion = $ this -> getPhpVersionInfo ( ) ; $ supported = false ; if ( $ minPhpVersion == null ) { $ minVersionPhp = $ this -> getMinPhpVersion ( ) ; } if ( version_compare ( $ currentPhpVersion [ 'versio... | Check PHP version requirement . |
8,687 | private static function getPhpVersionInfo ( ) { $ currentVersionFull = PHP_VERSION ; preg_match ( "#^\d+(\.\d+)*#" , $ currentVersionFull , $ filtered ) ; $ currentVersion = $ filtered [ 0 ] ; return [ 'full' => $ currentVersionFull , 'version' => $ currentVersion ] ; } | Get current Php version information |
8,688 | protected function publishFiles ( ) { $ this -> publishes ( [ __DIR__ . '/../Config/installer.php' => base_path ( 'config/installer.php' ) , ] , 'laravelinstaller' ) ; $ this -> publishes ( [ __DIR__ . '/../assets' => public_path ( 'installer' ) , ] , 'laravelinstaller' ) ; $ this -> publishes ( [ __DIR__ . '/../Views'... | Publish config file for the installer . |
8,689 | public function getEnvContent ( ) { if ( ! file_exists ( $ this -> envPath ) ) { if ( file_exists ( $ this -> envExamplePath ) ) { copy ( $ this -> envExamplePath , $ this -> envPath ) ; } else { touch ( $ this -> envPath ) ; } } return file_get_contents ( $ this -> envPath ) ; } | Get the content of the . env file . |
8,690 | public function saveFileClassic ( Request $ input ) { $ message = trans ( 'installer_messages.environment.success' ) ; try { file_put_contents ( $ this -> envPath , $ input -> get ( 'envConfig' ) ) ; } catch ( Exception $ e ) { $ message = trans ( 'installer_messages.environment.errors' ) ; } return $ message ; } | Save the edited content to the . env file . |
8,691 | public function insert ( self $ branch ) { if ( ! \ in_array ( $ branch , $ this -> branches ) ) { $ this -> branches [ ] = $ branch ; } } | Inserts a node in the branch graph . |
8,692 | public function show ( $ padding = 0 ) { echo str_repeat ( ' ' , $ padding ) , $ this -> branch -> getUniqueId ( ) , ':' , $ this -> increase ; if ( \ count ( $ this -> branches ) ) { echo ':' , PHP_EOL ; foreach ( $ this -> branches as $ node ) { $ node -> show ( $ padding + 1 ) ; } } else { echo PHP_EOL ; } } | Generates an ASCII visualization of the branch . |
8,693 | public function setExpectReturn ( $ expecting , Variable $ expectingVariable = null ) { $ this -> expecting = $ expecting ; $ this -> expectingVariable = $ expectingVariable ; } | Sets if the variable must be resolved into a direct variable symbol create a temporary value or ignore the return value . |
8,694 | public function compile ( $ expression , CompilationContext $ compilationContext ) { if ( $ this -> expecting ) { if ( $ this -> expectingVariable ) { $ symbolVariable = $ this -> expectingVariable ; if ( 'variable' != $ symbolVariable -> getType ( ) ) { throw new CompilerException ( 'Cannot use variable type: ' . $ sy... | Compiles a reference to a value . |
8,695 | public function addLeaf ( Branch $ branch ) { if ( isset ( $ this -> branchMap [ $ branch -> getUniqueId ( ) ] ) ) { $ branchNode = $ this -> branchMap [ $ branch -> getUniqueId ( ) ] ; } else { $ branchNode = new BranchGraphNode ( $ branch ) ; } $ branchNode -> increase ( ) ; $ tempBranch = $ branch -> getParentBranch... | Adds a leaf to the branch tree . |
8,696 | public function hasVariable ( $ name , CompilationContext $ compilationContext = null ) { return false !== $ this -> getVariable ( $ name , $ compilationContext ? : $ this -> compilationContext ) ; } | Check if a variable is declared in the current symbol table . |
8,697 | public function addVariable ( $ type , $ name , CompilationContext $ compilationContext ) { $ currentBranch = $ compilationContext -> branchManager -> getCurrentBranch ( ) ; $ branchId = $ currentBranch -> getUniqueId ( ) ; if ( $ this -> globalsManager -> isSuperGlobal ( $ name ) || 'zephir_fcall_cache_entry' == $ typ... | Adds a variable to the symbol table . |
8,698 | public function getVariable ( $ name , $ compilationContext = null ) { $ pos = strpos ( $ name , Variable :: BRANCH_MAGIC ) ; if ( $ pos > - 1 ) { $ branchId = ( int ) ( substr ( $ name , $ pos + \ strlen ( Variable :: BRANCH_MAGIC ) ) ) ; $ name = substr ( $ name , 0 , $ pos ) ; } else { $ branch = $ this -> resolveVa... | Returns a variable in the symbol table . |
8,699 | public function getVariables ( ) { $ ret = [ ] ; foreach ( $ this -> branchVariables as $ branchId => $ vars ) { foreach ( $ vars as $ var ) { $ ret [ $ var -> getName ( ) ] = $ var ; } } return $ ret ; } | Returns all the variables defined in the symbol table . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.