CS: PSR1/2

parent b4d1ad30
......@@ -51,7 +51,6 @@ class ConfigureDatabase implements SetupScript
$vars = [];
while (! $connected) {
$vars['db_driver'] = $this->askDatabaseDriver();
$vars['db_host'] = $this->askDatabaseHost();
$vars['db_port'] = $this->askDatabasePort($vars['db_driver']);
......
......@@ -6,10 +6,8 @@ use Illuminate\Console\Command;
use Modules\Core\Console\Installers\SetupScript;
use Modules\Core\Console\Installers\Writers\EnvFileWriter;
class CreateEnvFile implements SetupScript
{
/**
* @var EnvFileWriter
*/
......@@ -42,8 +40,4 @@ class CreateEnvFile implements SetupScript
$command->info('Successfully created .env file');
}
}
......@@ -25,7 +25,6 @@ class SetInstalledFlag implements SetupScript
*/
public function fire(Command $command)
{
$vars = [];
$vars['installed'] = 'true';
......@@ -33,6 +32,5 @@ class SetInstalledFlag implements SetupScript
$this->env->write($vars);
$command->info('The application is now installed');
}
}
......@@ -68,26 +68,19 @@ class EnvFileWriter
public function write($vars)
{
if (!empty($vars)) {
$environmentFile = $this->finder->get($this->file);
foreach ($vars as $key => $value) {
if (isset($this->setable_variables[$key])) {
$env_var_name = explode('=', $this->setable_variables[$key])[0];
$value = $env_var_name . '=' . $value;
$environmentFile = str_replace($this->setable_variables[$key], $value, $environmentFile);
}
}
$this->finder->put($this->file, $environmentFile);
}
}
}
......@@ -98,8 +98,10 @@ trait Translatable
$cacheArray = [];
$translatedEntityName = $this->getTranslationClass();
if (! isset($cacheArray[$translatedEntityName])) {
$cacheArray[$translatedEntityName] = array_values(array_diff(EntityManagerFacade::getClassMetadata($translatedEntityName)->getColumnNames(),
['id', 'locale']));
$cacheArray[$translatedEntityName] = array_values(array_diff(
EntityManagerFacade::getClassMetadata($translatedEntityName)->getColumnNames(),
['id', 'locale']
));
}
return $cacheArray[$translatedEntityName];
......
......@@ -67,7 +67,10 @@ abstract class BaseFormRequest extends FormRequest
}
return $factory->make(
$this->all(), $rules, array_merge($this->messages(), $messages), $attributes
$this->all(),
$rules,
array_merge($this->messages(), $messages),
$attributes
);
}
......
......@@ -262,7 +262,9 @@ class CoreServiceProvider extends ServiceProvider
$localeConfig = $this->app['cache']
->tags('setting.settings', 'global')
->remember("asgard.locales", 120,
->remember(
"asgard.locales",
120,
function () {
return DB::table('setting__settings')->whereName('core::locales')->first();
}
......
......@@ -45,7 +45,9 @@ abstract class BaseCacheDecorator implements BaseRepository
{
return $this->cache
->tags([$this->entityName, 'global'])
->remember("{$this->locale}.{$this->entityName}.find.{$id}", $this->cacheTime,
->remember(
"{$this->locale}.{$this->entityName}.find.{$id}",
$this->cacheTime,
function () use ($id) {
return $this->repository->find($id);
}
......@@ -59,7 +61,9 @@ abstract class BaseCacheDecorator implements BaseRepository
{
return $this->cache
->tags([$this->entityName, 'global'])
->remember("{$this->locale}.{$this->entityName}.all", $this->cacheTime,
->remember(
"{$this->locale}.{$this->entityName}.all",
$this->cacheTime,
function () {
return $this->repository->all();
}
......@@ -73,7 +77,9 @@ abstract class BaseCacheDecorator implements BaseRepository
{
return $this->cache
->tags([$this->entityName, 'global'])
->remember("{$this->locale}.{$this->entityName}.allWithBuilder", $this->cacheTime,
->remember(
"{$this->locale}.{$this->entityName}.allWithBuilder",
$this->cacheTime,
function () {
return $this->repository->allWithBuilder();
}
......@@ -87,7 +93,9 @@ abstract class BaseCacheDecorator implements BaseRepository
{
return $this->cache
->tags([$this->entityName, 'global'])
->remember("{$this->locale}.{$this->entityName}.paginate.{$perPage}", $this->cacheTime,
->remember(
"{$this->locale}.{$this->entityName}.paginate.{$perPage}",
$this->cacheTime,
function () use ($perPage) {
return $this->repository->paginate($perPage);
}
......@@ -101,7 +109,9 @@ abstract class BaseCacheDecorator implements BaseRepository
{
return $this->cache
->tags([$this->entityName, 'global'])
->remember("{$this->locale}.{$this->entityName}.allTranslatedIn.{$lang}", $this->cacheTime,
->remember(
"{$this->locale}.{$this->entityName}.allTranslatedIn.{$lang}",
$this->cacheTime,
function () use ($lang) {
return $this->repository->allTranslatedIn($lang);
}
......@@ -115,7 +125,9 @@ abstract class BaseCacheDecorator implements BaseRepository
{
return $this->cache
->tags([$this->entityName, 'global'])
->remember("{$this->locale}.{$this->entityName}.findBySlug.{$slug}", $this->cacheTime,
->remember(
"{$this->locale}.{$this->entityName}.findBySlug.{$slug}",
$this->cacheTime,
function () use ($slug) {
return $this->repository->findBySlug($slug);
}
......@@ -161,7 +173,9 @@ abstract class BaseCacheDecorator implements BaseRepository
return $this->cache
->tags([$this->entityName, 'global'])
->remember("{$this->locale}.{$this->entityName}.findByAttributes.{$tagIdentifier}", $this->cacheTime,
->remember(
"{$this->locale}.{$this->entityName}.findByAttributes.{$tagIdentifier}",
$this->cacheTime,
function () use ($attributes) {
return $this->repository->findByAttributes($attributes);
}
......@@ -177,7 +191,9 @@ abstract class BaseCacheDecorator implements BaseRepository
return $this->cache
->tags([$this->entityName, 'global'])
->remember("{$this->locale}.{$this->entityName}.findByAttributes.{$tagIdentifier}.{$orderBy}.{$sortOrder}", $this->cacheTime,
->remember(
"{$this->locale}.{$this->entityName}.findByAttributes.{$tagIdentifier}.{$orderBy}.{$sortOrder}",
$this->cacheTime,
function () use ($attributes, $orderBy, $sortOrder) {
return $this->repository->getByAttributes($attributes, $orderBy, $sortOrder);
}
......@@ -193,7 +209,9 @@ abstract class BaseCacheDecorator implements BaseRepository
return $this->cache
->tags([$this->entityName, 'global'])
->remember("{$this->locale}.{$this->entityName}.findByMany.{$tagIdentifier}", $this->cacheTime,
->remember(
"{$this->locale}.{$this->entityName}.findByMany.{$tagIdentifier}",
$this->cacheTime,
function () use ($ids) {
return $this->repository->findByMany($ids);
}
......
......@@ -23,7 +23,9 @@ class CacheWidgetDecorator extends BaseCacheDecorator implements WidgetRepositor
{
return $this->cache
->tags([$this->entityName, 'global'])
->remember("{$this->locale}.{$this->entityName}.findForUser.{$userId}", $this->cacheTime,
->remember(
"{$this->locale}.{$this->entityName}.findForUser.{$userId}",
$this->cacheTime,
function () use ($userId) {
return $this->repository->findForUser($userId);
}
......@@ -40,7 +42,9 @@ class CacheWidgetDecorator extends BaseCacheDecorator implements WidgetRepositor
{
return $this->cache
->tags([$this->entityName, 'global'])
->remember("{$this->locale}.{$this->entityName}.updateOrCreateForUser.{$userId}", $this->cacheTime,
->remember(
"{$this->locale}.{$this->entityName}.updateOrCreateForUser.{$userId}",
$this->cacheTime,
function () use ($widgets, $userId) {
return $this->repository->updateOrCreateForUser($widgets, $userId);
}
......
<?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 AddFoldersColumnsOnFilesTable extends Migration
{
......
......@@ -257,7 +257,7 @@ class Imagy
}
$filenameWithoutPrefix = $this->removeConfigPrefix($path->getRelativeUrl());
$filename = substr(strrchr($filenameWithoutPrefix, '/'), 1);
$folders = str_replace($filename, '' , $filenameWithoutPrefix);
$folders = str_replace($filename, '', $filenameWithoutPrefix);
if ($filename === false) {
return config('asgard.media.config.files-path') . $this->newFilename($path, $thumbnail);
......@@ -276,7 +276,7 @@ class Imagy
return str_replace([
$configAssetPath,
ltrim($configAssetPath, '/')
ltrim($configAssetPath, '/'),
], '', $path);
}
}
......@@ -40,8 +40,8 @@ final class EloquentFolderRepositoryTest extends MediaTestCase
$this->assertCount(1, $this->folder->all());
$this->assertEquals('My Folder', $folder->filename);
$this->assertEquals('/assets/media/my-folder', $folder->path->getRelativeUrl());
$this->assertTrue( $folder->is_folder);
$this->assertTrue( $folder->isFolder());
$this->assertTrue($folder->is_folder);
$this->assertTrue($folder->isFolder());
$this->assertEquals(0, $folder->folder_id);
}
......
......@@ -31,8 +31,8 @@ class MediaTransformer extends Resource
'media_type' => $this->media_type,
'fa_icon' => FileHelper::getFaIcon($this->media_type),
'created_at' => $this->created_at,
'small_thumb' => $this->imagy->getThumbnail($this->path,'smallThumb'),
'medium_thumb' => $this->imagy->getThumbnail($this->path,'mediumThumb'),
'small_thumb' => $this->imagy->getThumbnail($this->path, 'smallThumb'),
'medium_thumb' => $this->imagy->getThumbnail($this->path, 'mediumThumb'),
];
}
......
......@@ -27,7 +27,9 @@ class CacheMenuDecorator extends BaseCacheDecorator implements MenuRepository
{
return $this->cache
->tags([$this->entityName, 'global'])
->remember("{$this->locale}.{$this->entityName}.allOnline", $this->cacheTime,
->remember(
"{$this->locale}.{$this->entityName}.allOnline",
$this->cacheTime,
function () {
return $this->repository->allOnline();
}
......
......@@ -29,7 +29,9 @@ class CacheMenuItemDecorator extends BaseCacheDecorator implements MenuItemRepos
{
return $this->cache
->tags([$this->entityName, 'global'])
->remember("{$this->locale}.{$this->entityName}.rootsForMenu.{$menuId}", $this->cacheTime,
->remember(
"{$this->locale}.{$this->entityName}.rootsForMenu.{$menuId}",
$this->cacheTime,
function () use ($menuId) {
return $this->repository->rootsForMenu($menuId);
}
......@@ -45,7 +47,9 @@ class CacheMenuItemDecorator extends BaseCacheDecorator implements MenuItemRepos
{
return $this->cache
->tags([$this->entityName, 'global'])
->remember("{$this->locale}.{$this->entityName}.getForRoutes", $this->cacheTime,
->remember(
"{$this->locale}.{$this->entityName}.getForRoutes",
$this->cacheTime,
function () {
return $this->repository->getForRoutes();
}
......@@ -62,7 +66,9 @@ class CacheMenuItemDecorator extends BaseCacheDecorator implements MenuItemRepos
{
return $this->cache
->tags([$this->entityName, 'global'])
->remember("{$this->locale}.{$this->entityName}.getRootForMenu.{$menuId}", $this->cacheTime,
->remember(
"{$this->locale}.{$this->entityName}.getRootForMenu.{$menuId}",
$this->cacheTime,
function () use ($menuId) {
return $this->repository->getRootForMenu($menuId);
}
......@@ -79,7 +85,9 @@ class CacheMenuItemDecorator extends BaseCacheDecorator implements MenuItemRepos
{
return $this->cache
->tags([$this->entityName, 'global'])
->remember("{$this->locale}.{$this->entityName}.getTreeForMenu.{$menuId}", $this->cacheTime,
->remember(
"{$this->locale}.{$this->entityName}.getTreeForMenu.{$menuId}",
$this->cacheTime,
function () use ($menuId) {
return $this->repository->getTreeForMenu($menuId);
}
......@@ -96,7 +104,9 @@ class CacheMenuItemDecorator extends BaseCacheDecorator implements MenuItemRepos
{
return $this->cache
->tags([$this->entityName, 'global'])
->remember("{$this->locale}.{$this->entityName}.allRootsForMenu.{$menuId}", $this->cacheTime,
->remember(
"{$this->locale}.{$this->entityName}.allRootsForMenu.{$menuId}",
$this->cacheTime,
function () use ($menuId) {
return $this->repository->allRootsForMenu($menuId);
}
......@@ -112,7 +122,9 @@ class CacheMenuItemDecorator extends BaseCacheDecorator implements MenuItemRepos
{
return $this->cache
->tags([$this->entityName, 'global'])
->remember("{$this->locale}.{$this->entityName}.findByUriInLanguage.{$uri}.{$locale}", $this->cacheTime,
->remember(
"{$this->locale}.{$this->entityName}.findByUriInLanguage.{$uri}.{$locale}",
$this->cacheTime,
function () use ($uri, $locale) {
return $this->repository->findByUriInLanguage($uri, $locale);
}
......
......@@ -31,7 +31,9 @@ class CachePageDecorator extends BaseCacheDecorator implements PageRepository
{
return $this->cache
->tags([$this->entityName, 'global'])
->remember("{$this->locale}.{$this->entityName}.findHomepage", $this->cacheTime,
->remember(
"{$this->locale}.{$this->entityName}.findHomepage",
$this->cacheTime,
function () {
return $this->repository->findHomepage();
}
......@@ -46,7 +48,9 @@ class CachePageDecorator extends BaseCacheDecorator implements PageRepository
{
return $this->cache
->tags([$this->entityName, 'global'])
->remember("{$this->locale}.{$this->entityName}.countAll", $this->cacheTime,
->remember(
"{$this->locale}.{$this->entityName}.countAll",
$this->cacheTime,
function () {
return $this->repository->countAll();
}
......@@ -62,7 +66,9 @@ class CachePageDecorator extends BaseCacheDecorator implements PageRepository
{
return $this->cache
->tags([$this->entityName, 'global'])
->remember("{$this->locale}.{$this->entityName}.findBySlugInLocale.{$slug}.{$locale}", $this->cacheTime,
->remember(
"{$this->locale}.{$this->entityName}.findBySlugInLocale.{$slug}.{$locale}",
$this->cacheTime,
function () use ($slug, $locale) {
return $this->repository->findBySlugInLocale($slug, $locale);
}
......@@ -85,7 +91,9 @@ class CachePageDecorator extends BaseCacheDecorator implements PageRepository
return $this->cache
->tags([$this->entityName, 'global'])
->remember("{$this->locale}.{$this->entityName}.serverPaginationFilteringFor.{$key}", $this->cacheTime,
->remember(
"{$this->locale}.{$this->entityName}.serverPaginationFilteringFor.{$key}",
$this->cacheTime,
function () use ($request) {
return $this->repository->serverPaginationFilteringFor($request);
}
......
......@@ -58,7 +58,9 @@ class SettingController extends AdminBaseController
$dbSettings = $this->setting->savedModuleSettings($currentModule->getLowerName());
return view('setting::admin.module-settings',
compact('currentModule', 'translatableSettings', 'plainSettings', 'dbSettings', 'modulesWithSettings'));
return view(
'setting::admin.module-settings',
compact('currentModule', 'translatableSettings', 'plainSettings', 'dbSettings', 'modulesWithSettings')
);
}
}
......@@ -35,7 +35,9 @@ class CacheSettingDecorator extends BaseCacheDecorator implements SettingReposit
{
return $this->cache
->tags([$this->entityName, 'global'])
->remember("{$this->locale}.{$this->entityName}.findByName.{$settingName}", $this->cacheTime,
->remember(
"{$this->locale}.{$this->entityName}.findByName.{$settingName}",
$this->cacheTime,
function () use ($settingName) {
return $this->repository->findByName($settingName);
}
......@@ -54,7 +56,9 @@ class CacheSettingDecorator extends BaseCacheDecorator implements SettingReposit
return $this->cache
->tags([$this->entityName, 'global'])
->remember("{$this->locale}.{$this->entityName}.moduleSettings.{$moduleList}", $this->cacheTime,
->remember(
"{$this->locale}.{$this->entityName}.moduleSettings.{$moduleList}",
$this->cacheTime,
function () use ($modules) {
return $this->repository->moduleSettings($modules);
}
......@@ -70,7 +74,9 @@ class CacheSettingDecorator extends BaseCacheDecorator implements SettingReposit
{
return $this->cache
->tags([$this->entityName, 'global'])
->remember("{$this->locale}.{$this->entityName}.savedModuleSettings.{$module}", $this->cacheTime,
->remember(
"{$this->locale}.{$this->entityName}.savedModuleSettings.{$module}",
$this->cacheTime,
function () use ($module) {
return $this->repository->savedModuleSettings($module);
}
......@@ -86,7 +92,9 @@ class CacheSettingDecorator extends BaseCacheDecorator implements SettingReposit
{
return $this->cache
->tags([$this->entityName, 'global'])
->remember("{$this->locale}.{$this->entityName}.findByModule.{$module}", $this->cacheTime,
->remember(
"{$this->locale}.{$this->entityName}.findByModule.{$module}",
$this->cacheTime,
function () use ($module) {
return $this->repository->findByModule($module);
}
......@@ -102,7 +110,9 @@ class CacheSettingDecorator extends BaseCacheDecorator implements SettingReposit
{
return $this->cache
->tags([$this->entityName, 'global'])
->remember("{$this->locale}.{$this->entityName}.get.{$settingName}", $this->cacheTime,
->remember(
"{$this->locale}.{$this->entityName}.get.{$settingName}",
$this->cacheTime,
function () use ($settingName) {
return $this->repository->get($settingName);
}
......@@ -118,7 +128,9 @@ class CacheSettingDecorator extends BaseCacheDecorator implements SettingReposit
{
return $this->cache
->tags([$this->entityName, 'global'])
->remember("{$this->locale}.{$this->entityName}.translatableModuleSettings.{$module}", $this->cacheTime,
->remember(
"{$this->locale}.{$this->entityName}.translatableModuleSettings.{$module}",
$this->cacheTime,
function () use ($module) {
return $this->repository->translatableModuleSettings($module);
}
......@@ -134,7 +146,9 @@ class CacheSettingDecorator extends BaseCacheDecorator implements SettingReposit
{
return $this->cache
->tags([$this->entityName, 'global'])
->remember("{$this->locale}.{$this->entityName}.plainModuleSettings.{$module}", $this->cacheTime,
->remember(
"{$this->locale}.{$this->entityName}.plainModuleSettings.{$module}",
$this->cacheTime,
function () use ($module) {
return $this->repository->plainModuleSettings($module);
}
......
......@@ -23,7 +23,9 @@ class CacheTagDecorator extends BaseCacheDecorator implements TagRepository
{
return $this->cache
->tags([$this->entityName, 'global'])
->remember("{$this->locale}.{$this->entityName}.allForNamespace.{$namespace}", $this->cacheTime,
->remember(
"{$this->locale}.{$this->entityName}.allForNamespace.{$namespace}",
$this->cacheTime,
function () use ($namespace) {
return $this->repository->allForNamespace($namespace);
}
......
......@@ -27,7 +27,8 @@ class CacheTranslationDecorator extends BaseCacheDecorator implements Translatio
$locale = $locale ?: app()->getLocale();
return app('cache')->driver('translations')
->rememberForever("{$this->entityName}.findByKeyAndLocale.{$cleanKey}.{$locale}",
->rememberForever(
"{$this->entityName}.findByKeyAndLocale.{$cleanKey}.{$locale}",
function () use ($key, $locale) {
return $this->repository->findByKeyAndLocale($key, $locale);
}
......@@ -37,7 +38,8 @@ class CacheTranslationDecorator extends BaseCacheDecorator implements Translatio
public function allFormatted()
{
return app('cache')->driver('translations')
->rememberForever("{$this->locale}.{$this->entityName}.allFormatted",
->rememberForever(
"{$this->locale}.{$this->entityName}.allFormatted",
function () {
return $this->repository->allFormatted();
}
......@@ -56,7 +58,8 @@ class CacheTranslationDecorator extends BaseCacheDecorator implements Translatio
$cleanKey = $this->cleanKey($key);
return app('cache')->driver('translations')
->rememberForever("{$this->locale}.{$this->entityName}.findTranslationByKey.{$cleanKey}",
->rememberForever(
"{$this->locale}.{$this->entityName}.findTranslationByKey.{$cleanKey}",
function () use ($key) {
return $this->repository->findTranslationByKey($key);
}
......@@ -102,7 +105,8 @@ class CacheTranslationDecorator extends BaseCacheDecorator implements Translatio
public function getTranslationsForGroupAndNamespace($locale, $group, $namespace)
{
return app('cache')->driver('translations')
->rememberForever("{$this->entityName}.findByKeyAndLocale.{$locale}.{$group}.[$namespace]",
->rememberForever(
"{$this->entityName}.findByKeyAndLocale.{$locale}.{$group}.[$namespace]",
function () use ($locale, $group, $namespace) {
return $this->repository->getTranslationsForGroupAndNamespace($locale, $group, $namespace);
}
......
......@@ -28,7 +28,9 @@ class CacheUserTokenDecorator extends BaseCacheDecorator implements UserTokenRep
{
return $this->cache
->tags([$this->entityName, 'global'])
->remember("{$this->locale}.{$this->entityName}.allForUser.{$userId}", $this->cacheTime,
->remember(
"{$this->locale}.{$this->entityName}.allForUser.{$userId}",
$this->cacheTime,
function () use ($userId) {
return $this->repository->allForUser($userId);
}
......
......@@ -81,8 +81,10 @@ class ModulesController extends AdminBaseController
{
$module->enable();
return redirect()->route('admin.workshop.modules.show', [$module->getLowerName()])->with('success',
trans('workshop::modules.module enabled'));
return redirect()->route('admin.workshop.modules.show', [$module->getLowerName()])->with(
'success',
trans('workshop::modules.module enabled')
);
}
/**
......
......@@ -10,7 +10,8 @@ $router->bind('theme', function ($theme) {
return app(\Modules\Workshop\Manager\ThemeManager::class)->find($theme);
});
$router->group(['prefix' => '/workshop'],
$router->group(
['prefix' => '/workshop'],
function (Router $router) {
$router->get('modules', [
'as' => 'admin.workshop.modules.index',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment