Completed
Push — master ( 367b93...f210fc )
by Hector
01:52
created
examples/analytics.php 2 patches
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\Analytics;
6 5
 use Hborras\TwitterAdsSDK\TwitterAds\Campaign\Campaign;
7 6
 use Hborras\TwitterAdsSDK\TwitterAds\Campaign\LineItem;
8 7
 use Hborras\TwitterAdsSDK\TwitterAds\Enumerations;
Please login to merge, or discard this 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();
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
         }
@@ -78,14 +78,14 @@  discard block
 block discarded – undo
78 78
                 );
79 79
                 $stats = $stats[0]->id_data[0]->metrics;
80 80
                 if (!is_null($stats->billed_charge_local_micro)) {
81
-                    echo "\t\t\t Start: " . $date[0]->format('Y-m-d H:i:s') . PHP_EOL;
82
-                    echo "\t\t\t End: " . $date[1]->format('Y-m-d H:i:s') . PHP_EOL;
83
-                    echo "\t\t\t " . ($stats->billed_charge_local_micro[0] / 1000000) . "€" . PHP_EOL;
81
+                    echo "\t\t\t Start: ".$date[0]->format('Y-m-d H:i:s').PHP_EOL;
82
+                    echo "\t\t\t End: ".$date[1]->format('Y-m-d H:i:s').PHP_EOL;
83
+                    echo "\t\t\t ".($stats->billed_charge_local_micro[0] / 1000000)."€".PHP_EOL;
84 84
                     echo "\t\t\t\t App clicks: ";
85 85
                     getStats($stats->app_clicks);
86
-                    echo "\t\t\t\t Installs:" . PHP_EOL;
86
+                    echo "\t\t\t\t Installs:".PHP_EOL;
87 87
                     getStats($stats->mobile_conversion_installs);
88
-                    echo "\t\t\t\t Checkouts:" . PHP_EOL;
88
+                    echo "\t\t\t\t Checkouts:".PHP_EOL;
89 89
                     getStats($stats->mobile_conversion_checkouts_initiated);
90 90
                 }
91 91
             }
@@ -105,14 +105,14 @@  discard block
 block discarded – undo
105 105
     if ($stat instanceof stdClass) {
106 106
         foreach (get_object_vars($stat) as $key => $val) {
107 107
             if (is_array($val)) {
108
-                echo "\t\t\t\t\t " . $key . ": " . $val[0] . PHP_EOL;
108
+                echo "\t\t\t\t\t ".$key.": ".$val[0].PHP_EOL;
109 109
             } else {
110
-                echo "\t\t\t\t\t " . $key . " 0" . PHP_EOL;
110
+                echo "\t\t\t\t\t ".$key." 0".PHP_EOL;
111 111
             }
112 112
         }
113 113
     } else if (is_array($stat)) {
114 114
         foreach ($stat as $s) {
115
-            echo $s . PHP_EOL;
115
+            echo $s.PHP_EOL;
116 116
         }
117 117
     }
118 118
 
Please login to merge, or discard this patch.
src/TwitterAds.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
         $this->response->setApiPath($path);
227 227
         $url = sprintf('%s/%s', self::API_HOST_OAUTH, $path);
228 228
         $request = Request::fromConsumerAndToken($this->consumer, $this->token, $method, $url, $parameters);
229
-        $authorization = 'Authorization: Basic ' . $this->encodeAppAuthorization($this->consumer);
229
+        $authorization = 'Authorization: Basic '.$this->encodeAppAuthorization($this->consumer);
230 230
         $result = $this->request($request->getNormalizedHttpUrl(), $method, $authorization, $parameters);
231 231
         $response = JsonDecoder::decode($result, $this->decodeJsonAsArray);
232 232
         $this->response->setBody($response);
@@ -495,7 +495,7 @@  discard block
 block discarded – undo
495 495
             $request->signRequest($this->signatureMethod, $this->consumer, $this->token);
496 496
             $authorization = $request->toHeader();
497 497
         } else {
498
-            $authorization = 'Authorization: Bearer ' . $this->bearer;
498
+            $authorization = 'Authorization: Bearer '.$this->bearer;
499 499
         }
500 500
         if (strpos($url, TONUpload::DEFAULT_DOMAIN) === 0) {
501 501
             return $this->request($url, $method, $authorization, $parameters, $headers);
@@ -522,7 +522,7 @@  discard block
 block discarded – undo
522 522
         /* Curl settings */
523 523
         $options = [
524 524
             CURLOPT_VERBOSE => false,
525
-            CURLOPT_CAINFO => __DIR__ . DIRECTORY_SEPARATOR . 'cacert.pem',
525
+            CURLOPT_CAINFO => __DIR__.DIRECTORY_SEPARATOR.'cacert.pem',
526 526
             CURLOPT_CONNECTTIMEOUT => $this->connectionTimeout,
527 527
             CURLOPT_HEADER => true,
528 528
             CURLOPT_HTTPHEADER => array_merge(['Accept: */*', $authorization, 'Expect:'], $headers, ['Connection: close']),
@@ -567,7 +567,7 @@  discard block
 block discarded – undo
567 567
         }
568 568
 
569 569
         if (in_array($method, ['GET', 'PUT', 'DELETE']) && !empty($postfields) && !isset($postfields['raw'])) {
570
-            $options[CURLOPT_URL] .= '?' . Util::buildHttpQuery($postfields);
570
+            $options[CURLOPT_URL] .= '?'.Util::buildHttpQuery($postfields);
571 571
         }
572 572
 
573 573
         $curlHandle = curl_init();
@@ -643,7 +643,7 @@  discard block
 block discarded – undo
643 643
         $key = $consumer->key;
644 644
         $secret = $consumer->secret;
645 645
 
646
-        return base64_encode($key . ':' . $secret);
646
+        return base64_encode($key.':'.$secret);
647 647
     }
648 648
 
649 649
     /**
@@ -790,9 +790,9 @@  discard block
 block discarded – undo
790 790
             $token = $token['oauth_token'];
791 791
         }
792 792
         if (empty($sign_in_with_twitter)) {
793
-            return $this->authorizeURL() . "?oauth_token={$token}";
793
+            return $this->authorizeURL()."?oauth_token={$token}";
794 794
         } else {
795
-            return $this->authenticateURL() . "?oauth_token={$token}";
795
+            return $this->authenticateURL()."?oauth_token={$token}";
796 796
         }
797 797
     }
798 798
 }
Please login to merge, or discard this patch.
src/TwitterAds/Resource.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@
 block discarded – undo
47 47
         $instance = $instance ?: TwitterAds::instance();
48 48
         if (!$instance) {
49 49
             throw new \InvalidArgumentException(
50
-                'An Api instance must be provided as argument or ' .
50
+                'An Api instance must be provided as argument or '.
51 51
                 'set as instance in the \TwitterAds\Api');
52 52
         }
53 53
         return $instance;
Please login to merge, or discard this patch.