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

Commit c1bb5a4

Browse files
committed
Merge pull request #169 from symfony-cmf/styleci
Introduced Style CI
2 parents 022cd27 + 959e049 commit c1bb5a4

File tree

20 files changed

+82
-95
lines changed

20 files changed

+82
-95
lines changed

.styleci.yml

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

Adapter/PhpcrOdmAdapter.php

Lines changed: 25 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,12 @@
1414
use Doctrine\ODM\PHPCR\DocumentManager;
1515
use Doctrine\ODM\PHPCR\Document\Generic;
1616
use Doctrine\Common\Util\ClassUtils;
17-
use PHPCR\InvalidItemStateException;
1817
use Symfony\Cmf\Component\RoutingAuto\Model\AutoRouteInterface;
1918
use Symfony\Cmf\Component\RoutingAuto\UriContext;
20-
use Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Phpcr\RedirectRoute;
2119
use Symfony\Cmf\Component\RoutingAuto\AdapterInterface;
22-
use Symfony\Cmf\Bundle\RoutingAutoBundle\Model\AutoRedirectRoute;
2320

2421
/**
25-
* Adapter for PHPCR-ODM
22+
* Adapter for PHPCR-ODM.
2623
*
2724
* @author Daniel Leech <[email protected]>
2825
*/
@@ -53,7 +50,7 @@ public function __construct(DocumentManager $dm, $routeBasePath, $autoRouteFqcn
5350
}
5451

5552
/**
56-
* {@inheritDoc}
53+
* {@inheritdoc}
5754
*/
5855
public function getLocales($contentDocument)
5956
{
@@ -65,7 +62,7 @@ public function getLocales($contentDocument)
6562
}
6663

6764
/**
68-
* {@inheritDoc}
65+
* {@inheritdoc}
6966
*/
7067
public function translateObject($contentDocument, $locale)
7168
{
@@ -75,15 +72,15 @@ public function translateObject($contentDocument, $locale)
7572
}
7673

7774
/**
78-
* {@inheritDoc}
75+
* {@inheritdoc}
7976
*/
8077
public function generateAutoRouteTag(UriContext $uriContext)
8178
{
82-
return $uriContext->getLocale() ? : self::TAG_NO_MULTILANG;
79+
return $uriContext->getLocale() ?: self::TAG_NO_MULTILANG;
8380
}
8481

8582
/**
86-
* {@inheritDoc}
83+
* {@inheritdoc}
8784
*/
8885
public function migrateAutoRouteChildren(AutoRouteInterface $srcAutoRoute, AutoRouteInterface $destAutoRoute)
8986
{
@@ -94,12 +91,12 @@ public function migrateAutoRouteChildren(AutoRouteInterface $srcAutoRoute, AutoR
9491
$srcAutoRouteChildren = $srcAutoRouteNode->getNodes();
9592

9693
foreach ($srcAutoRouteChildren as $srcAutoRouteChild) {
97-
$session->move($srcAutoRouteChild->getPath(), $destAutoRouteNode->getPath() . '/' . $srcAutoRouteChild->getName());
94+
$session->move($srcAutoRouteChild->getPath(), $destAutoRouteNode->getPath().'/'.$srcAutoRouteChild->getName());
9895
}
9996
}
10097

10198
/**
102-
* {@inheritDoc}
99+
* {@inheritdoc}
103100
*/
104101
public function removeAutoRoute(AutoRouteInterface $autoRoute)
105102
{
@@ -110,7 +107,7 @@ public function removeAutoRoute(AutoRouteInterface $autoRoute)
110107
}
111108

112109
/**
113-
* {@inheritDoc}
110+
* {@inheritdoc}
114111
*/
115112
public function createAutoRoute(UriContext $uriContext, $contentDocument, $autoRouteTag)
116113
{
@@ -126,7 +123,7 @@ public function createAutoRoute(UriContext $uriContext, $contentDocument, $autoR
126123
$segments = preg_split('#/#', $uriContext->getUri(), null, PREG_SPLIT_NO_EMPTY);
127124
$headName = array_pop($segments);
128125
foreach ($segments as $segment) {
129-
$basePath .= '/' . $segment;
126+
$basePath .= '/'.$segment;
130127
$document = $this->dm->find(null, $basePath);
131128

132129
if (null === $document) {
@@ -138,7 +135,7 @@ public function createAutoRoute(UriContext $uriContext, $contentDocument, $autoR
138135
$parentDocument = $document;
139136
}
140137

141-
$path = $basePath . '/' . $headName;
138+
$path = $basePath.'/'.$headName;
142139
$existingDocument = $this->dm->find(null, $path);
143140

144141
if ($existingDocument) {
@@ -153,7 +150,7 @@ public function createAutoRoute(UriContext $uriContext, $contentDocument, $autoR
153150

154151
throw new \RuntimeException(
155152
sprintf(
156-
'Encountered existing PHPCR-ODM document at path "%s" of class "%s", the route tree should ' .
153+
'Encountered existing PHPCR-ODM document at path "%s" of class "%s", the route tree should '.
157154
'contain only instances of AutoRouteInterface.',
158155
$path,
159156
get_class($existingDocument)
@@ -172,7 +169,7 @@ public function createAutoRoute(UriContext $uriContext, $contentDocument, $autoR
172169
}
173170

174171
/**
175-
* {@inheritDoc}
172+
* {@inheritdoc}
176173
*/
177174
public function createRedirectRoute(AutoRouteInterface $referringAutoRoute, AutoRouteInterface $newRoute)
178175
{
@@ -181,15 +178,15 @@ public function createRedirectRoute(AutoRouteInterface $referringAutoRoute, Auto
181178
}
182179

183180
/**
184-
* {@inheritDoc}
181+
* {@inheritdoc}
185182
*/
186183
public function getRealClassName($className)
187184
{
188185
return ClassUtils::getRealClass($className);
189186
}
190187

191188
/**
192-
* {@inheritDoc}
189+
* {@inheritdoc}
193190
*/
194191
public function compareAutoRouteContent(AutoRouteInterface $autoRoute, $contentDocument)
195192
{
@@ -201,36 +198,37 @@ public function compareAutoRouteContent(AutoRouteInterface $autoRoute, $contentD
201198
}
202199

203200
/**
204-
* {@inheritDoc}
201+
* {@inheritdoc}
205202
*/
206203
public function getReferringAutoRoutes($contentDocument)
207204
{
208-
return $this->dm->getReferrers($contentDocument, null, null, null, 'Symfony\Cmf\Component\RoutingAuto\Model\AutoRouteInterface');
205+
return $this->dm->getReferrers($contentDocument, null, null, null, 'Symfony\Cmf\Component\RoutingAuto\Model\AutoRouteInterface');
209206
}
210207

211208
/**
212-
* {@inheritDoc}
209+
* {@inheritdoc}
213210
*/
214211
public function findRouteForUri($uri, UriContext $uriContext)
215212
{
216213
return $this->dm->find(
217-
'Symfony\Cmf\Component\RoutingAuto\Model\AutoRouteInterface',
214+
'Symfony\Cmf\Component\RoutingAuto\Model\AutoRouteInterface',
218215
$this->getPathFromUri($uri)
219216
);
220217
}
221218

222219
private function getPathFromUri($uri)
223220
{
224-
return $this->baseRoutePath . $uri;
221+
return $this->baseRoutePath.$uri;
225222
}
226223

227224
/**
228225
* Convert the given generic document to an auto route document.
229226
*
230227
* @param Generic $document
231-
* @param object $contentDocument
232-
* @param string $autoRouteTag
233-
* @param string $routeType
228+
* @param object $contentDocument
229+
* @param string $autoRouteTag
230+
* @param string $routeType
231+
*
234232
* @return AutoRouteInterface
235233
*/
236234
private function migrateGenericToAutoRoute(Generic $document, $contentDocument, $autoRouteTag, $routeType)
@@ -246,7 +244,7 @@ private function migrateGenericToAutoRoute(Generic $document, $contentDocument,
246244
if (!$autoRoute instanceof $autoRouteClassName) {
247245
throw new \RuntimeException(
248246
sprintf(
249-
'Failed to migrate existing, non-managed, PHPCR node at "%s" to a managed document implementing ' .
247+
'Failed to migrate existing, non-managed, PHPCR node at "%s" to a managed document implementing '.
250248
'the AutoRouteInterface. It is an instance of "%s".',
251249
$document->getId(),
252250
get_class($autoRoute)

CmfRoutingAutoBundle.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,5 +56,4 @@ private function buildPhpcrCompilerPass(ContainerBuilder $container)
5656
);
5757
}
5858
}
59-
6059
}

Command/RefreshCommand.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public function configure()
5252
}
5353

5454
/**
55-
* {@inheritDoc}
55+
* {@inheritdoc}
5656
*/
5757
public function execute(InputInterface $input, OutputInterface $output)
5858
{
@@ -81,7 +81,6 @@ public function execute(InputInterface $input, OutputInterface $output)
8181
}
8282

8383
foreach (array_keys($mapping) as $classFqn) {
84-
8584
$output->writeln(sprintf('<info>Processing class: </info> %s', $classFqn));
8685

8786
$qb = $dm->createQueryBuilder();

Controller/RedirectController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
use Symfony\Component\Routing\RouterInterface;
1818

1919
/**
20-
* Simple redirecting controller for AutoRouteInterface documents
20+
* Simple redirecting controller for AutoRouteInterface documents.
2121
*
2222
* @author Daniel Leech <[email protected]>
2323
*/

DependencyInjection/CmfRoutingAutoExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
class CmfRoutingAutoExtension extends Extension
2222
{
2323
/**
24-
* {@inheritDoc}
24+
* {@inheritdoc}
2525
*/
2626
public function load(array $configs, ContainerBuilder $container)
2727
{

DependencyInjection/Compiler/AdapterPass.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
use Symfony\Component\DependencyInjection\ContainerBuilder;
1515
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
16-
use Symfony\Component\DependencyInjection\Reference;
1716

1817
/**
1918
* @author Daniel Leech <[email protected]>

Doctrine/Phpcr/AutoRouteListener.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
use Doctrine\ODM\PHPCR\DocumentManager;
1616
use Symfony\Component\DependencyInjection\ContainerInterface;
1717
use Symfony\Cmf\Bundle\RoutingAutoBundle\Model\AutoRoute;
18-
use Doctrine\Common\Util\ClassUtils;
1918
use Symfony\Cmf\Component\RoutingAuto\UriContextCollection;
2019
use Symfony\Cmf\Component\RoutingAuto\Mapping\Exception\ClassNotMappedException;
2120

Model/AutoRoute.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,39 +30,39 @@ class AutoRoute extends Route implements AutoRouteInterface
3030
protected $redirectRoute;
3131

3232
/**
33-
* {@inheritDoc}
33+
* {@inheritdoc}
3434
*/
3535
public function setAutoRouteTag($autoRouteTag)
3636
{
3737
$this->setDefault(self::DEFAULT_KEY_AUTO_ROUTE_TAG, $autoRouteTag);
3838
}
3939

4040
/**
41-
* {@inheritDoc}
41+
* {@inheritdoc}
4242
*/
4343
public function getAutoRouteTag()
4444
{
4545
return $this->getDefault(self::DEFAULT_KEY_AUTO_ROUTE_TAG);
4646
}
4747

4848
/**
49-
* {@inheritDoc}
49+
* {@inheritdoc}
5050
*/
5151
public function setType($type)
5252
{
5353
$this->setDefault('type', $type);
5454
}
5555

5656
/**
57-
* {@inheritDoc}
57+
* {@inheritdoc}
5858
*/
5959
public function setRedirectTarget($redirectRoute)
6060
{
6161
$this->redirectRoute = $redirectRoute;
6262
}
6363

6464
/**
65-
* {@inheritDoc}
65+
* {@inheritdoc}
6666
*/
6767
public function getRedirectTarget()
6868
{

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Symfony CMF Routing Auto Bundle
22

33
[![Build Status](https://secure.travis-ci.org/symfony-cmf/RoutingAutoBundle.png?branch=master)](http://travis-ci.org/symfony-cmf/RoutingAutoBundle)
4+
[![StyleCI](https://styleci.io/repos/8671509/shield)](https://styleci.io/repos/8671509)
45
[![Latest Stable Version](https://poser.pugx.org/symfony-cmf/routing-auto-bundle/version.png)](https://packagist.org/packages/symfony-cmf/routing-auto-bundle)
56
[![Total Downloads](https://poser.pugx.org/symfony-cmf/routing-auto-bundle/d/total.png)](https://packagist.org/packages/symfony-cmf/routing-auto-bundle)
67

0 commit comments

Comments
 (0)