Doing custom debug method, I thought use/create a library but a private function (if agree with me: controller are classes, right?) is a comfortable piece to access/use.
<?php
class CartController extends BaseController {
// is well decalared?
protected $var;
public function index() {
// https://github.com/Crinsane/LaravelShoppingcart#example
Cart::instance('shopping')->add('192ao12', 'Product 1', 1, 9.99);
Cart::instance('shopping')->add('1239ad0', 'Product 2', 2, 5.95, array('size' => 'large'));
// want to use $cart
$cart = Cart::content();
// comment to continue
$this->_debug($cart);
/* code */
}
private function _debug($var) {
$this->var = $var;
// 'echo' is a little hero, a view? if i can't avoid it i'll do
echo '<pre>';
var_dump($this->var);
echo '</pre>';
die();
}
}
$var
full of objects and things, how to manage it without using dozens of if
s?