Skip to content

Commit

Permalink
Merge pull request #342 from acrobat/phpcs-fixes
Browse files Browse the repository at this point in the history
Minor phpcs fixes
  • Loading branch information
Florian Eckerstorfer committed Dec 22, 2014
2 parents 8a8c362 + 19f910f commit 13a2dd9
Show file tree
Hide file tree
Showing 10 changed files with 56 additions and 17 deletions.
11 changes: 11 additions & 0 deletions Command/InstallCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,16 @@
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Filesystem\Exception\IOException;

/**
* InstallCommand
*
* @package BraincraftedBootstrapBundle
* @subpackage Command
* @author Florian Eckerstorfer <florian@eckerstorfer.co>
* @copyright 2012-2013 Florian Eckerstorfer
* @license http://opensource.org/licenses/MIT The MIT License
* @link http://bootstrap.braincrafted.com BraincraftedBootst
*/
class InstallCommand extends ContainerAwareCommand
{
/**
Expand Down Expand Up @@ -57,6 +67,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
$fs->copy($file, $dest);
} catch (IOException $e) {
$output->writeln(sprintf('<error>Could not copy %s</error>', $file->getBaseName()));

return;
}
}
Expand Down
2 changes: 1 addition & 1 deletion Composer/ScriptHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class ScriptHandler
public static function install(CommandEvent $event)
{
$options = self::getOptions($event);
$consolePathOptionsKey = array_key_exists('symfony-bin-dir', $options) ? 'symfony-bin-dir' : 'symfony-app-dir';
$consolePathOptionsKey = array_key_exists('symfony-bin-dir', $options) ? 'symfony-bin-dir' : 'symfony-app-dir';
$consolePath = $options[$consolePathOptionsKey];

if (!is_dir($consolePath)) {
Expand Down
1 change: 1 addition & 0 deletions DependencyInjection/AsseticConfiguration.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ protected function buildCssWithSass(array $config)
protected function buildJs(array $config)
{
$path = !in_array($config['less_filter'], array('sass', 'scssphp')) ? "/js" : "/javascripts/bootstrap";

return array(
'inputs' => array(
$config['assets_dir'].$path.'/transition.js',
Expand Down
8 changes: 5 additions & 3 deletions Form/Extension/InputGroupButtonExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,21 +94,23 @@ public function buildForm(FormBuilderInterface $builder, array $options)
* Adds a button
*
* @param FormBuilderInterface $builder
* @param array $config
* @param array $config
*
* @return ButtonBuilder
*/
protected function addButton(FormBuilderInterface $builder, $config)
{
$options = (isset($config['options']))? $config['options'] : array();

return $builder->create($config['name'], $config['type'], $options);
}

/**
* Stores a button for later rendering
*
* @param ButtonBuilder $buttonBuilder
* @param ButtonBuilder $buttonBuilder
* @param FormBuilderInterface $form
* @param string $position
* @param string $position
*/
protected function storeButton(ButtonBuilder $buttonBuilder, FormBuilderInterface $form, $position)
{
Expand Down
10 changes: 6 additions & 4 deletions Form/Type/FormActionsType.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ public function buildForm(FormBuilderInterface $builder, array $options)
/**
* {@inheritdoc}
*
* @param FormView $view
* @param FormView $view
* @param FormInterface $form
* @param array $options
* @param array $options
*/
public function buildView(FormView $view, FormInterface $form, array $options)
{
Expand All @@ -51,8 +51,9 @@ public function buildView(FormView $view, FormInterface $form, array $options)
* Adds a button
*
* @param FormBuilderInterface $builder
* @param $name
* @param $config
* @param string $name
* @param array $config
*
* @throws \InvalidArgumentException
* @return ButtonBuilder
*/
Expand All @@ -66,6 +67,7 @@ protected function addButton($builder, $name, $config)
* Validates if child is a Button
*
* @param FormInterface $field
*
* @throws \InvalidArgumentException
*/
protected function validateButton(FormInterface $field)
Expand Down
13 changes: 10 additions & 3 deletions Form/Type/FormStaticControlType.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,31 @@
*/
class FormStaticControlType extends AbstractType
{

/**
* {@inheritdoc}
*/
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
$resolver->setDefaults(array(
#'mapped' => false,
//'mapped' => false,
'required' => false,
'disabled' => true,
));
}

/**
* {@inheritdoc}
*/
public function getParent()
{
return 'text';
}

/**
* {@inheritdoc}
*/
public function getName()
{
return 'bs_static';
}

}
2 changes: 1 addition & 1 deletion Session/FlashMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function error($message)
/**
* Sets a danger message.
*
* @param $message
* @param string $message
*/
public function danger($message)
{
Expand Down
8 changes: 7 additions & 1 deletion Twig/BootstrapFormExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public function setWidgetCol($widgetCol)
/**
* Returns the number of columns of widgets.
*
* @return integer Number of columns.
* @return integer Number of columns.Class
*/
public function getWidgetCol()
{
Expand Down Expand Up @@ -224,6 +224,12 @@ public function restoreFormSettings()
$this->simpleCol = $settings['simpleCol'];
}

/**
* @param string $label
* @param string $value
*
* @return string
*/
public function formControlStaticFunction($label, $value)
{
return sprintf(
Expand Down
17 changes: 13 additions & 4 deletions Twig/BootstrapIconExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,17 @@ class BootstrapIconExtension extends Twig_Extension
* @var string
*/
private $iconPrefix;

/**
* @var string
*/
private $iconTag;

public function __construct($iconPrefix, $iconTag='span')
/**
* @param string $iconPrefix
* @param string $iconTag
*/
public function __construct($iconPrefix, $iconTag = 'span')
{
$this->iconPrefix = $iconPrefix;
$this->iconTag = $iconTag;
Expand Down Expand Up @@ -65,13 +73,14 @@ public function getFunctions()
/**
* Parses the given string and replaces all occurrences of .icon-[name] with the corresponding icon.
*
* @param string $text The text to parse
* @param string $text The text to parse
*
* @return string The HTML code with the icons
*/
public function parseIconsFilter($text)
{
$that = $this;

return preg_replace_callback(
'/\.icon-([a-z0-9+-]+)/',
function ($matches) use ($that) {
Expand All @@ -84,14 +93,14 @@ function ($matches) use ($that) {
/**
* Returns the HTML code for the given icon.
*
* @param string $icon The name of the icon
* @param string $icon The name of the icon
*
* @return string The HTML code for the icon
*/
public function iconFunction($icon)
{
$icon = str_replace('+', ' '.$this->iconPrefix.'-', $icon);

return sprintf('<%1$s class="%2$s %2$s-%3$s"></%1$s>', $this->iconTag, $this->iconPrefix, $icon);
}

Expand Down
1 change: 1 addition & 0 deletions Util/PathUtil.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public function getRelativePath($from, $to)
}
}
}

return implode('/', $relPath);
}
}

0 comments on commit 13a2dd9

Please sign in to comment.