Skip to content

Commit

Permalink
Run Laravel Pint
Browse files Browse the repository at this point in the history
  • Loading branch information
duncanmcclean committed Sep 6, 2023
1 parent a141e62 commit f87fd88
Show file tree
Hide file tree
Showing 17 changed files with 22 additions and 27 deletions.
2 changes: 1 addition & 1 deletion src/Console/Commands/MigrateOrderStatuses.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

class MigrateOrderStatuses extends Command
{
use RunsInPlease, ConfirmableTrait;
use ConfirmableTrait, RunsInPlease;

protected $name = 'sc:migrate-order-statuses';

Expand Down
2 changes: 1 addition & 1 deletion src/Console/Commands/MigrateOrdersToDatabase.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

class MigrateOrdersToDatabase extends Command
{
use RunsInPlease, ConfirmableTrait;
use ConfirmableTrait, RunsInPlease;

protected $name = 'sc:migrate-to-database';

Expand Down
5 changes: 0 additions & 5 deletions src/Contracts/Gateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ public function isOffsiteGateway(): bool;
*
* If you're building an off-site gateway, you should return a `checkout_url` key with the
* URL the user should be redirected to for checkout.
*
* @param \DoubleThreeDigital\SimpleCommerce\Contracts\Order $order
*/
public function prepare(Request $request, Order $order): array;

Expand All @@ -36,8 +34,6 @@ public function prepare(Request $request, Order $order): array;
* If you need to display an error message, you should throw a GatewayCheckoutFailed exception.
*
* If you're building an off-site gateway, you don't need to implement this method.
*
* @param \DoubleThreeDigital\SimpleCommerce\Contracts\Order $order
*/
public function checkout(Request $request, Order $order): array;

Expand All @@ -62,7 +58,6 @@ public function checkoutMessages(): array;
* return an array of any data which may prove helpful in the future to track down
* refunds (like a Refund ID).
*
* @param \DoubleThreeDigital\SimpleCommerce\Contracts\Order $order
* @return array|null
*/
public function refund(Order $order): array;
Expand Down
2 changes: 1 addition & 1 deletion src/Coupons/Coupon.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

class Coupon implements Contract
{
use FluentlyGetsAndSets, ExistsAsFile, TracksQueriedColumns, ContainsData;
use ContainsData, ExistsAsFile, FluentlyGetsAndSets, TracksQueriedColumns;

public $id;

Expand Down
8 changes: 4 additions & 4 deletions src/Http/Controllers/CartItemController.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,13 @@ public function store(StoreRequest $request)

// Ensure there's enough stock to fulfill the customer's quantity
if ($product->purchasableType() === ProductType::Product) {
if (is_int($product->stock()) && $product->stock() < $request->quantity) {
if (is_int($product->stock()) && $request->quantity > $product->stock()) {
return $this->withErrors($request, __("There's not enough stock to fulfil the quantity you selected. Please try again later."));
}
} elseif ($product->purchasableType() === ProductType::Variant) {
$variant = $product->variant($request->get('variant'));

if ($variant !== null && is_int($variant->stock()) && $variant->stock() < $request->quantity) {
if ($variant !== null && is_int($variant->stock()) && $request->quantity > $variant->stock()) {
return $this->withErrors($request, __("There's not enough stock to fulfil the quantity you selected. Please try again later."));
}
}
Expand Down Expand Up @@ -212,15 +212,15 @@ public function update(UpdateRequest $request, string $requestItem)

// Ensure there's enough stock to fulfill the customer's quantity
if ($product->purchasableType() === ProductType::Product) {
if (is_int($product->stock()) && $product->stock() < $request->quantity) {
if (is_int($product->stock()) && $request->quantity > $product->stock()) {
return $this->withErrors($request, __("There's not enough stock to fulfil the quantity you selected. Please try again later."));
}
} elseif ($product->purchasableType() === ProductType::Variant) {
$variant = $request->has('variant')
? $product->variant($request->get('variant'))
: $product->variant($lineItem->variant()['variant']);

if ($variant !== null && is_int($variant->stock()) && $variant->stock() < $request->quantity) {
if ($variant !== null && is_int($variant->stock()) && $request->quantity > $variant->stock()) {
return $this->withErrors($request, __("There's not enough stock to fulfil the quantity you selected. Please try again later."));
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Http/Controllers/CheckoutController.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

class CheckoutController extends BaseActionController
{
use CartDriver, AcceptsFormRequests;
use AcceptsFormRequests, CartDriver;

public $order;

Expand Down
2 changes: 1 addition & 1 deletion src/Http/Requests/Cart/UpdateRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

class UpdateRequest extends FormRequest
{
use CartDriver, AcceptsFormRequests;
use AcceptsFormRequests, CartDriver;

public function authorize()
{
Expand Down
6 changes: 3 additions & 3 deletions src/Listeners/EnforceEntryBlueprintFields.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@ public function handle(EntryBlueprintFound $event)

if (
$this->isOrExtendsClass($customerDriver['repository'], EntryCustomerRepository::class)
&& $event->blueprint->namespace() === "collections.{$customerDriver['collection']}"
&& "collections.{$customerDriver['collection']}" === $event->blueprint->namespace()
) {
return $this->enforceCustomerFields($event);
}

if (isset($productDriver['collection']) && $event->blueprint->namespace() === "collections.{$productDriver['collection']}") {
if (isset($productDriver['collection']) && "collections.{$productDriver['collection']}" === $event->blueprint->namespace()) {
return $this->enforceProductFields($event);
}

if (isset($orderDriver['collection']) && $event->blueprint->namespace() === "collections.{$orderDriver['collection']}") {
if (isset($orderDriver['collection']) && "collections.{$orderDriver['collection']}" === $event->blueprint->namespace()) {
return $this->enforceOrderFields($event);
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/Orders/HasLineItems.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public function addLineItem(array $lineItemData): LineItem
public function updateLineItem($lineItemId, array $lineItemData): LineItem
{
$this->lineItems = $this->lineItems->map(function ($item) use ($lineItemId, $lineItemData) {
if ($item->id() !== $lineItemId) {
if ($lineItemId !== $item->id()) {
return $item;
}

Expand Down Expand Up @@ -148,7 +148,7 @@ public function updateLineItem($lineItemId, array $lineItemData): LineItem
public function removeLineItem($lineItemId): Collection
{
$this->lineItems = $this->lineItems->reject(function ($item) use ($lineItemId) {
return $item->id() === $lineItemId;
return $lineItemId === $item->id();
})->values();

$this->save();
Expand Down
2 changes: 1 addition & 1 deletion src/Products/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public function variantOptions(): Collection
public function variant(string $optionKey): ?ProductVariant
{
return $this->variantOptions()->filter(function ($variant) use ($optionKey) {
return $variant->key() === $optionKey;
return $optionKey === $variant->key();
})->first();
}

Expand Down
2 changes: 1 addition & 1 deletion src/Products/ProductVariant.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

class ProductVariant
{
use HasData, FluentlyGetsAndSets;
use FluentlyGetsAndSets, HasData;

protected $key;

Expand Down
2 changes: 1 addition & 1 deletion src/Tags/CartTags.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

class CartTags extends SubTag
{
use Concerns\FormBuilder;
use CartDriver;
use Concerns\FormBuilder;

public function index()
{
Expand Down
2 changes: 1 addition & 1 deletion src/Tags/CheckoutTags.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@

class CheckoutTags extends SubTag
{
use Concerns\FormBuilder;
use CartDriver;
use Concerns\FormBuilder;

public function index()
{
Expand Down
2 changes: 1 addition & 1 deletion src/Tags/CouponTags.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

class CouponTags extends SubTag
{
use Concerns\FormBuilder;
use CartDriver;
use Concerns\FormBuilder;

public function index(): array
{
Expand Down
2 changes: 1 addition & 1 deletion src/Tax/Standard/TaxCategory.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

class TaxCategory
{
use FluentlyGetsAndSets, ExistsAsFile, TracksQueriedColumns, ContainsData;
use ContainsData, ExistsAsFile, FluentlyGetsAndSets, TracksQueriedColumns;

public $id;

Expand Down
2 changes: 1 addition & 1 deletion src/Tax/Standard/TaxRate.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

class TaxRate
{
use FluentlyGetsAndSets, ExistsAsFile, TracksQueriedColumns, ContainsData;
use ContainsData, ExistsAsFile, FluentlyGetsAndSets, TracksQueriedColumns;

public $id;

Expand Down
2 changes: 1 addition & 1 deletion src/Tax/Standard/TaxZone.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

class TaxZone
{
use FluentlyGetsAndSets, ExistsAsFile, TracksQueriedColumns, ContainsData;
use ContainsData, ExistsAsFile, FluentlyGetsAndSets, TracksQueriedColumns;

public $id;

Expand Down

0 comments on commit f87fd88

Please sign in to comment.