Completed
Push — master ( 36148e...c710c7 )
by Hector
13s queued 11s
created
examples/analytics.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -36,21 +36,21 @@  discard block
 block discarded – undo
36 36
 $j = 1;
37 37
 $l = 1;
38 38
 foreach ($campaignsData as $campaign) {
39
-    echo $i . ': ' . $campaign->getId() . ' ' . $campaign->getName() . ' ' . $campaign->getStartTime()->format('Y-m-d') . ' - ' . $campaign->getEntityStatus() . PHP_EOL;
39
+    echo $i.': '.$campaign->getId().' '.$campaign->getName().' '.$campaign->getStartTime()->format('Y-m-d').' - '.$campaign->getEntityStatus().PHP_EOL;
40 40
     $lineItems = $campaign->getLineItems([TwitterAds\Fields\LineItemFields::COUNT => 2]);
41 41
     /** @var LineItem $lineItem */
42 42
     foreach ($lineItems as $lineItem) {
43
-        echo "\t" . $j . ': ' . $lineItem->getId() . ' ' . $lineItem->getName() . ' ' . PHP_EOL;
44
-        echo "\t\tBid: " . ($lineItem->getBidAmountLocalMicro() / 1000000) . PHP_EOL;
45
-        echo "\t\tObjective: " . $lineItem->getObjective() . PHP_EOL;
46
-        echo "\t\tCharge By: " . $lineItem->getPayBy() . PHP_EOL;
47
-        echo "\t\tBid Strategy: " . $lineItem->getBidStrategy() . PHP_EOL;
43
+        echo "\t".$j.': '.$lineItem->getId().' '.$lineItem->getName().' '.PHP_EOL;
44
+        echo "\t\tBid: ".($lineItem->getBidAmountLocalMicro() / 1000000).PHP_EOL;
45
+        echo "\t\tObjective: ".$lineItem->getObjective().PHP_EOL;
46
+        echo "\t\tCharge By: ".$lineItem->getPayBy().PHP_EOL;
47
+        echo "\t\tBid Strategy: ".$lineItem->getBidStrategy().PHP_EOL;
48 48
         $targetingCriterias = $lineItem->getTargetingCriteria();
49 49
         /** @var TwitterAds\Campaign\TargetingCriteria $targetingCriteria */
50 50
         foreach ($targetingCriterias as $targetingCriteria) {
51
-            echo "\t\t" . $l . ': ' . $targetingCriteria->getId() . ' ' . $targetingCriteria->getName() . ' ' .
51
+            echo "\t\t".$l.': '.$targetingCriteria->getId().' '.$targetingCriteria->getName().' '.
52 52
 
53
-                $targetingCriteria->getTargetingType() . ' ' . $targetingCriteria->getTargetingValue() . PHP_EOL;
53
+                $targetingCriteria->getTargetingType().' '.$targetingCriteria->getTargetingValue().PHP_EOL;
54 54
 
55 55
             $l++;
56 56
         }
@@ -76,14 +76,14 @@  discard block
 block discarded – undo
76 76
                 );
77 77
                 $stats = $stats[0]->id_data[0]->metrics;
78 78
                 if (!is_null($stats->billed_charge_local_micro)) {
79
-                    echo "\t\t\t Start: " . $date[0]->format('Y-m-d H:i:s') . PHP_EOL;
80
-                    echo "\t\t\t End: " . $date[1]->format('Y-m-d H:i:s') . PHP_EOL;
81
-                    echo "\t\t\t " . ($stats->billed_charge_local_micro[0] / 1000000) . '€' . PHP_EOL;
79
+                    echo "\t\t\t Start: ".$date[0]->format('Y-m-d H:i:s').PHP_EOL;
80
+                    echo "\t\t\t End: ".$date[1]->format('Y-m-d H:i:s').PHP_EOL;
81
+                    echo "\t\t\t ".($stats->billed_charge_local_micro[0] / 1000000).'€'.PHP_EOL;
82 82
                     echo "\t\t\t\t App clicks: ";
83 83
                     getStats($stats->app_clicks);
84
-                    echo "\t\t\t\t Installs:" . PHP_EOL;
84
+                    echo "\t\t\t\t Installs:".PHP_EOL;
85 85
                     getStats($stats->mobile_conversion_installs);
86
-                    echo "\t\t\t\t Checkouts:" . PHP_EOL;
86
+                    echo "\t\t\t\t Checkouts:".PHP_EOL;
87 87
                     getStats($stats->mobile_conversion_checkouts_initiated);
88 88
                 }
89 89
             }
@@ -103,14 +103,14 @@  discard block
 block discarded – undo
103 103
     if ($stat instanceof stdClass) {
104 104
         foreach (get_object_vars($stat) as $key => $val) {
105 105
             if (is_array($val)) {
106
-                echo "\t\t\t\t\t " . $key . ': ' . $val[0] . PHP_EOL;
106
+                echo "\t\t\t\t\t ".$key.': '.$val[0].PHP_EOL;
107 107
             } else {
108
-                echo "\t\t\t\t\t " . $key . ' 0' . PHP_EOL;
108
+                echo "\t\t\t\t\t ".$key.' 0'.PHP_EOL;
109 109
             }
110 110
         }
111 111
     } else if (is_array($stat)) {
112 112
         foreach ($stat as $s) {
113
-            echo $s . PHP_EOL;
113
+            echo $s.PHP_EOL;
114 114
         }
115 115
     }
116 116
 
Please login to merge, or discard this patch.
examples/analytics_async.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -36,21 +36,21 @@  discard block
 block discarded – undo
36 36
 $j = 1;
37 37
 $l = 1;
38 38
 foreach ($campaignsData as $campaign) {
39
-    echo $i . ': ' . $campaign->getId() . ' ' . $campaign->getName() . ' ' . $campaign->getStartTime()->format('Y-m-d') . ' - ' . $campaign->getEntityStatus() . PHP_EOL;
39
+    echo $i.': '.$campaign->getId().' '.$campaign->getName().' '.$campaign->getStartTime()->format('Y-m-d').' - '.$campaign->getEntityStatus().PHP_EOL;
40 40
     $lineItems = $campaign->getLineItems([TwitterAds\Fields\LineItemFields::COUNT => 2]);
41 41
     /** @var LineItem $lineItem */
42 42
     foreach ($lineItems as $lineItem) {
43
-        echo "\t" . $j . ': ' . $lineItem->getId() . ' ' . $lineItem->getName() . ' ' . PHP_EOL;
44
-        echo "\t\tBid: " . ($lineItem->getBidAmountLocalMicro() / 1000000) . PHP_EOL;
45
-        echo "\t\tObjective: " . $lineItem->getObjective() . PHP_EOL;
46
-        echo "\t\tCharge By: " . $lineItem->getPayBy() . PHP_EOL;
47
-        echo "\t\tBid Strategy: " . $lineItem->getBidStrategy() . PHP_EOL;
43
+        echo "\t".$j.': '.$lineItem->getId().' '.$lineItem->getName().' '.PHP_EOL;
44
+        echo "\t\tBid: ".($lineItem->getBidAmountLocalMicro() / 1000000).PHP_EOL;
45
+        echo "\t\tObjective: ".$lineItem->getObjective().PHP_EOL;
46
+        echo "\t\tCharge By: ".$lineItem->getPayBy().PHP_EOL;
47
+        echo "\t\tBid Strategy: ".$lineItem->getBidStrategy().PHP_EOL;
48 48
         $targetingCriterias = $lineItem->getTargetingCriteria();
49 49
         /** @var TwitterAds\Campaign\TargetingCriteria $targetingCriteria */
50 50
         foreach ($targetingCriterias as $targetingCriteria) {
51
-            echo "\t\t" . $l . ': ' . $targetingCriteria->getId() . ' ' . $targetingCriteria->getName() . ' ' .
51
+            echo "\t\t".$l.': '.$targetingCriteria->getId().' '.$targetingCriteria->getName().' '.
52 52
 
53
-                $targetingCriteria->getTargetingType() . ' ' . $targetingCriteria->getTargetingValue() . PHP_EOL;
53
+                $targetingCriteria->getTargetingType().' '.$targetingCriteria->getTargetingValue().PHP_EOL;
54 54
 
55 55
             $l++;
56 56
         }
@@ -74,26 +74,26 @@  discard block
 block discarded – undo
74 74
                         AnalyticsFields::PLACEMENT => Enumerations::PLACEMENT_ALL_ON_TWITTER
75 75
                     ], $async
76 76
                 );
77
-                while($job->getStatus() == TwitterAds\Fields\JobFields::PROCESSING){
78
-                    echo 'Job is still processing. Waiting 5 more seconds' .PHP_EOL;
77
+                while ($job->getStatus() == TwitterAds\Fields\JobFields::PROCESSING) {
78
+                    echo 'Job is still processing. Waiting 5 more seconds'.PHP_EOL;
79 79
                     $job->read();
80 80
                     sleep(5);
81 81
                 }
82 82
 
83
-                if($job->getStatus() == TwitterAds\Fields\JobFields::SUCCESS){
83
+                if ($job->getStatus() == TwitterAds\Fields\JobFields::SUCCESS) {
84 84
                     $result = gzfile($job->getUrl());
85 85
                     $result = implode('', $result);
86 86
                     $stats = json_decode($result)->data;
87 87
                     $stats = $stats[0]->id_data[0]->metrics;
88 88
                     if (!is_null($stats->billed_charge_local_micro)) {
89
-                        echo "\t\t\t Start: " . $date[0]->format('Y-m-d H:i:s') . PHP_EOL;
90
-                        echo "\t\t\t End: " . $date[1]->format('Y-m-d H:i:s') . PHP_EOL;
91
-                        echo "\t\t\t " . ($stats->billed_charge_local_micro[0] / 1000000) . '€' . PHP_EOL;
89
+                        echo "\t\t\t Start: ".$date[0]->format('Y-m-d H:i:s').PHP_EOL;
90
+                        echo "\t\t\t End: ".$date[1]->format('Y-m-d H:i:s').PHP_EOL;
91
+                        echo "\t\t\t ".($stats->billed_charge_local_micro[0] / 1000000).'€'.PHP_EOL;
92 92
                         echo "\t\t\t\t App clicks: ";
93 93
                         getStats($stats->app_clicks);
94
-                        echo "\t\t\t\t Installs:" . PHP_EOL;
94
+                        echo "\t\t\t\t Installs:".PHP_EOL;
95 95
                         getStats($stats->mobile_conversion_installs);
96
-                        echo "\t\t\t\t Checkouts:" . PHP_EOL;
96
+                        echo "\t\t\t\t Checkouts:".PHP_EOL;
97 97
                         getStats($stats->mobile_conversion_checkouts_initiated);
98 98
                     }
99 99
                 }
@@ -114,14 +114,14 @@  discard block
 block discarded – undo
114 114
     if ($stat instanceof stdClass) {
115 115
         foreach (get_object_vars($stat) as $key => $val) {
116 116
             if (is_array($val)) {
117
-                echo "\t\t\t\t\t " . $key . ': ' . $val[0] . PHP_EOL;
117
+                echo "\t\t\t\t\t ".$key.': '.$val[0].PHP_EOL;
118 118
             } else {
119
-                echo "\t\t\t\t\t " . $key . ' 0' . PHP_EOL;
119
+                echo "\t\t\t\t\t ".$key.' 0'.PHP_EOL;
120 120
             }
121 121
         }
122 122
     } else if (is_array($stat)) {
123 123
         foreach ($stat as $s) {
124
-            echo $s . PHP_EOL;
124
+            echo $s.PHP_EOL;
125 125
         }
126 126
     }
127 127
 
Please login to merge, or discard this patch.