Platform::isHHVM()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
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