SitemapDataService::mapTimeout2Period()   A
last analyzed

Complexity

Conditions 6
Paths 6

Size

Total Lines 19

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 19
rs 9.0111
c 0
b 0
f 0
cc 6
nc 6
nop 1
1
<?php
2
3
/**
4
 * Sitemap data service
5
 */
6
7
namespace FRUIT\GoogleServices\Service;
8
9
/**
10
 * Sitemap data service
11
 */
12
class SitemapDataService
13
{
14
15
    /**
16
     * Map timestamp to period
17
     *
18
     * @param integer $sec
19
     *
20
     * @return string
21
     */
22
    public static function mapTimeout2Period($sec)
23
    {
24
        if ($sec <= 0) {
25
            return 'monthly';
26
        }
27
        if ($sec <= 1800) {
28
            return 'always';
29
        }
30
        if ($sec <= 14400) {
31
            return 'hourly';
32
        }
33
        if ($sec <= 172800) {
34
            return 'daily';
35
        }
36
        if ($sec <= 604800) {
37
            return 'weekly';
38
        }
39
        return 'monthly';
40
    }
41
}
42