Skip to content

Commit

Permalink
Merge pull request #19 from liberu-genealogy/sweep/rename_app_to_src_…
Browse files Browse the repository at this point in the history
…and_add_composerjson_p

Sweep: rename app/ to src/ and add composer.json psr4 auto loading  (✓ Sandbox Passed)
  • Loading branch information
curtisdelicata authored Mar 12, 2024
2 parents d9ab070 + 89f93c6 commit 8c9a124
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ This will download and install the `php-dna` package, making it available for us
To dispatch the `DispatchMatchkitsJob` for processing DNA matchkits, you can use the following code snippet:

```php
dispatch(new \App\Jobs\DispatchMatchkitsJob());
dispatch(new \Src\Jobs\DispatchMatchkitsJob());
```

This will enqueue the job for processing by the Laravel queue system. Make sure your queue worker is running to process the job.
Expand Down
9 changes: 7 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"require": {
"liberu-genealogy/php-dna": "^1.0"
"autoload": {
"psr-4": {
"Src\\": "src/"
}
},
"require": {
"liberu-genealogy/php-dna": "^1.0"
}
}
28 changes: 28 additions & 0 deletions src/Jobs/DispatchMatchkitsJob.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

namespace Src\Jobs;

use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use LiburuGenealogy\PhpDna\Matchkits;

class DispatchMatchkitsJob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;

protected $matchkits;

public function __construct(Matchkits $matchkits)
{
$this->matchkits = $matchkits;
}

public function handle()
{
// Logic to process matchkits
$this->matchkits->process();
}
}
22 changes: 22 additions & 0 deletions src/Providers/DnaServiceProvider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

namespace Src\Providers;

use Illuminate\Support\ServiceProvider;
use Src\Jobs\DispatchMatchkitsJob;
use LiburuGenealogy\PhpDna\Matchkits;

class DnaServiceProvider extends ServiceProvider
{
public function register()
{
$this->app->bind('dispatchMatchkits', function($app) {
return new DispatchMatchkitsJob();
});
}

public function boot()
{
// Optional: Add event listeners or other bootstrapping code necessary for the php-dna library integration
}
}
2 changes: 1 addition & 1 deletion tests/Unit/DispatchMatchkitsJobTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace Tests\Unit;

use Tests\TestCase;
use App\Jobs\DispatchMatchkitsJob;
use Src\Jobs\DispatchMatchkitsJob;
use LiburuGenealogy\PhpDna\Matchkits;
use Mockery;
use Illuminate\Support\Facades\Queue;
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/DnaServiceProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
namespace Tests\Unit;

use Tests\TestCase;
use App\Jobs\DispatchMatchkitsJob;
use Src\Jobs\DispatchMatchkitsJob;
use Illuminate\Support\Facades\App;

class DnaServiceProviderTest extends TestCase
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/MatchKitsFacadeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace Tests\Unit;

use Tests\TestCase;
use App\Facades\MatchKitsFacade;
use Src\Facades\MatchKitsFacade;
use LiburuGenealogy\PhpDna\Matchkits;
use Illuminate\Support\Facades\App;

Expand Down

0 comments on commit 8c9a124

Please sign in to comment.