for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace ABM\Wasabi;
use Ratchet\MessageComponentInterface;
use Ratchet\ConnectionInterface;
use Analog\Analog;
class Cart
{
/**
* @param string $data
*/
public function getCartData($data) {
$cart = substr($data, 0, strpos($data, ','));
$cust = substr($data, strpos($data, ',') + 1);
Analog::log("Cart & customer variables: $data");
$otherCarts = $this->processFindCarts($cart, $cust);
return $otherCarts;
}
* @param string $cart
* @param string $cust
private function processFindCarts($cart, $cust)
$sql = 'SELECT DISTINCT pc.id_cart as id, DATE_FORMAT(pc.date_upd,"%a %D %b %Y, %l:%i %p") as timer from '._DB_PREFIX_.'cart as pc
LEFT JOIN '._DB_PREFIX_.'cart_product as pcp on pcp.id_cart = pc.id_cart
WHERE pc.id_cart NOT IN (SELECT po.id_cart FROM '._DB_PREFIX_.'orders as po)
AND pcp.id_product IS NOT NULL
AND pc.id_customer = '.(int) $cust.'
AND pc.id_cart != '.(int) $cart.'
ORDER BY pc.date_upd DESC
LIMIT 10';
if ($results = $this->dbConn->fetchRowMany($sql)) {
dbConn
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
class MyClass { } $x = new MyClass(); $x->foo = true;
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:
class MyClass { public $foo; } $x = new MyClass(); $x->foo = true;
foreach ($results as &$row) {
$row['token'] = md5(_COOKIE_KEY_.'recover_cart_'.$row['id']);
return $results;
} else {
return;
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: