Skip to content

Commit f6ca539

Browse files
samundraDrudgeRajen
authored andcommitted
remove redundant check for isset() which is unnecessary in case of unset() (#21)
* remove redundant isset check * fix typos * deconstruct array using shorthand syntax * fix typo changes * revert change for list syntax
1 parent eed1a15 commit f6ca539

File tree

5 files changed

+27
-22
lines changed

5 files changed

+27
-22
lines changed

README.MD

+11-10
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
11
[![StyleCI](https://github.styleci.io/repos/159037396/shield?branch=master)](https://github.styleci.io/repos/159037396)
2+
23
### Introduction
4+
35
<a href = "https://github.com/the-control-group/voyager">Voyager </a> is an awesome admin tool for laravel.
4-
It's easy to create admin tool for CMS using it awesome features ```BREAD```.
6+
It is very easy to create admin tool for CMS using Voyager's awesome feature [BREAD](https://voyager.readme.io/docs/bread).
57

68
Voyager has limitation for the deployment (after you finish the work, create bread and need to publish in production. :) )
79

8-
Voyager Deployment Orchestrator is the package which will listen ```BREAD Events``` (Add, Update Delete) and will generate
10+
Voyager Deployment Orchestrator is the package which will listen `BREAD Events` (Add, Update Delete) and will generate
911
files, so that BREAD data can be easily seeded.
1012

1113
### Installation
1214

1315
```composer require drudge-rajen/voyager-deployment-orchestrator```
1416

15-
Publish the default config and seeder file.
17+
Then publish the default config and seeder file.
1618

1719
```
1820
php artisan vendor:publish --provider="DrudgeRajen\VoyagerDeploymentOrchestrator\VoyagerDeploymentOrchestratorServiceProvider"
@@ -28,21 +30,20 @@ return [
2830
];
2931
```
3032

31-
32-
After Publishing the ``VoyagerDeploymentOrchestratorSeeder`` class file
33-
autoload the composer so that laravel knows about the seeder.
33+
After Publishing the `VoyagerDeploymentOrchestratorSeeder` class file,
34+
autoload composer so that laravel knows about new seeders.
3435

3536
``composer dump-autoload``
3637

3738
### Usage
3839
Voyager Fires Events on Insert, Update, and Delete of BREAD.
39-
This package listens to those events and creates the respective seeder files.
40+
This package listens for those events and creates respective seeder files.
4041

41-
To run the seeder file :
42+
#### To run the seeder file:
4243

43-
``php artisan db:seed --class=VoyagerDeploymentOrchestratorSeeder``
44+
```php artisan db:seed --class=VoyagerDeploymentOrchestratorSeeder```
4445

45-
### Contribuing
46+
### Contributing
4647

4748
Run phpcs linter to check for any error that may happen during PR.
4849

composer.json

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
{
22
"name": "drudge-rajen/voyager-deployment-orchestrator",
33
"description": "Package for Voyager BREAD Deployment.",
4-
"keywords": ["laravel", "voyager", "voyager-deployment", "voyager-seeder", "bread-seeder"],
4+
"keywords": [
5+
"laravel",
6+
"voyager",
7+
"voyager-deployment",
8+
"voyager-seeder",
9+
"bread-seeder"
10+
],
511
"type": "library",
612
"license": "MIT",
713
"require": {

src/ContentManager/ContentManager.php

+6-8
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,9 @@ private function populateDataTypeSeederContent(string $stub, DataType $dataType)
121121

122122
$dataTypeArray = $dataType->toArray();
123123

124-
//Here, we cannot do $dataType->unsetRelations('translations)
125-
// because voyager first fire events and then save the translations.
126-
if (isset($dataTypeArray['translations'])) {
127-
unset($dataTypeArray['translations']);
128-
}
124+
// Here, we cannot do $dataType->unsetRelations('translations')
125+
// because voyager first fires events and then saves translations.
126+
unset($dataTypeArray['translations']);
129127

130128
return $this->populateInsertStatements(
131129
$stub,
@@ -307,7 +305,7 @@ private function populateTranslationStatements(string $stub, DataType $dataType)
307305
*
308306
* @param string $stub
309307
* @param string $tableName
310-
* @param $dataTypeArray
308+
* @param array $dataTypeArray
311309
*
312310
* @return mixed|string
313311
*/
@@ -330,8 +328,8 @@ private function populateInsertStatements(
330328
/**
331329
* Replace String.
332330
*
333-
* @param $search
334-
* @param $replace
331+
* @param string $search
332+
* @param string $replace
335333
* @param $stub
336334
*
337335
* @return mixed

src/OrchestratorHandlers/BreadAddedHandler.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ public function handle(BreadChanged $breadAdded)
3131
{
3232
$dataType = $breadAdded->dataType;
3333

34-
//Generate Data Type Seeder File.
34+
// Generate Data Type Seeder File.
3535
$this->filesGenerator->generateDataTypeSeedFile($dataType);
3636

37-
//Generate Data Row Seeder File.
37+
// Generate Data Row Seeder File.
3838
return $this->filesGenerator->generateDataRowSeedFile($dataType);
3939
}
4040
}

src/OrchestratorHandlers/BreadDeletedHandler.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function handle(BreadChanged $breadDataDeleted) : bool
4545
Voyager::model('Permission')->removeFrom($dataType->name);
4646
}
4747

48-
//Finally, We can delete seed files.
48+
// Finally, We can delete seed files.
4949
$this->fileGenerator->deleteSeedFiles($dataType);
5050

5151
// After deleting seeds file, we create new seed file in order to rollback

0 commit comments

Comments
 (0)