Skip to content

Commit

Permalink
Merge pull request #26 from AJenbo/phpstan
Browse files Browse the repository at this point in the history
Fix for remaning level 0 issues
  • Loading branch information
condor2 authored Dec 22, 2023
2 parents 199e02b + bae776b commit b9763f2
Show file tree
Hide file tree
Showing 11 changed files with 12 additions and 30 deletions.
2 changes: 0 additions & 2 deletions upload/admin/model/extension/payment/divido.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ public function getAllPlans() {
throw new Exception("No Divido api-key defined");
}

Divido::setMerchant($api_key);

$response = Divido_Finances::all();
if ($response->status != 'ok') {
throw new Exception("Can't get list of finance plans from Divido!");
Expand Down
2 changes: 1 addition & 1 deletion upload/admin/model/extension/payment/pp_express.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function addTransaction($transaction_data, $request_data = array()) {
if ($request_data) {
$serialized_data = json_encode($request_data);

$this->db->query("UPDATE " . DB_PREFIX . "paypal_order_transaction SET call_data = '" . $this->db->escape($serialized_data) . "' WHERE paypal_order_transaction_id = " . (int)$paypal_order_transaction_id . " LIMIT 1");
$this->db->query("UPDATE " . DB_PREFIX . "paypal_order_transaction SET call_data = '" . $this->db->escape($serialized_data) . "' WHERE paypal_order_transaction_id = " . (int)$transaction_data['transaction_id'] . " LIMIT 1");
}


Expand Down
6 changes: 0 additions & 6 deletions upload/catalog/controller/extension/module/ebay_listing.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,8 @@ public function index() {

$data['products'] = array();

$products = $this->cache->get('ebay_listing.' . md5(serialize($products)));

if (!$products) {
$products = $this->model_extension_openbay_ebay_product->getDisplayProducts();

$this->cache->set('ebay_listing.' . md5(serialize($products)), $products);
}

foreach($products['products'] as $product) {
if (isset($product['pictures'][0])) {
$image = $this->model_extension_openbay_ebay_product->resize($product['pictures'][0], $this->config->get('ebay_listing_width'), $this->config->get('ebay_listing_height'));
Expand Down
1 change: 1 addition & 0 deletions upload/catalog/controller/startup/router.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public function index() {
// Sanitize the call
$route = preg_replace('/[^a-zA-Z0-9_\/]/', '', (string)$route);

$data = [];
// Trigger the pre events
$result = $this->event->trigger('controller/' . $route . '/before', array(&$route, &$data));

Expand Down
5 changes: 0 additions & 5 deletions upload/catalog/model/extension/payment/divido.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ class ModelExtensionPaymentDivido extends Model {
const CACHE_KEY_PLANS = 'divido_plans';

public function setMerchant($api_key) {
if ($api_key) {
Divido::setMerchant($api_key);
}
}

public function getMethod($payment_address, $total) {
Expand Down Expand Up @@ -153,8 +150,6 @@ public function getAllPlans() {
throw new Exception("No Divido api-key defined");
}

Divido::setMerchant($api_key);

$response = Divido_Finances::all();
if ($response->status != 'ok') {
throw new Exception("Can't get list of finance plans from Divido!");
Expand Down
5 changes: 3 additions & 2 deletions upload/system/engine/event.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
namespace Opencart\System\Engine;
/*
* Event System Userguide
*
Expand All @@ -12,7 +13,7 @@ public function __construct($registry) {
$this->registry = $registry;
}

public function register($trigger, Action $action) {
public function register($trigger, \Action $action) {
$this->data[$trigger][] = $action;
}

Expand All @@ -22,7 +23,7 @@ public function trigger($event, array $args = array()) {
foreach ($actions as $action) {
$result = $action->execute($this->registry, $args);

if (!is_null($result) && !($result instanceof Exception)) {
if (!is_null($result) && !($result instanceof \Exception)) {
return $result;
}
}
Expand Down
4 changes: 3 additions & 1 deletion upload/system/engine/front.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public function dispatch(Action $action, Action $error) {
*
*
* @param object $action
* @return object
* @return ?object
*/
private function execute(Action $action) {
$result = $action->execute($this->registry);
Expand All @@ -77,5 +77,7 @@ private function execute(Action $action) {

return $action;
}

return null;
}
}
4 changes: 0 additions & 4 deletions upload/system/engine/proxy.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,8 @@ public function __call($key, $args) {
$args = func_get_args();

foreach ($args as $arg) {
if ($arg instanceof Ref) {
$arg_data[] =& $arg->getRef();
} else {
$arg_data[] =& $arg;
}
}

if (isset($this->data[$key])) {
return call_user_func_array($this->data[$key], $arg_data);
Expand Down
2 changes: 1 addition & 1 deletion upload/system/framework.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
});

// Event
$event = new Event($registry);
$event = new \Opencart\System\Engine\Event($registry);
$registry->set('event', $event);

// Event Register
Expand Down
9 changes: 1 addition & 8 deletions upload/system/helper/json.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,6 @@ function json_decode($json, $assoc = false) {

$json = strtr($json, array_map('stripcslashes', $m2s));

$function = @create_function('', "return {$json};");
$return = ($function) ? $function() : null;

unset($s2m);
unset($m2s);
unset($function);

return $return;
return eval('return {'.$json.'}');
}
}
2 changes: 2 additions & 0 deletions upload/system/library/session/file.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,7 @@ public function destroy($session_id) {
if (is_file($file)) {
unlink($file);
}

return true;
}
}

0 comments on commit b9763f2

Please sign in to comment.