Passed
Push — master ( 2259c5...50e852 )
by Jan
05:34
created
src/DataTables/Column/EntityColumn.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -60,12 +60,12 @@
 block discarded – undo
60 60
 
61 61
         $resolver->setRequired('property');
62 62
 
63
-        $resolver->setDefault('field', static function (Options $option) {
63
+        $resolver->setDefault('field', static function(Options $option) {
64 64
             return $option['property'].'.name';
65 65
         });
66 66
 
67
-        $resolver->setDefault('render', function (Options $options) {
68
-            return function ($value, $context) use ($options) {
67
+        $resolver->setDefault('render', function(Options $options) {
68
+            return function($value, $context) use ($options) {
69 69
                 if ($this->accessor->isReadable($context, $options['property'])) {
70 70
                     $entity = $this->accessor->getValue($context, $options['property']);
71 71
                 } else {
Please login to merge, or discard this patch.
src/DataTables/Helpers/PartDataTableHelper.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@
 block discarded – undo
59 59
         }
60 60
         if ($context->getBuiltProject() !== null) {
61 61
             $icon = sprintf('<i class="fa-solid fa-box-archive fa-fw me-1" title="%s"></i>',
62
-                $this->translator->trans('part.info.projectBuildPart.hint') . ': ' . $context->getBuiltProject()->getName());
62
+                $this->translator->trans('part.info.projectBuildPart.hint').': '.$context->getBuiltProject()->getName());
63 63
         }
64 64
 
65 65
 
Please login to merge, or discard this patch.
src/DataTables/Filters/Constraints/FilterTrait.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
         //Replace all special characters with underscores
54 54
         $property = preg_replace('/[^a-zA-Z0-9_]/', '_', $property);
55 55
         //Add a random number to the end of the property name for uniqueness
56
-        return $property . '_' . uniqid("", false);
56
+        return $property.'_'.uniqid("", false);
57 57
     }
58 58
 
59 59
     /**
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
             $expression = sprintf("%s %s :%s", $property, $comparison_operator, $parameterIdentifier);
73 73
         }
74 74
 
75
-        if($this->useHaving || $this->isAggregateFunctionString($property)) { //If the property is an aggregate function, we have to use the "having" instead of the "where"
75
+        if ($this->useHaving || $this->isAggregateFunctionString($property)) { //If the property is an aggregate function, we have to use the "having" instead of the "where"
76 76
             $queryBuilder->andHaving($expression);
77 77
         } else {
78 78
             $queryBuilder->andWhere($expression);
Please login to merge, or discard this patch.
src/DataTables/Filters/Constraints/BooleanConstraint.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@
 block discarded – undo
62 62
     public function apply(QueryBuilder $queryBuilder): void
63 63
     {
64 64
         //Do not apply a filter if value is null (filter is set to ignore)
65
-        if(!$this->isEnabled()) {
65
+        if (!$this->isEnabled()) {
66 66
             return;
67 67
         }
68 68
 
Please login to merge, or discard this patch.
src/DataTables/Filters/Constraints/TextConstraint.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -86,16 +86,16 @@  discard block
 block discarded – undo
86 86
 
87 87
     public function apply(QueryBuilder $queryBuilder): void
88 88
     {
89
-        if(!$this->isEnabled()) {
89
+        if (!$this->isEnabled()) {
90 90
             return;
91 91
         }
92 92
 
93
-        if(!in_array($this->operator, self::ALLOWED_OPERATOR_VALUES, true)) {
94
-            throw new \RuntimeException('Invalid operator '. $this->operator . ' provided. Valid operators are '. implode(', ', self::ALLOWED_OPERATOR_VALUES));
93
+        if (!in_array($this->operator, self::ALLOWED_OPERATOR_VALUES, true)) {
94
+            throw new \RuntimeException('Invalid operator '.$this->operator.' provided. Valid operators are '.implode(', ', self::ALLOWED_OPERATOR_VALUES));
95 95
         }
96 96
 
97 97
         //Equal and not equal can be handled easily
98
-        if($this->operator === '=' || $this->operator === '!=') {
98
+        if ($this->operator === '=' || $this->operator === '!=') {
99 99
 
100 100
             $this->addSimpleAndConstraint($queryBuilder, $this->property, $this->identifier, $this->operator, $this->value);
101 101
             return;
@@ -106,11 +106,11 @@  discard block
 block discarded – undo
106 106
         if ($this->operator === 'LIKE') {
107 107
             $like_value = $this->value;
108 108
         } else if ($this->operator === 'STARTS') {
109
-            $like_value = $this->value . '%';
109
+            $like_value = $this->value.'%';
110 110
         } else if ($this->operator === 'ENDS') {
111
-            $like_value = '%' . $this->value;
111
+            $like_value = '%'.$this->value;
112 112
         } else if ($this->operator === 'CONTAINS') {
113
-            $like_value = '%' . $this->value . '%';
113
+            $like_value = '%'.$this->value.'%';
114 114
         }
115 115
 
116 116
         if ($like_value !== null) {
Please login to merge, or discard this patch.
src/DataTables/Filters/Constraints/IntConstraint.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -26,10 +26,10 @@
 block discarded – undo
26 26
 {
27 27
     public function apply(QueryBuilder $queryBuilder): void
28 28
     {
29
-        if($this->value1 !== null) {
29
+        if ($this->value1 !== null) {
30 30
             $this->value1 = (int) $this->value1;
31 31
         }
32
-        if($this->value2 !== null) {
32
+        if ($this->value2 !== null) {
33 33
             $this->value2 = (int) $this->value2;
34 34
         }
35 35
 
Please login to merge, or discard this patch.
src/DataTables/Filters/Constraints/Part/ParameterConstraint.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -53,8 +53,8 @@  discard block
 block discarded – undo
53 53
         //The alias has to be uniq for each subquery, so generate a random one
54 54
         $this->alias = uniqid('param_', false);
55 55
 
56
-        $this->value_text = new TextConstraint($this->alias . '.value_text');
57
-        $this->value = new ParameterValueConstraint($this->alias );
56
+        $this->value_text = new TextConstraint($this->alias.'.value_text');
57
+        $this->value = new ParameterValueConstraint($this->alias);
58 58
     }
59 59
 
60 60
     public function isEnabled(): bool
@@ -69,26 +69,26 @@  discard block
 block discarded – undo
69 69
 
70 70
 
71 71
 
72
-        $subqb->select('COUNT(' . $this->alias . ')')
72
+        $subqb->select('COUNT('.$this->alias.')')
73 73
             ->from(PartParameter::class, $this->alias)
74
-            ->where($this->alias . '.element = part');
74
+            ->where($this->alias.'.element = part');
75 75
 
76 76
         if (!empty($this->name)) {
77 77
             $paramName = $this->generateParameterIdentifier('params.name');
78
-            $subqb->andWhere($this->alias . '.name = :' . $paramName);
79
-            $queryBuilder->setParameter($paramName,  $this->name);
78
+            $subqb->andWhere($this->alias.'.name = :'.$paramName);
79
+            $queryBuilder->setParameter($paramName, $this->name);
80 80
         }
81 81
 
82 82
         if (!empty($this->symbol)) {
83 83
             $paramName = $this->generateParameterIdentifier('params.symbol');
84
-            $subqb->andWhere($this->alias . '.symbol = :' . $paramName);
85
-            $queryBuilder->setParameter($paramName,  $this->symbol);
84
+            $subqb->andWhere($this->alias.'.symbol = :'.$paramName);
85
+            $queryBuilder->setParameter($paramName, $this->symbol);
86 86
         }
87 87
 
88 88
         if (!empty($this->unit)) {
89 89
             $paramName = $this->generateParameterIdentifier('params.unit');
90
-            $subqb->andWhere($this->alias . '.unit = :' . $paramName);
91
-            $queryBuilder->setParameter($paramName,  $this->unit);
90
+            $subqb->andWhere($this->alias.'.unit = :'.$paramName);
91
+            $queryBuilder->setParameter($paramName, $this->unit);
92 92
         }
93 93
 
94 94
         //Apply all subfilters
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
             $queryBuilder->setParameter($parameter->getName(), $parameter->getValue());
102 102
         }
103 103
 
104
-        $queryBuilder->andWhere('(' . $subqb->getDQL() . ') > 0');
104
+        $queryBuilder->andWhere('('.$subqb->getDQL().') > 0');
105 105
     }
106 106
 
107 107
     /**
Please login to merge, or discard this patch.
src/DataTables/Filters/Constraints/Part/TagsConstraint.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -102,34 +102,34 @@
 block discarded – undo
102 102
      */
103 103
     protected function getExpressionForTag(QueryBuilder $queryBuilder, string $tag): Expr\Orx
104 104
     {
105
-        $tag_identifier_prefix = uniqid($this->identifier . '_', false);
105
+        $tag_identifier_prefix = uniqid($this->identifier.'_', false);
106 106
 
107 107
         $expr = $queryBuilder->expr();
108 108
 
109 109
         $tmp = $expr->orX(
110
-            $expr->like($this->property, ':' . $tag_identifier_prefix . '_1'),
111
-            $expr->like($this->property, ':' . $tag_identifier_prefix . '_2'),
112
-            $expr->like($this->property, ':' . $tag_identifier_prefix . '_3'),
113
-            $expr->eq($this->property, ':' . $tag_identifier_prefix . '_4'),
110
+            $expr->like($this->property, ':'.$tag_identifier_prefix.'_1'),
111
+            $expr->like($this->property, ':'.$tag_identifier_prefix.'_2'),
112
+            $expr->like($this->property, ':'.$tag_identifier_prefix.'_3'),
113
+            $expr->eq($this->property, ':'.$tag_identifier_prefix.'_4'),
114 114
         );
115 115
 
116 116
         //Set the parameters for the LIKE expression, in each variation of the tag (so with a comma, at the end, at the beginning, and on both ends, and equaling the tag)
117
-        $queryBuilder->setParameter($tag_identifier_prefix . '_1', '%,' . $tag . ',%');
118
-        $queryBuilder->setParameter($tag_identifier_prefix . '_2', '%,' . $tag);
119
-        $queryBuilder->setParameter($tag_identifier_prefix . '_3', $tag . ',%');
120
-        $queryBuilder->setParameter($tag_identifier_prefix . '_4', $tag);
117
+        $queryBuilder->setParameter($tag_identifier_prefix.'_1', '%,'.$tag.',%');
118
+        $queryBuilder->setParameter($tag_identifier_prefix.'_2', '%,'.$tag);
119
+        $queryBuilder->setParameter($tag_identifier_prefix.'_3', $tag.',%');
120
+        $queryBuilder->setParameter($tag_identifier_prefix.'_4', $tag);
121 121
 
122 122
         return $tmp;
123 123
     }
124 124
 
125 125
     public function apply(QueryBuilder $queryBuilder): void
126 126
     {
127
-        if(!$this->isEnabled()) {
127
+        if (!$this->isEnabled()) {
128 128
             return;
129 129
         }
130 130
 
131
-        if(!in_array($this->operator, self::ALLOWED_OPERATOR_VALUES, true)) {
132
-            throw new \RuntimeException('Invalid operator '. $this->operator . ' provided. Valid operators are '. implode(', ', self::ALLOWED_OPERATOR_VALUES));
131
+        if (!in_array($this->operator, self::ALLOWED_OPERATOR_VALUES, true)) {
132
+            throw new \RuntimeException('Invalid operator '.$this->operator.' provided. Valid operators are '.implode(', ', self::ALLOWED_OPERATOR_VALUES));
133 133
         }
134 134
 
135 135
         $tagsExpressions = [];
Please login to merge, or discard this patch.
src/DataTables/Filters/Constraints/Part/ParameterValueConstraint.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -37,13 +37,13 @@
 block discarded – undo
37 37
     public function __construct(string $alias) {
38 38
         $this->alias = $alias;
39 39
 
40
-        parent::__construct($alias . '.value_typical');
40
+        parent::__construct($alias.'.value_typical');
41 41
     }
42 42
 
43 43
     public function apply(QueryBuilder $queryBuilder): void
44 44
     {
45 45
         //Skip if not enabled
46
-        if(!$this->isEnabled()) {
46
+        if (!$this->isEnabled()) {
47 47
             return;
48 48
         }
49 49
 
Please login to merge, or discard this patch.