@@ -71,8 +71,8 @@ discard block |
||
71 | 71 | unset($user['uid']); |
72 | 72 | |
73 | 73 | $body = $this->body->withMethod(self::TOPIC . '_add') |
74 | - ->withArguments($arguments) |
|
75 | - ->withAddedOptions(array_merge($defaultOptions, $user, $options)); |
|
74 | + ->withArguments($arguments) |
|
75 | + ->withAddedOptions(array_merge($defaultOptions, $user, $options)); |
|
76 | 76 | |
77 | 77 | return $this->client->sendRequest($body); |
78 | 78 | } |
@@ -87,8 +87,8 @@ discard block |
||
87 | 87 | ]; |
88 | 88 | |
89 | 89 | $body = $this->body->withMethod(self::TOPIC . '_show') |
90 | - ->withArguments($arguments) |
|
91 | - ->withAddedOptions(array_merge($defaultOptions, $options)); |
|
90 | + ->withArguments($arguments) |
|
91 | + ->withAddedOptions(array_merge($defaultOptions, $options)); |
|
92 | 92 | |
93 | 93 | return $this->client->sendRequest($body); |
94 | 94 | } |
@@ -109,8 +109,8 @@ discard block |
||
109 | 109 | ]; |
110 | 110 | |
111 | 111 | $body = $this->body->withMethod(self::TOPIC . '_find') |
112 | - ->withArguments($arguments) |
|
113 | - ->withAddedOptions(array_merge($defaultOptions, $options)); |
|
112 | + ->withArguments($arguments) |
|
113 | + ->withAddedOptions(array_merge($defaultOptions, $options)); |
|
114 | 114 | |
115 | 115 | return $this->client->sendRequest($body); |
116 | 116 | } |
@@ -139,8 +139,8 @@ discard block |
||
139 | 139 | $arguments = array_merge([$uid], $arguments); |
140 | 140 | |
141 | 141 | $body = $this->body->withMethod(self::TOPIC . '_mod') |
142 | - ->withArguments($arguments) |
|
143 | - ->withAddedOptions(array_merge($defaultOptions, $newData, $options)); |
|
142 | + ->withArguments($arguments) |
|
143 | + ->withAddedOptions(array_merge($defaultOptions, $newData, $options)); |
|
144 | 144 | |
145 | 145 | return $this->client->sendRequest($body); |
146 | 146 | } |
@@ -151,8 +151,8 @@ discard block |
||
151 | 151 | ]; |
152 | 152 | |
153 | 153 | $body = $this->body->withMethod(self::TOPIC . '_del') |
154 | - ->withArguments($arguments) |
|
155 | - ->withAddedOptions(array_merge($defaultOptions, $options)); |
|
154 | + ->withArguments($arguments) |
|
155 | + ->withAddedOptions(array_merge($defaultOptions, $options)); |
|
156 | 156 | |
157 | 157 | return $this->client->sendRequest($body); |
158 | 158 | } |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | public function add($user, array $arguments = [], array $options = []): ResponseBodyInterface |
69 | 69 | { |
70 | 70 | if (\is_object($user)) { |
71 | - $user = (array)$user; |
|
71 | + $user = (array) $user; |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | $defaultOptions = [ |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | $arguments = array_merge([$user['uid']], $arguments); |
83 | 83 | unset($user['uid']); |
84 | 84 | |
85 | - $body = $this->body->withMethod(self::TOPIC . '_add') |
|
85 | + $body = $this->body->withMethod(self::TOPIC.'_add') |
|
86 | 86 | ->withArguments($arguments) |
87 | 87 | ->withAddedOptions(array_merge($defaultOptions, $user, $options)); |
88 | 88 | |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | 'rights' => false, |
99 | 99 | ]; |
100 | 100 | |
101 | - $body = $this->body->withMethod(self::TOPIC . '_show') |
|
101 | + $body = $this->body->withMethod(self::TOPIC.'_show') |
|
102 | 102 | ->withArguments($arguments) |
103 | 103 | ->withAddedOptions(array_merge($defaultOptions, $options)); |
104 | 104 | |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | 'whoami' => false, |
121 | 121 | ]; |
122 | 122 | |
123 | - $body = $this->body->withMethod(self::TOPIC . '_find') |
|
123 | + $body = $this->body->withMethod(self::TOPIC.'_find') |
|
124 | 124 | ->withArguments($arguments) |
125 | 125 | ->withAddedOptions(array_merge($defaultOptions, $options)); |
126 | 126 | |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | |
151 | 151 | $arguments = array_merge([$uid], $arguments); |
152 | 152 | |
153 | - $body = $this->body->withMethod(self::TOPIC . '_mod') |
|
153 | + $body = $this->body->withMethod(self::TOPIC.'_mod') |
|
154 | 154 | ->withArguments($arguments) |
155 | 155 | ->withAddedOptions(array_merge($defaultOptions, $newData, $options)); |
156 | 156 | |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | $defaultOptions = [ |
163 | 163 | ]; |
164 | 164 | |
165 | - $body = $this->body->withMethod(self::TOPIC . '_del') |
|
165 | + $body = $this->body->withMethod(self::TOPIC.'_del') |
|
166 | 166 | ->withArguments($arguments) |
167 | 167 | ->withAddedOptions(array_merge($defaultOptions, $options)); |
168 | 168 | |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | |
172 | 172 | public function __call(string $name, array $arguments): ResponseBodyInterface |
173 | 173 | { |
174 | - if (strncmp($name, 'findBy', 6) === 0 && strlen($name) > 6) { |
|
174 | + if (strncmp($name, 'findBy', 6) === 0 && strlen($name)>6) { |
|
175 | 175 | $field = str_replace('findBy', '', $name); |
176 | 176 | $field = strtolower($field); // Sn => sn |
177 | 177 | // #TODO camelCase to snake_case em alguns casos (givenname excecao) |
@@ -33,7 +33,7 @@ |
||
33 | 33 | { |
34 | 34 | $body = $response->getBody(); |
35 | 35 | $body->rewind(); |
36 | - $jsonResponse = (object)Json::decode($body->getContents()); |
|
36 | + $jsonResponse = (object) Json::decode($body->getContents()); |
|
37 | 37 | |
38 | 38 | // #TODO handle results fields: count, total, summary, result |
39 | 39 | return new CommonBody( |
@@ -21,16 +21,16 @@ discard block |
||
21 | 21 | * This file contains examples of utilization of this library |
22 | 22 | */ |
23 | 23 | |
24 | -ini_set( 'display_errors', 1); |
|
25 | -ini_set( 'track_errors', 1); |
|
26 | -ini_set( 'html_errors', 1); |
|
27 | -error_reporting( E_ALL ); |
|
24 | +ini_set('display_errors', 1); |
|
25 | +ini_set('track_errors', 1); |
|
26 | +ini_set('html_errors', 1); |
|
27 | +error_reporting(E_ALL); |
|
28 | 28 | |
29 | -require_once( 'functions_utils.php' ); |
|
29 | +require_once('functions_utils.php'); |
|
30 | 30 | |
31 | 31 | $host = 'ipa.demo1.freeipa.org'; |
32 | 32 | // The certificate can be obtained in https://$host/ipa/config/ca.crt |
33 | -$certificate = __DIR__ . "/../certs/ipa.demo1.freeipa.org_ca.crt"; |
|
33 | +$certificate = __DIR__."/../certs/ipa.demo1.freeipa.org_ca.crt"; |
|
34 | 34 | $user = 'admin'; |
35 | 35 | $password = 'Secret123'; |
36 | 36 | $search = 'test'; |
@@ -109,8 +109,8 @@ discard block |
||
109 | 109 | if ($ret_search_users) { |
110 | 110 | $t = count($ret_search_users); |
111 | 111 | print "Found $t usuários. Names: "; |
112 | - for ($i = 0; $i < $t; $i++) { |
|
113 | - print $ret_search_users[$i]->uid[0] . " | "; |
|
112 | + for ($i = 0; $i<$t; $i++) { |
|
113 | + print $ret_search_users[$i]->uid[0]." | "; |
|
114 | 114 | } |
115 | 115 | _print(); |
116 | 116 | } else { |
@@ -4,18 +4,18 @@ |
||
4 | 4 | * Print a message |
5 | 5 | */ |
6 | 6 | function _print( $string = NULL ) { |
7 | - if ( 'cli' == php_sapi_name() ) { // PHP is running in terminal |
|
8 | - $line_end = PHP_EOL; |
|
9 | - } else { |
|
10 | - $line_end = '<br/>'; |
|
11 | - } |
|
7 | + if ( 'cli' == php_sapi_name() ) { // PHP is running in terminal |
|
8 | + $line_end = PHP_EOL; |
|
9 | + } else { |
|
10 | + $line_end = '<br/>'; |
|
11 | + } |
|
12 | 12 | |
13 | - if ( ! empty( $string ) ) { |
|
14 | - $file = basename( $_SERVER["PHP_SELF"] ); |
|
15 | - $output = date( 'd-m-Y_H:i:s ' ) . "[$file] $string $line_end"; |
|
16 | - } else { |
|
17 | - $output = $line_end; |
|
18 | - } |
|
13 | + if ( ! empty( $string ) ) { |
|
14 | + $file = basename( $_SERVER["PHP_SELF"] ); |
|
15 | + $output = date( 'd-m-Y_H:i:s ' ) . "[$file] $string $line_end"; |
|
16 | + } else { |
|
17 | + $output = $line_end; |
|
18 | + } |
|
19 | 19 | |
20 | - print ( $output ); |
|
20 | + print ( $output ); |
|
21 | 21 | } |
@@ -3,19 +3,19 @@ |
||
3 | 3 | /** |
4 | 4 | * Print a message |
5 | 5 | */ |
6 | -function _print( $string = NULL ) { |
|
7 | - if ( 'cli' == php_sapi_name() ) { // PHP is running in terminal |
|
6 | +function _print($string = NULL) { |
|
7 | + if ('cli' == php_sapi_name()) { // PHP is running in terminal |
|
8 | 8 | $line_end = PHP_EOL; |
9 | 9 | } else { |
10 | 10 | $line_end = '<br/>'; |
11 | 11 | } |
12 | 12 | |
13 | - if ( ! empty( $string ) ) { |
|
14 | - $file = basename( $_SERVER["PHP_SELF"] ); |
|
15 | - $output = date( 'd-m-Y_H:i:s ' ) . "[$file] $string $line_end"; |
|
13 | + if ( ! empty($string)) { |
|
14 | + $file = basename($_SERVER["PHP_SELF"]); |
|
15 | + $output = date('d-m-Y_H:i:s ')."[$file] $string $line_end"; |
|
16 | 16 | } else { |
17 | 17 | $output = $line_end; |
18 | 18 | } |
19 | 19 | |
20 | - print ( $output ); |
|
20 | + print ($output); |
|
21 | 21 | } |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | public function withOptions(array $options): Body |
129 | 129 | { |
130 | 130 | $new = clone $this; |
131 | - $new->options = (object)$options; |
|
131 | + $new->options = (object) $options; |
|
132 | 132 | |
133 | 133 | return $new; |
134 | 134 | } |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | public function withAddedOptions(array $options): Body |
140 | 140 | { |
141 | 141 | $new = clone $this; |
142 | - $new->options = (object)array_merge($options, (array)$new->options); |
|
142 | + $new->options = (object) array_merge($options, (array) $new->options); |
|
143 | 143 | |
144 | 144 | return $new; |
145 | 145 | } |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | public function jsonSerialize(): array |
159 | 159 | { |
160 | 160 | return [ |
161 | - 'method' => $this->method . ($this->methodVersion !== null ? sprintf('/%s', $this->methodVersion) : ''), |
|
161 | + 'method' => $this->method.($this->methodVersion !== null ? sprintf('/%s', $this->methodVersion) : ''), |
|
162 | 162 | 'params' => [$this->arguments, $this->options], |
163 | 163 | 'id' => $this->id, |
164 | 164 | ]; |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | throw new JsonException(sprintf('Unable to encode json. Error was: "%s".', json_last_error_msg())); |
37 | 37 | } |
38 | 38 | |
39 | - return (string)$encoded; |
|
39 | + return (string) $encoded; |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | /** |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | * @return array|stdClass |
50 | 50 | * @throws JsonException |
51 | 51 | */ |
52 | - public static function decode(string $json, bool $assoc = false, int $depth = 512, int $options = 0): array|stdClass |
|
52 | + public static function decode(string $json, bool $assoc = false, int $depth = 512, int $options = 0): array | stdClass |
|
53 | 53 | { |
54 | 54 | $decoded = json_decode($json, $assoc, $depth, $options); |
55 | 55 |
@@ -48,7 +48,7 @@ |
||
48 | 48 | /** |
49 | 49 | * {@inheritDoc} |
50 | 50 | */ |
51 | - public function getResult(): null|object |
|
51 | + public function getResult(): null | object |
|
52 | 52 | { |
53 | 53 | return $this->result; |
54 | 54 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | |
30 | 30 | private UriFactoryInterface $uriFactory; |
31 | 31 | |
32 | - private ResponseBodyBuilder|CommonBodyBuilder $responseBodyBuilder; |
|
32 | + private ResponseBodyBuilder | CommonBodyBuilder $responseBodyBuilder; |
|
33 | 33 | |
34 | 34 | private array $httpClientPlugins; |
35 | 35 | |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | $psrHttpClient = $this->psrHttpClient; |
72 | 72 | if ($psrHttpClient === null) { |
73 | 73 | // #TODO setup docs.php-http.org/en/latest/clients/socket-client.html too |
74 | - if (!class_exists('\Http\Client\Curl\Client')) { |
|
74 | + if ( ! class_exists('\Http\Client\Curl\Client')) { |
|
75 | 75 | throw new RuntimeException('Specify a HTTP client or install php-http/curl-client'); |
76 | 76 | } |
77 | 77 |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | 'raw' => false, |
65 | 65 | ]; |
66 | 66 | |
67 | - $body = $this->body->withMethod(self::TOPIC . '_find') |
|
67 | + $body = $this->body->withMethod(self::TOPIC.'_find') |
|
68 | 68 | ->withArguments($arguments) |
69 | 69 | ->withAddedOptions(array_merge($defaultOptions, $options)); |
70 | 70 | |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | 'no_members' => true, |
98 | 98 | ]; |
99 | 99 | |
100 | - $body = $this->body->withMethod(self::TOPIC . '_add_member') |
|
100 | + $body = $this->body->withMethod(self::TOPIC.'_add_member') |
|
101 | 101 | ->withArguments([ |
102 | 102 | $group, |
103 | 103 | ]) |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | |
111 | 111 | public function __call(string $name, array $arguments): ResponseBodyInterface |
112 | 112 | { |
113 | - if (strncmp($name, 'findBy', 6) === 0 && strlen($name) > 6) { |
|
113 | + if (strncmp($name, 'findBy', 6) === 0 && strlen($name)>6) { |
|
114 | 114 | $field = str_replace('findBy', '', $name); |
115 | 115 | $field = strtolower($field); // Sn => sn |
116 | 116 | // #TODO camelCase to snake_case em alguns casos (givenname excecao) |