Skip to content
This repository was archived by the owner on Sep 16, 2021. It is now read-only.

Commit d55a986

Browse files
committed
Applied fixes from StyleCI
1 parent 8c30fcc commit d55a986

File tree

16 files changed

+309
-189
lines changed

16 files changed

+309
-189
lines changed

.styleci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
preset: symfony

CmfTreeBrowserBundle.php

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,20 @@
11
<?php
22

3-
namespace Symfony\Cmf\Bundle\TreeBrowserBundle;
3+
/*
4+
* This file is part of the Symfony CMF package.
5+
*
6+
* (c) 2011-2015 Symfony CMF
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
411

5-
use Symfony\Component\HttpKernel\Bundle\Bundle;
6-
use Symfony\Component\DependencyInjection\ContainerBuilder;
7-
use Symfony\Component\DependencyInjection\Compiler\PassConfig;
12+
namespace Symfony\Cmf\Bundle\TreeBrowserBundle;
813

914
use Symfony\Cmf\Bundle\TreeBrowserBundle\DependencyInjection\Compiler\AddTreesCompilerPass;
15+
use Symfony\Component\DependencyInjection\Compiler\PassConfig;
16+
use Symfony\Component\DependencyInjection\ContainerBuilder;
17+
use Symfony\Component\HttpKernel\Bundle\Bundle;
1018

1119
class CmfTreeBrowserBundle extends Bundle
1220
{
@@ -15,5 +23,4 @@ public function build(ContainerBuilder $container)
1523
parent::build($container);
1624
$container->addCompilerPass(new AddTreesCompilerPass(), PassConfig::TYPE_BEFORE_OPTIMIZATION);
1725
}
18-
1926
}

Controller/TreeBrowserController.php

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,20 @@
11
<?php
22

3+
/*
4+
* This file is part of the Symfony CMF package.
5+
*
6+
* (c) 2011-2015 Symfony CMF
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
312
namespace Symfony\Cmf\Bundle\TreeBrowserBundle\Controller;
413

14+
use Symfony\Cmf\Bundle\TreeBrowserBundle\Tree\TreeInterface;
15+
use Symfony\Component\HttpFoundation\JsonResponse;
516
use Symfony\Component\HttpFoundation\Request;
617
use Symfony\Component\HttpFoundation\Response;
7-
use Symfony\Component\HttpFoundation\JsonResponse;
8-
9-
use Symfony\Cmf\Bundle\TreeBrowserBundle\Tree\TreeInterface;
1018

1119
/**
1220
* Frontend to the TreeInterface, allowing to fetch children, get an edit form
@@ -23,7 +31,7 @@ class TreeBrowserController
2331
protected $tree;
2432

2533
/**
26-
* Create the controller
34+
* Create the controller.
2735
*
2836
* @param TreeInterface $tree the tree to operate on
2937
*/
@@ -33,13 +41,13 @@ public function __construct(TreeInterface $tree)
3341
}
3442

3543
/**
36-
* Get a json encoded list of children the specified node has
44+
* Get a json encoded list of children the specified node has.
3745
*
3846
* @param Request $request containing the parameter 'root' for which to get
39-
* the children
47+
* the children
4048
*
4149
* @return Response json encoded list of child nodes of the specified root
42-
* node.
50+
* node.
4351
*/
4452
public function childrenAction(Request $request)
4553
{
@@ -58,10 +66,10 @@ public function childrenAction(Request $request)
5866
* Should only be configured for POST requests to avoid manipulations.
5967
*
6068
* @param Request $request with the parameters dropped and target,
61-
* containing the path to move from resp. to
69+
* containing the path to move from resp. to
6270
*
6371
* @return Response returning a plain text result with the new path of the
64-
* node.
72+
* node.
6573
*/
6674
public function moveAction(Request $request)
6775
{
@@ -77,10 +85,10 @@ public function moveAction(Request $request)
7785
* Should only be configured for POST requests to avoid manipulations.
7886
*
7987
* @param Request $request with the parameters dropped and target,
80-
* containing the path to move from resp. to
88+
* containing the path to move from resp. to
8189
*
8290
* @return Response returning a plain text result with the new path of the
83-
* node.
91+
* node.
8492
*/
8593
public function reorderAction(Request $request)
8694
{

DependencyInjection/CmfTreeBrowserExtension.php

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,30 @@
11
<?php
22

3+
/*
4+
* This file is part of the Symfony CMF package.
5+
*
6+
* (c) 2011-2015 Symfony CMF
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
312
namespace Symfony\Cmf\Bundle\TreeBrowserBundle\DependencyInjection;
413

514
use Symfony\Component\Config\FileLocator;
6-
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
7-
use Symfony\Component\DependencyInjection\Reference;
815
use Symfony\Component\DependencyInjection\ContainerBuilder;
916
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
17+
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
1018

1119
/**
12-
* @author Lukas Kahwe Smith <[email protected]>
13-
*/
20+
* @author Lukas Kahwe Smith <[email protected]>
21+
*/
1422
class CmfTreeBrowserExtension extends Extension
1523
{
1624
/**
1725
* Loads the services based on your application configuration.
1826
*
19-
* @param array $configs
27+
* @param array $configs
2028
* @param ContainerBuilder $container
2129
*/
2230
public function load(array $configs, ContainerBuilder $container)
@@ -28,7 +36,6 @@ public function load(array $configs, ContainerBuilder $container)
2836
if (isset($bundles['DoctrinePHPCRBundle'])
2937
&& $config['persistence']['phpcr']['enabled']
3038
) {
31-
3239
$loader->load('tree-phpcr.xml');
3340
$phpcrTree = $container->getDefinition('cmf_tree_browser.phpcr_tree');
3441
$phpcrTree->replaceArgument(1, $config['persistence']['phpcr']['session_name']);

DependencyInjection/Compiler/AddTreesCompilerPass.php

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
11
<?php
22

3+
/*
4+
* This file is part of the Symfony CMF package.
5+
*
6+
* (c) 2011-2015 Symfony CMF
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
312
namespace Symfony\Cmf\Bundle\TreeBrowserBundle\DependencyInjection\Compiler;
413

5-
use Symfony\Component\DependencyInjection\ContainerBuilder;
614
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
15+
use Symfony\Component\DependencyInjection\ContainerBuilder;
716
use Symfony\Component\DependencyInjection\DefinitionDecorator;
8-
use Symfony\Component\DependencyInjection\Reference;
917

1018
class AddTreesCompilerPass implements CompilerPassInterface
1119
{
@@ -33,5 +41,4 @@ public function process(ContainerBuilder $container)
3341
}
3442
$container->setParameter('cmf_tree_browser.tree_controllers', $controllers);
3543
}
36-
37-
}
44+
}

DependencyInjection/Configuration.php

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,21 @@
11
<?php
22

3+
/*
4+
* This file is part of the Symfony CMF package.
5+
*
6+
* (c) 2011-2015 Symfony CMF
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
312
namespace Symfony\Cmf\Bundle\TreeBrowserBundle\DependencyInjection;
413

514
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
615
use Symfony\Component\Config\Definition\ConfigurationInterface;
716

817
/**
9-
* This class contains the configuration information for the bundle
18+
* This class contains the configuration information for the bundle.
1019
*
1120
* This information is solely responsible for how the different configuration
1221
* sections are normalized, and merged.
@@ -37,8 +46,7 @@ public function getConfigTreeBuilder()
3746
->end()
3847
->end()
3948
->end()
40-
->end()
41-
;
49+
->end();
4250

4351
return $treeBuilder;
4452
}

Route/TreeControllerRoutesLoader.php

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,23 @@
11
<?php
22

3+
/*
4+
* This file is part of the Symfony CMF package.
5+
*
6+
* (c) 2011-2015 Symfony CMF
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
312
namespace Symfony\Cmf\Bundle\TreeBrowserBundle\Route;
413

514
use Symfony\Component\Config\FileLocator;
615
use Symfony\Component\Config\Loader\FileLoader;
7-
use Symfony\Component\Routing\RouteCollection;
816
use Symfony\Component\Routing\Route;
17+
use Symfony\Component\Routing\RouteCollection;
918

1019
/**
11-
* Load routes for all existing tree controllers
20+
* Load routes for all existing tree controllers.
1221
*/
1322
class TreeControllerRoutesLoader extends FileLoader
1423
{
@@ -37,7 +46,7 @@ public function load($resource, $type = null)
3746
foreach ($this->treeControllers as $controller) {
3847
foreach ($this->getRoutesDefinitions() as $name => $definition) {
3948
$defaults = array(
40-
'_controller' => $controller['id'].':'.$definition['action']
49+
'_controller' => $controller['id'].':'.$definition['action'],
4150
);
4251
$path = '_cmf_tree/'.$controller['alias'].'/'.$definition['path'];
4352

@@ -55,7 +64,7 @@ public function load($resource, $type = null)
5564
* @param mixed $resource A resource
5665
* @param string $type The resource type
5766
*
58-
* @return Boolean true if this class supports the given resource, false otherwise
67+
* @return bool true if this class supports the given resource, false otherwise
5968
*/
6069
public function supports($resource, $type = null)
6170
{
@@ -70,19 +79,19 @@ protected function getRoutesDefinitions()
7079
{
7180
return array(
7281
'children' => array(
73-
'path' => 'children',
82+
'path' => 'children',
7483
'method' => 'GET',
75-
'action' => 'childrenAction'
84+
'action' => 'childrenAction',
7685
),
7786
'move' => array(
78-
'path' => 'move',
87+
'path' => 'move',
7988
'method' => 'POST',
80-
'action' => 'moveAction'
89+
'action' => 'moveAction',
8190
),
8291
'reorder' => array(
83-
'path' => 'reorder',
92+
'path' => 'reorder',
8493
'method' => 'POST',
85-
'action' => 'reorderAction'
94+
'action' => 'reorderAction',
8695
),
8796
);
8897
}

Tests/Functional/PHPCR/PHPCRBrowserTest.php

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,20 @@
11
<?php
22

3-
namespace Symfony\Cmf\Bundle\TreeBrowserBundle\Tests\Functional\PHPCR;
3+
/*
4+
* This file is part of the Symfony CMF package.
5+
*
6+
* (c) 2011-2015 Symfony CMF
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
411

12+
namespace Symfony\Cmf\Bundle\TreeBrowserBundle\Tests\Functional\PHPCR;
513

614
use Symfony\Cmf\Component\Testing\Functional\BaseTestCase;
715

816
/**
9-
* Functional test for PHPCRBrowser
17+
* Functional test for PHPCRBrowser.
1018
*
1119
* @author Jacopo Jakuza Romei <[email protected]>
1220
*/
@@ -49,11 +57,11 @@ public function testGetChildrenListFromInnerNode()
4957
protected function loadFixtures()
5058
{
5159
$session = $this->getContainer()->get('doctrine_phpcr.session');
52-
if ($session->nodeExists("/cms")) {
53-
$session->getNode("/cms")->remove();
60+
if ($session->nodeExists('/cms')) {
61+
$session->getNode('/cms')->remove();
5462
}
55-
if ($session->nodeExists("/menus")) {
56-
$session->getNode("/menus")->remove();
63+
if ($session->nodeExists('/menus')) {
64+
$session->getNode('/menus')->remove();
5765
}
5866

5967
$node = $session->getRootNode()->addNode('cms', 'nt:unstructured');
@@ -66,5 +74,4 @@ protected function loadFixtures()
6674

6775
$session->save();
6876
}
69-
7077
}

Tests/Resources/app/AppKernel.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,23 @@
11
<?php
22

3+
/*
4+
* This file is part of the Symfony CMF package.
5+
*
6+
* (c) 2011-2015 Symfony CMF
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
312
use Symfony\Cmf\Component\Testing\HttpKernel\TestKernel;
413
use Symfony\Component\Config\Loader\LoaderInterface;
14+
515
class AppKernel extends TestKernel
616
{
717
public function configure()
818
{
919
$this->requireBundleSets(array(
10-
'default', 'phpcr_odm'
20+
'default', 'phpcr_odm',
1121
));
1222

1323
$this->addBundles(array(
@@ -20,4 +30,3 @@ public function registerContainerConfiguration(LoaderInterface $loader)
2030
$loader->load(__DIR__.'/config/config.php');
2131
}
2232
}
23-

Tests/Resources/app/config/config.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
11
<?php
22

3+
/*
4+
* This file is part of the Symfony CMF package.
5+
*
6+
* (c) 2011-2015 Symfony CMF
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
312
$container->setParameter('cmf_testing.bundle_fqn', 'Symfony\Cmf\Bundle\TreeBrowserBundle');
413
$loader->import(CMF_TEST_CONFIG_DIR.'/default.php');
514
$loader->import(CMF_TEST_CONFIG_DIR.'/phpcr_odm.php');
615
$loader->import(__DIR__.'/cmf_tree_browser.yml');
7-

0 commit comments

Comments
 (0)