Skip to content
This repository has been archived by the owner on Nov 27, 2020. It is now read-only.

Commit

Permalink
Use bootstrap methods
Browse files Browse the repository at this point in the history
  • Loading branch information
NastuzziSamy committed Jun 27, 2020
1 parent 2c5fbc5 commit e5511a8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/Commands/BaseGeneratorCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
Str, Carbon
};
use Illuminate\Console\GeneratorCommand;
use Illuminate\Container\Container;

abstract class BaseGeneratorCommand extends GeneratorCommand
{
Expand All @@ -27,6 +26,7 @@ abstract class BaseGeneratorCommand extends GeneratorCommand
protected function buildClass($name)
{
$stub = parent::buildClass($name);

$stub = $this->replaceDate($stub, (string) Carbon::now());
$stub = $this->replaceModelClass($stub, $this->guessModelClass($this->getNameInput()));

Expand All @@ -42,7 +42,7 @@ protected function buildClass($name)
*/
protected function replaceDate(string $stub, string $date)
{
return str_replace('DummyDate', $date, $stub);
return \str_replace('DummyDate', $date, $stub);
}

/**
Expand All @@ -57,7 +57,7 @@ protected function guessModelClass(string $name)
$name = Str::replaceLast($this->type, '', $name);
}

return '\\'.Container::getInstance()->make('config', ['metas.models_namespace', 'App']).'\\'.$name;
return '\\'.config('metas.models_namespace', 'App').'\\'.$name;
}

/**
Expand All @@ -69,6 +69,6 @@ protected function guessModelClass(string $name)
*/
protected function replaceModelClass(string $stub, string $modelClass)
{
return str_replace('DummyModelClass', $modelClass, $stub);
return \str_replace('DummyModelClass', $modelClass, $stub);
}
}
2 changes: 1 addition & 1 deletion src/Exceptions/ConfigException.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class ConfigException extends LaramoreException
* @param integer $code
* @param \Throwable $previous
*/
public function __construct(string $config, array $supportedValues, $givenValue, string $message=null,
public function __construct(string $config, array $supportedValues=null, $givenValue=null, string $message=null,
int $code=0, \Throwable $previous=null)
{
$this->config = $config;
Expand Down
4 changes: 2 additions & 2 deletions src/Traits/HasLockedMacros.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
namespace Laramore\Traits;

use Illuminate\Support\Traits\Macroable;
use Illuminate\Container\Container;
use Illuminate\Foundation\Application;
use Laramore\Exceptions\LockException;

trait HasLockedMacros
Expand All @@ -29,7 +29,7 @@ trait HasLockedMacros
*/
public static function macro($name, callable $macro)
{
if (Container::getInstance()->isBooted()) {
if (Application::getInstance()->isBooted()) {
throw new LockException('No more macros could be defined after the application booting', $name);
}

Expand Down

0 comments on commit e5511a8

Please sign in to comment.