@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | { |
| 27 | 27 | foreach ($config as $key => $value) { |
| 28 | 28 | $key = str_replace('_', '', $key); |
| 29 | - $setter = 'set' . $key; |
|
| 29 | + $setter = 'set'.$key; |
|
| 30 | 30 | if (method_exists($this, $setter)) { |
| 31 | 31 | $this->$setter($value); |
| 32 | 32 | } |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | $result = clone $this; |
| 86 | 86 | foreach ($configuration->getConfigsArray() as $key => $value) { |
| 87 | 87 | if ($value !== null) { |
| 88 | - $setter = 'set' . ucfirst($key); |
|
| 88 | + $setter = 'set'.ucfirst($key); |
|
| 89 | 89 | $result->$setter($value); |
| 90 | 90 | } |
| 91 | 91 | } |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | 'pagination_limit' => 10, |
| 22 | 22 | 'translation_domain' => null |
| 23 | 23 | ]); |
| 24 | - if (!empty($config['instances'])){ |
|
| 24 | + if (!empty($config['instances'])) { |
|
| 25 | 25 | foreach ($config['instances'] as $key => $configuration) { |
| 26 | 26 | $this->instances[$key] = new Configuration($configuration); |
| 27 | 27 | } |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | |
| 44 | 44 | public function getCellContent($entity) |
| 45 | 45 | { |
| 46 | - return preg_replace_callback('/\{(\w+)\}/', function ($matches) use ($entity) { |
|
| 46 | + return preg_replace_callback('/\{(\w+)\}/', function($matches) use ($entity) { |
|
| 47 | 47 | if ($this->isButtonVisible($matches[1])) { |
| 48 | 48 | if (array_key_exists($matches[1], $this->buttons) && is_callable($this->buttons[$matches[1]])) { |
| 49 | 49 | return call_user_func_array($this->buttons[$matches[1]], [ |
@@ -72,15 +72,15 @@ discard block |
||
| 72 | 72 | if (is_callable($this->urlGenerator)) { |
| 73 | 73 | return call_user_func_array($this->urlGenerator, [$item, $action, $this->container->getRouter()]); |
| 74 | 74 | } elseif (!empty($this->identifier) && $item->has($this->identifier)) { |
| 75 | - return $this->container->getRouter()->generate($this->pathPrefix . $action, [ |
|
| 75 | + return $this->container->getRouter()->generate($this->pathPrefix.$action, [ |
|
| 76 | 76 | 'id' => $item->get($this->identifier) |
| 77 | 77 | ]); |
| 78 | 78 | } elseif ($item->hasIdentifier()) { |
| 79 | - return $this->container->getRouter()->generate($this->pathPrefix . $action, [ |
|
| 79 | + return $this->container->getRouter()->generate($this->pathPrefix.$action, [ |
|
| 80 | 80 | 'id' => $item->get($item->getIdentifier()) |
| 81 | 81 | ]); |
| 82 | 82 | } else { |
| 83 | - throw new DataGridException('Could not generate url for action: ' . $action); |
|
| 83 | + throw new DataGridException('Could not generate url for action: '.$action); |
|
| 84 | 84 | } |
| 85 | 85 | } |
| 86 | 86 | |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | protected function checkConfiguration() |
| 56 | 56 | { |
| 57 | 57 | if ((!is_string($this->attribute) || empty($this->attribute)) && $this->value === null) { |
| 58 | - throw new DataGridException('attribute or value property must be set for ' . static::class); |
|
| 58 | + throw new DataGridException('attribute or value property must be set for '.static::class); |
|
| 59 | 59 | } |
| 60 | 60 | } |
| 61 | 61 | |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | public function getHeadContent() |
| 68 | 68 | { |
| 69 | 69 | $label = $this->getLabel(); |
| 70 | - if (($translator = $this->container->getTranslator()) !== null){ |
|
| 70 | + if (($translator = $this->container->getTranslator()) !== null) { |
|
| 71 | 71 | $label = $translator->trans($label, [], $this->translationDomain); |
| 72 | 72 | } |
| 73 | 73 | return ucfirst($label); |
@@ -30,7 +30,7 @@ |
||
| 30 | 30 | { |
| 31 | 31 | $obj = $this->getCellValue($entity); |
| 32 | 32 | if (is_object($obj)) { |
| 33 | - $result = $obj->{'get' . ucfirst($this->labelAttribute)}(); |
|
| 33 | + $result = $obj->{'get'.ucfirst($this->labelAttribute)}(); |
|
| 34 | 34 | return $this->format === 'html' |
| 35 | 35 | ? $result |
| 36 | 36 | : htmlspecialchars($result); |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | public function addColumn(string $attribute, string $columnClass = DataColumn::class, array $options = []): DataGridBuilderInterface |
| 63 | 63 | { |
| 64 | 64 | if (!is_subclass_of($columnClass, AbstractColumn::class)) { |
| 65 | - throw new InvalidArgumentException('Expected subclass of' . AbstractColumn::class); |
|
| 65 | + throw new InvalidArgumentException('Expected subclass of'.AbstractColumn::class); |
|
| 66 | 66 | } |
| 67 | 67 | /** |
| 68 | 68 | * @var AbstractColumn $column |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | public function enablePagination(bool $enabled = true, ?int $limit = null): DataGridBuilderInterface |
| 126 | 126 | { |
| 127 | 127 | $this->configuration->setPaginationEnabled($enabled); |
| 128 | - if ($limit !== null){ |
|
| 128 | + if ($limit !== null) { |
|
| 129 | 129 | $this->configuration->setPaginationLimit($limit); |
| 130 | 130 | } |
| 131 | 131 | return $this; |
@@ -48,7 +48,7 @@ |
||
| 48 | 48 | public function createGrid(string $gridType, $dataSource): DataGridInterface |
| 49 | 49 | { |
| 50 | 50 | if (!is_subclass_of($gridType, AbstractGridType::class)) { |
| 51 | - throw new InvalidArgumentException('Expected subclass of ' . AbstractGridType::class); |
|
| 51 | + throw new InvalidArgumentException('Expected subclass of '.AbstractGridType::class); |
|
| 52 | 52 | } |
| 53 | 53 | $provider = DataProvider::create($dataSource, $this->container->getDoctrine()); |
| 54 | 54 | |
@@ -15,9 +15,9 @@ |
||
| 15 | 15 | |
| 16 | 16 | public function get(string $attribute) |
| 17 | 17 | { |
| 18 | - if ($this->has($attribute)){ |
|
| 18 | + if ($this->has($attribute)) { |
|
| 19 | 19 | return $this->data[$attribute]; |
| 20 | 20 | } |
| 21 | - throw new DataGridException('Unknown property ' . $attribute); |
|
| 21 | + throw new DataGridException('Unknown property '.$attribute); |
|
| 22 | 22 | } |
| 23 | 23 | } |
| 24 | 24 | \ No newline at end of file |
@@ -29,16 +29,16 @@ |
||
| 29 | 29 | if (property_exists($this->data, $camelAttribute)) { |
| 30 | 30 | return $this->data->$camelAttribute; |
| 31 | 31 | } |
| 32 | - throw new DataGridException('Unknown property ' . $attribute . ' in ' . get_class($this->data)); |
|
| 32 | + throw new DataGridException('Unknown property '.$attribute.' in '.get_class($this->data)); |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | |
| 36 | 36 | private function getPropertyAccessVariations(string $attribute): array |
| 37 | 37 | { |
| 38 | - $camelAttribute = preg_replace_callback('/_([a-z]?)/', function ($matches) { |
|
| 38 | + $camelAttribute = preg_replace_callback('/_([a-z]?)/', function($matches) { |
|
| 39 | 39 | return isset($matches[1]) ? strtoupper($matches[1]) : ''; |
| 40 | 40 | }, $attribute); |
| 41 | - $getter = 'get' . $camelAttribute; |
|
| 41 | + $getter = 'get'.$camelAttribute; |
|
| 42 | 42 | return [$camelAttribute, $getter]; |
| 43 | 43 | } |
| 44 | 44 | } |
| 45 | 45 | \ No newline at end of file |