@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | /** |
| 25 | 25 | * @return null|string |
| 26 | 26 | */ |
| 27 | - public function getAttribute(){ |
|
| 27 | + public function getAttribute() { |
|
| 28 | 28 | return $this->attribute; |
| 29 | 29 | } |
| 30 | 30 | |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | |
| 47 | 47 | protected function checkConfiguration() |
| 48 | 48 | { |
| 49 | - if (!is_string($this->attribute) && $this->value === null){ |
|
| 49 | + if (!is_string($this->attribute) && $this->value === null) { |
|
| 50 | 50 | throw new Exception('attribute or value property must be set for DataColumn'); |
| 51 | 51 | } |
| 52 | 52 | } |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | |
| 64 | 64 | public function getFilterContent() |
| 65 | 65 | { |
| 66 | - if ($this->hasFilter()){ |
|
| 66 | + if ($this->hasFilter()) { |
|
| 67 | 67 | return $this->filter->render($this->attribute, $this->filterValue); |
| 68 | 68 | } |
| 69 | 69 | return ''; |
@@ -77,22 +77,22 @@ discard block |
||
| 77 | 77 | : htmlspecialchars($result); |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | - protected function getCellValue($entity){ |
|
| 81 | - if (is_callable($this->value)){ |
|
| 80 | + protected function getCellValue($entity) { |
|
| 81 | + if (is_callable($this->value)) { |
|
| 82 | 82 | return call_user_func_array($this->value, [$entity]); |
| 83 | - } elseif ($this->value !== null){ |
|
| 83 | + } elseif ($this->value !== null) { |
|
| 84 | 84 | return $this->value; |
| 85 | 85 | } else { |
| 86 | 86 | return $this->getEntityAttribute($entity, $this->attribute); |
| 87 | 87 | } |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | - protected function getEntityAttribute($entity, $attribute){ |
|
| 91 | - $attribute = preg_replace_callback('/_([A-z]?)/', function($matches){ |
|
| 90 | + protected function getEntityAttribute($entity, $attribute) { |
|
| 91 | + $attribute = preg_replace_callback('/_([A-z]?)/', function($matches) { |
|
| 92 | 92 | return isset($matches[1]) ? strtoupper($matches[1]) : ''; |
| 93 | 93 | }, $attribute); |
| 94 | 94 | $getter = 'get'.ucfirst($attribute); |
| 95 | - if (method_exists($entity, $getter)){ |
|
| 95 | + if (method_exists($entity, $getter)) { |
|
| 96 | 96 | return $entity->$getter(); |
| 97 | 97 | } |
| 98 | 98 | throw new Exception('Unknown property '.$attribute.' in '.get_class($entity)); |
@@ -13,9 +13,9 @@ |
||
| 13 | 13 | |
| 14 | 14 | function getCellContent($entity, DataGrid $grid) |
| 15 | 15 | { |
| 16 | - if (is_callable($this->value)){ |
|
| 16 | + if (is_callable($this->value)) { |
|
| 17 | 17 | $result = call_user_func_array($this->value, [$entity]); |
| 18 | - } elseif ($this->value !== null){ |
|
| 18 | + } elseif ($this->value !== null) { |
|
| 19 | 19 | $result = $this->value == true ? $this->trueValue : $this->falseValue; |
| 20 | 20 | } else { |
| 21 | 21 | $result = $this->getEntityAttribute($entity, $this->attribute) == true ? $this->trueValue : $this->falseValue; |
@@ -41,8 +41,8 @@ discard block |
||
| 41 | 41 | public function getCellContent($entity, DataGrid $grid) |
| 42 | 42 | { |
| 43 | 43 | return preg_replace_callback('/\{(\w+)\}/', function($matches) use ($entity, $grid) { |
| 44 | - if ($this->isButtonVisible($matches[1])){ |
|
| 45 | - if (array_key_exists($matches[1], $this->buttons) && is_callable($this->buttons[$matches[1]])){ |
|
| 44 | + if ($this->isButtonVisible($matches[1])) { |
|
| 45 | + if (array_key_exists($matches[1], $this->buttons) && is_callable($this->buttons[$matches[1]])) { |
|
| 46 | 46 | return call_user_func_array($this->buttons[$matches[1]], [ |
| 47 | 47 | $entity, |
| 48 | 48 | $this->generateUrl($entity, $matches[1], $grid) |
@@ -65,8 +65,8 @@ discard block |
||
| 65 | 65 | * @return mixed|string |
| 66 | 66 | * @throws Exception |
| 67 | 67 | */ |
| 68 | - protected function generateUrl($entity, $action, $grid){ |
|
| 69 | - if ($this->urlGenerator != null && is_callable($this->urlGenerator)){ |
|
| 68 | + protected function generateUrl($entity, $action, $grid) { |
|
| 69 | + if ($this->urlGenerator != null && is_callable($this->urlGenerator)) { |
|
| 70 | 70 | return call_user_func_array($this->urlGenerator, [$entity, $action, $grid->getRouter()]); |
| 71 | 71 | } elseif (method_exists($entity, 'getId')) { |
| 72 | 72 | return $grid->getRouter()->generate($this->pathPrefix.$action, ['id' => $entity->getId()]); |
@@ -14,9 +14,9 @@ |
||
| 14 | 14 | public function getCellContent($entity, DataGrid $grid) |
| 15 | 15 | { |
| 16 | 16 | $value = $this->getCellValue($entity); |
| 17 | - if ($value instanceof DateTime){ |
|
| 17 | + if ($value instanceof DateTime) { |
|
| 18 | 18 | return $value->format($this->dateFormat); |
| 19 | - } elseif (is_string($value) && $this->dateFormat != null){ |
|
| 19 | + } elseif (is_string($value) && $this->dateFormat != null) { |
|
| 20 | 20 | return date($this->dateFormat, strtotime($value)); |
| 21 | 21 | } |
| 22 | 22 | return (string)$value; |
@@ -22,8 +22,8 @@ |
||
| 22 | 22 | function getCellContent($entity, DataGrid $grid) |
| 23 | 23 | { |
| 24 | 24 | $value = (string)$this->getCellValue($entity); |
| 25 | - if (!empty($value)){ |
|
| 26 | - if ($this->format === 'html'){ |
|
| 25 | + if (!empty($value)) { |
|
| 26 | + if ($this->format === 'html') { |
|
| 27 | 27 | return $grid->getTemplate()->renderBlock('grid_img', [ |
| 28 | 28 | 'src' => $value, |
| 29 | 29 | 'width' => $this->width, |