Platform   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 52
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 5
lcom 0
cbo 0
dl 0
loc 52
rs 10
c 1
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A isWindows() 0 4 1
A isUnix() 0 4 1
A getPlatform() 0 8 2
A isHHVM() 0 4 1
1
<?php namespace Indatus\Dispatcher;
2
3
/**
4
 * This file is part of Dispatcher
5
 *
6
 * (c) Ben Kuhl <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 *
11
 * @codeCoverageIgnore
12
 */
13
class Platform
14
{
15
    /**
16
     * @var int
17
     */
18
    const UNIX = 0;
19
20
    /**
21
     * @var int
22
     */
23
    const WINDOWS = 1;
24
25
    /**
26
     * Determine if the current OS is Windows
27
     * @return bool
28
     */
29
    public function isWindows()
30
    {
31
        return $this->getPlatform() == self::WINDOWS;
32
    }
33
34
    /**
35
     * Determine if the current OS is Unix
36
     * @return bool
37
     */
38
    public function isUnix()
39
    {
40
        return $this->getPlatform() == self::UNIX;
41
    }
42
43
    /**
44
     * @return integer
45
     */
46
    private function getPlatform()
47
    {
48
        if (strncasecmp(PHP_OS, "Win", 3) == 0) {
49
            return self::WINDOWS;
50
        } else {
51
            return self::UNIX;
52
        }
53
    }
54
55
    /**
56
     * Determine if we're running in HHVM
57
     *
58
     * @return bool
59
     */
60
    public function isHHVM()
61
    {
62
        return defined('HHVM_VERSION');
63
    }
64
}
65