Skip to content

Commit

Permalink
[PSR-2] Replace indentation tabs with 4 spaces
Browse files Browse the repository at this point in the history
Fixed with php-cs-fixer and `indentation` fixer
  • Loading branch information
julienbourdeau committed Jul 7, 2015
1 parent d766319 commit 5a304c2
Show file tree
Hide file tree
Showing 662 changed files with 168,069 additions and 168,069 deletions.
28 changes: 14 additions & 14 deletions Adapter/Adapter_AddressFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,25 +26,25 @@

class Adapter_AddressFactory
{
/**
* Initilize an address corresponding to the specified id address or if empty to the
* default shop configuration
* @param null $id_address
* @param bool $with_geoloc
* @return Address
*/
public function findOrCreate($id_address = null, $with_geoloc = false)
/**
* Initilize an address corresponding to the specified id address or if empty to the
* default shop configuration
* @param null $id_address
* @param bool $with_geoloc
* @return Address
*/
public function findOrCreate($id_address = null, $with_geoloc = false)
{
$func_args = func_get_args();
return call_user_func_array(array('Address', 'initialize'), $func_args);
}

/**
* Check if an address exists depending on given $id_address
* @param $id_address
* @return bool
*/
public function addressExists($id_address)
/**
* Check if an address exists depending on given $id_address
* @param $id_address
* @return bool
*/
public function addressExists($id_address)
{
return Address::addressExists($id_address);
}
Expand Down
14 changes: 7 additions & 7 deletions Adapter/Adapter_Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@
class Adapter_Configuration implements Core_Business_ConfigurationInterface
{

/**
* Returns constant defined by given $key if exists or check directly into PrestaShop
* Configuration
* @param $key
* @return mixed
*/
public function get($key)
/**
* Returns constant defined by given $key if exists or check directly into PrestaShop
* Configuration
* @param $key
* @return mixed
*/
public function get($key)
{
if (defined($key)) {
return constant($key);
Expand Down
26 changes: 13 additions & 13 deletions Adapter/Adapter_Database.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,23 @@

class Adapter_Database implements Core_Foundation_Database_DatabaseInterface
{
/**
* Perform a SELECT sql statement
* @param $sqlString
* @return array|false
* @throws PrestaShopDatabaseException
*/
public function select($sqlString)
/**
* Perform a SELECT sql statement
* @param $sqlString
* @return array|false
* @throws PrestaShopDatabaseException
*/
public function select($sqlString)
{
return Db::getInstance()->executeS($sqlString);
}

/**
* Escape $unsafe to be used into a SQL statement
* @param $unsafeData
* @return string
*/
public function escape($unsafeData)
/**
* Escape $unsafe to be used into a SQL statement
* @param $unsafeData
* @return string
*/
public function escape($unsafeData)
{
// Prepare required params
$html_ok = true;
Expand Down
134 changes: 67 additions & 67 deletions Adapter/Adapter_EntityMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,82 +26,82 @@

class Adapter_EntityMapper {

/**
* Load ObjectModel
* @param $id
* @param $id_lang
* @param $entity ObjectModel
* @param $entity_defs
* @param $id_shop
* @param $should_cache_objects
* @throws PrestaShopDatabaseException
*/
public function load($id, $id_lang, $entity, $entity_defs, $id_shop, $should_cache_objects)
{
// Load object from database if object id is present
$cache_id = 'objectmodel_' . $entity_defs['classname'] . '_' . (int)$id . '_' . (int)$id_shop . '_' . (int)$id_lang;
if (!$should_cache_objects || !Cache::isStored($cache_id)) {
$sql = new DbQuery();
$sql->from($entity_defs['table'], 'a');
$sql->where('a.`' . bqSQL($entity_defs['primary']) . '` = ' . (int)$id);
/**
* Load ObjectModel
* @param $id
* @param $id_lang
* @param $entity ObjectModel
* @param $entity_defs
* @param $id_shop
* @param $should_cache_objects
* @throws PrestaShopDatabaseException
*/
public function load($id, $id_lang, $entity, $entity_defs, $id_shop, $should_cache_objects)
{
// Load object from database if object id is present
$cache_id = 'objectmodel_' . $entity_defs['classname'] . '_' . (int)$id . '_' . (int)$id_shop . '_' . (int)$id_lang;
if (!$should_cache_objects || !Cache::isStored($cache_id)) {
$sql = new DbQuery();
$sql->from($entity_defs['table'], 'a');
$sql->where('a.`' . bqSQL($entity_defs['primary']) . '` = ' . (int)$id);

// Get lang informations
if ($id_lang && isset($entity_defs['multilang']) && $entity_defs['multilang']) {
// Get lang informations
if ($id_lang && isset($entity_defs['multilang']) && $entity_defs['multilang']) {

$sql->leftJoin($entity_defs['table'] . '_lang', 'b', 'a.`' . bqSQL($entity_defs['primary']) . '` = b.`' . bqSQL($entity_defs['primary']) . '` AND b.`id_lang` = ' . (int)$id_lang);
if ($id_shop && !empty($entity_defs['multilang_shop'])) {
$sql->where('b.`id_shop` = ' . (int)$id_shop);
}
}
$sql->leftJoin($entity_defs['table'] . '_lang', 'b', 'a.`' . bqSQL($entity_defs['primary']) . '` = b.`' . bqSQL($entity_defs['primary']) . '` AND b.`id_lang` = ' . (int)$id_lang);
if ($id_shop && !empty($entity_defs['multilang_shop'])) {
$sql->where('b.`id_shop` = ' . (int)$id_shop);
}
}

// Get shop informations
if (Shop::isTableAssociated($entity_defs['table'])) {
$sql->leftJoin($entity_defs['table'] . '_shop', 'c', 'a.`' . bqSQL($entity_defs['primary']) . '` = c.`' . bqSQL($entity_defs['primary']) . '` AND c.`id_shop` = ' . (int)$id_shop);
}
// Get shop informations
if (Shop::isTableAssociated($entity_defs['table'])) {
$sql->leftJoin($entity_defs['table'] . '_shop', 'c', 'a.`' . bqSQL($entity_defs['primary']) . '` = c.`' . bqSQL($entity_defs['primary']) . '` AND c.`id_shop` = ' . (int)$id_shop);
}

if ($object_datas = Db::getInstance()->getRow($sql)) {
if (!$id_lang && isset($entity_defs['multilang']) && $entity_defs['multilang']) {
if ($object_datas = Db::getInstance()->getRow($sql)) {
if (!$id_lang && isset($entity_defs['multilang']) && $entity_defs['multilang']) {

$sql = 'SELECT *
$sql = 'SELECT *
FROM `' . bqSQL(_DB_PREFIX_ . $entity_defs['table']) . '_lang`
WHERE `' . bqSQL($entity_defs['primary']) . '` = ' . (int)$id
.(($id_shop && $entity->isLangMultishop()) ? ' AND `id_shop` = ' . (int)$id_shop : '');
.(($id_shop && $entity->isLangMultishop()) ? ' AND `id_shop` = ' . (int)$id_shop : '');

if ($object_datas_lang = Db::getInstance()->executeS($sql)) {
if ($object_datas_lang = Db::getInstance()->executeS($sql)) {

foreach ($object_datas_lang as $row) {
foreach ($row as $key => $value) {
if ($key != $entity_defs['primary'] && array_key_exists($key, $entity)) {
if (!isset($object_datas[$key]) || !is_array($object_datas[$key]))
$object_datas[$key] = array();
foreach ($object_datas_lang as $row) {
foreach ($row as $key => $value) {
if ($key != $entity_defs['primary'] && array_key_exists($key, $entity)) {
if (!isset($object_datas[$key]) || !is_array($object_datas[$key]))
$object_datas[$key] = array();

$object_datas[$key][$row['id_lang']] = $value;
}
}
}
}
}
$entity->id = (int)$id;
foreach ($object_datas as $key => $value) {
if (array_key_exists($key, $entity)) {
$entity->{$key} = $value;
} else {
unset($object_datas[$key]);
}
}
if ($should_cache_objects) {
Cache::store($cache_id, $object_datas);
}
}
} else {
$object_datas = Cache::retrieve($cache_id);
if ($object_datas) {
$entity->id = (int)$id;
foreach ($object_datas as $key => $value) {
$entity->{$key} = $value;
}
}
}
}
$object_datas[$key][$row['id_lang']] = $value;
}
}
}
}
}
$entity->id = (int)$id;
foreach ($object_datas as $key => $value) {
if (array_key_exists($key, $entity)) {
$entity->{$key} = $value;
} else {
unset($object_datas[$key]);
}
}
if ($should_cache_objects) {
Cache::store($cache_id, $object_datas);
}
}
} else {
$object_datas = Cache::retrieve($cache_id);
if ($object_datas) {
$entity->id = (int)$id;
foreach ($object_datas as $key => $value) {
$entity->{$key} = $value;
}
}
}
}

}
6 changes: 3 additions & 3 deletions Adapter/Adapter_ProductPriceCalculator.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,18 @@ public function getProductPrice(
$id_product_attribute = null,
$decimals = 6,
$divisor = null,
$only_reduc = false,
$only_reduc = false,
$usereduc = true,
$quantity = 1,
$force_associated_tax = false,
$id_customer = null,
$id_cart = null,
$id_address = null,
$id_address = null,
&$specific_price_output = null,
$with_ecotax = true,
$use_group_reduction = true,
Context $context = null,
$use_customer_price = true
$use_customer_price = true
)
{
return Product::getPriceStatic(
Expand Down
44 changes: 22 additions & 22 deletions Adapter/Adapter_ServiceLocator.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,29 +26,29 @@

class Adapter_ServiceLocator
{
/**
* Set a service container Instance
* @var Core_Foundation_IoC_Container
*/
private static $service_container;
/**
* Set a service container Instance
* @var Core_Foundation_IoC_Container
*/
private static $service_container;

public static function setServiceContainerInstance(Core_Foundation_IoC_Container $container)
{
self::$service_container = $container;
}
public static function setServiceContainerInstance(Core_Foundation_IoC_Container $container)
{
self::$service_container = $container;
}

/**
* Get a service depending on its given $serviceName
* @param $serviceName
* @return mixed|object
* @throws Adapter_Exception
*/
public static function get($serviceName)
{
if (empty(self::$service_container) || is_null(self::$service_container)) {
throw new Adapter_Exception('Service container is not set.');
}
/**
* Get a service depending on its given $serviceName
* @param $serviceName
* @return mixed|object
* @throws Adapter_Exception
*/
public static function get($serviceName)
{
if (empty(self::$service_container) || is_null(self::$service_container)) {
throw new Adapter_Exception('Service container is not set.');
}

return self::$service_container->make($serviceName);
}
return self::$service_container->make($serviceName);
}
}
Loading

0 comments on commit 5a304c2

Please sign in to comment.