braincrafted /
bootstrap-bundle
This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | /** |
||
| 3 | * This file is part of BraincraftedBootstrapBundle. |
||
| 4 | * |
||
| 5 | * (c) 2012-2013 by Florian Eckerstorfer |
||
| 6 | */ |
||
| 7 | |||
| 8 | namespace Braincrafted\Bundle\BootstrapBundle\DependencyInjection; |
||
| 9 | |||
| 10 | /** |
||
| 11 | * AsseticConfiguration |
||
| 12 | * |
||
| 13 | * @package BraincraftedBootstrapBundle |
||
| 14 | * @subpackage DependencyInjection |
||
| 15 | * @author Florian Eckerstorfer <[email protected]> |
||
| 16 | * @copyright 2012-2013 Florian Eckerstorfer |
||
| 17 | * @license http://opensource.org/licenses/MIT The MIT License |
||
| 18 | * @link http://bootstrap.braincrafted.com Bootstrap for Symfony2 |
||
| 19 | */ |
||
| 20 | class AsseticConfiguration |
||
| 21 | { |
||
| 22 | /** |
||
| 23 | * Builds the assetic configuration. |
||
| 24 | * |
||
| 25 | * @param array $config |
||
| 26 | * |
||
| 27 | * @return array |
||
|
0 ignored issues
–
show
|
|||
| 28 | */ |
||
| 29 | public function build(array $config) |
||
| 30 | { |
||
| 31 | $output = array(); |
||
| 32 | |||
| 33 | // Fix path in output dir |
||
| 34 | if ('/' !== substr($config['output_dir'], -1) && strlen($config['output_dir']) > 0) { |
||
| 35 | $config['output_dir'] .= '/'; |
||
| 36 | } |
||
| 37 | |||
| 38 | // changed from css_preprocessor to css_preprocessor for 3.0 |
||
| 39 | if (in_array($config['css_preprocessor'], array('sass', 'scssphp'))) { |
||
| 40 | $output['bootstrap_css'] = $this->buildCssWithSass($config); |
||
| 41 | } elseif ('none' !== $config['css_preprocessor']) { |
||
| 42 | $output['bootstrap_css'] = $this->buildCssWithLess($config); |
||
| 43 | } else { |
||
| 44 | $output['bootstrap_css'] = $this->buildCssWithoutLess($config); |
||
| 45 | } |
||
| 46 | |||
| 47 | $output['bootstrap_js'] = $this->buildJs($config); |
||
| 48 | $output['jquery'] = $this->buildJquery($config); |
||
| 49 | |||
| 50 | return $output; |
||
| 51 | } |
||
| 52 | |||
| 53 | /** |
||
| 54 | * @param array $config |
||
| 55 | * |
||
| 56 | * @return array |
||
|
0 ignored issues
–
show
|
|||
| 57 | */ |
||
| 58 | protected function buildCssWithoutLess(array $config) |
||
| 59 | { |
||
| 60 | $inputs = array( |
||
| 61 | $config['assets_dir'].'/dist/css/bootstrap.css', |
||
| 62 | ); |
||
| 63 | if ('fa' === $config['icon_prefix']) { |
||
| 64 | $inputs[] = $config['fontawesome_dir'].'/css/font-awesome.css'; |
||
| 65 | } |
||
| 66 | |||
| 67 | return array( |
||
| 68 | 'inputs' => $inputs, |
||
| 69 | 'filters' => array('cssrewrite'), |
||
| 70 | 'output' => $config['output_dir'].'css/bootstrap.css' |
||
| 71 | ); |
||
| 72 | } |
||
| 73 | |||
| 74 | /** |
||
| 75 | * @param array $config |
||
| 76 | * |
||
| 77 | * @return array |
||
|
0 ignored issues
–
show
|
|||
| 78 | */ |
||
| 79 | protected function buildCssWithLess(array $config) |
||
| 80 | { |
||
| 81 | $bootstrapFile = $config['assets_dir'].'/less/bootstrap.less'; |
||
| 82 | if (true === isset($config['customize']['variables_file']) && |
||
| 83 | null !== $config['customize']['variables_file']) { |
||
| 84 | $bootstrapFile = $config['customize']['bootstrap_output']; |
||
| 85 | } |
||
| 86 | |||
| 87 | $inputs = array( |
||
| 88 | $bootstrapFile, |
||
| 89 | __DIR__.'/../Resources/less/form.less' |
||
| 90 | ); |
||
| 91 | if ('fa' === $config['icon_prefix']) { |
||
| 92 | $inputs[] = $config['fontawesome_dir'].'/less/font-awesome.less'; |
||
| 93 | } |
||
| 94 | |||
| 95 | return array( |
||
| 96 | 'inputs' => $inputs, |
||
| 97 | 'filters' => array($config['css_preprocessor']), |
||
| 98 | 'output' => $config['output_dir'].'css/bootstrap.css' |
||
| 99 | ); |
||
| 100 | } |
||
| 101 | |||
| 102 | /** |
||
| 103 | * @param array $config |
||
| 104 | * |
||
| 105 | * @return array |
||
|
0 ignored issues
–
show
|
|||
| 106 | */ |
||
| 107 | protected function buildCssWithSass(array $config) |
||
| 108 | { |
||
| 109 | $bootstrapFile = $config['assets_dir'].'/stylesheets/_bootstrap.scss'; |
||
| 110 | if (true === isset($config['customize']['variables_file']) && |
||
| 111 | null !== $config['customize']['variables_file']) { |
||
| 112 | $bootstrapFile = $config['customize']['bootstrap_output']; |
||
| 113 | } |
||
| 114 | |||
| 115 | $inputs = array( |
||
| 116 | $bootstrapFile, |
||
| 117 | __DIR__.'/../Resources/sass/form.scss' |
||
| 118 | ); |
||
| 119 | if ('fa' === $config['icon_prefix']) { |
||
| 120 | $inputs[] = $config['fontawesome_dir'].'/scss/font-awesome.scss'; |
||
| 121 | } |
||
| 122 | |||
| 123 | return array( |
||
| 124 | 'inputs' => $inputs, |
||
| 125 | 'filters' => array($config['css_preprocessor']), |
||
| 126 | 'output' => $config['output_dir'].'css/bootstrap.css' |
||
| 127 | ); |
||
| 128 | } |
||
| 129 | |||
| 130 | /** |
||
| 131 | * @param array $config |
||
| 132 | * |
||
| 133 | * @return array |
||
|
0 ignored issues
–
show
|
|||
| 134 | */ |
||
| 135 | protected function buildJs(array $config) |
||
| 136 | { |
||
| 137 | $path = !in_array($config['css_preprocessor'], array('sass', 'scssphp')) ? "/js" : "/javascripts/bootstrap"; |
||
| 138 | |||
| 139 | return array( |
||
| 140 | 'inputs' => array( |
||
| 141 | $config['assets_dir'].$path.'/transition.js', |
||
| 142 | $config['assets_dir'].$path.'/alert.js', |
||
| 143 | $config['assets_dir'].$path.'/button.js', |
||
| 144 | $config['assets_dir'].$path.'/carousel.js', |
||
| 145 | $config['assets_dir'].$path.'/collapse.js', |
||
| 146 | $config['assets_dir'].$path.'/dropdown.js', |
||
| 147 | $config['assets_dir'].$path.'/modal.js', |
||
| 148 | $config['assets_dir'].$path.'/tooltip.js', |
||
| 149 | $config['assets_dir'].$path.'/popover.js', |
||
| 150 | $config['assets_dir'].$path.'/scrollspy.js', |
||
| 151 | $config['assets_dir'].$path.'/tab.js', |
||
| 152 | $config['assets_dir'].$path.'/affix.js', |
||
| 153 | __DIR__.'/../Resources/js/bc-bootstrap-collection.js' |
||
| 154 | ), |
||
| 155 | 'output' => $config['output_dir'].'js/bootstrap.js' |
||
| 156 | ); |
||
| 157 | } |
||
| 158 | |||
| 159 | /** |
||
| 160 | * @param array $config |
||
| 161 | * |
||
| 162 | * @return array |
||
|
0 ignored issues
–
show
|
|||
| 163 | */ |
||
| 164 | protected function buildJquery(array $config) |
||
| 165 | { |
||
| 166 | return array( |
||
| 167 | 'inputs' => array($config['jquery_path']), |
||
| 168 | 'output' => $config['output_dir'].'js/jquery.js' |
||
| 169 | ); |
||
| 170 | } |
||
| 171 | } |
||
| 172 |
This check looks for the generic type
arrayas a return type and suggests a more specific type. This type is inferred from the actual code.