idx
int64
0
241k
question
stringlengths
64
6.21k
target
stringlengths
5
803
8,500
public function saveToFile ( $ filePath ) { $ this -> adsUtilityRegistry -> addUtility ( AdsUtility :: REPORT_DOWNLOADER_FILE ) ; $ this -> reportDownloadResultDelegate -> saveToFile ( $ filePath ) ; }
Writes the contents of the report download response to the specified file .
8,501
public function fromFile ( $ path = null ) { if ( $ path === null ) { $ path = self :: DEFAULT_CONFIGURATION_FILENAME ; } return $ this -> from ( $ this -> configurationLoader -> fromFile ( $ path ) ) ; }
Reads configuration settings from the specified filepath . The filepath is optional and if omitted it will look for the default configuration filename in the home directory of the user running PHP .
8,502
public function waitForReportToFinish ( ) { $ reportJobStatus = $ this -> reportService -> getReportJobStatus ( $ this -> reportJobId ) ; while ( $ reportJobStatus === ReportJobStatus :: IN_PROGRESS ) { $ this -> logger -> info ( sprintf ( 'Report job ID %d has status %s. Sleeping for %d seconds ' . 'before polling aga...
Blocks and waits for the report to finish running by polling for the report s status and sleeping in between polls .
8,503
public function downloadReport ( $ exportFormat , $ filePath = null ) { $ downloadUrl = $ this -> getDownloadUrl ( $ exportFormat ) ; $ requestOptions = [ ] ; $ requestOptions [ RequestOptions :: HEADERS ] = [ 'User-Agent' => $ this -> getFormattedUserAgent ( ) ] ; $ proxy = $ this -> reportService -> getAdsSession ( )...
Downloads the report with the specified export format .
8,504
private function getDownloadUrl ( $ exportFormat ) { $ reportJobStatus = $ this -> reportService -> getReportJobStatus ( $ this -> reportJobId ) ; if ( $ reportJobStatus === ReportJobStatus :: IN_PROGRESS ) { throw new UnexpectedValueException ( sprintf ( 'Report %d must be completed before downloading. ' . 'Report is ...
Gets the download URL for the report .
8,505
public static function pass ( ) { if ( is_null ( self :: $ passedResult ) ) { self :: $ passedResult = new self ( true ) ; } return self :: $ passedResult ; }
Creates a validation pass result .
8,506
public static function getSoapHeaderValue ( $ xml , $ soapHeaderName ) { $ headerValue = '' ; if ( $ xml === null || $ xml === '' ) { return $ headerValue ; } $ xmlReader = new XMLReader ( ) ; $ xmlReader -> xml ( $ xml ) ; while ( $ xmlReader -> read ( ) ) { if ( $ xmlReader -> nodeType === XMLReader :: ELEMENT && $ x...
Gets the value of the specified SOAP header from the specified SOAP request or response payload as an XML string .
8,507
public function formatDetailed ( RequestInterface $ request , ResponseInterface & $ response = null , Exception & $ error = null ) { $ needRewind = $ this -> shouldLogResponsePayload && ! is_null ( $ response ) && ! is_null ( $ response -> getBody ( ) ) ; if ( $ needRewind && ! $ response -> getBody ( ) -> isSeekable (...
Formats a detailed message based on the specified HTTP request and response and errors if present . This function also replaces the original response with a new one with a seekable stream if the original one contains forward - only stream .
8,508
private function scrubAndFormatDetailedMessage ( RequestInterface $ request , ResponseInterface $ response = null , Exception $ error = null ) { $ requestHeaders = LogMessageScrubbers :: scrubHttpHeadersArray ( $ request -> getHeaders ( ) , $ this -> requestHttpHeadersToScrub ) ; $ changes = [ 'set_headers' => $ reques...
Scrubs and formats a detailed message containing HTTP request and response and errors if exist .
8,509
public function mutate ( \ Google \ AdsApi \ AdWords \ v201809 \ mcm \ Customer $ customer ) { return $ this -> __soapCall ( 'mutate' , array ( array ( 'customer' => $ customer ) ) ) -> getRval ( ) ; }
Update the authorized customer .
8,510
public function generateHttpClient ( ) { $ config = $ this -> config ; if ( ! array_key_exists ( 'handler' , $ config ) || $ config [ 'handler' ] === null ) { $ config [ 'handler' ] = HandlerStack :: create ( ) ; } $ config [ 'handler' ] -> before ( 'http_errors' , GuzzleLogMessageHandler :: log ( $ this -> logger , $ ...
Generates a Guzzle HTTP client for making HTTP calls by using configs of the user - provided client . This method adds the logging middleware required by this library to the handler stack of the generated client .
8,511
private static function createFeed ( AdWordsServices $ adWordsServices , AdWordsSession $ session ) { $ feedService = $ adWordsServices -> get ( $ session , FeedService :: class ) ; $ urlAttribute = new FeedAttribute ( ) ; $ urlAttribute -> setType ( FeedAttributeType :: URL_LIST ) ; $ urlAttribute -> setName ( 'Page U...
Creates the feed for DSA page URLs .
8,512
private static function createFeedMapping ( AdWordsServices $ adWordsServices , AdWordsSession $ session , DSAFeedDetails $ feedDetails ) { $ feedMappingService = $ adWordsServices -> get ( $ session , FeedMappingService :: class ) ; $ urlFieldMapping = new AttributeFieldMapping ( ) ; $ urlFieldMapping -> setFeedAttrib...
Creates the feed mapping for the DSA page feeds .
8,513
private static function createFeedItems ( AdWordsServices $ adWordsServices , AdWordsSession $ session , DSAFeedDetails $ feedDetails , $ labelName ) { $ feedItemService = $ adWordsServices -> get ( $ session , FeedItemService :: class ) ; $ rentalCars = self :: createDsaUrlAddOperation ( $ feedDetails , 'http://www.ex...
Creates the page URLs in the DSA page feed .
8,514
private static function createDsaUrlAddOperation ( DSAFeedDetails $ feedDetails , $ url , $ labelName ) { $ urlAttributeValue = new FeedItemAttributeValue ( ) ; $ urlAttributeValue -> setFeedAttributeId ( $ feedDetails -> urlAttributeId ) ; $ urlAttributeValue -> setStringValues ( [ $ url ] ) ; $ labelAttributeValue = ...
Creates a feed item operation to add the DSA URL .
8,515
private static function updateCampaignDsaSetting ( AdWordsServices $ adWordsServices , AdWordsSession $ session , $ campaignId , DSAFeedDetails $ feedDetails ) { $ campaignService = $ adWordsServices -> get ( $ session , CampaignService :: class ) ; $ selector = new Selector ( ) ; $ selector -> setFields ( [ 'Id' , 'Se...
Updates the campaign DSA setting to add DSA pagefeeds .
8,516
private static function addDsaTargeting ( AdWordsServices $ adWordsServices , AdWordsSession $ session , $ adGroupId , $ dsaPageUrlLabel ) { $ adGroupCriterionService = $ adWordsServices -> get ( $ session , AdGroupCriterionService :: class ) ; $ webpage = new Webpage ( ) ; $ parameter = new WebpageParameter ( ) ; $ pa...
Sets custom targeting for the page feed URLs based on a list of labels .
8,517
private static function getAllManagedCustomerIds ( AdWordsServices $ adWordsServices , AdWordsSession $ session ) { $ managedCustomerService = $ adWordsServices -> get ( $ session , ManagedCustomerService :: class ) ; $ selector = new Selector ( ) ; $ selector -> setFields ( [ 'CustomerId' ] ) ; $ selector -> setPaging...
Retrieves all the customer IDs under a manager account .
8,518
public function formatDetailed ( $ requestHeaders , $ request , $ responseHeaders , $ response ) { $ requestHeaders = LogMessageScrubbers :: scrubRequestHttpHeaders ( trim ( $ requestHeaders ) , $ this -> requestHttpHeadersToScrub ) ; $ request = LogMessageScrubbers :: scrubRequestSoapHeaders ( $ request , $ this -> re...
Formats this log message as a detailed message containing full SOAP XML request and response payloads along with their HTTP headers .
8,519
private function formatSoapFaultForSummary ( $ soapFault ) { $ soapFault = str_replace ( [ "\r\n" , "\n" , "\r" ] , '' , $ soapFault ) ; if ( mb_strlen ( $ soapFault , 'UTF-8' ) > $ this -> faultMsgMaxLength ) { $ soapFault = mb_substr ( $ soapFault , 0 , $ this -> faultMsgMaxLength , 'UTF-8' ) . '...' ; } ; return $ s...
Removes line breaks and truncates the SOAP fault if necessary .
8,520
public function createInstance ( $ className , $ args = null ) { $ reflectionClass = new ReflectionClass ( $ className ) ; $ args = func_get_args ( ) ; array_shift ( $ args ) ; return $ reflectionClass -> newInstanceArgs ( $ args ) ; }
Creates a new instance of the specified class name .
8,521
private static function createAdGroup ( AdWordsServices $ adWordsServices , AdWordsSession $ session , Campaign $ campaign ) { $ adGroupService = $ adWordsServices -> get ( $ session , AdGroupService :: class ) ; $ adGroup = new AdGroup ( ) ; $ adGroup -> setCampaignId ( $ campaign -> getId ( ) ) ; $ adGroup -> setName...
Creates an ad group in the specified campaign .
8,522
private static function attachUserList ( AdWordsServices $ adWordsServices , AdWordsSession $ session , AdGroup $ adGroup , $ userListId ) { $ adGroupCriterionService = $ adWordsServices -> get ( $ session , AdGroupCriterionService :: class ) ; $ userList = new CriterionUserList ( ) ; $ userList -> setUserListId ( $ us...
Attaches a user list to an ad group . The user list provides positive targeting and feed information to drive the dynamic content of the ad .
8,523
private static function createAd ( AdWordsServices $ adWordsServices , AdWordsSession $ session , AdGroup $ adGroup ) { $ adGroupAdService = $ adWordsServices -> get ( $ session , AdGroupAdService :: class ) ; $ responsiveDisplayAd = new ResponsiveDisplayAd ( ) ; $ marketingImage = self :: uploadImage ( $ adWordsServic...
Creates an ad for serving dynamic content in a remarketing campaign .
8,524
private static function createDynamicDisplayAdSettings ( AdWordsServices $ adWordsServices , AdWordsSession $ session ) { $ landscapeLogoImage = self :: uploadImage ( $ adWordsServices , $ session , 'https://goo.gl/dEvQeF' ) ; $ dynamicSettings = new DynamicSettings ( ) ; $ dynamicSettings -> setLandscapeLogoImage ( $ ...
Creates dynamic display ad settings .
8,525
public static function log ( LoggerInterface $ logger , GuzzleLogMessageFormatter $ messageFormatter ) { return function ( callable $ handler ) use ( $ logger , $ messageFormatter ) { return function ( $ request , array $ options ) use ( $ handler , $ logger , $ messageFormatter ) { return $ handler ( $ request , $ opt...
Logs requests and responses for Guzzle HTTP calls to non - SOAP ads API endpoints to the specified logger .
8,526
private static function createPriceTableRow ( $ header , $ description , $ finalUrl , $ priceInMicros , $ currencyCode , $ priceUnit , $ finalMobileUrl = null ) { $ priceTableRow = new PriceTableRow ( ) ; $ priceTableRow -> setHeader ( $ header ) ; $ priceTableRow -> setDescription ( $ description ) ; $ priceTableRow -...
Creates a new price table row with the specified attributes .
8,527
public function updateNetwork ( \ Google \ AdsApi \ AdManager \ v201808 \ Network $ network ) { return $ this -> __soapCall ( 'updateNetwork' , array ( array ( 'network' => $ network ) ) ) -> getRval ( ) ; }
Updates the specified network . Currently only the network display name can be updated .
8,528
public static function copyFrom ( ExpressionBuilder $ otherInstance ) { $ copyingInstance = new self ( $ otherInstance -> fieldName ) ; $ copyingInstance -> simpleOperator = $ otherInstance -> simpleOperator ; $ copyingInstance -> simpleValue = $ otherInstance -> simpleValue ; $ copyingInstance -> listOperator = $ othe...
Creates a new expression builder object by copying the operands and operators from another expression builder object .
8,529
private function setSimpleOperator ( $ operator , $ value ) { if ( empty ( $ operator ) ) { throw new InvalidArgumentException ( 'The operator must not be null' . ' or empty.' ) ; } if ( is_null ( $ value ) || $ value === '' ) { throw new InvalidArgumentException ( 'The value string must not be' . ' null or empty' ) ; ...
Sets an operator and a single value that follows the operator .
8,530
private static function formatValue ( $ value ) { if ( is_numeric ( $ value ) && ! is_string ( $ value ) ) { return $ value ; } return sprintf ( '\'%s\'' , addslashes ( $ value ) ) ; }
If the input value is not numeric escape all quotes then wrap the string in a pair of quotes .
8,531
private static function formatValues ( $ listValues ) { $ formattedValues = [ ] ; foreach ( $ listValues as $ value ) { $ formattedValues [ ] = self :: formatValue ( $ value ) ; } return $ formattedValues ; }
Formats each individual value in an array .
8,532
private function setListOperator ( $ listOperator , array $ values ) { if ( empty ( $ listOperator ) ) { throw new InvalidArgumentException ( 'The list operator must not' . ' be null or empty.' ) ; } if ( empty ( $ values ) ) { throw new InvalidArgumentException ( 'The list of values must not' . ' be null or empty.' ) ...
Sets the list operator and values ; Also adds quotes to string values .
8,533
public function buildExpression ( ) { if ( isset ( $ this -> simpleOperator ) ) { return sprintf ( '%s %s %s' , $ this -> fieldName , $ this -> simpleOperator , self :: formatValue ( $ this -> simpleValue ) ) ; } if ( isset ( $ this -> listOperator ) ) { return sprintf ( '%s %s [%s]' , $ this -> fieldName , $ this -> l...
Builds a logic expression in the WHERE clause of an AWQL string .
8,534
private static function createUserListRule ( ) { $ checkoutStringRuleItem = new StringRuleItem ( ) ; $ checkoutStringKey = new StringKey ( ) ; $ checkoutStringKey -> setName ( 'ecomm_pagetype' ) ; $ checkoutStringRuleItem -> setKey ( $ checkoutStringKey ) ; $ checkoutStringRuleItem -> setOp ( StringRuleItemStringOperat...
Create a user list rule composed of two rule item groups .
8,535
private static function createCombinedUserListRules ( ) { $ site1StringRuleItem = new StringRuleItem ( ) ; $ site1StringKey = new StringKey ( ) ; $ site1StringKey -> setName ( 'url__' ) ; $ site1StringRuleItem -> setKey ( $ site1StringKey ) ; $ site1StringRuleItem -> setOp ( StringRuleItemStringOperator :: EQUALS ) ; $...
Create rules to be used as left and right operands of a combined user list .
8,536
public static function asBiddableAdGroupCriterion ( $ adGroupId , ProductPartition $ productPartition , $ bidAmount = null ) { $ criterion = new BiddableAdGroupCriterion ( ) ; if ( $ bidAmount !== null && $ bidAmount > 0 ) { $ biddingStrategyConfiguration = new BiddingStrategyConfiguration ( ) ; $ cpcBid = new CpcBid (...
Returns the biddable ad group criterion with by specifying the product partition and bid amount .
8,537
public static function asNegativeAdGroupCriterion ( $ adGroupId , ProductPartition $ productPartition ) { $ criterion = new NegativeAdGroupCriterion ( ) ; $ criterion -> setAdGroupId ( $ adGroupId ) ; $ criterion -> setCriterion ( $ productPartition ) ; return $ criterion ; }
Returns the negative ad group criterion with by specifying the product partition .
8,538
private static function createAdGroupCriterionOperation ( AdGroupCriterion $ criterion , $ operator ) { $ operation = new AdGroupCriterionOperation ( ) ; $ operation -> setOperand ( $ criterion ) ; $ operation -> setOperator ( $ operator ) ; return $ operation ; }
Creates an ad group criterion operation for the given ad group criterion .
8,539
public static function showAdGroupTree ( AdWordsServices $ adWordsServices , AdWordsSession $ session , $ adGroupId ) { $ adGroupCriterionService = $ adWordsServices -> get ( $ session , AdGroupCriterionService :: class ) ; $ children = [ ] ; $ rootNode = null ; $ totalNumEntries = 0 ; $ offset = 0 ; do { $ query = spr...
Returns the string representation of ad group criteria of the specified ad group ID by showing them hierarchically .
8,540
private static function traverseTree ( Criterion $ node , array $ children , $ level ) { $ type = 'n/a' ; $ value = 'n/a' ; if ( $ node -> getCaseValue ( ) !== null ) { $ type = ( new ReflectionClass ( $ node -> getCaseValue ( ) ) ) -> getShortName ( ) ; if ( $ node -> getCaseValue ( ) instanceof ProductCanonicalCondit...
Recursively traverses this tree and returns its string representation .
8,541
public function getOrFetchAccessToken ( FetchAuthTokenInterface $ fetchAuthTokenInterface , callable $ httpHandler = null ) { if ( $ this -> shouldFetchAccessToken ( $ fetchAuthTokenInterface ) ) { return $ fetchAuthTokenInterface -> fetchAuthToken ( $ httpHandler ) [ 'access_token' ] ; } return $ fetchAuthTokenInterfa...
Gets the existing access token or fetches a new one if an existing one is about to expire within the refresh window or fetches a new one if there is no existing access token .
8,542
private static function getPredefinedCustomTargetingKeyIds ( ServiceFactory $ serviceFactory , AdManagerSession $ session ) { $ customTargetingKeyIds = [ ] ; $ customTargetingService = $ serviceFactory -> createCustomTargetingService ( $ session ) ; $ pageSize = StatementBuilder :: SUGGESTED_PAGE_LIMIT ; $ statementBui...
Gets predefined custom targeting key IDs .
8,543
private static function createAdGroup ( AdWordsServices $ adWordsServices , AdWordsSession $ session , Campaign $ campaign ) { $ adGroupService = $ adWordsServices -> get ( $ session , AdGroupService :: class ) ; $ adGroup = new AdGroup ( ) ; $ adGroup -> setCampaignId ( $ campaign -> getId ( ) ) ; $ adGroup -> setName...
Creates an ad group in the Shopping campaign .
8,544
private static function createShowcaseAd ( AdWordsServices $ adWordsServices , AdWordsSession $ session , AdGroup $ adGroup ) { $ adGroupAdService = $ adWordsServices -> get ( $ session , AdGroupAdService :: class ) ; $ showcaseAd = new ShowcaseAd ( ) ; $ showcaseAd -> setName ( 'Showcase ad #' . uniqid ( ) ) ; $ showc...
Creates a Showcase ad .
8,545
private static function createProductPartitions ( AdWordsServices $ adWordsServices , AdWordsSession $ session , $ adGroupId ) { $ operations = [ ] ; $ root = ProductPartitions :: createSubdivision ( ) ; $ criterion = ProductPartitions :: asBiddableAdGroupCriterion ( $ adGroupId , $ root ) ; $ operation = ProductPartit...
Creates the product partition tree for the ad group .
8,546
private static function uploadImage ( AdWordsServices $ adWordsServices , AdWordsSession $ session , $ url ) { $ mediaService = $ adWordsServices -> get ( $ session , MediaService :: class ) ; $ image = new Image ( ) ; $ image -> setData ( file_get_contents ( $ url ) ) ; $ image -> setType ( MediaMediaType :: IMAGE ) ;...
Uploads an image .
8,547
public function formatApplicationNameForSoapHeader ( $ applicationName , $ productNameForSoapHeader , $ includeUtilityUsage ) { $ adsUtilities = $ this -> adsUtilityRegistry -> popAllUtilities ( ) ; return sprintf ( '%s (%sApi-PHP, %s/%s, PHP/%s%s)' , $ applicationName , $ productNameForSoapHeader , $ this -> libraryMe...
Formats an application name in a format standard to the ads libraries to include in the SOAP header .
8,548
public function formatApplicationNameForGuzzleHeader ( $ applicationName , $ productName , $ includeUtilityUsage , $ isReportingGzipEnabled = null ) { $ adsUtilities = $ this -> adsUtilityRegistry -> popAllUtilities ( ) ; return sprintf ( '%s (%sApi-PHP, %s/%s, PHP/%s, %s%s%s)' , $ applicationName , $ productName , $ t...
Formats an application name in a format standard to the ads libraries to include in the Guzzle HTTP header .
8,549
private function initiateResumableUpload ( $ uploadUrl ) { $ requestOptions = [ ] ; $ requestOptions [ RequestOptions :: HEADERS ] = [ 'Content-Type' => 'application/xml' , 'Content-Length' => 0 , 'x-goog-resumable' => 'start' ] ; if ( ! empty ( $ this -> connectionSettings -> getProxyUrl ( ) ) ) { $ requestOptions [ R...
Initiates the resumable upload by sending a request to Google Cloud Storage .
8,550
public function generateSoapClient ( AdsSession $ session , AdsHeaderHandler $ headerHandler , AdsServiceDescriptor $ serviceDescriptor ) { $ options = [ 'trace' => true , 'encoding' => 'utf-8' , 'connection_timeout' => $ this -> soapCallTimeout , 'features' => SOAP_SINGLE_ELEMENT_ARRAYS ] ; $ soapSettings = $ session ...
Generates a SOAP client that interfaces with the specified service using configuration data from the specified ads session .
8,551
private function getLocalWsdlPath ( $ wsdl ) { $ resourcesWsdlsPath = sprintf ( self :: $ RESOURCES_WSDLS_PATH_FORMAT , __DIR__ , DIRECTORY_SEPARATOR ) ; $ wsdlFilePath = str_replace ( '/' , DIRECTORY_SEPARATOR , parse_url ( $ wsdl , PHP_URL_PATH ) ) ; return $ resourcesWsdlsPath . $ wsdlFilePath . self :: $ WSDL_FILE_...
Gets the path to stored WSDLs from the provided live WSDL URI .
8,552
public static function writeCsvToStream ( array $ csvData , $ handle ) { if ( is_null ( $ handle ) ) { throw new InvalidArgumentException ( 'File handle is null.' ) ; } foreach ( $ csvData as $ line ) { fputcsv ( $ handle , $ line ) ; } }
Writes the CSV data to a stream handle .
8,553
private static function printMeanEstimate ( StatsEstimate $ minEstimate , StatsEstimate $ maxEstimate ) { $ meanAverageCpc = self :: calculateMeanMicroAmount ( $ minEstimate -> getAverageCpc ( ) , $ maxEstimate -> getAverageCpc ( ) ) ; $ meanAveragePosition = self :: calculateMean ( $ minEstimate -> getAveragePosition ...
Prints estimated average CPC ad position daily clicks and daily costs between the provided lower bound and upper bound of estimated stats .
8,554
private static function calculateMean ( $ min , $ max ) { if ( $ min === null || $ max === null ) { return null ; } return ( $ min + $ max ) / 2 ; }
Returns the mean of the two numbers if neither is null else returns null .
8,555
private static function calculateMeanMicroAmount ( $ min , $ max ) { if ( $ min === null || $ max === null ) { return null ; } if ( $ min -> getMicroAmount ( ) === null || $ max -> getMicroAmount ( ) === null ) { return null ; } return ( $ min -> getMicroAmount ( ) + $ max -> getMicroAmount ( ) ) / 2 ; }
Returns the mean of the two object s microAmounts if neither is null else returns null .
8,556
public function uploadBatchJobOperations ( array $ operations , $ uploadUrl ) { $ this -> adsUtilityRegistry -> addUtility ( AdsUtility :: BATCH_JOBS ) ; return $ this -> batchJobsDelegate -> uploadBatchJobOperations ( $ operations , $ uploadUrl ) ; }
Uploads all batch job operations to the specified upload URL .
8,557
public function uploadIncrementalBatchJobOperations ( array $ operations , BatchJobUploadStatus $ batchJobUploadStatus ) { $ this -> adsUtilityRegistry -> addUtility ( AdsUtility :: BATCH_JOBS ) ; return $ this -> batchJobsDelegate -> uploadIncrementalBatchJobOperations ( $ operations , $ batchJobUploadStatus ) ; }
Uploads batch job operations incrementally to the specified upload URL .
8,558
public function downloadBatchJobResults ( $ downloadUrl ) { $ this -> adsUtilityRegistry -> addUtility ( AdsUtility :: BATCH_JOBS ) ; return $ this -> batchJobsDelegate -> downloadBatchJobResults ( $ downloadUrl ) ; }
Downloads the results of batch processing from the download URL .
8,559
public static function createValue ( $ value ) { if ( $ value instanceof Value ) { return $ value ; } elseif ( is_bool ( $ value ) ) { return new BooleanValue ( $ value ) ; } elseif ( is_float ( $ value ) || is_int ( $ value ) ) { return new NumberValue ( strval ( $ value ) ) ; } elseif ( is_string ( $ value ) ) { retu...
Creates a PQL Value from the specified value .
8,560
public static function toString ( Value $ value ) { if ( $ value instanceof BooleanValue ) { return $ value -> getValue ( ) ? 'true' : 'false' ; } elseif ( $ value instanceof NumberValue || $ value instanceof TextValue ) { return strval ( $ value -> getValue ( ) ) ; } elseif ( $ value instanceof DateTimeValue ) { retur...
Creates a string from the Value .
8,561
public static function getColumnLabels ( ResultSet $ resultSet ) { $ columnLabels = [ ] ; foreach ( $ resultSet -> getColumnTypes ( ) as $ columnType ) { $ columnLabels [ ] = $ columnType -> getLabelName ( ) ; } return $ columnLabels ; }
Gets the column labels for the result set .
8,562
public static function combineResultSets ( ResultSet $ first , ResultSet $ second ) { $ firstColumns = self :: getColumnLabels ( $ first ) ; $ secondColumns = self :: getColumnLabels ( $ second ) ; if ( $ firstColumns !== $ secondColumns ) { throw new InvalidArgumentException ( sprintf ( 'First result set columns [%s] ...
Combines the first and second result sets if and only if the columns of both result sets match .
8,563
public static function copyFrom ( ServiceQueryBuilderDelegate $ otherInstance , ServiceQueryBuilder $ queryBuilder ) { $ copyingInstance = new self ( ) ; $ copyingInstance -> startIndex = $ otherInstance -> startIndex ; $ copyingInstance -> pageSize = $ otherInstance -> pageSize ; $ copyingInstance -> orderByFields = $...
Creates a new query builder delegate object by copying field names WHERE conditions and pagination data from another query builder delegate object .
8,564
public function select ( array $ fields ) { if ( empty ( $ fields ) ) { throw new InvalidArgumentException ( 'The field array must not be' . ' empty.' ) ; } foreach ( $ fields as $ field ) { $ validationResult = QueryValidator :: validateFieldName ( $ field ) ; if ( $ validationResult -> isFailed ( ) ) { throw new Inva...
Sets the fields for the SELECT clause . Repeated field names will be included exactly once .
8,565
private function appendOrderByClause ( $ awqlString ) { if ( empty ( $ this -> orderByFields ) ) { return $ awqlString ; } return sprintf ( '%s ORDER BY %s' , $ awqlString , implode ( ', ' , $ this -> orderByFields ) ) ; }
Appends the ORDER BY clause to a partial AWQL string .
8,566
public function downloadReport ( ReportDefinition $ reportDefinition , ReportSettings $ reportSettingsOverride = null ) { return $ this -> makeReportRequest ( $ this -> requestOptionsFactory -> createRequestOptionsWithReportDefinition ( $ reportDefinition , $ reportSettingsOverride ) ) ; }
Downloads a report using report definition .
8,567
public function downloadReportWithAwql ( $ reportQuery , $ reportFormat , ReportSettings $ reportSettingsOverride = null ) { if ( ! is_string ( $ reportQuery ) ) { throw new InvalidArgumentException ( 'The report query must be a' . ' string.' ) ; } return $ this -> makeReportRequest ( $ this -> requestOptionsFactory ->...
Downloads a report using AWQL .
8,568
public function downloadReportWithReportQuery ( ReportQuery $ reportQuery , $ reportFormat , ReportSettings $ reportSettingsOverride = null ) { $ awqlString = sprintf ( '%s' , $ reportQuery ) ; return $ this -> downloadReportWithAwql ( $ awqlString , $ reportFormat , $ reportSettingsOverride ) ; }
Downloads a report using a report query object .
8,569
private function makeReportRequest ( array $ requestOptions ) { $ requestOptions [ RequestOptions :: STREAM ] = true ; $ proxy = $ this -> session -> getConnectionSettings ( ) -> getProxyUrl ( ) ; if ( ! empty ( $ proxy ) ) { $ requestOptions [ RequestOptions :: PROXY ] = [ 'https' => $ proxy ] ; } if ( $ this -> sessi...
Make an HTTP request to download a report with the specified request options .
8,570
private static function getFeeds ( AdWordsServices $ adWordsServices , AdWordsSession $ session ) { $ feedService = $ adWordsServices -> get ( $ session , FeedService :: class ) ; $ totalNumEntries = 0 ; $ offset = 0 ; $ query = 'SELECT Id, Name, Attributes WHERE Origin="USER" AND ' . 'FeedStatus="ENABLED"' ; $ feeds =...
Gets all enabled feeds .
8,571
private static function getFeedItems ( AdWordsServices $ adWordsServices , AdWordsSession $ session , $ feedId ) { $ feedItemService = $ adWordsServices -> get ( $ session , FeedItemService :: class ) ; $ totalNumEntries = 0 ; $ offset = 0 ; $ query = sprintf ( 'SELECT FeedItemId, AttributeValues WHERE Status = ' . '"E...
Gets all enabled feed items of the specified feed .
8,572
private static function getCampaignFeeds ( AdWordsServices $ adWordsServices , AdWordsSession $ session , $ feedId , $ placeholderId ) { $ campaignFeedService = $ adWordsServices -> get ( $ session , CampaignFeedService :: class ) ; $ page = $ campaignFeedService -> query ( sprintf ( 'SELECT CampaignId, MatchingFunctio...
Gets all enabled campaign feeds for the specified feed and placeholder type .
8,573
private static function getAttributeFieldMappings ( AdWordsServices $ adWordsServices , AdWordsSession $ session , $ feedId , $ placeholderTypeId ) { $ feedMappingService = $ adWordsServices -> get ( $ session , FeedMappingService :: class ) ; $ page = $ feedMappingService -> query ( sprintf ( 'SELECT FeedMappingId, At...
Gets attribute field mappings from the specified feed and placeholder type .
8,574
private static function getSitelinksFromFeed ( AdWordsServices $ adWordsServices , AdWordsSession $ session , $ feedId ) { printf ( "Processing feed ID %d...\n" , $ feedId ) ; $ sitelinks = [ ] ; $ feedItems = self :: getFeedItems ( $ adWordsServices , $ session , $ feedId ) ; if ( $ feedItems !== null ) { $ attributeF...
Gets sitelinks from the specified feed .
8,575
private static function getPlatformRestrictionsForCampaignFeed ( $ campaignFeed ) { $ platformRestrictions = ExtensionSettingPlatform :: NONE ; if ( $ campaignFeed -> getMatchingFunction ( ) -> getOperator ( ) === FunctionOperator :: AND_VALUE ) { foreach ( $ campaignFeed -> getMatchingFunction ( ) -> getLhsOperand ( )...
Gets plaftform restrictions for the specified campaign feed .
8,576
private static function getFeedItemIdsForCampaignFeed ( $ campaignFeed ) { $ feedItemIds = [ ] ; if ( $ campaignFeed -> getMatchingFunction ( ) -> getOperator ( ) === FunctionOperator :: IN ) { $ feedItemIds = array_merge ( $ feedItemIds , self :: getFeedItemIdsFromArgument ( $ campaignFeed -> getMatchingFunction ( ) )...
Gets feed item IDs from the specified campaign feed .
8,577
private static function getFeedItemIdsFromArgument ( $ function ) { $ feedItemIds = [ ] ; if ( count ( $ function -> getLhsOperand ( ) ) === 1 && $ function -> getLhsOperand ( ) [ 0 ] instanceof RequestContextOperand && $ function -> getLhsOperand ( ) [ 0 ] -> getContextType ( ) === RequestContextOperandContextType :: ...
Gets feed item IDs from the specified function argument .
8,578
private static function createExtensionSetting ( AdWordsServices $ adWordsServices , AdWordsSession $ session , array $ sitelinksFromFeed , $ campaignId , array $ feedItemIds , $ platformRestrictions ) { $ campaignExtensionSettingService = $ adWordsServices -> get ( $ session , CampaignExtensionSettingService :: class ...
Creates a new extension setting for the specified feed items .
8,579
private static function deleteCampaignFeed ( AdWordsServices $ adWordsServices , AdWordsSession $ session , $ campaignFeed ) { $ campaignFeedService = $ adWordsServices -> get ( $ session , CampaignFeedService :: class ) ; printf ( "Deleting association of feed ID %d and campaign ID %d...\n" , $ campaignFeed -> getFeed...
Deletes associations of the specified feed IDs and campaign IDs .
8,580
private static function deleteOldFeedItems ( AdWordsServices $ adWordsServices , AdWordsSession $ session , $ feedItemIds , $ feedId ) { if ( count ( $ feedItemIds ) === 0 ) { return ; } $ feedItemService = $ adWordsServices -> get ( $ session , FeedItemService :: class ) ; $ operations = [ ] ; foreach ( $ feedItemIds ...
Deletes old feed items that became unused anymore after migration .
8,581
private static function createCustomizerFeed ( AdWordsServices $ adWordsServices , AdWordsSession $ session , $ feedName ) { $ adCustomizerFeedService = $ adWordsServices -> get ( $ session , AdCustomizerFeedService :: class ) ; $ nameAttribute = new AdCustomizerFeedAttribute ( ) ; $ nameAttribute -> setName ( 'Name' )...
Creates a new feed for AdCustomizerFeed .
8,582
private static function createCustomizerFeedItems ( AdWordsServices $ adWordsServices , AdWordsSession $ session , AdCustomizerFeed $ adCustomizerFeed , array $ adGroupIds ) { $ feedItemService = $ adWordsServices -> get ( $ session , FeedItemService :: class ) ; $ operations = [ ] ; $ marsDate = mktime ( 0 , 0 , 0 , d...
Creates feed items with the values to use in ad customizations for each ad group .
8,583
private static function createFeedItemAddOperation ( $ name , $ price , $ date , AdCustomizerFeed $ adCustomizerFeed ) { $ nameAttributeValue = new FeedItemAttributeValue ( ) ; $ nameAttributeValue -> setFeedAttributeId ( $ adCustomizerFeed -> getFeedAttributes ( ) [ 0 ] -> getId ( ) ) ; $ nameAttributeValue -> setStri...
Creates a feed item operation that will create a feed item with the specified values and ad group target when sent to FeedItemService . mutate .
8,584
private static function restrictFeedItemToAdGroup ( AdWordsServices $ adWordsServices , AdWordsSession $ session , FeedItem $ feedItem , $ adGroupId ) { $ feedItemTargetService = $ adWordsServices -> get ( $ session , FeedItemTargetService :: class ) ; $ adGroupTarget = new FeedItemAdGroupTarget ( ) ; $ adGroupTarget -...
Restricts the feed item to an ad group .
8,585
private static function createAdsWithCustomizations ( AdWordsServices $ adWordsServices , AdWordsSession $ session , array $ adGroupIds , $ feedName ) { $ adGroupAdService = $ adWordsServices -> get ( $ session , AdGroupAdService :: class ) ; $ operations = [ ] ; $ expandedTextAd = new ExpandedTextAd ( ) ; $ expandedTe...
Creates expanded text ads that use ad customizations for the specified ad group IDs .
8,586
public function getConfiguration ( $ name , $ section = null ) { $ configValue = null ; if ( $ section === null ) { if ( array_key_exists ( $ name , $ this -> config ) ) { $ configValue = $ this -> config [ $ name ] ; } } else { if ( array_key_exists ( $ section , $ this -> config ) ) { $ sectionSettings = $ this -> co...
Gets the value for the specified setting name .
8,587
private function createSoapHeaderObject ( AdsServiceDescriptor $ serviceDescriptor ) { $ reflectionClass = new ReflectionClass ( $ serviceDescriptor -> getServiceClass ( ) ) ; return $ this -> reflection -> createInstance ( sprintf ( '%s\\%s' , $ reflectionClass -> getNamespaceName ( ) , self :: SOAP_HEADER_CLASS_NAME ...
Creates a new instance of the SOAP header object used by the Ad Manager API .
8,588
public function getPreviewUrl ( $ lineItemId , $ creativeId , $ siteUrl ) { return $ this -> __soapCall ( 'getPreviewUrl' , array ( array ( 'lineItemId' => $ lineItemId , 'creativeId' => $ creativeId , 'siteUrl' => $ siteUrl ) ) ) -> getRval ( ) ; }
Returns an insite preview URL that references the specified site URL with the specified creative from the association served to it . For Creative Set previewing you may specify the master creative Id .
8,589
public function getPreviewUrlsForNativeStyles ( $ lineItemId , $ creativeId , $ siteUrl ) { return $ this -> __soapCall ( 'getPreviewUrlsForNativeStyles' , array ( array ( 'lineItemId' => $ lineItemId , 'creativeId' => $ creativeId , 'siteUrl' => $ siteUrl ) ) ) -> getRval ( ) ; }
Returns a list of URLs that reference the specified site URL with the specified creative from the association served to it . For Creative Set previewing you may specify the master creative Id . Each URL corresponds to one available native style for previewing the specified creative .
8,590
private static function printAccountHierarchy ( $ account , $ customerIdsToAccounts , $ customerIdsToChildLinks , $ depth = null ) { if ( $ depth === null ) { print "(Customer ID, Account Name)\n" ; self :: printAccountHierarchy ( $ account , $ customerIdsToAccounts , $ customerIdsToChildLinks , 0 ) ; return ; } print ...
Prints the specified account s hierarchy using recursion .
8,591
public function getCampaignsAction ( Request $ request , FetchAuthTokenInterface $ oAuth2Credential , AdWordsServices $ adWordsServices , AdWordsSessionBuilder $ adWordsSessionBuilder ) { if ( $ request -> method ( ) === 'POST' ) { $ selectedFields = array_values ( [ 'id' => 'Id' ] + $ request -> except ( [ '_token' , ...
Controls a POST and GET request that is submitted from the Get All Campaigns form .
8,592
private function fetchCampaigns ( Request $ request , CampaignService $ campaignService , array $ selectedFields , $ entriesPerPage , $ pageNo ) { $ query = ( new ServiceQueryBuilder ( ) ) -> select ( $ selectedFields ) -> orderByAsc ( 'Name' ) -> limit ( ( $ pageNo - 1 ) * $ entriesPerPage , intval ( $ entriesPerPage ...
Fetch campaigns using the provided campaign service selected fields the number of entries per page and the specified page number .
8,593
public function downloadReportAction ( Request $ request , FetchAuthTokenInterface $ oAuth2Credential , AdWordsServices $ adWordsServices , AdWordsSessionBuilder $ adWordsSessionBuilder ) { if ( $ request -> method ( ) === 'POST' ) { $ clientCustomerId = $ request -> input ( 'clientCustomerId' ) ; $ reportType = $ requ...
Controls a POST and GET request that is submitted from the Download Report form .
8,594
private function downloadReport ( $ reportType , $ reportRange , ReportDownloader $ reportDownloader , array $ selectedFields ) { $ query = ( new ReportQueryBuilder ( ) ) -> select ( $ selectedFields ) -> from ( $ reportType ) -> duringDateRange ( $ reportRange ) -> build ( ) ; $ reportSettingsOverride = ( new ReportSe...
Download a report of the specified report type and date range selected fields and the number of entries per page .
8,595
private function padContent ( $ content ) { $ numBytes = mb_strlen ( $ content , '8bit' ) ; $ remainder = $ numBytes % self :: $ REQUIRED_CONTENT_BYTES_INCREMENT ; if ( $ remainder > 0 ) { $ targetLength = $ numBytes + ( self :: $ REQUIRED_CONTENT_BYTES_INCREMENT - $ remainder ) ; $ content = str_pad ( $ content , $ ta...
Pads the request content to conform to the requirements of Google Cloud Storage .
8,596
public function createLogger ( $ channel , $ stream = null , $ level = null ) { $ stream = $ stream === null ? fopen ( 'php://stderr' , 'w' ) : $ stream ; $ level = $ level === null ? Logger :: INFO : $ level ; $ handler = new StreamHandler ( $ stream , $ level ) ; $ handler -> getFormatter ( ) -> ignoreEmptyContextAnd...
Creates a Monolog logger with a stream handler configured for this library .
8,597
public function withBindVariableValue ( $ key , $ value ) { $ this -> valueMap [ $ key ] = Pql :: createValue ( $ value ) ; return $ this ; }
Adds a bind variable value to the statement .
8,598
public function toStatement ( ) { $ statement = new Statement ( ) ; $ statement -> setQuery ( $ this -> buildQuery ( ) ) ; $ statement -> setValues ( MapEntries :: fromAssociativeArray ( $ this -> getBindVariableMap ( ) , 'Google\AdsApi\AdManager\v201805\String_ValueMapEntry' ) ) ; return $ statement ; }
Gets the statement representing the state of this statement builder .
8,599
private static function removeKeyword ( $ clause , $ keyword ) { $ keyword .= ' ' ; if ( stristr ( substr ( $ clause , 0 , strlen ( $ keyword ) ) , $ keyword ) !== false ) { return substr ( $ clause , strlen ( $ keyword ) ) ; } return $ clause ; }
Removes the specified keyword from the clause if present . Will remove keyword + .