Skip to content

Commit

Permalink
ran linter
Browse files Browse the repository at this point in the history
  • Loading branch information
roncodes committed Feb 13, 2024
1 parent 56540f0 commit 36ef89d
Show file tree
Hide file tree
Showing 32 changed files with 63 additions and 64 deletions.
3 changes: 1 addition & 2 deletions server/src/Http/Controllers/MetricsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@
class MetricsController extends Controller
{
/**
* Get all key metrics for a companies storefront
* Get all key metrics for a companies storefront.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function all(Request $request)
Expand Down
2 changes: 1 addition & 1 deletion server/src/Http/Controllers/v1/CartController.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class CartController extends Controller
*
* @return \Illuminate\Http\Response
*/
public function retrieve(string $uniqueId = null, Request $request)
public function retrieve(?string $uniqueId = null, Request $request)
{
$cart = Cart::retrieve($uniqueId, true);

Expand Down
10 changes: 5 additions & 5 deletions server/src/Http/Controllers/v1/CustomerController.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
use Fleetbase\FleetOps\Models\Contact;
use Fleetbase\FleetOps\Models\Order;
use Fleetbase\FleetOps\Models\Place;
use Fleetbase\Support\Utils;
use Fleetbase\Http\Controllers\Controller;
use Fleetbase\Models\User;
use Fleetbase\Models\UserDevice;
Expand All @@ -18,6 +17,7 @@
use Fleetbase\Storefront\Http\Requests\VerifyCreateCustomerRequest;
use Fleetbase\Storefront\Http\Resources\Customer;
use Fleetbase\Storefront\Support\Storefront;
use Fleetbase\Support\Utils;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Hash;
Expand Down Expand Up @@ -140,14 +140,14 @@ public function requestCustomerCreationCode(VerifyCreateCustomerRequest $request
'messageCallback' => function ($verification) use ($about) {
return "Your {$about->name} verification code is {$verification->code}";
},
'meta' => $meta
'meta' => $meta,
]);
} else {
VerificationCode::generateSmsVerificationFor($customer, 'storefront_create_customer', [
'messageCallback' => function ($verification) use ($about) {
return "Your {$about->name} verification code is {$verification->code}";
},
'meta' => $meta
'meta' => $meta,
]);
}

Expand Down Expand Up @@ -391,7 +391,7 @@ public function loginWithPhone()
VerificationCode::generateSmsVerificationFor($user, 'storefront_login', [
'messageCallback' => function ($verification) use ($about) {
return "Your {$about->name} verification code is {$verification->code}";
}
},
]);

return response()->json(['status' => 'OK']);
Expand Down Expand Up @@ -462,7 +462,7 @@ public function verifyCode(Request $request)
/**
* Patches phone number with international code.
*/
public static function phone(string $phone = null): string
public static function phone(?string $phone = null): string
{
if ($phone === null) {
$phone = request()->input('phone');
Expand Down
2 changes: 1 addition & 1 deletion server/src/Http/Controllers/v1/NetworkController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

use Fleetbase\FleetOps\Support\Utils;
use Fleetbase\Http\Controllers\Controller;
use Fleetbase\LaravelMysqlSpatial\Types\Point;
use Fleetbase\Models\Category;
use Fleetbase\Storefront\Http\Resources\Store as StorefrontStore;
use Fleetbase\Storefront\Http\Resources\StoreLocation as StorefrontStoreLocation;
use Fleetbase\Storefront\Models\Store;
use Fleetbase\Storefront\Models\StoreLocation;
use Fleetbase\LaravelMysqlSpatial\Types\Point;
use Illuminate\Http\Request;

class NetworkController extends Controller
Expand Down
2 changes: 1 addition & 1 deletion server/src/Http/Controllers/v1/ProductController.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public function find($id)
/**
* Deletes a Storefront Product resources.
*
* @return \Fleetbase\Http\Resources\v1\DeletedResource
* @return DeletedResource
*/
public function delete($id)
{
Expand Down
4 changes: 2 additions & 2 deletions server/src/Http/Controllers/v1/ServiceQuoteController.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
use Fleetbase\FleetOps\Models\ServiceRate;
use Fleetbase\FleetOps\Support\Flow;
use Fleetbase\FleetOps\Support\Utils;
use Fleetbase\Support\Utils as CoreUtils;
use Fleetbase\Http\Controllers\Controller;
use Fleetbase\Storefront\Http\Requests\GetServiceQuoteFromCart;
use Fleetbase\Storefront\Models\Cart;
use Fleetbase\Storefront\Models\Product;
use Fleetbase\Storefront\Models\Store;
use Fleetbase\Storefront\Models\StoreLocation;
use Fleetbase\Support\Utils as CoreUtils;
use Illuminate\Support\Str;

class ServiceQuoteController extends Controller
Expand Down Expand Up @@ -303,7 +303,7 @@ public function fromCartForNetwork(GetServiceQuoteFromCart $request)

if ($integratedVendor) {
try {
/** @var \Fleetbase\FleetOps\Models\ServiceQuote $serviceQuote */
/** @var ServiceQuote $serviceQuote */
$serviceQuote = $integratedVendor->api()->setRequestId($requestId)->getQuoteFromPreliminaryPayload([...$origins, $destination], [], $serviceType, $scheduledAt, $isRouteOptimized);
} catch (\Exception $e) {
return response()->error($e->getMessage());
Expand Down
10 changes: 5 additions & 5 deletions server/src/Http/Resources/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function toArray($request)
];
}

public function mapHours(\Illuminate\Database\Eloquent\Collection $hours = null): array
public function mapHours(?\Illuminate\Database\Eloquent\Collection $hours = null): array
{
if (empty($hours)) {
return [];
Expand All @@ -79,7 +79,7 @@ function ($hour) {
);
}

public function mapFiles(\Illuminate\Database\Eloquent\Collection $files = null, $contentType = 'image')
public function mapFiles(?\Illuminate\Database\Eloquent\Collection $files = null, $contentType = 'image')
{
return collect($files)->map(function ($file) use ($contentType) {
if (!Str::contains($file->content_type, $contentType)) {
Expand All @@ -90,7 +90,7 @@ public function mapFiles(\Illuminate\Database\Eloquent\Collection $files = null,
})->filter()->values();
}

public function mapAddonCategories(\Illuminate\Database\Eloquent\Collection $addonCategories = null)
public function mapAddonCategories(?\Illuminate\Database\Eloquent\Collection $addonCategories = null)
{
return collect($addonCategories)->map(function ($addonCategory) {
$addons = data_get($addonCategory, 'category.addons', []);
Expand Down Expand Up @@ -120,7 +120,7 @@ public function mapAddonCategories(\Illuminate\Database\Eloquent\Collection $add
});
}

public function mapProductAddons(\Illuminate\Database\Eloquent\Collection $addons = null, $excluded = [])
public function mapProductAddons(?\Illuminate\Database\Eloquent\Collection $addons = null, $excluded = [])
{
return collect($addons)->map(function ($addon) use ($excluded) {
if (is_array($excluded) && in_array($addon->uuid, $excluded)) {
Expand Down Expand Up @@ -157,7 +157,7 @@ public function mapProductAddons(\Illuminate\Database\Eloquent\Collection $addon
})->filter()->values();
}

public function mapVariants(\Illuminate\Database\Eloquent\Collection $variants = null)
public function mapVariants(?\Illuminate\Database\Eloquent\Collection $variants = null)
{
return collect($variants)->map(function ($variant) {
$productVariantArr = [
Expand Down
2 changes: 1 addition & 1 deletion server/src/Imports/ProductsImport.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
class ProductsImport implements ToCollection, WithHeadingRow
{
/**
* @return \Illuminate\Support\Collection
* @return Collection
*/
public function collection(Collection $rows)
{
Expand Down
2 changes: 1 addition & 1 deletion server/src/Listeners/HandleOrderDriverAssigned.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class HandleOrderDriverAssigned implements ShouldQueue
*/
public function handle(OrderDriverAssigned $event)
{
/** @var \Fleetbase\FleetOps\Models\Order $order */
/** @var Order $order */
$order = $event->getModelRecord();

// halt if unable to resolve order record from event
Expand Down
2 changes: 1 addition & 1 deletion server/src/Models/Cart.php
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,7 @@ public function createEvent(string $eventName, $cartItemId = null, $save = true)
*
* @return \Fleetbase\Models\Storefront\Cart
*/
public function updateCurrency(string $currencyCode = null, $save = false)
public function updateCurrency(?string $currencyCode = null, $save = false)
{
$this->attributes['currency'] = $currencyCode ?? session('storefront_currency');

Expand Down
10 changes: 5 additions & 5 deletions server/src/Models/Network.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
class Network extends StorefrontModel
{
use HasUuid;
use HasPublicId;
use HasPublicid;
use HasApiModelBehavior;
use HasOptionsAttributes;
use HasSlug;
Expand Down Expand Up @@ -83,7 +83,7 @@ class Network extends StorefrontModel
protected $hidden = ['logo', 'backdrop', 'files', 'media'];

/**
* @var \Spatie\Sluggable\SlugOptions
* @var SlugOptions
*/
public function getSlugOptions(): SlugOptions
{
Expand Down Expand Up @@ -220,7 +220,7 @@ public function getStoresCountAttribute()
/**
* Adds a new store to the network.
*/
public function addStore(Store $store, Category $category = null): NetworkStore
public function addStore(Store $store, ?Category $category = null): NetworkStore
{
return NetworkStore::updateOrCreate(
[
Expand All @@ -241,7 +241,7 @@ public function addStore(Store $store, Category $category = null): NetworkStore
* @param File|string|null $icon
* @param string $iconColor
*/
public function createCategory(string $name, string $description = '', ?array $meta = [], ?array $translations = [], Category $parent = null, $icon = null, $iconColor = '#000000'): Category
public function createCategory(string $name, string $description = '', ?array $meta = [], ?array $translations = [], ?Category $parent = null, $icon = null, $iconColor = '#000000'): Category
{
$iconFile = null;
$iconName = null;
Expand Down Expand Up @@ -276,7 +276,7 @@ public function createCategory(string $name, string $description = '', ?array $m
* @param File|string|null $icon
* @param string $iconColor
*/
public function createCategoryStrict(string $name, string $description = '', ?array $meta = [], ?array $translations = [], Category $parent = null, $icon = null, $iconColor = '#000000'): Category
public function createCategoryStrict(string $name, string $description = '', ?array $meta = [], ?array $translations = [], ?Category $parent = null, $icon = null, $iconColor = '#000000'): Category
{
$existingCategory = Category::where(['company_uuid' => $this->company_uuid, 'owner_uuid' => $this->uuid, 'name' => $name])->first();

Expand Down
2 changes: 1 addition & 1 deletion server/src/Models/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ public static function boot()
}

/**
* @var \Spatie\Sluggable\SlugOptions
* @var SlugOptions
*/
public function getSlugOptions(): SlugOptions
{
Expand Down
2 changes: 1 addition & 1 deletion server/src/Models/ProductAddon.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class ProductAddon extends StorefrontModel
protected $appends = [];

/**
* @var \Spatie\Sluggable\SlugOptions
* @var SlugOptions
*/
public function getSlugOptions(): SlugOptions
{
Expand Down
2 changes: 1 addition & 1 deletion server/src/Models/ProductStoreLocation.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class ProductStoreLocation extends StorefrontModel
protected $appends = [];

/**
* @var \Spatie\Sluggable\SlugOptions
* @var SlugOptions
*/
public function getSlugOptions(): SlugOptions
{
Expand Down
2 changes: 1 addition & 1 deletion server/src/Models/ProductVariant.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class ProductVariant extends StorefrontModel
protected $with = [];

/**
* @var \Spatie\Sluggable\SlugOptions
* @var SlugOptions
*/
public function getSlugOptions(): SlugOptions
{
Expand Down
12 changes: 6 additions & 6 deletions server/src/Models/Store.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ class Store extends StorefrontModel
protected $filterParams = ['network', 'without_category', 'category', 'category_uuid'];

/**
* @var \Spatie\Sluggable\SlugOptions
* @var SlugOptions
*/
public function getSlugOptions(): SlugOptions
{
Expand Down Expand Up @@ -332,7 +332,7 @@ public function getNetworkCategoryUsingId(?string $id)
/**
* Retrieves the category of the store belonging to the specified network.
*
* @param \Fleetbase\Storefront\Models\Network $network the network for which the category is to be retrieved
* @param Network $network the network for which the category is to be retrieved
*
* @return \Fleetbase\Models\Category|null the category of the store in the given network, or null if the store does not belong to the network
*/
Expand Down Expand Up @@ -360,7 +360,7 @@ public function getNetworkCategory(Network $network)
* @param File|string|null $icon
* @param string $iconColor
*/
public function createCategory(string $name, string $description = '', ?array $meta = [], ?array $translations = [], Category $parent = null, $icon = null, $iconColor = '#000000'): Category
public function createCategory(string $name, string $description = '', ?array $meta = [], ?array $translations = [], ?Category $parent = null, $icon = null, $iconColor = '#000000'): Category
{
$iconFile = null;
$iconName = null;
Expand Down Expand Up @@ -397,7 +397,7 @@ public function createCategory(string $name, string $description = '', ?array $m
* @param File|string|null $icon
* @param string $iconColor
*/
public function createCategoryStrict(string $name, string $description = '', ?array $meta = [], ?array $translations = [], Category $parent = null, $icon = null, $iconColor = '#000000'): Category
public function createCategoryStrict(string $name, string $description = '', ?array $meta = [], ?array $translations = [], ?Category $parent = null, $icon = null, $iconColor = '#000000'): Category
{
$existingCategory = Category::where(['company_uuid' => $this->company_uuid, 'owner_uuid' => $this->uuid, 'name' => $name])->first();

Expand All @@ -411,7 +411,7 @@ public function createCategoryStrict(string $name, string $description = '', ?ar
/**
* Creates a new product in the store.
*/
public function createProduct(string $name, string $description, array $tags = [], Category $category = null, File $image = null, User $createdBy = null, string $sku = '', int $price = 0, string $status = 'available', array $options = []): Product
public function createProduct(string $name, string $description, array $tags = [], ?Category $category = null, ?File $image = null, ?User $createdBy = null, string $sku = '', int $price = 0, string $status = 'available', array $options = []): Product
{
return Product::create(
[
Expand All @@ -438,7 +438,7 @@ public function createProduct(string $name, string $description, array $tags = [
);
}

public function createLocation($location, string $name = null, ?User $createdBy): ?StoreLocation
public function createLocation($location, ?string $name = null, ?User $createdBy): ?StoreLocation
{
$place = Place::createFromMixed($location);

Expand Down
4 changes: 2 additions & 2 deletions server/src/Notifications/StorefrontOrderCanceled.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class StorefrontOrderCanceled extends Notification
/**
* The order instance this notification is for.
*
* @var \Fleetbase\FleetOps\Models\Order
* @var Order
*/
public $order;

Expand Down Expand Up @@ -63,7 +63,7 @@ public function via($notifiable)
/**
* Get the mail representation of the notification.
*
* @return \Illuminate\Notifications\Messages\MailMessage
* @return MailMessage
*/
public function toMail($notifiable)
{
Expand Down
2 changes: 1 addition & 1 deletion server/src/Notifications/StorefrontOrderCompleted.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public function via($notifiable)
/**
* Get the mail representation of the notification.
*
* @return \Illuminate\Notifications\Messages\MailMessage
* @return MailMessage
*/
public function toMail($notifiable)
{
Expand Down
2 changes: 1 addition & 1 deletion server/src/Notifications/StorefrontOrderCreated.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public function toTwilio($notifiable)
/**
* Get the mail representation of the notification.
*
* @return \Illuminate\Notifications\Messages\MailMessage
* @return MailMessage
*/
public function toMail($notifiable)
{
Expand Down
2 changes: 1 addition & 1 deletion server/src/Notifications/StorefrontOrderDriverAssigned.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function via($notifiable)
/**
* Get the mail representation of the notification.
*
* @return \Illuminate\Notifications\Messages\MailMessage
* @return MailMessage
*/
public function toMail($notifiable)
{
Expand Down
2 changes: 1 addition & 1 deletion server/src/Notifications/StorefrontOrderEnroute.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public function via($notifiable)
/**
* Get the mail representation of the notification.
*
* @return \Illuminate\Notifications\Messages\MailMessage
* @return MailMessage
*/
public function toMail($notifiable)
{
Expand Down
2 changes: 1 addition & 1 deletion server/src/Notifications/StorefrontOrderNearby.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public function via($notifiable)
/**
* Get the mail representation of the notification.
*
* @return \Illuminate\Notifications\Messages\MailMessage
* @return MailMessage
*/
public function toMail($notifiable)
{
Expand Down
2 changes: 1 addition & 1 deletion server/src/Notifications/StorefrontOrderPreparing.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function via($notifiable)
/**
* Get the mail representation of the notification.
*
* @return \Illuminate\Notifications\Messages\MailMessage
* @return MailMessage
*/
public function toMail($notifiable)
{
Expand Down
Loading

0 comments on commit 36ef89d

Please sign in to comment.