Skip to content

Commit

Permalink
Improve error handling
Browse files Browse the repository at this point in the history
Signed-off-by: Sam Poyigi <[email protected]>
  • Loading branch information
sampoyigi committed Jan 7, 2024
1 parent edcd9f0 commit e2a9150
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 353 deletions.
317 changes: 1 addition & 316 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -215,321 +215,6 @@ parameters:
count: 1
path: src/Classes/WorkingTimeslot.php

-
message: "#^Access to an undefined property Igniter\\\\Local\\\\Components\\\\Gallery\\:\\:\\$id\\.$#"
count: 1
path: src/Components/Gallery.php

-
message: "#^Call to an undefined static method Igniter\\\\Local\\\\Facades\\\\Location\\:\\:current\\(\\)\\.$#"
count: 1
path: src/Components/Gallery.php

-
message: "#^Call to an undefined method Illuminate\\\\Database\\\\Eloquent\\\\Model\\:\\:getWeekDaysOptions\\(\\)\\.$#"
count: 1
path: src/Components/Info.php

-
message: "#^Call to an undefined static method Igniter\\\\Local\\\\Facades\\\\Location\\:\\:collectionSchedule\\(\\)\\.$#"
count: 1
path: src/Components/Info.php

-
message: "#^Call to an undefined static method Igniter\\\\Local\\\\Facades\\\\Location\\:\\:current\\(\\)\\.$#"
count: 1
path: src/Components/Info.php

-
message: "#^Call to an undefined static method Igniter\\\\Local\\\\Facades\\\\Location\\:\\:deliverySchedule\\(\\)\\.$#"
count: 1
path: src/Components/Info.php

-
message: "#^Call to an undefined static method Igniter\\\\Local\\\\Facades\\\\Location\\:\\:getOrderType\\(\\)\\.$#"
count: 1
path: src/Components/Info.php

-
message: "#^Call to an undefined static method Igniter\\\\Local\\\\Facades\\\\Location\\:\\:getOrderTypes\\(\\)\\.$#"
count: 1
path: src/Components/Info.php

-
message: "#^Call to an undefined static method Igniter\\\\Local\\\\Facades\\\\Location\\:\\:lastOrderTime\\(\\)\\.$#"
count: 1
path: src/Components/Info.php

-
message: "#^Call to an undefined static method Igniter\\\\Local\\\\Facades\\\\Location\\:\\:openingSchedule\\(\\)\\.$#"
count: 1
path: src/Components/Info.php

-
message: "#^Call to an undefined static method Igniter\\\\Flame\\\\Geolite\\\\Facades\\\\Geocoder\\:\\:geocode\\(\\)\\.$#"
count: 1
path: src/Components/LocalBox.php

-
message: "#^Call to an undefined static method Igniter\\\\Flame\\\\Geolite\\\\Facades\\\\Geocoder\\:\\:getLogs\\(\\)\\.$#"
count: 1
path: src/Components/LocalBox.php

-
message: "#^Call to an undefined static method Igniter\\\\Flame\\\\Geolite\\\\Facades\\\\Geocoder\\:\\:reverse\\(\\)\\.$#"
count: 1
path: src/Components/LocalBox.php

-
message: "#^Call to an undefined static method Igniter\\\\Local\\\\Facades\\\\Location\\:\\:getSession\\(\\)\\.$#"
count: 1
path: src/Components/LocalBox.php

-
message: "#^Call to an undefined static method Igniter\\\\Local\\\\Facades\\\\Location\\:\\:putSession\\(\\)\\.$#"
count: 3
path: src/Components/LocalBox.php

-
message: "#^Call to an undefined static method Igniter\\\\Local\\\\Facades\\\\Location\\:\\:searchByCoordinates\\(\\)\\.$#"
count: 1
path: src/Components/LocalBox.php

-
message: "#^Call to an undefined static method Igniter\\\\Local\\\\Facades\\\\Location\\:\\:updateNearbyArea\\(\\)\\.$#"
count: 1
path: src/Components/LocalBox.php

-
message: "#^Call to an undefined static method Igniter\\\\Local\\\\Facades\\\\Location\\:\\:updateUserPosition\\(\\)\\.$#"
count: 1
path: src/Components/LocalBox.php

-
message: "#^Call to an undefined static method Igniter\\\\User\\\\Facades\\\\AdminAuth\\:\\:getUser\\(\\)\\.$#"
count: 1
path: src/Components/LocalBox.php

-
message: "#^Call to an undefined static method Igniter\\\\Flame\\\\Geolite\\\\Facades\\\\Geocoder\\:\\:geocode\\(\\)\\.$#"
count: 1
path: src/Components/LocalList.php

-
message: "#^Call to an undefined static method Igniter\\\\Flame\\\\Geolite\\\\Facades\\\\Geocoder\\:\\:getLogs\\(\\)\\.$#"
count: 1
path: src/Components/LocalList.php

-
message: "#^Call to an undefined static method Igniter\\\\Flame\\\\Geolite\\\\Facades\\\\Geocoder\\:\\:reverse\\(\\)\\.$#"
count: 1
path: src/Components/LocalList.php

-
message: "#^Call to an undefined static method Igniter\\\\Local\\\\Facades\\\\Location\\:\\:current\\(\\)\\.$#"
count: 1
path: src/Components/LocalList.php

-
message: "#^Call to an undefined static method Igniter\\\\Local\\\\Facades\\\\Location\\:\\:getSession\\(\\)\\.$#"
count: 1
path: src/Components/LocalList.php

-
message: "#^Call to an undefined static method Igniter\\\\Local\\\\Facades\\\\Location\\:\\:putSession\\(\\)\\.$#"
count: 3
path: src/Components/LocalList.php

-
message: "#^Call to an undefined static method Igniter\\\\Local\\\\Facades\\\\Location\\:\\:searchByCoordinates\\(\\)\\.$#"
count: 1
path: src/Components/LocalList.php

-
message: "#^Call to an undefined static method Igniter\\\\Local\\\\Facades\\\\Location\\:\\:updateNearbyArea\\(\\)\\.$#"
count: 1
path: src/Components/LocalList.php

-
message: "#^Call to an undefined static method Igniter\\\\Local\\\\Facades\\\\Location\\:\\:updateUserPosition\\(\\)\\.$#"
count: 1
path: src/Components/LocalList.php

-
message: "#^Call to an undefined static method Igniter\\\\Local\\\\Facades\\\\Location\\:\\:userPosition\\(\\)\\.$#"
count: 4
path: src/Components/LocalList.php

-
message: "#^Call to an undefined static method Igniter\\\\Local\\\\Models\\\\Location\\:\\:withCount\\(\\)\\.$#"
count: 1
path: src/Components/LocalList.php

-
message: "#^Call to an undefined static method Igniter\\\\User\\\\Facades\\\\AdminAuth\\:\\:getUser\\(\\)\\.$#"
count: 1
path: src/Components/LocalList.php

-
message: "#^Call to an undefined static method Illuminate\\\\Support\\\\Facades\\\\Event\\:\\:fire\\(\\)\\.$#"
count: 1
path: src/Components/LocalList.php

-
message: "#^Access to an undefined property Igniter\\\\Local\\\\Components\\\\Review\\:\\:\\$author\\.$#"
count: 1
path: src/Components/Review.php

-
message: "#^Access to an undefined property Igniter\\\\Local\\\\Components\\\\Review\\:\\:\\$customer_id\\.$#"
count: 1
path: src/Components/Review.php

-
message: "#^Access to an undefined property Igniter\\\\Local\\\\Components\\\\Review\\:\\:\\$delivery\\.$#"
count: 1
path: src/Components/Review.php

-
message: "#^Access to an undefined property Igniter\\\\Local\\\\Components\\\\Review\\:\\:\\$location_id\\.$#"
count: 1
path: src/Components/Review.php

-
message: "#^Access to an undefined property Igniter\\\\Local\\\\Components\\\\Review\\:\\:\\$quality\\.$#"
count: 1
path: src/Components/Review.php

-
message: "#^Access to an undefined property Igniter\\\\Local\\\\Components\\\\Review\\:\\:\\$review_status\\.$#"
count: 1
path: src/Components/Review.php

-
message: "#^Access to an undefined property Igniter\\\\Local\\\\Components\\\\Review\\:\\:\\$review_text\\.$#"
count: 1
path: src/Components/Review.php

-
message: "#^Access to an undefined property Igniter\\\\Local\\\\Components\\\\Review\\:\\:\\$sale_id\\.$#"
count: 1
path: src/Components/Review.php

-
message: "#^Access to an undefined property Igniter\\\\Local\\\\Components\\\\Review\\:\\:\\$sale_type\\.$#"
count: 1
path: src/Components/Review.php

-
message: "#^Access to an undefined property Igniter\\\\Local\\\\Components\\\\Review\\:\\:\\$service\\.$#"
count: 1
path: src/Components/Review.php

-
message: "#^Call to an undefined method Igniter\\\\Local\\\\Components\\\\Review\\:\\:save\\(\\)\\.$#"
count: 1
path: src/Components/Review.php

-
message: "#^Call to an undefined method Illuminate\\\\Database\\\\Eloquent\\\\Builder\\:\\:isApproved\\(\\)\\.$#"
count: 1
path: src/Components/Review.php

-
message: "#^Call to an undefined method Illuminate\\\\Database\\\\Eloquent\\\\Model\\:\\:getRatingOptions\\(\\)\\.$#"
count: 1
path: src/Components/Review.php

-
message: "#^Call to an undefined static method Igniter\\\\Local\\\\Facades\\\\Location\\:\\:current\\(\\)\\.$#"
count: 1
path: src/Components/Review.php

-
message: "#^Call to an undefined static method Igniter\\\\Local\\\\Models\\\\Review\\:\\:whereReviewable\\(\\)\\.$#"
count: 1
path: src/Components/Review.php

-
message: "#^Call to an undefined static method Igniter\\\\Local\\\\Models\\\\ReviewSettings\\:\\:get\\(\\)\\.$#"
count: 2
path: src/Components/Review.php

-
message: "#^Call to an undefined static method Igniter\\\\User\\\\Facades\\\\Auth\\:\\:customer\\(\\)\\.$#"
count: 4
path: src/Components/Review.php

-
message: "#^Class Igniter\\\\Reservation\\\\Classes\\\\BookingManager not found\\.$#"
count: 1
path: src/Components/Review.php

-
message: "#^Call to an undefined static method Igniter\\\\Flame\\\\Geolite\\\\Facades\\\\Geocoder\\:\\:geocode\\(\\)\\.$#"
count: 1
path: src/Components/Search.php

-
message: "#^Call to an undefined static method Igniter\\\\Flame\\\\Geolite\\\\Facades\\\\Geocoder\\:\\:getLogs\\(\\)\\.$#"
count: 1
path: src/Components/Search.php

-
message: "#^Call to an undefined static method Igniter\\\\Flame\\\\Geolite\\\\Facades\\\\Geocoder\\:\\:reverse\\(\\)\\.$#"
count: 1
path: src/Components/Search.php

-
message: "#^Call to an undefined static method Igniter\\\\Local\\\\Facades\\\\Location\\:\\:checkDeliveryCoverage\\(\\)\\.$#"
count: 1
path: src/Components/Search.php

-
message: "#^Call to an undefined static method Igniter\\\\Local\\\\Facades\\\\Location\\:\\:getSession\\(\\)\\.$#"
count: 2
path: src/Components/Search.php

-
message: "#^Call to an undefined static method Igniter\\\\Local\\\\Facades\\\\Location\\:\\:orderTypeIsDelivery\\(\\)\\.$#"
count: 1
path: src/Components/Search.php

-
message: "#^Call to an undefined static method Igniter\\\\Local\\\\Facades\\\\Location\\:\\:putSession\\(\\)\\.$#"
count: 3
path: src/Components/Search.php

-
message: "#^Call to an undefined static method Igniter\\\\Local\\\\Facades\\\\Location\\:\\:requiresUserPosition\\(\\)\\.$#"
count: 1
path: src/Components/Search.php

-
message: "#^Call to an undefined static method Igniter\\\\Local\\\\Facades\\\\Location\\:\\:searchByCoordinates\\(\\)\\.$#"
count: 2
path: src/Components/Search.php

-
message: "#^Call to an undefined static method Igniter\\\\Local\\\\Facades\\\\Location\\:\\:updateNearbyArea\\(\\)\\.$#"
count: 2
path: src/Components/Search.php

-
message: "#^Call to an undefined static method Igniter\\\\Local\\\\Facades\\\\Location\\:\\:updateUserPosition\\(\\)\\.$#"
count: 1
path: src/Components/Search.php

-
message: "#^Call to an undefined static method Igniter\\\\Local\\\\Facades\\\\Location\\:\\:userPosition\\(\\)\\.$#"
count: 2
path: src/Components/Search.php

-
message: "#^Call to an undefined static method Igniter\\\\User\\\\Facades\\\\Auth\\:\\:customer\\(\\)\\.$#"
count: 4
path: src/Components/Search.php

-
message: "#^Call to an undefined static method Igniter\\\\Admin\\\\Facades\\\\AdminMenu\\:\\:registerCallback\\(\\)\\.$#"
count: 1
Expand Down Expand Up @@ -737,7 +422,7 @@ parameters:

-
message: "#^Call to an undefined static method Igniter\\\\User\\\\Facades\\\\AdminAuth\\:\\:user\\(\\)\\.$#"
count: 4
count: 2
path: src/MainMenuWidgets/LocationPicker.php

-
Expand Down
4 changes: 2 additions & 2 deletions src/Classes/WorkingSchedule.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
use DateTimeInterface;
use DateTimeZone;
use Igniter\Local\Events\WorkingScheduleTimeslotValidEvent;
use Igniter\Local\Exceptions\WorkingHourException;
use Illuminate\Support\Arr;
use Illuminate\Support\Collection;
use InvalidArgumentException;

class WorkingSchedule
{
Expand Down Expand Up @@ -395,7 +395,7 @@ protected function parseDate($start = null)
return $start;
}

throw new InvalidArgumentException('The datetime must be an instance of DateTime.');
throw new WorkingHourException('The datetime must be an instance of DateTime.');
}

protected function parsePeriods($periods)
Expand Down
2 changes: 1 addition & 1 deletion src/Contracts/AreaInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ interface AreaInterface
{
public function getLocationId();

public function checkBoundary($coordinate);
public function checkBoundary(CoordinatesInterface $coordinate);

public function pointInVertices(CoordinatesInterface $coordinate);

Expand Down
15 changes: 7 additions & 8 deletions src/FormWidgets/MapArea.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use Igniter\Admin\Classes\FormField;
use Igniter\Admin\Traits\FormModelWidget;
use Igniter\Admin\Traits\ValidatesForm;
use Igniter\Flame\Exception\ApplicationException;
use Igniter\Flame\Exception\FlashException;
use Igniter\Flame\Html\HtmlFacade as Html;
use Igniter\Local\Models\LocationArea;
use Illuminate\Database\Eloquent\Collection;
Expand Down Expand Up @@ -198,14 +198,13 @@ public function onSaveRecord()

public function onDeleteArea()
{
if (!strlen($areaId = post('areaId'))) {
throw new ApplicationException(lang('igniter.local::default.alert_invalid_area'));
}
throw_unless(strlen($areaId = post('areaId')),
FlashException::error(lang('igniter.local::default.alert_invalid_area'))
);

$model = $this->getRelationModel()->find($areaId);
if (!$model) {
throw new ApplicationException(sprintf(lang('igniter::admin.form.not_found'), $areaId));
}
throw_unless($model = $this->getRelationModel()->find($areaId),
FlashException::error(sprintf(lang('igniter::admin.form.not_found'), $areaId))
);

$model->delete();

Expand Down
Loading

0 comments on commit e2a9150

Please sign in to comment.