Completed
Branch master (3b97d6)
by Pavel
09:49
created
src/Grid/DataGridFactory.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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);
Please login to merge, or discard this patch.
src/Grid/Hydrators/DataGridHydrator.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@
 block discarded – undo
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;
Please login to merge, or discard this patch.
src/Grid/DataGridItem.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/Grid/DataGrid.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@
 block discarded – undo
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
             }
Please login to merge, or discard this patch.
src/Grid/Providers/RepositoryDataProvider.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@
 block discarded – undo
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);
Please login to merge, or discard this patch.
src/Grid/Providers/QueryBuilderDataProvider.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
Please login to merge, or discard this patch.
src/Grid/DataGridBuilder.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@
 block discarded – undo
55 55
     public function addColumn(string $columnClass, array $config = []): DataGridBuilderInterface
56 56
     {
57 57
         if (!is_subclass_of($columnClass, AbstractColumn::class)) {
58
-            throw new InvalidArgumentException('Expected subclass of' . AbstractColumn::class);
58
+            throw new InvalidArgumentException('Expected subclass of'.AbstractColumn::class);
59 59
         }
60 60
         /**
61 61
          * @var AbstractColumn $column
Please login to merge, or discard this patch.
src/Grid/Columns/DataColumn.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@
 block discarded – undo
47 47
     protected function checkConfiguration()
48 48
     {
49 49
         if ((!is_string($this->attribute) || empty($this->attribute)) && $this->value === null) {
50
-            throw new DataGridException('attribute or value property must be set for ' . static::class);
50
+            throw new DataGridException('attribute or value property must be set for '.static::class);
51 51
         }
52 52
     }
53 53
 
Please login to merge, or discard this patch.
src/Grid/Columns/RelationColumn.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
         return !empty($this->label)
24 24
             ? ucfirst($this->label)
25 25
             : (!empty($this->attribute)
26
-                ? ucfirst($this->attribute) . '.' . ucfirst($this->labelAttribute)
26
+                ? ucfirst($this->attribute).'.'.ucfirst($this->labelAttribute)
27 27
                 : ucfirst($this->labelAttribute)
28 28
             );
29 29
     }
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
     {
33 33
         $obj = $this->getCellValue($entity);
34 34
         if (is_object($obj)) {
35
-            $result = $obj->{'get' . ucfirst($this->labelAttribute)}();
35
+            $result = $obj->{'get'.ucfirst($this->labelAttribute)}();
36 36
             return $this->format === 'html'
37 37
                 ? $result
38 38
                 : htmlspecialchars($result);
Please login to merge, or discard this patch.