1
|
|
|
<?php |
2
|
|
|
namespace agoalofalife\bpm\Actions; |
3
|
|
|
|
4
|
|
|
use agoalofalife\bpm\Assistants\ConstructorUrl; |
5
|
|
|
use agoalofalife\bpm\Assistants\QueryBuilder; |
6
|
|
|
use agoalofalife\bpm\Contracts\Action; |
7
|
|
|
use agoalofalife\bpm\Contracts\ActionGet; |
8
|
|
|
use agoalofalife\bpm\Contracts\ActionSet; |
9
|
|
|
use agoalofalife\bpm\KernelBpm; |
10
|
|
|
|
11
|
|
|
/** |
12
|
|
|
* Class Update |
13
|
|
|
* @property KernelBpm kernel |
14
|
|
|
* @property string HTTP_TYPE |
15
|
|
|
* @property array data |
16
|
|
|
* @property string url |
17
|
|
|
* @package agoalofalife\bpm\Actions |
18
|
|
|
*/ |
19
|
|
|
class Update implements Action, ActionGet, ActionSet |
20
|
|
|
{ |
21
|
|
|
use ConstructorUrl, QueryBuilder; |
22
|
|
|
|
23
|
|
|
protected $url = '?'; |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* Request type to created |
27
|
|
|
* @var string |
28
|
|
|
*/ |
29
|
|
|
protected $HTTP_TYPE = 'PUT'; |
30
|
|
|
protected $data = []; |
31
|
|
|
protected $kernel; |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* @param KernelBpm $bpm |
35
|
|
|
* @return void |
36
|
|
|
*/ |
37
|
1 |
|
public function injectionKernel(KernelBpm $bpm) |
38
|
|
|
{ |
39
|
1 |
|
$this->kernel = $bpm; |
40
|
1 |
|
} |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* @return string |
44
|
|
|
*/ |
45
|
2 |
|
public function getUrl() |
46
|
|
|
{ |
47
|
2 |
|
return $this->url; |
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* @param array $data |
52
|
|
|
* @return array |
53
|
|
|
*/ |
54
|
2 |
|
public function setData(array $data) |
55
|
|
|
{ |
56
|
2 |
|
return $this->data = $data; |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* @return \agoalofalife\bpm\Contracts\Handler |
61
|
|
|
*/ |
62
|
1 |
|
public function processData() |
63
|
|
|
{ |
64
|
1 |
|
$this->query(); |
65
|
1 |
|
return $this->kernel->getHandler(); |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* @return array |
70
|
|
|
*/ |
71
|
1 |
|
public function getData() |
72
|
|
|
{ |
73
|
1 |
|
return $this->data; |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* @return mixed |
78
|
|
|
*/ |
79
|
1 |
|
private function query() |
80
|
|
|
{ |
81
|
1 |
|
$parameters = str_replace(' ', '%20', $this->url); |
82
|
1 |
|
$url = $this->kernel->getCollection() . $parameters; |
83
|
1 |
|
$urlHome = config($this->kernel->getPrefixConfig() . '.UrlHome'); |
84
|
|
|
|
85
|
1 |
|
$response = $this->kernel->getCurl()->request($this->HTTP_TYPE, $urlHome . $url, |
86
|
1 |
|
$this->headers()->getCookie()->body()->httpErrorsFalse()->get() |
87
|
1 |
|
); |
88
|
1 |
|
$body = $response->getBody(); |
89
|
|
|
|
90
|
1 |
|
$this->kernel->getHandler()->parse($body->getContents()); |
|
|
|
|
91
|
|
|
|
92
|
1 |
|
if ( $response->getStatusCode() == 401 && $response->getReasonPhrase() == 'Unauthorized' ) |
93
|
1 |
|
{ |
94
|
|
|
$this->kernel->authentication(); |
95
|
|
|
$this->query(); |
96
|
|
|
} |
97
|
1 |
|
} |
98
|
|
|
|
99
|
|
|
} |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.