Completed
Pull Request — master (#191)
by Emanuele
03:10
created
src/FacebookAds/Logger/NullLogger.php 1 patch
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -27,15 +27,13 @@  discard block
 block discarded – undo
27 27
 use FacebookAds\Http\RequestInterface;
28 28
 use FacebookAds\Http\ResponseInterface;
29 29
 
30
-class NullLogger implements LoggerInterface
31
-{
30
+class NullLogger implements LoggerInterface {
32 31
     /**
33 32
      * @param string $level
34 33
      * @param string $message
35 34
      * @param array $context
36 35
      */
37
-    public function log($level, $message, array $context = array())
38
-    {
36
+    public function log($level, $message, array $context = array()) {
39 37
     }
40 38
 
41 39
     /**
@@ -43,8 +41,7 @@  discard block
 block discarded – undo
43 41
      * @param RequestInterface $request
44 42
      * @param array $context
45 43
      */
46
-    public function logRequest($level, RequestInterface $request, array $context = array())
47
-    {
44
+    public function logRequest($level, RequestInterface $request, array $context = array()) {
48 45
     }
49 46
 
50 47
     /**
@@ -52,7 +49,6 @@  discard block
 block discarded – undo
52 49
      * @param ResponseInterface $response
53 50
      * @param array $context
54 51
      */
55
-    public function logResponse($level, ResponseInterface $response, array $context = array())
56
-    {
52
+    public function logResponse($level, ResponseInterface $response, array $context = array()) {
57 53
     }
58 54
 }
Please login to merge, or discard this patch.
src/FacebookAds/Logger/LoggerInterface.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -27,8 +27,7 @@
 block discarded – undo
27 27
 use FacebookAds\Http\RequestInterface;
28 28
 use FacebookAds\Http\ResponseInterface;
29 29
 
30
-interface LoggerInterface
31
-{
30
+interface LoggerInterface {
32 31
     /**
33 32
      * @param string $level
34 33
      * @param string $message
Please login to merge, or discard this patch.
src/FacebookAds/Object/Product.php 1 patch
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -31,24 +31,21 @@
 block discarded – undo
31 31
 use FacebookAds\Object\Traits\CannotCreate;
32 32
 use FacebookAds\Object\Traits\FieldValidation;
33 33
 
34
-class Product extends AbstractCrudObject
35
-{
34
+class Product extends AbstractCrudObject {
36 35
     use CannotCreate;
37 36
     use FieldValidation;
38 37
 
39 38
     /**
40 39
      * @return string
41 40
      */
42
-    protected function getEndpoint()
43
-    {
41
+    protected function getEndpoint() {
44 42
         return 'products';
45 43
     }
46 44
 
47 45
     /**
48 46
      * @return ProductFields
49 47
      */
50
-    public static function getFieldsEnum()
51
-    {
48
+    public static function getFieldsEnum() {
52 49
         return ProductFields::getInstance();
53 50
     }
54 51
 
Please login to merge, or discard this patch.
src/FacebookAds/Object/Campaign.php 1 patch
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -30,8 +30,7 @@  discard block
 block discarded – undo
30 30
 use FacebookAds\Object\Traits\FieldValidation;
31 31
 use FacebookAds\Object\Traits\ObjectValidation;
32 32
 
33
-class Campaign extends AbstractArchivableCrudObject
34
-{
33
+class Campaign extends AbstractArchivableCrudObject {
35 34
     use FieldValidation;
36 35
     use ObjectValidation;
37 36
     use AdLabelAwareCrudObjectTrait;
@@ -39,16 +38,14 @@  discard block
 block discarded – undo
39 38
     /**
40 39
      * @return string
41 40
      */
42
-    protected function getEndpoint()
43
-    {
41
+    protected function getEndpoint() {
44 42
         return 'campaigns';
45 43
     }
46 44
 
47 45
     /**
48 46
      * @return CampaignFields
49 47
      */
50
-    public static function getFieldsEnum()
51
-    {
48
+    public static function getFieldsEnum() {
52 49
         return CampaignFields::getInstance();
53 50
     }
54 51
 
@@ -57,8 +54,7 @@  discard block
 block discarded – undo
57 54
      * @param array $params
58 55
      * @return Cursor
59 56
      */
60
-    public function getAdSets(array $fields = array(), array $params = array())
61
-    {
57
+    public function getAdSets(array $fields = array(), array $params = array()) {
62 58
         return $this->getManyByConnection(AdSet::className(), $fields, $params);
63 59
     }
64 60
 
@@ -67,8 +63,7 @@  discard block
 block discarded – undo
67 63
      * @param array $params
68 64
      * @return Cursor
69 65
      */
70
-    public function getAds(array $fields = array(), array $params = array())
71
-    {
66
+    public function getAds(array $fields = array(), array $params = array()) {
72 67
         return $this->getManyByConnection(Ad::className(), $fields, $params);
73 68
     }
74 69
 
Please login to merge, or discard this patch.
src/FacebookAds/Object/AdSet.php 1 patch
Braces   +7 added lines, -14 removed lines patch added patch discarded remove patch
@@ -30,8 +30,7 @@  discard block
 block discarded – undo
30 30
 use FacebookAds\Object\Traits\FieldValidation;
31 31
 use FacebookAds\Object\Traits\ObjectValidation;
32 32
 
33
-class AdSet extends AbstractArchivableCrudObject implements CanRedownloadInterface
34
-{
33
+class AdSet extends AbstractArchivableCrudObject implements CanRedownloadInterface {
35 34
     use FieldValidation;
36 35
     use ObjectValidation;
37 36
     use AdLabelAwareCrudObjectTrait;
@@ -39,16 +38,14 @@  discard block
 block discarded – undo
39 38
     /**
40 39
      * @return string
41 40
      */
42
-    protected function getEndpoint()
43
-    {
41
+    protected function getEndpoint() {
44 42
         return 'adsets';
45 43
     }
46 44
 
47 45
     /**
48 46
      * @return AdSetFields
49 47
      */
50
-    public static function getFieldsEnum()
51
-    {
48
+    public static function getFieldsEnum() {
52 49
         return AdSetFields::getInstance();
53 50
     }
54 51
 
@@ -57,8 +54,7 @@  discard block
 block discarded – undo
57 54
      * @param array $params
58 55
      * @return Cursor
59 56
      */
60
-    public function getAds(array $fields = array(), array $params = array())
61
-    {
57
+    public function getAds(array $fields = array(), array $params = array()) {
62 58
         return $this->getManyByConnection(Ad::className(), $fields, $params);
63 59
     }
64 60
 
@@ -67,8 +63,7 @@  discard block
 block discarded – undo
67 63
      * @param array $params
68 64
      * @return Cursor
69 65
      */
70
-    public function getAdCreatives(array $fields = array(), array $params = array())
71
-    {
66
+    public function getAdCreatives(array $fields = array(), array $params = array()) {
72 67
         return $this->getManyByConnection(AdCreative::className(), $fields, $params);
73 68
     }
74 69
 
@@ -77,8 +72,7 @@  discard block
 block discarded – undo
77 72
      * @param array $params
78 73
      * @return Cursor
79 74
      */
80
-    public function getInsights(array $fields = array(), array $params = array())
81
-    {
75
+    public function getInsights(array $fields = array(), array $params = array()) {
82 76
         return $this->getManyByConnection(Insights::classname(), $fields, $params, 'insights');
83 77
     }
84 78
 
@@ -87,8 +81,7 @@  discard block
 block discarded – undo
87 81
      * @param array $params
88 82
      * @return AsyncJobInsights
89 83
      */
90
-    public function getInsightsAsync(array $fields = array(), array $params = array())
91
-    {
84
+    public function getInsightsAsync(array $fields = array(), array $params = array()) {
92 85
         return $this->createAsyncJob(AsyncJobInsights::className(), $fields, $params);
93 86
     }
94 87
 }
Please login to merge, or discard this patch.
src/FacebookAds/Object/Project.php 1 patch
Braces   +9 added lines, -18 removed lines patch added patch discarded remove patch
@@ -29,23 +29,20 @@  discard block
 block discarded – undo
29 29
 use FacebookAds\Object\Fields\ProjectFields;
30 30
 use FacebookAds\Object\Traits\FieldValidation;
31 31
 
32
-class Project extends AbstractCrudObject
33
-{
32
+class Project extends AbstractCrudObject {
34 33
     use FieldValidation;
35 34
 
36 35
     /**
37 36
      * @return string
38 37
      */
39
-    protected function getEndpoint()
40
-    {
38
+    protected function getEndpoint() {
41 39
         return 'businessprojects';
42 40
     }
43 41
 
44 42
     /**
45 43
      * @return ProjectFields
46 44
      */
47
-    public static function getFieldsEnum()
48
-    {
45
+    public static function getFieldsEnum() {
49 46
         return ProjectFields::getInstance();
50 47
     }
51 48
 
@@ -88,8 +85,7 @@  discard block
 block discarded – undo
88 85
     /**
89 86
      * @param int $page_id
90 87
      */
91
-    public function addPage($page_id)
92
-    {
88
+    public function addPage($page_id) {
93 89
         $params = array(
94 90
             'page_id' => $page_id,
95 91
         );
@@ -103,8 +99,7 @@  discard block
 block discarded – undo
103 99
     /**
104 100
      * @param int $page_id
105 101
      */
106
-    public function deletePage($page_id)
107
-    {
102
+    public function deletePage($page_id) {
108 103
         $params = array(
109 104
             'page_id' => $page_id,
110 105
         );
@@ -118,8 +113,7 @@  discard block
 block discarded – undo
118 113
     /**
119 114
      * @param int $account_id
120 115
      */
121
-    public function adAdAccount($account_id)
122
-    {
116
+    public function adAdAccount($account_id) {
123 117
         $params = array(
124 118
             'adaccount_id' => $account_id,
125 119
         );
@@ -133,8 +127,7 @@  discard block
 block discarded – undo
133 127
     /**
134 128
      * @param int $account_id
135 129
      */
136
-    public function deleteAdAccount($account_id)
137
-    {
130
+    public function deleteAdAccount($account_id) {
138 131
         $params = array(
139 132
             'adaccount_id' => $account_id,
140 133
         );
@@ -148,8 +141,7 @@  discard block
 block discarded – undo
148 141
     /**
149 142
      * @param int $app_id
150 143
      */
151
-    public function addApp($app_id)
152
-    {
144
+    public function addApp($app_id) {
153 145
         $params = array(
154 146
             'app_id' => $app_id,
155 147
         );
@@ -163,8 +155,7 @@  discard block
 block discarded – undo
163 155
     /**
164 156
      * @param int $app_id
165 157
      */
166
-    public function deleteApp($app_id)
167
-    {
158
+    public function deleteApp($app_id) {
168 159
         $params = array(
169 160
             'app_id' => $app_id,
170 161
         );
Please login to merge, or discard this patch.
src/FacebookAds/Object/AdImage.php 1 patch
Braces   +9 added lines, -18 removed lines patch added patch discarded remove patch
@@ -31,8 +31,7 @@  discard block
 block discarded – undo
31 31
 use FacebookAds\Object\Traits\CannotUpdate;
32 32
 use FacebookAds\Object\Traits\FieldValidation;
33 33
 
34
-class AdImage extends AbstractCrudObject
35
-{
34
+class AdImage extends AbstractCrudObject {
36 35
     use FieldValidation;
37 36
     use CannotUpdate;
38 37
 
@@ -59,24 +58,21 @@  discard block
 block discarded – undo
59 58
     /**
60 59
      * @return string
61 60
      */
62
-    protected function getEndpoint()
63
-    {
61
+    protected function getEndpoint() {
64 62
         return 'adimages';
65 63
     }
66 64
 
67 65
     /**
68 66
      * @return AdImageFields
69 67
      */
70
-    public static function getFieldsEnum()
71
-    {
68
+    public static function getFieldsEnum() {
72 69
         return AdImageFields::getInstance();
73 70
     }
74 71
 
75 72
     /**
76 73
      * @return string
77 74
      */
78
-    protected function getNodePath()
79
-    {
75
+    protected function getNodePath() {
80 76
         return '/'.$this->assureParentId().'/'.$this->getEndpoint();
81 77
     }
82 78
 
@@ -88,8 +84,7 @@  discard block
 block discarded – undo
88 84
      * @throws \Exception
89 85
      * @throws \RuntimeException
90 86
      */
91
-    public function create(array $params = array())
92
-    {
87
+    public function create(array $params = array()) {
93 88
         if ($this->data[static::FIELD_ID]) {
94 89
             throw new \Exception("Object has already an ID");
95 90
         }
@@ -131,8 +126,7 @@  discard block
 block discarded – undo
131 126
      * @param array $params Additional request parameters
132 127
      * @return $this
133 128
      */
134
-    public function read(array $fields = array(), array $params = array())
135
-    {
129
+    public function read(array $fields = array(), array $params = array()) {
136 130
         $fields = implode(',', $fields ?: static::getDefaultReadFields());
137 131
         if ($fields) {
138 132
             $params['fields'] = $fields;
@@ -162,8 +156,7 @@  discard block
 block discarded – undo
162 156
      * @return void
163 157
      * @throws \Exception
164 158
      */
165
-    public function delete(array $params = array())
166
-    {
159
+    public function delete(array $params = array()) {
167 160
         if (!$this->data[AdImageFields::HASH]) {
168 161
             throw new \Exception("AdImage hash is required to delete");
169 162
         }
@@ -181,8 +174,7 @@  discard block
 block discarded – undo
181 174
      * @return array
182 175
      * @throws \RuntimeException
183 176
      */
184
-    protected function arrayFromZip($params = array())
185
-    {
177
+    protected function arrayFromZip($params = array()) {
186 178
         if (!$this->isZipFile($this->data[AdImageFields::FILENAME])) {
187 179
             throw new \RuntimeException($this->data[AdImageFields::FILENAME]." doesn't resolve to a zip file");
188 180
         }
@@ -223,8 +215,7 @@  discard block
 block discarded – undo
223 215
      * @param string $file_path
224 216
      * @return bool
225 217
      */
226
-    protected function isZipFile($file_path)
227
-    {
218
+    protected function isZipFile($file_path) {
228 219
         $finfo = finfo_open(FILEINFO_MIME_TYPE);
229 220
         $file_mime_type = finfo_file($finfo, $file_path);
230 221
         return $file_mime_type == 'application/zip' ||
Please login to merge, or discard this patch.
src/FacebookAds/Object/LeadgenForm.php 1 patch
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -30,8 +30,7 @@  discard block
 block discarded – undo
30 30
 use FacebookAds\Object\Traits\CannotDelete;
31 31
 use FacebookAds\Object\Traits\CannotUpdate;
32 32
 
33
-class LeadgenForm extends AbstractCrudObject
34
-{
33
+class LeadgenForm extends AbstractCrudObject {
35 34
     use CannotCreate;
36 35
     use CannotUpdate;
37 36
     use CannotDelete;
@@ -39,16 +38,14 @@  discard block
 block discarded – undo
39 38
     /**
40 39
      * @return string
41 40
      */
42
-    protected function getEndpoint()
43
-    {
41
+    protected function getEndpoint() {
44 42
         return 'leadgen_forms';
45 43
     }
46 44
 
47 45
     /**
48 46
      * @return LeadgenFormFields
49 47
      */
50
-    public static function getFieldsEnum()
51
-    {
48
+    public static function getFieldsEnum() {
52 49
         return LeadgenFormFields::getInstance();
53 50
     }
54 51
 
Please login to merge, or discard this patch.
src/FacebookAds/Object/AdAccountGroup.php 1 patch
Braces   +10 added lines, -20 removed lines patch added patch discarded remove patch
@@ -30,8 +30,7 @@  discard block
 block discarded – undo
30 30
 use FacebookAds\Object\Fields\AdAccountGroupFields;
31 31
 use FacebookAds\Object\Traits\FieldValidation;
32 32
 
33
-class AdAccountGroup extends AbstractCrudObject
34
-{
33
+class AdAccountGroup extends AbstractCrudObject {
35 34
     use FieldValidation;
36 35
 
37 36
     /**
@@ -39,24 +38,21 @@  discard block
 block discarded – undo
39 38
      * @param string $parent_id Parent ID for AdAccountGroup is always "me"
40 39
      * @param Api $api The Api instance this object should use to make calls
41 40
      */
42
-    public function __construct($id = null, $parent_id = null, Api $api = null)
43
-    {
41
+    public function __construct($id = null, $parent_id = null, Api $api = null) {
44 42
         parent::__construct($id, 'me', $api);
45 43
     }
46 44
 
47 45
     /**
48 46
      * @return string
49 47
      */
50
-    protected function getEndpoint()
51
-    {
48
+    protected function getEndpoint() {
52 49
         return 'adaccountgroups';
53 50
     }
54 51
 
55 52
     /**
56 53
      * @return AdAccountGroupFields
57 54
      */
58
-    public static function getFieldsEnum()
59
-    {
55
+    public static function getFieldsEnum() {
60 56
         return AdAccountGroupFields::getInstance();
61 57
     }
62 58
 
@@ -96,8 +92,7 @@  discard block
 block discarded – undo
96 92
      * @param array $params
97 93
      * @return Cursor
98 94
      */
99
-    public function getUsers(array $fields = array(), array $params = array())
100
-    {
95
+    public function getUsers(array $fields = array(), array $params = array()) {
101 96
         return $this->getConnectedObjects(AdAccountGroupUser::className(), $fields, $params, 'users');
102 97
     }
103 98
 
@@ -119,8 +114,7 @@  discard block
 block discarded – undo
119 114
      * @param array $roles list of user's roles indexed by user id
120 115
      * @return bool
121 116
      */
122
-    public function addUsers(array $roles)
123
-    {
117
+    public function addUsers(array $roles) {
124 118
         $params = array();
125 119
         foreach ($roles as $uid => $role) {
126 120
             $params[] = array(
@@ -142,8 +136,7 @@  discard block
 block discarded – undo
142 136
      * @param array $roles list of user's roles indexed by user id
143 137
      * @return bool
144 138
      */
145
-    public function updateUsers(array $roles)
146
-    {
139
+    public function updateUsers(array $roles) {
147 140
         $params = array();
148 141
         foreach ($roles as $uid => $role) {
149 142
             $params[] = array(
@@ -165,8 +158,7 @@  discard block
 block discarded – undo
165 158
      * @param $user_id
166 159
      * @return bool
167 160
      */
168
-    public function removeUser($user_id)
169
-    {
161
+    public function removeUser($user_id) {
170 162
         return $this->getApi()->call(
171 163
             '/'.$this->assureId().'/users/'.$user_id,
172 164
             RequestInterface::METHOD_DELETE
@@ -179,8 +171,7 @@  discard block
 block discarded – undo
179 171
      * @param array $account_ids list of ad account ids to be added
180 172
      * @return bool
181 173
      */
182
-    public function addAdAccounts(array $account_ids)
183
-    {
174
+    public function addAdAccounts(array $account_ids) {
184 175
         return $this->getApi()->call(
185 176
             '/'.$this->assureId().'/adaccounts',
186 177
             RequestInterface::METHOD_POST,
@@ -194,8 +185,7 @@  discard block
 block discarded – undo
194 185
      * @param $account_id
195 186
      * @return bool
196 187
      */
197
-    public function removeAdAccount($account_id)
198
-    {
188
+    public function removeAdAccount($account_id) {
199 189
         return $this->getApi()->call(
200 190
             '/'.$this->assureId().'/adaccounts/'.$account_id,
201 191
             RequestInterface::METHOD_DELETE
Please login to merge, or discard this patch.