danielme85 / simple-server-info
Showing 1 of 1 files from the diff.

@@ -202,7 +202,7 @@
Loading
202 202
                else {
203 203
                    $keypos = strpos($row, ':');
204 204
                    $key = trim(strtolower(str_replace(' ', '_', substr($row, 0, $keypos))));
205 -
                    if (empty($returnonly) or in_array($key, $returnonly)) {
205 +
                    if (empty($returnonly) or (is_array($returnonly) && in_array($key, $returnonly))) {
206 206
                        $value = trim(str_replace(':', '', substr($row, $keypos)));
207 207
                        $results[$cpu][$key] = $value;
208 208
                    }
@@ -541,10 +541,10 @@
Loading
541 541
    public function processesActiveOrRunning($returnonly = null, string $returntype = null) : array
542 542
    {
543 543
        //set min required data if we want to get active processes or running.
544 -
        if (!in_array('cpu_usage', $returnonly)) {
544 +
        if (is_array($returnonly) && !in_array('cpu_usage', $returnonly)) {
545 545
            $returnonly[] = 'cpu_usage';
546 546
        }
547 -
        if (!in_array('state', $returnonly)) {
547 +
        if (is_array($returnonly) && !in_array('state', $returnonly)) {
548 548
            $returnonly[] = 'state';
549 549
        }
550 550
@@ -592,7 +592,7 @@
Loading
592 592
    private function getProcessStatus($pid, $returnonly, $runningonly) : array
593 593
    {
594 594
        if ($runningonly and !empty($returnonly)) {
595 -
            if (!in_array('state', $returnonly)) {
595 +
            if (is_array($returnonly) && !in_array('state', $returnonly)) {
596 596
                $returnonly[] = 'state';
597 597
            }
598 598
        }
@@ -602,7 +602,7 @@
Loading
602 602
                if (!empty($row)) {
603 603
                    $keypos = strpos($row, ':');
604 604
                    $key = trim(strtolower(str_replace(' ', '_', substr($row, 0, $keypos))));
605 -
                    if (empty($returnonly) or in_array($key, $returnonly)) {
605 +
                    if (empty($returnonly) or (is_array($returnonly) && in_array($key, $returnonly))) {
606 606
                        $value = trim(str_replace(':', '', substr($row, $keypos)));
607 607
                        $results[$key] = $value;
608 608
                    }
@@ -626,7 +626,7 @@
Loading
626 626
    private function getProcessStats($pid, $returnonly, $runningonly) : array
627 627
    {
628 628
        if ($runningonly and !empty($returnonly)) {
629 -
            if (!in_array('state', $returnonly)) {
629 +
            if (is_array($returnonly) && !in_array('state', $returnonly)) {
630 630
                $returnonly[] = 'state';
631 631
            }
632 632
        }
@@ -646,7 +646,7 @@
Loading
646 646
                    if (!$runningonly or ($statArray[2] === 'R')) {
647 647
                        $i = 0;
648 648
                        foreach ($headers as $header) {
649 -
                            if (empty($returnonly) or in_array($header, $returnonly)) {
649 +
                            if (empty($returnonly) or (is_array($returnonly) && in_array($header, $returnonly))) {
650 650
                                $results[$header] = $statArray[$i] ?? null;
651 651
                            }
652 652
                            $i++;
@@ -698,7 +698,7 @@
Loading
698 698
                }
699 699
            }
700 700
            if (!empty($returnonly)) {
701 -
                if (in_array('cpu_usage', $returnonly)) {
701 +
                if (is_array($returnonly) && in_array('cpu_usage', $returnonly)) {
702 702
                    $cpuUsage = $this->processesCpuUsage($runningonly);
703 703
                    if (!empty($cpuUsage)) {
704 704
                        foreach ($cpuUsage as $pidRow => $usageRow) {
@@ -1020,7 +1020,7 @@
Loading
1020 1020
                        if (!empty($newheaders) and !empty($values)) {
1021 1021
                            $subcounter = 0;
1022 1022
                            foreach ($newheaders as $header) {
1023 -
                                if (empty($returnOnly) or in_array($header, $returnOnly)) {
1023 +
                                if (empty($returnOnly) or (is_array($returnOnly) && in_array($header, $returnOnly))) {
1024 1024
                                    $results[$counter][$header] = $values[$subcounter];
1025 1025
                                }
1026 1026
                                $subcounter++;
@@ -1071,4 +1071,4 @@
Loading
1071 1071
            return $size;
1072 1072
        }
1073 1073
    }
1074 -
}
Files Complexity Coverage
src/Info.php 193 96.27%
Project Totals (1 files) 193 96.27%
11.1
7.1=.1
TRAVIS_OS_NAME=linux
11.2
7.2=.2
TRAVIS_OS_NAME=linux

No yaml found.

Create your codecov.yml to customize your Codecov experience

Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading