Passed
Branch scrutinizer (7e64c3)
by Nikita
06:59 queued 02:33
created
Generator/RestControllerGenerator.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -1,7 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 namespace Tpg\ExtjsBundle\Generator;
3 3
 
4
-use Doctrine\ORM\Mapping\Driver\SimplifiedYamlDriver;
5 4
 use Sensio\Bundle\GeneratorBundle\Generator\ControllerGenerator;
6 5
 use Symfony\Component\HttpKernel\Bundle\BundleInterface;
7 6
 use Symfony\Component\Yaml\Yaml;
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -64,11 +64,11 @@
 block discarded – undo
64 64
             'trait'      => $this->trait,
65 65
             'namespace'  => $bundle->getNamespace(),
66 66
             'bundle'     => $bundle->getName(),
67
-            "manager"    => ($this->mongo===true)?"doctrine_mongodb.odm.default_document_manager":"doctrine.orm.default_entity_manager",
68
-            'serializer' => ($this->mongo===true)?"tpg_extjs.odm_serializer":"tpg_extjs.orm_serializer",
67
+            "manager"    => ($this->mongo === true) ? "doctrine_mongodb.odm.default_document_manager" : "doctrine.orm.default_entity_manager",
68
+            'serializer' => ($this->mongo === true) ? "tpg_extjs.odm_serializer" : "tpg_extjs.orm_serializer",
69 69
             'controller'        => $controller,
70 70
             'entity_class'      => $entityClass,
71
-            'entity_name'       => str_replace(array("/","\\"), "_", $this->entityName),
71
+            'entity_name'       => str_replace(array("/", "\\"), "_", $this->entityName),
72 72
             'entity_bundle'     => $this->entityBundle->getName(),
73 73
             'entity'            => array_pop($tmpEntity),
74 74
             'route_name_prefix' => strtolower(preg_replace('/([A-Z])/', '_\\1', $bundle->getName().'_api_'))
Please login to merge, or discard this patch.
Tests/Command/BaseTestGeneratedRestController.php 2 patches
Unused Use Statements   -7 removed lines patch added patch discarded remove patch
@@ -3,16 +3,9 @@
 block discarded – undo
3 3
 
4 4
 include_once(__DIR__ . '/../app/AppKernel.php');
5 5
 
6
-use Doctrine\Bundle\MongoDBBundle\Command\CreateSchemaDoctrineODMCommand;
7
-use Doctrine\Bundle\MongoDBBundle\Command\DropSchemaDoctrineODMCommand;
8 6
 use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
9
-use Doctrine\Bundle\DoctrineBundle\Command\CreateDatabaseDoctrineCommand;
10
-use Doctrine\Bundle\DoctrineBundle\Command\DropDatabaseDoctrineCommand;
11
-use Doctrine\Bundle\DoctrineBundle\Command\Proxy\CreateSchemaDoctrineCommand;
12
-
13 7
 use Symfony\Bundle\FrameworkBundle\Console\Application;
14 8
 use Symfony\Component\Console\Tester\CommandTester;
15
-use Symfony\Component\Routing\Router;
16 9
 use Tpg\ExtjsBundle\Command\GenerateRestControllerCommand;
17 10
 
18 11
 class BaseTestGeneratedRestController extends WebTestCase {
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@
 block discarded – undo
1 1
 <?php
2 2
 namespace Tpg\ExtjsBundle\Tests\Command;
3 3
 
4
-include_once(__DIR__ . '/../app/AppKernel.php');
4
+include_once(__DIR__.'/../app/AppKernel.php');
5 5
 
6 6
 use Doctrine\Bundle\MongoDBBundle\Command\CreateSchemaDoctrineODMCommand;
7 7
 use Doctrine\Bundle\MongoDBBundle\Command\DropSchemaDoctrineODMCommand;
Please login to merge, or discard this patch.
Controller/GeneratorController.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -20,26 +20,26 @@  discard block
 block discarded – undo
20 20
         $kernel = $this->get('kernel');
21 21
         if ($models === null) {
22 22
             $list = $this->container->getParameter("tpg_extjs.entities");
23
-            return new StreamedResponse(function () use($list, $generator, $kernel) {
23
+            return new StreamedResponse(function() use($list, $generator, $kernel) {
24 24
                 foreach ($list as $configEntityLine) {
25 25
                     list($bundleName, $path) = explode("/", substr($configEntityLine, 1), 2);
26 26
                     /** @var Bundle $bundle */
27 27
                     $bundle = $kernel->getBundle($bundleName, true);
28 28
 
29 29
                     /** Entity end with backslash, it is a directory */
30
-                    $loadAllEntitiesFromDir = ($configEntityLine[strlen($configEntityLine)-1] == "/");
30
+                    $loadAllEntitiesFromDir = ($configEntityLine[strlen($configEntityLine) - 1] == "/");
31 31
 
32
-                    if ( $loadAllEntitiesFromDir ) {
32
+                    if ($loadAllEntitiesFromDir) {
33 33
                         $bundleRef = new \ReflectionClass($bundle);
34 34
                         $dir = new Finder();
35 35
                         $dir->files()->depth('== 0')->in(dirname($bundleRef->getFileName()).'/'.$path)->name('/.*\.php$/');
36
-                        foreach($dir as $file) {
36
+                        foreach ($dir as $file) {
37 37
                             /** @var SplFileInfo $file*/
38
-                            $entityClassname = $bundleRef->getNamespaceName() . "\\" . str_replace("/", "\\", $path) . substr($file->getFilename(), 0, -4);
38
+                            $entityClassname = $bundleRef->getNamespaceName()."\\".str_replace("/", "\\", $path).substr($file->getFilename(), 0, -4);
39 39
                             echo $generator->generateMarkupForEntity($entityClassname);
40 40
                         }
41
-                    } else  {
42
-                        $entityClassname = $bundle->getNamespace() . "\\" . str_replace("/", "\\", $path);
41
+                    } else {
42
+                        $entityClassname = $bundle->getNamespace()."\\".str_replace("/", "\\", $path);
43 43
                         echo $generator->generateMarkupForEntity($entityClassname);
44 44
                     }
45 45
                 }
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
             if (!is_array($models)) {
52 52
                 $models = array($models);
53 53
             }
54
-            return new StreamedResponse(function () use($models, $generator) {
54
+            return new StreamedResponse(function() use($models, $generator) {
55 55
                 foreach ($models as $model) {
56 56
                     $model = str_replace(".", "\\", $model);
57 57
                     echo $generator->generateMarkupForEntity($model);
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
         } else {
103 103
             $requestData = array();
104 104
             $i = 0;
105
-            foreach($actionparams as $parameter) {
105
+            foreach ($actionparams as $parameter) {
106 106
                 $requestData[$parameter->getName()] = $data[$i++];
107 107
             }
108 108
         }
Please login to merge, or discard this patch.
Tests/Service/GeneratorServiceTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
         $this->twigEngine = new TwigEngineMokcup();
22 22
         $this->service->setTwigEngine($this->twigEngine);
23 23
         $this->service->setModelFieldsParameters(array(
24
-          "date" => array( "format" => "d-m-y")
24
+          "date" => array("format" => "d-m-y")
25 25
         ));
26 26
     }
27 27
 
Please login to merge, or discard this patch.
Tests/Command/ORM/GeneratedRestControllerTest.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 
17 17
     public function testGetsActionWithFilterOnName() {
18 18
         $filter = json_encode(array(
19
-            array('property'=>'name','value'=>'Ford')
19
+            array('property'=>'name', 'value'=>'Ford')
20 20
         ));
21 21
         $this->client->request('GET', '/cars.json?filter='.$filter);
22 22
         $content = json_decode($this->client->getResponse()->getContent(), true);
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 
27 27
     public function testGetsActionWithFilterOnPlateNumner() {
28 28
         $filter = json_encode(array(
29
-            array('property'=>'plateNumber','value'=>'BB243')
29
+            array('property'=>'plateNumber', 'value'=>'BB243')
30 30
         ));
31 31
         $this->client->request('GET', '/cars.json?filter='.$filter);
32 32
         $content = json_decode($this->client->getResponse()->getContent(), true);
Please login to merge, or discard this patch.
Tests/Command/ORM/GeneratedRestControllerAssociationTest.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
         $manager = $this->client->getContainer()->get("doctrine.orm.default_entity_manager");
24 24
         $owner = new CarOwner();
25 25
         $owner->setName("james");
26
-        foreach($this->records as $record) {
26
+        foreach ($this->records as $record) {
27 27
             $owner->addCar($record);
28 28
         }
29 29
         $manager->persist($owner);
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 
45 45
     public function testGetWithAssociation() {
46 46
         $filter = json_encode(array(
47
-            array('property'=>'name','value'=>'Ford')
47
+            array('property'=>'name', 'value'=>'Ford')
48 48
         ));
49 49
         $this->client->request('GET', '/cars.json?filter='.$filter);
50 50
         $content = json_decode($this->client->getResponse()->getContent(), true);
Please login to merge, or discard this patch.
Tests/Command/ODM/GenerateRestControllerCommandTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@
 block discarded – undo
1 1
 <?php
2 2
 namespace Tpg\ExtjsBundle\Tests\Command\ODM;
3 3
 
4
-include_once(__DIR__ . '/../../app/AppKernel.php');
4
+include_once(__DIR__.'/../../app/AppKernel.php');
5 5
 
6 6
 use Symfony\Bundle\FrameworkBundle\Console\Application;
7 7
 use Symfony\Component\Console\Tester\CommandTester;
Please login to merge, or discard this patch.
Tests/Command/ODM/GeneratedRestControllerEmbeddedAssociationTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@
 block discarded – undo
7 7
 
8 8
     public function testGetWithAssociation() {
9 9
         $filter = json_encode(array(
10
-            array('property'=>'name','value'=>'Invoice 1')
10
+            array('property'=>'name', 'value'=>'Invoice 1')
11 11
         ));
12 12
         $this->client->request('GET', '/orders.json?filter='.$filter);
13 13
         $content = json_decode($this->client->getResponse()->getContent(), true);
Please login to merge, or discard this patch.
Tests/app_test.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -5,8 +5,8 @@
 block discarded – undo
5 5
     exit(0);
6 6
 }
7 7
 
8
-$loader = require_once __DIR__ . '/bootstrap.php';
9
-require_once __DIR__ . '/app/AppKernel.php';
8
+$loader = require_once __DIR__.'/bootstrap.php';
9
+require_once __DIR__.'/app/AppKernel.php';
10 10
 use Symfony\Component\HttpFoundation\Request;
11 11
 
12 12
 $kernel = new AppKernel('test', true);
Please login to merge, or discard this patch.