Issues (15)

src/Process/Process.php (2 issues)

Labels
Severity
1
<?php
2
3
4
namespace Tohidplus\Paravel\Process;
5
6
use Symfony\Component\Process\Process as SymphonyProcess;
0 ignored issues
show
The type Symfony\Component\Process\Process was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
7
use Tohidplus\Paravel\Facades\Serializer;
8
9
/**
10
 *
11
 * Class Process
12
 * @package Tohidplus\Paravel
13
 * @mixin SymphonyProcess
14
 */
15
class Process
16
{
17
    /**
18
     * @var SymphonyProcess
19
     */
20
    private SymphonyProcess $process;
21
    /**
22
     * @var ProcessHandler
23
     */
24
    private ProcessHandler $handler;
25
26
    /**
27
     * Process constructor.
28
     * @param string $path
29
     * @param ProcessHandler $handler
30
     */
31
    public function __construct(string $path, ProcessHandler $handler)
32
    {
33
        $this->process = new SymphonyProcess(["php", $path, "parallel:run", Serializer::base64_serialize($handler)]);
34
        $this->handler = $handler;
35
    }
36
37
    public function label()
38
    {
39
        return $this->handler->getLabel();
40
    }
41
42
    public function __call($name, $arguments)
43
    {
44
        return call_user_func(array($this->process, $name), ...$arguments);
45
    }
46
47
    public function __get($name)
48
    {
49
        return $this->process->$name;
50
    }
51
52
    /**
53
     * @return mixed|string
54
     */
55
    public function getOutput()
56
    {
57
        if ($this->isSuccessful()) {
0 ignored issues
show
The method isSuccessful() does not exist on Tohidplus\Paravel\Process\Process. Since you implemented __call, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

57
        if ($this->/** @scrutinizer ignore-call */ isSuccessful()) {
Loading history...
58
            return Serializer::base64_unserialize($this->process->getOutput());
59
        }
60
        return $this->process->getOutput();
61
    }
62
}
63