Skip to content

Commit

Permalink
General code improvements based on sensiolabs analysis.
Browse files Browse the repository at this point in the history
  • Loading branch information
NoUseFreak committed Apr 4, 2015
1 parent cd8707b commit e4d51ae
Show file tree
Hide file tree
Showing 50 changed files with 230 additions and 288 deletions.
209 changes: 131 additions & 78 deletions composer.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/Clastic/AliasBundle/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
vendor/
composer.lock
phpunit.xml
phpunit.xml
4 changes: 2 additions & 2 deletions src/Clastic/AliasBundle/Controller/AliasController.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
namespace Clastic\AliasBundle\Controller;

use Clastic\AliasBundle\Entity\Alias;
use Clastic\AliasBundle\Form\AliasType;
use Clastic\AliasBundle\Form\AliasFormType;
use Clastic\BackofficeBundle\Controller\AbstractModuleController;
use Clastic\NodeBundle\Node\NodeReferenceInterface;
use Symfony\Component\Form\Form;
Expand Down Expand Up @@ -49,7 +49,7 @@ protected function getListTemplate()
*/
protected function buildForm($data)
{
return $this->createForm(new AliasType(), $data);
return $this->createForm(new AliasFormType(), $data);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* file that was distributed with this source code.
*/

namespace Clastic\AliasBundle\Form;
namespace Clastic\AliasBundle\Form\Type;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
Expand All @@ -16,7 +16,7 @@
/**
* @author Dries De Peuter <dries@nousefreak.be>
*/
class AliasType extends AbstractType
class AliasFormType extends AbstractType
{
/**
* @param FormBuilderInterface $builder
Expand Down
6 changes: 4 additions & 2 deletions src/Clastic/AliasBundle/Tests/Unit/Form/AliasFormTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
namespace Clastic\AliasBundle\Tests\Unit\Form;

use Clastic\AliasBundle\Entity\Alias;
use Clastic\AliasBundle\Form\Type\AliasFormType;
use Clastic\AliasBundle\Form\TypeAliasFormType;
use Clastic\AliasBundle\Form\AliasType;
use Clastic\BackofficeBundle\Form\Type\TabsTabActionsType;
use Clastic\BackofficeBundle\Form\Type\TabsTabType;
Expand Down Expand Up @@ -54,7 +56,7 @@ public function testFormAlias()
),
);

$type = new AliasType();
$type = new AliasFormType();
$form = $this->factory->create($type, new Alias());

// submit the data to the form directly
Expand All @@ -72,7 +74,7 @@ public function testFormEmpty()
{
$formData = array();

$type = new AliasType();
$type = new AliasFormType();
$form = $this->factory->create($type, new Alias());

// submit the data to the form directly
Expand Down
2 changes: 1 addition & 1 deletion src/Clastic/BackofficeBundle/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
vendor/
composer.lock
phpunit.xml
phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

namespace Clastic\BackofficeBundle\Controller;

use Clastic\BackofficeBundle\Form\DeleteType;
use Clastic\BackofficeBundle\Form\Type\DeleteFormType;
use Clastic\CoreBundle\Module\ModuleInterface;
use Clastic\CoreBundle\Module\SubmoduleInterface;
use Doctrine\ORM\QueryBuilder;
Expand Down Expand Up @@ -176,7 +176,7 @@ public function deleteAction($id, Request $request)
$breadcrumbs = $this->buildBreadcrumbs($this->getType());
$breadcrumbs->addItem(sprintf('Delete "%s"', $this->resolveDataTitle($data)));

$form = $this->createForm(new DeleteType(), array(
$form = $this->createForm(new DeleteFormType(), array(
'id' => $data->getId(),
'title' => $title,
));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@
* file that was distributed with this source code.
*/

namespace Clastic\BackofficeBundle\Form;
namespace Clastic\BackofficeBundle\Form\Type;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;

/**
* DeleteType
* DeleteForm
*
* @author Dries De Peuter <dries@nousefreak.be>
*/
class DeleteType extends AbstractType
class DeleteFormType extends AbstractType
{
/**
* {@inheritdoc}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* file that was distributed with this source code.
*/

namespace Clastic\BackofficeBundle\Form;
namespace Clastic\BackofficeBundle\Form\Type;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
Expand All @@ -17,7 +17,7 @@
*
* @author Dries De Peuter <dries@nousefreak.be>
*/
class SettingsType extends AbstractType
class SettingsFormType extends AbstractType
{
/**
* {@inheritdoc}
Expand Down
2 changes: 1 addition & 1 deletion src/Clastic/BackofficeBundle/Resources/config/services.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<parameter key="clastic.backoffice.type.entity_hidden.class">Clastic\BackofficeBundle\Form\Type\EntityHiddenType</parameter>
<parameter key="clastic.backoffice.type.entity_multi_select.class">Clastic\BackofficeBundle\Form\Type\EntityMultiSelectType</parameter>
<parameter key="clastic.backoffice.type.tree.class">Clastic\BackofficeBundle\Form\Type\TreeType</parameter>
<parameter key="clastic.backoffice.type.settings.class">Clastic\BackofficeBundle\Form\SettingsType</parameter>
<parameter key="clastic.backoffice.type.settings.class">Clastic\BackofficeBundle\Form\Type\SettingsFormType</parameter>
<parameter key="clastic.backoffice.type.fieldset.class">Clastic\BackofficeBundle\Form\Type\FieldsetType</parameter>
<parameter key="clastic.backoffice.type.link.class">Clastic\BackofficeBundle\Form\Type\LinkType</parameter>
<parameter key="clastic.backoffice.node.form_build.class">Clastic\BackofficeBundle\EventListener\NodeFormBuildListener</parameter>
Expand Down
2 changes: 1 addition & 1 deletion src/Clastic/BackofficeBundle/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@
"psr-4": { "Clastic\\BackofficeBundle\\": "" }
},
"minimum-stability": "dev"
}
}
2 changes: 1 addition & 1 deletion src/Clastic/BlockBundle/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
vendor/
composer.lock
phpunit.xml
phpunit.xml
4 changes: 2 additions & 2 deletions src/Clastic/BlockBundle/Controller/BlockController.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

use Clastic\BackofficeBundle\Controller\AbstractModuleController;
use Clastic\BlockBundle\Entity\Block;
use Clastic\BlockBundle\Form\BlockType;
use Clastic\BlockBundle\Form\Type\BlockFormType;
use Clastic\NodeBundle\Node\NodeReferenceInterface;
use Symfony\Component\Form\Form;

Expand Down Expand Up @@ -45,7 +45,7 @@ protected function getListTemplate()
*/
protected function buildForm($data)
{
return $this->createForm(new BlockType(), $data);
return $this->createForm(new BlockFormType(), $data);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* file that was distributed with this source code.
*/

namespace Clastic\BlockBundle\Form;
namespace Clastic\BlockBundle\Form\Type;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
Expand All @@ -18,7 +18,7 @@
*
* @author Dries De Peuter <dries@nousefreak.be>
*/
class BlockType extends AbstractType
class BlockFormType extends AbstractType
{
/**
* @param FormBuilderInterface $builder
Expand Down
2 changes: 1 addition & 1 deletion src/Clastic/BlogBundle/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
vendor/
composer.lock
phpunit.xml
phpunit.xml
2 changes: 1 addition & 1 deletion src/Clastic/CoreBundle/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
vendor/
composer.lock
phpunit.xml
phpunit.xml
2 changes: 1 addition & 1 deletion src/Clastic/FrontBundle/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
vendor/
composer.lock
phpunit.xml
phpunit.xml
2 changes: 1 addition & 1 deletion src/Clastic/FrontBundle/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@
"psr-4": { "Clastic\\FrontBundle\\": "" }
},
"minimum-stability": "dev"
}
}
2 changes: 1 addition & 1 deletion src/Clastic/GeneratorBundle/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
vendor/
composer.lock
phpunit.xml
phpunit.xml
13 changes: 0 additions & 13 deletions src/Clastic/GeneratorBundle/Generator/ModuleGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

use Sensio\Bundle\GeneratorBundle\Generator\Generator;
use Symfony\Component\DependencyInjection\Container;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\HttpKernel\Bundle\BundleInterface;

/**
Expand All @@ -21,18 +20,6 @@
*/
class ModuleGenerator extends Generator
{
private $filesystem;

/**
* Constructor.
*
* @param Filesystem $filesystem A Filesystem instance
*/
public function __construct(Filesystem $filesystem)
{
$this->filesystem = $filesystem;
}

/**
* @param BundleInterface $bundle
* @param string $module
Expand Down
2 changes: 1 addition & 1 deletion src/Clastic/GeneratorBundle/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@
"psr-4": { "Clastic\\GeneratorBundle\\": "" }
},
"minimum-stability": "dev"
}
}
2 changes: 1 addition & 1 deletion src/Clastic/MediaBundle/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
vendor/
composer.lock
phpunit.xml
phpunit.xml
14 changes: 7 additions & 7 deletions src/Clastic/MediaBundle/Controller/MediaController.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

use Clastic\BackofficeBundle\Controller\AbstractModuleController;
use Clastic\MediaBundle\Entity\File;
use Clastic\MediaBundle\Form\FileType;
use Clastic\MediaBundle\Form\Type\FileFormType;
use Symfony\Component\Form\Form;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
Expand Down Expand Up @@ -41,7 +41,7 @@ public function listAction(Request $request)
$this->buildBreadcrumbs($this->getType());

$file = new File();
$form = $this->createForm(new FileType(), $file);
$form = $this->createForm(new FileFormType(), $file);

$form->handleRequest($request);

Expand Down Expand Up @@ -70,15 +70,15 @@ public function listAction(Request $request)
*/
protected function resolveData($id)
{
// TODO: Implement resolveData() method.
return null;
}

/**
* @return string
*/
protected function getListTemplate()
{
// TODO: Implement getListTemplate() method.
return null;
}

/**
Expand All @@ -88,7 +88,7 @@ protected function getListTemplate()
*/
protected function buildForm($data)
{
// TODO: Implement buildForm() method.
return null;
}

/**
Expand All @@ -98,14 +98,14 @@ protected function buildForm($data)
*/
protected function resolveDataTitle($data)
{
// TODO: Implement resolveDataTitle() method.
return null;
}

/**
* @return string
*/
protected function getEntityName()
{
// TODO: Implement getEntityName() method.
return null;
}
}
8 changes: 8 additions & 0 deletions src/Clastic/MediaBundle/ElFinder/ElFinderEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,12 @@ public function __construct(array $data)
{
$this->data = $data;
}

/**
* @return array
*/
public function getData()
{
return $this->data;
}
}
8 changes: 8 additions & 0 deletions src/Clastic/MediaBundle/Entity/Directory.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,4 +124,12 @@ public function getChildren()
{
return $this->children;
}

/**
* @return ArrayCollection
*/
public function getFiles()
{
return $this->files;
}
}
15 changes: 14 additions & 1 deletion src/Clastic/MediaBundle/EventListener/FileListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,19 @@
*/
class FileListener implements EventSubscriber
{
/**
* @var string
*/
private $kernelDir;

/**
* @param string $kernelDir
*/
public function __construct($kernelDir)
{
$this->kernelDir = $kernelDir;
}

/**
* Returns an array of events this subscriber wants to listen to.
*
Expand Down Expand Up @@ -142,6 +155,6 @@ protected function getUploadRootDir()
{
// the absolute directory path where uploaded
// documents should be saved
return __DIR__.'/../../../../web/'.$this->getUploadDir();
return $this->kernelDir . '/../web/'.$this->getUploadDir();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* file that was distributed with this source code.
*/

namespace Clastic\MediaBundle\Form;
namespace Clastic\MediaBundle\Form\Type;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
Expand All @@ -16,7 +16,7 @@
/**
* @author Dries De Peuter <dries@nousefreak.be>
*/
class FileType extends AbstractType
class FileFormType extends AbstractType
{
/**
* @param FormBuilderInterface $builder
Expand Down

0 comments on commit e4d51ae

Please sign in to comment.