Completed
Pull Request — master (#98)
by
unknown
01:01
created
src/TwitterAds/TailoredAudience/TailoredAudience.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -129,7 +129,7 @@
 block discarded – undo
129 129
      */
130 130
     public function getAudienceSize()
131 131
     {
132
-        return (int)$this->audience_size;
132
+        return (int) $this->audience_size;
133 133
     }
134 134
 
135 135
     /**
Please login to merge, or discard this patch.
src/TwitterAds/Analytics.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@
 block discarded – undo
59 59
     {
60 60
         $endTime = isset($params[AnalyticsFields::END_TIME]) ? $params[AnalyticsFields::END_TIME] : new DateTime('now');
61 61
         $endTime->setTime($endTime->format('H'), 0, 0);
62
-        $startTime = isset($params[AnalyticsFields::START_TIME]) ? $params[AnalyticsFields::START_TIME] : new DateTime($endTime->format('c') . ' - 7 days');
62
+        $startTime = isset($params[AnalyticsFields::START_TIME]) ? $params[AnalyticsFields::START_TIME] : new DateTime($endTime->format('c').' - 7 days');
63 63
         $startTime->setTime($startTime->format('H'), 0, 0);
64 64
         $granularity = isset($params[AnalyticsFields::GRANULARITY]) ? $params[AnalyticsFields::GRANULARITY] : Enumerations::GRANULARITY_TOTAL;
65 65
         $placement = isset($params[AnalyticsFields::PLACEMENT]) ? $params[AnalyticsFields::PLACEMENT] : Enumerations::PLACEMENT_ALL_ON_TWITTER;
Please login to merge, or discard this patch.
src/TwitterAds/Campaign/Feature.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@
 block discarded – undo
37 37
         $instance = $instance ?: TwitterAds::instance();
38 38
         if (!$instance) {
39 39
             throw new InvalidArgumentException(
40
-                'An Api instance must be provided as argument or ' .
40
+                'An Api instance must be provided as argument or '.
41 41
                 'set as instance in the \TwitterAds\Api'
42 42
             );
43 43
         }
Please login to merge, or discard this patch.
src/TwitterAds/Campaign/AdvertiserBusinessCategories.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@
 block discarded – undo
37 37
         $instance = $instance ?: TwitterAds::instance();
38 38
         if (!$instance) {
39 39
             throw new InvalidArgumentException(
40
-                'An Api instance must be provided as argument or ' .
40
+                'An Api instance must be provided as argument or '.
41 41
                 'set as instance in the \TwitterAds\Api'
42 42
             );
43 43
         }
Please login to merge, or discard this patch.
src/TwitterAds.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
         $this->response->setApiPath($path);
235 235
         $url = sprintf('%s/%s', self::API_HOST_OAUTH, $path);
236 236
         $request = Request::fromConsumerAndToken($this->consumer, $this->token, $method, $url, $parameters);
237
-        $authorization = 'Authorization: Basic ' . $this->encodeAppAuthorization($this->consumer);
237
+        $authorization = 'Authorization: Basic '.$this->encodeAppAuthorization($this->consumer);
238 238
         $result = $this->request($request->getNormalizedHttpUrl(), $method, $authorization, $parameters);
239 239
         $response = json_decode($result, $this->decodeJsonAsArray);
240 240
         $this->response->setBody($response);
@@ -524,9 +524,9 @@  discard block
 block discarded – undo
524 524
     public function manageErrors($response)
525 525
     {
526 526
         $errors = [];
527
-        if(isset($response->errors)){
527
+        if (isset($response->errors)) {
528 528
             $errors = $response->errors;
529
-        } else if(isset($response->operation_errors)){
529
+        } else if (isset($response->operation_errors)) {
530 530
             $errors = $response->operation_errors;
531 531
         }
532 532
 
@@ -572,7 +572,7 @@  discard block
 block discarded – undo
572 572
             $request->signRequest($this->signatureMethod, $this->consumer, $this->token);
573 573
             $authorization = $request->toHeader();
574 574
         } else {
575
-            $authorization = 'Authorization: Bearer ' . $this->bearer;
575
+            $authorization = 'Authorization: Bearer '.$this->bearer;
576 576
         }
577 577
         if (strpos($url, TONUpload::DEFAULT_DOMAIN) === 0) {
578 578
             return $this->request($url, $method, $authorization, $parameters, $headers);
@@ -598,7 +598,7 @@  discard block
 block discarded – undo
598 598
         /* Curl settings */
599 599
         $options = [
600 600
             CURLOPT_VERBOSE => false,
601
-            CURLOPT_CAINFO => __DIR__ . DIRECTORY_SEPARATOR . 'cacert.pem',
601
+            CURLOPT_CAINFO => __DIR__.DIRECTORY_SEPARATOR.'cacert.pem',
602 602
             CURLOPT_CONNECTTIMEOUT => $this->connectionTimeout,
603 603
             CURLOPT_HEADER => true,
604 604
             CURLOPT_HTTPHEADER => array_merge(['Accept: */*', $authorization, 'Expect:'], $headers, ['Connection: close']),
@@ -628,7 +628,7 @@  discard block
 block discarded – undo
628 628
                     $options[CURLOPT_POSTFIELDS] = $postfields['raw'];
629 629
                     $options[CURLOPT_HTTPHEADER] = array_merge($options[CURLOPT_HTTPHEADER], [
630 630
                         'Content-Type: application/json',
631
-                        'Content-Length: '. strlen($postfields['raw'])
631
+                        'Content-Length: '.strlen($postfields['raw'])
632 632
                     ]);
633 633
                 } else {
634 634
                     $options[CURLOPT_POSTFIELDS] = Util::buildHttpQuery($postfields);
@@ -647,7 +647,7 @@  discard block
 block discarded – undo
647 647
         }
648 648
 
649 649
         if (in_array($method, ['GET', 'PUT', 'DELETE']) && !empty($postfields) && !isset($postfields['raw'])) {
650
-            $options[CURLOPT_URL] .= '?' . Util::buildHttpQuery($postfields);
650
+            $options[CURLOPT_URL] .= '?'.Util::buildHttpQuery($postfields);
651 651
         }
652 652
 
653 653
         $curlHandle = curl_init();
@@ -723,7 +723,7 @@  discard block
 block discarded – undo
723 723
         $key = $consumer->key;
724 724
         $secret = $consumer->secret;
725 725
 
726
-        return base64_encode($key . ':' . $secret);
726
+        return base64_encode($key.':'.$secret);
727 727
     }
728 728
 
729 729
     /**
@@ -757,7 +757,7 @@  discard block
 block discarded – undo
757 757
      */
758 758
     public function getAccountId()
759 759
     {
760
-        if(!$this->account instanceof Account){
760
+        if (!$this->account instanceof Account) {
761 761
             return '';
762 762
         }
763 763
         return $this->account->getId();
@@ -768,7 +768,7 @@  discard block
 block discarded – undo
768 768
      */
769 769
     public function getAccountTimezone()
770 770
     {
771
-        if(!$this->account instanceof Account){
771
+        if (!$this->account instanceof Account) {
772 772
             return 'UTC';
773 773
         }
774 774
         return $this->account->getTimezone();
@@ -883,9 +883,9 @@  discard block
 block discarded – undo
883 883
             $token = $token['oauth_token'];
884 884
         }
885 885
         if (empty($sign_in_with_twitter)) {
886
-            return $this->authorizeURL() . "?oauth_token={$token}";
886
+            return $this->authorizeURL()."?oauth_token={$token}";
887 887
         }
888 888
 
889
-        return $this->authenticateURL() . "?oauth_token={$token}";
889
+        return $this->authenticateURL()."?oauth_token={$token}";
890 890
     }
891 891
 }
Please login to merge, or discard this patch.
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.