|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* This file is part of the official Paylater module for PrestaShop. |
|
4
|
|
|
* |
|
5
|
|
|
* @author Paga+Tarde <[email protected]> |
|
6
|
|
|
* @copyright 2019 Paga+Tarde |
|
7
|
|
|
* @license proprietary |
|
8
|
|
|
*/ |
|
9
|
|
|
|
|
10
|
|
|
use PagaMasTarde\ModuleUtils\Model\Log\LogEntry; |
|
11
|
|
|
/** |
|
12
|
|
|
* Class AbstractController |
|
13
|
|
|
*/ |
|
14
|
|
|
abstract class AbstractController extends ModuleFrontController |
|
|
|
|
|
|
15
|
|
|
{ |
|
16
|
|
|
/** |
|
17
|
|
|
* PMT_CODE |
|
18
|
|
|
*/ |
|
19
|
|
|
const PMT_CODE = 'paylater'; |
|
20
|
|
|
|
|
21
|
|
|
/** |
|
22
|
|
|
* @var array $headers |
|
23
|
|
|
*/ |
|
24
|
|
|
protected $headers; |
|
25
|
|
|
|
|
26
|
|
|
/** |
|
27
|
|
|
* Configure redirection |
|
28
|
|
|
* |
|
29
|
|
|
* @param bool $error |
|
30
|
|
|
* @param string $url |
|
31
|
|
|
* @param array $parameters |
|
32
|
|
|
*/ |
|
33
|
|
|
public function redirect($url = '', $parameters = array()) |
|
34
|
|
|
{ |
|
35
|
|
|
$parsedUrl = parse_url($url); |
|
36
|
|
|
$separator = ($parsedUrl['query'] == null) ? '?' : '&'; |
|
37
|
|
|
$redirectUrl = $url. $separator . http_build_query($parameters); |
|
38
|
|
|
Tools::redirect($redirectUrl); |
|
|
|
|
|
|
39
|
|
|
} |
|
40
|
|
|
|
|
41
|
|
|
/** |
|
42
|
|
|
* Save log in SQL database |
|
43
|
|
|
* |
|
44
|
|
|
* @param array $data |
|
45
|
|
|
* @param null $exception |
|
|
|
|
|
|
46
|
|
|
*/ |
|
47
|
|
|
public function saveLog($data = array(), $exception = null) |
|
48
|
|
|
{ |
|
49
|
|
|
try { |
|
50
|
|
|
$logObj = new LogEntry(); |
|
51
|
|
|
if ($exception !== null) { |
|
|
|
|
|
|
52
|
|
|
$logObj->error($exception); |
|
53
|
|
|
} |
|
54
|
|
|
if (isset($data['message'])) { |
|
55
|
|
|
$logObj->setMessage($data['message']); |
|
56
|
|
|
} |
|
57
|
|
|
if (isset($data['line'])) { |
|
58
|
|
|
$logObj->setLine($data['line']); |
|
59
|
|
|
} |
|
60
|
|
|
if (isset($data['file'])) { |
|
61
|
|
|
$logObj->setFile($data['file']); |
|
62
|
|
|
} |
|
63
|
|
|
if (isset($data['code'])) { |
|
64
|
|
|
$logObj->setCode($data['code']); |
|
65
|
|
|
} |
|
66
|
|
|
if (isset($data['trace'])) { |
|
67
|
|
|
$logObj->setTrace($data['trace']); |
|
68
|
|
|
} |
|
69
|
|
|
|
|
70
|
|
|
Db::getInstance()->insert('pmt_logs', array( |
|
|
|
|
|
|
71
|
|
|
'log' => $logObj->toJson() |
|
72
|
|
|
)); |
|
73
|
|
|
} catch (\Exception $exception) { |
|
74
|
|
|
// Do nothing |
|
75
|
|
|
} |
|
76
|
|
|
} |
|
77
|
|
|
} |
|
78
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths