Skip to content

Commit

Permalink
- remove unnecessarily files
Browse files Browse the repository at this point in the history
  • Loading branch information
ibrahem-kamal committed Jan 30, 2024
1 parent 4d77fab commit 7aaba63
Show file tree
Hide file tree
Showing 10 changed files with 101 additions and 53 deletions.
10 changes: 0 additions & 10 deletions .github/ISSUE_TEMPLATE/bug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,6 @@ body:
placeholder: 9.0.0
validations:
required: true
- type: dropdown
id: operating-systems
attributes:
label: Which operating systems does with happen with?
description: You may select more than one.
multiple: true
options:
- macOS
- Windows
- Linux
- type: textarea
id: notes
attributes:
Expand Down
14 changes: 14 additions & 0 deletions config/omni-messaging.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

return [
/**
* Channels should be added in the following format:
* 'channels' => [
* 'channel_name' => [
* 'driver' => 'driver_name',
* 'options' => []
* ]
* ]
*/
'channels' => []
];
17 changes: 0 additions & 17 deletions database/factories/ModelFactory.php

This file was deleted.

2 changes: 1 addition & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
backupStaticProperties="false"
>
<testsuites>
<testsuite name="Ibrahemkamal Test Suite">
<testsuite name="Omni Messaging">
<directory>tests</directory>
</testsuite>
</testsuites>
Expand Down
Empty file removed resources/views/.gitkeep
Empty file.
18 changes: 18 additions & 0 deletions src/Facades/OmniMessaging.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

namespace Ibrahemkamal\OmniMessaging\Facades;

use Illuminate\Support\Facades\Facade;

/**
* @see \Ibrahemkamal\OmniMessaging\OmniMessaging
* @method static \Ibrahemkamal\OmniMessaging\Contracts\MessagingDriverContract driver(string $driverName)
*
*/
class OmniMessaging extends Facade
{
protected static function getFacadeAccessor()
{
return \Ibrahemkamal\OmniMessaging\OmniMessaging::class;
}
}
37 changes: 37 additions & 0 deletions src/OmniMessaging.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

namespace Ibrahemkamal\OmniMessaging;

use Ibrahemkamal\OmniMessaging\Contracts\MessagingDriverContract;
use Illuminate\Support\Manager;
use InvalidArgumentException;

class OmniMessaging extends Manager
{
/**
* Get the default driver name.
*
*
* @throws InvalidArgumentException
*/
public function getDefaultDriver(): string
{
throw new InvalidArgumentException('No Omni Messaging driver was specified.');
}

protected function channel(MessagingDriverContract $channel)
{
$name = $channel->getChannelName();
$channel = config("omni-messaging.channels.$name");
if (!$channel) {
throw new InvalidArgumentException("Omni Messaging channel [$name] is not defined.");
}
if (!isset($channel['driver'])) {
throw new InvalidArgumentException("Omni Messaging channel [$name] driver is not defined.");
}
if (!isset($channel['options'])) {
throw new InvalidArgumentException("Omni Messaging channel [$name] options is not defined.");
}
return $this->driver($channel['driver']);
}
}
26 changes: 26 additions & 0 deletions src/OmniMessagingServiceProvider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

namespace Ibrahemkamal\OmniMessaging;

use Spatie\LaravelPackageTools\Package;
use Spatie\LaravelPackageTools\PackageServiceProvider;

class OmniMessagingServiceProvider extends PackageServiceProvider
{
public function configurePackage(Package $package): void
{
/*
* This class is a Package Service Provider
*
* More info: https://github.com/spatie/laravel-package-tools
*/
$package
->name('omni-messaging')
->hasConfigFile();
}

public function registeringPackage(): void
{
$this->app->singleton(\Ibrahemkamal\OmniMessaging\Facades\OmniMessaging::class, OmniMessaging::class);
}
}
5 changes: 5 additions & 0 deletions tests/ArchTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php

arch('it will not use debugging functions')
->expect(['dd', 'dump', 'ray'])
->each->not->toBeUsed();
25 changes: 0 additions & 25 deletions workbench/app/Providers/WorkbenchServiceProvider.php

This file was deleted.

0 comments on commit 7aaba63

Please sign in to comment.