@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | $this->filterBuilder = new DataGridFiltersBuilder(); |
58 | 58 | |
59 | 59 | foreach ($configs->getConfigs() as $key => $value) { |
60 | - $setter = 'setDefault' . ucfirst($key); |
|
60 | + $setter = 'setDefault'.ucfirst($key); |
|
61 | 61 | if (method_exists($this, $setter)) { |
62 | 62 | $this->$setter($value); |
63 | 63 | } |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | public function createGrid(string $gridType, $dataProvider): DataGrid |
69 | 69 | { |
70 | 70 | if (!is_subclass_of($gridType, AbstractGridType::class)) { |
71 | - throw new InvalidArgumentException('Expected subclass of ' . AbstractGridType::class); |
|
71 | + throw new InvalidArgumentException('Expected subclass of '.AbstractGridType::class); |
|
72 | 72 | } |
73 | 73 | $provider = DataProvider::create($dataProvider, $this->container['doctrine']->getManager()); |
74 | 74 | $this->gridBuilder->setProvider($provider); |
@@ -53,7 +53,7 @@ |
||
53 | 53 | if (!isset($cacheKeyInfo['isScalar'])) { |
54 | 54 | $dqlAlias = $cacheKeyInfo['dqlAlias']; |
55 | 55 | $type = $cacheKeyInfo['type']; |
56 | - $fieldName = $dqlAlias . $this->getFieldSeparator() . $fieldName; |
|
56 | + $fieldName = $dqlAlias.$this->getFieldSeparator().$fieldName; |
|
57 | 57 | $value = $type |
58 | 58 | ? $type->convertToPHPValue($value, $this->_platform) |
59 | 59 | : $value; |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | public function has($name) |
50 | 50 | { |
51 | 51 | if ($this->entity !== null) { |
52 | - return method_exists($this->entity, 'get' . ucfirst($name)); |
|
52 | + return method_exists($this->entity, 'get'.ucfirst($name)); |
|
53 | 53 | } |
54 | 54 | if ($this->row !== null) { |
55 | 55 | return array_key_exists($name, $this->row); |
@@ -71,21 +71,21 @@ discard block |
||
71 | 71 | if (array_key_exists($name, $this->row)) { |
72 | 72 | return $this->row[$name]; |
73 | 73 | } |
74 | - throw new DataGridException('Unknown property ' . $name); |
|
74 | + throw new DataGridException('Unknown property '.$name); |
|
75 | 75 | } |
76 | 76 | return null; |
77 | 77 | } |
78 | 78 | |
79 | 79 | protected function getEntityAttribute($name) |
80 | 80 | { |
81 | - $attribute = preg_replace_callback('/_([A-z]?)/', function ($matches) { |
|
81 | + $attribute = preg_replace_callback('/_([A-z]?)/', function($matches) { |
|
82 | 82 | return isset($matches[1]) ? strtoupper($matches[1]) : ''; |
83 | 83 | }, $name); |
84 | - $getter = 'get' . ucfirst($attribute); |
|
84 | + $getter = 'get'.ucfirst($attribute); |
|
85 | 85 | if (method_exists($this->entity, $getter)) { |
86 | 86 | return $this->entity->$getter(); |
87 | 87 | } |
88 | - throw new DataGridException('Unknown property ' . $attribute . ' in ' . get_class($this->entity)); |
|
88 | + throw new DataGridException('Unknown property '.$attribute.' in '.get_class($this->entity)); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | public function getId() |
@@ -100,11 +100,11 @@ discard block |
||
100 | 100 | { |
101 | 101 | $metaData = $this->entityManager->getClassMetadata(get_class($this->entity)); |
102 | 102 | $idAttr = $metaData->getIdentifier()[0]; |
103 | - $getter = 'get' . ucfirst($idAttr); |
|
103 | + $getter = 'get'.ucfirst($idAttr); |
|
104 | 104 | if (method_exists($this->entity, $getter)) { |
105 | 105 | return $this->entity->$getter(); |
106 | 106 | } |
107 | - throw new DataGridException('Cannot find identifier in ' . get_class($this->entity)); |
|
107 | + throw new DataGridException('Cannot find identifier in '.get_class($this->entity)); |
|
108 | 108 | //TODO surrogate pk |
109 | 109 | } |
110 | 110 |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | public function setOptions(array $options) |
38 | 38 | { |
39 | 39 | foreach ($options as $key => $value) { |
40 | - $setter = 'set' . ucfirst($key); |
|
40 | + $setter = 'set'.ucfirst($key); |
|
41 | 41 | if (method_exists($this, $setter)) { |
42 | 42 | $this->$setter($value); |
43 | 43 | } |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | |
47 | 47 | public function getFirst() |
48 | 48 | { |
49 | - return ($this->page - 1) * $this->limit; |
|
49 | + return ($this->page-1) * $this->limit; |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | /** |
@@ -120,10 +120,10 @@ discard block |
||
120 | 120 | if ($this->page < 5) { |
121 | 121 | return array_merge(range(1, 6), [null, $this->maxPage]); |
122 | 122 | } |
123 | - if ($this->page > $this->maxPage - 4) { |
|
124 | - return array_merge([1, null], range($this->maxPage - 5, $this->maxPage)); |
|
123 | + if ($this->page > $this->maxPage-4) { |
|
124 | + return array_merge([1, null], range($this->maxPage-5, $this->maxPage)); |
|
125 | 125 | } |
126 | - return array_merge([1, null], range($this->page - 2, $this->page + 2), [null, $this->maxPage]); |
|
126 | + return array_merge([1, null], range($this->page-2, $this->page+2), [null, $this->maxPage]); |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | } |
@@ -66,7 +66,7 @@ |
||
66 | 66 | protected function setConfigurationOptions($options) |
67 | 67 | { |
68 | 68 | foreach ($options as $key => $value) { |
69 | - $setter = 'set' . ucfirst($key); |
|
69 | + $setter = 'set'.ucfirst($key); |
|
70 | 70 | if (method_exists($this, $setter)) { |
71 | 71 | $this->$setter($value); |
72 | 72 | } |
@@ -38,7 +38,7 @@ |
||
38 | 38 | $this->getCriteria() |
39 | 39 | ->setMaxResults($this->getPager()->getLimit()) |
40 | 40 | ->setFirstResult($this->getPager()->getFirst()); |
41 | - return array_map(function ($entity) { |
|
41 | + return array_map(function($entity) { |
|
42 | 42 | $item = new DataGridItem(); |
43 | 43 | $item->setEntity($entity); |
44 | 44 | $item->setEntityManager($this->entityManager); |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | $this->builder->getEntityManager()->getConfiguration() |
38 | 38 | ->addCustomHydrationMode($hydratorName, DataGridHydrator::class); |
39 | 39 | |
40 | - return array_map(function ($row) { |
|
40 | + return array_map(function($row) { |
|
41 | 41 | $item = new DataGridItem(); |
42 | 42 | $item->setRow($row); |
43 | 43 | $item->setEntityManager($this->entityManager); |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | public function getTotalCount(): int |
49 | 49 | { |
50 | 50 | if (empty($this->countFieldName)) { |
51 | - throw new DataGridException("countableFieldName must be set for " . static::class); |
|
51 | + throw new DataGridException("countableFieldName must be set for ".static::class); |
|
52 | 52 | } |
53 | 53 | $countQueryBuilder = clone($this->builder); |
54 | 54 | $countQueryBuilder->select("count({$this->countFieldName})"); |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | $this->builder->andWhere($this->builder->expr()->isNull($attribute)); |
75 | 75 | } else { |
76 | 76 | $placeholderName = str_replace('.', '_', $attribute); |
77 | - $this->builder->andWhere($this->builder->expr()->eq($attribute, ':' . $placeholderName)); |
|
77 | + $this->builder->andWhere($this->builder->expr()->eq($attribute, ':'.$placeholderName)); |
|
78 | 78 | $this->builder->setParameter($placeholderName, $value); |
79 | 79 | } |
80 | 80 | return $this; |
@@ -83,8 +83,8 @@ discard block |
||
83 | 83 | public function addLikeFilter(string $attribute, $value): DataProviderInterface |
84 | 84 | { |
85 | 85 | $placeholderName = str_replace('.', '_', $attribute); |
86 | - $this->builder->andWhere($this->builder->expr()->like('lower(' . $attribute . ')', ':' . $placeholderName)); |
|
87 | - $this->builder->setParameter($placeholderName, '%' . mb_strtolower($value) . '%'); |
|
86 | + $this->builder->andWhere($this->builder->expr()->like('lower('.$attribute.')', ':'.$placeholderName)); |
|
87 | + $this->builder->setParameter($placeholderName, '%'.mb_strtolower($value).'%'); |
|
88 | 88 | return $this; |
89 | 89 | } |
90 | 90 | |
@@ -100,10 +100,10 @@ discard block |
||
100 | 100 | $date = new DateTime($value); |
101 | 101 | $nextDate = (clone $date)->modify('+1 day'); |
102 | 102 | $placeholderName = str_replace('.', '_', $attribute); |
103 | - $placeholderNameNext = str_replace('.', '_', $attribute) . '_next'; |
|
103 | + $placeholderNameNext = str_replace('.', '_', $attribute).'_next'; |
|
104 | 104 | $this->builder |
105 | - ->andWhere($this->builder->expr()->gte($attribute, ':' . $placeholderName)) |
|
106 | - ->andWhere($this->builder->expr()->lt($attribute, ':' . $placeholderNameNext)); |
|
105 | + ->andWhere($this->builder->expr()->gte($attribute, ':'.$placeholderName)) |
|
106 | + ->andWhere($this->builder->expr()->lt($attribute, ':'.$placeholderNameNext)); |
|
107 | 107 | $this->builder->setParameters([ |
108 | 108 | $placeholderName => $date, |
109 | 109 | $placeholderNameNext => $nextDate |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | $date = new DateTime($value); |
116 | 116 | $placeholderName = str_replace('.', '_', $attribute); |
117 | 117 | $this->builder |
118 | - ->andWhere($this->builder->expr()->lt($attribute, ':' . $placeholderName)); |
|
118 | + ->andWhere($this->builder->expr()->lt($attribute, ':'.$placeholderName)); |
|
119 | 119 | $this->builder->setParameter($placeholderName, $date); |
120 | 120 | } |
121 | 121 | |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | $date = (new DateTime($value))->modify('+1 day'); |
125 | 125 | $placeholderName = str_replace('.', '_', $attribute); |
126 | 126 | $this->builder |
127 | - ->andWhere($this->builder->expr()->lt($attribute, ':' . $placeholderName)); |
|
127 | + ->andWhere($this->builder->expr()->lt($attribute, ':'.$placeholderName)); |
|
128 | 128 | $this->builder->setParameter($placeholderName, $date); |
129 | 129 | } |
130 | 130 | |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | $date = (new DateTime($value))->modify('+1 day'); |
134 | 134 | $placeholderName = str_replace('.', '_', $attribute); |
135 | 135 | $this->builder |
136 | - ->andWhere($this->builder->expr()->gte($attribute, ':' . $placeholderName)); |
|
136 | + ->andWhere($this->builder->expr()->gte($attribute, ':'.$placeholderName)); |
|
137 | 137 | $this->builder->setParameter($placeholderName, $date); |
138 | 138 | } |
139 | 139 | |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | $date = new DateTime($value); |
143 | 143 | $placeholderName = str_replace('.', '_', $attribute); |
144 | 144 | $this->builder |
145 | - ->andWhere($this->builder->expr()->gte($attribute, ':' . $placeholderName)); |
|
145 | + ->andWhere($this->builder->expr()->gte($attribute, ':'.$placeholderName)); |
|
146 | 146 | $this->builder->setParameter($placeholderName, $date); |
147 | 147 | } |
148 | 148 | } |
149 | 149 | \ No newline at end of file |
@@ -49,27 +49,27 @@ discard block |
||
49 | 49 | |
50 | 50 | public function addEqualFilter(string $attribute, $value): DataProviderInterface |
51 | 51 | { |
52 | - throw new NotSupportedException("Method addEqualFilter() is not supported in " . static::class); |
|
52 | + throw new NotSupportedException("Method addEqualFilter() is not supported in ".static::class); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | public function addLikeFilter(string $attribute, $value): DataProviderInterface |
56 | 56 | { |
57 | - throw new NotSupportedException("Method addLikeFilter() is not supported in " . static::class); |
|
57 | + throw new NotSupportedException("Method addLikeFilter() is not supported in ".static::class); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | public function addRelationFilter(string $attribute, $value, string $relationClass): DataProviderInterface |
61 | 61 | { |
62 | - throw new NotSupportedException("Method addRelationFilter() is not supported in " . static::class); |
|
62 | + throw new NotSupportedException("Method addRelationFilter() is not supported in ".static::class); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | public function addCustomFilter(string $attribute, $value, callable $callback): DataProviderInterface |
66 | 66 | { |
67 | - throw new NotSupportedException("Method addCustomFilter() is not supported in " . static::class); |
|
67 | + throw new NotSupportedException("Method addCustomFilter() is not supported in ".static::class); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | public function addDateFilter(string $attribute, $value, string $comparison = 'equal'): DataProviderInterface |
71 | 71 | { |
72 | - $comparisonFunc = lcfirst($comparison) . 'Date'; |
|
72 | + $comparisonFunc = lcfirst($comparison).'Date'; |
|
73 | 73 | if (method_exists($this, $comparisonFunc)) { |
74 | 74 | $this->$comparisonFunc($attribute, $value); |
75 | 75 | } else { |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | |
81 | 81 | protected function equalDate($attribute, $value): void |
82 | 82 | { |
83 | - throw new NotSupportedException("Method equalDate() is not supported in " . static::class); |
|
83 | + throw new NotSupportedException("Method equalDate() is not supported in ".static::class); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | |
@@ -95,10 +95,10 @@ discard block |
||
95 | 95 | if (is_array($data)) { |
96 | 96 | return new ArrayDataProvider($data); |
97 | 97 | } |
98 | - throw new DataGridException('Provided data must be one of: ' . implode(', ', [ |
|
98 | + throw new DataGridException('Provided data must be one of: '.implode(', ', [ |
|
99 | 99 | ServiceEntityRepository::class, |
100 | 100 | QueryBuilder::class, |
101 | 101 | 'Array' |
102 | - ]) . ', ' . (($type = gettype($data)) == 'object' ? get_class($data) : $type) . ' given'); |
|
102 | + ]).', '.(($type = gettype($data)) == 'object' ? get_class($data) : $type).' given'); |
|
103 | 103 | } |
104 | 104 | } |
105 | 105 | \ No newline at end of file |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | |
19 | 19 | public function getItems(): array |
20 | 20 | { |
21 | - return array_map(function ($row) { |
|
21 | + return array_map(function($row) { |
|
22 | 22 | $item = new DataGridItem(); |
23 | 23 | $item->setRow($row); |
24 | 24 | return $item; |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | |
44 | 44 | public function addEqualFilter(string $attribute, $value): DataProviderInterface |
45 | 45 | { |
46 | - $this->data = array_filter($this->data, function ($row) use ($attribute, $value) { |
|
46 | + $this->data = array_filter($this->data, function($row) use ($attribute, $value) { |
|
47 | 47 | if (!array_key_exists($attribute, $row)) { |
48 | 48 | return false; |
49 | 49 | } |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | |
55 | 55 | public function addLikeFilter(string $attribute, $value): DataProviderInterface |
56 | 56 | { |
57 | - $this->data = array_filter($this->data, function ($row) use ($attribute, $value) { |
|
57 | + $this->data = array_filter($this->data, function($row) use ($attribute, $value) { |
|
58 | 58 | if (!array_key_exists($attribute, $row)) { |
59 | 59 | return false; |
60 | 60 | } |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | |
66 | 66 | public function addCustomFilter(string $attribute, $value, callable $callback): DataProviderInterface |
67 | 67 | { |
68 | - $this->data = array_filter($this->data, function ($row) use ($attribute, $value, $callback) { |
|
68 | + $this->data = array_filter($this->data, function($row) use ($attribute, $value, $callback) { |
|
69 | 69 | return call_user_func_array($callback, [$row, $attribute, $value]); |
70 | 70 | }); |
71 | 71 | return $this; |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | |
74 | 74 | protected function buildCompare($attribute, $order) |
75 | 75 | { |
76 | - return function ($a, $b) use ($attribute, $order) { |
|
76 | + return function($a, $b) use ($attribute, $order) { |
|
77 | 77 | if (!array_key_exists($attribute, $a) || !array_key_exists($attribute, $b)) { |
78 | 78 | return 0; |
79 | 79 | } |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | protected function equalDate($attribute, $value): void |
96 | 96 | { |
97 | 97 | $date = new DateTime($value); |
98 | - $this->data = array_filter($this->data, function ($row) use ($attribute, $date) { |
|
98 | + $this->data = array_filter($this->data, function($row) use ($attribute, $date) { |
|
99 | 99 | if (!array_key_exists($attribute, $row)) { |
100 | 100 | return false; |
101 | 101 | } |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | protected function ltDate($attribute, $value): void |
115 | 115 | { |
116 | 116 | $date = new DateTime($value); |
117 | - $this->data = array_filter($this->data, function ($row) use ($attribute, $date) { |
|
117 | + $this->data = array_filter($this->data, function($row) use ($attribute, $date) { |
|
118 | 118 | if (!array_key_exists($attribute, $row)) { |
119 | 119 | return false; |
120 | 120 | } |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | protected function lteDate($attribute, $value): void |
134 | 134 | { |
135 | 135 | $date = (new DateTime($value))->modify('+1 day'); |
136 | - $this->data = array_filter($this->data, function ($row) use ($attribute, $date) { |
|
136 | + $this->data = array_filter($this->data, function($row) use ($attribute, $date) { |
|
137 | 137 | if (!array_key_exists($attribute, $row)) { |
138 | 138 | return false; |
139 | 139 | } |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | protected function gtDate($attribute, $value): void |
153 | 153 | { |
154 | 154 | $date = (new DateTime($value))->modify('+1 day'); |
155 | - $this->data = array_filter($this->data, function ($row) use ($attribute, $date) { |
|
155 | + $this->data = array_filter($this->data, function($row) use ($attribute, $date) { |
|
156 | 156 | if (!array_key_exists($attribute, $row)) { |
157 | 157 | return false; |
158 | 158 | } |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | protected function gteDate($attribute, $value): void |
172 | 172 | { |
173 | 173 | $date = new DateTime($value); |
174 | - $this->data = array_filter($this->data, function ($row) use ($attribute, $date) { |
|
174 | + $this->data = array_filter($this->data, function($row) use ($attribute, $date) { |
|
175 | 175 | if (!array_key_exists($attribute, $row)) { |
176 | 176 | return false; |
177 | 177 | } |