@@ -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 | } |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | public function add($user, array $arguments = [], array $options = []): ResponseBodyInterface |
| 62 | 62 | { |
| 63 | 63 | if (\is_object($user)) { |
| 64 | - $user = (array)$user; |
|
| 64 | + $user = (array) $user; |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | $defaultOptions = [ |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | $arguments = array_merge([$user['uid']], $arguments); |
| 76 | 76 | unset($user['uid']); |
| 77 | 77 | |
| 78 | - $body = $this->body->withMethod(self::TOPIC . '_add') |
|
| 78 | + $body = $this->body->withMethod(self::TOPIC.'_add') |
|
| 79 | 79 | ->withArguments($arguments) |
| 80 | 80 | ->withAddedOptions(array_merge($defaultOptions, $user, $options)); |
| 81 | 81 | |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | 'rights' => false, |
| 92 | 92 | ]; |
| 93 | 93 | |
| 94 | - $body = $this->body->withMethod(self::TOPIC . '_show') |
|
| 94 | + $body = $this->body->withMethod(self::TOPIC.'_show') |
|
| 95 | 95 | ->withArguments($arguments) |
| 96 | 96 | ->withAddedOptions(array_merge($defaultOptions, $options)); |
| 97 | 97 | |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | 'whoami' => false, |
| 114 | 114 | ]; |
| 115 | 115 | |
| 116 | - $body = $this->body->withMethod(self::TOPIC . '_find') |
|
| 116 | + $body = $this->body->withMethod(self::TOPIC.'_find') |
|
| 117 | 117 | ->withArguments($arguments) |
| 118 | 118 | ->withAddedOptions(array_merge($defaultOptions, $options)); |
| 119 | 119 | |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | |
| 144 | 144 | $arguments = array_merge([$uid], $arguments); |
| 145 | 145 | |
| 146 | - $body = $this->body->withMethod(self::TOPIC . '_mod') |
|
| 146 | + $body = $this->body->withMethod(self::TOPIC.'_mod') |
|
| 147 | 147 | ->withArguments($arguments) |
| 148 | 148 | ->withAddedOptions(array_merge($defaultOptions, $newData, $options)); |
| 149 | 149 | |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | $defaultOptions = [ |
| 156 | 156 | ]; |
| 157 | 157 | |
| 158 | - $body = $this->body->withMethod(self::TOPIC . '_del') |
|
| 158 | + $body = $this->body->withMethod(self::TOPIC.'_del') |
|
| 159 | 159 | ->withArguments($arguments) |
| 160 | 160 | ->withAddedOptions(array_merge($defaultOptions, $options)); |
| 161 | 161 | |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | |
| 165 | 165 | public function __call($name, $arguments) |
| 166 | 166 | { |
| 167 | - if (strncmp($name, 'findBy', 6) === 0 && strlen($name) > 6) { |
|
| 167 | + if (strncmp($name, 'findBy', 6) === 0 && strlen($name)>6) { |
|
| 168 | 168 | $field = str_replace('findBy', '', $name); |
| 169 | 169 | $field = strtolower($field); // Sn => sn |
| 170 | 170 | // #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 | } |