Completed
Push — master ( 5c5f74...7209c8 )
by Hector
01:44
created
examples/tailored_audience_read.php 1 patch
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,6 @@
 block discarded – undo
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';
Please login to merge, or discard this patch.
src/TwitterAds/Campaign/LineItem.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -83,7 +83,7 @@
 block discarded – undo
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
     {
Please login to merge, or discard this patch.
src/TwitterAds/Analytics/Job.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@
 block discarded – undo
42 42
         $resource = str_replace(static::RESOURCE_REPLACE, $this->getTwitterAds()->getAccountId(), static::RESOURCE);
43 43
         $params[JobFields::JOB_IDS] = $this->id;
44 44
         $response = $this->getTwitterAds()->get($resource, $params);
45
-        if(isset($response->getBody()->data[0])){
45
+        if (isset($response->getBody()->data[0])) {
46 46
             return $this->fromResponse($response->getBody()->data[0]);
47 47
         } else {
48 48
             return $this;
Please login to merge, or discard this patch.
examples/analytics_async.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -37,23 +37,23 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
examples/analytics.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -37,23 +37,23 @@  discard block
 block discarded – undo
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
         }
@@ -79,14 +79,14 @@  discard block
 block discarded – undo
79 79
                 );
80 80
                 $stats = $stats[0]->id_data[0]->metrics;
81 81
                 if (!is_null($stats->billed_charge_local_micro)) {
82
-                    echo "\t\t\t Start: " . $date[0]->format('Y-m-d H:i:s') . PHP_EOL;
83
-                    echo "\t\t\t End: " . $date[1]->format('Y-m-d H:i:s') . PHP_EOL;
84
-                    echo "\t\t\t " . ($stats->billed_charge_local_micro[0] / 1000000) . "€" . PHP_EOL;
82
+                    echo "\t\t\t Start: ".$date[0]->format('Y-m-d H:i:s').PHP_EOL;
83
+                    echo "\t\t\t End: ".$date[1]->format('Y-m-d H:i:s').PHP_EOL;
84
+                    echo "\t\t\t ".($stats->billed_charge_local_micro[0] / 1000000)."€".PHP_EOL;
85 85
                     echo "\t\t\t\t App clicks: ";
86 86
                     getStats($stats->app_clicks);
87
-                    echo "\t\t\t\t Installs:" . PHP_EOL;
87
+                    echo "\t\t\t\t Installs:".PHP_EOL;
88 88
                     getStats($stats->mobile_conversion_installs);
89
-                    echo "\t\t\t\t Checkouts:" . PHP_EOL;
89
+                    echo "\t\t\t\t Checkouts:".PHP_EOL;
90 90
                     getStats($stats->mobile_conversion_checkouts_initiated);
91 91
                 }
92 92
             }
@@ -106,14 +106,14 @@  discard block
 block discarded – undo
106 106
     if ($stat instanceof stdClass) {
107 107
         foreach (get_object_vars($stat) as $key => $val) {
108 108
             if (is_array($val)) {
109
-                echo "\t\t\t\t\t " . $key . ": " . $val[0] . PHP_EOL;
109
+                echo "\t\t\t\t\t ".$key.": ".$val[0].PHP_EOL;
110 110
             } else {
111
-                echo "\t\t\t\t\t " . $key . " 0" . PHP_EOL;
111
+                echo "\t\t\t\t\t ".$key." 0".PHP_EOL;
112 112
             }
113 113
         }
114 114
     } else if (is_array($stat)) {
115 115
         foreach ($stat as $s) {
116
-            echo $s . PHP_EOL;
116
+            echo $s.PHP_EOL;
117 117
         }
118 118
     }
119 119
 
Please login to merge, or discard this patch.