Passed
Push — master ( 7a7143...02d84d )
by Patrick
02:37
created
library/Trapdirector/Tables/TrapDirectorTableGrouping.php 3 patches
Indentation   +69 added lines, -69 removed lines patch added patch discarded remove patch
@@ -7,86 +7,86 @@
 block discarded – undo
7 7
 {
8 8
     
9 9
   
10
-    /*************** Grouping ************/
10
+	/*************** Grouping ************/
11 11
     
12
-    /** @var boolean $grouppingActive set to true if grouping is active by query or function call */
13
-    protected $grouppingActive=false;
12
+	/** @var boolean $grouppingActive set to true if grouping is active by query or function call */
13
+	protected $grouppingActive=false;
14 14
     
15
-    /** @var string $groupingColumn Name of column (can be hidden) for grouping */
16
-    protected $groupingColumn='';
15
+	/** @var string $groupingColumn Name of column (can be hidden) for grouping */
16
+	protected $groupingColumn='';
17 17
     
18
-    /**@var string $groupingVal Current value of grouping column in row (used while rendering) */
19
-    protected $groupingVal='';
18
+	/**@var string $groupingVal Current value of grouping column in row (used while rendering) */
19
+	protected $groupingVal='';
20 20
     
21
-    /** @var integer $groupingColSpan colspan of grouping line : set to table titles in init */
22
-    protected $groupingColSpan=1;
21
+	/** @var integer $groupingColSpan colspan of grouping line : set to table titles in init */
22
+	protected $groupingColSpan=1;
23 23
       
24
-    /*****************  Grouping ****************/
24
+	/*****************  Grouping ****************/
25 25
     
26
-    /**
27
-     * Set grouping. column must be DB name
28
-     * @param string $columnDBName
29
-     */
30
-    public function setGrouping(string $columnDBName)
31
-    {
32
-        $this->groupingColumn = $columnDBName;
33
-        $this->grouppingActive = TRUE;
34
-    }
26
+	/**
27
+	 * Set grouping. column must be DB name
28
+	 * @param string $columnDBName
29
+	 */
30
+	public function setGrouping(string $columnDBName)
31
+	{
32
+		$this->groupingColumn = $columnDBName;
33
+		$this->grouppingActive = TRUE;
34
+	}
35 35
     
36
-    /**
37
-     * Init of grouping before rendering
38
-     */
39
-    public function initGrouping()
40
-    {
41
-        $this->groupingVal = '';
42
-        $this->groupingColSpan = count($this->titles);
43
-    }
36
+	/**
37
+	 * Init of grouping before rendering
38
+	 */
39
+	public function initGrouping()
40
+	{
41
+		$this->groupingVal = '';
42
+		$this->groupingColSpan = count($this->titles);
43
+	}
44 44
     
45
-    /**
46
-     * Function to print grouping value (for ovveride in specific tables)
47
-     * @param string $value
48
-     * @return string
49
-     */
50
-    public function groupingPrintData( string $value )
51
-    {
52
-        $html = "$value";
53
-        return $html;
54
-    }
45
+	/**
46
+	 * Function to print grouping value (for ovveride in specific tables)
47
+	 * @param string $value
48
+	 * @return string
49
+	 */
50
+	public function groupingPrintData( string $value )
51
+	{
52
+		$html = "$value";
53
+		return $html;
54
+	}
55 55
     
56
-    /**
57
-     * When to display new grouping line  (for ovveride in specific tables)
58
-     * @param string $val1 Current value in grouping
59
-     * @param string $val2 Value of current line
60
-     * @return boolean TRUE if a new grouping line is needed.
61
-     */
62
-    public function groupingEvalNext(string $val1, string $val2)
63
-    {
64
-        if ($val1 != $val2)
65
-            return TRUE;
66
-        else
67
-            return FALSE;
68
-    }
56
+	/**
57
+	 * When to display new grouping line  (for ovveride in specific tables)
58
+	 * @param string $val1 Current value in grouping
59
+	 * @param string $val2 Value of current line
60
+	 * @return boolean TRUE if a new grouping line is needed.
61
+	 */
62
+	public function groupingEvalNext(string $val1, string $val2)
63
+	{
64
+		if ($val1 != $val2)
65
+			return TRUE;
66
+		else
67
+			return FALSE;
68
+	}
69 69
     
70
-    /**
71
-     * Called before each line to check if grouping line is needed.
72
-     * @param mixed $values
73
-     * @return string with line or empty.
74
-     */
75
-    public function groupingNextLine( $values)
76
-    {
77
-        if ($this->grouppingActive === FALSE) return '';
70
+	/**
71
+	 * Called before each line to check if grouping line is needed.
72
+	 * @param mixed $values
73
+	 * @return string with line or empty.
74
+	 */
75
+	public function groupingNextLine( $values)
76
+	{
77
+		if ($this->grouppingActive === FALSE) return '';
78 78
 
79
-        $dbcol = $this->groupingColumn;
80
-        $dbVal = $values->$dbcol;
81
-        if ( $dbVal === NULL ) $dbVal = '0'; // Set default to 0
82
-        if ($this->groupingVal == '' || $this->groupingEvalNext($this->groupingVal ,$dbVal) === TRUE )
83
-        {
84
-            $this->groupingVal = $dbVal;
85
-            $html = '<tr><th colspan="'. $this->groupingColSpan .'">'. $this->groupingPrintData($this->groupingVal) .'</th></tr>';
86
-            return $html;
87
-        }
88
-        return '';
79
+		$dbcol = $this->groupingColumn;
80
+		$dbVal = $values->$dbcol;
81
+		if ( $dbVal === NULL ) $dbVal = '0'; // Set default to 0
82
+		if ($this->groupingVal == '' || $this->groupingEvalNext($this->groupingVal ,$dbVal) === TRUE )
83
+		{
84
+			$this->groupingVal = $dbVal;
85
+			$html = '<tr><th colspan="'. $this->groupingColSpan .'">'. $this->groupingPrintData($this->groupingVal) .'</th></tr>';
86
+			return $html;
87
+		}
88
+		return '';
89 89
 
90
-    }
90
+	}
91 91
  
92 92
 }
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -29,8 +29,8 @@  discard block
 block discarded – undo
29 29
      */
30 30
     public function setGrouping(string $columnDBName)
31 31
     {
32
-        $this->groupingColumn = $columnDBName;
33
-        $this->grouppingActive = TRUE;
32
+        $this->groupingColumn=$columnDBName;
33
+        $this->grouppingActive=TRUE;
34 34
     }
35 35
     
36 36
     /**
@@ -38,8 +38,8 @@  discard block
 block discarded – undo
38 38
      */
39 39
     public function initGrouping()
40 40
     {
41
-        $this->groupingVal = '';
42
-        $this->groupingColSpan = count($this->titles);
41
+        $this->groupingVal='';
42
+        $this->groupingColSpan=count($this->titles);
43 43
     }
44 44
     
45 45
     /**
@@ -47,9 +47,9 @@  discard block
 block discarded – undo
47 47
      * @param string $value
48 48
      * @return string
49 49
      */
50
-    public function groupingPrintData( string $value )
50
+    public function groupingPrintData(string $value)
51 51
     {
52
-        $html = "$value";
52
+        $html="$value";
53 53
         return $html;
54 54
     }
55 55
     
@@ -72,17 +72,17 @@  discard block
 block discarded – undo
72 72
      * @param mixed $values
73 73
      * @return string with line or empty.
74 74
      */
75
-    public function groupingNextLine( $values)
75
+    public function groupingNextLine($values)
76 76
     {
77 77
         if ($this->grouppingActive === FALSE) return '';
78 78
 
79
-        $dbcol = $this->groupingColumn;
80
-        $dbVal = $values->$dbcol;
81
-        if ( $dbVal === NULL ) $dbVal = '0'; // Set default to 0
82
-        if ($this->groupingVal == '' || $this->groupingEvalNext($this->groupingVal ,$dbVal) === TRUE )
79
+        $dbcol=$this->groupingColumn;
80
+        $dbVal=$values->$dbcol;
81
+        if ($dbVal === NULL) $dbVal='0'; // Set default to 0
82
+        if ($this->groupingVal == '' || $this->groupingEvalNext($this->groupingVal, $dbVal) === TRUE)
83 83
         {
84
-            $this->groupingVal = $dbVal;
85
-            $html = '<tr><th colspan="'. $this->groupingColSpan .'">'. $this->groupingPrintData($this->groupingVal) .'</th></tr>';
84
+            $this->groupingVal=$dbVal;
85
+            $html='<tr><th colspan="'.$this->groupingColSpan.'">'.$this->groupingPrintData($this->groupingVal).'</th></tr>';
86 86
             return $html;
87 87
         }
88 88
         return '';
Please login to merge, or discard this patch.
Braces   +12 added lines, -6 removed lines patch added patch discarded remove patch
@@ -61,10 +61,11 @@  discard block
 block discarded – undo
61 61
      */
62 62
     public function groupingEvalNext(string $val1, string $val2)
63 63
     {
64
-        if ($val1 != $val2)
65
-            return TRUE;
66
-        else
67
-            return FALSE;
64
+        if ($val1 != $val2) {
65
+                    return TRUE;
66
+        } else {
67
+                    return FALSE;
68
+        }
68 69
     }
69 70
     
70 71
     /**
@@ -74,11 +75,16 @@  discard block
 block discarded – undo
74 75
      */
75 76
     public function groupingNextLine( $values)
76 77
     {
77
-        if ($this->grouppingActive === FALSE) return '';
78
+        if ($this->grouppingActive === FALSE) {
79
+        	return '';
80
+        }
78 81
 
79 82
         $dbcol = $this->groupingColumn;
80 83
         $dbVal = $values->$dbcol;
81
-        if ( $dbVal === NULL ) $dbVal = '0'; // Set default to 0
84
+        if ( $dbVal === NULL ) {
85
+        	$dbVal = '0';
86
+        }
87
+        // Set default to 0
82 88
         if ($this->groupingVal == '' || $this->groupingEvalNext($this->groupingVal ,$dbVal) === TRUE )
83 89
         {
84 90
             $this->groupingVal = $dbVal;
Please login to merge, or discard this patch.