Skip to content
This repository has been archived by the owner on Sep 22, 2024. It is now read-only.

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
pactode committed Apr 10, 2019
1 parent c060856 commit ed644d9
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/TaskLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,21 @@ public function loadFor(Schedule $schedule, array $exclude = [])
}

foreach ((new Finder)->in($path)->files() as $taskFile) {
$taskClass = $namespace.str_replace(
$task = $namespace.str_replace(
['/', '.php'],
['\\', ''],
Str::after($taskFile->getPathname(), app_path().DIRECTORY_SEPARATOR)
);

if (in_array($taskClass, $exclude)) {
if (in_array($task, $exclude)) {
continue;
}

if (is_subclass_of($taskClass, TaskContract::class) &&
! (new ReflectionClass($taskClass))->isAbstract()) {
$task = new $taskClass;
if (is_subclass_of($task, TaskContract::class) &&
! (new ReflectionClass($task))->isAbstract()) {

// Invoke task
$task($schedule);
(new $task)($schedule);
}
}
}
Expand Down

0 comments on commit ed644d9

Please sign in to comment.