Completed
Push — master ( 994973...a422c2 )
by ARCANEDEV
06:22
created

AggregatesTrends::averageByMinutes()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 3
crap 2
1
<?php namespace Arcanedev\LaravelMetrics\Metrics\Concerns;
2
3
use Arcanedev\LaravelMetrics\Metrics\Trend;
4
5
/**
6
 * Trait     AggregatesTrends
7
 *
8
 * @package  Arcanedev\LaravelMetrics\Metrics\Concerns
9
 * @author   ARCANEDEV <[email protected]>
10
 */
11
trait AggregatesTrends
12
{
13
    /* -----------------------------------------------------------------
14
     |  Count Methods
15
     | -----------------------------------------------------------------
16
     */
17
18
    /**
19
     * Calculate the `count` of the metric over months.
20
     *
21
     * @param  \Illuminate\Database\Eloquent\Builder|string  $model
22
     * @param  string|null                                   $column
23
     *
24
     * @return \Arcanedev\LaravelMetrics\Results\TrendResult|mixed
25
     */
26 4
    public function countByMonths($model, $column = null)
27
    {
28 4
        return $this->count(Trend::BY_MONTHS, $model, $column);
0 ignored issues
show
Bug introduced by
It seems like count() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
29
    }
30
31
    /**
32
     * Calculate the `count` of the metric over weeks.
33
     *
34
     * @param  \Illuminate\Database\Eloquent\Builder|string  $model
35
     * @param  string|null                                   $column
36
     *
37
     * @return \Arcanedev\LaravelMetrics\Results\TrendResult|mixed
38
     */
39
    public function countByWeeks($model, $column = null)
40
    {
41
        return $this->count(Trend::BY_WEEKS, $model, $column);
0 ignored issues
show
Bug introduced by
It seems like count() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
42
    }
43
44
    /**
45
     * Calculate the `count` of the metric over days.
46
     *
47
     * @param  \Illuminate\Database\Eloquent\Builder|string  $model
48
     * @param  string|null                                   $column
49
     *
50
     * @return \Arcanedev\LaravelMetrics\Results\TrendResult|mixed
51
     */
52 8
    public function countByDays($model, $column = null)
53
    {
54 8
        return $this->count(Trend::BY_DAYS, $model, $column);
0 ignored issues
show
Bug introduced by
It seems like count() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
55
    }
56
57
    /**
58
     * Calculate the `count` of the metric over hours.
59
     *
60
     * @param  \Illuminate\Database\Eloquent\Builder|string  $model
61
     * @param  string|null                                   $column
62
     *
63
     * @return \Arcanedev\LaravelMetrics\Results\TrendResult|mixed
64
     */
65
    public function countByHours($model, $column = null)
66
    {
67
        return $this->count(Trend::BY_HOURS, $model, $column);
0 ignored issues
show
Bug introduced by
It seems like count() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
68
    }
69
70
    /**
71
     * Calculate the `count` of the metric over minutes.
72
     *
73
     * @param  \Illuminate\Database\Eloquent\Builder|string  $model
74
     * @param  string|null                                   $column
75
     *
76
     * @return \Arcanedev\LaravelMetrics\Results\TrendResult|mixed
77
     */
78
    public function countByMinutes($model, $column = null)
79
    {
80
        return $this->count(Trend::BY_MINUTES, $model, $column);
0 ignored issues
show
Bug introduced by
It seems like count() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
81
    }
82
83
    /* -----------------------------------------------------------------
84
     |  Average Methods
85
     | -----------------------------------------------------------------
86
     */
87
88
    /**
89
     * Calculate the `average` of the metric over months.
90
     *
91
     * @param  \Illuminate\Database\Eloquent\Builder|string  $model
92
     * @param  string                                        $column
93
     * @param  string|null                                   $dateColumn
94
     *
95
     * @return \Arcanedev\LaravelMetrics\Results\TrendResult|mixed
96
     */
97
    public function averageByMonths($model, $column, $dateColumn = null)
98
    {
99
        return $this->average(Trend::BY_MONTHS, $model, $column, $dateColumn);
0 ignored issues
show
Bug introduced by
The method average() does not exist on Arcanedev\LaravelMetrics...ncerns\AggregatesTrends. Did you maybe mean averageByMonths()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
100
    }
101
102
    /**
103
     * Calculate the `average` of the metric over weeks.
104
     *
105
     * @param  \Illuminate\Database\Eloquent\Builder|string  $model
106
     * @param  string                                        $column
107
     * @param  string|null                                   $dateColumn
108
     *
109
     * @return \Arcanedev\LaravelMetrics\Results\TrendResult|mixed
110
     */
111
    public function averageByWeeks($model, $column, $dateColumn = null)
112
    {
113
        return $this->average(Trend::BY_WEEKS, $model, $column, $dateColumn);
0 ignored issues
show
Bug introduced by
The method average() does not exist on Arcanedev\LaravelMetrics...ncerns\AggregatesTrends. Did you maybe mean averageByMonths()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
114
    }
115
116
    /**
117
     * Calculate the `average` of the metric over days.
118
     *
119
     * @param  \Illuminate\Database\Eloquent\Builder|string  $model
120
     * @param  string                                        $column
121
     * @param  string|null                                   $dateColumn
122
     *
123
     * @return \Arcanedev\LaravelMetrics\Results\TrendResult|mixed
124
     */
125
    public function averageByDays($model, $column, $dateColumn = null)
126
    {
127
        return $this->average(Trend::BY_DAYS, $model, $column, $dateColumn);
0 ignored issues
show
Bug introduced by
The method average() does not exist on Arcanedev\LaravelMetrics...ncerns\AggregatesTrends. Did you maybe mean averageByMonths()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
128
    }
129
130
    /**
131
     * Calculate the `average` of the metric over hours.
132
     *
133
     * @param  \Illuminate\Database\Eloquent\Builder|string  $model
134
     * @param  string                                        $column
135
     * @param  string|null                                   $dateColumn
136
     *
137
     * @return \Arcanedev\LaravelMetrics\Results\TrendResult|mixed
138
     */
139
    public function averageByHours($model, $column, $dateColumn = null)
140
    {
141
        return $this->average(Trend::BY_HOURS, $model, $column, $dateColumn);
0 ignored issues
show
Bug introduced by
The method average() does not exist on Arcanedev\LaravelMetrics...ncerns\AggregatesTrends. Did you maybe mean averageByMonths()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
142
    }
143
144
    /**
145
     * Calculate the `average` of the metric over minutes.
146
     *
147
     * @param  \Illuminate\Database\Eloquent\Builder|string  $model
148
     * @param  string                                        $column
149
     * @param  string|null                                   $dateColumn
150
     *
151
     * @return \Arcanedev\LaravelMetrics\Results\TrendResult|mixed
152
     */
153
    public function averageByMinutes($model, $column, $dateColumn = null)
154
    {
155
        return $this->average(Trend::BY_MINUTES, $model, $column, $dateColumn);
0 ignored issues
show
Bug introduced by
The method average() does not exist on Arcanedev\LaravelMetrics...ncerns\AggregatesTrends. Did you maybe mean averageByMonths()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
156
    }
157
158
    /* -----------------------------------------------------------------
159
     |  Sum Methods
160
     | -----------------------------------------------------------------
161
     */
162
163
    /**
164
     * Calculate the `sum` of the metric over months.
165
     *
166
     * @param  \Illuminate\Database\Eloquent\Builder|string  $model
167
     * @param  string                                        $column
168
     * @param  string|null                                   $dateColumn
169
     *
170
     * @return \Arcanedev\LaravelMetrics\Results\TrendResult|mixed
171
     */
172
    public function sumByMonths($model, $column, $dateColumn = null)
173
    {
174
        return $this->sum(Trend::BY_MONTHS, $model, $column, $dateColumn);
0 ignored issues
show
Bug introduced by
It seems like sum() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
175
    }
176
177
    /**
178
     * Calculate the `sum` of the metric over weeks.
179
     *
180
     * @param  \Illuminate\Database\Eloquent\Builder|string  $model
181
     * @param  string                                        $column
182
     * @param  string                                        $dateColumn
183
     *
184
     * @return \Arcanedev\LaravelMetrics\Results\TrendResult|mixed
185
     */
186
    public function sumByWeeks($model, $column, $dateColumn = null)
187
    {
188
        return $this->sum(Trend::BY_WEEKS, $model, $column, $dateColumn);
0 ignored issues
show
Bug introduced by
It seems like sum() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
189
    }
190
191
    /**
192
     * Calculate the `sum` of the metric over days.
193
     *
194
     * @param  \Illuminate\Database\Eloquent\Builder|string  $model
195
     * @param  string                                        $column
196
     * @param  string|null                                   $dateColumn
197
     *
198
     * @return \Arcanedev\LaravelMetrics\Results\TrendResult|mixed
199
     */
200
    public function sumByDays($model, $column, $dateColumn = null)
201
    {
202
        return $this->sum(Trend::BY_DAYS, $model, $column, $dateColumn);
0 ignored issues
show
Bug introduced by
It seems like sum() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
203
    }
204
205
    /**
206
     * Calculate the `sum` of the metric over hours.
207
     *
208
     * @param  \Illuminate\Database\Eloquent\Builder|string  $model
209
     * @param  string                                        $column
210
     * @param  string                                        $dateColumn
211
     *
212
     * @return \Arcanedev\LaravelMetrics\Results\TrendResult|mixed
213
     */
214
    public function sumByHours($model, $column, $dateColumn = null)
215
    {
216
        return $this->sum(Trend::BY_HOURS, $model, $column, $dateColumn);
0 ignored issues
show
Bug introduced by
It seems like sum() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
217
    }
218
219
    /**
220
     * Calculate the `sum` of the metric over minutes.
221
     *
222
     * @param  \Illuminate\Database\Eloquent\Builder|string  $model
223
     * @param  string                                        $column
224
     * @param  string|null                                   $dateColumn
225
     *
226
     * @return \Arcanedev\LaravelMetrics\Results\TrendResult|mixed
227
     */
228
    public function sumByMinutes($model, $column, $dateColumn = null)
229
    {
230
        return $this->sum(Trend::BY_MINUTES, $model, $column, $dateColumn);
0 ignored issues
show
Bug introduced by
It seems like sum() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
231
    }
232
233
    /* -----------------------------------------------------------------
234
     |  Max Methods
235
     | -----------------------------------------------------------------
236
     */
237
238
    /**
239
     * Calculate the `max` of the metric over months.
240
     *
241
     * @param  \Illuminate\Database\Eloquent\Builder|string  $model
242
     * @param  string                                        $column
243
     * @param  string|null                                   $dateColumn
244
     *
245
     * @return \Arcanedev\LaravelMetrics\Results\TrendResult|mixed
246
     */
247
    public function maxByMonths($model, $column, $dateColumn = null)
248
    {
249
        return $this->max(Trend::BY_MONTHS, $model, $column, $dateColumn);
0 ignored issues
show
Bug introduced by
It seems like max() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
250
    }
251
252
    /**
253
     * Calculate the `max` of the metric over weeks.
254
     *
255
     * @param  \Illuminate\Database\Eloquent\Builder|string  $model
256
     * @param  string                                        $column
257
     * @param  string|null                                   $dateColumn
258
     *
259
     * @return \Arcanedev\LaravelMetrics\Results\TrendResult|mixed
260
     */
261
    public function maxByWeeks($model, $column, $dateColumn = null)
262
    {
263
        return $this->max(Trend::BY_WEEKS, $model, $column, $dateColumn);
0 ignored issues
show
Bug introduced by
It seems like max() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
264
    }
265
266
    /**
267
     * Calculate the `max` of the metric over days.
268
     *
269
     * @param  \Illuminate\Database\Eloquent\Builder|string  $model
270
     * @param  string                                        $column
271
     * @param  string|null                                   $dateColumn
272
     *
273
     * @return \Arcanedev\LaravelMetrics\Results\TrendResult|mixed
274
     */
275
    public function maxByDays($model, $column, $dateColumn = null)
276
    {
277
        return $this->max(Trend::BY_DAYS, $model, $column, $dateColumn);
0 ignored issues
show
Bug introduced by
It seems like max() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
278
    }
279
280
    /**
281
     * Calculate the `max` of the metric over hours.
282
     *
283
     * @param  \Illuminate\Database\Eloquent\Builder|string  $model
284
     * @param  string                                        $column
285
     * @param  string|null                                   $dateColumn
286
     *
287
     * @return \Arcanedev\LaravelMetrics\Results\TrendResult|mixed
288
     */
289
    public function maxByHours($model, $column, $dateColumn = null)
290
    {
291
        return $this->max(Trend::BY_HOURS, $model, $column, $dateColumn);
0 ignored issues
show
Bug introduced by
It seems like max() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
292
    }
293
294
    /**
295
     * Calculate the `max` of the metric over minutes.
296
     *
297
     * @param  \Illuminate\Database\Eloquent\Builder|string  $model
298
     * @param  string                                        $column
299
     * @param  string|null                                   $dateColumn
300
     *
301
     * @return \Arcanedev\LaravelMetrics\Results\TrendResult|mixed
302
     */
303
    public function maxByMinutes($model, $column, $dateColumn = null)
304
    {
305
        return $this->max(Trend::BY_MINUTES, $model, $column, $dateColumn);
0 ignored issues
show
Bug introduced by
It seems like max() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
306
    }
307
308
    /* -----------------------------------------------------------------
309
     |  Min Methods
310
     | -----------------------------------------------------------------
311
     */
312
313
    /**
314
     * Calculate the `min` of the metric over months.
315
     *
316
     * @param  \Illuminate\Database\Eloquent\Builder|string  $model
317
     * @param  string                                        $column
318
     * @param  string|null                                   $dateColumn
319
     *
320
     * @return \Arcanedev\LaravelMetrics\Results\TrendResult|mixed
321
     */
322
    public function minByMonths($model, $column, $dateColumn = null)
323
    {
324
        return $this->min(Trend::BY_MONTHS, $model, $column, $dateColumn);
0 ignored issues
show
Bug introduced by
It seems like min() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
325
    }
326
327
    /**
328
     * Calculate the `min` of the metric over weeks.
329
     *
330
     * @param  \Illuminate\Database\Eloquent\Builder|string  $model
331
     * @param  string                                        $column
332
     * @param  string|null                                   $dateColumn
333
     *
334
     * @return \Arcanedev\LaravelMetrics\Results\TrendResult|mixed
335
     */
336
    public function minByWeeks($model, $column, $dateColumn = null)
337
    {
338
        return $this->min(Trend::BY_WEEKS, $model, $column, $dateColumn);
0 ignored issues
show
Bug introduced by
It seems like min() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
339
    }
340
341
    /**
342
     * Calculate the `min` of the metric over days.
343
     *
344
     * @param  \Illuminate\Database\Eloquent\Builder|string  $model
345
     * @param  string                                        $column
346
     * @param  string|null                                   $dateColumn
347
     *
348
     * @return \Arcanedev\LaravelMetrics\Results\TrendResult|mixed
349
     */
350
    public function minByDays($model, $column, $dateColumn = null)
351
    {
352
        return $this->min(Trend::BY_DAYS, $model, $column, $dateColumn);
0 ignored issues
show
Bug introduced by
It seems like min() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
353
    }
354
355
    /**
356
     * Calculate the `min` of the metric over hours.
357
     *
358
     * @param  \Illuminate\Database\Eloquent\Builder|string  $model
359
     * @param  string                                        $column
360
     * @param  string|null                                   $dateColumn
361
     *
362
     * @return \Arcanedev\LaravelMetrics\Results\TrendResult|mixed
363
     */
364
    public function minByHours($model, $column, $dateColumn = null)
365
    {
366
        return $this->min(Trend::BY_HOURS, $model, $column, $dateColumn);
0 ignored issues
show
Bug introduced by
It seems like min() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
367
    }
368
369
    /**
370
     * Calculate the `min` of the metric over minutes.
371
     *
372
     * @param  \Illuminate\Database\Eloquent\Builder|string  $model
373
     * @param  string                                        $column
374
     * @param  string|null                                   $dateColumn
375
     *
376
     * @return \Arcanedev\LaravelMetrics\Results\TrendResult|mixed
377
     */
378
    public function minByMinutes($model, $column, $dateColumn = null)
379
    {
380
        return $this->min(Trend::BY_MINUTES, $model, $column, $dateColumn);
0 ignored issues
show
Bug introduced by
It seems like min() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
381
    }
382
}
383