@@ -2,7 +2,6 @@ |
||
2 | 2 | |
3 | 3 | use Hborras\TwitterAdsSDK\TwitterAds; |
4 | 4 | use Hborras\TwitterAdsSDK\TwitterAds\Account; |
5 | -use Hborras\TwitterAdsSDK\TwitterAds\Analytics; |
|
6 | 5 | use Hborras\TwitterAdsSDK\TwitterAds\Campaign\Campaign; |
7 | 6 | use Hborras\TwitterAdsSDK\TwitterAds\Campaign\LineItem; |
8 | 7 | use Hborras\TwitterAdsSDK\TwitterAds\Enumerations; |
@@ -37,23 +37,23 @@ discard block |
||
37 | 37 | $j = 1; |
38 | 38 | $l = 1; |
39 | 39 | foreach ($campaignsData as $campaign) { |
40 | - echo $i . ": " . $campaign->getId() . " " . $campaign->getName() . " " . $campaign->getStartTime()->format('Y-m-d') . " - " . $campaign->getEntityStatus() . PHP_EOL; |
|
40 | + echo $i.": ".$campaign->getId()." ".$campaign->getName()." ".$campaign->getStartTime()->format('Y-m-d')." - ".$campaign->getEntityStatus().PHP_EOL; |
|
41 | 41 | $lineItems = $campaign->getLineItems([TwitterAds\Fields\LineItemFields::COUNT => 2]); |
42 | 42 | /** @var LineItem $lineItem */ |
43 | 43 | foreach ($lineItems as $lineItem) { |
44 | - echo "\t" . $j . ": " . $lineItem->getId() . " " . $lineItem->getName() . " " . PHP_EOL; |
|
45 | - echo "\t\tBid: " . ($lineItem->getBidAmountLocalMicro() / 1000000) . PHP_EOL; |
|
46 | - echo "\t\tObjective: " . $lineItem->getObjective() . PHP_EOL; |
|
47 | - echo "\t\tCharge By: " . $lineItem->getChargeBy() . PHP_EOL; |
|
48 | - echo "\t\tBid Unit: " . $lineItem->getBidUnit() . PHP_EOL; |
|
49 | - echo "\t\tOptimization: " . $lineItem->getOptimization() . PHP_EOL; |
|
50 | - echo "\t\tBid Type: " . $lineItem->getBidType() . PHP_EOL; |
|
44 | + echo "\t".$j.": ".$lineItem->getId()." ".$lineItem->getName()." ".PHP_EOL; |
|
45 | + echo "\t\tBid: ".($lineItem->getBidAmountLocalMicro() / 1000000).PHP_EOL; |
|
46 | + echo "\t\tObjective: ".$lineItem->getObjective().PHP_EOL; |
|
47 | + echo "\t\tCharge By: ".$lineItem->getChargeBy().PHP_EOL; |
|
48 | + echo "\t\tBid Unit: ".$lineItem->getBidUnit().PHP_EOL; |
|
49 | + echo "\t\tOptimization: ".$lineItem->getOptimization().PHP_EOL; |
|
50 | + echo "\t\tBid Type: ".$lineItem->getBidType().PHP_EOL; |
|
51 | 51 | $targetingCriterias = $lineItem->getTargetingCriteria(); |
52 | 52 | /** @var TwitterAds\Campaign\TargetingCriteria $targetingCriteria */ |
53 | 53 | foreach ($targetingCriterias as $targetingCriteria) { |
54 | - echo "\t\t" . $l . ": " . $targetingCriteria->getId() . " " . $targetingCriteria->getName() . " " . |
|
54 | + echo "\t\t".$l.": ".$targetingCriteria->getId()." ".$targetingCriteria->getName()." ". |
|
55 | 55 | |
56 | - $targetingCriteria->getTargetingType() . " " . $targetingCriteria->getTargetingValue() . PHP_EOL; |
|
56 | + $targetingCriteria->getTargetingType()." ".$targetingCriteria->getTargetingValue().PHP_EOL; |
|
57 | 57 | |
58 | 58 | $l++; |
59 | 59 | } |
@@ -77,26 +77,26 @@ discard block |
||
77 | 77 | AnalyticsFields::PLACEMENT => Enumerations::PLACEMENT_ALL_ON_TWITTER |
78 | 78 | ], $async |
79 | 79 | ); |
80 | - while($job->getStatus() == TwitterAds\Fields\JobFields::PROCESSING){ |
|
80 | + while ($job->getStatus() == TwitterAds\Fields\JobFields::PROCESSING) { |
|
81 | 81 | echo "Job is still processing. Waiting 5 more seconds".PHP_EOL; |
82 | 82 | $job->read(); |
83 | 83 | sleep(5); |
84 | 84 | } |
85 | 85 | |
86 | - if($job->getStatus() == TwitterAds\Fields\JobFields::SUCCESS){ |
|
86 | + if ($job->getStatus() == TwitterAds\Fields\JobFields::SUCCESS) { |
|
87 | 87 | $result = gzfile($job->getUrl()); |
88 | 88 | $result = implode("", $result); |
89 | 89 | $stats = json_decode($result)->data; |
90 | 90 | $stats = $stats[0]->id_data[0]->metrics; |
91 | 91 | if (!is_null($stats->billed_charge_local_micro)) { |
92 | - echo "\t\t\t Start: " . $date[0]->format('Y-m-d H:i:s') . PHP_EOL; |
|
93 | - echo "\t\t\t End: " . $date[1]->format('Y-m-d H:i:s') . PHP_EOL; |
|
94 | - echo "\t\t\t " . ($stats->billed_charge_local_micro[0] / 1000000) . "€" . PHP_EOL; |
|
92 | + echo "\t\t\t Start: ".$date[0]->format('Y-m-d H:i:s').PHP_EOL; |
|
93 | + echo "\t\t\t End: ".$date[1]->format('Y-m-d H:i:s').PHP_EOL; |
|
94 | + echo "\t\t\t ".($stats->billed_charge_local_micro[0] / 1000000)."€".PHP_EOL; |
|
95 | 95 | echo "\t\t\t\t App clicks: "; |
96 | 96 | getStats($stats->app_clicks); |
97 | - echo "\t\t\t\t Installs:" . PHP_EOL; |
|
97 | + echo "\t\t\t\t Installs:".PHP_EOL; |
|
98 | 98 | getStats($stats->mobile_conversion_installs); |
99 | - echo "\t\t\t\t Checkouts:" . PHP_EOL; |
|
99 | + echo "\t\t\t\t Checkouts:".PHP_EOL; |
|
100 | 100 | getStats($stats->mobile_conversion_checkouts_initiated); |
101 | 101 | } |
102 | 102 | } |
@@ -117,14 +117,14 @@ discard block |
||
117 | 117 | if ($stat instanceof stdClass) { |
118 | 118 | foreach (get_object_vars($stat) as $key => $val) { |
119 | 119 | if (is_array($val)) { |
120 | - echo "\t\t\t\t\t " . $key . ": " . $val[0] . PHP_EOL; |
|
120 | + echo "\t\t\t\t\t ".$key.": ".$val[0].PHP_EOL; |
|
121 | 121 | } else { |
122 | - echo "\t\t\t\t\t " . $key . " 0" . PHP_EOL; |
|
122 | + echo "\t\t\t\t\t ".$key." 0".PHP_EOL; |
|
123 | 123 | } |
124 | 124 | } |
125 | 125 | } else if (is_array($stat)) { |
126 | 126 | foreach ($stat as $s) { |
127 | - echo $s . PHP_EOL; |
|
127 | + echo $s.PHP_EOL; |
|
128 | 128 | } |
129 | 129 | } |
130 | 130 |
@@ -2,7 +2,6 @@ |
||
2 | 2 | |
3 | 3 | use Hborras\TwitterAdsSDK\TwitterAds; |
4 | 4 | use Hborras\TwitterAdsSDK\TwitterAds\Account; |
5 | -use Hborras\TwitterAdsSDK\TwitterAds\TailoredAudience\TailoredAudience; |
|
6 | 5 | |
7 | 6 | |
8 | 7 | require '../autoload.php'; |
@@ -83,7 +83,7 @@ |
||
83 | 83 | * @param $metricGroups |
84 | 84 | * @param array $params |
85 | 85 | * @param bool $async |
86 | - * @return Job| mixed |
|
86 | + * @return LineItem mixed |
|
87 | 87 | */ |
88 | 88 | public function stats($metricGroups, $params = [], $async = false) |
89 | 89 | { |
@@ -15,8 +15,8 @@ |
||
15 | 15 | const APPROVAL_STATUS = 'approval_status'; |
16 | 16 | const LINE_ITEM_ID = 'line_item_id'; |
17 | 17 | const TWEET_ID = 'tweet_id'; |
18 | - const SCHEDULED_TWEET_IDS = 'scheduled_tweet_ids'; |
|
19 | - const SCHEDULED_TWEET_ID = 'scheduled_tweet_id'; |
|
18 | + const SCHEDULED_TWEET_IDS = 'scheduled_tweet_ids'; |
|
19 | + const SCHEDULED_TWEET_ID = 'scheduled_tweet_id'; |
|
20 | 20 | const ENTITY_STATUS = 'entity_status'; |
21 | 21 | const PROMOTED_TWEET_IDS = 'promoted_tweet_ids'; |
22 | 22 | const LINE_ITEM_IDS = 'line_item_ids'; |
@@ -42,7 +42,7 @@ |
||
42 | 42 | $instance = $instance ?: TwitterAds::instance(); |
43 | 43 | if (!$instance) { |
44 | 44 | throw new \InvalidArgumentException( |
45 | - 'An Api instance must be provided as argument or ' . |
|
45 | + 'An Api instance must be provided as argument or '. |
|
46 | 46 | 'set as instance in the \TwitterAds\Api' |
47 | 47 | ); |
48 | 48 | } |
@@ -28,7 +28,7 @@ |
||
28 | 28 | /** |
29 | 29 | * Automatically set the account if this class is not an account |
30 | 30 | * Resource constructor. |
31 | - * @param null $id |
|
31 | + * @param string $id |
|
32 | 32 | * @param TwitterAds $twitterAds |
33 | 33 | */ |
34 | 34 | public function __construct($id = null, TwitterAds $twitterAds = null) |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | $instance = $instance ?: TwitterAds::instance(); |
43 | 43 | if (!$instance) { |
44 | 44 | throw new \InvalidArgumentException( |
45 | - 'An Api instance must be provided as argument or ' . |
|
45 | + 'An Api instance must be provided as argument or '. |
|
46 | 46 | 'set as instance in the \TwitterAds\Api' |
47 | 47 | ); |
48 | 48 | } |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | $params[$property] = implode(',', $this->$property); |
155 | 155 | } elseif (is_bool($this->$property)) { |
156 | 156 | $params[$property] = $this->$property ? 'true' : 'false'; |
157 | - } elseif (isset($this->$property->id)){ |
|
157 | + } elseif (isset($this->$property->id)) { |
|
158 | 158 | $params[$property] = strval($this->$property->id); |
159 | 159 | } else { |
160 | 160 | $params[$property] = strval($this->$property); |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | |
58 | 58 | // create request for a simple nullcasted tweet |
59 | 59 | $media = $api->upload(['media' => 'kitten.jpg']); |
60 | -$tweet1 = Tweet::create($account, 'Tweet number 1 ...' . rand() . ' http://twitter.com', ['media_ids' => $media->media_id]); |
|
60 | +$tweet1 = Tweet::create($account, 'Tweet number 1 ...'.rand().' http://twitter.com', ['media_ids' => $media->media_id]); |
|
61 | 61 | |
62 | 62 | // promote the tweet using our line item |
63 | 63 | $promotedTweet = new PromotedTweet(); |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | // create request for a nullcasted tweet with a website card |
69 | 69 | $websiteCard = new WebsiteCard(); |
70 | 70 | $websiteCard = $websiteCard->all()->getCollection()[0]; |
71 | -$status = 'Tweet number 2 ...' . rand(); |
|
71 | +$status = 'Tweet number 2 ...'.rand(); |
|
72 | 72 | |
73 | 73 | $tweet2 = Tweet::create($account, $status, [TweetFields::CARD_URI => $websiteCard->getCardUri()]); |
74 | 74 |
@@ -26,4 +26,4 @@ |
||
26 | 26 | |
27 | 27 | // create request for a simple nullcasted tweet |
28 | 28 | $media = $api->upload(['media' => 'kitten.jpg', 'media_type' => 'image/jpg'], true); |
29 | -$tweet = Tweet::create($account, 'Tweet with chunked upload GIF...' . rand() . ' http://twitter.com', ['media_ids' => $media->media_id]); |
|
30 | 29 | \ No newline at end of file |
30 | +$tweet = Tweet::create($account, 'Tweet with chunked upload GIF...'.rand().' http://twitter.com', ['media_ids' => $media->media_id]); |
|
31 | 31 | \ No newline at end of file |
@@ -9,7 +9,7 @@ |
||
9 | 9 | const UPDATED_AT = 'updated_at'; |
10 | 10 | const DELETED = 'delete'; |
11 | 11 | const NAME = 'name'; |
12 | - const COUNTRY_CODE = 'country_code'; |
|
12 | + const COUNTRY_CODE = 'country_code'; |
|
13 | 13 | const IPHONE_APP_ID = 'iphone_app_id'; |
14 | 14 | const IPHONE_DEEP_LINK = 'iphone_deep_link'; |
15 | 15 | const IPAD_APP_ID = 'ipad_app_id'; |