Skip to content
This repository has been archived by the owner on Dec 17, 2022. It is now read-only.

Commit

Permalink
Code cleanup & tidying
Browse files Browse the repository at this point in the history
  • Loading branch information
Brunty committed Jul 11, 2014
1 parent 0eef7e7 commit 1968037
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
<?php namespace Brunty\LaravelEnvironment\Commands;
<?php
namespace Brunty\LaravelEnvironment\Commands;

use Brunty\LaravelEnvironment\Helpers\ArrayHelper;
use Brunty\LaravelEnvironment\Helpers\FileSystemHelper;
use Brunty\LaravelEnvironment\Helpers\InputHelper;
use Illuminate\Support\Str as Str;
use Illuminate\Console\Command;
use Illuminate\Filesystem\Filesystem;
use Symfony\Component\Console\Input\InputOption;

/**
* Class SetupEnvironmentVariablesCommand
Expand Down
14 changes: 8 additions & 6 deletions src/Brunty/LaravelEnvironment/Helpers/ArrayHelper.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
<?php namespace Brunty\LaravelEnvironment\Helpers;
<?php
namespace Brunty\LaravelEnvironment\Helpers;

/**
* Class ArrayHelper
* @package Brunty\LaravelEnvironment\Helpers
*/
class ArrayHelper {
class ArrayHelper
{

/**
* @param $contents
Expand Down Expand Up @@ -32,10 +34,10 @@ public function arrayKeyToStringPath($contents)
public function stringPathToArrayKey($inputArray = [])
{
$tempArray = [];
foreach($inputArray as $envVar => $value) {
foreach ($inputArray as $envVar => $value) {
$path = explode('.', $envVar);
$root = &$tempArray;
while($branch = array_shift($path)) {
while ($branch = array_shift($path)) {
if ( ! isset($root[$branch])) {
$root[$branch] = [];
}
Expand All @@ -56,9 +58,9 @@ public function stringPathToArrayKey($inputArray = [])
public function arrayToSymfonyConsoleTableRows($inputArray = [])
{
$rows = [];

ksort($inputArray);
foreach($inputArray as $envVar => $value) {

foreach ($inputArray as $envVar => $value) {
$rows[] = [$envVar, $value];
}

Expand Down
17 changes: 14 additions & 3 deletions src/Brunty/LaravelEnvironment/Helpers/FileSystemHelper.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
<?php namespace Brunty\LaravelEnvironment\Helpers;
<?php
namespace Brunty\LaravelEnvironment\Helpers;

use Illuminate\Filesystem\Filesystem;

class FileSystemHelper extends Filesystem {
/**
* Class FileSystemHelper
* @package Brunty\LaravelEnvironment\Helpers
*/
class FileSystemHelper extends Filesystem
{

public function includeFile($path) {
/**
* @param $path
* @return mixed
*/
public function includeFile($path)
{
return include($path);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php namespace Brunty\LaravelEnvironment;
<?php
namespace Brunty\LaravelEnvironment;

use Brunty\LaravelEnvironment\Commands\SetupEnvironmentVariablesCommand;
use Brunty\LaravelEnvironment\Helpers\ArrayHelper;
use Brunty\LaravelEnvironment\Helpers\FileSystemHelper;
use Illuminate\Filesystem\Filesystem;
use Illuminate\Support\ServiceProvider;

class LaravelEnvironmentServiceProvider extends ServiceProvider {
Expand Down

0 comments on commit 1968037

Please sign in to comment.