Skip to content

Commit

Permalink
PhpCsFixer - blank_line_before_statement
Browse files Browse the repository at this point in the history
  • Loading branch information
BadPixxel committed Sep 1, 2023
1 parent c79dd4b commit 2cb2a22
Show file tree
Hide file tree
Showing 32 changed files with 42 additions and 0 deletions.
1 change: 1 addition & 0 deletions modules/splashsync/splashsync.php
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,7 @@ public function hookDisplayBackOfficeFooter()
if (is_file($bufferFile) && function_exists("json_encode")) {
file_put_contents($bufferFile, json_encode(array()));
}

//====================================================================//
// Render Footer
return $this->display(__FILE__, 'footer.tpl');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public function overrideDescription(string $objectType, array $description): arr
"enable_push_deleted" => 0,
));
}

//====================================================================//
// Other Types => NO Sync
return array_replace_recursive($description, array(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ public function objectsList(string $filter = null, array $params = array()): arr
$sqlFilter .= " OR LOWER( c.name ) LIKE LOWER( '%".pSQL($filter)."%') ";
$sql->where($sqlFilter);
}

//====================================================================//
// Execute Generic Search
return $this->getObjectsListGenericData($sql, "lastname", $params);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public function description(): array
if (!class_exists($configuratorClass) || !is_subclass_of($configuratorClass, AbstractConfigurator::class)) {
return $description;
}

//====================================================================//
// Apply Overrides & Return Object Description Array
return (new $configuratorClass())->overrideDescription(static::getType(), $description);
Expand Down
4 changes: 4 additions & 0 deletions modules/splashsync/src/Objects/Core/MultishopObjectTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public function fields(): array
//====================================================================//
// Load Core Fields from All Shop Context
$fields = MSF::loadFields($this->coreFields());

//====================================================================//
// Redo Override Fields from Local Configurator
return Splash::configurator()->overrideFields(self::getType(), $fields);
Expand Down Expand Up @@ -114,6 +115,7 @@ public function get(string $objectId, array $fields): ?array
if (!empty($objectData) && !isset($objectData["id"])) {
$objectData["id"] = $objectId;
}

//====================================================================//
// Return Object Data of False
return empty($objectData) ? null : $objectData;
Expand Down Expand Up @@ -199,6 +201,7 @@ public function getAllShopsData(string $objectId, array $fieldsList): ?array
MSM::setContext();
$allShopData = $this->coreGet($objectId, $allShopFields);
}

//====================================================================//
// Object Not Found => Exit
return is_array($allShopData) ? $allShopData : null;
Expand Down Expand Up @@ -259,6 +262,7 @@ public function getMsfUpdateFields(string $type)
if (!Shop::isFeatureActive()) {
return null;
}

//====================================================================//
// Return Updated Fields
return $this->updateFields[$type] ?? array();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ protected function getObjectListTotal(string $sql)
if (Db::getInstance()->getNumberError()) {
return Splash::log()->errTrace(Db::getInstance()->getMsgError());
}

//====================================================================//
// Compute Total Number of Results
return Db::getInstance()->numRows();
Expand Down
1 change: 1 addition & 0 deletions modules/splashsync/src/Objects/CreditNote/HooksTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ private function hookactionCreditNote(OrderSlip $order, string $action, string $
if (empty($objectId)) {
Splash::log()->err("ErrLocalTpl", "CreditNote", __FUNCTION__, "Unable to Read Order Slip Id.");
}

//====================================================================//
// Commit Update For Invoice
return $this->doCommit("CreditNote", (string) $objectId, $action, $comment);
Expand Down
2 changes: 2 additions & 0 deletions modules/splashsync/src/Objects/CreditNote/ItemsTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,7 @@ private function getShippingPrice()
if ($this->hasCustomerCartRule()) {
$price = $taxPercent = 0;
}

//====================================================================//
// Build Price Array
return self::prices()->encode(
Expand All @@ -342,6 +343,7 @@ private function getCarrierName(): string
if (!isset($this->carrier) || empty($this->carrier->name)) {
return $this->spl->l("Delivery");
}

//====================================================================//
// Return Carrier Name
return $this->carrier->name;
Expand Down
1 change: 1 addition & 0 deletions modules/splashsync/src/Objects/Order/HooksTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ private function hookactionInvoice(object $order, string $action, string $commen
if (empty($objectId)) {
Splash::log()->err("ErrLocalTpl", "Invoice", __FUNCTION__, "Unable to Read Order Invoice Id.");
}

//====================================================================//
// Commit Update For Invoice
return $this->doCommit("Invoice", (string) $objectId, $action, $comment);
Expand Down
2 changes: 2 additions & 0 deletions modules/splashsync/src/Objects/Order/ItemsTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,7 @@ private function getShippingPrice()
} else {
$taxPercent = 0;
}

//====================================================================//
// Build Price Array
return self::prices()->encode(
Expand All @@ -476,6 +477,7 @@ private function getCarrierName(): string
if (!isset($this->carrier) || empty($this->carrier->name)) {
return $this->spl->l("Delivery");
}

//====================================================================//
// Return Carrier Name
return $this->carrier->name;
Expand Down
1 change: 1 addition & 0 deletions modules/splashsync/src/Objects/Order/ObjectsListTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public function objectsList(string $filter = null, array $params = array()): arr
$where .= " OR LOWER( o.date_add ) LIKE LOWER( '%".pSQL($filter)."%') ";
$sql->where($where);
}

//====================================================================//
// Execute Generic Search
return $this->getObjectsListGenericData($sql, "order_date", $params);
Expand Down
1 change: 1 addition & 0 deletions modules/splashsync/src/Objects/Order/PrimaryTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ public function getByPrimary(array $keys): ?string
if (1 != count($result) || empty($result[0]['id'])) {
return null;
}

//====================================================================//
// Result Found
return $result[0]['id'];
Expand Down
1 change: 1 addition & 0 deletions modules/splashsync/src/Objects/Order/StatusTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ private function getSplashStatus(): string
if ($this->object->hasBeenPaid()) {
return "OrderProcessing";
}

//====================================================================//
// Default Status => Order is Closed & Delivered
// Used for Orders imported to Prestashop that do not have Prestashop Status
Expand Down
1 change: 1 addition & 0 deletions modules/splashsync/src/Objects/Order/TrackingTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ private function getOrderTrackingUrl(): string
if (empty($trackingNumber)) {
return "";
}

//====================================================================//
// Return Carrier Tracking Url
return str_replace("@", $trackingNumber, $this->carrier->url);
Expand Down
1 change: 1 addition & 0 deletions modules/splashsync/src/Objects/Product/AttributeTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ public function deleteAttribute(): bool
if (!empty($attrList)) {
return true;
}

//====================================================================//
// Also Delete Product From DataBase
return $this->object->delete();
Expand Down
1 change: 1 addition & 0 deletions modules/splashsync/src/Objects/Product/CRUDTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ public function delete(string $objectId): bool
if ($this->AttributeId) {
return $this->deleteAttribute();
}

//====================================================================//
// Else Delete Product From DataBase
return $this->object->delete();
Expand Down
2 changes: 2 additions & 0 deletions modules/splashsync/src/Objects/Product/HooksTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ public function hookActionUpdateQuantity(array $params): bool
array_push($unikId, $productId);
}
}

//====================================================================//
// Commit Update For Product
return $this->doCommit("Product", $unikId, SPL_A_UPDATE, $this->l('Product Stock Updated on Prestashop'));
Expand Down Expand Up @@ -269,6 +270,7 @@ private function hookActionProduct($product, $action, $comment)
if (empty($idList)) {
return true;
}

//====================================================================//
// Commit Update For Product
return $this->doCommit("Product", $idList, $action, $comment);
Expand Down
2 changes: 2 additions & 0 deletions modules/splashsync/src/Objects/Product/IdEncoderTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ public static function getUnikIdStatic($productId, $attributeId): string
return (string) $productId.'@@'.(string) $attributeId;
}
}

//====================================================================//
// Generate Standard Id
return (string) ($productId + ($attributeId << 20));
Expand Down Expand Up @@ -109,6 +110,7 @@ private static function decodeIdsStatic($uniqueId)
'aId' => (int) $decoded[1],
);
}

//====================================================================//
// Standard Id Decoder
return array(
Expand Down
1 change: 1 addition & 0 deletions modules/splashsync/src/Objects/Product/ImagesTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ protected function buildInfo($imageId): ArrayObject
_PS_PROD_IMG_DIR_.$objectImage->getImgFolder(),
$publicUrl->getImageLink($imageName, (string) $imageId)
);

//====================================================================//
// Encode Image Information Array
return new ArrayObject(
Expand Down
1 change: 1 addition & 0 deletions modules/splashsync/src/Objects/Product/PrimaryTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ public function getByPrimary(array $keys): ?string
if (1 != count($result)) {
return null;
}

//====================================================================//
// Result Found
return (string) $this->getUnikId(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ private function createVariantProduct(array $objectData): ?Product
if (!$product || !$this->createAttribute()) {
return null;
}

//====================================================================//
// Return Product
return $product;
Expand Down
1 change: 1 addition & 0 deletions modules/splashsync/src/Objects/ThirdParty/CRUDTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ public function create(): ?Customer
if (empty($this->in["email"])) {
return Splash::log()->errNull("ErrLocalFieldMissing", __CLASS__, __FUNCTION__, "email");
}

//====================================================================//
// Create Empty Customer
return new Customer();
Expand Down
1 change: 1 addition & 0 deletions modules/splashsync/src/Objects/ThirdParty/HooksTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ private function hookactionCustomer($customer, $action, $comment)
if (empty($customerId)) {
Splash::log()->err("ErrLocalTpl", __CLASS__, __FUNCTION__, "Unable to Read Customer Id.");
}

//====================================================================//
// Commit Update For Product
return $this->doCommit("ThirdParty", $customerId, $action, $comment);
Expand Down
1 change: 1 addition & 0 deletions modules/splashsync/src/Objects/ThirdParty/MainTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,7 @@ private function getCompanyName(): string
if (!empty($this->object->company)) {
return $this->object->company;
}

//====================================================================//
// Generic FallBack Mode
return "Prestashop(".$this->object->id.")";
Expand Down
1 change: 1 addition & 0 deletions modules/splashsync/src/Objects/ThirdParty/PrimaryTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ public function getByPrimary(array $keys): ?string
if (1 != count($result) || empty($result[0]['id'])) {
return null;
}

//====================================================================//
// Result Found
return $result[0]['id'];
Expand Down
2 changes: 2 additions & 0 deletions modules/splashsync/src/Services/AttributesManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ public static function getGroupById(int $groupId): ?AttributeGroup
//====================================================================//
// Ensure Loading of Attribute Group List
self::getAllGroups();

//====================================================================//
// Return Attribute Group
return self::$groups[$groupId] ?? null;
Expand Down Expand Up @@ -223,6 +224,7 @@ public static function getAttributeById(AttributeGroup $group, int $attributeId)
if (is_null(self::$attributes)) {
return null;
}

//====================================================================//
// Return Attribute Values
return self::$attributes[$group->id][$attributeId] ?? null;
Expand Down
2 changes: 2 additions & 0 deletions modules/splashsync/src/Services/DiscountsManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public static function isFeatureActive(): bool
if (empty(Splash::configuration()->PsUseAdvancedDiscounts)) {
return false;
}

//====================================================================//
// Check if Storage Table Exists
return self::hasStorageTable();
Expand Down Expand Up @@ -285,6 +286,7 @@ private static function getCoreDiscountPrice($object, Currency $currency)
} else {
$taxPercent = 0;
}

//====================================================================//
// Build Price Array
return self::prices()->encode(
Expand Down
1 change: 1 addition & 0 deletions modules/splashsync/src/Services/MultiShopFieldsManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,7 @@ private static function getMsfFieldId(array $coreField, int $shopId): string
if (!self::isListField($coreField['type'])) {
return self::MSF_PREFIX.$shopId."_".$coreField['id'];
}

//====================================================================//
// This is a List Field
return self::fieldName($coreField['id'])
Expand Down
1 change: 1 addition & 0 deletions modules/splashsync/src/Services/MultiShopManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ public static function isFeatureActive($force = false): bool
if (!empty(Splash::input("SPLASH_TRAVIS"))) {
return true;
}

//====================================================================//
// Check if Splash Multi-Shop Feature is Active
return !empty(Splash::configuration()->PsUseMultiShopParser);
Expand Down
1 change: 1 addition & 0 deletions modules/splashsync/src/Services/OrderStatusManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ public static function isKnown(int $psStateId): bool
//====================================================================//
// Load List of Known PS States
$knowStates = self::getKnownStatus();

//====================================================================//
// PS State is Known
return isset($knowStates[$psStateId]);
Expand Down
1 change: 1 addition & 0 deletions modules/splashsync/src/Services/PmAdvancedPack.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ public static function isAdvancedPack($productId)
if (!self::isFeatureActive()) {
return false;
}

//====================================================================//
// Check if Product Id is on List
return in_array($productId, self::getIdsPacks(), true);
Expand Down
2 changes: 2 additions & 0 deletions modules/splashsync/tests/L10MsfProductsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ private function getShopDataSet(array $field, int $shopId): array
$shopId
);
}

//====================================================================//
// Simple Fields
return MSF::encodeData(
Expand Down Expand Up @@ -216,6 +217,7 @@ private function isAllowedForTesting(array $sequence): bool
if ("Product" != $sequence["1"]) {
return false;
}

//====================================================================//
// Ensure Field is R/W Field
return $this->isAllowedFieldForTesting($sequence["2"]);
Expand Down

0 comments on commit 2cb2a22

Please sign in to comment.