Skip to content

Commit 491a2ab

Browse files
cedriclombardotOlivier Guyollot
authored and
Olivier Guyollot
committed
Run a php-cs-fixer see http://cs.sensiolabs.org
1 parent 6212beb commit 491a2ab

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+306
-389
lines changed

config/app.yml

+19-19
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
all:
2-
sf_twitter_bootstrap:
3-
web_dir: /sfTwitterBootstrapPlugin
4-
image_dir: /sfTwitterBootstrapPlugin/images/
5-
default_image: config.png
6-
dashboard_url: @homepage
7-
resize_mode: thumbnail
8-
site: My Site Name
9-
include_path: true
10-
include_assets: true
11-
include_jquery: true
12-
include_jquery_no_conflict: false
13-
login_route: @sf_guard_signin
14-
logout: true
15-
logout_route: @sf_guard_signout
16-
top_link_to_fieldset: true
17-
display_top_pagination: true
18-
use_icons_in_button: true
19-
breadcrumb_root_name: Home
1+
all:
2+
sf_twitter_bootstrap:
3+
web_dir: /sfTwitterBootstrapPlugin
4+
image_dir: /sfTwitterBootstrapPlugin/images/
5+
default_image: config.png
6+
dashboard_url: @homepage
7+
resize_mode: thumbnail
8+
site: My Site Name
9+
include_path: true
10+
include_assets: true
11+
include_jquery: true
12+
include_jquery_no_conflict: false
13+
login_route: @sf_guard_signin
14+
logout: true
15+
logout_route: @sf_guard_signout
16+
top_link_to_fieldset: true
17+
display_top_pagination: true
18+
use_icons_in_button: true
19+
breadcrumb_root_name: Home

config/view.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
default:
22
components:
3-
sf_twitter_bootstrap_permanent_slot: false
3+
sf_twitter_bootstrap_permanent_slot: false

data/generator/sfDoctrineModule/twitter/parts/batchAction.php

+7-15
Original file line numberDiff line numberDiff line change
@@ -2,41 +2,34 @@ public function executeBatch(sfWebRequest $request)
22
{
33
$request->checkCSRFProtection();
44

5-
if (!$ids = $request->getParameter('ids'))
6-
{
5+
if (!$ids = $request->getParameter('ids')) {
76
$this->getUser()->setFlash('error', 'You must at least select one item.');
87

98
$this->redirect('@<?php echo $this->getUrlForAction('list') ?>');
109
}
1110

12-
if (!$action = $request->getParameter('batch_action'))
13-
{
11+
if (!$action = $request->getParameter('batch_action')) {
1412
$this->getUser()->setFlash('error', 'You must select an action to execute on the selected items.');
1513

1614
$this->redirect('@<?php echo $this->getUrlForAction('list') ?>');
1715
}
1816

19-
if (!method_exists($this, $method = 'execute'.ucfirst($action)))
20-
{
17+
if (!method_exists($this, $method = 'execute'.ucfirst($action))) {
2118
throw new InvalidArgumentException(sprintf('You must create a "%s" method for action "%s"', $method, $action));
2219
}
2320

24-
if (!$this->getUser()->hasCredential($this->configuration->getCredentials($action)))
25-
{
21+
if (!$this->getUser()->hasCredential($this->configuration->getCredentials($action))) {
2622
$this->forward(sfConfig::get('sf_secure_module'), sfConfig::get('sf_secure_action'));
2723
}
2824

2925
$validator = new sfValidatorDoctrineChoice(array('multiple' => true, 'model' => '<?php echo $this->getModelClass() ?>'));
30-
try
31-
{
26+
try {
3227
// validate ids
3328
$ids = $validator->clean($ids);
3429

3530
// execute batch
3631
$this->$method($request);
37-
}
38-
catch (sfValidatorError $e)
39-
{
32+
} catch (sfValidatorError $e) {
4033
$this->getUser()->setFlash('error', 'A problem occurs when deleting the selected items as some items do not exist anymore.');
4134
}
4235

@@ -52,8 +45,7 @@ protected function executeBatchDelete(sfWebRequest $request)
5245
->whereIn('<?php echo $this->getPrimaryKeys(true) ?>', $ids)
5346
->execute();
5447

55-
foreach ($records as $record)
56-
{
48+
foreach ($records as $record) {
5749
$this->dispatcher->notify(new sfEvent($this, 'admin.delete_object', array('object' => $record)));
5850

5951
$record->delete();

data/generator/sfDoctrineModule/twitter/parts/deleteAction.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ public function executeDelete(sfWebRequest $request)
44

55
$this->dispatcher->notify(new sfEvent($this, 'admin.delete_object', array('object' => $this->getRoute()->getObject())));
66

7-
if ($this->getRoute()->getObject()->delete())
8-
{
7+
if ($this->getRoute()->getObject()->delete()) {
98
$this->getUser()->setFlash('notice', 'The item was deleted successfully.');
109
}
1110

data/generator/sfDoctrineModule/twitter/parts/fieldsConfiguration.php

+6
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,13 @@ public function getNewDisplay()
6161
public function getListDisplay()
6262
{
6363
<?php if (isset($this->config['list']['display'])): ?>
64+
6465
return <?php echo $this->asPhp($this->config['list']['display']) ?>;
6566
<?php elseif (isset($this->config['list']['hide'])): ?>
67+
6668
return <?php echo $this->asPhp(array_diff($this->getAllFieldNames(false), $this->config['list']['hide'])) ?>;
6769
<?php else: ?>
70+
6871
return <?php echo $this->asPhp($this->getAllFieldNames(false)) ?>;
6972
<?php endif; ?>
7073
<?php unset($this->config['list']['display'], $this->config['list']['hide']) ?>
@@ -73,10 +76,13 @@ public function getListDisplay()
7376
public function getShowDisplay()
7477
{
7578
<?php if (isset($this->config['show']['display'])): ?>
79+
7680
return <?php echo $this->asPhp($this->config['show']['display']) ?>;
7781
<?php elseif (isset($this->config['show']['hide'])): ?>
82+
7883
return <?php echo $this->asPhp(array_diff($this->getAllFieldNames(false), $this->config['show']['hide'])) ?>;
7984
<?php else: ?>
85+
8086
return <?php echo $this->asPhp($this->getAllFieldNames(false)) ?>;
8187
<?php endif; ?>
8288
<?php unset($this->config['show']['display'], $this->config['show']['hide']) ?>

data/generator/sfDoctrineModule/twitter/parts/filterAction.php

+2-4
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ public function executeFilter(sfWebRequest $request)
22
{
33
$this->setPage(1);
44

5-
if ($request->hasParameter('_reset'))
6-
{
5+
if ($request->hasParameter('_reset')) {
76
$this->setFilters($this->configuration->getFilterDefaults());
87

98
$this->redirect('@<?php echo $this->getUrlForAction('list') ?>');
@@ -12,8 +11,7 @@ public function executeFilter(sfWebRequest $request)
1211
$this->filters = $this->configuration->getFilterForm($this->getFilters());
1312

1413
$this->filters->bind($request->getParameter($this->filters->getName()));
15-
if ($this->filters->isValid())
16-
{
14+
if ($this->filters->isValid()) {
1715
$this->setFilters($this->filters->getValues());
1816

1917
$this->redirect('@<?php echo $this->getUrlForAction('list') ?>');

data/generator/sfDoctrineModule/twitter/parts/indexAction.php

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
public function executeIndex(sfWebRequest $request)
22
{
33
// sorting
4-
if ($request->getParameter('sort') && $this->isValidSortColumn($request->getParameter('sort')))
5-
{
4+
if ($request->getParameter('sort') && $this->isValidSortColumn($request->getParameter('sort'))) {
65
$this->setSort(array($request->getParameter('sort'), $request->getParameter('sort_type')));
76
}
87

98
// pager
10-
if ($request->getParameter('page'))
11-
{
9+
if ($request->getParameter('page')) {
1210
$this->setPage($request->getParameter('page'));
1311
}
1412

data/generator/sfDoctrineModule/twitter/parts/paginationAction.php

+2-4
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ protected function buildQuery()
2222
{
2323
$tableMethod = $this->configuration->getTableMethod();
2424
<?php if ($this->configuration->hasFilterForm()): ?>
25-
if (null === $this->filters)
26-
{
25+
if (null === $this->filters) {
2726
$this->filters = $this->configuration->getFilterForm($this->getFilters());
2827
}
2928

@@ -34,8 +33,7 @@ protected function buildQuery()
3433
$query = Doctrine_Core::getTable('<?php echo $this->getModelClass() ?>')
3534
->createQuery('a');
3635

37-
if ($tableMethod)
38-
{
36+
if ($tableMethod) {
3937
$query = Doctrine_Core::getTable('<?php echo $this->getModelClass() ?>')->$tableMethod($query);
4038
}
4139
<?php endif; ?>
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
protected function processForm(sfWebRequest $request, sfForm $form)
22
{
33
$form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
4-
if ($form->isValid())
5-
{
4+
if ($form->isValid()) {
65
$notice = $form->getObject()->isNew() ? 'The item was created successfully.' : 'The item was updated successfully.';
76

87
try {
@@ -18,26 +17,22 @@ protected function processForm(sfWebRequest $request, sfForm $form)
1817
$message = trim($message, ', ');
1918

2019
$this->getUser()->setFlash('error', $message);
20+
2121
return sfView::SUCCESS;
2222
}
2323

2424
$this->dispatcher->notify(new sfEvent($this, 'admin.save_object', array('object' => $<?php echo $this->getSingularName() ?>)));
2525

26-
if ($request->hasParameter('_save_and_add'))
27-
{
26+
if ($request->hasParameter('_save_and_add')) {
2827
$this->getUser()->setFlash('notice', $notice.' You can add another one below.');
2928

3029
$this->redirect('@<?php echo $this->getUrlForAction('new') ?>');
31-
}
32-
else
33-
{
30+
} else {
3431
$this->getUser()->setFlash('notice', $notice);
3532

3633
$this->redirect(array('sf_route' => '<?php echo $this->getUrlForAction('edit') ?>', 'sf_subject' => $<?php echo $this->getSingularName() ?>));
3734
}
38-
}
39-
else
40-
{
35+
} else {
4136
$this->getUser()->setFlash('error', 'The item has not been saved due to some errors.', false);
4237
}
4338
}

data/generator/sfDoctrineModule/twitter/parts/showConfiguration.php

+3-4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ protected function getConfig()
22
{
33
$configuration = parent::getConfig();
44
$configuration['show'] = $this->getFieldsShow();
5+
56
return $configuration;
67
}
78

@@ -17,8 +18,7 @@ protected function compile()
1718
'actions' => $this->getShowActions(),
1819
) ;
1920

20-
foreach ($this->getShowDisplay() as $name)
21-
{
21+
foreach ($this->getShowDisplay() as $name) {
2222
list($field, $flag) = sfModelGeneratorConfigurationField::splitFieldWithFlag($name);
2323
$field = new sfModelGeneratorConfigurationField($field, array_merge(
2424
array('type' => 'Text', 'label' => sfInflector::humanize(sfInflector::underscore($field))),
@@ -32,8 +32,7 @@ protected function compile()
3232
$this->configuration['show']['display'][$name] = $field;
3333
}
3434

35-
foreach ($this->configuration['show']['actions'] as $action => $parameters)
36-
{
35+
foreach ($this->configuration['show']['actions'] as $action => $parameters) {
3736
$this->configuration['show']['actions'][$action] = $this->fixActionParameters($action, $parameters);
3837
}
3938

data/generator/sfDoctrineModule/twitter/parts/sortingAction.php

+4-8
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
protected function addSortQuery($query)
22
{
3-
if (array(null, null) == ($sort = $this->getSort()))
4-
{
3+
if (array(null, null) == ($sort = $this->getSort())) {
54
return;
65
}
76

8-
if (!in_array(strtolower($sort[1]), array('asc', 'desc')))
9-
{
7+
if (!in_array(strtolower($sort[1]), array('asc', 'desc'))) {
108
$sort[1] = 'asc';
119
}
1210

@@ -15,8 +13,7 @@ protected function addSortQuery($query)
1513

1614
protected function getSort()
1715
{
18-
if (null !== $sort = $this->getUser()->getAttribute('<?php echo $this->getModuleName() ?>.sort', null, 'admin_module'))
19-
{
16+
if (null !== $sort = $this->getUser()->getAttribute('<?php echo $this->getModuleName() ?>.sort', null, 'admin_module')) {
2017
return $sort;
2118
}
2219

@@ -27,8 +24,7 @@ protected function getSort()
2724

2825
protected function setSort(array $sort)
2926
{
30-
if (null !== $sort[0] && null === $sort[1])
31-
{
27+
if (null !== $sort[0] && null === $sort[1]) {
3228
$sort[1] = 'asc';
3329
}
3430

data/generator/sfDoctrineModule/twitter/parts/sortingConfiguration.php

+2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@ public function getDefaultSort()
22
{
33
<?php if ($sort = (isset($this->config['list']['sort']) ? $this->config['list']['sort'] : false)): ?>
44
<?php if (!is_array($sort)) $sort = array($sort, 'asc'); ?>
5+
56
return array('<?php echo $sort[0] ?>', '<?php echo isset($sort[1]) ? $sort[1] : 'asc' ?>');
67
<?php else: ?>
8+
79
return array(null, null);
810
<?php endif; ?>
911
<?php unset($this->config['list']['sort']) ?>

data/generator/sfDoctrineModule/twitter/template/actions/actions.class.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ public function preExecute()
1616
{
1717
$this->configuration = new <?php echo $this->getModuleName() ?>GeneratorConfiguration();
1818

19-
if (!$this->getUser()->hasCredential($this->configuration->getCredentials($this->getActionName())))
20-
{
19+
if (!$this->getUser()->hasCredential($this->configuration->getCredentials($this->getActionName()))) {
2120
$this->forward(sfConfig::get('sf_secure_module'), sfConfig::get('sf_secure_action'));
2221
}
2322

Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
<?php if (isset($this->params['css']) && ($this->params['css'] !== false)): ?>
22
[?php use_stylesheet('<?php echo $this->params['css'] ?>', 'first') ?]
3-
<?php endif; ?>
3+
<?php endif;

data/generator/sfDoctrineModule/twitter/template/templates/_filters.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@
3030
[?php
3131
$icon_filter = '';
3232
$icon_reset = '';
33-
if(sfTwitterBootstrap::getProperty('use_icons_in_button', false))
34-
{
33+
if (sfTwitterBootstrap::getProperty('use_icons_in_button', false)) {
3534
$icon_filter = '<i class="icon-search icon-white"></i> ';
3635
$icon_reset = '<i class="icon-refresh"></i> ';
3736
}

data/generator/sfDoctrineModule/twitter/template/templates/_form_actions.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@
2626
[?php else: ?]
2727
<?php
2828
$params['params'] = is_array($params['params']) ? array_merge($params['params'], array('class' => 'btn mlm')) : array('class' => 'btn mlm') ;
29-
if(sfTwitterBootstrap::getProperty('use_icons_in_button', false))
30-
{
29+
if (sfTwitterBootstrap::getProperty('use_icons_in_button', false)) {
3130
$params['label'] = isset($params['icon']) ? '<i class="'.$params['icon'].'"></i> ' . $params['label'] : $params['label'];
3231
}
3332
echo $this->addCredentialCondition($this->getLinkToAction($name, $params, true), $params)

data/generator/sfDoctrineModule/twitter/template/templates/_list.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
/* <![CDATA[ */
5656
function checkAll()
5757
{
58-
var boxes = document.getElementsByTagName('input'); for(var index = 0; index < boxes.length; index++) { box = boxes[index]; if (box.type == 'checkbox' && box.className == 'sf_admin_batch_checkbox') box.checked = document.getElementById('sf_admin_list_batch_checkbox').checked } return true;
58+
var boxes = document.getElementsByTagName('input'); for (var index = 0; index < boxes.length; index++) { box = boxes[index]; if (box.type == 'checkbox' && box.className == 'sf_admin_batch_checkbox') box.checked = document.getElementById('sf_admin_list_batch_checkbox').checked } return true;
5959
}
6060
/* ]]> */
6161
</script>

data/generator/sfDoctrineModule/twitter/template/templates/_list_actions.php

+2-4
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@
99

1010
<?php
1111
$params['params'] = is_array($params['params']) ? array_merge($params['params'], array('class' => 'btn')) : array('class' => 'btn');
12-
if(sfTwitterBootstrap::getProperty('use_icons_in_button', false))
13-
{
12+
if (sfTwitterBootstrap::getProperty('use_icons_in_button', false)) {
1413
$params['label'] = isset($params['icon']) ? '<i class="'.$params['icon'].'"></i> ' . $params['label'] : $params['label'];
1514
}
1615
echo $this->addCredentialCondition($this->getLinkToAction($name, $params, false), $params)."\n"
@@ -70,8 +69,7 @@
7069

7170
[?php
7271
$icon = '';
73-
if(sfTwitterBootstrap::getProperty('use_icons_in_button', false))
74-
{
72+
if (sfTwitterBootstrap::getProperty('use_icons_in_button', false)) {
7573
$icon = '<i class="icon-plus-sign icon-white"></i> ';
7674
}
7775
?]

data/generator/sfDoctrineModule/twitter/template/templates/_list_batch_actions.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@
1717
<input type="submit" class="btn" value="[?php echo __('go', array(), 'sf_admin') ?]" onclick="copyIds()" />
1818
</div>
1919
</form>
20-
<?php endif; ?>
20+
<?php endif;

data/generator/sfDoctrineModule/twitter/template/templates/_list_td_actions.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@
1313
<?php else: ?>
1414
<li class="sf_admin_action_<?php echo $params['class_suffix'] ?>">
1515
<?php
16-
if(sfTwitterBootstrap::getProperty('use_icons_in_button', false))
17-
{
16+
if (sfTwitterBootstrap::getProperty('use_icons_in_button', false)) {
1817
$params['label'] = isset($params['icon']) ? '<i class="'.$params['icon'].'"></i> ' . $params['label'] : $params['label'];
1918
}
2019
echo $this->addCredentialCondition($this->getLinkToAction($name, $params, true), $params)

data/generator/sfDoctrineModule/twitter/template/templates/_list_td_tabular.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66
77
EOF
88
, strtolower($field->getType()), $name, $this->renderField($field)), $field->getConfig()) ?>
9-
<?php endforeach; ?>
9+
<?php endforeach;

0 commit comments

Comments
 (0)