Mac::inUse()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
/**
3
 * @package     Cronfig Sysinfo Library
4
 * @link        https://github.com/cronfig/sysinfo
5
 * @license     http://opensource.org/licenses/MIT
6
 */
7
8
namespace Cronfig\Sysinfo;
9
10
/**
11
 * Class Mac
12
 */
13
class Mac extends AbstractOs implements OsInterface
14
{
15
    /**
16
     * Checks whether the current OS is equal to the current class
17
     *
18
     * @return bool
19
     */
20
    public function inUse()
21
    {
22
        return strtolower($this->getCurrentOsName()) === 'darwin';
23
    }
24
25
    /**
26
     * Counts CPU cores of the current system
27
     *
28
     * @return int
29
     */
30
    public function getCoreCount()
31
    {
32
        $this->requiredFunction('shell_exec');
33
34
        return (int) trim(shell_exec('sysctl -n hw.ncpu'));
35
    }
36
}
37