| @@ -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 | |
| @@ -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; | 
| @@ -124,7 +124,7 @@ discard block | ||
| 124 | 124 | } | 
| 125 | 125 | |
| 126 | 126 | /** | 
| 127 | - * @return Handler | |
| 127 | + * @return \Illuminate\Container\Container | |
| 128 | 128 | */ | 
| 129 | 129 | public function getHandler() | 
| 130 | 130 |      { | 
| @@ -134,7 +134,7 @@ discard block | ||
| 134 | 134 | /** | 
| 135 | 135 | * Set the response handler | 
| 136 | 136 | * @param string $typeHandler default xml | 
| 137 | - * @return Action | |
| 137 | + * @return \Illuminate\Container\Container | |
| 138 | 138 | */ | 
| 139 | 139 | public function setHandler($typeHandler = 'xml') | 
| 140 | 140 |      { | 
| @@ -152,7 +152,7 @@ discard block | ||
| 152 | 152 | } | 
| 153 | 153 | |
| 154 | 154 | /** | 
| 155 | - * @param $typeAction string | |
| 155 | + * @param string $typeAction string | |
| 156 | 156 | * @return Action | 
| 157 | 157 | */ | 
| 158 | 158 | public function setAction($typeAction) | 
| @@ -198,7 +198,7 @@ discard block | ||
| 198 | 198 | /** | 
| 199 | 199 | * Set collection for correct query | 
| 200 | 200 | * @param string $collection | 
| 201 | - * @return mixed | |
| 201 | + * @return string | |
| 202 | 202 | * @throws \Exception | 
| 203 | 203 | */ | 
| 204 | 204 | public function setCollection($collection) | 
| @@ -228,7 +228,7 @@ discard block | ||
| 228 | 228 | return app()->make(ClientInterface::class); | 
| 229 | 229 | } | 
| 230 | 230 | /** | 
| 231 | - * @param $action | |
| 231 | + * @param string $action | |
| 232 | 232 | * @return array | 
| 233 | 233 | */ | 
| 234 | 234 | private function splitAction($action) | 
| @@ -36,7 +36,7 @@ discard block | ||
| 36 | 36 | */ | 
| 37 | 37 | class KernelBpm | 
| 38 | 38 |  { | 
| 39 | - const PATH_LOG = __DIR__ . '/resource/logs'; | |
| 39 | + const PATH_LOG = __DIR__.'/resource/logs'; | |
| 40 | 40 | |
| 41 | 41 | protected $action = [ | 
| 42 | 42 | 'create' => Create::class, | 
| @@ -109,7 +109,7 @@ discard block | ||
| 109 | 109 | */ | 
| 110 | 110 | public function loadConfiguration(SourceConfiguration $configuration) | 
| 111 | 111 |      { | 
| 112 | - config()->set( $this->prefixConfiguration = $configuration->getName(), $configuration->get()); | |
| 112 | + config()->set($this->prefixConfiguration = $configuration->getName(), $configuration->get()); | |
| 113 | 113 | } | 
| 114 | 114 | |
| 115 | 115 | /** | 
| @@ -159,7 +159,7 @@ discard block | ||
| 159 | 159 |      { | 
| 160 | 160 | Assertion::keyIsset($this->action, $typeAction); | 
| 161 | 161 | |
| 162 | - $this->currentAction = app()->make( $this->action[$typeAction] ); | |
| 162 | + $this->currentAction = app()->make($this->action[$typeAction]); | |
| 163 | 163 | |
| 164 | 164 | return $this->currentAction; | 
| 165 | 165 | } | 
| @@ -175,7 +175,7 @@ discard block | ||
| 175 | 175 | |
| 176 | 176 | extract($this->splitAction($action)); | 
| 177 | 177 | |
| 178 | - $action = $this->setAction($action); | |
| 178 | + $action = $this->setAction($action); | |
| 179 | 179 | $this->setHandler($handler); | 
| 180 | 180 | |
| 181 | 181 | $action->injectionKernel($this); | 
| @@ -205,8 +205,8 @@ discard block | ||
| 205 | 205 |      { | 
| 206 | 206 |          try { | 
| 207 | 207 | Assertion::regex($collection, '/[A-z]+Collection$/'); | 
| 208 | -        } catch(AssertionFailedException $e) { | |
| 209 | -           throw new \Exception("Expected word 'Collection' in parameter method setCollection received : " .  $e->getValue()); | |
| 208 | +        } catch (AssertionFailedException $e) { | |
| 209 | +           throw new \Exception("Expected word 'Collection' in parameter method setCollection received : ".$e->getValue()); | |
| 210 | 210 | } | 
| 211 | 211 | |
| 212 | 212 | return $this->collection = $collection; | 
| @@ -237,8 +237,8 @@ discard block | ||
| 237 | 237 | |
| 238 | 238 | // verification values | 
| 239 | 239 | Assertion::between(count($split), 2, 2); | 
| 240 | - Assertion::keyExists( $this->action, $split[0]); | |
| 241 | - Assertion::keyExists( $this->handlers, $split[1]); | |
| 240 | + Assertion::keyExists($this->action, $split[0]); | |
| 241 | + Assertion::keyExists($this->handlers, $split[1]); | |
| 242 | 242 | |
| 243 | 243 | return ['action' => $split[0], 'handler' => $split[1]]; | 
| 244 | 244 | } | 
| @@ -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; | 
| @@ -102,7 +102,7 @@ discard block | ||
| 102 | 102 | } | 
| 103 | 103 | |
| 104 | 104 | /** | 
| 105 | - * @param $response | |
| 105 | + * @param \SimpleXMLElement $response | |
| 106 | 106 | * @return bool | 
| 107 | 107 | */ | 
| 108 | 108 | public function checkIntegrity($response) | 
| @@ -183,7 +183,7 @@ discard block | ||
| 183 | 183 | } | 
| 184 | 184 | /** | 
| 185 | 185 | * Get one Element | 
| 186 | - * @return mixed | |
| 186 | + * @return XmlHandler | |
| 187 | 187 | */ | 
| 188 | 188 | private function arrayOne() | 
| 189 | 189 |      { | 
| @@ -127,7 +127,7 @@ | ||
| 127 | 127 | */ | 
| 128 | 128 | public function toArray() | 
| 129 | 129 |      { | 
| 130 | - return $this->xmlToArrayRecursive($this->validText); | |
| 130 | + return $this->xmlToArrayRecursive($this->validText); | |
| 131 | 131 | } | 
| 132 | 132 | |
| 133 | 133 | /** | 
| @@ -84,12 +84,12 @@ discard block | ||
| 84 | 84 | $this->response = simplexml_load_string($response); | 
| 85 | 85 | $copyXml = $this->response; | 
| 86 | 86 | |
| 87 | - if ( $this->response === false || $this->checkIntegrity($this->response) === false ) | |
| 87 | + if ($this->response === false || $this->checkIntegrity($this->response) === false) | |
| 88 | 88 |          { | 
| 89 | 89 | return []; | 
| 90 | 90 | } | 
| 91 | 91 | |
| 92 | - $array_vars_list = get_object_vars($copyXml); | |
| 92 | + $array_vars_list = get_object_vars($copyXml); | |
| 93 | 93 | |
| 94 | 94 |              if (key_exists('content', $array_vars_list)) { | 
| 95 | 95 | return $this->arrayOne(); | 
| @@ -107,7 +107,7 @@ discard block | ||
| 107 | 107 | */ | 
| 108 | 108 | public function checkIntegrity($response) | 
| 109 | 109 |      { | 
| 110 | - if ( empty($response->message) ) | |
| 110 | + if (empty($response->message)) | |
| 111 | 111 |          { | 
| 112 | 112 | return true; | 
| 113 | 113 | } | 
| @@ -154,12 +154,12 @@ discard block | ||
| 154 | 154 | */ | 
| 155 | 155 | private function workspace() | 
| 156 | 156 |      { | 
| 157 | -        if ( !empty($this->response->message->collection->title) ) { | |
| 157 | +        if (!empty($this->response->message->collection->title)) { | |
| 158 | 158 |              throw new \Exception("responce BPM API : ". | 
| 159 | - $this->response->innererror->message.". ENG :". $this->response->message); | |
| 159 | + $this->response->innererror->message.". ENG :".$this->response->message); | |
| 160 | 160 | } | 
| 161 | 161 |          foreach ($this->response->workspace->collection as $item) { | 
| 162 | - $this->validText[] = get_object_vars($item->children( $this->namespaces['NamespaceAtom'] ))['title']; | |
| 162 | + $this->validText[] = get_object_vars($item->children($this->namespaces['NamespaceAtom']))['title']; | |
| 163 | 163 | } | 
| 164 | 164 | return $this; | 
| 165 | 165 | } | 
| @@ -172,8 +172,8 @@ discard block | ||
| 172 | 172 | private function arrayMany() | 
| 173 | 173 |      { | 
| 174 | 174 |          try { | 
| 175 | -            foreach ($this->response->children( $this->namespaces['NamespaceAtom'] )->entry as $item ) { | |
| 176 | - $this->validText[] = $item->content->children( $this->namespaces['NamespaceMetadata'] ) | |
| 175 | +            foreach ($this->response->children($this->namespaces['NamespaceAtom'])->entry as $item) { | |
| 176 | + $this->validText[] = $item->content->children($this->namespaces['NamespaceMetadata']) | |
| 177 | 177 | ->children($this->namespaces['NamespaceDataServices']); | 
| 178 | 178 | } | 
| 179 | 179 | return $this; | 
| @@ -187,9 +187,9 @@ discard block | ||
| 187 | 187 | */ | 
| 188 | 188 | private function arrayOne() | 
| 189 | 189 |      { | 
| 190 | - $this->validText = $this->response->children( $this->namespaces['NamespaceAtom'] )->content | |
| 191 | - ->children( $this->namespaces['NamespaceMetadata'] ) | |
| 192 | - ->children( $this->namespaces['NamespaceDataServices'] ); | |
| 190 | + $this->validText = $this->response->children($this->namespaces['NamespaceAtom'])->content | |
| 191 | + ->children($this->namespaces['NamespaceMetadata']) | |
| 192 | + ->children($this->namespaces['NamespaceDataServices']); | |
| 193 | 193 | return $this; | 
| 194 | 194 | } | 
| 195 | 195 | |
| @@ -226,7 +226,7 @@ discard block | ||
| 226 | 226 | $xmlns_dcd->appendChild($valued); | 
| 227 | 227 | |
| 228 | 228 | //---------- properties ----------// | 
| 229 | -        $properties   = $dom->createElement('m:properties'); | |
| 229 | +        $properties = $dom->createElement('m:properties'); | |
| 230 | 230 | $content->appendChild($properties); | 
| 231 | 231 | |
| 232 | 232 |          foreach ($data as $nameField => $valueField) { | 
| @@ -55,7 +55,7 @@ | ||
| 55 | 55 | //dd($test); | 
| 56 | 56 | |
| 57 | 57 | // 8. Example delete | 
| 58 | -$test = $test->action('delete:xml', function ($creator){ | |
| 58 | +$test = $test->action('delete:xml', function($creator) { | |
| 59 | 59 |      $creator->guid(''); | 
| 60 | 60 | })->get(); | 
| 61 | 61 | dd($test); | 
| 62 | 62 | \ No newline at end of file |