diff --git a/src/Trinity/Bundle/ContactBundle/Model/ContactInterface.php b/src/Trinity/Bundle/ContactBundle/Model/ContactInterface.php index b4e5f0f..2c3f00c 100644 --- a/src/Trinity/Bundle/ContactBundle/Model/ContactInterface.php +++ b/src/Trinity/Bundle/ContactBundle/Model/ContactInterface.php @@ -11,4 +11,4 @@ interface ContactInterface public function getEmail(); public function getMessage(); -} \ No newline at end of file +} diff --git a/src/Trinity/Bundle/NewsletterBundle/Configuration/ModelConfiguration.php b/src/Trinity/Bundle/NewsletterBundle/Configuration/ModelConfiguration.php index bf4b520..0181efb 100644 --- a/src/Trinity/Bundle/NewsletterBundle/Configuration/ModelConfiguration.php +++ b/src/Trinity/Bundle/NewsletterBundle/Configuration/ModelConfiguration.php @@ -35,5 +35,4 @@ class ModelConfiguration { return $this->blocks; } - -} \ No newline at end of file +} diff --git a/src/Trinity/Bundle/NewsletterBundle/Form/EventListener/AddBlockFieldsSubscriber.php b/src/Trinity/Bundle/NewsletterBundle/Form/EventListener/AddBlockFieldsSubscriber.php index 238fd56..5c80780 100644 --- a/src/Trinity/Bundle/NewsletterBundle/Form/EventListener/AddBlockFieldsSubscriber.php +++ b/src/Trinity/Bundle/NewsletterBundle/Form/EventListener/AddBlockFieldsSubscriber.php @@ -34,5 +34,4 @@ class AddBlockFieldsSubscriber implements EventSubscriberInterface } } } - -} \ No newline at end of file +} diff --git a/src/Trinity/Bundle/NotificationBundle/Controller/NotificationAdminController.php b/src/Trinity/Bundle/NotificationBundle/Controller/NotificationAdminController.php index 6c78d27..eb90ae8 100644 --- a/src/Trinity/Bundle/NotificationBundle/Controller/NotificationAdminController.php +++ b/src/Trinity/Bundle/NotificationBundle/Controller/NotificationAdminController.php @@ -90,4 +90,4 @@ class NotificationAdminController extends BaseAdminController { return parent::rankAction($request); } -} \ No newline at end of file +} diff --git a/src/Trinity/Bundle/SearchBundle/Command/BuildIndexCommand.php b/src/Trinity/Bundle/SearchBundle/Command/BuildIndexCommand.php index 5feeaf4..8f0f67f 100644 --- a/src/Trinity/Bundle/SearchBundle/Command/BuildIndexCommand.php +++ b/src/Trinity/Bundle/SearchBundle/Command/BuildIndexCommand.php @@ -8,8 +8,6 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Finder\Finder; -use Trinity\Bundle\ContentManagerBundle\Model\PageQuery; - class BuildIndexCommand extends ContainerAwareCommand { protected function configure() @@ -46,18 +44,12 @@ EOF return $namespace.'\\'.str_replace('.php', 'Query', $file->getFilename()); } - protected function execute(InputInterface $input, OutputInterface $output) { $dialog = $this->getDialogHelper(); if ($input->isInteractive()) { - if (!$dialog->askConfirmation( - $output, - $dialog->getQuestion('Do you confirm generation', 'yes', '?'), - true - ) - ) { + if (!$dialog->askConfirmation($output, $dialog->getQuestion('Do you confirm generation', 'yes', '?'), true)) { $output->writeln( array( '', @@ -163,7 +155,6 @@ EOF $indexed_elements++; } - $output->writeln( array( ''.$query.' number of indexed elements : '.$indexed_elements.'', @@ -209,4 +200,4 @@ EOF return $dialog; } -} \ No newline at end of file +} diff --git a/src/Trinity/Bundle/SearchBundle/Controller/SearchController.php b/src/Trinity/Bundle/SearchBundle/Controller/SearchController.php index 6b7b477..4008ed2 100644 --- a/src/Trinity/Bundle/SearchBundle/Controller/SearchController.php +++ b/src/Trinity/Bundle/SearchBundle/Controller/SearchController.php @@ -2,14 +2,9 @@ namespace Trinity\Bundle\SearchBundle\Controller; -use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; -use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template; use Symfony\Component\HttpFoundation\Request; use Trinity\Bundle\ContentManagerBundle\Controller\PageController; -use Trinity\Bundle\ContentManagerBundle\Exception\NavigationNotFoundException; -use Trinity\Bundle\ContentManagerBundle\Exception\PageNotFoundException; -use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter; use Trinity\Bundle\SearchBundle\Model\SearchObject; @@ -17,10 +12,8 @@ use Trinity\Bundle\ContentManagerBundle\Model\PageQuery; use Zend\Search\Lucene\Index\Term; use Zend\Search\Lucene\Search\Query\Boolean as ZendBooleanQuery; use Zend\Search\Lucene\Search\Query\Fuzzy as FuzzyQuery; -use Zend\Search\Lucene\Search\Query\MultiTerm; use Zend\Search\Lucene\Search\QueryParser; - class SearchController extends PageController { diff --git a/src/Trinity/Bundle/SearchBundle/DependencyInjection/Configuration.php b/src/Trinity/Bundle/SearchBundle/DependencyInjection/Configuration.php index 58c482b..83956d2 100644 --- a/src/Trinity/Bundle/SearchBundle/DependencyInjection/Configuration.php +++ b/src/Trinity/Bundle/SearchBundle/DependencyInjection/Configuration.php @@ -23,7 +23,6 @@ class Configuration implements ConfigurationInterface // Here you should define the parameters that are allowed to // configure your bundle. See the documentation linked above for // more information on that topic. - return $treeBuilder; } } diff --git a/src/Trinity/Bundle/SearchBundle/Event/LuceneEvent.php b/src/Trinity/Bundle/SearchBundle/Event/LuceneEvent.php index 49d58a3..1919166 100644 --- a/src/Trinity/Bundle/SearchBundle/Event/LuceneEvent.php +++ b/src/Trinity/Bundle/SearchBundle/Event/LuceneEvent.php @@ -40,4 +40,4 @@ class LuceneEvent extends Event { return $this->object; } -} \ No newline at end of file +} diff --git a/src/Trinity/Bundle/SearchBundle/EventListener/LuceneSubscriber.php b/src/Trinity/Bundle/SearchBundle/EventListener/LuceneSubscriber.php index 8556f8d..a2f27c4 100644 --- a/src/Trinity/Bundle/SearchBundle/EventListener/LuceneSubscriber.php +++ b/src/Trinity/Bundle/SearchBundle/EventListener/LuceneSubscriber.php @@ -1,10 +1,8 @@ setDefaultControllerClass('Trinity\Bundle\SearchBundle\Controller\SearchController::indexAction'); } - public function __construct($template = null) { parent::__construct(null !== $template ? $template : 'TrinitySearchBundle:Search:index.html.twig'); diff --git a/src/Trinity/Bundle/SearchBundle/TrinitySearchEvents.php b/src/Trinity/Bundle/SearchBundle/TrinitySearchEvents.php index 24e1761..db32c73 100644 --- a/src/Trinity/Bundle/SearchBundle/TrinitySearchEvents.php +++ b/src/Trinity/Bundle/SearchBundle/TrinitySearchEvents.php @@ -18,4 +18,4 @@ final class TrinitySearchEvents * The REMOVE_INDEX event occurs when the object delete process succeeded. */ const LUCENE_REMOVE_INDEX = "trinity_search.lucene.remove_index"; -} \ No newline at end of file +} diff --git a/src/Trinity/Bundle/SearchBundle/Twig/Extension/HighlightExtension.php b/src/Trinity/Bundle/SearchBundle/Twig/Extension/HighlightExtension.php index 502f45b..1c1020a 100644 --- a/src/Trinity/Bundle/SearchBundle/Twig/Extension/HighlightExtension.php +++ b/src/Trinity/Bundle/SearchBundle/Twig/Extension/HighlightExtension.php @@ -2,20 +2,23 @@ namespace Trinity\Bundle\SearchBundle\Twig\Extension; -class HighlightExtension extends \Twig_Extension { - - public function getFilters() { +class HighlightExtension extends \Twig_Extension +{ + public function getFilters() + { return array( 'highlight' => new \Twig_Filter_Method($this, 'highlight'), ); } - public function highlight($sentence, $expr) { + public function highlight($sentence, $expr) + { $expr = explode(' ', $expr); foreach ($expr as $word) { $sentence = preg_replace('/(' . $word . ')/i', '\1', $sentence); } + return $sentence; } @@ -24,4 +27,4 @@ class HighlightExtension extends \Twig_Extension { return 'highlight_extension'; } -} \ No newline at end of file +} diff --git a/src/Trinity/Bundle/SecurityBundle/DependencyInjection/Configuration.php b/src/Trinity/Bundle/SecurityBundle/DependencyInjection/Configuration.php index 1447af3..a0897a2 100644 --- a/src/Trinity/Bundle/SecurityBundle/DependencyInjection/Configuration.php +++ b/src/Trinity/Bundle/SecurityBundle/DependencyInjection/Configuration.php @@ -23,7 +23,6 @@ class Configuration implements ConfigurationInterface // Here you should define the parameters that are allowed to // configure your bundle. See the documentation linked above for // more information on that topic. - return $treeBuilder; } } diff --git a/src/Trinity/Bundle/SlideshowBundle/DependencyInjection/Configuration.php b/src/Trinity/Bundle/SlideshowBundle/DependencyInjection/Configuration.php index ad823ca..0c7b3b7 100644 --- a/src/Trinity/Bundle/SlideshowBundle/DependencyInjection/Configuration.php +++ b/src/Trinity/Bundle/SlideshowBundle/DependencyInjection/Configuration.php @@ -23,7 +23,6 @@ class Configuration implements ConfigurationInterface // Here you should define the parameters that are allowed to // configure your bundle. See the documentation linked above for // more information on that topic. - return $treeBuilder; } } diff --git a/src/Trinity/Bundle/SlideshowBundle/Form/Extension/Type/FileImageType.php b/src/Trinity/Bundle/SlideshowBundle/Form/Extension/Type/FileImageType.php index fb56af8..58f505c 100644 --- a/src/Trinity/Bundle/SlideshowBundle/Form/Extension/Type/FileImageType.php +++ b/src/Trinity/Bundle/SlideshowBundle/Form/Extension/Type/FileImageType.php @@ -3,9 +3,6 @@ namespace Trinity\Bundle\SlideshowBundle\Form\Extension\Type; use Symfony\Component\Form\AbstractType; -use Symfony\Component\Form\FormInterface; -use Symfony\Component\Form\FormView; -use Symfony\Component\OptionsResolver\OptionsResolverInterface; class FileImageType extends AbstractType { @@ -17,7 +14,6 @@ class FileImageType extends AbstractType return 'file'; } - /** * {@inheritdoc} */ @@ -26,4 +22,3 @@ class FileImageType extends AbstractType return 'file_image'; } } - diff --git a/src/Trinity/Bundle/SlideshowBundle/Form/Extension/Type/PersoType.php b/src/Trinity/Bundle/SlideshowBundle/Form/Extension/Type/PersoType.php index 28a0208..5735a03 100644 --- a/src/Trinity/Bundle/SlideshowBundle/Form/Extension/Type/PersoType.php +++ b/src/Trinity/Bundle/SlideshowBundle/Form/Extension/Type/PersoType.php @@ -3,8 +3,6 @@ namespace Trinity\Bundle\SlideshowBundle\Form\Extension\Type; use Symfony\Component\Form\AbstractType; -use Symfony\Component\Form\FormInterface; -use Symfony\Component\Form\FormView; use Symfony\Component\OptionsResolver\OptionsResolverInterface; class PersoType extends AbstractType @@ -51,4 +49,3 @@ class PersoType extends AbstractType return 'perso'; } } - diff --git a/src/Trinity/Bundle/SlideshowBundle/Form/Type/SlideshowItemsContainerBlockType.php b/src/Trinity/Bundle/SlideshowBundle/Form/Type/SlideshowItemsContainerBlockType.php index ab17c02..f14e72e 100644 --- a/src/Trinity/Bundle/SlideshowBundle/Form/Type/SlideshowItemsContainerBlockType.php +++ b/src/Trinity/Bundle/SlideshowBundle/Form/Type/SlideshowItemsContainerBlockType.php @@ -6,7 +6,6 @@ use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormView; use Symfony\Component\Form\FormInterface; use Trinity\Bundle\SlideshowBundle\Block\SlideshowItemsContainerBlock; -use Trinity\Bundle\SlideshowBundle\Model\SlideshowItemQuery; use Trinity\Bundle\ContentManagerBundle\Form\Type\BlockType; class SlideshowItemsContainerBlockType extends BlockType @@ -48,9 +47,8 @@ class SlideshowItemsContainerBlockType extends BlockType )); } - public function getName() { return 'slideshow_items_container_block'; } -} \ No newline at end of file +} diff --git a/src/Trinity/Bundle/UserBundle/Configuration/GroupCrudConfiguration.php b/src/Trinity/Bundle/UserBundle/Configuration/GroupCrudConfiguration.php index 0af3caa..7166838 100644 --- a/src/Trinity/Bundle/UserBundle/Configuration/GroupCrudConfiguration.php +++ b/src/Trinity/Bundle/UserBundle/Configuration/GroupCrudConfiguration.php @@ -34,14 +34,14 @@ class GroupCrudConfiguration extends \Trinity\Bundle\AdminBundle\Configuration\C ->setEditTitle('Edition of "%name%"') ->setMaxPerPage(20) - ->setFieldTemplate('roles', 'TrinityUserBundle:GroupAdmin:roles.html.twig') - - ->setDisplayFields(array( - 'id', - 'code', - 'name', - 'roles' - )) + ->setFieldTemplate('roles', 'TrinityUserBundle:GroupAdmin:roles.html.twig') + + ->setDisplayFields(array( + 'id', + 'code', + 'name', + 'roles' + )) ; } } diff --git a/src/Trinity/Bundle/UserBundle/Configuration/UserLogCrudConfiguration.php b/src/Trinity/Bundle/UserBundle/Configuration/UserLogCrudConfiguration.php index 4b0afd1..1074c66 100644 --- a/src/Trinity/Bundle/UserBundle/Configuration/UserLogCrudConfiguration.php +++ b/src/Trinity/Bundle/UserBundle/Configuration/UserLogCrudConfiguration.php @@ -23,7 +23,7 @@ class UserLogCrudConfiguration extends \Trinity\Bundle\AdminBundle\Configuration ->setEditTitle('Edition of "%message%"') ->setMaxPerPage(20) - ->setSort('orderById', \Criteria::DESC) + ->setSort('orderById', \Criteria::DESC) ->removeIndexAction('new') diff --git a/src/Trinity/Bundle/UserBundle/Controller/SecurityAdminController.php b/src/Trinity/Bundle/UserBundle/Controller/SecurityAdminController.php index 82696ae..77cf73a 100644 --- a/src/Trinity/Bundle/UserBundle/Controller/SecurityAdminController.php +++ b/src/Trinity/Bundle/UserBundle/Controller/SecurityAdminController.php @@ -9,84 +9,84 @@ use \FOS\UserBundle\Controller\SecurityController as BaseSecurityController; class SecurityAdminController extends BaseSecurityController { - public function loginAction(Request $request) - { - /** @var $session \Symfony\Component\HttpFoundation\Session\Session */ - $session = $request->getSession(); + public function loginAction(Request $request) + { + /** @var $session \Symfony\Component\HttpFoundation\Session\Session */ + $session = $request->getSession(); - // get the error if any (works with forward and redirect -- see below) - if ($request->attributes->has(SecurityContext::AUTHENTICATION_ERROR)) { - $error = $request->attributes->get(SecurityContext::AUTHENTICATION_ERROR); - } elseif (null !== $session && $session->has(SecurityContext::AUTHENTICATION_ERROR)) { - $error = $session->get(SecurityContext::AUTHENTICATION_ERROR); - $session->remove(SecurityContext::AUTHENTICATION_ERROR); - } else { - $error = ''; - } + // get the error if any (works with forward and redirect -- see below) + if ($request->attributes->has(SecurityContext::AUTHENTICATION_ERROR)) { + $error = $request->attributes->get(SecurityContext::AUTHENTICATION_ERROR); + } elseif (null !== $session && $session->has(SecurityContext::AUTHENTICATION_ERROR)) { + $error = $session->get(SecurityContext::AUTHENTICATION_ERROR); + $session->remove(SecurityContext::AUTHENTICATION_ERROR); + } else { + $error = ''; + } - if ($error) { - // TODO: this is a potential security risk (see http://trac.symfony-project.org/ticket/9523) - $error = $error->getMessage(); - } - // last username entered by the user - $lastUsername = (null === $session) ? '' : $session->get(SecurityContext::LAST_USERNAME); + if ($error) { + // TODO: this is a potential security risk (see http://trac.symfony-project.org/ticket/9523) + $error = $error->getMessage(); + } + // last username entered by the user + $lastUsername = (null === $session) ? '' : $session->get(SecurityContext::LAST_USERNAME); - $csrfToken = $this->container->has('form.csrf_provider') - ? $this->container->get('form.csrf_provider')->generateCsrfToken('authenticate') - : null; + $csrfToken = $this->container->has('form.csrf_provider') + ? $this->container->get('form.csrf_provider')->generateCsrfToken('authenticate') + : null; - if ($request->isXmlHttpRequest()) { - return $this->renderXhrLogin(array( - 'last_username' => $lastUsername, - 'error' => $error, - 'csrf_token' => $csrfToken, - )); - } else { - return $this->renderLogin(array( - 'last_username' => $lastUsername, - 'error' => $error, - 'csrf_token' => $csrfToken, - 'logo' => '/bundles/trinityadminmenu/img/logo_signin.png' - )); - } - } + if ($request->isXmlHttpRequest()) { + return $this->renderXhrLogin(array( + 'last_username' => $lastUsername, + 'error' => $error, + 'csrf_token' => $csrfToken, + )); + } else { + return $this->renderLogin(array( + 'last_username' => $lastUsername, + 'error' => $error, + 'csrf_token' => $csrfToken, + 'logo' => '/bundles/trinityadminmenu/img/logo_signin.png' + )); + } + } - protected function renderLogin(array $data) - { - $template = sprintf('TrinityUserBundle:Security\Admin:login.html.%s', $this->container->getParameter('fos_user.template.engine')); + protected function renderLogin(array $data) + { + $template = sprintf('TrinityUserBundle:Security\Admin:login.html.%s', $this->container->getParameter('fos_user.template.engine')); - return $this->container->get('templating')->renderResponse($template, $data); - } + return $this->container->get('templating')->renderResponse($template, $data); + } - protected function renderXhrLogin(array $data) - { - $template = sprintf('TrinityUserBundle:Security\Admin:loginXHR.html.%s', $this->container->getParameter('fos_user.template.engine')); + protected function renderXhrLogin(array $data) + { + $template = sprintf('TrinityUserBundle:Security\Admin:loginXHR.html.%s', $this->container->getParameter('fos_user.template.engine')); - return $this->container->get('templating')->renderResponse($template, $data); - } + return $this->container->get('templating')->renderResponse($template, $data); + } - public function checkAction() - { - throw new \RuntimeException('You must configure the check path to be handled by the firewall using form_login in your security firewall configuration.'); - } + public function checkAction() + { + throw new \RuntimeException('You must configure the check path to be handled by the firewall using form_login in your security firewall configuration.'); + } - public function xhrcheckAction(Request $request) - { - if (false === $this->container->get('request')->isXmlHttpRequest()) { - throw new \RuntimeException('This action is allowed in XHR context only.'); - } + public function xhrcheckAction(Request $request) + { + if (false === $this->container->get('request')->isXmlHttpRequest()) { + throw new \RuntimeException('This action is allowed in XHR context only.'); + } - $result = array('success' => true); + $result = array('success' => true); - if (false === $this->container->get('security.context')->isGranted($this->container->getParameter('trinity_user.bo_auth_role'))) { - $result = array('success' => false); - } + if (false === $this->container->get('security.context')->isGranted($this->container->getParameter('trinity_user.bo_auth_role'))) { + $result = array('success' => false); + } - $response = new Response(json_encode($result)); - $response->headers->set('Content-Type', 'application/json'); + $response = new Response(json_encode($result)); + $response->headers->set('Content-Type', 'application/json'); - return $response; + return $response; - } + } } diff --git a/src/Trinity/Bundle/UserBundle/Controller/SecurityController.php b/src/Trinity/Bundle/UserBundle/Controller/SecurityController.php index 41b9224..88c4372 100644 --- a/src/Trinity/Bundle/UserBundle/Controller/SecurityController.php +++ b/src/Trinity/Bundle/UserBundle/Controller/SecurityController.php @@ -2,9 +2,6 @@ namespace Trinity\Bundle\UserBundle\Controller; -use \Symfony\Component\HttpFoundation\Request; -use \Symfony\Component\HttpFoundation\Response; -use Symfony\Component\Security\Core\SecurityContext; use \FOS\UserBundle\Controller\SecurityController as BaseSecurityController; class SecurityController extends BaseSecurityController diff --git a/src/Trinity/Bundle/UserBundle/Controller/UserLogAdminController.php b/src/Trinity/Bundle/UserBundle/Controller/UserLogAdminController.php index 8216819..ec70f76 100644 --- a/src/Trinity/Bundle/UserBundle/Controller/UserLogAdminController.php +++ b/src/Trinity/Bundle/UserBundle/Controller/UserLogAdminController.php @@ -15,7 +15,6 @@ use Symfony\Component\HttpFoundation\Request; use Trinity\Bundle\UserBundle\Configuration\UserLogCrudConfiguration as CrudConfiguration; use Trinity\Bundle\UserBundle\Form\Type\UserLogBatchType as BatchType; - /** * @Route("/admin/userlog") */ diff --git a/src/Trinity/Bundle/UserBundle/Flash/Flash.php b/src/Trinity/Bundle/UserBundle/Flash/Flash.php index 3a3d315..77a3059 100644 --- a/src/Trinity/Bundle/UserBundle/Flash/Flash.php +++ b/src/Trinity/Bundle/UserBundle/Flash/Flash.php @@ -4,17 +4,17 @@ namespace Trinity\Bundle\UserBundle\Flash; abstract class Flash { - protected $message = null; + protected $message = null; - public function __construct($message) - { - $this->message = $message; - } + public function __construct($message) + { + $this->message = $message; + } - public function getMessage() - { - return $this->message; - } + public function getMessage() + { + return $this->message; + } - abstract public function getTemplate(); + abstract public function getTemplate(); } diff --git a/src/Trinity/Bundle/UserBundle/Flash/FlashContainer.php b/src/Trinity/Bundle/UserBundle/Flash/FlashContainer.php index 463f23a..6c205c6 100644 --- a/src/Trinity/Bundle/UserBundle/Flash/FlashContainer.php +++ b/src/Trinity/Bundle/UserBundle/Flash/FlashContainer.php @@ -4,22 +4,22 @@ namespace Trinity\Bundle\UserBundle\Flash; class FlashContainer { - protected $flash; - protected $persist; + protected $flash; + protected $persist; - public function __construct(Flash $flash, $persist) - { - $this->flash = $flash; - $this->persist = $persist; - } + public function __construct(Flash $flash, $persist) + { + $this->flash = $flash; + $this->persist = $persist; + } - public function getFlash() - { - return $this->flash; - } + public function getFlash() + { + return $this->flash; + } - public function getPersist() - { - return $this->persist; - } + public function getPersist() + { + return $this->persist; + } } diff --git a/src/Trinity/Bundle/UserBundle/Flash/FlashError.php b/src/Trinity/Bundle/UserBundle/Flash/FlashError.php index 81d2c12..4bcac3e 100644 --- a/src/Trinity/Bundle/UserBundle/Flash/FlashError.php +++ b/src/Trinity/Bundle/UserBundle/Flash/FlashError.php @@ -4,8 +4,8 @@ namespace Trinity\Bundle\UserBundle\Flash; class FlashError extends Flash { - public function getTemplate() - { - return 'TrinityAdminBundle:BaseAdmin:flashError.html.twig'; - } + public function getTemplate() + { + return 'TrinityAdminBundle:BaseAdmin:flashError.html.twig'; + } } diff --git a/src/Trinity/Bundle/UserBundle/Flash/FlashNotice.php b/src/Trinity/Bundle/UserBundle/Flash/FlashNotice.php index 0009f49..c8eafae 100644 --- a/src/Trinity/Bundle/UserBundle/Flash/FlashNotice.php +++ b/src/Trinity/Bundle/UserBundle/Flash/FlashNotice.php @@ -4,8 +4,8 @@ namespace Trinity\Bundle\UserBundle\Flash; class FlashNotice extends Flash { - public function getTemplate() - { - return 'TrinityAdminBundle:BaseAdmin:flashNotice.html.twig'; - } + public function getTemplate() + { + return 'TrinityAdminBundle:BaseAdmin:flashNotice.html.twig'; + } } diff --git a/src/Trinity/Bundle/UserBundle/Flash/FlashSuccess.php b/src/Trinity/Bundle/UserBundle/Flash/FlashSuccess.php index bce7416..8bfd8ce 100644 --- a/src/Trinity/Bundle/UserBundle/Flash/FlashSuccess.php +++ b/src/Trinity/Bundle/UserBundle/Flash/FlashSuccess.php @@ -4,8 +4,8 @@ namespace Trinity\Bundle\UserBundle\Flash; class FlashSuccess extends Flash { - public function getTemplate() - { - return 'TrinityAdminBundle:BaseAdmin:flashSuccess.html.twig'; - } + public function getTemplate() + { + return 'TrinityAdminBundle:BaseAdmin:flashSuccess.html.twig'; + } } diff --git a/src/Trinity/Bundle/UserBundle/Flash/FlashWarning.php b/src/Trinity/Bundle/UserBundle/Flash/FlashWarning.php index 8a3fd90..b36d526 100644 --- a/src/Trinity/Bundle/UserBundle/Flash/FlashWarning.php +++ b/src/Trinity/Bundle/UserBundle/Flash/FlashWarning.php @@ -4,8 +4,8 @@ namespace Trinity\Bundle\UserBundle\Flash; class FlashWarning extends Flash { - public function getTemplate() - { - return 'TrinityAdminBundle:BaseAdmin:flashWarning.html.twig'; - } + public function getTemplate() + { + return 'TrinityAdminBundle:BaseAdmin:flashWarning.html.twig'; + } } diff --git a/src/Trinity/Bundle/UserBundle/Form/EventListener/AddCodeFieldSubscriber.php b/src/Trinity/Bundle/UserBundle/Form/EventListener/AddCodeFieldSubscriber.php index ce56754..8118fd8 100644 --- a/src/Trinity/Bundle/UserBundle/Form/EventListener/AddCodeFieldSubscriber.php +++ b/src/Trinity/Bundle/UserBundle/Form/EventListener/AddCodeFieldSubscriber.php @@ -32,5 +32,4 @@ class AddCodeFieldSubscriber implements EventSubscriberInterface ); } } - -} \ No newline at end of file +} diff --git a/src/Trinity/Bundle/UserBundle/Form/Type/MyProfileType.php b/src/Trinity/Bundle/UserBundle/Form/Type/MyProfileType.php index f101450..b9aa0c1 100644 --- a/src/Trinity/Bundle/UserBundle/Form/Type/MyProfileType.php +++ b/src/Trinity/Bundle/UserBundle/Form/Type/MyProfileType.php @@ -4,7 +4,6 @@ namespace Trinity\Bundle\UserBundle\Form\Type; use Symfony\Component\Form\FormBuilderInterface; use FOS\UserBundle\Form\Type\ProfileFormType as BaseType; -use Trinity\Bundle\UserBundle\Form\Type\ProfileType; class MyProfileType extends BaseType { @@ -29,4 +28,3 @@ class MyProfileType extends BaseType return 'trinity_user_profile'; } } - diff --git a/src/Trinity/Bundle/UserBundle/Form/Type/UserLogBatchType.php b/src/Trinity/Bundle/UserBundle/Form/Type/UserLogBatchType.php index 76d1d99..85ac48c 100644 --- a/src/Trinity/Bundle/UserBundle/Form/Type/UserLogBatchType.php +++ b/src/Trinity/Bundle/UserBundle/Form/Type/UserLogBatchType.php @@ -10,26 +10,26 @@ class UserLogBatchType extends BaseBatchType public function buildForm(FormBuilderInterface $builder, array $options) { $builder->add( - 'objects', - 'choice', - array( - 'required' => true, - 'multiple' => true, - 'expanded' => true, - ) - ); + 'objects', + 'choice', + array( + 'required' => true, + 'multiple' => true, + 'expanded' => true, + ) + ); - $builder->add( - 'action', - 'choice', - array( - 'required' => true, - 'choices' => array( - self::BATCH_REMOVE => 'Remove', - ), - 'multiple' => false, - ) - ); + $builder->add( + 'action', + 'choice', + array( + 'required' => true, + 'choices' => array( + self::BATCH_REMOVE => 'Remove', + ), + 'multiple' => false, + ) + ); } } diff --git a/src/Trinity/Bundle/UserBundle/Form/Type/UserLogFilterType.php b/src/Trinity/Bundle/UserBundle/Form/Type/UserLogFilterType.php index 00d08f1..4c74661 100644 --- a/src/Trinity/Bundle/UserBundle/Form/Type/UserLogFilterType.php +++ b/src/Trinity/Bundle/UserBundle/Form/Type/UserLogFilterType.php @@ -10,7 +10,7 @@ class UserLogFilterType extends BaseAbstractType protected $options = array( 'data_class' => 'FOS\UserBundle\Propel\UserLog', 'name' => 'userlog', - 'csrf_protection' => false, + 'csrf_protection' => false, ); /** diff --git a/src/Trinity/Bundle/UserBundle/Form/Type/UserType.php b/src/Trinity/Bundle/UserBundle/Form/Type/UserType.php index 9869fc7..ea08101 100644 --- a/src/Trinity/Bundle/UserBundle/Form/Type/UserType.php +++ b/src/Trinity/Bundle/UserBundle/Form/Type/UserType.php @@ -6,8 +6,6 @@ use Propel\PropelBundle\Form\BaseAbstractType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolverInterface; -use \Trinity\Bundle\UserBundle\Form\Type\ProfileType; - class UserType extends BaseAbstractType { /** @@ -110,5 +108,3 @@ class UserType extends BaseAbstractType return array_keys(self::getRoles()); } } - - diff --git a/src/Trinity/Bundle/VarsEditorBundle/Controller/VarsAdminController.php b/src/Trinity/Bundle/VarsEditorBundle/Controller/VarsAdminController.php index 6022caf..61239af 100644 --- a/src/Trinity/Bundle/VarsEditorBundle/Controller/VarsAdminController.php +++ b/src/Trinity/Bundle/VarsEditorBundle/Controller/VarsAdminController.php @@ -115,13 +115,13 @@ class VarsAdminController extends Controller $type = isset($var['type']) ? $var['type'] : 'text'; $help = isset($var['help']) ? array('data-help' => $this->get('translator')->trans($var['help'])) : array(); $name = $key.'_'.$var['key']; - $label = isset($var['label']) ? $var['label'] : $name; + $label = isset($var['label']) ? $var['label'] : $name; $form->add( $name, $type, array( - 'label' => $label, + 'label' => $label, 'data' => $value, 'attr' => array_merge($options, $help) ) @@ -158,13 +158,13 @@ class VarsAdminController extends Controller $type = isset($var['type']) ? $var['type'] : 'text'; $help = isset($var['help']) ? array('data-help' => $this->get('translator')->trans($var['help'])) : array(); $name = $var['key']; - $label = isset($var['label']) ? $var['label'] : $name; + $label = isset($var['label']) ? $var['label'] : $name; $form->add( $name, $type, array( - 'label' => $label, + 'label' => $label, 'data' => $value, 'attr' => array_merge($options, $help) ) diff --git a/src/Trinity/Bundle/VarsEditorBundle/DependencyInjection/TrinityVarsEditorExtension.php b/src/Trinity/Bundle/VarsEditorBundle/DependencyInjection/TrinityVarsEditorExtension.php index cf61882..13ea0f5 100644 --- a/src/Trinity/Bundle/VarsEditorBundle/DependencyInjection/TrinityVarsEditorExtension.php +++ b/src/Trinity/Bundle/VarsEditorBundle/DependencyInjection/TrinityVarsEditorExtension.php @@ -25,6 +25,6 @@ class TrinityVarsEditorExtension extends Extension $loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); $loader->load('services.xml'); - $container->setParameter('trinity_vars_editor.file', $config['file']); + $container->setParameter('trinity_vars_editor.file', $config['file']); } } diff --git a/src/Trinity/Bundle/WidgetBundle/DependencyInjection/Configuration.php b/src/Trinity/Bundle/WidgetBundle/DependencyInjection/Configuration.php index 6ac07b6..71a26ea 100644 --- a/src/Trinity/Bundle/WidgetBundle/DependencyInjection/Configuration.php +++ b/src/Trinity/Bundle/WidgetBundle/DependencyInjection/Configuration.php @@ -23,7 +23,6 @@ class Configuration implements ConfigurationInterface // Here you should define the parameters that are allowed to // configure your bundle. See the documentation linked above for // more information on that topic. - return $treeBuilder; } } diff --git a/src/Trinity/Component/File/FileUploadInterface.php b/src/Trinity/Component/File/FileUploadInterface.php index deaa10a..ce34af8 100644 --- a/src/Trinity/Component/File/FileUploadInterface.php +++ b/src/Trinity/Component/File/FileUploadInterface.php @@ -8,6 +8,6 @@ interface FileUploadInterface public function getUploadFields(); public function getUploadDir($field); public function uploadRollback($field, $locale = null); - public function deleteFile($v); - public function isUploadRollbackField($field, $locale = null); + public function deleteFile($v); + public function isUploadRollbackField($field, $locale = null); } diff --git a/src/Trinity/Component/Propel/CustomSluggableBehavior.php b/src/Trinity/Component/Propel/CustomSluggableBehavior.php index 241075b..3a8a911 100644 --- a/src/Trinity/Component/Propel/CustomSluggableBehavior.php +++ b/src/Trinity/Component/Propel/CustomSluggableBehavior.php @@ -117,6 +117,7 @@ if (\$this->isColumnModified($const) && \$this->{$this->getColumnGetter()}()) { \$this->{$this->getColumnSetter()}(\$this->createSlug()); }"; } + return $script; } @@ -247,7 +248,7 @@ protected static function cleanupSlugPart(\$slug, \$replacement = '" . $this->ge // replace non letter or digits with separator \$slug = preg_replace_callback( '" . $this->getParameter('replace_pattern') . "', - function(\$m) use (\$replacement) { + function (\$m) use (\$replacement) { return \$replacement; }, utf8_encode(\$slug) @@ -255,7 +256,7 @@ protected static function cleanupSlugPart(\$slug, \$replacement = '" . $this->ge \$slug = preg_replace_callback( '#'.preg_quote(\$replacement).'{2,}#', - function(\$m) use (\$replacement) { + function (\$m) use (\$replacement) { return \$replacement; }, utf8_encode(\$slug) diff --git a/src/Trinity/Component/Propel/I18nSluggableBehavior.php b/src/Trinity/Component/Propel/I18nSluggableBehavior.php index f77a9ac..23f8727 100644 --- a/src/Trinity/Component/Propel/I18nSluggableBehavior.php +++ b/src/Trinity/Component/Propel/I18nSluggableBehavior.php @@ -5,7 +5,6 @@ use I18nBehavior; use ReflectionObject; use SluggableBehavior; - class I18nSluggableBehavior extends I18nBehavior { @@ -25,4 +24,4 @@ class I18nSluggableBehavior extends I18nBehavior $this->i18nTable->addBehavior(new SluggableBehavior()); } -} \ No newline at end of file +} diff --git a/src/Trinity/Component/Propel/UploadableBehavior.php b/src/Trinity/Component/Propel/UploadableBehavior.php index 3aebdad..5d26121 100644 --- a/src/Trinity/Component/Propel/UploadableBehavior.php +++ b/src/Trinity/Component/Propel/UploadableBehavior.php @@ -7,10 +7,10 @@ use Trinity\Component\Utils\Propel as PropelUtils; class UploadableBehavior extends \Behavior { - protected $fields = array(); - protected $dirs = array(); - protected $i18n_upload_fields = array(); - protected $i18n_upload_paths = array(); + protected $fields = array(); + protected $dirs = array(); + protected $i18n_upload_fields = array(); + protected $i18n_upload_paths = array(); protected $tableModificationOrder = 90; @@ -19,6 +19,7 @@ class UploadableBehavior extends \Behavior if ($this->getTable()->getColumn($columnName)) { return 'get'.$this->getTable()->getColumn($columnName)->getPhpName(); } + return PropelUtils::getGetter($columnName); } @@ -27,6 +28,7 @@ class UploadableBehavior extends \Behavior if ($this->getTable()->getColumn($columnName)) { return 'set'.$this->getTable()->getColumn($columnName)->getPhpName(); } + return PropelUtils::getSetter($columnName); } @@ -35,7 +37,7 @@ class UploadableBehavior extends \Behavior $this->fields = array_map('trim', explode(',', $this->getParameter('fields'))); $path = array_map('trim', explode(',', $this->getParameter('paths'))); - if(count($this->fields) != count($path)) { + if (count($this->fields) != count($path)) { throw new InvalidArgumentException(sprintf( 'You must give a path for each field specified in \'fields\' parameter. %s field for %s path', count($this->fields), @@ -43,7 +45,7 @@ class UploadableBehavior extends \Behavior )); } - foreach($this->fields as $k => $v) { + foreach ($this->fields as $k => $v) { $this->dirs[$v] = $path[$k]; } } @@ -133,43 +135,47 @@ class UploadableBehavior extends \Behavior $this->addI18nWebPathMethod($script); $this->addHasUploadedFieldMethod($script); $this->addGetterAsFile($script); + return $script; } public function preSave() { $script = ''; - foreach($this->fields as $k => $field) { + foreach ($this->fields as $k => $field) { $camel_field = PropelUtils::camelCase($field); $script .= sprintf('$this->upload%s();%s', $camel_field, PHP_EOL); } + return $script; } public function postInsert() { $script = ''; - foreach($this->fields as $k => $field) { + foreach ($this->fields as $k => $field) { $camel_field = PropelUtils::camelCase($field); $script .= sprintf('$this->save%sFile();%s', $camel_field, PHP_EOL); } + return $script; } public function postUpdate() { $script = ''; - foreach($this->fields as $k => $field) { + foreach ($this->fields as $k => $field) { $camel_field = PropelUtils::camelCase($field); $script .= sprintf('$this->save%sFile();%s', $camel_field, PHP_EOL); } + return $script; } public function postSave() { $script = ''; - foreach($this->fields as $k => $field) { + foreach ($this->fields as $k => $field) { $camel_field = PropelUtils::camelCase($field); $script .= <<delete_$field) { EOL; } + return $script; } public function postDelete() { $script = ''; - foreach($this->fields as $k => $field) { + foreach ($this->fields as $k => $field) { $camel_field = PropelUtils::camelCase($field); $script .= sprintf('$this->set%s(null);%s', $camel_field, PHP_EOL); $script .= sprintf('$this->setDelete%s(true);%s', $camel_field, PHP_EOL); $script .= sprintf('$this->remove%s();%s', $camel_field, PHP_EOL); $script .= ' '.PHP_EOL; } + return $script; } - - protected function addAttributes(&$script) { $dirs = var_export($this->dirs, true); @@ -218,22 +224,22 @@ EOL; $upload EOS; } - if($rollbacks != '') { + if ($rollbacks != '') { $script .= <<$field && !\$this->delete_$field && null !== \$this->rollback_$field) { \$this->$field = \$this->rollback_$field; // keep the file + return true; } @@ -356,7 +363,7 @@ EOS; */ public function save{$camel_field}File() { - if(\$this->hasUploaded{$camel_field}()){ + if (\$this->hasUploaded{$camel_field}()) { \$this->{$field}_file->move(\$this->getUploadDir('$field')$i18n, \$this->{$field}); } } @@ -492,8 +499,8 @@ EOS; protected function addI18nWebPathMethod(&$script) { - if($this->getTable()->hasBehavior('i18n')) { - foreach($this->i18n_upload_fields as $field) { + if ($this->getTable()->hasBehavior('i18n')) { + foreach ($this->i18n_upload_fields as $field) { $camel_field = PropelUtils::camelCase($field); @@ -547,6 +554,7 @@ EOS; $upload EOS; } + return $script; } @@ -572,6 +580,7 @@ public static function getUploadDir(\$field) } EOS; + return $script; } diff --git a/src/Trinity/Component/Tests/TestCase.php b/src/Trinity/Component/Tests/TestCase.php index a5c016e..174b7f9 100644 --- a/src/Trinity/Component/Tests/TestCase.php +++ b/src/Trinity/Component/Tests/TestCase.php @@ -37,4 +37,3 @@ class TestCase extends \PHPUnit_Framework_TestCase return self::getApplication()->run(new \Symfony\Component\Console\Input\StringInput($command)); } } - diff --git a/src/Trinity/Component/Tests/WebTestCase.php b/src/Trinity/Component/Tests/WebTestCase.php index b3935fb..0ecd471 100644 --- a/src/Trinity/Component/Tests/WebTestCase.php +++ b/src/Trinity/Component/Tests/WebTestCase.php @@ -34,4 +34,3 @@ class WebTestCase extends BaseWebTestCase return self::getApplication()->run(new \Symfony\Component\Console\Input\StringInput($command)); } } - diff --git a/src/Trinity/Component/Utils/ArrayFilter.php b/src/Trinity/Component/Utils/ArrayFilter.php index 08d0a93..67a887c 100644 --- a/src/Trinity/Component/Utils/ArrayFilter.php +++ b/src/Trinity/Component/Utils/ArrayFilter.php @@ -10,4 +10,4 @@ class ArrayFilter return (strlen($var)>1); } -} \ No newline at end of file +} diff --git a/src/Trinity/Component/Utils/Propel.php b/src/Trinity/Component/Utils/Propel.php index 12452c4..2ecf31a 100644 --- a/src/Trinity/Component/Utils/Propel.php +++ b/src/Trinity/Component/Utils/Propel.php @@ -18,10 +18,10 @@ class Propel { return ucfirst(preg_replace_callback( '/_[a-z0-9]{1}/iU', - function($matches) { + function ($matches) { return str_replace('_', '', strtoupper($matches[0])); }, - $string + $string )); } }