Completed
Pull Request — master (#191)
by Emanuele
03:10
created
src/FacebookAds/Object/AdAccountGroupUser.php 1 patch
Braces   +11 added lines, -22 removed lines patch added patch discarded remove patch
@@ -29,8 +29,7 @@  discard block
 block discarded – undo
29 29
 use FacebookAds\Object\Fields\AdAccountGroupUserFields;
30 30
 use FacebookAds\Object\Traits\FieldValidation;
31 31
 
32
-class AdAccountGroupUser extends AbstractObject
33
-{
32
+class AdAccountGroupUser extends AbstractObject {
34 33
     use FieldValidation;
35 34
 
36 35
     /**
@@ -62,8 +61,7 @@  discard block
 block discarded – undo
62 61
      * @param string $ad_account_group_id
63 62
      * @param Api $api
64 63
      */
65
-    public function __construct($ad_account_group_id, Api $api = null)
66
-    {
64
+    public function __construct($ad_account_group_id, Api $api = null) {
67 65
         $this->adAccountGroupId = $ad_account_group_id;
68 66
         $this->api = $api;
69 67
     }
@@ -71,24 +69,21 @@  discard block
 block discarded – undo
71 69
     /**
72 70
      * @return AdAccountGroupUserFields
73 71
      */
74
-    public static function getFieldsEnum()
75
-    {
72
+    public static function getFieldsEnum() {
76 73
         return AdAccountGroupUserFields::getInstance();
77 74
     }
78 75
 
79 76
     /**
80 77
      * @return Api
81 78
      */
82
-    public function getApi()
83
-    {
79
+    public function getApi() {
84 80
         return $this->api;
85 81
     }
86 82
 
87 83
     /**
88 84
      * @return string
89 85
      */
90
-    public function getParentId()
91
-    {
86
+    public function getParentId() {
92 87
         return $this->adAccountGroupId;
93 88
     }
94 89
 
@@ -96,8 +91,7 @@  discard block
 block discarded – undo
96 91
      * @param array $params
97 92
      * @return $this
98 93
      */
99
-    public function create(array $params = array())
100
-    {
94
+    public function create(array $params = array()) {
101 95
         return $this->save($params);
102 96
     }
103 97
 
@@ -105,8 +99,7 @@  discard block
 block discarded – undo
105 99
      * @param array $params
106 100
      * @return $this
107 101
      */
108
-    public function update(array $params = array())
109
-    {
102
+    public function update(array $params = array()) {
110 103
         return $this->save($params);
111 104
     }
112 105
 
@@ -114,8 +107,7 @@  discard block
 block discarded – undo
114 107
      * @return string
115 108
      * @throws \Exception
116 109
      */
117
-    protected function assureId()
118
-    {
110
+    protected function assureId() {
119 111
         if (!$this->data[AdAccountGroupUserFields::UID]) {
120 112
             throw new \Exception(AdAccountGroupUserFields::UID.' field must be set');
121 113
         }
@@ -127,8 +119,7 @@  discard block
 block discarded – undo
127 119
      * @param array $params
128 120
      * @return $this
129 121
      */
130
-    public function save(array $params = array())
131
-    {
122
+    public function save(array $params = array()) {
132 123
         $this->assureId();
133 124
 
134 125
         $this->getApi()->call(
@@ -143,8 +134,7 @@  discard block
 block discarded – undo
143 134
      * @param array $params
144 135
      * @throws \Exception
145 136
      */
146
-    public function delete(array $params = array())
147
-    {
137
+    public function delete(array $params = array()) {
148 138
         if (!$this->data[AdAccountGroupUserFields::UID]) {
149 139
             throw new \Exception("UID field must be set");
150 140
         }
@@ -160,8 +150,7 @@  discard block
 block discarded – undo
160 150
     /**
161 151
      * @return AdUser
162 152
      */
163
-    public function getAdUser()
164
-    {
153
+    public function getAdUser() {
165 154
         return new AdUser($this->{AdAccountGroupUserFields::UID});
166 155
     }
167 156
 }
Please login to merge, or discard this patch.
src/FacebookAds/Enum/AbstractEnum.php 1 patch
Braces   +13 added lines, -26 removed lines patch added patch discarded remove patch
@@ -24,8 +24,7 @@  discard block
 block discarded – undo
24 24
 
25 25
 namespace FacebookAds\Enum;
26 26
 
27
-abstract class AbstractEnum implements EnumInstanceInterface
28
-{
27
+abstract class AbstractEnum implements EnumInstanceInterface {
29 28
     /**
30 29
      * @var array|null
31 30
      */
@@ -54,16 +53,14 @@  discard block
 block discarded – undo
54 53
     /**
55 54
      * @return string
56 55
      */
57
-    public static function className()
58
-    {
56
+    public static function className() {
59 57
         return get_called_class();
60 58
     }
61 59
 
62 60
     /**
63 61
      * @return AbstractEnum
64 62
      */
65
-    public static function getInstance()
66
-    {
63
+    public static function getInstance() {
67 64
         $fqn = get_called_class();
68 65
         if (!array_key_exists($fqn, static::$instances)) {
69 66
             static::$instances[$fqn] = new static();
@@ -75,8 +72,7 @@  discard block
 block discarded – undo
75 72
     /**
76 73
      * @return array
77 74
      */
78
-    public function getArrayCopy()
79
-    {
75
+    public function getArrayCopy() {
80 76
         if ($this->map === null) {
81 77
             $this->map = (new \ReflectionClass(get_called_class()))
82 78
                 ->getConstants();
@@ -88,8 +84,7 @@  discard block
 block discarded – undo
88 84
     /**
89 85
      * @return array
90 86
      */
91
-    public function getNames()
92
-    {
87
+    public function getNames() {
93 88
         if ($this->names === null) {
94 89
             $this->names = array_keys($this->getArrayCopy());
95 90
         }
@@ -100,8 +95,7 @@  discard block
 block discarded – undo
100 95
     /**
101 96
      * @return array
102 97
      */
103
-    public function getValues()
104
-    {
98
+    public function getValues() {
105 99
         if ($this->values === null) {
106 100
             $this->values = array_values($this->getArrayCopy());
107 101
         }
@@ -112,8 +106,7 @@  discard block
 block discarded – undo
112 106
     /**
113 107
      * @return array
114 108
      */
115
-    public function getValuesMap()
116
-    {
109
+    public function getValuesMap() {
117 110
         if ($this->valuesMap === null) {
118 111
             $this->valuesMap = array_fill_keys($this->getValues(), null);
119 112
         }
@@ -125,8 +118,7 @@  discard block
 block discarded – undo
125 118
      * @param string|int|float $name
126 119
      * @return mixed
127 120
      */
128
-    public function getValueForName($name)
129
-    {
121
+    public function getValueForName($name) {
130 122
         return array_key_exists($name, $this->getArrayCopy())
131 123
             ? $this->getArrayCopy()[$name]
132 124
             : null;
@@ -137,8 +129,7 @@  discard block
 block discarded – undo
137 129
      * @return mixed
138 130
      * @throws \InvalidArgumentException
139 131
      */
140
-    public function assureValueForName($name)
141
-    {
132
+    public function assureValueForName($name) {
142 133
         $value = $this->getValueForName($name);
143 134
         if ($value === null) {
144 135
             throw new \InvalidArgumentException('Unknown name "'.$name.'" in '.static::className());
@@ -151,8 +142,7 @@  discard block
 block discarded – undo
151 142
      * @param string|int|float $name
152 143
      * @return bool
153 144
      */
154
-    public function isValid($name)
155
-    {
145
+    public function isValid($name) {
156 146
         return array_key_exists($name, $this->getArrayCopy());
157 147
     }
158 148
 
@@ -160,8 +150,7 @@  discard block
 block discarded – undo
160 150
      * @param string|int|float $name
161 151
      * @throws \InvalidArgumentException
162 152
      */
163
-    public function assureIsValid($name)
164
-    {
153
+    public function assureIsValid($name) {
165 154
         if (!array_key_exists($name, $this->getArrayCopy())) {
166 155
             throw new \InvalidArgumentException('Unknown name "'.$name.'" in '.static::className());
167 156
         }
@@ -171,8 +160,7 @@  discard block
 block discarded – undo
171 160
      * @param string|int|float $value
172 161
      * @return bool
173 162
      */
174
-    public function isValidValue($value)
175
-    {
163
+    public function isValidValue($value) {
176 164
         return array_key_exists($value, $this->getValuesMap());
177 165
     }
178 166
 
@@ -180,8 +168,7 @@  discard block
 block discarded – undo
180 168
      * @param mixed $value
181 169
      * @throws \InvalidArgumentException
182 170
      */
183
-    public function assureIsValidValue($value)
184
-    {
171
+    public function assureIsValidValue($value) {
185 172
         if (!$this->isValidValue($value)) {
186 173
             throw new \InvalidArgumentException('"'.$value.'", not a valid value in '.static::className());
187 174
         }
Please login to merge, or discard this patch.
src/FacebookAds/Enum/EnumInstanceInterface.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -24,8 +24,7 @@
 block discarded – undo
24 24
 
25 25
 namespace FacebookAds\Enum;
26 26
 
27
-interface EnumInstanceInterface
28
-{
27
+interface EnumInstanceInterface {
29 28
     /**
30 29
      * @return EnumInstanceInterface
31 30
      */
Please login to merge, or discard this patch.
src/FacebookAds/Enum/EmptyEnum.php 1 patch
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -24,37 +24,32 @@
 block discarded – undo
24 24
 
25 25
 namespace FacebookAds\Enum;
26 26
 
27
-class EmptyEnum extends AbstractEnum
28
-{
27
+class EmptyEnum extends AbstractEnum {
29 28
     /**
30 29
      * @return array
31 30
      */
32
-    public function getArrayCopy()
33
-    {
31
+    public function getArrayCopy() {
34 32
         return array();
35 33
     }
36 34
 
37 35
     /**
38 36
      * @return array
39 37
      */
40
-    public function getNames()
41
-    {
38
+    public function getNames() {
42 39
         return array();
43 40
     }
44 41
 
45 42
     /**
46 43
      * @return array
47 44
      */
48
-    public function getValues()
49
-    {
45
+    public function getValues() {
50 46
         return array();
51 47
     }
52 48
 
53 49
     /**
54 50
      * @return array
55 51
      */
56
-    public function getValuesMap()
57
-    {
52
+    public function getValuesMap() {
58 53
         return array();
59 54
     }
60 55
 }
Please login to merge, or discard this patch.
src/FacebookAds/Session.php 1 patch
Braces   +6 added lines, -12 removed lines patch added patch discarded remove patch
@@ -24,8 +24,7 @@  discard block
 block discarded – undo
24 24
 
25 25
 namespace FacebookAds;
26 26
 
27
-class Session
28
-{
27
+class Session {
29 28
     /**
30 29
      * @var string
31 30
      */
@@ -51,8 +50,7 @@  discard block
 block discarded – undo
51 50
      * @param string $app_secret
52 51
      * @param string $access_token
53 52
      */
54
-    public function __construct($app_id, $app_secret, $access_token)
55
-    {
53
+    public function __construct($app_id, $app_secret, $access_token) {
56 54
         $this->appId = $app_id;
57 55
         $this->appSecret = $app_secret;
58 56
         $this->accessToken = $access_token;
@@ -61,32 +59,28 @@  discard block
 block discarded – undo
61 59
     /**
62 60
      * @return string
63 61
      */
64
-    public function getAppId()
65
-    {
62
+    public function getAppId() {
66 63
         return $this->appId;
67 64
     }
68 65
 
69 66
     /**
70 67
      * @return string
71 68
      */
72
-    public function getAppSecret()
73
-    {
69
+    public function getAppSecret() {
74 70
         return $this->appSecret;
75 71
     }
76 72
 
77 73
     /**
78 74
      * @return string
79 75
      */
80
-    public function getAccessToken()
81
-    {
76
+    public function getAccessToken() {
82 77
         return $this->accessToken;
83 78
     }
84 79
 
85 80
     /**
86 81
      * @return string
87 82
      */
88
-    public function getAppSecretProof()
89
-    {
83
+    public function getAppSecretProof() {
90 84
         if ($this->appSecretProof === null) {
91 85
             $this->appSecretProof = hash_hmac('sha256', $this->getAccessToken(), $this->getAppSecret());
92 86
         }
Please login to merge, or discard this patch.
src/FacebookAds/Http/Util.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -24,8 +24,7 @@  discard block
 block discarded – undo
24 24
 
25 25
 namespace FacebookAds\Http;
26 26
 
27
-abstract class Util
28
-{
27
+abstract class Util {
29 28
     /**
30 29
      * Avoid parse_str() for HHVM compatibility
31 30
      * This implementation is not a complete sobstitute, but covers all the
@@ -35,8 +34,7 @@  discard block
 block discarded – undo
35 34
      * @param $query_string
36 35
      * @return array
37 36
      */
38
-    public static function parseUrlQuery($query_string)
39
-    {
37
+    public static function parseUrlQuery($query_string) {
40 38
         $query = array();
41 39
         $pairs = explode('&', $query_string);
42 40
         foreach ($pairs as $pair) {
Please login to merge, or discard this patch.
src/FacebookAds/Http/Client.php 1 patch
Braces   +16 added lines, -32 removed lines patch added patch discarded remove patch
@@ -30,8 +30,7 @@  discard block
 block discarded – undo
30 30
 use FacebookAds\Http\Exception\EmptyResponseException;
31 31
 use FacebookAds\Http\Exception\RequestException;
32 32
 
33
-class Client
34
-{
33
+class Client {
35 34
     /**
36 35
      * @var string
37 36
      */
@@ -75,8 +74,7 @@  discard block
 block discarded – undo
75 74
     /**
76 75
      * @return RequestInterface
77 76
      */
78
-    public function getRequestPrototype()
79
-    {
77
+    public function getRequestPrototype() {
80 78
         if ($this->requestPrototype === null) {
81 79
             $this->requestPrototype = new Request($this);
82 80
         }
@@ -87,24 +85,21 @@  discard block
 block discarded – undo
87 85
     /**
88 86
      * @param RequestInterface $prototype
89 87
      */
90
-    public function setRequestPrototype(RequestInterface $prototype)
91
-    {
88
+    public function setRequestPrototype(RequestInterface $prototype) {
92 89
         $this->requestPrototype = $prototype;
93 90
     }
94 91
 
95 92
     /**
96 93
      * @return RequestInterface
97 94
      */
98
-    public function createRequest()
99
-    {
95
+    public function createRequest() {
100 96
         return $this->getRequestPrototype()->createClone();
101 97
     }
102 98
 
103 99
     /**
104 100
      * @return ResponseInterface
105 101
      */
106
-    public function getResponsePrototype()
107
-    {
102
+    public function getResponsePrototype() {
108 103
         if ($this->responsePrototype === null) {
109 104
             $this->responsePrototype = new Response();
110 105
         }
@@ -115,24 +110,21 @@  discard block
 block discarded – undo
115 110
     /**
116 111
      * @param ResponseInterface $prototype
117 112
      */
118
-    public function setResponsePrototype(ResponseInterface $prototype)
119
-    {
113
+    public function setResponsePrototype(ResponseInterface $prototype) {
120 114
         $this->responsePrototype = $prototype;
121 115
     }
122 116
 
123 117
     /**
124 118
      * @return ResponseInterface
125 119
      */
126
-    public function createResponse()
127
-    {
120
+    public function createResponse() {
128 121
         return clone $this->getResponsePrototype();
129 122
     }
130 123
 
131 124
     /**
132 125
      * @return Headers
133 126
      */
134
-    public function getDefaultRequestHeaderds()
135
-    {
127
+    public function getDefaultRequestHeaderds() {
136 128
         if ($this->defaultRequestHeaders === null) {
137 129
             $this->defaultRequestHeaders = new Headers(array(
138 130
                 'User-Agent' => 'fb-php-ads-'.Api::VERSION,
@@ -146,32 +138,28 @@  discard block
 block discarded – undo
146 138
     /**
147 139
      * @param Headers $headers
148 140
      */
149
-    public function setDefaultRequestHeaders(Headers $headers)
150
-    {
141
+    public function setDefaultRequestHeaders(Headers $headers) {
151 142
         $this->defaultRequestHeaders = $headers;
152 143
     }
153 144
 
154 145
     /**
155 146
      * @return string
156 147
      */
157
-    public function getDefaultGraphBaseDomain()
158
-    {
148
+    public function getDefaultGraphBaseDomain() {
159 149
         return $this->defaultGraphBaseDomain;
160 150
     }
161 151
 
162 152
     /**
163 153
      * @param string $domain
164 154
      */
165
-    public function setDefaultGraphBaseDomain($domain)
166
-    {
155
+    public function setDefaultGraphBaseDomain($domain) {
167 156
         $this->defaultGraphBaseDomain = $domain;
168 157
     }
169 158
 
170 159
     /**
171 160
      * @return AdapterInterface
172 161
      */
173
-    public function getAdapter()
174
-    {
162
+    public function getAdapter() {
175 163
         if ($this->adapter === null) {
176 164
             $this->adapter = new CurlAdapter($this);
177 165
         }
@@ -182,16 +170,14 @@  discard block
 block discarded – undo
182 170
     /**
183 171
      * @param AdapterInterface $adapter
184 172
      */
185
-    public function setAdapter(AdapterInterface $adapter)
186
-    {
173
+    public function setAdapter(AdapterInterface $adapter) {
187 174
         $this->adapter = $adapter;
188 175
     }
189 176
 
190 177
     /**
191 178
      * @return string
192 179
      */
193
-    public function getCaBundlePath()
194
-    {
180
+    public function getCaBundlePath() {
195 181
         if ($this->caBundlePath === null) {
196 182
             $this->caBundlePath = __DIR__.DIRECTORY_SEPARATOR
197 183
                 .str_repeat('..'.DIRECTORY_SEPARATOR, 3)
@@ -204,8 +190,7 @@  discard block
 block discarded – undo
204 190
     /**
205 191
      * @param string $path
206 192
      */
207
-    public function setCaBundlePath($path)
208
-    {
193
+    public function setCaBundlePath($path) {
209 194
         $this->caBundlePath = $path;
210 195
     }
211 196
 
@@ -214,8 +199,7 @@  discard block
 block discarded – undo
214 199
      * @return ResponseInterface
215 200
      * @throws RequestException
216 201
      */
217
-    public function sendRequest(RequestInterface $request)
218
-    {
202
+    public function sendRequest(RequestInterface $request) {
219 203
         $response = $this->getAdapter()->sendRequest($request);
220 204
         $response->setRequest($request);
221 205
         $response_content = $response->getContent();
Please login to merge, or discard this patch.
src/FacebookAds/Http/Headers.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -24,6 +24,5 @@
 block discarded – undo
24 24
 
25 25
 namespace FacebookAds\Http;
26 26
 
27
-class Headers extends \ArrayObject
28
-{
27
+class Headers extends \ArrayObject {
29 28
 }
Please login to merge, or discard this patch.
src/FacebookAds/Http/Response.php 1 patch
Braces   +10 added lines, -20 removed lines patch added patch discarded remove patch
@@ -24,8 +24,7 @@  discard block
 block discarded – undo
24 24
 
25 25
 namespace FacebookAds\Http;
26 26
 
27
-class Response implements ResponseInterface
28
-{
27
+class Response implements ResponseInterface {
29 28
     /**
30 29
      * @var RequestInterface
31 30
      */
@@ -54,40 +53,35 @@  discard block
 block discarded – undo
54 53
     /**
55 54
      * @return RequestInterface
56 55
      */
57
-    public function getRequest()
58
-    {
56
+    public function getRequest() {
59 57
         return $this->request;
60 58
     }
61 59
 
62 60
     /**
63 61
      * @param RequestInterface $request
64 62
      */
65
-    public function setRequest(RequestInterface $request)
66
-    {
63
+    public function setRequest(RequestInterface $request) {
67 64
         $this->request = $request;
68 65
     }
69 66
 
70 67
     /**
71 68
      * @return int
72 69
      */
73
-    public function getStatusCode()
74
-    {
70
+    public function getStatusCode() {
75 71
         return $this->statusCode;
76 72
     }
77 73
 
78 74
     /**
79 75
      * @param int $status_code
80 76
      */
81
-    public function setStatusCode($status_code)
82
-    {
77
+    public function setStatusCode($status_code) {
83 78
         $this->statusCode = $status_code;
84 79
     }
85 80
 
86 81
     /**
87 82
      * @return Headers
88 83
      */
89
-    public function getHeaders()
90
-    {
84
+    public function getHeaders() {
91 85
         if ($this->headers === null) {
92 86
             $this->headers = new Headers();
93 87
         }
@@ -98,24 +92,21 @@  discard block
 block discarded – undo
98 92
     /**
99 93
      * @param Headers $headers
100 94
      */
101
-    public function setHeaders(Headers $headers)
102
-    {
95
+    public function setHeaders(Headers $headers) {
103 96
         $this->headers = $headers;
104 97
     }
105 98
 
106 99
     /**
107 100
      * @return string
108 101
      */
109
-    public function getBody()
110
-    {
102
+    public function getBody() {
111 103
         return $this->body;
112 104
     }
113 105
 
114 106
     /**
115 107
      * @param string $body
116 108
      */
117
-    public function setBody($body)
118
-    {
109
+    public function setBody($body) {
119 110
         $this->body = $body;
120 111
         $this->content = null;
121 112
     }
@@ -123,8 +114,7 @@  discard block
 block discarded – undo
123 114
     /**
124 115
      * @return array|null
125 116
      */
126
-    public function getContent()
127
-    {
117
+    public function getContent() {
128 118
         if ($this->content === null) {
129 119
             $this->content = json_decode($this->getBody(), true);
130 120
         }
Please login to merge, or discard this patch.