Skip to content

Commit

Permalink
Apply fixes from StyleCI (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
ycs77 authored Oct 14, 2019
1 parent a9d4d2d commit ed0892a
Show file tree
Hide file tree
Showing 13 changed files with 20 additions and 13 deletions.
1 change: 0 additions & 1 deletion src/CacheManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use Illuminate\Foundation\Application;
use Illuminate\Support\Manager;
use Ycs77\LaravelWizard\Wizard;

class CacheManager extends Manager
{
Expand Down
4 changes: 2 additions & 2 deletions src/Console/TableCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

namespace Ycs77\LaravelWizard\Console;

use Illuminate\Support\Str;
use Illuminate\Console\Command;
use Illuminate\Support\Composer;
use Illuminate\Filesystem\Filesystem;
use Illuminate\Support\Composer;
use Illuminate\Support\Str;

class TableCommand extends Command
{
Expand Down
2 changes: 1 addition & 1 deletion src/Console/WizardControllerMakeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ protected function buildStepsReplacements(array $replace)
* Create a step for the wizard.
*
* @param string $stepClass
* @param boolean $force
* @param bool $force
* @return void
*/
public function createWizardStep(string $stepClass, bool $force = false)
Expand Down
2 changes: 2 additions & 0 deletions src/DatabaseStore.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ public function get(string $key = '')
}

$data = json_decode($data['payload'], true);

return $key ? Arr::get($data, $key) : $data;
}

Expand Down Expand Up @@ -120,6 +121,7 @@ public function put(string $key, array $value, $lastIndex = null)
public function has(string $key)
{
$data = $this->get($key);

return isset($data);
}

Expand Down
5 changes: 2 additions & 3 deletions src/Facades/Wizard.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,12 @@ protected static function getFacadeAccessor()
* @param array $options
* @return void
*/
static public function routes(
public static function routes(
string $uri,
string $controllerClass,
string $name,
$options = []
)
{
) {
$options = array_merge([
'create' => 'create',
'store' => 'store',
Expand Down
2 changes: 2 additions & 0 deletions src/Http/Controllers/WizardController.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ public function store(Request $request, string $step)
// Set this step index and redirect to prev step.
if ($request->query('_trigger') === 'back' && $this->beforeBackWizardStep($request)) {
$prevStep = $this->wizard()->stepRepo()->prev();

return $this->setThisStepAndRedirectTo($request, $prevStep);
}

Expand Down Expand Up @@ -408,6 +409,7 @@ protected function save(Request $request)

$data = $this->wizard()->cache()->get();
$this->wizard()->cache()->clear();

return $data;
}

Expand Down
4 changes: 3 additions & 1 deletion src/SessionStore.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public function __construct(Session $session, string $wizardKey)
public function get(string $key = '')
{
$data = $this->session->get($this->wizardKey, []);

return $key ? Arr::get($data, $key) : $data;
}

Expand All @@ -66,7 +67,7 @@ public function getLastProcessedIndex()
*/
public function set(array $data, $lastIndex = null)
{
if (isset( $lastIndex) && is_numeric($lastIndex)) {
if (isset($lastIndex) && is_numeric($lastIndex)) {
$data['_last_index'] = (int)$lastIndex;
}

Expand Down Expand Up @@ -97,6 +98,7 @@ public function put(string $key, array $value, $lastIndex = null)
public function has(string $key)
{
$data = $this->get($key);

return isset($data);
}

Expand Down
1 change: 1 addition & 0 deletions src/StepRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ public function find(string $slug)
public function set($steps)
{
$this->steps = new Collection($steps);

return $this;
}

Expand Down
2 changes: 2 additions & 0 deletions src/Wizard.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ public function cache()
public function setCache($cache = null)
{
$this->cache = $cache ?? (new CacheManager($this->app, $this))->driver();

return $this;
}

Expand All @@ -139,6 +140,7 @@ public function stepRepo()
public function setStepRepo($stepRepo = null)
{
$this->stepRepo = $stepRepo ?? new StepRepository($this);

return $this;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateWizardTestTables extends Migration
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/DatabaseStoreTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ public function testClearData()
$this->cache->clear();

// assert
$this->assertDatabaseMissing('wizards',[
$this->assertDatabaseMissing('wizards', [
'payload' => '{"step":{"field":"data"},"_last_index":1}',
'user_id' => 1,
]);
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/StepRepositoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
namespace Ycs77\LaravelWizard\Test\Unit;

use Ycs77\LaravelWizard\StepRepository;
use Ycs77\LaravelWizard\Test\Stubs\UserStepStub;
use Ycs77\LaravelWizard\Test\Stubs\PostStepStub;
use Ycs77\LaravelWizard\Test\Stubs\UserStepStub;
use Ycs77\LaravelWizard\Test\TestCase;
use Ycs77\LaravelWizard\Wizard;

Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/StepTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Http\Request;
use Ycs77\LaravelWizard\Test\Stubs\UserStepStub;
use Ycs77\LaravelWizard\Test\Stubs\PostStepStub;
use Ycs77\LaravelWizard\Test\Stubs\UserStepStub;
use Ycs77\LaravelWizard\Test\TestCase;
use Ycs77\LaravelWizard\Wizard;

Expand Down

0 comments on commit ed0892a

Please sign in to comment.