1
0
mirror of https://github.com/flarum/core.git synced 2025-10-10 22:44:25 +02:00

Applied fixes from StyleCI

This commit is contained in:
Toby Zerner
2016-02-25 22:09:39 -05:00
committed by StyleCI Bot
parent 83c22d73a4
commit a6cf10f854
96 changed files with 240 additions and 245 deletions

View File

@@ -86,7 +86,7 @@ class Extension implements Arrayable
*/
public function __construct($path, $composerJson)
{
$this->path = $path;
$this->path = $path;
$this->composerJson = $composerJson;
$this->assignId();
}
@@ -116,7 +116,6 @@ class Extension implements Arrayable
return isset($this->{$name}) || $this->composerJsonAttribute(Str::snake($name, '-'));
}
/**
* Dot notation getter for composer.json attributes.
*
@@ -131,7 +130,7 @@ class Extension implements Arrayable
}
/**
* @param boolean $installed
* @param bool $installed
* @return Extension
*/
public function setInstalled($installed)
@@ -142,7 +141,7 @@ class Extension implements Arrayable
}
/**
* @return boolean
* @return bool
*/
public function isInstalled()
{
@@ -177,15 +176,15 @@ class Extension implements Arrayable
{
if (($icon = $this->composerJsonAttribute('extra.flarum-extension.icon'))) {
if ($file = Arr::get($icon, 'image')) {
$file = $this->path . '/' . $file;
$file = $this->path.'/'.$file;
if (file_exists($file)) {
$mimetype = pathinfo($file, PATHINFO_EXTENSION) === 'svg'
? 'image/svg+xml'
: finfo_file(finfo_open(FILEINFO_MIME_TYPE), $file);
$data = file_get_contents($file);
$data = file_get_contents($file);
$icon['backgroundImage'] = 'url(\'data:' . $mimetype . ';base64,' . base64_encode($data) . '\')';
$icon['backgroundImage'] = 'url(\'data:'.$mimetype.';base64,'.base64_encode($data).'\')';
}
}
@@ -194,7 +193,7 @@ class Extension implements Arrayable
}
/**
* @param boolean $enabled
* @param bool $enabled
* @return Extension
*/
public function setEnabled($enabled)
@@ -205,7 +204,7 @@ class Extension implements Arrayable
}
/**
* @return boolean
* @return bool
*/
public function isEnabled()
{
@@ -237,7 +236,7 @@ class Extension implements Arrayable
*/
public function hasAssets()
{
return realpath($this->path . '/assets/') !== false;
return realpath($this->path.'/assets/') !== false;
}
/**
@@ -247,7 +246,7 @@ class Extension implements Arrayable
*/
public function hasMigrations()
{
return realpath($this->path . '/migrations/') !== false;
return realpath($this->path.'/migrations/') !== false;
}
/**

View File

@@ -10,7 +10,6 @@
namespace Flarum\Extension;
use Flarum\Core;
use Flarum\Database\Migrator;
use Flarum\Event\ExtensionWasDisabled;
use Flarum\Event\ExtensionWasEnabled;
@@ -19,7 +18,6 @@ use Flarum\Foundation\Application;
use Flarum\Settings\SettingsRepositoryInterface;
use Illuminate\Contracts\Events\Dispatcher;
use Illuminate\Filesystem\Filesystem;
use Illuminate\Support\Arr;
use Illuminate\Support\Collection;
class ExtensionManager
@@ -47,9 +45,9 @@ class ExtensionManager
Dispatcher $dispatcher,
Filesystem $filesystem
) {
$this->config = $config;
$this->app = $app;
$this->migrator = $migrator;
$this->config = $config;
$this->app = $app;
$this->migrator = $migrator;
$this->dispatcher = $dispatcher;
$this->filesystem = $filesystem;
}
@@ -61,15 +59,15 @@ class ExtensionManager
{
$extensionsDir = $this->getExtensionsDir();
$dirs = array_diff(scandir($extensionsDir), ['.', '..']);
$dirs = array_diff(scandir($extensionsDir), ['.', '..']);
$extensions = new Collection();
$installed = json_decode(file_get_contents(public_path('vendor/composer/installed.json')), true);
foreach ($dirs as $dir) {
if (file_exists($manifest = $extensionsDir . '/' . $dir . '/composer.json')) {
if (file_exists($manifest = $extensionsDir.'/'.$dir.'/composer.json')) {
$extension = new Extension(
$extensionsDir . '/' . $dir,
$extensionsDir.'/'.$dir,
json_decode(file_get_contents($manifest), true)
);
@@ -112,7 +110,7 @@ class ExtensionManager
*/
public function enable($name)
{
if (!$this->isEnabled($name)) {
if (! $this->isEnabled($name)) {
$extension = $this->getExtension($name);
$enabled = $this->getEnabled();
@@ -182,8 +180,8 @@ class ExtensionManager
{
if ($extension->hasAssets()) {
$this->filesystem->copyDirectory(
$extension->getPath() . '/assets',
$this->app->basePath() . '/assets/extensions/' . $extension->getId()
$extension->getPath().'/assets',
$this->app->basePath().'/assets/extensions/'.$extension->getId()
);
}
}
@@ -195,7 +193,7 @@ class ExtensionManager
*/
protected function unpublishAssets(Extension $extension)
{
$this->filesystem->deleteDirectory($this->app->basePath() . '/assets/extensions/' . $extension);
$this->filesystem->deleteDirectory($this->app->basePath().'/assets/extensions/'.$extension);
}
/**
@@ -207,7 +205,7 @@ class ExtensionManager
*/
public function getAsset(Extension $extension, $path)
{
return $this->app->basePath() . '/assets/extensions/' . $extension->getId() . $path;
return $this->app->basePath().'/assets/extensions/'.$extension->getId().$path;
}
/**
@@ -219,7 +217,7 @@ class ExtensionManager
public function migrate(Extension $extension, $up = true)
{
if ($extension->hasMigrations()) {
$migrationDir = $extension->getPath() . '/migrations';
$migrationDir = $extension->getPath().'/migrations';
$this->app->bind('Illuminate\Database\Schema\Builder', function ($container) {
return $container->make('Illuminate\Database\ConnectionInterface')->getSchemaBuilder();