/** * Generate the Pet Basket of a user * @param type $userId generate this user's basket * @param type $returnType 'json' for json formatted object, else php Basket object * @return mixed Basket instance or json version of Basket instance */ public static function myPetBasket($userId, $returnType) { $basket = Basket::constructByUserId($userId); if ($returnType === 'json') { return json_encode($basket->__toString()); } return $basket; }