Skip to content

Commit

Permalink
Apply fixes from StyleCI
Browse files Browse the repository at this point in the history
  • Loading branch information
glennjacobs authored and StyleCIBot committed Apr 4, 2022
1 parent 6c95c4b commit c0ad168
Show file tree
Hide file tree
Showing 102 changed files with 561 additions and 427 deletions.
2 changes: 1 addition & 1 deletion config/payments.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

'types' => [
'cash-in-hand' => [
'driver' => 'offline',
'driver' => 'offline',
'released' => 'payment-offline',
],
],
Expand Down
4 changes: 2 additions & 2 deletions database/factories/OrderFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ public function definition(): array
'tax_breakdown' => [
[
'description' => 'VAT',
'total' => 200,
'percentage' => 20,
'total' => 200,
'percentage' => 20,
],
],
'tax_total' => $taxTotal,
Expand Down
4 changes: 2 additions & 2 deletions database/factories/OrderLineFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ public function definition(): array
'tax_breakdown' => [
[
'description' => 'VAT',
'total' => 200,
'percentage' => 20,
'total' => 200,
'percentage' => 20,
],
],
'tax_total' => $this->faker->numberBetween(1, 5000),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class CreateMediaTable extends Migration
{
public function up()
{
if (! Schema::hasTable('media')) {
if (!Schema::hasTable('media')) {
Schema::create('media', function (Blueprint $table) {
$table->bigIncrements('id');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public function up()
{
$tableName = config('activitylog.table_name');

if (! Schema::hasTable($tableName)) {
if (!Schema::hasTable($tableName)) {
Schema::create($tableName, function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('log_name')->nullable();
Expand Down
2 changes: 1 addition & 1 deletion database/state/ConvertProductTypeAttributesToProducts.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public function run()
{
$prefix = config('getcandy.database.table_prefix');

if (! $this->canRun()) {
if (!$this->canRun()) {
return;
}

Expand Down
4 changes: 2 additions & 2 deletions database/state/EnsureDefaultTaxClassExists.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class EnsureDefaultTaxClassExists
{
public function run()
{
if (! $this->canRun() || ! $this->shouldRun()) {
if (!$this->canRun() || !$this->shouldRun()) {
return;
}

Expand All @@ -32,6 +32,6 @@ protected function canRun()

protected function shouldRun()
{
return ! TaxClass::whereDefault(true)->count();
return !TaxClass::whereDefault(true)->count();
}
}
2 changes: 1 addition & 1 deletion database/state/EnsureUserOrdersHaveACustomer.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class EnsureUserOrdersHaveACustomer
{
public function run()
{
if (! $this->canRun()) {
if (!$this->canRun()) {
return;
}

Expand Down
7 changes: 4 additions & 3 deletions src/Actions/Carts/CalculateLine.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ class CalculateLine
/**
* Execute the action.
*
* @param \GetCandy\Models\CartLine $cartLine
* @param \Illuminate\Database\Eloquent\Collection $customerGroups
* @param \GetCandy\Models\CartLine $cartLine
* @param \Illuminate\Database\Eloquent\Collection $customerGroups
*
* @return \GetCandy\Models\CartLine
*/
public function execute(
Expand All @@ -29,7 +30,7 @@ public function execute(
$unitQuantity = $purchasable->getUnitQuantity();

// we check if any cart line modifiers have already specified a unit price in their calculating() method
if (! ($price = $cartLine->unitPrice) instanceof Price) {
if (!($price = $cartLine->unitPrice) instanceof Price) {
$priceResponse = Pricing::currency($cart->currency)
->qty($cartLine->quantity)
->currency($cart->currency)
Expand Down
21 changes: 11 additions & 10 deletions src/Actions/Carts/CreateOrder.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ public function __construct(OrderReferenceGeneratorInterface $generator)
/**
* Execute the action.
*
* @param \GetCandy\Models\Cart $cart
* @param \GetCandy\Models\Cart $cart
*
* @return void
*/
public function execute(
Expand Down Expand Up @@ -56,9 +57,9 @@ public function execute(
'tax_breakdown' => $cart->taxBreakdown->map(function ($tax) {
return [
'description' => $tax['description'],
'identifier' => $tax['identifier'],
'percentage' => $tax['amounts']->sum('percentage'),
'total' => $tax['total']->value,
'identifier' => $tax['identifier'],
'percentage' => $tax['amounts']->sum('percentage'),
'total' => $tax['total']->value,
];
})->values(),
'tax_total' => $cart->taxTotal->value,
Expand Down Expand Up @@ -87,9 +88,9 @@ public function execute(
'tax_breakdown' => $line->taxBreakdown->amounts->map(function ($amount) {
return [
'description' => $amount->description,
'identifier' => $amount->identifier,
'percentage' => $amount->percentage,
'total' => $amount->price->value,
'identifier' => $amount->identifier,
'percentage' => $amount->percentage,
'total' => $amount->price->value,
];
})->values(),
'tax_total' => $line->taxAmount->value,
Expand Down Expand Up @@ -127,9 +128,9 @@ public function execute(
'tax_breakdown' => $shippingAddress->taxBreakdown->amounts->map(function ($amount) {
return [
'description' => $amount->description,
'identifier' => $amount->identifier,
'percentage' => $amount->percentage,
'total' => $amount->price->value,
'identifier' => $amount->identifier,
'percentage' => $amount->percentage,
'total' => $amount->price->value,
];
})->values(),
'tax_total' => $shippingAddress->shippingTaxTotal->value,
Expand Down
5 changes: 3 additions & 2 deletions src/Actions/Carts/MergeCart.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ class MergeCart
/**
* Execute the action.
*
* @param \GetCandy\Models\Cart $target
* @param \GetCandy\Models\Cart $source
* @param \GetCandy\Models\Cart $target
* @param \GetCandy\Models\Cart $source
*
* @return \GetCandy\Models\Cart
*/
public function execute(Cart $target, Cart $source)
Expand Down
9 changes: 5 additions & 4 deletions src/Actions/Carts/ValidateCartForOrder.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ class ValidateCartForOrder
/**
* Execute the action.
*
* @param \GetCandy\Models\Cart $cart
* @param \GetCandy\Models\Cart $cart
*
* @return void
*/
public function execute(
Expand All @@ -31,7 +32,7 @@ public function execute(
}

// Do we have a billing address?
if (! $cart->billingAddress) {
if (!$cart->billingAddress) {
throw new BillingAddressMissingException(
__('getcandy::exceptions.carts.billing_missing')
);
Expand All @@ -48,7 +49,7 @@ public function execute(

// Is this cart shippable and if so, does it have a shipping address.
if ($cart->getManager()->isShippable()) {
if (! $cart->shippingAddress) {
if (!$cart->shippingAddress) {
throw new ShippingAddressMissingException(
__('getcandy::exceptions.carts.shipping_missing')
);
Expand All @@ -64,7 +65,7 @@ public function execute(
}

// Do we have a shipping option applied?
if (! $cart->getManager()->getShippingOption()) {
if (!$cart->getManager()->getShippingOption()) {
throw new ShippingOptionMissingException();
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/Actions/Collections/SortProducts.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ class SortProducts
/**
* Execute the action.
*
* @param \GetCandy\Models\Collection $collection
* @param \GetCandy\Models\Collection $collection
*
* @return void
*/
public function execute(Collection $collection)
Expand Down
7 changes: 4 additions & 3 deletions src/Actions/Collections/SortProductsByPrice.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ class SortProductsByPrice
/**
* Execute the action.
*
* @param \Illuminate\Support\Collection $products
* @param \GetCandy\Models\Currency $currency
* @param string $direction
* @param \Illuminate\Support\Collection $products
* @param \GetCandy\Models\Currency $currency
* @param string $direction
*
* @return void
*/
public function execute(Collection $products, Currency $currency, $direction = 'asc')
Expand Down
5 changes: 3 additions & 2 deletions src/Actions/Collections/SortProductsBySku.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ class SortProductsBySku
/**
* Execute the action.
*
* @param \Illuminate\Support\Collection $products
* @param string $direction
* @param \Illuminate\Support\Collection $products
* @param string $direction
*
* @return \Illuminate\Support\Collection
*/
public function execute(Collection $products, $direction = 'asc')
Expand Down
15 changes: 9 additions & 6 deletions src/Actions/Taxes/GetTaxZonePostcode.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ class GetTaxZonePostcode
/**
* Execute the action.
*
* @param string $postcode
* @param string $postcode
*
* @return null|\GetCandy\Models\TaxZonePostcode
*/
public function execute($postcode)
Expand All @@ -20,7 +21,7 @@ public function execute($postcode)
return $postcodeZone;
}

if (! $postcodeZone) {
if (!$postcodeZone) {
return null;
}

Expand All @@ -32,7 +33,7 @@ public function execute($postcode)
})->sort(fn ($current, $next) => $current['matches'] < $next['matches'])->first();

// Give up, use default...
if (! $match) {
if (!$match) {
return null;
}

Expand All @@ -42,7 +43,8 @@ public function execute($postcode)
/**
* Return the zone or zones which match this postcode.
*
* @param string $postcode
* @param string $postcode
*
* @return \GetCandy\Models\TaxZonePostcode|\Illuminate\Support\Collection
*/
protected function getZoneMatches($postcode)
Expand All @@ -59,8 +61,9 @@ protected function getZoneMatches($postcode)
/**
* Match wildcard postcodes and return number of matches.
*
* @param string $wildcard
* @param string $haystack
* @param string $wildcard
* @param string $haystack
*
* @return int
*/
private function matchWildcard($wildcard, $haystack)
Expand Down
5 changes: 3 additions & 2 deletions src/Addons/Manifest.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,13 @@ public function build()
/**
* Format a given composer package into our addon format.
*
* @param array $package
* @param array $package
*
* @return void|array
*/
protected function formatPackage($package)
{
if (! $provider = $package['extra']['laravel']['providers'][0] ?? null) {
if (!$provider = $package['extra']['laravel']['providers'][0] ?? null) {
return;
}

Expand Down
6 changes: 4 additions & 2 deletions src/Base/AttributeManifestInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ interface AttributeManifestInterface
/**
* Add an attribute type.
*
* @param string $classname
* @param string $classname
*
* @return void
*/
public function addType($classname);
Expand All @@ -24,7 +25,8 @@ public function getTypes(): Collection;
/**
* Return an attribute type by it's key.
*
* @param string $handle
* @param string $handle
*
* @return string|null
*/
public function getType($handle);
Expand Down
12 changes: 7 additions & 5 deletions src/Base/BaseModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ abstract class BaseModel extends Model
/**
* Create a new instance of the Model.
*
* @param array $attributes
* @param array $attributes
*/
public function __construct(array $attributes = [])
{
Expand All @@ -30,8 +30,9 @@ public function __construct(array $attributes = [])
/**
* Handle dynamic method calls into the model.
*
* @param string $method
* @param array $parameters
* @param string $method
* @param array $parameters
*
* @return mixed
*/
public function __call($method, $parameters)
Expand All @@ -46,8 +47,9 @@ public function __call($method, $parameters)
/**
* Handle dynamic static method calls into the model.
*
* @param string $method
* @param array $parameters
* @param string $method
* @param array $parameters
*
* @return mixed
*/
public static function __callStatic($method, $parameters)
Expand Down
Loading

0 comments on commit c0ad168

Please sign in to comment.