@@ -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 | } |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | $arguments = array_merge([$user['uid']], $arguments); |
71 | 71 | unset($user['uid']); |
72 | 72 | |
73 | - $body = $this->body->withMethod(self::TOPIC . '_add') |
|
73 | + $body = $this->body->withMethod(self::TOPIC.'_add') |
|
74 | 74 | ->withArguments($arguments) |
75 | 75 | ->withAddedOptions(array_merge($defaultOptions, $user, $options)); |
76 | 76 | |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | 'rights' => false, |
87 | 87 | ]; |
88 | 88 | |
89 | - $body = $this->body->withMethod(self::TOPIC . '_show') |
|
89 | + $body = $this->body->withMethod(self::TOPIC.'_show') |
|
90 | 90 | ->withArguments($arguments) |
91 | 91 | ->withAddedOptions(array_merge($defaultOptions, $options)); |
92 | 92 | |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | 'whoami' => false, |
109 | 109 | ]; |
110 | 110 | |
111 | - $body = $this->body->withMethod(self::TOPIC . '_find') |
|
111 | + $body = $this->body->withMethod(self::TOPIC.'_find') |
|
112 | 112 | ->withArguments($arguments) |
113 | 113 | ->withAddedOptions(array_merge($defaultOptions, $options)); |
114 | 114 | |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | |
139 | 139 | $arguments = array_merge([$uid], $arguments); |
140 | 140 | |
141 | - $body = $this->body->withMethod(self::TOPIC . '_mod') |
|
141 | + $body = $this->body->withMethod(self::TOPIC.'_mod') |
|
142 | 142 | ->withArguments($arguments) |
143 | 143 | ->withAddedOptions(array_merge($defaultOptions, $newData, $options)); |
144 | 144 | |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | $defaultOptions = [ |
151 | 151 | ]; |
152 | 152 | |
153 | - $body = $this->body->withMethod(self::TOPIC . '_del') |
|
153 | + $body = $this->body->withMethod(self::TOPIC.'_del') |
|
154 | 154 | ->withArguments($arguments) |
155 | 155 | ->withAddedOptions(array_merge($defaultOptions, $options)); |
156 | 156 | |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | |
160 | 160 | public function __call($name, $arguments) |
161 | 161 | { |
162 | - if (strncmp($name, 'findBy', 6) === 0 && strlen($name) > 6) { |
|
162 | + if (strncmp($name, 'findBy', 6) === 0 && strlen($name)>6) { |
|
163 | 163 | $field = str_replace('findBy', '', $name); |
164 | 164 | $field = strtolower($field); // Sn => sn |
165 | 165 | // #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( |
@@ -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) : null), |
|
161 | + 'method' => $this->method.($this->methodVersion !== null ? sprintf('/%s', $this->methodVersion) : null), |
|
162 | 162 | 'params' => [$this->arguments, $this->options], |
163 | 163 | 'id' => $this->id, |
164 | 164 | ]; |
@@ -72,7 +72,7 @@ |
||
72 | 72 | $psrHttpClient = $this->psrHttpClient; |
73 | 73 | if ($psrHttpClient === null) { |
74 | 74 | // #TODO setup docs.php-http.org/en/latest/clients/socket-client.html too |
75 | - if (!class_exists('\Http\Client\Curl\Client')) { |
|
75 | + if ( ! class_exists('\Http\Client\Curl\Client')) { |
|
76 | 76 | throw new RuntimeException('Specify a HTTP client or install php-http/curl-client'); |
77 | 77 | } |
78 | 78 |
@@ -33,7 +33,7 @@ |
||
33 | 33 | throw new JsonException(sprintf('Unable to encode json. Error was: "%s".', json_last_error_msg())); |
34 | 34 | } |
35 | 35 | |
36 | - return (string)$encoded; |
|
36 | + return (string) $encoded; |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | /** |
@@ -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 | } |