Skip to content

Commit

Permalink
Refactor.
Browse files Browse the repository at this point in the history
Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com>
  • Loading branch information
crynobone committed Aug 3, 2019
1 parent f780491 commit d97e9cd
Show file tree
Hide file tree
Showing 34 changed files with 127 additions and 127 deletions.
12 changes: 6 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,17 @@
"laravie/authen": "^2.1",
"laravie/html": "~5.8.0",
"mpociot/reauthenticate": "^1.3",
"orchestra/asset": "~3.8.0",
"orchestra/auth": "~3.8.0",
"orchestra/asset": "~3.8.1",
"orchestra/auth": "~3.8.1",
"orchestra/contracts": "~3.8.0",
"orchestra/extension": "~3.8.0",
"orchestra/extension": "~3.8.1",
"orchestra/html": "~3.8.1",
"orchestra/kernel": "~3.8.0",
"orchestra/kernel": "~3.8.2",
"orchestra/memory": "~3.8.0",
"orchestra/messages": "~3.8.0",
"orchestra/model": "~3.8.0",
"orchestra/model": "~3.8.2",
"orchestra/notifier": "~3.8.2",
"orchestra/support": "~3.8.5",
"orchestra/support": "~3.8.6",
"orchestra/translation": "~3.8.0",
"orchestra/view": "~3.8.0",
"orchestra/widget": "~3.8.0"
Expand Down
2 changes: 1 addition & 1 deletion routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use Illuminate\Routing\Router;
use Orchestra\Support\Facades\Foundation;

Foundation::namespaced('Orchestra\Foundation\Http\Controllers', function (Router $router) {
Foundation::namespaced('Orchestra\Foundation\Http\Controllers', static function (Router $router) {
// Route to account/profile.
$router->get('account', 'Account\ProfileUpdaterController@edit');
$router->post('account', 'Account\ProfileUpdaterController@update');
Expand Down
2 changes: 1 addition & 1 deletion src/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ public function useVendorPath($path)
public function registerConfiguredProviders()
{
$providers = Collection::make($this->config['app.providers'])
->partition(function ($provider) {
->partition(static function ($provider) {
return Str::startsWith($provider, ['Illuminate\\', 'Orchestra\\']);
});

Expand Down
12 changes: 6 additions & 6 deletions src/Bootstrap/LoadExpresso.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,30 +31,30 @@ protected function addBladeExtensions(Application $app)
{
$blade = $app->make('blade.compiler');

$blade->directive('decorator', function ($expression) {
$blade->directive('decorator', static function ($expression) {
return "<?php echo \app('orchestra.decorator')->render({$expression}); ?>";
});

$blade->directive('placeholder', function ($expression) {
$blade->directive('placeholder', static function ($expression) {
$expression = \preg_replace('/\(\s*(.*)\)/', '$1', $expression);

return "<?php \$__ps = app('orchestra.widget')->make('placeholder.'.{$expression}); "
."foreach (\$__ps as \$__p) { echo value(\$__p->value ?: ''); } ?>";
});

$blade->directive('get_meta', function ($expression) {
$blade->directive('get_meta', static function ($expression) {
return "<?php echo \get_meta({$expression}); ?>";
});

$blade->directive('set_meta', function ($expression) {
$blade->directive('set_meta', static function ($expression) {
return "<?php \set_meta({$expression}); ?>";
});

$blade->directive('title', function ($expression) {
$blade->directive('title', static function ($expression) {
return "<?php echo \app('html')->title({$expression}); ?>";
});

$blade->extend(function ($view) {
$blade->extend(static function ($view) {
$view = \preg_replace('/(\s*)(<\?\s)/', '$1<?php ', $view);
$view = \preg_replace('/#\{\{\s*(.+?)\s*\}\}/s', '<?php $1; ?>', $view);

Expand Down
2 changes: 1 addition & 1 deletion src/Bootstrap/LoadUserMetaData.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class LoadUserMetaData
*/
public function bootstrap(Application $app)
{
$app->make('orchestra.memory')->extend('user', function ($app, $name) {
$app->make('orchestra.memory')->extend('user', static function ($app, $name) {
return new UserProvider(
new UserRepository($name, [], $app)
);
Expand Down
2 changes: 1 addition & 1 deletion src/Bootstrap/NotifyIfSafeMode.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class NotifyIfSafeMode
public function bootstrap(Application $app)
{
if ($app->make('orchestra.extension.status')->is('safe')) {
Messages::extend(function (MessageBag $messages) {
Messages::extend(static function (MessageBag $messages) {
$messages->add('info', \trans('orchestra/foundation::response.safe-mode'));
});
}
Expand Down
4 changes: 2 additions & 2 deletions src/Console/Commands/ClearCompiledCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ public function handle()
Collection::make([
$this->laravel->getCachedServicesPath(),
$this->laravel->getCachedExtensionServicesPath(),
])->filter(function ($file) {
])->filter(static function ($file) {
return \file_exists($file);
})->each(function ($file) {
})->each(static function ($file) {
@\unlink($file);
});
}
Expand Down
28 changes: 14 additions & 14 deletions src/Http/Controllers/Account/PasswordBrokerController.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ protected function onCreate()
*/
public function showLinkRequestForm()
{
set_meta('title', trans('orchestra/foundation::title.forgot-password'));
\set_meta('title', \trans('orchestra/foundation::title.forgot-password'));

return view('orchestra/foundation::forgot.index');
return \view('orchestra/foundation::forgot.index');
}

/**
Expand Down Expand Up @@ -63,15 +63,15 @@ public function sendResetLinkEmail(Processor $processor)
*/
public function showResetForm($token = null)
{
if (is_null($token)) {
if (\is_null($token)) {
return $this->showLinkRequestForm();
}

$email = Request::input('email');

set_meta('title', trans('orchestra/foundation::title.reset-password'));
\set_meta('title', \trans('orchestra/foundation::title.reset-password'));

return view('orchestra/foundation::forgot.reset', compact('email', 'token'));
return \view('orchestra/foundation::forgot.reset', \compact('email', 'token'));
}

/**
Expand Down Expand Up @@ -103,7 +103,7 @@ public function resetLinkFailedValidation($errors)
// to tell it the the user. This might not be important but a
// good practice to make sure all form use the same e-mail
// address validation
return $this->redirectWithErrors(handles('orchestra::forgot'), $errors);
return $this->redirectWithErrors(\handles('orchestra::forgot'), $errors);
}

/**
Expand All @@ -115,9 +115,9 @@ public function resetLinkFailedValidation($errors)
*/
public function resetLinkFailed($response)
{
$message = trans($response);
$message = \trans($response);

return $this->redirectWithMessage(handles('orchestra::forgot'), $message, 'error');
return $this->redirectWithMessage(\handles('orchestra::forgot'), $message, 'error');
}

/**
Expand All @@ -129,9 +129,9 @@ public function resetLinkFailed($response)
*/
public function resetLinkSent($response)
{
$message = trans($response);
$message = \trans($response);

return $this->redirectWithMessage(handles('orchestra::forgot'), $message);
return $this->redirectWithMessage(\handles('orchestra::forgot'), $message);
}

/**
Expand All @@ -143,10 +143,10 @@ public function resetLinkSent($response)
*/
public function passwordResetHasFailed($response)
{
$message = trans($response);
$message = \trans($response);
$token = Request::input('token');

return $this->redirectWithMessage(handles("orchestra::forgot/reset/{$token}"), $message, 'error');
return $this->redirectWithMessage(\handles("orchestra::forgot/reset/{$token}"), $message, 'error');
}

/**
Expand All @@ -158,8 +158,8 @@ public function passwordResetHasFailed($response)
*/
public function passwordHasReset($response)
{
$message = trans('orchestra/foundation::response.account.password.update');
$message = \trans('orchestra/foundation::response.account.password.update');

return $this->redirectWithMessage(handles('orchestra::/'), $message);
return $this->redirectWithMessage(\handles('orchestra::/'), $message);
}
}
18 changes: 9 additions & 9 deletions src/Http/Controllers/Account/PasswordUpdaterController.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ public function update(Processor $processor)
*/
public function showPasswordChanger(array $data)
{
set_meta('title', trans('orchestra/foundation::title.account.password'));
\set_meta('title', \trans('orchestra/foundation::title.account.password'));

return view('orchestra/foundation::account.password', $data);
return \view('orchestra/foundation::account.password', $data);
}

/**
Expand All @@ -59,7 +59,7 @@ public function showPasswordChanger(array $data)
*/
public function updatePasswordFailedValidation($errors)
{
return $this->redirectWithErrors(handles('orchestra::account/password'), $errors);
return $this->redirectWithErrors(\handles('orchestra::account/password'), $errors);
}

/**
Expand All @@ -69,9 +69,9 @@ public function updatePasswordFailedValidation($errors)
*/
public function verifyCurrentPasswordFailed()
{
$message = trans('orchestra/foundation::response.account.password.invalid');
$message = \trans('orchestra/foundation::response.account.password.invalid');

return $this->redirectWithMessage(handles('orchestra::account/password'), $message, 'error');
return $this->redirectWithMessage(\handles('orchestra::account/password'), $message, 'error');
}

/**
Expand All @@ -83,9 +83,9 @@ public function verifyCurrentPasswordFailed()
*/
public function updatePasswordFailed(array $errors)
{
$message = trans('orchestra/foundation::response.db-failed', $errors);
$message = \trans('orchestra/foundation::response.db-failed', $errors);

return $this->redirectWithMessage(handles('orchestra::account/password'), $message, 'error');
return $this->redirectWithMessage(\handles('orchestra::account/password'), $message, 'error');
}

/**
Expand All @@ -95,8 +95,8 @@ public function updatePasswordFailed(array $errors)
*/
public function passwordUpdated()
{
$message = trans('orchestra/foundation::response.account.password.update');
$message = \trans('orchestra/foundation::response.account.password.update');

return $this->redirectWithMessage(handles('orchestra::account/password'), $message);
return $this->redirectWithMessage(\handles('orchestra::account/password'), $message);
}
}
14 changes: 7 additions & 7 deletions src/Http/Controllers/Account/ProfileCreatorController.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ public function store(Processor $processor)
*/
public function showProfileCreator(array $data)
{
set_meta('title', trans('orchestra/foundation::title.register'));
\set_meta('title', \trans('orchestra/foundation::title.register'));

return view('orchestra/foundation::credential.register', $data);
return \view('orchestra/foundation::credential.register', $data);
}

/**
Expand All @@ -86,7 +86,7 @@ public function createProfileFailedValidation($errors)
*/
public function createProfileFailed(array $errors)
{
messages('error', trans('orchestra/foundation::response.db-failed', $errors));
\messages('error', \trans('orchestra/foundation::response.db-failed', $errors));

return $this->redirect($this->getRedirectToRegisterPath())->withInput();
}
Expand All @@ -98,8 +98,8 @@ public function createProfileFailed(array $errors)
*/
public function profileCreatedWithoutNotification()
{
messages('success', trans('orchestra/foundation::response.users.create'));
messages('error', trans('orchestra/foundation::response.credential.register.email-fail'));
\messages('success', \trans('orchestra/foundation::response.users.create'));
\messages('error', \trans('orchestra/foundation::response.credential.register.email-fail'));

return Redirect::intended($this->getRedirectToLoginPath());
}
Expand All @@ -111,8 +111,8 @@ public function profileCreatedWithoutNotification()
*/
public function profileCreated()
{
messages('success', trans('orchestra/foundation::response.users.create'));
messages('success', trans('orchestra/foundation::response.credential.register.email-send'));
\messages('success', \trans('orchestra/foundation::response.users.create'));
\messages('success', \trans('orchestra/foundation::response.credential.register.email-send'));

return Redirect::intended($this->getRedirectToLoginPath());
}
Expand Down
14 changes: 7 additions & 7 deletions src/Http/Controllers/Account/ProfileUpdaterController.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ public function update(Processor $processor)
*/
public function showProfileChanger(array $data)
{
set_meta('title', trans('orchestra/foundation::title.account.profile'));
\set_meta('title', \trans('orchestra/foundation::title.account.profile'));

return view('orchestra/foundation::account.index', $data);
return \view('orchestra/foundation::account.index', $data);
}

/**
Expand All @@ -59,7 +59,7 @@ public function showProfileChanger(array $data)
*/
public function updateProfileFailedValidation($errors)
{
return $this->redirectWithErrors(handles('orchestra::account'), $errors);
return $this->redirectWithErrors(\handles('orchestra::account'), $errors);
}

/**
Expand All @@ -71,9 +71,9 @@ public function updateProfileFailedValidation($errors)
*/
public function updateProfileFailed(array $errors)
{
$message = trans('orchestra/foundation::response.db-failed', $errors);
$message = \trans('orchestra/foundation::response.db-failed', $errors);

return $this->redirectWithMessage(handles('orchestra::account'), $message, 'error');
return $this->redirectWithMessage(\handles('orchestra::account'), $message, 'error');
}

/**
Expand All @@ -83,8 +83,8 @@ public function updateProfileFailed(array $errors)
*/
public function profileUpdated()
{
$message = trans('orchestra/foundation::response.account.profile.update');
$message = \trans('orchestra/foundation::response.account.profile.update');

return $this->redirectWithMessage(handles('orchestra::account'), $message);
return $this->redirectWithMessage(\handles('orchestra::account'), $message);
}
}
8 changes: 4 additions & 4 deletions src/Http/Controllers/Account/ReauthenticateController.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ protected function onCreate()
*/
public function show()
{
return view('orchestra/foundation::account.reauthenticate');
return \view('orchestra/foundation::account.reauthenticate');
}

/**
Expand Down Expand Up @@ -62,7 +62,7 @@ public function reauth(Request $request, AccountValidator $validator)
*/
public function userReauthenticateHasFailedValidation($errors)
{
return $this->redirectWithErrors(handles('orchestra::sudo'), $errors);
return $this->redirectWithErrors(\handles('orchestra::sudo'), $errors);
}

/**
Expand All @@ -72,9 +72,9 @@ public function userReauthenticateHasFailedValidation($errors)
*/
protected function userHasFailedReauthentication()
{
$message = trans('orchestra/foundation::response.credential.invalid-combination');
$message = \trans('orchestra/foundation::response.credential.invalid-combination');

return $this->redirectWithMessage(handles('orchestra::sudo'), $message, 'error');
return $this->redirectWithMessage(\handles('orchestra::sudo'), $message, 'error');
}

/**
Expand Down
Loading

0 comments on commit d97e9cd

Please sign in to comment.