Code Duplication    Length = 13-34 lines in 2 locations

src/Kunstmaan/DashboardBundle/Command/Helper/Analytics/ChartDataCommandHelper.php 1 location

@@ 62-74 (lines=13) @@
59
            }
60
61
            // timestamp
62
            if ($timespan <= 1) {
63
                $timestamp = mktime($row[1], 0, 0, substr($row[0], 4, 2), substr($row[0], 6, 2), substr($row[0], 0, 4));
64
                $timestamp = date('Y-m-d H:00', $timestamp);
65
            } elseif ($timespan <= 7) {
66
                $timestamp = mktime($row[1], 0, 0, substr($row[0], 4, 2), substr($row[0], 6, 2), substr($row[0], 0, 4));
67
                $timestamp = date('Y-m-d H:00', $timestamp);
68
            } elseif ($timespan <= 31) {
69
                $timestamp = mktime(0, 0, 0, substr($row[2], 4, 2), substr($row[2], 6, 2), substr($row[2], 0, 4));
70
                $timestamp = date('Y-m-d H:00', $timestamp);
71
            } else {
72
                $timestamp = strtotime(substr($row[0], 0, 4) . 'W' . substr($row[0], 4, 2));
73
                $timestamp = date('Y-m-d H:00', $timestamp);
74
            }
75
76
            // add to chart array
77
            $chartEntry = array(

src/Kunstmaan/DashboardBundle/Command/Helper/Analytics/GoalCommandHelper.php 1 location

@@ 146-179 (lines=34) @@
143
            $goalEntry = array();
144
            foreach ($rows as $row) {
145
                // Create a timestamp for each goal visit (this depends on the timespan of the overview: split per hour, day, week, month)
146
                if ($timespan <= 1) {
147
                    $timestamp = mktime(
148
                        $row[1],
149
                        0,
150
                        0,
151
                        substr($row[0], 4, 2),
152
                        substr($row[0], 6, 2),
153
                        substr($row[0], 0, 4)
154
                    );
155
                    $timestamp = date('Y-m-d H:00', $timestamp);
156
                } elseif ($timespan <= 7) {
157
                    $timestamp = mktime(
158
                        $row[1],
159
                        0,
160
                        0,
161
                        substr($row[0], 4, 2),
162
                        substr($row[0], 6, 2),
163
                        substr($row[0], 0, 4)
164
                    );
165
                    $timestamp = date('Y-m-d H:00', $timestamp);
166
                } elseif ($timespan <= 31) {
167
                    $timestamp = mktime(
168
                        0,
169
                        0,
170
                        0,
171
                        substr($row[2], 4, 2),
172
                        substr($row[2], 6, 2),
173
                        substr($row[2], 0, 4)
174
                    );
175
                    $timestamp = date('Y-m-d H:00', $timestamp);
176
                } else {
177
                    $timestamp = strtotime(substr($row[0], 0, 4) . 'W' . substr($row[0], 4, 2));
178
                    $timestamp = date('Y-m-d H:00', $timestamp);
179
                }
180
                $goalEntry[$timestamp] = $row[$i + $start];
181
            }
182
            $goalCollection['goal' . $goaldata[$i]['position']]['name'] = $goaldata[$i]['name'];