@@ -16,9 +16,9 @@ |
||
| 16 | 16 | $configuration = new Configuration(); |
| 17 | 17 | $config = $this->processConfiguration($configuration, $configs); |
| 18 | 18 | |
| 19 | - $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config')); |
|
| 19 | + $loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); |
|
| 20 | 20 | $loader->load('services.xml'); |
| 21 | - $ymlLoader = new YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config')); |
|
| 21 | + $ymlLoader = new YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); |
|
| 22 | 22 | $ymlLoader->load('data_grid.yml'); |
| 23 | 23 | |
| 24 | 24 | $container->getDefinition('data_grid.configuration') |
@@ -26,7 +26,7 @@ |
||
| 26 | 26 | { |
| 27 | 27 | $this->container = $container; |
| 28 | 28 | foreach ($config as $key => $value) { |
| 29 | - $setter = 'set' . ucfirst($key); |
|
| 29 | + $setter = 'set'.ucfirst($key); |
|
| 30 | 30 | if (method_exists($this, $setter)) { |
| 31 | 31 | $this->$setter($value); |
| 32 | 32 | } |
@@ -75,7 +75,7 @@ |
||
| 75 | 75 | public function addDateFilter(string $attribute, string $comparison = 'equal'): DataGridFiltersBuilderInterface |
| 76 | 76 | { |
| 77 | 77 | if (array_key_exists($attribute, $this->params)) { |
| 78 | - $comparisonFunc = lcfirst($comparison) . 'Date'; |
|
| 78 | + $comparisonFunc = lcfirst($comparison).'Date'; |
|
| 79 | 79 | if (method_exists($this, $comparisonFunc)) { |
| 80 | 80 | $this->$comparisonFunc($attribute); |
| 81 | 81 | } else { |
@@ -51,9 +51,9 @@ |
||
| 51 | 51 | { |
| 52 | 52 | $manager = $this->container['doctrine']->getRepository($this->entityClass); |
| 53 | 53 | $queryResult = $manager->createQueryBuilder('dgq') |
| 54 | - ->select(['dgq.id', 'dgq.' . $this->label])->orderBy('dgq.id')->getQuery()->getArrayResult(); |
|
| 54 | + ->select(['dgq.id', 'dgq.'.$this->label])->orderBy('dgq.id')->getQuery()->getArrayResult(); |
|
| 55 | 55 | $choices = []; |
| 56 | - array_walk($queryResult, function ($val) use (&$choices) { |
|
| 56 | + array_walk($queryResult, function($val) use (&$choices) { |
|
| 57 | 57 | $choices[$val['id']] = $val[$this->label]; |
| 58 | 58 | }); |
| 59 | 59 | return [ |
@@ -90,13 +90,13 @@ |
||
| 90 | 90 | |
| 91 | 91 | protected function getEntityAttribute($entity, $attribute) |
| 92 | 92 | { |
| 93 | - $attribute = preg_replace_callback('/_([A-z]?)/', function ($matches) { |
|
| 93 | + $attribute = preg_replace_callback('/_([A-z]?)/', function($matches) { |
|
| 94 | 94 | return isset($matches[1]) ? strtoupper($matches[1]) : ''; |
| 95 | 95 | }, $attribute); |
| 96 | - $getter = 'get' . ucfirst($attribute); |
|
| 96 | + $getter = 'get'.ucfirst($attribute); |
|
| 97 | 97 | if (method_exists($entity, $getter)) { |
| 98 | 98 | return $entity->$getter(); |
| 99 | 99 | } |
| 100 | - throw new Exception('Unknown property ' . $attribute . ' in ' . get_class($entity)); |
|
| 100 | + throw new Exception('Unknown property '.$attribute.' in '.get_class($entity)); |
|
| 101 | 101 | } |
| 102 | 102 | } |
@@ -43,7 +43,7 @@ |
||
| 43 | 43 | protected function setConfiguration($config) |
| 44 | 44 | { |
| 45 | 45 | foreach ($config as $key => $value) { |
| 46 | - $setter = 'set' . ucfirst($key); |
|
| 46 | + $setter = 'set'.ucfirst($key); |
|
| 47 | 47 | if (method_exists($this, $setter)) { |
| 48 | 48 | $this->$setter($value); |
| 49 | 49 | } |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | $this->filterBuilder = new DataGridFiltersBuilder($this->container); |
| 64 | 64 | $this->options['filtersCriteria'] = $this->filterBuilder->getCriteria(); |
| 65 | 65 | foreach ($configs->getConfigs() as $key => $value) { |
| 66 | - $setter = 'setDefault' . ucfirst($key); |
|
| 66 | + $setter = 'setDefault'.ucfirst($key); |
|
| 67 | 67 | if (method_exists($this, $setter)) { |
| 68 | 68 | $this->$setter($value); |
| 69 | 69 | } |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | public function createGrid(string $gridType, ServiceEntityRepository $repository): DataGrid |
| 75 | 75 | { |
| 76 | 76 | if (!is_subclass_of($gridType, AbstractGridType::class)) { |
| 77 | - throw new InvalidArgumentException('Expected subclass of ' . AbstractGridType::class); |
|
| 77 | + throw new InvalidArgumentException('Expected subclass of '.AbstractGridType::class); |
|
| 78 | 78 | } |
| 79 | 79 | $this->repository = $repository; |
| 80 | 80 | /** @var AbstractGridType $type */ |
@@ -123,10 +123,11 @@ |
||
| 123 | 123 | |
| 124 | 124 | protected function setPage($page) |
| 125 | 125 | { |
| 126 | - if (is_numeric($page)) |
|
| 127 | - $this->options['page'] = (int)$page; |
|
| 128 | - else |
|
| 129 | - $this->options['page'] = 1; |
|
| 126 | + if (is_numeric($page)) { |
|
| 127 | + $this->options['page'] = (int)$page; |
|
| 128 | + } else { |
|
| 129 | + $this->options['page'] = 1; |
|
| 130 | + } |
|
| 130 | 131 | } |
| 131 | 132 | |
| 132 | 133 | protected function setDefaultTemplate($template) |
@@ -17,7 +17,7 @@ |
||
| 17 | 17 | public function __construct(array $config) |
| 18 | 18 | { |
| 19 | 19 | foreach ($config as $key => $value) { |
| 20 | - $setter = 'set' . ucfirst($key); |
|
| 20 | + $setter = 'set'.ucfirst($key); |
|
| 21 | 21 | if (method_exists($this, $setter)) { |
| 22 | 22 | $this->$setter($value); |
| 23 | 23 | } |
@@ -45,7 +45,7 @@ |
||
| 45 | 45 | { |
| 46 | 46 | $this->container = $container; |
| 47 | 47 | foreach ($this->container as $key => $value) { |
| 48 | - $setter = 'set' . ucfirst($key); |
|
| 48 | + $setter = 'set'.ucfirst($key); |
|
| 49 | 49 | if (method_exists($this, $setter)) { |
| 50 | 50 | $this->$setter($value); |
| 51 | 51 | } |