This repository was archived by the owner on Mar 29, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathScriptOrigin.php
115 lines (99 loc) · 2.53 KB
/
ScriptOrigin.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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
<?php declare(strict_types=1);
/**
* This file is part of the phpv8/php-v8 PHP extension.
*
* Copyright (c) 2015-2018 Bogdan Padalko <thepinepain@gmail.com>
*
* Licensed under the MIT license: http://opensource.org/licenses/MIT
*
* For the full copyright and license information, please view the
* LICENSE file that was distributed with this source or visit
* http://opensource.org/licenses/MIT
*/
namespace V8;
/**
* The origin, within a file, of a script.
*/
class ScriptOrigin
{
/**
* @var string
*/
private $resource_name;
/**
* @var int|null
*/
private $resource_line_offset;
/**
* @var int|null
*/
private $resource_column_offset;
/**
* @var int|null
*/
private $script_id;
/**
* @var string
*/
private $source_map_url;
/**
* @var ScriptOriginOptions
*/
private $options;
/**
* @param string $resource_name
* @param int|null $resource_line_offset
* @param int|null $resource_column_offset
* @param int|null $script_id
* @param string $source_map_url
* @param ScriptOriginOptions|null $options
*/
public function __construct(
string $resource_name = "",
?int $resource_line_offset = null,
?int $resource_column_offset = null,
?int $script_id = null,
string $source_map_url = '',
ScriptOriginOptions $options = null
) {
$this->resource_name = $resource_name;
$this->resource_line_offset = $resource_line_offset;
$this->resource_column_offset = $resource_column_offset;
$this->script_id = $script_id;
$this->options = $options ?: new ScriptOriginOptions();
$this->source_map_url = $source_map_url;
}
public function resourceName(): string
{
return $this->resource_name;
}
/**
* @return int|null
*/
public function resourceLineOffset(): ?int
{
return $this->resource_line_offset;
}
/**
* @return int|null
*/
public function resourceColumnOffset(): ?int
{
return $this->resource_column_offset;
}
/**
* @return int|null
*/
public function scriptId(): ?int
{
return $this->script_id;
}
public function sourceMapUrl(): string
{
return $this->source_map_url;
}
public function options(): ScriptOriginOptions
{
return $this->options;
}
}