Skip to content

Commit

Permalink
Some indentation and type parameter's work
Browse files Browse the repository at this point in the history
  • Loading branch information
condor2 committed Dec 26, 2023
1 parent 9f16791 commit 1876f08
Show file tree
Hide file tree
Showing 26 changed files with 472 additions and 414 deletions.
22 changes: 11 additions & 11 deletions upload/system/config/catalog.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,17 @@
$_['action_event'] = [
'view/*/before' => 'event/theme',

'model/extension/analytics/*/before' => 'event/compatibility/beforeModel',
'model/extension/captcha/*/before' => 'event/compatibility/beforeModel',
'model/extension/credit_card/*/before' => 'event/compatibility/beforeModel',
'model/extension/feed/*/before' => 'event/compatibility/beforeModel',
'model/extension/fraud/*/before' => 'event/compatibility/beforeModel',
'model/extension/module/*/before' => 'event/compatibility/beforeModel',
'model/extension/payment/*/before' => 'event/compatibility/beforeModel',
'model/extension/recurring/*/before' => 'event/compatibility/beforeModel',
'model/extension/shipping/*/before' => 'event/compatibility/beforeModel',
'model/extension/theme/*/before' => 'event/compatibility/beforeModel',
'model/extension/total/*/before' => 'event/compatibility/beforeModel',
'model/extension/analytics/*/before' => 'event/compatibility/beforeModel',
'model/extension/captcha/*/before' => 'event/compatibility/beforeModel',
'model/extension/credit_card/*/before' => 'event/compatibility/beforeModel',
'model/extension/feed/*/before' => 'event/compatibility/beforeModel',
'model/extension/fraud/*/before' => 'event/compatibility/beforeModel',
'model/extension/module/*/before' => 'event/compatibility/beforeModel',
'model/extension/payment/*/before' => 'event/compatibility/beforeModel',
'model/extension/recurring/*/before' => 'event/compatibility/beforeModel',
'model/extension/shipping/*/before' => 'event/compatibility/beforeModel',
'model/extension/theme/*/before' => 'event/compatibility/beforeModel',
'model/extension/total/*/before' => 'event/compatibility/beforeModel',

'model/analytics/*/after' => 'event/compatibility/afterModel',
'model/captcha/*/after' => 'event/compatibility/afterModel',
Expand Down
48 changes: 24 additions & 24 deletions upload/system/config/paypal.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
'production' => [
'partner_id' => 'TY2Q25KP2PX9L',
'client_id' => 'AbjxI4a9fMnew8UOMoDFVwSh7h1aeOBaXpd2wcccAnuqecijKIylRnNguGRWDrEPrTYraBQApf_-O3_4',
'partner_attribution_id' => 'OPENCARTLIMITED_Cart_OpenCartPCP'
'partner_attribution_id' => 'OPENCARTLIMITED_Cart_OpenCartPCP'
],
'sandbox' => [
'partner_id' => 'EJNHWRJJNB38L',
Expand Down Expand Up @@ -94,10 +94,10 @@
'type' => 'buy'
],
'card' => [
'status' => true,
'align' => 'right',
'size' => 'large',
'secure_status' => true,
'status' => true,
'align' => 'right',
'size' => 'large',
'secure_status' => true,
'secure_scenario' => [
'failed_authentication' => 0,
'rejected_authentication' => 0,
Expand Down Expand Up @@ -167,9 +167,9 @@
],
'order_status' => [
'completed' => [
'code' => 'completed',
'name' => 'text_completed_status',
'id' => 5
'code' => 'completed',
'name' => 'text_completed_status',
'id' => 5
],
'denied' => [
'code' => 'denied',
Expand Down Expand Up @@ -462,20 +462,20 @@
],
'button_insert_type' => [
'into_begin' => [
'code' => 'prepend',
'name' => 'text_insert_prepend'
'code' => 'prepend',
'name' => 'text_insert_prepend'
],
'into_end' => [
'code' => 'append',
'name' => 'text_insert_append'
'code' => 'append',
'name' => 'text_insert_append'
],
'before' => [
'code' => 'before',
'name' => 'text_insert_before'
'code' => 'before',
'name' => 'text_insert_before'
],
'after' => [
'code' => 'after',
'name' => 'text_insert_after'
'code' => 'after',
'name' => 'text_insert_after'
]
],
'button_align' => [
Expand Down Expand Up @@ -829,7 +829,7 @@
],
'card_secure_scenario' => [
'failed_authentication' => [
'code' => 'failed_authentication',
'code' => 'failed_authentication',
'name' => 'text_3ds_failed_authentication',
'error' => 'error_3ds_failed_authentication',
'recommended' => 0
Expand Down Expand Up @@ -879,12 +879,12 @@
],
'message_insert_type' => [
'into_begin' => [
'code' => 'prepend',
'name' => 'text_insert_prepend'
'code' => 'prepend',
'name' => 'text_insert_prepend'
],
'into_end' => [
'code' => 'append',
'name' => 'text_insert_append'
'code' => 'append',
'name' => 'text_insert_append'
],
'before' => [
'code' => 'before',
Expand Down Expand Up @@ -953,7 +953,7 @@
'name' => 'text_white'
]
],
'message_text_size' => ['10', '11', '12', '13', '14', '15', '16'],
'message_text_size' => ['10', '11', '12', '13', '14', '15', '16'],
'message_flex_color' => [
'blue' => [
'code' => 'blue',
Expand All @@ -969,8 +969,8 @@
]
],
'message_flex_ratio' => ['1x1', '1x4', '8x1', '20x1'],
'contact_sales' => ['100k - 250k', '250k - 2m', '2m - 10m', '10m - 20m', '20m - 50m', '50m +'],
'contact_product' => [
'contact_sales' => ['100k - 250k', '250k - 2m', '2m - 10m', '10m - 20m', '20m - 50m', '50m +'],
'contact_product' => [
[
'code' => 'BT DCC',
'name' => 'text_bt_dcc'
Expand Down
4 changes: 2 additions & 2 deletions upload/system/library/cache/file.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function get($key) {
return false;
}

public function set($key, $value, $expire = '') {
public function set($key, $value, $expire = ''): void {
$this->delete($key);

if (!$expire) {
Expand All @@ -69,7 +69,7 @@ public function set($key, $value, $expire = '') {
fclose($handle);
}

public function delete($key) {
public function delete($key): void {
$files = glob(DIR_CACHE . 'cache.' . basename($key) . '.*');

if ($files) {
Expand Down
4 changes: 2 additions & 2 deletions upload/system/library/cache/mem.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
class Mem {
private $expire;
private $memcache;
const CACHEDUMP_LIMIT = 9999;
public const CACHEDUMP_LIMIT = 9999;

public function __construct($expire) {
$this->expire = $expire;
Expand All @@ -24,7 +24,7 @@ public function set($key, $value, $expire = '') {
return $this->memcache->set(CACHE_PREFIX . $key, $value, MEMCACHE_COMPRESSED, $expire);
}

public function delete($key) {
public function delete($key): void {
$this->memcache->delete(CACHE_PREFIX . $key);
}
}
66 changes: 47 additions & 19 deletions upload/system/library/cache/redis.php
Original file line number Diff line number Diff line change
@@ -1,41 +1,69 @@
<?php
namespace Cache;
class Redis {
private $expire;
private $cache;
/**
* @var object|\Redis
*/
private object $redis;
/**
* @var int
*/
private int $expire;

public function __construct($expire) {
/**
* Constructor
*
* @param int $expire
*/
public function __construct(int $expire = 3600) {
$this->expire = $expire;

$this->cache = new \Redis();
$this->cache->pconnect(CACHE_HOSTNAME, CACHE_PORT);
$this->redis = new \Redis();
$this->redis->pconnect(CACHE_HOSTNAME, CACHE_PORT);
}

public function get($key) {
/**
* Get
*
* @param string $key
*
* @return mixed
*/
public function get(string $key) {
$data = $this->redis->get(CACHE_PREFIX . $key);

if ($this->cache->exists(CACHE_PREFIX . $key)) {
$data = $this->cache->get(CACHE_PREFIX . $key);
return json_decode($data, true);
}

return false;
return json_decode($data, true);
}

public function set($key, $value, $expire = '') {
/**
* Set
*
* @param string $key
* @param mixed $value
* @param int $expire
*
* @return void
*/
public function set(string $key, $value, int $expire = 0): void {
if (!$expire) {
$expire = $this->expire;
}

$status = $this->cache->set(CACHE_PREFIX . $key, json_encode($value));
$status = $this->redis->set(CACHE_PREFIX . $key, json_encode($value));

if ($status) {
$this->cache->expire(CACHE_PREFIX . $key, $expire);
$this->redis->expire(CACHE_PREFIX . $key, $expire);
}

return $status;
}

public function delete($key) {
$this->cache->del(CACHE_PREFIX . $key);
/**
* Delete
*
* @param string $key
*
* @return void
*/
public function delete(string $key): void {
$this->redis->del(CACHE_PREFIX . $key);
}
}
50 changes: 25 additions & 25 deletions upload/system/library/cart/affiliate.php
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
<?php
namespace Cart;
class Affiliate {
private $db;
private $config;
private $request;
private $session;
private $affiliate_id = 0;
private $firstname = '';
private $lastname = '';
private $email = '';
private $telephone = '';
private $fax = '';
private $code = '';

public function __construct($registry) {
private object $db;
private object $config;
private object $request;
private object $session;
private int $affiliate_id = 0;
private string $firstname = '';
private string $lastname = '';
private string $email = '';
private string $telephone = '';
private string $fax = '';
private string $code = '';

public function __construct(object $registry) {
$this->db = $registry->get('db');
$this->config = $registry->get('config');
$this->request = $registry->get('request');
Expand All @@ -38,8 +38,8 @@ public function __construct($registry) {
}
}

public function login($email, $password) {
$affiliate_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "affiliate WHERE LOWER(email) = '" . $this->db->escape(utf8_strtolower($email)) . "' AND status = '1' AND approved = '1'");
public function login(string $email, string $password): bool {
$affiliate_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "affiliate WHERE LOWER(email) = '" . $this->db->escape(utf8_strtolower($email)) . "' AND status = '1' AND approved = '1'");

if ($affiliate_query->num_rows) {
if (password_verify($password, $affiliate_query->row['password'])) {
Expand Down Expand Up @@ -72,7 +72,7 @@ public function login($email, $password) {
}
}

public function logout() {
public function logout(): void {
unset($this->session->data['affiliate_id']);

$this->affiliate_id = 0;
Expand All @@ -83,35 +83,35 @@ public function logout() {
$this->fax = '';
}

public function isLogged() {
public function isLogged(): bool {
return $this->affiliate_id;
}

public function getId() {
public function getId(): int {
return $this->affiliate_id;
}

public function getFirstName() {
public function getFirstName(): string {
return $this->firstname;
}

public function getLastName() {
public function getLastName(): string {
return $this->lastname;
}

public function getEmail() {
public function getEmail(): string {
return $this->email;
}

public function getTelephone() {
public function getTelephone(): string {
return $this->telephone;
}

public function getFax() {
public function getFax(): string {
return $this->fax;
}

public function getCode() {
public function getCode(): string {
return $this->code;
}
}
}
2 changes: 1 addition & 1 deletion upload/system/library/cart/cart.php
Original file line number Diff line number Diff line change
Expand Up @@ -410,4 +410,4 @@ public function hasDownload() {

return false;
}
}
}
2 changes: 1 addition & 1 deletion upload/system/library/cart/currency.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,4 +186,4 @@ public function getValue($currency) {
public function has($currency) {
return isset($this->currencies[$currency]);
}
}
}
Loading

0 comments on commit 1876f08

Please sign in to comment.