|
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\KernelBpm; |
|
9
|
|
|
|
|
10
|
|
|
/** |
|
11
|
|
|
* Class Delete |
|
12
|
|
|
* @property KernelBpm kernel |
|
13
|
|
|
* @property string HTTP_TYPE |
|
14
|
|
|
* @property string url |
|
15
|
|
|
* @property array data |
|
16
|
|
|
* @package agoalofalife\bpm\Actions |
|
17
|
|
|
*/ |
|
18
|
|
|
class Delete implements Action |
|
19
|
|
|
{ |
|
20
|
|
|
use ConstructorUrl, QueryBuilder; |
|
21
|
|
|
|
|
22
|
|
|
protected $kernel; |
|
23
|
|
|
protected $url = '?'; |
|
24
|
|
|
/** |
|
25
|
|
|
* Type of Request to delete |
|
26
|
|
|
* @var string |
|
27
|
|
|
*/ |
|
28
|
|
|
protected $HTTP_TYPE = 'DELETE'; |
|
29
|
|
|
|
|
30
|
|
|
public function injectionKernel(KernelBpm $bpm) |
|
31
|
|
|
{ |
|
32
|
|
|
$this->kernel = $bpm; |
|
33
|
|
|
} |
|
34
|
|
|
|
|
35
|
|
|
/** |
|
36
|
|
|
* @return string |
|
37
|
|
|
*/ |
|
38
|
2 |
|
public function getUrl() |
|
39
|
|
|
{ |
|
40
|
2 |
|
return $this->url; |
|
41
|
|
|
} |
|
42
|
|
|
|
|
43
|
|
|
/** |
|
44
|
|
|
* @return \agoalofalife\bpm\Contracts\Handler |
|
45
|
|
|
*/ |
|
46
|
|
|
public function processData() |
|
47
|
|
|
{ |
|
48
|
|
|
$this->query(); |
|
49
|
|
|
return $this->kernel->getHandler(); |
|
50
|
|
|
} |
|
51
|
|
|
|
|
52
|
|
|
private function query() |
|
53
|
|
|
{ |
|
54
|
|
|
$parameters = str_replace(' ', '%20', $this->url); |
|
55
|
|
|
|
|
56
|
|
|
$url = $this->kernel->getCollection() . $parameters; |
|
57
|
|
|
$urlHome = config($this->kernel->getPrefixConfig() . '.UrlHome'); |
|
58
|
|
|
|
|
59
|
|
|
|
|
60
|
|
|
$response = $this->kernel->getCurl()->request($this->HTTP_TYPE, $urlHome . $url, |
|
61
|
|
|
$this->headers()->getCookie()->httpErrorsFalse()->get() |
|
62
|
|
|
); |
|
63
|
|
|
|
|
64
|
|
|
$body = $response->getBody(); |
|
65
|
|
|
$this->kernel->getHandler()->parse($body->getContents()); |
|
|
|
|
|
|
66
|
|
|
|
|
67
|
|
|
if ( $response->getStatusCode() == 401 && $response->getReasonPhrase() == 'Unauthorized' ) |
|
68
|
|
|
{ |
|
69
|
|
|
$this->kernel->authentication(); |
|
70
|
|
|
$this->query(); |
|
71
|
|
|
} |
|
72
|
|
|
} |
|
73
|
|
|
} |
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.