Skip to content

Commit

Permalink
Applied fixes from StyleCI
Browse files Browse the repository at this point in the history
  • Loading branch information
helios-ag authored and StyleCIBot committed Sep 25, 2015
1 parent ae8179a commit a46ba41
Show file tree
Hide file tree
Showing 28 changed files with 160 additions and 193 deletions.
47 changes: 24 additions & 23 deletions Command/DumpEmoticonsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;

/**
*
* @author Al Ganiev <[email protected]>
* @copyright 2013 Al Ganiev
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
* @author Al Ganiev <[email protected]>
* @copyright 2013 Al Ganiev
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
class DumpEmoticonsCommand extends ContainerAwareCommand
{
/**
* @see Command
*/
* @see Command
*/
protected function configure()
{
$this
Expand All @@ -27,29 +27,31 @@ protected function configure()
}

/**
* Copies one folder to another
* Copies one folder to another.
*
* @param $src
* @param $dst
*/
private function recurseCopy($src,$dst)
private function recurseCopy($src, $dst)
{
$dir = opendir($src);
@mkdir($dst);
while (false !== ( $file = readdir($dir)) ) {
if (( $file != '.' ) && ( $file != '..' )) {
if ( is_dir($src . '/' . $file) ) {
$this->recurseCopy($src . '/' . $file,$dst . '/' . $file);
} else {
copy($src . '/' . $file,$dst . '/' . $file);
}
$dir = opendir($src);
@mkdir($dst);
while (false !== ($file = readdir($dir))) {
if (($file != '.') && ($file != '..')) {
if (is_dir($src.'/'.$file)) {
$this->recurseCopy($src.'/'.$file, $dst.'/'.$file);
} else {
copy($src.'/'.$file, $dst.'/'.$file);
}
}
closedir($dir);
}
closedir($dir);
}

/**
* @param \Symfony\Component\Console\Input\InputInterface $input
* @param \Symfony\Component\Console\Output\OutputInterface $output
* @param \Symfony\Component\Console\Input\InputInterface $input
* @param \Symfony\Component\Console\Output\OutputInterface $output
*
* @return int|null|void
*/
protected function execute(InputInterface $input, OutputInterface $output)
Expand All @@ -69,9 +71,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
return $output->writeln('<error>Emoticons folder does not exist</error>');
}

$this->recurseCopy($emoticonsFolder,$webFolder);
$this->recurseCopy($emoticonsFolder, $webFolder);

$output->writeln('<comment>Emoticons dumped succesfully</comment>');
}

}
3 changes: 0 additions & 3 deletions Composer/ScriptHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace FM\BbcodeBundle\Composer;

use Sensio\Bundle\DistributionBundle\Composer\ScriptHandler as BaseHandler;

use Composer\Script\CommandEvent;

/**
Expand All @@ -21,6 +20,4 @@ public static function installEmoticons(CommandEvent $event)
$event->getIO()->write('<info>Dumping emoticons...</info>');
static::executeCommand($event, $consoleDir, 'bbcode:dump');
}

}

40 changes: 25 additions & 15 deletions Decoda/Decoda.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@
use Decoda\Hook;
use Decoda\Filter;
use Decoda\Decoda as BaseDecoda;
use \OutOfRangeException;
use OutOfRangeException;

/**
* Class Decoda
* @package FM\BbcodeBundle\Decoda
* Class Decoda.
*/
class Decoda extends BaseDecoda
{
Expand All @@ -24,7 +23,7 @@ class Decoda extends BaseDecoda
* Store the text and single instance configuration.
*
* @param string $string
* @param array $config
* @param array $config
*/
public function __construct($string = '', array $config = array())
{
Expand All @@ -37,14 +36,16 @@ public function __construct($string = '', array $config = array())
* Set the locale.
*
* @param string $locale
*
* @return Decoda
*
* @throws DomainException
*/
public function setLocale($locale)
{
if (false !== strpos($locale, '-')) {
$locales = explode('-', $locale);
$locale = $locales[0];
$locale = $locales[0];
}

return parent::setLocale($locale);
Expand All @@ -63,7 +64,7 @@ public function setDefaultLocale($locale)
{
if (false !== strpos($locale, '-')) {
$locales = explode('-', $locale);
$locale = $locales[0];
$locale = $locales[0];
}

$this->defaultLocale = $locale;
Expand Down Expand Up @@ -105,7 +106,7 @@ public function message($key, array $vars = array())
}

/**
* Set messages
* Set messages.
*
* @param array $messages
*/
Expand All @@ -119,14 +120,16 @@ public function setMessages(array $messages = array())
* Add a loader that will generate localization messages.
*
* @param \Decoda\Loader $loader
*
* @return \Decoda\Decoda
*/
public function addMessages(Loader $loader) {
public function addMessages(Loader $loader)
{
$loader->setParser($this);

if ($messages = $loader->load()) {
foreach ($messages as $locale => $strings) {
foreach ($strings as $id => $message){
foreach ($strings as $id => $message) {
$this->setMessage($locale, $id, $message);
}
}
Expand All @@ -138,9 +141,9 @@ public function addMessages(Loader $loader) {
/**
* Sets a message translation.
*
* @param string $locale The locale
* @param string $id The message id
* @param string $translation The messages translation
* @param string $locale The locale
* @param string $id The message id
* @param string $translation The messages translation
*/
public function setMessage($locale, $id, $translation)
{
Expand Down Expand Up @@ -182,7 +185,8 @@ public function addFilter(Filter $filter, $id = null)
* @see \Decoda\Decoda::hasFilter()
*
* @param string $id
* @return boolean
*
* @return bool
*/
public function hasFilter($id)
{
Expand All @@ -195,7 +199,9 @@ public function hasFilter($id)
* @see \Decoda\Decoda::getFilter()
*
* @param string $id
*
* @throws InvalidArgumentException
*
* @return \Decoda\Filter[]
*/
public function getFilter($id)
Expand All @@ -207,6 +213,7 @@ public function getFilter($id)
* Remove filter(s).
*
* @param string|array $filters
*
* @return \Decoda\Decoda
*/
public function removeFilter($ids)
Expand Down Expand Up @@ -235,14 +242,14 @@ public function addHook(Hook $hook, $id = null)
return parent::addHook($hook, strtolower($id));
}


/**
* Check if a hook exists.
*
* @see \Decoda\Decoda::hasHook()
*
* @param string $id
* @return boolean
*
* @return bool
*/
public function hasHook($id)
{
Expand All @@ -255,7 +262,9 @@ public function hasHook($id)
* @see \Decoda\Decoda::getHook()
*
* @param string $id
*
* @throws InvalidArgumentException
*
* @return \Decoda\Hook[]
*/
public function getHook($id)
Expand All @@ -267,6 +276,7 @@ public function getHook($id)
* Remove hook(s).
*
* @param string|array $hooks
*
* @return \Decoda\Decoda
*/
public function removeHook($ids)
Expand Down
Loading

0 comments on commit a46ba41

Please sign in to comment.