Passed
Pull Request — master (#9)
by Shinji
02:00
created

CommandLineEnumerator   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A getIterator() 0 8 2
1
<?php
2
3
/**
4
 * This file is part of the sj-i/php-profiler package.
5
 *
6
 * (c) sji <[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
12
declare(strict_types=1);
13
14
namespace PhpProfiler\Lib\Process\ProcFileSystem;
15
16
use IteratorAggregate;
17
18
final class CommandLineEnumerator implements IteratorAggregate
19
{
20
    /**
21
     * @return \Generator<int, string>
22
     */
23
    public function getIterator()
24
    {
25
        /**
26
         * @var string $full_path
27
         * @var \SplFileInfo $item
28
         */
29
        foreach (new \GlobIterator('/proc/*/cmdline') as $full_path => $item) {
30
            yield (int)basename($item->getPath()) => file_get_contents($full_path);
31
        }
32
    }
33
}
34