The following is my code:
<?php
2
class DefaultBehaviour { }
3
4
#[\AllowDynamicProperties]
5
class ClassAllowsDynamicProperties { }
6
7
$o1 = new DefaultBehaviour();
8
$o2 = new ClassAllowsDynamicProperties();
9
10
$o1->nonExistingProp = true;
11
$o2->nonExistingProp = true;
12
?>
13
use Blesta\Core\Util\Common\Traits\Container;
14
15
/**
16
* Square API.
17
*
18
* @package blesta
19
* @subpackage blesta.components.modules.square
20
* @copyright Copyright (c) 2010, Phillips Data, Inc.
21
* @license
http://www.blesta.com/license/ The Blesta License Agreement
22
* @link
http://www.blesta.com/ Blesta
23
*/
24
class SquareApi
25
{
26
// Load traits
27
use Container;
28
29
/**
30
* @var string The application ID
31
*/
32
private $application_id;
33
34
/**
35
* @var string The personal access token
36
*/
37
private $access_token;
38
39
/**
40
* @var string The store location ID
41
*/
42
private $location_id;
43
44
/**
45
* Initializes the class.
46
*
47
* @param string $application_id The application ID
48
* @param string $access_token The personal access token
49
* @param string $location_id The store location ID
50
*/
51
public function __construct($application_id, $access_token, $location_id)
52
{
53
$this->application_id = $application_id;
54
$this->access_token = $access_token;
55
$this->location_id = $location_id;
56
57
// Initialize logger
58
$logger = $this->getFromContainer('logger');
59
$this->logger = $logger;
60
}
61
62
/**
63
* Send a request to the Square API.
64
*
65
* @param string $method Specifies the endpoint and method to invoke
66
* @param array $params The parameters to include in the api call
67
* @param string $type The HTTP request type
68
* @return stdClass An object containing the api response
69
*/
70
private function apiRequest($method, array $params = [], $type = 'GET')
71
{
72
// Send request
73
$ch = curl_init();
74
curl_setopt($ch, CURLOPT_TIMEOUT, 20);
75
curl_setopt($ch, CURLOPT_FRESH_CONNECT, true);
76
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
77
78
if (Configure::get('Blesta.curl_verify_ssl')) {
79
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
80
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
81
} else {
82
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
83
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
84
}
85
86
// Set authentication details
87
curl_setopt($ch, CURLOPT_HTTPHEADER, [
88
'Content-Type: application/json',
89
'Authorization: Bearer ' . $this->access_token
90
]);
Now I receive a new error code:
Creation of dynamic property DefaultBehaviour::$nonExistingProp is deprecated.