License::setSetting()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 5
rs 9.4285
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
/**
3
 * Jaeger
4
 *
5
 * @copyright	Copyright (c) 2015-2016, mithra62
6
 * @link		http://jaeger-app.com
7
 * @version		1.0
8
 * @filesource 	./License.php
9
 */
10
namespace JaegerApp;
11
12
/**
13
 * Jaeger - Licensing Object
14
 *
15
 * Contains the methods for validating the host system
16
 *
17
 * @package License
18
 * @author Eric Lamb <[email protected]>
19
 */
20
class License
21
{
22
23
    /**
24
     * The Setting object
25
     * 
26
     * @var \JaegerApp\Settings
27
     */
28
    protected $setting = null;
29
30
    /**
31
     * Sets the Setting object
32
     * 
33
     * @param \JaegerApp\Settings $settings            
34
     * @return \JaegerApp\License
35
     */
36
    public function setSetting(\JaegerApp\Settings $settings)
37
    {
38
        $this->setting = $settings;
39
        return $this;
40
    }
41
42
    /**
43
     * Validates a license number is valid
44
     * 
45
     * @param string $license            
46
     * @return number
47
     */
48
    public function validLicense($license)
49
    {
50
        return preg_match("/^([a-z0-9]{8})-([a-z0-9]{4})-([a-z0-9]{4})-([a-z0-9]{4})-([a-z0-9]{12})$/", $license);
51
    }
52
}