Skip to content

Commit

Permalink
CS Applied
Browse files Browse the repository at this point in the history
  • Loading branch information
helios-ag committed Nov 20, 2023
1 parent d291604 commit d4fd199
Show file tree
Hide file tree
Showing 18 changed files with 289 additions and 283 deletions.
18 changes: 0 additions & 18 deletions .php_cs

This file was deleted.

2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"matthiasnoback/symfony-dependency-injection-test": "^4.1",
"symfony/finder": "^4.4 || ^5.0 || ^5.2 || ^6.0",
"php-coveralls/php-coveralls": "^2.0",
"friendsofphp/php-cs-fixer": "dev-master"
"friendsofphp/php-cs-fixer": "dev-master"
},
"suggest": {
"helios-ag/fm-tinymce-bundle": "FMTinyMCEBundle WYSIWYG Editor Bundle",
Expand Down
24 changes: 13 additions & 11 deletions src/Bridge/ElFinderBridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

namespace FM\ElfinderBundle\Bridge;

use Symfony\Component\HttpFoundation\Session\SessionInterface;
use FM\ElfinderBundle\ElFinder\ElFinder;
use elFinderVolumeDriver;
use FM\ElfinderBundle\ElFinder\ElFinder;
use Symfony\Component\HttpFoundation\Session\SessionInterface;

class ElFinderBridge extends ElFinder
{
Expand All @@ -19,21 +19,30 @@ public function __construct($opts)
parent::__construct($opts);
}

/** @param $session */
public function setSession($session)
{
$this->session = $session;
}

/**
* @return array
*/
public function getVolumes()
{
return $this->volumes;
}

/**
* @param array $opts
*/
protected function mountVolumes($opts)
{
foreach ($opts['roots'] as $i => $o) {
$volume = null;

if (isset($o['service'])) {
$driver = $o['service'];

if (is_object($driver) && $driver instanceof elFinderVolumeDriver) {
$volume = $driver;
unset($opts['roots'][$i]);
Expand All @@ -45,19 +54,12 @@ protected function mountVolumes($opts)
$id = $volume->id();

$this->volumes[$id] = $volume;

if (!$this->default && $volume->isReadable()) {
$this->default = $this->volumes[$id];
}
}
}
parent::mountVolumes($opts);
}

/**
* @return array
*/
public function getVolumes()
{
return $this->volumes;
}
}
29 changes: 15 additions & 14 deletions src/Command/ElFinderInstallerCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace FM\ElfinderBundle\Command;

use ReflectionClass;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
Expand All @@ -12,13 +13,13 @@

final class ElFinderInstallerCommand extends Command
{
private const ELFINDER_CSS_DIR = 'vendor/studio-42/elfinder/css';
private const ELFINDER_CSS_DIR = 'vendor/studio-42/elfinder/css';

private const ELFINDER_JS_DIR = 'vendor/studio-42/elfinder/js';
private const ELFINDER_JS_DIR = 'vendor/studio-42/elfinder/js';

private const ELFINDER_SOUNDS_DIR = 'vendor/studio-42/elfinder/sounds';

private const ELFINDER_IMG_DIR = 'vendor/studio-42/elfinder/img';
private const ELFINDER_IMG_DIR = 'vendor/studio-42/elfinder/img';

protected $fileSystem;

Expand All @@ -38,13 +39,13 @@ protected function configure(): void
->setDescription('Copies elfinder assets to public directory')
->addOption('docroot', null, InputOption::VALUE_OPTIONAL, 'Website document root.', 'public')
->setHelp(<<<'EOF'
Default docroot:
<info>public</info>
Default docroot:
<info>public</info>
You can pass docroot:
<info>Where to install elfinder</info>
<info>php %command.full_name% --docroot=public_html</info>
EOF
You can pass docroot:
<info>Where to install elfinder</info>
<info>php %command.full_name% --docroot=public_html</info>
EOF
);
}

Expand All @@ -59,15 +60,15 @@ protected function execute(InputInterface $input, OutputInterface $output): int

$publicDir = sprintf('%s/%s/bundles/fmelfinder', $rootDir, $dr);

$reflection = new \ReflectionClass(\Composer\Autoload\ClassLoader::class);
$reflection = new ReflectionClass(\Composer\Autoload\ClassLoader::class);
$vendorRootDir = dirname($reflection->getFileName(), 3);

$io->note(sprintf('Starting to install elfinder to %s folder', $publicDir));

$this->fileSystem->mirror($vendorRootDir.'/'.self::ELFINDER_CSS_DIR, $publicDir.'/css');
$this->fileSystem->mirror($vendorRootDir.'/'.self::ELFINDER_IMG_DIR, $publicDir.'/img');
$this->fileSystem->mirror($vendorRootDir.'/'.self::ELFINDER_JS_DIR, $publicDir.'/js');
$this->fileSystem->mirror($vendorRootDir.'/'.self::ELFINDER_SOUNDS_DIR, $publicDir.'/sounds');
$this->fileSystem->mirror($vendorRootDir . '/' . self::ELFINDER_CSS_DIR, $publicDir . '/css');
$this->fileSystem->mirror($vendorRootDir . '/' . self::ELFINDER_IMG_DIR, $publicDir . '/img');
$this->fileSystem->mirror($vendorRootDir . '/' . self::ELFINDER_JS_DIR, $publicDir . '/js');
$this->fileSystem->mirror($vendorRootDir . '/' . self::ELFINDER_SOUNDS_DIR, $publicDir . '/sounds');

$io->success('elFinder assets successfully installed');

Expand Down
Loading

0 comments on commit d4fd199

Please sign in to comment.