add some phpdoc

This commit is contained in:
Manuel Raynaud
2014-03-17 14:55:26 +01:00
parent 0d6354debc
commit 99eb5c01f4
10 changed files with 74 additions and 10 deletions

View File

@@ -166,7 +166,6 @@ abstract class AbstractSeoCrudController extends AbstractCrudController
return $response; return $response;
} }
// Error (Default: false) // Error (Default: false)
$error_msg = false; $error_msg = false;

View File

@@ -27,6 +27,11 @@ class Admin extends BaseAdmin implements UserInterface
{ {
use ModelEventDispatcherTrait; use ModelEventDispatcherTrait;
/**
* Retrieve all permissions for the current admin
*
* @return array|string
*/
public function getPermissions() public function getPermissions()
{ {
$profileId = $this->getProfileId(); $profileId = $this->getProfileId();
@@ -105,7 +110,7 @@ class Admin extends BaseAdmin implements UserInterface
*/ */
public function eraseCredentials() public function eraseCredentials()
{ {
$this->setPassword(null); parent::setPassword(null);
} }
/** /**

View File

@@ -4,7 +4,7 @@ namespace Thelia\Model;
use Thelia\Model\Base\AreaDeliveryModule as BaseAreaDeliveryModule; use Thelia\Model\Base\AreaDeliveryModule as BaseAreaDeliveryModule;
class AreaDeliveryModule extends BaseAreaDeliveryModule class AreaDeliveryModule extends BaseAreaDeliveryModule
{ {
} }

View File

@@ -8,6 +8,13 @@ use Thelia\Model\Base\Cart as BaseCart;
class Cart extends BaseCart class Cart extends BaseCart
{ {
/**
* Duplicate the current existing cart. Only the token is changed
*
* @param $token
* @param Customer $customer
* @return Cart
*/
public function duplicate($token, Customer $customer = null) public function duplicate($token, Customer $customer = null)
{ {
$cartItems = $this->getCartItems(); $cartItems = $this->getCartItems();
@@ -62,6 +69,11 @@ class Cart extends BaseCart
return $cart; return $cart;
} }
/**
* Retrieve the last item added in the cart
*
* @return CartItem
*/
public function getLastCartItemAdded() public function getLastCartItemAdded()
{ {
return CartItemQuery::create() return CartItemQuery::create()
@@ -71,6 +83,18 @@ class Cart extends BaseCart
; ;
} }
/**
*
* Retrieve the total taxed amount.
*
* By default, the total include the discount
*
* /!\ The postage amount is not available so it's the total with or without discount an without postage
*
* @param Country $country
* @param bool $discount
* @return float|int
*/
public function getTaxedAmount(Country $country, $discount = true) public function getTaxedAmount(Country $country, $discount = true)
{ {
$total = 0; $total = 0;
@@ -86,7 +110,13 @@ class Cart extends BaseCart
return $total; return $total;
} }
public function getTotalAmount() /**
*
* @see getTaxedAmount same as this method but the amount is without taxes
* @param bool $discount
* @return float|int
*/
public function getTotalAmount($discount = true)
{ {
$total = 0; $total = 0;
@@ -97,11 +127,18 @@ class Cart extends BaseCart
$total += $subtotal; $total += $subtotal;
} }
$total -= $this->getDiscount(); if ($discount) {
$total -= $this->getDiscount();
}
return $total; return $total;
} }
/**
* Retrieve the total weight for all products in cart
*
* @return float|int
*/
public function getWeight() public function getWeight()
{ {
$weight = 0; $weight = 0;

View File

@@ -36,6 +36,8 @@ class Category extends BaseCategory
* *
* count all products for current category and sub categories * count all products for current category and sub categories
* *
* /!\ the number of queries is exponential, use it with caution
*
* @return int * @return int
*/ */
public function countAllProducts() public function countAllProducts()

View File

@@ -4,7 +4,7 @@ namespace Thelia\Model;
use Thelia\Model\Base\CategoryImageI18n as BaseCategoryImageI18n; use Thelia\Model\Base\CategoryImageI18n as BaseCategoryImageI18n;
class CategoryImageI18n extends BaseCategoryImageI18n class CategoryImageI18n extends BaseCategoryImageI18n
{ {
} }

View File

@@ -18,6 +18,16 @@ class ConfigQuery extends BaseConfigQuery
{ {
protected static $cache = array(); protected static $cache = array();
/**
*
* Find a config variable and return the value or default value if not founded.
*
* Use this method for better performance, a cache is created for each variable already searched
*
* @param $search
* @param null $default
* @return mixed
*/
public static function read($search, $default = null) public static function read($search, $default = null)
{ {
if (array_key_exists($search, self::$cache)) { if (array_key_exists($search, self::$cache)) {

View File

@@ -16,6 +16,14 @@ class Country extends BaseCountry
{ {
use \Thelia\Model\Tools\ModelEventDispatcherTrait; use \Thelia\Model\Tools\ModelEventDispatcherTrait;
/**
*
* Put the current country as the default one.
*
* @throws \RuntimeException
* @throws \Exception
* @throws \Propel\Runtime\Exception\PropelException
*/
public function toggleDefault() public function toggleDefault()
{ {
if ($this->getId() === null) { if ($this->getId() === null) {

View File

@@ -212,7 +212,7 @@ class Customer extends BaseCustomer implements UserInterface
*/ */
public function eraseCredentials() public function eraseCredentials()
{ {
$this->setPassword(null); parent::setPassword(null);
} }
/** /**

View File

@@ -48,9 +48,12 @@ class Order extends BaseOrder
/** /**
* Compute this order amount. * Compute this order amount.
* *
* @param float $tax (output only) returns the tax amount for this order * The order amount amount is only avaible once the order is persisted in database.
* @param bool $includePostage if true, the postage cost is included to the total * Duting invoice process, use all cart methods instead of order methods (the order doest not exists at this moment)
* @param bool $includeDiscount if true, the discount will be included to the total *
* @param float|int $tax (output only) returns the tax amount for this order
* @param bool $includePostage if true, the postage cost is included to the total
* @param bool $includeDiscount if true, the discount will be included to the total
* @return float * @return float
*/ */
public function getTotalAmount(&$tax = 0, $includePostage = true, $includeDiscount = true) public function getTotalAmount(&$tax = 0, $includePostage = true, $includeDiscount = true)