-
Notifications
You must be signed in to change notification settings - Fork 1
/
MethodCall.php
73 lines (63 loc) · 1.32 KB
/
MethodCall.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<?php
declare(strict_types = 1);
namespace Innmind\StackTrace\CallFrame;
use Innmind\StackTrace\{
ClassName,
Method,
Line,
};
use Innmind\Url\Url;
use Innmind\Immutable\Sequence;
/**
* @psalm-immutable
*/
final class MethodCall implements UserLand
{
private ClassName $class;
private Method $method;
private Url $file;
private Line $line;
private Sequence $arguments;
/**
* @no-named-arguments
*
* @param mixed $arguments
*/
public function __construct(
ClassName $class,
Method $method,
Url $file,
Line $line,
...$arguments,
) {
$this->class = $class;
$this->method = $method;
$this->file = $file;
$this->line = $line;
$this->arguments = Sequence::mixed(...$arguments);
}
public function class(): ClassName
{
return $this->class;
}
public function method(): Method
{
return $this->method;
}
public function file(): Url
{
return $this->file;
}
public function line(): Line
{
return $this->line;
}
public function arguments(): Sequence
{
return $this->arguments;
}
public function toString(): string
{
return "{$this->class->toString()}->{$this->method->toString()}()";
}
}