@@ -84,7 +84,7 @@ |
||
84 | 84 | $urlHome = config($this->kernel->getPrefixConfig() . '.UrlHome'); |
85 | 85 | |
86 | 86 | $response = $this->kernel->getCurl()->request($this->HTTP_TYPE, $urlHome . $url, |
87 | - $this->headers()->getCookie()->body()->httpErrorsFalse()->get() |
|
87 | + $this->headers()->getCookie()->body()->httpErrorsFalse()->get() |
|
88 | 88 | ); |
89 | 89 | $body = $response->getBody(); |
90 | 90 |
@@ -43,7 +43,7 @@ |
||
43 | 43 | } |
44 | 44 | |
45 | 45 | /** |
46 | - * @return \agoalofalife\bpm\Contracts\Handler |
|
46 | + * @return \Illuminate\Container\Container |
|
47 | 47 | */ |
48 | 48 | public function processData() |
49 | 49 | { |
@@ -83,7 +83,7 @@ |
||
83 | 83 | $url = $this->kernel->getCollection() . $parameters; |
84 | 84 | $urlHome = config($this->kernel->getPrefixConfig() . '.UrlHome'); |
85 | 85 | |
86 | - $response = $this->kernel->getCurl()->request($this->HTTP_TYPE, $urlHome . $url, |
|
86 | + $response = $this->kernel->getCurl()->request($this->HTTP_TYPE, $urlHome . $url, |
|
87 | 87 | $this->headers()->getCookie()->body()->httpErrorsFalse()->get() |
88 | 88 | ); |
89 | 89 | $body = $response->getBody(); |
@@ -66,8 +66,8 @@ |
||
66 | 66 | $body = [ |
67 | 67 | 'body' => $this->kernel->getHandler()->create($this->data) |
68 | 68 | ]; |
69 | - $this->merge($body); |
|
70 | - return $this; |
|
69 | + $this->merge($body); |
|
70 | + return $this; |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | private function merge(array $newParameters) |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | |
12 | 12 | public function getCookie() |
13 | 13 | { |
14 | - $curl = ['curl' => [ CURLOPT_COOKIEFILE => app(Authentication::class)->getPathCookieFile()]]; |
|
14 | + $curl = ['curl' => [CURLOPT_COOKIEFILE => app(Authentication::class)->getPathCookieFile()]]; |
|
15 | 15 | $this->merge($curl); |
16 | 16 | return $this; |
17 | 17 | } |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | |
40 | 40 | public function debug() |
41 | 41 | { |
42 | - $debug = ['on_stats' => function (TransferStats $stats) { |
|
42 | + $debug = ['on_stats' => function(TransferStats $stats) { |
|
43 | 43 | app(Logger::class)->debug('api', |
44 | 44 | [ |
45 | 45 | 'time' => $stats->getTransferTime(), |
@@ -14,7 +14,7 @@ |
||
14 | 14 | { |
15 | 15 | app()->bind(Logger::class, function(){ |
16 | 16 | $log = new Logger(KernelBpm::class); |
17 | - return $log->pushHandler(new StreamHandler(KernelBpm::PATH_LOG . date('Y-m-d'). '.txt', Logger::DEBUG)); |
|
17 | + return $log->pushHandler(new StreamHandler(KernelBpm::PATH_LOG . date('Y-m-d'). '.txt', Logger::DEBUG)); |
|
18 | 18 | }); |
19 | 19 | } |
20 | 20 | } |
21 | 21 | \ No newline at end of file |
@@ -12,9 +12,9 @@ |
||
12 | 12 | |
13 | 13 | public function register() |
14 | 14 | { |
15 | - app()->bind(Logger::class, function(){ |
|
15 | + app()->bind(Logger::class, function() { |
|
16 | 16 | $log = new Logger(KernelBpm::class); |
17 | - return $log->pushHandler(new StreamHandler(KernelBpm::PATH_LOG . date('Y-m-d'). '.txt', Logger::DEBUG)); |
|
17 | + return $log->pushHandler(new StreamHandler(KernelBpm::PATH_LOG . date('Y-m-d') . '.txt', Logger::DEBUG)); |
|
18 | 18 | }); |
19 | 19 | } |
20 | 20 | } |
21 | 21 | \ No newline at end of file |
@@ -50,7 +50,7 @@ |
||
50 | 50 | } |
51 | 51 | |
52 | 52 | /** |
53 | - * @return Handler |
|
53 | + * @return \Illuminate\Container\Container |
|
54 | 54 | */ |
55 | 55 | public function processData() |
56 | 56 | { |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | } |
104 | 104 | $ParameterQuery.= " ".$param; |
105 | 105 | } |
106 | - $this->concatenationUrlCurl($ParameterQuery); |
|
106 | + $this->concatenationUrlCurl($ParameterQuery); |
|
107 | 107 | |
108 | 108 | return $this; |
109 | 109 | } |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | $urlHome = config($this->kernel->getPrefixConfig() . '.UrlHome'); |
163 | 163 | |
164 | 164 | $response = $this->kernel->getCurl()->request($this->HTTP_TYPE, $urlHome . $url, |
165 | - $this->debug()->headers()->getCookie()->httpErrorsFalse()->get() |
|
165 | + $this->debug()->headers()->getCookie()->httpErrorsFalse()->get() |
|
166 | 166 | ); |
167 | 167 | $body = $response->getBody(); |
168 | 168 |
@@ -77,8 +77,8 @@ discard block |
||
77 | 77 | */ |
78 | 78 | public function filterConstructor($strRequest) |
79 | 79 | { |
80 | - $ParameterQuery = '$filter='; |
|
81 | - $ParameterQuery.= $strRequest; |
|
80 | + $ParameterQuery = '$filter='; |
|
81 | + $ParameterQuery .= $strRequest; |
|
82 | 82 | $this->concatenationUrlCurl($ParameterQuery); |
83 | 83 | return $this; |
84 | 84 | } |
@@ -95,13 +95,13 @@ discard block |
||
95 | 95 | public function orderBy($whatSort, $param = 'asc') |
96 | 96 | { |
97 | 97 | $ParameterQuery = '$orderby='; |
98 | - $ParameterQuery.= ucfirst($whatSort); |
|
98 | + $ParameterQuery .= ucfirst($whatSort); |
|
99 | 99 | |
100 | - if ( empty($param) === false ) { |
|
100 | + if (empty($param) === false) { |
|
101 | 101 | if ($param != 'desc' && $param != 'asc') { |
102 | 102 | throw new \Exception('no valid orderby parameters'); |
103 | 103 | } |
104 | - $ParameterQuery.= " ".$param; |
|
104 | + $ParameterQuery .= " " . $param; |
|
105 | 105 | } |
106 | 106 | $this->concatenationUrlCurl($ParameterQuery); |
107 | 107 | |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | public function skip($skip) |
119 | 119 | { |
120 | 120 | Assert::that($skip, 'You must specify a numeric parameter for the amount of the method')->integer(); |
121 | - $ParameterQuery = '$skip='.$skip; |
|
121 | + $ParameterQuery = '$skip=' . $skip; |
|
122 | 122 | $this->concatenationUrlCurl($ParameterQuery); |
123 | 123 | |
124 | 124 | return $this; |
@@ -132,8 +132,8 @@ discard block |
||
132 | 132 | */ |
133 | 133 | public function amount($amountMax = null) |
134 | 134 | { |
135 | - Assert::that($amountMax,'You must specify a numeric parameter for the amount of the method')->integer(); |
|
136 | - $ParameterQuery = '$top='.$amountMax; |
|
135 | + Assert::that($amountMax, 'You must specify a numeric parameter for the amount of the method')->integer(); |
|
136 | + $ParameterQuery = '$top=' . $amountMax; |
|
137 | 137 | $this->concatenationUrlCurl($ParameterQuery); |
138 | 138 | return $this; |
139 | 139 | } |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | $url = $this->kernel->getCollection() . $parameters; |
162 | 162 | $urlHome = config($this->kernel->getPrefixConfig() . '.UrlHome'); |
163 | 163 | |
164 | - $response = $this->kernel->getCurl()->request($this->HTTP_TYPE, $urlHome . $url, |
|
164 | + $response = $this->kernel->getCurl()->request($this->HTTP_TYPE, $urlHome . $url, |
|
165 | 165 | $this->debug()->headers()->getCookie()->httpErrorsFalse()->get() |
166 | 166 | ); |
167 | 167 | $body = $response->getBody(); |
@@ -9,7 +9,7 @@ |
||
9 | 9 | { |
10 | 10 | public function checkResponseUnauthorized(ResponseInterface $response) |
11 | 11 | { |
12 | - if ( $response->getStatusCode() == 401 && $response->getReasonPhrase() == 'Unauthorized' ) |
|
12 | + if ($response->getStatusCode() == 401 && $response->getReasonPhrase() == 'Unauthorized') |
|
13 | 13 | { |
14 | 14 | $this->kernel->authentication(); |
15 | 15 | $this->query(); |
@@ -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 | - } |
|
95 | - // TODO not smog to find a similar case |
|
96 | - /* else{ |
|
91 | + if (gettype($value) != 'object') |
|
92 | + { |
|
93 | + $result[$key] = $value; |
|
94 | + } |
|
95 | + // TODO not smog to find a similar case |
|
96 | + /* else{ |
|
97 | 97 | $result[$key] = get_object_vars($value); |
98 | 98 | }*/ |
99 | 99 |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | private function chooseJsonPrefix($parse) |
50 | 50 | { |
51 | 51 | $decode = json_decode($parse); |
52 | - if ( isset($decode->{$this->jsonPrefix}->{$this->jsonPrefixWord}) ) |
|
52 | + if (isset($decode->{$this->jsonPrefix}->{$this->jsonPrefixWord})) |
|
53 | 53 | { |
54 | 54 | return $decode->{$this->jsonPrefix}->{$this->jsonPrefixWord}; |
55 | 55 | } else { |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | */ |
64 | 64 | public function checkIntegrity($response) |
65 | 65 | { |
66 | - return isset( json_decode($response)->{$this->jsonPrefix} ); |
|
66 | + return isset(json_decode($response)->{$this->jsonPrefix} ); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | /** |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | |
90 | 90 | public function create(array $data) |
91 | 91 | { |
92 | - if ( empty($data)){ |
|
92 | + if (empty($data)) { |
|
93 | 93 | return $this->buildJson = '{}'; |
94 | 94 | } |
95 | 95 | return $this->buildJson = json_encode($data); |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | if (gettype($value) == 'object') |
104 | 104 | { |
105 | 105 | $result[$key] = $this->objectToArray($value); |
106 | - } else{ |
|
106 | + } else { |
|
107 | 107 | if (gettype($value) != 'object') |
108 | 108 | { |
109 | 109 | $result[$key] = $value; |
@@ -27,15 +27,15 @@ |
||
27 | 27 | */ |
28 | 28 | public function register() |
29 | 29 | { |
30 | - $this->app->bind('bpm', function(){ |
|
31 | - $bpm = new KernelBpm(); |
|
32 | - $bpm->setConfigManually('apiBpm', [ |
|
33 | - 'UrlLogin' => config('apiBpm.UrlLogin'), |
|
34 | - 'Login' => config('apiBpm.Login'), |
|
35 | - 'Password' => config('apiBpm.Password'), |
|
36 | - 'UrlHome' => config('apiBpm.UrlHome'), |
|
37 | - ]); |
|
38 | - return $bpm; |
|
39 | - }); |
|
30 | + $this->app->bind('bpm', function(){ |
|
31 | + $bpm = new KernelBpm(); |
|
32 | + $bpm->setConfigManually('apiBpm', [ |
|
33 | + 'UrlLogin' => config('apiBpm.UrlLogin'), |
|
34 | + 'Login' => config('apiBpm.Login'), |
|
35 | + 'Password' => config('apiBpm.Password'), |
|
36 | + 'UrlHome' => config('apiBpm.UrlHome'), |
|
37 | + ]); |
|
38 | + return $bpm; |
|
39 | + }); |
|
40 | 40 | } |
41 | 41 | } |
42 | 42 | \ No newline at end of file |
@@ -27,7 +27,7 @@ |
||
27 | 27 | */ |
28 | 28 | public function register() |
29 | 29 | { |
30 | - $this->app->bind('bpm', function(){ |
|
30 | + $this->app->bind('bpm', function() { |
|
31 | 31 | $bpm = new KernelBpm(); |
32 | 32 | $bpm->setConfigManually('apiBpm', [ |
33 | 33 | 'UrlLogin' => config('apiBpm.UrlLogin'), |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | |
43 | 43 | curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); |
44 | 44 | curl_setopt($curl, CURLOPT_HEADER, 1); |
45 | - curl_setopt($curl, CURLOPT_URL, $this->configuration['UrlLogin']); |
|
45 | + curl_setopt($curl, CURLOPT_URL, $this->configuration['UrlLogin']); |
|
46 | 46 | curl_setopt($curl, CURLOPT_POST, true); |
47 | 47 | curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); |
48 | 48 | curl_setopt($curl, CURLOPT_COOKIEJAR, $this->pathToCookieFile); |
@@ -71,13 +71,13 @@ discard block |
||
71 | 71 | */ |
72 | 72 | public function getCsrf() |
73 | 73 | { |
74 | - if ( file_exists($this->pathToCookieFile) === false ) |
|
74 | + if (file_exists($this->pathToCookieFile) === false) |
|
75 | 75 | { |
76 | 76 | return ''; |
77 | 77 | } |
78 | 78 | preg_match("/BPMCSRF\\s(.+)/", file_get_contents($this->pathToCookieFile), $matches); |
79 | 79 | |
80 | - if ( isset($matches[1]) === false ) |
|
80 | + if (isset($matches[1]) === false) |
|
81 | 81 | { |
82 | 82 | return ''; |
83 | 83 | } |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | |
8 | 8 | $app = new Slim\App(); |
9 | 9 | // -------------- |
10 | -$app->add(function ($req, $res, $next) { |
|
10 | +$app->add(function($req, $res, $next) { |
|
11 | 11 | $response = $next($req, $res); |
12 | 12 | return $response |
13 | 13 | ->withHeader('Access-Control-Allow-Origin', '*') |
@@ -17,18 +17,18 @@ discard block |
||
17 | 17 | // -------- |
18 | 18 | |
19 | 19 | |
20 | -$app->get('/', function (Request $request, Response $response) { |
|
20 | +$app->get('/', function(Request $request, Response $response) { |
|
21 | 21 | require_once('index.html'); |
22 | 22 | }); |
23 | -$app->get('/api/statistic-request', function (Request $request, Response $response) { |
|
24 | - $data['date'] = []; |
|
23 | +$app->get('/api/statistic-request', function(Request $request, Response $response) { |
|
24 | + $data['date'] = []; |
|
25 | 25 | $data['durations'] = []; |
26 | 26 | $dateList = []; |
27 | 27 | $durationList = []; |
28 | 28 | |
29 | 29 | array_map(function($file) use (&$dateList, &$data, &$durationList){ |
30 | - preg_match_all( '/[0-9]{4}-[0-9]{2}-[0-9]{2}\s[0-9]{2}:[0-9]{2}:[0-9]{2}/', file_get_contents(PATH .'/'. $file), $matchesDate); |
|
31 | - preg_match_all( '/:([0-9]\.[0-9]+)/', file_get_contents(PATH .'/'. $file), $matchesDuration); |
|
30 | + preg_match_all('/[0-9]{4}-[0-9]{2}-[0-9]{2}\s[0-9]{2}:[0-9]{2}:[0-9]{2}/', file_get_contents(PATH . '/' . $file), $matchesDate); |
|
31 | + preg_match_all('/:([0-9]\.[0-9]+)/', file_get_contents(PATH . '/' . $file), $matchesDuration); |
|
32 | 32 | $data['date'] = array_merge($data['date'], array_shift($matchesDate)); |
33 | 33 | $data['durations'] = array_merge($data['durations'], $matchesDuration[1]); |
34 | 34 | |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | return $response->withJson(json_encode($data), 200); |
38 | 38 | }); |
39 | 39 | |
40 | -$app->post('/api/filterDates', function (Request $request, Response $response) { |
|
40 | +$app->post('/api/filterDates', function(Request $request, Response $response) { |
|
41 | 41 | |
42 | 42 | $data['date'] = []; |
43 | 43 | $data['durations'] = []; |
@@ -47,23 +47,23 @@ discard block |
||
47 | 47 | array_map(function($line) use ($request, &$dateList, &$data, &$durationList){ |
48 | 48 | if (preg_match("/{$request->getParams()['date']}/", $line)) |
49 | 49 | { |
50 | - preg_match_all( '/[0-9]{4}-[0-9]{2}-[0-9]{2}\s[0-9]{2}:[0-9]{2}:[0-9]{2}/', $line, $matchesDate); |
|
51 | - preg_match_all( '/:([0-9]\.[0-9]+)/', $line, $matchesDuration); |
|
50 | + preg_match_all('/[0-9]{4}-[0-9]{2}-[0-9]{2}\s[0-9]{2}:[0-9]{2}:[0-9]{2}/', $line, $matchesDate); |
|
51 | + preg_match_all('/:([0-9]\.[0-9]+)/', $line, $matchesDuration); |
|
52 | 52 | $data['date'] = array_merge($data['date'], array_shift($matchesDate)); |
53 | - $data['durations'] = array_merge( $data['durations'], $matchesDuration[1]); |
|
53 | + $data['durations'] = array_merge($data['durations'], $matchesDuration[1]); |
|
54 | 54 | } |
55 | - }, explode(PHP_EOL, file_get_contents(PATH .'/'. $file))); |
|
55 | + }, explode(PHP_EOL, file_get_contents(PATH . '/' . $file))); |
|
56 | 56 | }, getFiles(PATH)); |
57 | 57 | |
58 | 58 | return $response->withJson(json_encode($data), 200); |
59 | 59 | }); |
60 | 60 | |
61 | -$app->get('/api/listDates', function (Request $request, Response $response) { |
|
61 | +$app->get('/api/listDates', function(Request $request, Response $response) { |
|
62 | 62 | $dateList = []; |
63 | 63 | $data['date'] = []; |
64 | 64 | array_map(function($file) use (&$dateList, &$data){ |
65 | - preg_match_all( '/[0-9]{4}-[0-9]{2}-[0-9]{2}/', file_get_contents(PATH .'/'. $file), $matchesDate); |
|
66 | - $data['date'] = array_merge( $data['date'], array_shift($matchesDate)); |
|
65 | + preg_match_all('/[0-9]{4}-[0-9]{2}-[0-9]{2}/', file_get_contents(PATH . '/' . $file), $matchesDate); |
|
66 | + $data['date'] = array_merge($data['date'], array_shift($matchesDate)); |
|
67 | 67 | }, getFiles(PATH)); |
68 | 68 | $data['date'] = array_unique($data['date']); |
69 | 69 | return $response->withJson(json_encode($data), 200); |