Обнаружил такой код у заказчика... не понимаю почему так написано:
if (!empty($product_info))
{
if ($product_info['status'] == 1)
{
$this->data['product_name'] = $product_info['name'];
$this->data['product_image'] = $product_info['image'];
$this->data['product_price'] = $product_info['price'];
if (isset($this->request->get['count']))
$this->data['product_count'] = $this->request->get['count'];
}
else
$this->data['isWrongProduct'] = true;
}
else
$this->data['isWrongProduct'] = true;
Можно ли сократить код до:
if (!empty($product_info) && $product_info['status'] == 1)
{
$this->data['product_name'] = $product_info['name'];
$this->data['product_image'] = $product_info['image'];
$this->data['product_price'] = $product_info['price'];
if (isset($this->request->get['count']))
$this->data['product_count'] = $this->request->get['count'];
}
else
$this->data['isWrongProduct'] = true;
или могут возникнуть ошибки undefined?