Linux   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 20
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A inUse() 0 3 1
A getCoreCount() 0 3 1
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 Linux
12
 */
13
class Linux 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()) === 'linux';
23
    }
24
25
    /**
26
     * Counts CPU cores of the current system
27
     *
28
     * @return int
29
     */
30
    public function getCoreCount()
31
    {
32
        return (int) trim(shell_exec('nproc --all'));
33
    }
34
}
35