@@ -24,13 +24,11 @@ discard block |
||
24 | 24 | |
25 | 25 | namespace FacebookAds\Http\Adapter\Curl; |
26 | 26 | |
27 | -class Curl55 extends AbstractCurl |
|
28 | -{ |
|
27 | +class Curl55 extends AbstractCurl { |
|
29 | 28 | /** |
30 | 29 | * @throws \RuntimeException |
31 | 30 | */ |
32 | - public function __construct() |
|
33 | - { |
|
31 | + public function __construct() { |
|
34 | 32 | parent::__construct(); |
35 | 33 | if (version_compare(PHP_VERSION, '5.5.0') < 0) { |
36 | 34 | throw new \RuntimeException("Unsupported Curl version"); |
@@ -41,8 +39,7 @@ discard block |
||
41 | 39 | * @param string $string |
42 | 40 | * @return bool|string |
43 | 41 | */ |
44 | - public function escape($string) |
|
45 | - { |
|
42 | + public function escape($string) { |
|
46 | 43 | return curl_escape($this->handle, $string); |
47 | 44 | } |
48 | 45 | |
@@ -50,8 +47,7 @@ discard block |
||
50 | 47 | * @param int $bitmask |
51 | 48 | * @return int |
52 | 49 | */ |
53 | - public function pause($bitmask) |
|
54 | - { |
|
50 | + public function pause($bitmask) { |
|
55 | 51 | return curl_pause($this->handle, $bitmask); |
56 | 52 | } |
57 | 53 | |
@@ -59,16 +55,14 @@ discard block |
||
59 | 55 | * @param string $filepath |
60 | 56 | * @return \CURLFile |
61 | 57 | */ |
62 | - public function preparePostFileField($filepath) |
|
63 | - { |
|
58 | + public function preparePostFileField($filepath) { |
|
64 | 59 | return new \CURLFile($filepath); |
65 | 60 | } |
66 | 61 | |
67 | 62 | /** |
68 | 63 | * @return void |
69 | 64 | */ |
70 | - public function reset() |
|
71 | - { |
|
65 | + public function reset() { |
|
72 | 66 | $this->handle && curl_reset($this->handle); |
73 | 67 | } |
74 | 68 | |
@@ -76,8 +70,7 @@ discard block |
||
76 | 70 | * @param int $errornum |
77 | 71 | * @return NULL|string |
78 | 72 | */ |
79 | - public static function strerror($errornum) |
|
80 | - { |
|
73 | + public static function strerror($errornum) { |
|
81 | 74 | return curl_strerror($errornum); |
82 | 75 | } |
83 | 76 | |
@@ -85,8 +78,7 @@ discard block |
||
85 | 78 | * @param string $string |
86 | 79 | * @return bool|string |
87 | 80 | */ |
88 | - public function unescape($string) |
|
89 | - { |
|
81 | + public function unescape($string) { |
|
90 | 82 | return curl_unescape($this->handle, $string); |
91 | 83 | } |
92 | 84 | } |
@@ -24,13 +24,11 @@ discard block |
||
24 | 24 | |
25 | 25 | namespace FacebookAds\Http; |
26 | 26 | |
27 | -class Parameters extends \ArrayObject |
|
28 | -{ |
|
27 | +class Parameters extends \ArrayObject { |
|
29 | 28 | /** |
30 | 29 | * @param array $data |
31 | 30 | */ |
32 | - public function enhance(array $data) |
|
33 | - { |
|
31 | + public function enhance(array $data) { |
|
34 | 32 | foreach ($data as $key => $value) { |
35 | 33 | $this[$key] = $value; |
36 | 34 | } |
@@ -40,16 +38,14 @@ discard block |
||
40 | 38 | * @param mixed $value |
41 | 39 | * @return string |
42 | 40 | */ |
43 | - protected function exportNonScalar($value) |
|
44 | - { |
|
41 | + protected function exportNonScalar($value) { |
|
45 | 42 | return json_encode($value); |
46 | 43 | } |
47 | 44 | |
48 | 45 | /** |
49 | 46 | * @return array |
50 | 47 | */ |
51 | - public function export() |
|
52 | - { |
|
48 | + public function export() { |
|
53 | 49 | $data = array(); |
54 | 50 | foreach ($this as $key => $value) { |
55 | 51 | $data[$key] = is_null($value) || is_scalar($value) |
@@ -24,6 +24,5 @@ |
||
24 | 24 | |
25 | 25 | namespace FacebookAds\Exception; |
26 | 26 | |
27 | -class Exception extends \Exception |
|
28 | -{ |
|
27 | +class Exception extends \Exception { |
|
29 | 28 | } |
@@ -24,8 +24,7 @@ discard block |
||
24 | 24 | |
25 | 25 | namespace FacebookAds\Logger\CurlLogger; |
26 | 26 | |
27 | -final class JsonNode |
|
28 | -{ |
|
27 | +final class JsonNode { |
|
29 | 28 | /** |
30 | 29 | * @var int |
31 | 30 | */ |
@@ -51,8 +50,7 @@ discard block |
||
51 | 50 | * @return $this |
52 | 51 | * @throws \InvalidArgumentException |
53 | 52 | */ |
54 | - public static function factory($value) |
|
55 | - { |
|
53 | + public static function factory($value) { |
|
56 | 54 | $object = new self(); |
57 | 55 | switch (true) { |
58 | 56 | case is_object($value): |
@@ -73,16 +71,14 @@ discard block |
||
73 | 71 | return $object; |
74 | 72 | } |
75 | 73 | |
76 | - public function __construct() |
|
77 | - { |
|
74 | + public function __construct() { |
|
78 | 75 | $this->children = new \ArrayObject(); |
79 | 76 | } |
80 | 77 | |
81 | 78 | /** |
82 | 79 | * @return mixed |
83 | 80 | */ |
84 | - public function getValue() |
|
85 | - { |
|
81 | + public function getValue() { |
|
86 | 82 | return $this->value; |
87 | 83 | } |
88 | 84 | |
@@ -90,8 +86,7 @@ discard block |
||
90 | 86 | * @param mixed $value |
91 | 87 | * @return $this |
92 | 88 | */ |
93 | - public function setValue($value) |
|
94 | - { |
|
89 | + public function setValue($value) { |
|
95 | 90 | $this->value = $value; |
96 | 91 | |
97 | 92 | return $this; |
@@ -100,16 +95,14 @@ discard block |
||
100 | 95 | /** |
101 | 96 | * @return \ArrayObject |
102 | 97 | */ |
103 | - public function getChildren() |
|
104 | - { |
|
98 | + public function getChildren() { |
|
105 | 99 | return $this->children; |
106 | 100 | } |
107 | 101 | |
108 | 102 | /** |
109 | 103 | * @return int |
110 | 104 | */ |
111 | - public function getMaxTreeChildrenCount() |
|
112 | - { |
|
105 | + public function getMaxTreeChildrenCount() { |
|
113 | 106 | $max = $this->getChildren()->count(); |
114 | 107 | |
115 | 108 | /** @var JsonNode $child */ |
@@ -125,16 +118,14 @@ discard block |
||
125 | 118 | * @param int $indent |
126 | 119 | * @return string |
127 | 120 | */ |
128 | - protected function getPadding($indent) |
|
129 | - { |
|
121 | + protected function getPadding($indent) { |
|
130 | 122 | return str_repeat(' ', $indent * self::INDENT_UNIT); |
131 | 123 | } |
132 | 124 | |
133 | 125 | /** |
134 | 126 | * @return mixed |
135 | 127 | */ |
136 | - protected function getLastChildKey() |
|
137 | - { |
|
128 | + protected function getLastChildKey() { |
|
138 | 129 | if ($this->getChildren()->count() === 0) { |
139 | 130 | return null; |
140 | 131 | } |
@@ -149,8 +140,7 @@ discard block |
||
149 | 140 | * @param int $indent |
150 | 141 | * @return string |
151 | 142 | */ |
152 | - protected function encodeList($indent) |
|
153 | - { |
|
143 | + protected function encodeList($indent) { |
|
154 | 144 | $value = $this->getValue(); |
155 | 145 | if (empty($value) || (array_keys($value) === range(0, count($value) - 1))) { |
156 | 146 | $is_map = false; |
@@ -184,8 +174,7 @@ discard block |
||
184 | 174 | * @param int $indent |
185 | 175 | * @return string |
186 | 176 | */ |
187 | - public function encode($indent = 0) |
|
188 | - { |
|
177 | + public function encode($indent = 0) { |
|
189 | 178 | $value = $this->getValue(); |
190 | 179 | if (is_array($value) || is_object($value)) { |
191 | 180 | if ($this->getMaxTreeChildrenCount() > 2) { |
@@ -26,14 +26,12 @@ |
||
26 | 26 | |
27 | 27 | use FacebookAds\Http\Parameters; |
28 | 28 | |
29 | -class JsonAwareParameters extends Parameters |
|
30 | -{ |
|
29 | +class JsonAwareParameters extends Parameters { |
|
31 | 30 | /** |
32 | 31 | * @param mixed $value |
33 | 32 | * @return string |
34 | 33 | */ |
35 | - protected function exportNonScalar($value) |
|
36 | - { |
|
34 | + protected function exportNonScalar($value) { |
|
37 | 35 | return JsonNode::factory($value)->encode(); |
38 | 36 | } |
39 | 37 | } |
@@ -27,15 +27,13 @@ discard block |
||
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 |
||
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 |
||
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 | } |
@@ -27,8 +27,7 @@ |
||
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 |