@@ -3,7 +3,7 @@ discard block |
||
| 3 | 3 | use agoalofalife\bpmOnline\Api\JsonHandler; |
| 4 | 4 | use Illuminate\Container\Container; |
| 5 | 5 | |
| 6 | -if (! function_exists('XmlHandler')) { |
|
| 6 | +if (!function_exists('XmlHandler')) { |
|
| 7 | 7 | /** |
| 8 | 8 | * Just return object XmlHandler |
| 9 | 9 | * @return XmlHandler |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | |
| 18 | -if (! function_exists('JsonHandler')) { |
|
| 18 | +if (!function_exists('JsonHandler')) { |
|
| 19 | 19 | /** |
| 20 | 20 | * Just return object XmlHandler |
| 21 | 21 | * @return XmlHandler |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | |
| 30 | -if (! function_exists('config')) { |
|
| 30 | +if (!function_exists('config')) { |
|
| 31 | 31 | /** |
| 32 | 32 | * Get / set the specified configuration value. |
| 33 | 33 | * |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | } |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | -if (! function_exists('app')) { |
|
| 54 | +if (!function_exists('app')) { |
|
| 55 | 55 | /** |
| 56 | 56 | * Get the available container instance. |
| 57 | 57 | * |
@@ -9,12 +9,12 @@ discard block |
||
| 9 | 9 | private function xmlToArrayRecursive($xml) { |
| 10 | 10 | $xml = (array) $xml; |
| 11 | 11 | |
| 12 | - if(empty($xml)) { |
|
| 12 | + if (empty($xml)) { |
|
| 13 | 13 | return null; |
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | foreach ($xml as $key => $val) { |
| 17 | - if (is_array($val)){ |
|
| 17 | + if (is_array($val)) { |
|
| 18 | 18 | $xml[$key] = $this->xmlToArray($val); |
| 19 | 19 | } else { |
| 20 | 20 | if ($val instanceof SimpleXMLElement) { |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | private function xmlToArray($xml) { |
| 33 | 33 | $xml = (array) $xml; |
| 34 | 34 | |
| 35 | - if(empty($xml)) { |
|
| 35 | + if (empty($xml)) { |
|
| 36 | 36 | return null; |
| 37 | 37 | } |
| 38 | 38 | |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | */ |
| 48 | 48 | public function checkIntegrity($response) |
| 49 | 49 | { |
| 50 | - return isset( json_decode($response)->{$this->jsonPrefix} ); |
|
| 50 | + return isset( json_decode($response)->{$this->jsonPrefix} ); |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | /** |
@@ -88,12 +88,12 @@ discard block |
||
| 88 | 88 | { |
| 89 | 89 | $result[$key] = $this->objectToArray($value); |
| 90 | 90 | } else{ |
| 91 | - if (gettype($value) != 'object') |
|
| 92 | - { |
|
| 93 | - $result[$key] = $value; |
|
| 94 | - } else{ |
|
| 95 | - $result[$key] = get_object_vars($value); |
|
| 96 | - } |
|
| 91 | + if (gettype($value) != 'object') |
|
| 92 | + { |
|
| 93 | + $result[$key] = $value; |
|
| 94 | + } else{ |
|
| 95 | + $result[$key] = get_object_vars($value); |
|
| 96 | + } |
|
| 97 | 97 | |
| 98 | 98 | } |
| 99 | 99 | } |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | */ |
| 48 | 48 | public function checkIntegrity($response) |
| 49 | 49 | { |
| 50 | - return isset( json_decode($response)->{$this->jsonPrefix} ); |
|
| 50 | + return isset(json_decode($response)->{$this->jsonPrefix} ); |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | /** |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | |
| 74 | 74 | public function create(array $data) |
| 75 | 75 | { |
| 76 | - if ( empty($data)){ |
|
| 76 | + if (empty($data)) { |
|
| 77 | 77 | return $this->buildJson = '{}'; |
| 78 | 78 | } |
| 79 | 79 | return $this->buildJson = json_encode($data); |
@@ -87,11 +87,11 @@ discard block |
||
| 87 | 87 | if (gettype($value) == 'object') |
| 88 | 88 | { |
| 89 | 89 | $result[$key] = $this->objectToArray($value); |
| 90 | - } else{ |
|
| 90 | + } else { |
|
| 91 | 91 | if (gettype($value) != 'object') |
| 92 | 92 | { |
| 93 | 93 | $result[$key] = $value; |
| 94 | - } else{ |
|
| 94 | + } else { |
|
| 95 | 95 | $result[$key] = get_object_vars($value); |
| 96 | 96 | } |
| 97 | 97 | |
@@ -110,7 +110,7 @@ |
||
| 110 | 110 | } |
| 111 | 111 | $ParameterQuery.= " ".$param; |
| 112 | 112 | } |
| 113 | - $this->concatenationUrlCurl($ParameterQuery); |
|
| 113 | + $this->concatenationUrlCurl($ParameterQuery); |
|
| 114 | 114 | |
| 115 | 115 | return $this; |
| 116 | 116 | } |
@@ -74,8 +74,8 @@ discard block |
||
| 74 | 74 | */ |
| 75 | 75 | public function filterConstructor($strRequest) |
| 76 | 76 | { |
| 77 | - $ParameterQuery = '$filter='; |
|
| 78 | - $ParameterQuery.= $strRequest; |
|
| 77 | + $ParameterQuery = '$filter='; |
|
| 78 | + $ParameterQuery .= $strRequest; |
|
| 79 | 79 | $this->concatenationUrlCurl($ParameterQuery); |
| 80 | 80 | return $this; |
| 81 | 81 | } |
@@ -92,13 +92,13 @@ discard block |
||
| 92 | 92 | public function orderBy($whatSort, $param = 'asc') |
| 93 | 93 | { |
| 94 | 94 | $ParameterQuery = '$orderby='; |
| 95 | - $ParameterQuery.= ucfirst($whatSort); |
|
| 95 | + $ParameterQuery .= ucfirst($whatSort); |
|
| 96 | 96 | |
| 97 | - if ( empty($param) === false ) { |
|
| 97 | + if (empty($param) === false) { |
|
| 98 | 98 | if ($param != 'desc' && $param != 'asc') { |
| 99 | 99 | throw new \Exception('no valid orderby parameters'); |
| 100 | 100 | } |
| 101 | - $ParameterQuery.= " ".$param; |
|
| 101 | + $ParameterQuery .= " ".$param; |
|
| 102 | 102 | } |
| 103 | 103 | $this->concatenationUrlCurl($ParameterQuery); |
| 104 | 104 | |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | */ |
| 130 | 130 | public function amount($amountMax = null) |
| 131 | 131 | { |
| 132 | - Assert::that($amountMax,'You must specify a numeric parameter for the amount of the method')->integer(); |
|
| 132 | + Assert::that($amountMax, 'You must specify a numeric parameter for the amount of the method')->integer(); |
|
| 133 | 133 | $ParameterQuery = '$top='.$amountMax; |
| 134 | 134 | $this->concatenationUrlCurl($ParameterQuery); |
| 135 | 135 | return $this; |
@@ -141,10 +141,10 @@ discard block |
||
| 141 | 141 | private function query() |
| 142 | 142 | { |
| 143 | 143 | $parameters = str_replace(' ', '%20', $this->url); |
| 144 | - $url = $this->kernel->getCollection() . $parameters; |
|
| 145 | - $urlHome = config($this->kernel->getPrefixConfig() . '.UrlHome'); |
|
| 144 | + $url = $this->kernel->getCollection().$parameters; |
|
| 145 | + $urlHome = config($this->kernel->getPrefixConfig().'.UrlHome'); |
|
| 146 | 146 | |
| 147 | - $response = $this->kernel->getCurl()->request($this->HTTP_TYPE, $urlHome . $url, |
|
| 147 | + $response = $this->kernel->getCurl()->request($this->HTTP_TYPE, $urlHome.$url, |
|
| 148 | 148 | [ |
| 149 | 149 | 'headers' => [ |
| 150 | 150 | 'HTTP/1.0', |
@@ -157,11 +157,11 @@ discard block |
||
| 157 | 157 | ], |
| 158 | 158 | 'http_errors' => false |
| 159 | 159 | ]); |
| 160 | - $body = $response->getBody(); |
|
| 160 | + $body = $response->getBody(); |
|
| 161 | 161 | |
| 162 | 162 | $this->kernel->getHandler()->parse($body->getContents()); |
| 163 | 163 | |
| 164 | - if ( $response->getStatusCode() == 401 && $response->getReasonPhrase() == 'Unauthorized' ) |
|
| 164 | + if ($response->getStatusCode() == 401 && $response->getReasonPhrase() == 'Unauthorized') |
|
| 165 | 165 | { |
| 166 | 166 | $this->kernel->authentication(); |
| 167 | 167 | $this->query(); |
@@ -29,8 +29,8 @@ discard block |
||
| 29 | 29 | ]; |
| 30 | 30 | |
| 31 | 31 | protected $handlers = [ |
| 32 | - 'xml' => XmlHandler::class, |
|
| 33 | - 'json' => JsonHandler::class, |
|
| 32 | + 'xml' => XmlHandler::class, |
|
| 33 | + 'json' => JsonHandler::class, |
|
| 34 | 34 | ]; |
| 35 | 35 | |
| 36 | 36 | protected $collection; |
@@ -147,10 +147,10 @@ discard block |
||
| 147 | 147 | public function action($action, callable $callback) |
| 148 | 148 | { |
| 149 | 149 | |
| 150 | - extract($this->splitAction($action)); |
|
| 150 | + extract($this->splitAction($action)); |
|
| 151 | 151 | |
| 152 | - $action = $this->setAction($action); |
|
| 153 | - $this->setHandler($handler); |
|
| 152 | + $action = $this->setAction($action); |
|
| 153 | + $this->setHandler($handler); |
|
| 154 | 154 | |
| 155 | 155 | $action->injectionKernel($this); |
| 156 | 156 | call_user_func($callback, $action); |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | try { |
| 181 | 181 | Assertion::regex($collection, '/[A-z]+Collection$/'); |
| 182 | 182 | } catch(AssertionFailedException $e) { |
| 183 | - throw new \Exception("Expected word 'Collection' in parameter method setCollection received : " . $e->getValue()); |
|
| 183 | + throw new \Exception("Expected word 'Collection' in parameter method setCollection received : " . $e->getValue()); |
|
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | return $this->collection = $collection; |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | /** |
| 150 | - * @param $typeAction string |
|
| 150 | + * @param string $typeAction string |
|
| 151 | 151 | * @return Action |
| 152 | 152 | */ |
| 153 | 153 | public function setAction($typeAction) |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | /** |
| 194 | 194 | * Set collection for correct query |
| 195 | 195 | * @param string $collection |
| 196 | - * @return mixed |
|
| 196 | + * @return string |
|
| 197 | 197 | * @throws \Exception |
| 198 | 198 | */ |
| 199 | 199 | public function setCollection($collection) |
@@ -223,7 +223,7 @@ discard block |
||
| 223 | 223 | return app()->make(ClientInterface::class); |
| 224 | 224 | } |
| 225 | 225 | /** |
| 226 | - * @param $action |
|
| 226 | + * @param string $action |
|
| 227 | 227 | * @return array |
| 228 | 228 | */ |
| 229 | 229 | private function splitAction($action) |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | */ |
| 105 | 105 | public function loadConfiguration(SourceConfiguration $configuration) |
| 106 | 106 | { |
| 107 | - config()->set( $this->prefixConfiguration = $configuration->getName(), $configuration->get()); |
|
| 107 | + config()->set($this->prefixConfiguration = $configuration->getName(), $configuration->get()); |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | /** |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | public function setHandler($typeHandler = 'xml') |
| 135 | 135 | { |
| 136 | 136 | Assertion::keyIsset($this->handlers, $typeHandler); |
| 137 | - $this->currentHandler = app()->make( $this->handlers[$typeHandler] ); |
|
| 137 | + $this->currentHandler = app()->make($this->handlers[$typeHandler]); |
|
| 138 | 138 | return $this->currentHandler; |
| 139 | 139 | } |
| 140 | 140 | |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | { |
| 155 | 155 | Assertion::keyIsset($this->action, $typeAction); |
| 156 | 156 | |
| 157 | - $this->currentAction = app()->make( $this->action[$typeAction] ); |
|
| 157 | + $this->currentAction = app()->make($this->action[$typeAction]); |
|
| 158 | 158 | |
| 159 | 159 | return $this->currentAction; |
| 160 | 160 | } |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | |
| 171 | 171 | extract($this->splitAction($action)); |
| 172 | 172 | |
| 173 | - $action = $this->setAction($action); |
|
| 173 | + $action = $this->setAction($action); |
|
| 174 | 174 | $this->setHandler($handler); |
| 175 | 175 | |
| 176 | 176 | $action->injectionKernel($this); |
@@ -200,8 +200,8 @@ discard block |
||
| 200 | 200 | { |
| 201 | 201 | try { |
| 202 | 202 | Assertion::regex($collection, '/[A-z]+Collection$/'); |
| 203 | - } catch(AssertionFailedException $e) { |
|
| 204 | - throw new \Exception("Expected word 'Collection' in parameter method setCollection received : " . $e->getValue()); |
|
| 203 | + } catch (AssertionFailedException $e) { |
|
| 204 | + throw new \Exception("Expected word 'Collection' in parameter method setCollection received : ".$e->getValue()); |
|
| 205 | 205 | } |
| 206 | 206 | |
| 207 | 207 | return $this->collection = $collection; |
@@ -232,8 +232,8 @@ discard block |
||
| 232 | 232 | |
| 233 | 233 | // verification values |
| 234 | 234 | Assertion::between(count($split), 2, 2); |
| 235 | - Assertion::keyExists( $this->action, $split[0]); |
|
| 236 | - Assertion::keyExists( $this->handlers, $split[1]); |
|
| 235 | + Assertion::keyExists($this->action, $split[0]); |
|
| 236 | + Assertion::keyExists($this->handlers, $split[1]); |
|
| 237 | 237 | |
| 238 | 238 | return ['action' => $split[0], 'handler' => $split[1]]; |
| 239 | 239 | } |
@@ -9,7 +9,7 @@ |
||
| 9 | 9 | { |
| 10 | 10 | public function register() |
| 11 | 11 | { |
| 12 | - if ( app()->resolved('config') === false ) |
|
| 12 | + if (app()->resolved('config') === false) |
|
| 13 | 13 | { |
| 14 | 14 | app()->instance('config', new Repository()); |
| 15 | 15 | } |
@@ -13,9 +13,9 @@ |
||
| 13 | 13 | |
| 14 | 14 | public function register() |
| 15 | 15 | { |
| 16 | - app()->bind(Read::class, Read::class); |
|
| 17 | - app()->bind(Create::class, Create::class); |
|
| 18 | - app()->bind(Update::class, Update::class); |
|
| 19 | - app()->bind(Delete::class, Delete::class); |
|
| 16 | + app()->bind(Read::class, Read::class); |
|
| 17 | + app()->bind(Create::class, Create::class); |
|
| 18 | + app()->bind(Update::class, Update::class); |
|
| 19 | + app()->bind(Delete::class, Delete::class); |
|
| 20 | 20 | } |
| 21 | 21 | } |
| 22 | 22 | \ No newline at end of file |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | |
| 14 | 14 | public function register() |
| 15 | 15 | { |
| 16 | - app()->bind(Read::class, Read::class); |
|
| 16 | + app()->bind(Read::class, Read::class); |
|
| 17 | 17 | app()->bind(Create::class, Create::class); |
| 18 | 18 | app()->bind(Update::class, Update::class); |
| 19 | 19 | app()->bind(Delete::class, Delete::class); |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | class CookieAuthentication implements Authentication |
| 11 | 11 | { |
| 12 | 12 | protected $prefixCSRF = 'BPMCSRF'; |
| 13 | - protected $pathToCookieFile = __DIR__ . '/../resource/cookie.txt'; |
|
| 13 | + protected $pathToCookieFile = __DIR__.'/../resource/cookie.txt'; |
|
| 14 | 14 | protected $configuration; |
| 15 | 15 | |
| 16 | 16 | public function setConfig(array $config) |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | |
| 38 | 38 | curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); |
| 39 | 39 | curl_setopt($curl, CURLOPT_HEADER, 1); |
| 40 | - curl_setopt($curl, CURLOPT_URL, $this->configuration['UrlLogin']); |
|
| 40 | + curl_setopt($curl, CURLOPT_URL, $this->configuration['UrlLogin']); |
|
| 41 | 41 | curl_setopt($curl, CURLOPT_POST, true); |
| 42 | 42 | curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); |
| 43 | 43 | curl_setopt($curl, CURLOPT_COOKIEJAR, $this->pathToCookieFile); |
@@ -66,13 +66,13 @@ discard block |
||
| 66 | 66 | */ |
| 67 | 67 | public function getCsrf() |
| 68 | 68 | { |
| 69 | - if ( file_exists($this->pathToCookieFile) === false ) |
|
| 69 | + if (file_exists($this->pathToCookieFile) === false) |
|
| 70 | 70 | { |
| 71 | 71 | return ''; |
| 72 | 72 | } |
| 73 | 73 | preg_match("/BPMCSRF\\s(.+)/", file_get_contents($this->pathToCookieFile), $matches); |
| 74 | 74 | |
| 75 | - if ( isset($matches[1]) === false ) |
|
| 75 | + if (isset($matches[1]) === false) |
|
| 76 | 76 | { |
| 77 | 77 | return ''; |
| 78 | 78 | } |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | */ |
| 18 | 18 | public function get() |
| 19 | 19 | { |
| 20 | - $configuration = require $this->pathToFile; |
|
| 20 | + $configuration = require $this->pathToFile; |
|
| 21 | 21 | return $configuration; |
| 22 | 22 | } |
| 23 | 23 | |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | if (file_exists($path)) |
| 31 | 31 | { |
| 32 | 32 | $this->pathToFile = $path; |
| 33 | - } else{ |
|
| 33 | + } else { |
|
| 34 | 34 | Assertion::file($path, 'Local file name is not exist.'); |
| 35 | 35 | } |
| 36 | 36 | return true; |