dropbox-sign 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +26 -9
- data/VERSION +1 -0
- data/bin/release +39 -0
- data/bin/ruby +1 -0
- data/docs/BulkSendJobApi.md +5 -3
- data/docs/SignatureRequestApi.md +3 -3
- data/docs/SignatureRequestCreateEmbeddedRequest.md +1 -1
- data/docs/SignatureRequestSendRequest.md +1 -1
- data/docs/SubFormFieldsPerDocumentBase.md +1 -1
- data/docs/TeamResponse.md +1 -0
- data/docs/TemplateCreateEmbeddedDraftRequest.md +1 -1
- data/docs/TemplateResponse.md +2 -2
- data/docs/TemplateResponseDocument.md +3 -3
- data/docs/{TemplateResponseCustomField.md → TemplateResponseDocumentCustomFieldBase.md} +6 -8
- data/docs/TemplateResponseDocumentCustomFieldCheckbox.md +10 -0
- data/docs/TemplateResponseDocumentCustomFieldText.md +14 -0
- data/docs/TemplateResponseDocumentFieldGroup.md +1 -1
- data/docs/TemplateResponseDocumentFieldGroupRule.md +11 -0
- data/docs/{TemplateResponseDocumentFormField.md → TemplateResponseDocumentFormFieldBase.md} +5 -8
- data/docs/TemplateResponseDocumentFormFieldCheckbox.md +10 -0
- data/docs/TemplateResponseDocumentFormFieldDateSigned.md +10 -0
- data/docs/TemplateResponseDocumentFormFieldDropdown.md +10 -0
- data/docs/TemplateResponseDocumentFormFieldHyperlink.md +14 -0
- data/docs/TemplateResponseDocumentFormFieldInitials.md +10 -0
- data/docs/TemplateResponseDocumentFormFieldRadio.md +10 -0
- data/docs/TemplateResponseDocumentFormFieldSignature.md +10 -0
- data/docs/TemplateResponseDocumentFormFieldText.md +15 -0
- data/docs/{TemplateResponseDocumentStaticField.md → TemplateResponseDocumentStaticFieldBase.md} +6 -5
- data/docs/TemplateResponseDocumentStaticFieldCheckbox.md +10 -0
- data/docs/TemplateResponseDocumentStaticFieldDateSigned.md +10 -0
- data/docs/TemplateResponseDocumentStaticFieldDropdown.md +10 -0
- data/docs/TemplateResponseDocumentStaticFieldHyperlink.md +10 -0
- data/docs/TemplateResponseDocumentStaticFieldInitials.md +10 -0
- data/docs/TemplateResponseDocumentStaticFieldRadio.md +10 -0
- data/docs/TemplateResponseDocumentStaticFieldSignature.md +10 -0
- data/docs/TemplateResponseDocumentStaticFieldText.md +10 -0
- data/docs/TemplateResponseFieldAvgTextLength.md +1 -1
- data/docs/UnclaimedDraftApi.md +2 -2
- data/docs/UnclaimedDraftCreateEmbeddedRequest.md +1 -1
- data/docs/UnclaimedDraftCreateRequest.md +1 -1
- data/examples/SignatureRequestCreateEmbedded.rb +1 -1
- data/examples/SignatureRequestSend.rb +2 -2
- data/examples/UnclaimedDraftCreate.rb +2 -2
- data/lib/dropbox-sign/api/bulk_send_job_api.rb +6 -0
- data/lib/dropbox-sign/models/signature_request_create_embedded_request.rb +1 -1
- data/lib/dropbox-sign/models/signature_request_send_request.rb +1 -1
- data/lib/dropbox-sign/models/sub_form_fields_per_document_base.rb +1 -1
- data/lib/dropbox-sign/models/team_response.rb +17 -4
- data/lib/dropbox-sign/models/template_create_embedded_draft_request.rb +1 -1
- data/lib/dropbox-sign/models/template_response.rb +5 -5
- data/lib/dropbox-sign/models/template_response_document.rb +9 -9
- data/lib/dropbox-sign/models/{template_response_document_static_field.rb → template_response_document_custom_field_base.rb} +75 -43
- data/lib/dropbox-sign/models/template_response_document_custom_field_checkbox.rb +263 -0
- data/lib/dropbox-sign/models/template_response_document_custom_field_text.rb +306 -0
- data/lib/dropbox-sign/models/template_response_document_field_group.rb +2 -3
- data/lib/dropbox-sign/models/template_response_document_field_group_rule.rb +263 -0
- data/lib/dropbox-sign/models/{template_response_named_form_field.rb → template_response_document_form_field_base.rb} +82 -79
- data/lib/dropbox-sign/models/template_response_document_form_field_checkbox.rb +263 -0
- data/lib/dropbox-sign/models/template_response_document_form_field_date_signed.rb +263 -0
- data/lib/dropbox-sign/models/template_response_document_form_field_dropdown.rb +263 -0
- data/lib/dropbox-sign/models/template_response_document_form_field_hyperlink.rb +306 -0
- data/lib/dropbox-sign/models/template_response_document_form_field_initials.rb +263 -0
- data/lib/dropbox-sign/models/template_response_document_form_field_radio.rb +263 -0
- data/lib/dropbox-sign/models/template_response_document_form_field_signature.rb +263 -0
- data/lib/dropbox-sign/models/{template_response_document_form_field.rb → template_response_document_form_field_text.rb} +53 -132
- data/lib/dropbox-sign/models/{template_response_custom_field.rb → template_response_document_static_field_base.rb} +94 -112
- data/lib/dropbox-sign/models/template_response_document_static_field_checkbox.rb +263 -0
- data/lib/dropbox-sign/models/template_response_document_static_field_date_signed.rb +263 -0
- data/lib/dropbox-sign/models/template_response_document_static_field_dropdown.rb +263 -0
- data/lib/dropbox-sign/models/template_response_document_static_field_hyperlink.rb +263 -0
- data/lib/dropbox-sign/models/template_response_document_static_field_initials.rb +263 -0
- data/lib/dropbox-sign/models/template_response_document_static_field_radio.rb +263 -0
- data/lib/dropbox-sign/models/template_response_document_static_field_signature.rb +263 -0
- data/lib/dropbox-sign/models/template_response_document_static_field_text.rb +263 -0
- data/lib/dropbox-sign/models/template_response_field_avg_text_length.rb +1 -1
- data/lib/dropbox-sign/models/unclaimed_draft_create_embedded_request.rb +1 -1
- data/lib/dropbox-sign/models/unclaimed_draft_create_request.rb +1 -1
- data/lib/dropbox-sign/version.rb +1 -1
- data/lib/dropbox-sign.rb +22 -5
- data/openapi-config.yaml +4 -1
- data/openapi-sdk.yaml +598 -186
- data/templates/VERSION-root.mustache +1 -0
- data/test_fixtures/AccountCreateResponse.json +1 -0
- data/test_fixtures/ApiAppGetResponse.json +1 -0
- data/test_fixtures/ApiAppListResponse.json +1 -0
- data/test_fixtures/BulkSendJobGetResponse.json +8 -3
- data/test_fixtures/SignatureRequestGetResponse.json +65 -65
- data/test_fixtures/SignatureRequestListResponse.json +11 -4
- data/test_fixtures/TemplateGetResponse.json +1064 -41
- data/test_fixtures/TemplateListResponse.json +513 -44
- metadata +58 -64
- data/docs/TemplateResponseDocumentCustomField.md +0 -25
- data/docs/TemplateResponseNamedFormField.md +0 -23
- data/lib/dropbox-sign/models/template_response_document_custom_field.rb +0 -454
- data/vendor/autoload.php +0 -7
- data/vendor/bin/yaml-lint +0 -117
- data/vendor/composer/ClassLoader.php +0 -572
- data/vendor/composer/InstalledVersions.php +0 -350
- data/vendor/composer/LICENSE +0 -21
- data/vendor/composer/autoload_classmap.php +0 -10
- data/vendor/composer/autoload_files.php +0 -11
- data/vendor/composer/autoload_namespaces.php +0 -9
- data/vendor/composer/autoload_psr4.php +0 -11
- data/vendor/composer/autoload_real.php +0 -80
- data/vendor/composer/autoload_static.php +0 -46
- data/vendor/composer/installed.json +0 -239
- data/vendor/composer/installed.php +0 -50
- data/vendor/composer/platform_check.php +0 -26
- data/vendor/symfony/deprecation-contracts/.gitignore +0 -3
- data/vendor/symfony/deprecation-contracts/CHANGELOG.md +0 -5
- data/vendor/symfony/deprecation-contracts/LICENSE +0 -19
- data/vendor/symfony/deprecation-contracts/README.md +0 -26
- data/vendor/symfony/deprecation-contracts/composer.json +0 -35
- data/vendor/symfony/deprecation-contracts/function.php +0 -27
- data/vendor/symfony/polyfill-ctype/Ctype.php +0 -232
- data/vendor/symfony/polyfill-ctype/LICENSE +0 -19
- data/vendor/symfony/polyfill-ctype/README.md +0 -12
- data/vendor/symfony/polyfill-ctype/bootstrap.php +0 -50
- data/vendor/symfony/polyfill-ctype/bootstrap80.php +0 -46
- data/vendor/symfony/polyfill-ctype/composer.json +0 -41
- data/vendor/symfony/yaml/CHANGELOG.md +0 -237
- data/vendor/symfony/yaml/Command/LintCommand.php +0 -289
- data/vendor/symfony/yaml/Dumper.php +0 -140
- data/vendor/symfony/yaml/Escaper.php +0 -95
- data/vendor/symfony/yaml/Exception/DumpException.php +0 -21
- data/vendor/symfony/yaml/Exception/ExceptionInterface.php +0 -21
- data/vendor/symfony/yaml/Exception/ParseException.php +0 -132
- data/vendor/symfony/yaml/Exception/RuntimeException.php +0 -21
- data/vendor/symfony/yaml/Inline.php +0 -812
- data/vendor/symfony/yaml/LICENSE +0 -19
- data/vendor/symfony/yaml/Parser.php +0 -1305
- data/vendor/symfony/yaml/README.md +0 -13
- data/vendor/symfony/yaml/Resources/bin/yaml-lint +0 -45
- data/vendor/symfony/yaml/Tag/TaggedValue.php +0 -38
- data/vendor/symfony/yaml/Unescaper.php +0 -132
- data/vendor/symfony/yaml/Yaml.php +0 -100
- data/vendor/symfony/yaml/composer.json +0 -42
@@ -1,140 +0,0 @@
|
|
1
|
-
<?php
|
2
|
-
|
3
|
-
/*
|
4
|
-
* This file is part of the Symfony package.
|
5
|
-
*
|
6
|
-
* (c) Fabien Potencier <fabien@symfony.com>
|
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
|
-
namespace Symfony\Component\Yaml;
|
13
|
-
|
14
|
-
use Symfony\Component\Yaml\Tag\TaggedValue;
|
15
|
-
|
16
|
-
/**
|
17
|
-
* Dumper dumps PHP variables to YAML strings.
|
18
|
-
*
|
19
|
-
* @author Fabien Potencier <fabien@symfony.com>
|
20
|
-
*
|
21
|
-
* @final
|
22
|
-
*/
|
23
|
-
class Dumper
|
24
|
-
{
|
25
|
-
/**
|
26
|
-
* The amount of spaces to use for indentation of nested nodes.
|
27
|
-
*
|
28
|
-
* @var int
|
29
|
-
*/
|
30
|
-
protected $indentation;
|
31
|
-
|
32
|
-
public function __construct(int $indentation = 4)
|
33
|
-
{
|
34
|
-
if ($indentation < 1) {
|
35
|
-
throw new \InvalidArgumentException('The indentation must be greater than zero.');
|
36
|
-
}
|
37
|
-
|
38
|
-
$this->indentation = $indentation;
|
39
|
-
}
|
40
|
-
|
41
|
-
/**
|
42
|
-
* Dumps a PHP value to YAML.
|
43
|
-
*
|
44
|
-
* @param mixed $input The PHP value
|
45
|
-
* @param int $inline The level where you switch to inline YAML
|
46
|
-
* @param int $indent The level of indentation (used internally)
|
47
|
-
* @param int $flags A bit field of Yaml::DUMP_* constants to customize the dumped YAML string
|
48
|
-
*/
|
49
|
-
public function dump($input, int $inline = 0, int $indent = 0, int $flags = 0): string
|
50
|
-
{
|
51
|
-
$output = '';
|
52
|
-
$prefix = $indent ? str_repeat(' ', $indent) : '';
|
53
|
-
$dumpObjectAsInlineMap = true;
|
54
|
-
|
55
|
-
if (Yaml::DUMP_OBJECT_AS_MAP & $flags && ($input instanceof \ArrayObject || $input instanceof \stdClass)) {
|
56
|
-
$dumpObjectAsInlineMap = empty((array) $input);
|
57
|
-
}
|
58
|
-
|
59
|
-
if ($inline <= 0 || (!\is_array($input) && !$input instanceof TaggedValue && $dumpObjectAsInlineMap) || empty($input)) {
|
60
|
-
$output .= $prefix.Inline::dump($input, $flags);
|
61
|
-
} else {
|
62
|
-
$dumpAsMap = Inline::isHash($input);
|
63
|
-
|
64
|
-
foreach ($input as $key => $value) {
|
65
|
-
if ('' !== $output && "\n" !== $output[-1]) {
|
66
|
-
$output .= "\n";
|
67
|
-
}
|
68
|
-
|
69
|
-
if (Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK & $flags && \is_string($value) && false !== strpos($value, "\n") && false === strpos($value, "\r")) {
|
70
|
-
// If the first line starts with a space character, the spec requires a blockIndicationIndicator
|
71
|
-
// http://www.yaml.org/spec/1.2/spec.html#id2793979
|
72
|
-
$blockIndentationIndicator = (' ' === substr($value, 0, 1)) ? (string) $this->indentation : '';
|
73
|
-
|
74
|
-
if (isset($value[-2]) && "\n" === $value[-2] && "\n" === $value[-1]) {
|
75
|
-
$blockChompingIndicator = '+';
|
76
|
-
} elseif ("\n" === $value[-1]) {
|
77
|
-
$blockChompingIndicator = '';
|
78
|
-
} else {
|
79
|
-
$blockChompingIndicator = '-';
|
80
|
-
}
|
81
|
-
|
82
|
-
$output .= sprintf('%s%s%s |%s%s', $prefix, $dumpAsMap ? Inline::dump($key, $flags).':' : '-', '', $blockIndentationIndicator, $blockChompingIndicator);
|
83
|
-
|
84
|
-
foreach (explode("\n", $value) as $row) {
|
85
|
-
if ('' === $row) {
|
86
|
-
$output .= "\n";
|
87
|
-
} else {
|
88
|
-
$output .= sprintf("\n%s%s%s", $prefix, str_repeat(' ', $this->indentation), $row);
|
89
|
-
}
|
90
|
-
}
|
91
|
-
|
92
|
-
continue;
|
93
|
-
}
|
94
|
-
|
95
|
-
if ($value instanceof TaggedValue) {
|
96
|
-
$output .= sprintf('%s%s !%s', $prefix, $dumpAsMap ? Inline::dump($key, $flags).':' : '-', $value->getTag());
|
97
|
-
|
98
|
-
if (Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK & $flags && \is_string($value->getValue()) && false !== strpos($value->getValue(), "\n") && false === strpos($value->getValue(), "\r\n")) {
|
99
|
-
// If the first line starts with a space character, the spec requires a blockIndicationIndicator
|
100
|
-
// http://www.yaml.org/spec/1.2/spec.html#id2793979
|
101
|
-
$blockIndentationIndicator = (' ' === substr($value->getValue(), 0, 1)) ? (string) $this->indentation : '';
|
102
|
-
$output .= sprintf(' |%s', $blockIndentationIndicator);
|
103
|
-
|
104
|
-
foreach (explode("\n", $value->getValue()) as $row) {
|
105
|
-
$output .= sprintf("\n%s%s%s", $prefix, str_repeat(' ', $this->indentation), $row);
|
106
|
-
}
|
107
|
-
|
108
|
-
continue;
|
109
|
-
}
|
110
|
-
|
111
|
-
if ($inline - 1 <= 0 || null === $value->getValue() || is_scalar($value->getValue())) {
|
112
|
-
$output .= ' '.$this->dump($value->getValue(), $inline - 1, 0, $flags)."\n";
|
113
|
-
} else {
|
114
|
-
$output .= "\n";
|
115
|
-
$output .= $this->dump($value->getValue(), $inline - 1, $dumpAsMap ? $indent + $this->indentation : $indent + 2, $flags);
|
116
|
-
}
|
117
|
-
|
118
|
-
continue;
|
119
|
-
}
|
120
|
-
|
121
|
-
$dumpObjectAsInlineMap = true;
|
122
|
-
|
123
|
-
if (Yaml::DUMP_OBJECT_AS_MAP & $flags && ($value instanceof \ArrayObject || $value instanceof \stdClass)) {
|
124
|
-
$dumpObjectAsInlineMap = empty((array) $value);
|
125
|
-
}
|
126
|
-
|
127
|
-
$willBeInlined = $inline - 1 <= 0 || !\is_array($value) && $dumpObjectAsInlineMap || empty($value);
|
128
|
-
|
129
|
-
$output .= sprintf('%s%s%s%s',
|
130
|
-
$prefix,
|
131
|
-
$dumpAsMap ? Inline::dump($key, $flags).':' : '-',
|
132
|
-
$willBeInlined ? ' ' : "\n",
|
133
|
-
$this->dump($value, $inline - 1, $willBeInlined ? 0 : $indent + $this->indentation, $flags)
|
134
|
-
).($willBeInlined ? "\n" : '');
|
135
|
-
}
|
136
|
-
}
|
137
|
-
|
138
|
-
return $output;
|
139
|
-
}
|
140
|
-
}
|
@@ -1,95 +0,0 @@
|
|
1
|
-
<?php
|
2
|
-
|
3
|
-
/*
|
4
|
-
* This file is part of the Symfony package.
|
5
|
-
*
|
6
|
-
* (c) Fabien Potencier <fabien@symfony.com>
|
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
|
-
namespace Symfony\Component\Yaml;
|
13
|
-
|
14
|
-
/**
|
15
|
-
* Escaper encapsulates escaping rules for single and double-quoted
|
16
|
-
* YAML strings.
|
17
|
-
*
|
18
|
-
* @author Matthew Lewinski <matthew@lewinski.org>
|
19
|
-
*
|
20
|
-
* @internal
|
21
|
-
*/
|
22
|
-
class Escaper
|
23
|
-
{
|
24
|
-
// Characters that would cause a dumped string to require double quoting.
|
25
|
-
public const REGEX_CHARACTER_TO_ESCAPE = "[\\x00-\\x1f]|\x7f|\xc2\x85|\xc2\xa0|\xe2\x80\xa8|\xe2\x80\xa9";
|
26
|
-
|
27
|
-
// Mapping arrays for escaping a double quoted string. The backslash is
|
28
|
-
// first to ensure proper escaping because str_replace operates iteratively
|
29
|
-
// on the input arrays. This ordering of the characters avoids the use of strtr,
|
30
|
-
// which performs more slowly.
|
31
|
-
private const ESCAPEES = ['\\', '\\\\', '\\"', '"',
|
32
|
-
"\x00", "\x01", "\x02", "\x03", "\x04", "\x05", "\x06", "\x07",
|
33
|
-
"\x08", "\x09", "\x0a", "\x0b", "\x0c", "\x0d", "\x0e", "\x0f",
|
34
|
-
"\x10", "\x11", "\x12", "\x13", "\x14", "\x15", "\x16", "\x17",
|
35
|
-
"\x18", "\x19", "\x1a", "\x1b", "\x1c", "\x1d", "\x1e", "\x1f",
|
36
|
-
"\x7f",
|
37
|
-
"\xc2\x85", "\xc2\xa0", "\xe2\x80\xa8", "\xe2\x80\xa9",
|
38
|
-
];
|
39
|
-
private const ESCAPED = ['\\\\', '\\"', '\\\\', '\\"',
|
40
|
-
'\\0', '\\x01', '\\x02', '\\x03', '\\x04', '\\x05', '\\x06', '\\a',
|
41
|
-
'\\b', '\\t', '\\n', '\\v', '\\f', '\\r', '\\x0e', '\\x0f',
|
42
|
-
'\\x10', '\\x11', '\\x12', '\\x13', '\\x14', '\\x15', '\\x16', '\\x17',
|
43
|
-
'\\x18', '\\x19', '\\x1a', '\\e', '\\x1c', '\\x1d', '\\x1e', '\\x1f',
|
44
|
-
'\\x7f',
|
45
|
-
'\\N', '\\_', '\\L', '\\P',
|
46
|
-
];
|
47
|
-
|
48
|
-
/**
|
49
|
-
* Determines if a PHP value would require double quoting in YAML.
|
50
|
-
*
|
51
|
-
* @param string $value A PHP value
|
52
|
-
*/
|
53
|
-
public static function requiresDoubleQuoting(string $value): bool
|
54
|
-
{
|
55
|
-
return 0 < preg_match('/'.self::REGEX_CHARACTER_TO_ESCAPE.'/u', $value);
|
56
|
-
}
|
57
|
-
|
58
|
-
/**
|
59
|
-
* Escapes and surrounds a PHP value with double quotes.
|
60
|
-
*
|
61
|
-
* @param string $value A PHP value
|
62
|
-
*/
|
63
|
-
public static function escapeWithDoubleQuotes(string $value): string
|
64
|
-
{
|
65
|
-
return sprintf('"%s"', str_replace(self::ESCAPEES, self::ESCAPED, $value));
|
66
|
-
}
|
67
|
-
|
68
|
-
/**
|
69
|
-
* Determines if a PHP value would require single quoting in YAML.
|
70
|
-
*
|
71
|
-
* @param string $value A PHP value
|
72
|
-
*/
|
73
|
-
public static function requiresSingleQuoting(string $value): bool
|
74
|
-
{
|
75
|
-
// Determines if a PHP value is entirely composed of a value that would
|
76
|
-
// require single quoting in YAML.
|
77
|
-
if (\in_array(strtolower($value), ['null', '~', 'true', 'false', 'y', 'n', 'yes', 'no', 'on', 'off'])) {
|
78
|
-
return true;
|
79
|
-
}
|
80
|
-
|
81
|
-
// Determines if the PHP value contains any single characters that would
|
82
|
-
// cause it to require single quoting in YAML.
|
83
|
-
return 0 < preg_match('/[ \s \' " \: \{ \} \[ \] , & \* \# \?] | \A[ \- ? | < > = ! % @ ` \p{Zs}]/xu', $value);
|
84
|
-
}
|
85
|
-
|
86
|
-
/**
|
87
|
-
* Escapes and surrounds a PHP value with single quotes.
|
88
|
-
*
|
89
|
-
* @param string $value A PHP value
|
90
|
-
*/
|
91
|
-
public static function escapeWithSingleQuotes(string $value): string
|
92
|
-
{
|
93
|
-
return sprintf("'%s'", str_replace('\'', '\'\'', $value));
|
94
|
-
}
|
95
|
-
}
|
@@ -1,21 +0,0 @@
|
|
1
|
-
<?php
|
2
|
-
|
3
|
-
/*
|
4
|
-
* This file is part of the Symfony package.
|
5
|
-
*
|
6
|
-
* (c) Fabien Potencier <fabien@symfony.com>
|
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
|
-
namespace Symfony\Component\Yaml\Exception;
|
13
|
-
|
14
|
-
/**
|
15
|
-
* Exception class thrown when an error occurs during dumping.
|
16
|
-
*
|
17
|
-
* @author Fabien Potencier <fabien@symfony.com>
|
18
|
-
*/
|
19
|
-
class DumpException extends RuntimeException
|
20
|
-
{
|
21
|
-
}
|
@@ -1,21 +0,0 @@
|
|
1
|
-
<?php
|
2
|
-
|
3
|
-
/*
|
4
|
-
* This file is part of the Symfony package.
|
5
|
-
*
|
6
|
-
* (c) Fabien Potencier <fabien@symfony.com>
|
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
|
-
namespace Symfony\Component\Yaml\Exception;
|
13
|
-
|
14
|
-
/**
|
15
|
-
* Exception interface for all exceptions thrown by the component.
|
16
|
-
*
|
17
|
-
* @author Fabien Potencier <fabien@symfony.com>
|
18
|
-
*/
|
19
|
-
interface ExceptionInterface extends \Throwable
|
20
|
-
{
|
21
|
-
}
|
@@ -1,132 +0,0 @@
|
|
1
|
-
<?php
|
2
|
-
|
3
|
-
/*
|
4
|
-
* This file is part of the Symfony package.
|
5
|
-
*
|
6
|
-
* (c) Fabien Potencier <fabien@symfony.com>
|
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
|
-
namespace Symfony\Component\Yaml\Exception;
|
13
|
-
|
14
|
-
/**
|
15
|
-
* Exception class thrown when an error occurs during parsing.
|
16
|
-
*
|
17
|
-
* @author Fabien Potencier <fabien@symfony.com>
|
18
|
-
*/
|
19
|
-
class ParseException extends RuntimeException
|
20
|
-
{
|
21
|
-
private $parsedFile;
|
22
|
-
private $parsedLine;
|
23
|
-
private $snippet;
|
24
|
-
private $rawMessage;
|
25
|
-
|
26
|
-
/**
|
27
|
-
* @param string $message The error message
|
28
|
-
* @param int $parsedLine The line where the error occurred
|
29
|
-
* @param string|null $snippet The snippet of code near the problem
|
30
|
-
* @param string|null $parsedFile The file name where the error occurred
|
31
|
-
*/
|
32
|
-
public function __construct(string $message, int $parsedLine = -1, string $snippet = null, string $parsedFile = null, \Throwable $previous = null)
|
33
|
-
{
|
34
|
-
$this->parsedFile = $parsedFile;
|
35
|
-
$this->parsedLine = $parsedLine;
|
36
|
-
$this->snippet = $snippet;
|
37
|
-
$this->rawMessage = $message;
|
38
|
-
|
39
|
-
$this->updateRepr();
|
40
|
-
|
41
|
-
parent::__construct($this->message, 0, $previous);
|
42
|
-
}
|
43
|
-
|
44
|
-
/**
|
45
|
-
* Gets the snippet of code near the error.
|
46
|
-
*
|
47
|
-
* @return string
|
48
|
-
*/
|
49
|
-
public function getSnippet()
|
50
|
-
{
|
51
|
-
return $this->snippet;
|
52
|
-
}
|
53
|
-
|
54
|
-
/**
|
55
|
-
* Sets the snippet of code near the error.
|
56
|
-
*/
|
57
|
-
public function setSnippet(string $snippet)
|
58
|
-
{
|
59
|
-
$this->snippet = $snippet;
|
60
|
-
|
61
|
-
$this->updateRepr();
|
62
|
-
}
|
63
|
-
|
64
|
-
/**
|
65
|
-
* Gets the filename where the error occurred.
|
66
|
-
*
|
67
|
-
* This method returns null if a string is parsed.
|
68
|
-
*
|
69
|
-
* @return string
|
70
|
-
*/
|
71
|
-
public function getParsedFile()
|
72
|
-
{
|
73
|
-
return $this->parsedFile;
|
74
|
-
}
|
75
|
-
|
76
|
-
/**
|
77
|
-
* Sets the filename where the error occurred.
|
78
|
-
*/
|
79
|
-
public function setParsedFile(string $parsedFile)
|
80
|
-
{
|
81
|
-
$this->parsedFile = $parsedFile;
|
82
|
-
|
83
|
-
$this->updateRepr();
|
84
|
-
}
|
85
|
-
|
86
|
-
/**
|
87
|
-
* Gets the line where the error occurred.
|
88
|
-
*
|
89
|
-
* @return int
|
90
|
-
*/
|
91
|
-
public function getParsedLine()
|
92
|
-
{
|
93
|
-
return $this->parsedLine;
|
94
|
-
}
|
95
|
-
|
96
|
-
/**
|
97
|
-
* Sets the line where the error occurred.
|
98
|
-
*/
|
99
|
-
public function setParsedLine(int $parsedLine)
|
100
|
-
{
|
101
|
-
$this->parsedLine = $parsedLine;
|
102
|
-
|
103
|
-
$this->updateRepr();
|
104
|
-
}
|
105
|
-
|
106
|
-
private function updateRepr()
|
107
|
-
{
|
108
|
-
$this->message = $this->rawMessage;
|
109
|
-
|
110
|
-
$dot = false;
|
111
|
-
if ('.' === substr($this->message, -1)) {
|
112
|
-
$this->message = substr($this->message, 0, -1);
|
113
|
-
$dot = true;
|
114
|
-
}
|
115
|
-
|
116
|
-
if (null !== $this->parsedFile) {
|
117
|
-
$this->message .= sprintf(' in %s', json_encode($this->parsedFile, \JSON_UNESCAPED_SLASHES | \JSON_UNESCAPED_UNICODE));
|
118
|
-
}
|
119
|
-
|
120
|
-
if ($this->parsedLine >= 0) {
|
121
|
-
$this->message .= sprintf(' at line %d', $this->parsedLine);
|
122
|
-
}
|
123
|
-
|
124
|
-
if ($this->snippet) {
|
125
|
-
$this->message .= sprintf(' (near "%s")', $this->snippet);
|
126
|
-
}
|
127
|
-
|
128
|
-
if ($dot) {
|
129
|
-
$this->message .= '.';
|
130
|
-
}
|
131
|
-
}
|
132
|
-
}
|
@@ -1,21 +0,0 @@
|
|
1
|
-
<?php
|
2
|
-
|
3
|
-
/*
|
4
|
-
* This file is part of the Symfony package.
|
5
|
-
*
|
6
|
-
* (c) Fabien Potencier <fabien@symfony.com>
|
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
|
-
namespace Symfony\Component\Yaml\Exception;
|
13
|
-
|
14
|
-
/**
|
15
|
-
* Exception class thrown when an error occurs during parsing.
|
16
|
-
*
|
17
|
-
* @author Romain Neutron <imprec@gmail.com>
|
18
|
-
*/
|
19
|
-
class RuntimeException extends \RuntimeException implements ExceptionInterface
|
20
|
-
{
|
21
|
-
}
|