Skip to content

Commit

Permalink
remove comment
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelnabil230 committed Jul 22, 2022
1 parent 4ed223c commit f6e2fb3
Show file tree
Hide file tree
Showing 17 changed files with 20 additions and 87 deletions.
Binary file modified .DS_Store
Binary file not shown.
6 changes: 0 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,6 @@ This is the contents of the published config file:
```php
use MichaelNabil230\Setting\Models\Setting;

/**
*
* @author Michael Nabil <michaelnabil926@gmail.com>
* @license http://opensource.org/licenses/MIT
* @package setting
*/
return [
/*
|--------------------------------------------------------------------------
Expand Down
11 changes: 4 additions & 7 deletions config/setting.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@

use MichaelNabil230\Setting\Models\Setting;

/**
* @author Michael Nabil <[email protected]>
* @license http://opensource.org/licenses/MIT
*/

return [
/*
|--------------------------------------------------------------------------
Expand All @@ -32,7 +29,7 @@

'drivers' => [
'database' => [
'driver' => MichaelNabil230\Setting\Stores\DatabaseSettingStore::class,
'driver' => \MichaelNabil230\Setting\Stores\DatabaseSettingStore::class,
'options' => [
'model' => Setting::class,
'table' => 'settings', // name of table in dataBase
Expand All @@ -44,7 +41,7 @@
],

'redis' => [
'driver' => MichaelNabil230\Setting\Stores\RedisSettingStore::class,
'driver' => \MichaelNabil230\Setting\Stores\RedisSettingStore::class,
'options' => [
'client' => 'predis',
'default' => [
Expand All @@ -56,7 +53,7 @@
],

'json' => [
'driver' => MichaelNabil230\Setting\Stores\JsonSettingStore::class,
'driver' => \MichaelNabil230\Setting\Stores\JsonSettingStore::class,
'options' => [
'path' => storage_path('settings.json'),
],
Expand Down
8 changes: 1 addition & 7 deletions database/migrations/create_settings_table.php.stub
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,6 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

/**
*
* @author Michael Nabil <[email protected]>
* @license http://opensource.org/licenses/MIT
* @package setting
*/
return new class extends Migration
{
public function __construct()
Expand All @@ -22,7 +16,7 @@ return new class extends Migration
*
* @return void
*/
public function up(): void
public function up()
{
Schema::create($this->table, function (Blueprint $table) {
$table->id();
Expand Down
4 changes: 0 additions & 4 deletions src/Commands/ForgetSetting.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@

use Illuminate\Console\Command;

/**
* @author Michael Nabil <[email protected]>
* @license http://opensource.org/licenses/MIT
*/
class ForgetSetting extends Command
{
/**
Expand Down
6 changes: 1 addition & 5 deletions src/Commands/GetSetting.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@
use Illuminate\Support\Arr;
use Illuminate\Support\Collection;

/**
* @author Michael Nabil <[email protected]>
* @license http://opensource.org/licenses/MIT
*/
class GetSetting extends Command
{
/**
Expand Down Expand Up @@ -82,7 +78,7 @@ private function print($settings)
$settings
);

$this->info('Values found '.$settings->count());
$this->info('Values found ' . $settings->count());

return Command::SUCCESS;
}
Expand Down
8 changes: 2 additions & 6 deletions src/Commands/SetOrUpdateSetting.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@
use Illuminate\Console\Command;
use Illuminate\Support\Arr;

/**
* @author Michael Nabil <[email protected]>
* @license http://opensource.org/licenses/MIT
*/
class SetOrUpdateSetting extends Command
{
/**
Expand Down Expand Up @@ -38,9 +34,9 @@ public function handle()
$settings = setting()->set($key, $value)->save();

if (Arr::has($settings, $key)) {
$this->info('Insert '.$key.' into a new setting successfully.');
$this->info('Insert ' . $key . ' into a new setting successfully.');
} else {
$this->info('Updated '.$key.' setting successfully.');
$this->info('Updated ' . $key . ' setting successfully.');
}

return Command::SUCCESS;
Expand Down
12 changes: 4 additions & 8 deletions src/Facades/Setting.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
<?php

namespace MichaelNabil230\Setting\Facades;

use Illuminate\Support\Facades\Facade;

/**
* @method get($key, $default = null)
* @method set($key, $value = null)
Expand All @@ -15,14 +19,6 @@
* @see \MichaelNabil230\Setting\SettingManager
*/

namespace MichaelNabil230\Setting\Facades;

use Illuminate\Support\Facades\Facade;

/**
* @author Michael Nabil <[email protected]>
* @license http://opensource.org/licenses/MIT
*/
class Setting extends Facade
{
protected static function getFacadeAccessor()
Expand Down
4 changes: 0 additions & 4 deletions src/Interfaces/Store.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@

namespace MichaelNabil230\Setting\Interfaces;

/**
* @author Michael Nabil <[email protected]>
* @license http://opensource.org/licenses/MIT
*/
interface Store
{
/**
Expand Down
4 changes: 0 additions & 4 deletions src/Models/Setting.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

/**
* @author Michael Nabil <[email protected]>
* @license http://opensource.org/licenses/MIT
*/
class Setting extends Model
{
use HasFactory;
Expand Down
4 changes: 0 additions & 4 deletions src/SettingManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@
use Illuminate\Support\Arr;
use Illuminate\Support\Manager;

/**
* @author Michael Nabil <[email protected]>
* @license http://opensource.org/licenses/MIT
*/
class SettingManager extends Manager
{
/**
Expand Down
4 changes: 0 additions & 4 deletions src/SettingServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@
use Spatie\LaravelPackageTools\Package;
use Spatie\LaravelPackageTools\PackageServiceProvider;

/**
* @author Michael Nabil <[email protected]>
* @license http://opensource.org/licenses/MIT
*/
class SettingServiceProvider extends PackageServiceProvider
{
public function configurePackage(Package $package): void
Expand Down
8 changes: 2 additions & 6 deletions src/Stores/AbstractStore.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@
use Illuminate\Support\Arr;
use MichaelNabil230\Setting\Interfaces\Store;

/**
* @author Michael Nabil <[email protected]>
* @license http://opensource.org/licenses/MIT
*/
abstract class AbstractStore implements Store
{
/**
Expand Down Expand Up @@ -57,7 +53,7 @@ public function get($key, $default = null): mixed
{
$this->loadedData();

$default = $default ?? config('setting.defaults.'.$key);
$default = $default ?? config('setting.defaults.' . $key);

return Arr::get($this->data, $key, $default);
}
Expand Down Expand Up @@ -146,7 +142,7 @@ public function all(): array
*/
public function flip($key): self
{
return $this->set($key, ! $this->get($key));
return $this->set($key, !$this->get($key));
}

/**
Expand Down
8 changes: 2 additions & 6 deletions src/Stores/DatabaseSettingStore.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Arr;

/**
* @author Michael Nabil <[email protected]>
* @license http://opensource.org/licenses/MIT
*/
class DatabaseSettingStore extends AbstractStore
{
/** @var string */
Expand Down Expand Up @@ -120,7 +116,7 @@ public function forget($key): bool
{
$this->loadedData();

if (! Arr::has($this->data, $key)) {
if (!Arr::has($this->data, $key)) {
return false;
}

Expand Down Expand Up @@ -170,7 +166,7 @@ public function setExtraColumns(array $columns): self
*/
private function syncDeleted(array $deleted): void
{
if (! empty($deleted)) {
if (!empty($deleted)) {
$this->model::whereIn('key', $deleted)->delete();
}
}
Expand Down
10 changes: 3 additions & 7 deletions src/Stores/JsonSettingStore.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@
use InvalidArgumentException;
use RuntimeException;

/**
* @author Michael Nabil <[email protected]>
* @license http://opensource.org/licenses/MIT
*/
class JsonSettingStore extends AbstractStore
{
/**
Expand Down Expand Up @@ -81,7 +77,7 @@ public function forget($key): bool
{
$this->loadedData();

if (! Arr::has($this->data, $key)) {
if (!Arr::has($this->data, $key)) {
return false;
}

Expand Down Expand Up @@ -119,14 +115,14 @@ private function throwAnyException(): void
$files = $this->files;

// If the file does not already exist, we will attempt to create it.
if (! $files->exists($path)) {
if (!$files->exists($path)) {
$result = $files->put($path, '{}');
if ($result === false) {
throw new InvalidArgumentException("Could not write to $path.");
}
}

if (! $files->isWritable($path)) {
if (!$files->isWritable($path)) {
throw new InvalidArgumentException("$path is not writable.");
}
}
Expand Down
6 changes: 1 addition & 5 deletions src/Stores/RedisSettingStore.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@
use Illuminate\Redis\RedisManager;
use Illuminate\Support\Arr;

/**
* @author Michael Nabil <[email protected]>
* @license http://opensource.org/licenses/MIT
*/
class RedisSettingStore extends AbstractStore
{
/**
Expand Down Expand Up @@ -64,7 +60,7 @@ public function forget($key): bool
{
$this->loadedData();

if (! Arr::has($this->data, $key)) {
if (!Arr::has($this->data, $key)) {
return false;
}

Expand Down
4 changes: 0 additions & 4 deletions src/helpers.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
<?php

/**
* @author Michael Nabil <[email protected]>
* @license http://opensource.org/licenses/MIT
*/
if (! function_exists('setting')) {
/**
* Get the setting manager instance.
Expand Down

0 comments on commit f6e2fb3

Please sign in to comment.