$keyValueArray Associative array of key and values
+ */
+ public static function withQueryValues(UriInterface $uri, array $keyValueArray): UriInterface
+ {
+ $result = self::getFilteredQueryString($uri, array_keys($keyValueArray));
+
+ foreach ($keyValueArray as $key => $value) {
+ $result[] = self::generateQueryString((string) $key, $value !== null ? (string) $value : null);
+ }
+
+ return $uri->withQuery(implode('&', $result));
+ }
+
+ /**
+ * Creates a URI from a hash of `parse_url` components.
+ *
+ * @see http://php.net/manual/en/function.parse-url.php
+ *
+ * @throws MalformedUriException If the components do not form a valid URI.
+ */
+ public static function fromParts(array $parts): UriInterface
+ {
+ $uri = new self();
+ $uri->applyParts($parts);
+ $uri->validateState();
+
+ return $uri;
+ }
+
+ public function getScheme(): string
+ {
+ return $this->scheme;
+ }
+
+ public function getAuthority(): string
+ {
+ $authority = $this->host;
+ if ($this->userInfo !== '') {
+ $authority = $this->userInfo.'@'.$authority;
+ }
+
+ if ($this->port !== null) {
+ $authority .= ':'.$this->port;
+ }
+
+ return $authority;
+ }
+
+ public function getUserInfo(): string
+ {
+ return $this->userInfo;
+ }
+
+ public function getHost(): string
+ {
+ return $this->host;
+ }
+
+ public function getPort(): ?int
+ {
+ return $this->port;
+ }
+
+ public function getPath(): string
+ {
+ return $this->path;
+ }
+
+ public function getQuery(): string
+ {
+ return $this->query;
+ }
+
+ public function getFragment(): string
+ {
+ return $this->fragment;
+ }
+
+ public function withScheme($scheme): UriInterface
+ {
+ $scheme = $this->filterScheme($scheme);
+
+ if ($this->scheme === $scheme) {
+ return $this;
+ }
+
+ $new = clone $this;
+ $new->scheme = $scheme;
+ $new->composedComponents = null;
+ $new->removeDefaultPort();
+ $new->validateState();
+
+ return $new;
+ }
+
+ public function withUserInfo($user, $password = null): UriInterface
+ {
+ $info = $this->filterUserInfoComponent($user);
+ if ($password !== null) {
+ $info .= ':'.$this->filterUserInfoComponent($password);
+ }
+
+ if ($this->userInfo === $info) {
+ return $this;
+ }
+
+ $new = clone $this;
+ $new->userInfo = $info;
+ $new->composedComponents = null;
+ $new->validateState();
+
+ return $new;
+ }
+
+ public function withHost($host): UriInterface
+ {
+ $host = $this->filterHost($host);
+
+ if ($this->host === $host) {
+ return $this;
+ }
+
+ $new = clone $this;
+ $new->host = $host;
+ $new->composedComponents = null;
+ $new->validateState();
+
+ return $new;
+ }
+
+ public function withPort($port): UriInterface
+ {
+ $port = $this->filterPort($port);
+
+ if ($this->port === $port) {
+ return $this;
+ }
+
+ $new = clone $this;
+ $new->port = $port;
+ $new->composedComponents = null;
+ $new->removeDefaultPort();
+ $new->validateState();
+
+ return $new;
+ }
+
+ public function withPath($path): UriInterface
+ {
+ $path = $this->filterPath($path);
+
+ if ($this->path === $path) {
+ return $this;
+ }
+
+ $new = clone $this;
+ $new->path = $path;
+ $new->composedComponents = null;
+ $new->validateState();
+
+ return $new;
+ }
+
+ public function withQuery($query): UriInterface
+ {
+ $query = $this->filterQueryAndFragment($query);
+
+ if ($this->query === $query) {
+ return $this;
+ }
+
+ $new = clone $this;
+ $new->query = $query;
+ $new->composedComponents = null;
+
+ return $new;
+ }
+
+ public function withFragment($fragment): UriInterface
+ {
+ $fragment = $this->filterQueryAndFragment($fragment);
+
+ if ($this->fragment === $fragment) {
+ return $this;
+ }
+
+ $new = clone $this;
+ $new->fragment = $fragment;
+ $new->composedComponents = null;
+
+ return $new;
+ }
+
+ public function jsonSerialize(): string
+ {
+ return $this->__toString();
+ }
+
+ /**
+ * Apply parse_url parts to a URI.
+ *
+ * @param array $parts Array of parse_url parts to apply.
+ */
+ private function applyParts(array $parts): void
+ {
+ $this->scheme = isset($parts['scheme'])
+ ? $this->filterScheme($parts['scheme'])
+ : '';
+ $this->userInfo = isset($parts['user'])
+ ? $this->filterUserInfoComponent($parts['user'])
+ : '';
+ $this->host = isset($parts['host'])
+ ? $this->filterHost($parts['host'])
+ : '';
+ $this->port = isset($parts['port'])
+ ? $this->filterPort($parts['port'])
+ : null;
+ $this->path = isset($parts['path'])
+ ? $this->filterPath($parts['path'])
+ : '';
+ $this->query = isset($parts['query'])
+ ? $this->filterQueryAndFragment($parts['query'])
+ : '';
+ $this->fragment = isset($parts['fragment'])
+ ? $this->filterQueryAndFragment($parts['fragment'])
+ : '';
+ if (isset($parts['pass'])) {
+ $this->userInfo .= ':'.$this->filterUserInfoComponent($parts['pass']);
+ }
+
+ $this->removeDefaultPort();
+ }
+
+ /**
+ * @param mixed $scheme
+ *
+ * @throws \InvalidArgumentException If the scheme is invalid.
+ */
+ private function filterScheme($scheme): string
+ {
+ if (!is_string($scheme)) {
+ throw new \InvalidArgumentException('Scheme must be a string');
+ }
+
+ return \strtr($scheme, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz');
+ }
+
+ /**
+ * @param mixed $component
+ *
+ * @throws \InvalidArgumentException If the user info is invalid.
+ */
+ private function filterUserInfoComponent($component): string
+ {
+ if (!is_string($component)) {
+ throw new \InvalidArgumentException('User info must be a string');
+ }
+
+ return preg_replace_callback(
+ '/(?:[^%'.self::CHAR_UNRESERVED.self::CHAR_SUB_DELIMS.']+|%(?![A-Fa-f0-9]{2}))/',
+ [$this, 'rawurlencodeMatchZero'],
+ $component
+ );
+ }
+
+ /**
+ * @param mixed $host
+ *
+ * @throws \InvalidArgumentException If the host is invalid.
+ */
+ private function filterHost($host): string
+ {
+ if (!is_string($host)) {
+ throw new \InvalidArgumentException('Host must be a string');
+ }
+
+ return \strtr($host, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz');
+ }
+
+ /**
+ * @param mixed $port
+ *
+ * @throws \InvalidArgumentException If the port is invalid.
+ */
+ private function filterPort($port): ?int
+ {
+ if ($port === null) {
+ return null;
+ }
+
+ $port = (int) $port;
+ if (0 > $port || 0xFFFF < $port) {
+ throw new \InvalidArgumentException(
+ sprintf('Invalid port: %d. Must be between 0 and 65535', $port)
+ );
+ }
+
+ return $port;
+ }
+
+ /**
+ * @param string[] $keys
+ *
+ * @return string[]
+ */
+ private static function getFilteredQueryString(UriInterface $uri, array $keys): array
+ {
+ $current = $uri->getQuery();
+
+ if ($current === '') {
+ return [];
+ }
+
+ $decodedKeys = array_map('rawurldecode', $keys);
+
+ return array_filter(explode('&', $current), function ($part) use ($decodedKeys) {
+ return !in_array(rawurldecode(explode('=', $part)[0]), $decodedKeys, true);
+ });
+ }
+
+ private static function generateQueryString(string $key, ?string $value): string
+ {
+ // Query string separators ("=", "&") within the key or value need to be encoded
+ // (while preventing double-encoding) before setting the query string. All other
+ // chars that need percent-encoding will be encoded by withQuery().
+ $queryString = strtr($key, self::QUERY_SEPARATORS_REPLACEMENT);
+
+ if ($value !== null) {
+ $queryString .= '='.strtr($value, self::QUERY_SEPARATORS_REPLACEMENT);
+ }
+
+ return $queryString;
+ }
+
+ private function removeDefaultPort(): void
+ {
+ if ($this->port !== null && self::isDefaultPort($this)) {
+ $this->port = null;
+ }
+ }
+
+ /**
+ * Filters the path of a URI
+ *
+ * @param mixed $path
+ *
+ * @throws \InvalidArgumentException If the path is invalid.
+ */
+ private function filterPath($path): string
+ {
+ if (!is_string($path)) {
+ throw new \InvalidArgumentException('Path must be a string');
+ }
+
+ return preg_replace_callback(
+ '/(?:[^'.self::CHAR_UNRESERVED.self::CHAR_SUB_DELIMS.'%:@\/]++|%(?![A-Fa-f0-9]{2}))/',
+ [$this, 'rawurlencodeMatchZero'],
+ $path
+ );
+ }
+
+ /**
+ * Filters the query string or fragment of a URI.
+ *
+ * @param mixed $str
+ *
+ * @throws \InvalidArgumentException If the query or fragment is invalid.
+ */
+ private function filterQueryAndFragment($str): string
+ {
+ if (!is_string($str)) {
+ throw new \InvalidArgumentException('Query and fragment must be a string');
+ }
+
+ return preg_replace_callback(
+ '/(?:[^'.self::CHAR_UNRESERVED.self::CHAR_SUB_DELIMS.'%:@\/\?]++|%(?![A-Fa-f0-9]{2}))/',
+ [$this, 'rawurlencodeMatchZero'],
+ $str
+ );
+ }
+
+ private function rawurlencodeMatchZero(array $match): string
+ {
+ return rawurlencode($match[0]);
+ }
+
+ private function validateState(): void
+ {
+ if ($this->host === '' && ($this->scheme === 'http' || $this->scheme === 'https')) {
+ $this->host = self::HTTP_DEFAULT_HOST;
+ }
+
+ if ($this->getAuthority() === '') {
+ if (0 === strpos($this->path, '//')) {
+ throw new MalformedUriException('The path of a URI without an authority must not start with two slashes "//"');
+ }
+ if ($this->scheme === '' && false !== strpos(explode('/', $this->path, 2)[0], ':')) {
+ throw new MalformedUriException('A relative URI must not have a path beginning with a segment containing a colon');
+ }
+ }
+ }
+}
diff --git a/vendor/guzzlehttp/psr7/src/UriComparator.php b/vendor/guzzlehttp/psr7/src/UriComparator.php
new file mode 100644
index 0000000..70c582a
--- /dev/null
+++ b/vendor/guzzlehttp/psr7/src/UriComparator.php
@@ -0,0 +1,52 @@
+getHost(), $modified->getHost()) !== 0) {
+ return true;
+ }
+
+ if ($original->getScheme() !== $modified->getScheme()) {
+ return true;
+ }
+
+ if (self::computePort($original) !== self::computePort($modified)) {
+ return true;
+ }
+
+ return false;
+ }
+
+ private static function computePort(UriInterface $uri): int
+ {
+ $port = $uri->getPort();
+
+ if (null !== $port) {
+ return $port;
+ }
+
+ return 'https' === $uri->getScheme() ? 443 : 80;
+ }
+
+ private function __construct()
+ {
+ // cannot be instantiated
+ }
+}
diff --git a/vendor/guzzlehttp/psr7/src/UriNormalizer.php b/vendor/guzzlehttp/psr7/src/UriNormalizer.php
new file mode 100644
index 0000000..cd4c383
--- /dev/null
+++ b/vendor/guzzlehttp/psr7/src/UriNormalizer.php
@@ -0,0 +1,220 @@
+getPath() === ''
+ && ($uri->getScheme() === 'http' || $uri->getScheme() === 'https')
+ ) {
+ $uri = $uri->withPath('/');
+ }
+
+ if ($flags & self::REMOVE_DEFAULT_HOST && $uri->getScheme() === 'file' && $uri->getHost() === 'localhost') {
+ $uri = $uri->withHost('');
+ }
+
+ if ($flags & self::REMOVE_DEFAULT_PORT && $uri->getPort() !== null && Uri::isDefaultPort($uri)) {
+ $uri = $uri->withPort(null);
+ }
+
+ if ($flags & self::REMOVE_DOT_SEGMENTS && !Uri::isRelativePathReference($uri)) {
+ $uri = $uri->withPath(UriResolver::removeDotSegments($uri->getPath()));
+ }
+
+ if ($flags & self::REMOVE_DUPLICATE_SLASHES) {
+ $uri = $uri->withPath(preg_replace('#//++#', '/', $uri->getPath()));
+ }
+
+ if ($flags & self::SORT_QUERY_PARAMETERS && $uri->getQuery() !== '') {
+ $queryKeyValues = explode('&', $uri->getQuery());
+ sort($queryKeyValues);
+ $uri = $uri->withQuery(implode('&', $queryKeyValues));
+ }
+
+ return $uri;
+ }
+
+ /**
+ * Whether two URIs can be considered equivalent.
+ *
+ * Both URIs are normalized automatically before comparison with the given $normalizations bitmask. The method also
+ * accepts relative URI references and returns true when they are equivalent. This of course assumes they will be
+ * resolved against the same base URI. If this is not the case, determination of equivalence or difference of
+ * relative references does not mean anything.
+ *
+ * @param UriInterface $uri1 An URI to compare
+ * @param UriInterface $uri2 An URI to compare
+ * @param int $normalizations A bitmask of normalizations to apply, see constants
+ *
+ * @see https://tools.ietf.org/html/rfc3986#section-6.1
+ */
+ public static function isEquivalent(UriInterface $uri1, UriInterface $uri2, int $normalizations = self::PRESERVING_NORMALIZATIONS): bool
+ {
+ return (string) self::normalize($uri1, $normalizations) === (string) self::normalize($uri2, $normalizations);
+ }
+
+ private static function capitalizePercentEncoding(UriInterface $uri): UriInterface
+ {
+ $regex = '/(?:%[A-Fa-f0-9]{2})++/';
+
+ $callback = function (array $match) {
+ return strtoupper($match[0]);
+ };
+
+ return
+ $uri->withPath(
+ preg_replace_callback($regex, $callback, $uri->getPath())
+ )->withQuery(
+ preg_replace_callback($regex, $callback, $uri->getQuery())
+ );
+ }
+
+ private static function decodeUnreservedCharacters(UriInterface $uri): UriInterface
+ {
+ $regex = '/%(?:2D|2E|5F|7E|3[0-9]|[46][1-9A-F]|[57][0-9A])/i';
+
+ $callback = function (array $match) {
+ return rawurldecode($match[0]);
+ };
+
+ return
+ $uri->withPath(
+ preg_replace_callback($regex, $callback, $uri->getPath())
+ )->withQuery(
+ preg_replace_callback($regex, $callback, $uri->getQuery())
+ );
+ }
+
+ private function __construct()
+ {
+ // cannot be instantiated
+ }
+}
diff --git a/vendor/guzzlehttp/psr7/src/UriResolver.php b/vendor/guzzlehttp/psr7/src/UriResolver.php
new file mode 100644
index 0000000..38d5793
--- /dev/null
+++ b/vendor/guzzlehttp/psr7/src/UriResolver.php
@@ -0,0 +1,211 @@
+getScheme() != '') {
+ return $rel->withPath(self::removeDotSegments($rel->getPath()));
+ }
+
+ if ($rel->getAuthority() != '') {
+ $targetAuthority = $rel->getAuthority();
+ $targetPath = self::removeDotSegments($rel->getPath());
+ $targetQuery = $rel->getQuery();
+ } else {
+ $targetAuthority = $base->getAuthority();
+ if ($rel->getPath() === '') {
+ $targetPath = $base->getPath();
+ $targetQuery = $rel->getQuery() != '' ? $rel->getQuery() : $base->getQuery();
+ } else {
+ if ($rel->getPath()[0] === '/') {
+ $targetPath = $rel->getPath();
+ } else {
+ if ($targetAuthority != '' && $base->getPath() === '') {
+ $targetPath = '/'.$rel->getPath();
+ } else {
+ $lastSlashPos = strrpos($base->getPath(), '/');
+ if ($lastSlashPos === false) {
+ $targetPath = $rel->getPath();
+ } else {
+ $targetPath = substr($base->getPath(), 0, $lastSlashPos + 1).$rel->getPath();
+ }
+ }
+ }
+ $targetPath = self::removeDotSegments($targetPath);
+ $targetQuery = $rel->getQuery();
+ }
+ }
+
+ return new Uri(Uri::composeComponents(
+ $base->getScheme(),
+ $targetAuthority,
+ $targetPath,
+ $targetQuery,
+ $rel->getFragment()
+ ));
+ }
+
+ /**
+ * Returns the target URI as a relative reference from the base URI.
+ *
+ * This method is the counterpart to resolve():
+ *
+ * (string) $target === (string) UriResolver::resolve($base, UriResolver::relativize($base, $target))
+ *
+ * One use-case is to use the current request URI as base URI and then generate relative links in your documents
+ * to reduce the document size or offer self-contained downloadable document archives.
+ *
+ * $base = new Uri('http://example.com/a/b/');
+ * echo UriResolver::relativize($base, new Uri('http://example.com/a/b/c')); // prints 'c'.
+ * echo UriResolver::relativize($base, new Uri('http://example.com/a/x/y')); // prints '../x/y'.
+ * echo UriResolver::relativize($base, new Uri('http://example.com/a/b/?q')); // prints '?q'.
+ * echo UriResolver::relativize($base, new Uri('http://example.org/a/b/')); // prints '//example.org/a/b/'.
+ *
+ * This method also accepts a target that is already relative and will try to relativize it further. Only a
+ * relative-path reference will be returned as-is.
+ *
+ * echo UriResolver::relativize($base, new Uri('/a/b/c')); // prints 'c' as well
+ */
+ public static function relativize(UriInterface $base, UriInterface $target): UriInterface
+ {
+ if ($target->getScheme() !== ''
+ && ($base->getScheme() !== $target->getScheme() || $target->getAuthority() === '' && $base->getAuthority() !== '')
+ ) {
+ return $target;
+ }
+
+ if (Uri::isRelativePathReference($target)) {
+ // As the target is already highly relative we return it as-is. It would be possible to resolve
+ // the target with `$target = self::resolve($base, $target);` and then try make it more relative
+ // by removing a duplicate query. But let's not do that automatically.
+ return $target;
+ }
+
+ if ($target->getAuthority() !== '' && $base->getAuthority() !== $target->getAuthority()) {
+ return $target->withScheme('');
+ }
+
+ // We must remove the path before removing the authority because if the path starts with two slashes, the URI
+ // would turn invalid. And we also cannot set a relative path before removing the authority, as that is also
+ // invalid.
+ $emptyPathUri = $target->withScheme('')->withPath('')->withUserInfo('')->withPort(null)->withHost('');
+
+ if ($base->getPath() !== $target->getPath()) {
+ return $emptyPathUri->withPath(self::getRelativePath($base, $target));
+ }
+
+ if ($base->getQuery() === $target->getQuery()) {
+ // Only the target fragment is left. And it must be returned even if base and target fragment are the same.
+ return $emptyPathUri->withQuery('');
+ }
+
+ // If the base URI has a query but the target has none, we cannot return an empty path reference as it would
+ // inherit the base query component when resolving.
+ if ($target->getQuery() === '') {
+ $segments = explode('/', $target->getPath());
+ /** @var string $lastSegment */
+ $lastSegment = end($segments);
+
+ return $emptyPathUri->withPath($lastSegment === '' ? './' : $lastSegment);
+ }
+
+ return $emptyPathUri;
+ }
+
+ private static function getRelativePath(UriInterface $base, UriInterface $target): string
+ {
+ $sourceSegments = explode('/', $base->getPath());
+ $targetSegments = explode('/', $target->getPath());
+ array_pop($sourceSegments);
+ $targetLastSegment = array_pop($targetSegments);
+ foreach ($sourceSegments as $i => $segment) {
+ if (isset($targetSegments[$i]) && $segment === $targetSegments[$i]) {
+ unset($sourceSegments[$i], $targetSegments[$i]);
+ } else {
+ break;
+ }
+ }
+ $targetSegments[] = $targetLastSegment;
+ $relativePath = str_repeat('../', count($sourceSegments)).implode('/', $targetSegments);
+
+ // A reference to am empty last segment or an empty first sub-segment must be prefixed with "./".
+ // This also applies to a segment with a colon character (e.g., "file:colon") that cannot be used
+ // as the first segment of a relative-path reference, as it would be mistaken for a scheme name.
+ if ('' === $relativePath || false !== strpos(explode('/', $relativePath, 2)[0], ':')) {
+ $relativePath = "./$relativePath";
+ } elseif ('/' === $relativePath[0]) {
+ if ($base->getAuthority() != '' && $base->getPath() === '') {
+ // In this case an extra slash is added by resolve() automatically. So we must not add one here.
+ $relativePath = ".$relativePath";
+ } else {
+ $relativePath = "./$relativePath";
+ }
+ }
+
+ return $relativePath;
+ }
+
+ private function __construct()
+ {
+ // cannot be instantiated
+ }
+}
diff --git a/vendor/guzzlehttp/psr7/src/Utils.php b/vendor/guzzlehttp/psr7/src/Utils.php
new file mode 100644
index 0000000..917c05e
--- /dev/null
+++ b/vendor/guzzlehttp/psr7/src/Utils.php
@@ -0,0 +1,463 @@
+ $v) {
+ if (!is_string($k) || !in_array(strtolower($k), $keys)) {
+ $result[$k] = $v;
+ }
+ }
+
+ return $result;
+ }
+
+ /**
+ * Copy the contents of a stream into another stream until the given number
+ * of bytes have been read.
+ *
+ * @param StreamInterface $source Stream to read from
+ * @param StreamInterface $dest Stream to write to
+ * @param int $maxLen Maximum number of bytes to read. Pass -1
+ * to read the entire stream.
+ *
+ * @throws \RuntimeException on error.
+ */
+ public static function copyToStream(StreamInterface $source, StreamInterface $dest, int $maxLen = -1): void
+ {
+ $bufferSize = 8192;
+
+ if ($maxLen === -1) {
+ while (!$source->eof()) {
+ if (!$dest->write($source->read($bufferSize))) {
+ break;
+ }
+ }
+ } else {
+ $remaining = $maxLen;
+ while ($remaining > 0 && !$source->eof()) {
+ $buf = $source->read(min($bufferSize, $remaining));
+ $len = strlen($buf);
+ if (!$len) {
+ break;
+ }
+ $remaining -= $len;
+ $dest->write($buf);
+ }
+ }
+ }
+
+ /**
+ * Copy the contents of a stream into a string until the given number of
+ * bytes have been read.
+ *
+ * @param StreamInterface $stream Stream to read
+ * @param int $maxLen Maximum number of bytes to read. Pass -1
+ * to read the entire stream.
+ *
+ * @throws \RuntimeException on error.
+ */
+ public static function copyToString(StreamInterface $stream, int $maxLen = -1): string
+ {
+ $buffer = '';
+
+ if ($maxLen === -1) {
+ while (!$stream->eof()) {
+ $buf = $stream->read(1048576);
+ if ($buf === '') {
+ break;
+ }
+ $buffer .= $buf;
+ }
+
+ return $buffer;
+ }
+
+ $len = 0;
+ while (!$stream->eof() && $len < $maxLen) {
+ $buf = $stream->read($maxLen - $len);
+ if ($buf === '') {
+ break;
+ }
+ $buffer .= $buf;
+ $len = strlen($buffer);
+ }
+
+ return $buffer;
+ }
+
+ /**
+ * Calculate a hash of a stream.
+ *
+ * This method reads the entire stream to calculate a rolling hash, based
+ * on PHP's `hash_init` functions.
+ *
+ * @param StreamInterface $stream Stream to calculate the hash for
+ * @param string $algo Hash algorithm (e.g. md5, crc32, etc)
+ * @param bool $rawOutput Whether or not to use raw output
+ *
+ * @throws \RuntimeException on error.
+ */
+ public static function hash(StreamInterface $stream, string $algo, bool $rawOutput = false): string
+ {
+ $pos = $stream->tell();
+
+ if ($pos > 0) {
+ $stream->rewind();
+ }
+
+ $ctx = hash_init($algo);
+ while (!$stream->eof()) {
+ hash_update($ctx, $stream->read(1048576));
+ }
+
+ $out = hash_final($ctx, $rawOutput);
+ $stream->seek($pos);
+
+ return $out;
+ }
+
+ /**
+ * Clone and modify a request with the given changes.
+ *
+ * This method is useful for reducing the number of clones needed to mutate
+ * a message.
+ *
+ * The changes can be one of:
+ * - method: (string) Changes the HTTP method.
+ * - set_headers: (array) Sets the given headers.
+ * - remove_headers: (array) Remove the given headers.
+ * - body: (mixed) Sets the given body.
+ * - uri: (UriInterface) Set the URI.
+ * - query: (string) Set the query string value of the URI.
+ * - version: (string) Set the protocol version.
+ *
+ * @param RequestInterface $request Request to clone and modify.
+ * @param array $changes Changes to apply.
+ */
+ public static function modifyRequest(RequestInterface $request, array $changes): RequestInterface
+ {
+ if (!$changes) {
+ return $request;
+ }
+
+ $headers = $request->getHeaders();
+
+ if (!isset($changes['uri'])) {
+ $uri = $request->getUri();
+ } else {
+ // Remove the host header if one is on the URI
+ if ($host = $changes['uri']->getHost()) {
+ $changes['set_headers']['Host'] = $host;
+
+ if ($port = $changes['uri']->getPort()) {
+ $standardPorts = ['http' => 80, 'https' => 443];
+ $scheme = $changes['uri']->getScheme();
+ if (isset($standardPorts[$scheme]) && $port != $standardPorts[$scheme]) {
+ $changes['set_headers']['Host'] .= ':'.$port;
+ }
+ }
+ }
+ $uri = $changes['uri'];
+ }
+
+ if (!empty($changes['remove_headers'])) {
+ $headers = self::caselessRemove($changes['remove_headers'], $headers);
+ }
+
+ if (!empty($changes['set_headers'])) {
+ $headers = self::caselessRemove(array_keys($changes['set_headers']), $headers);
+ $headers = $changes['set_headers'] + $headers;
+ }
+
+ if (isset($changes['query'])) {
+ $uri = $uri->withQuery($changes['query']);
+ }
+
+ if ($request instanceof ServerRequestInterface) {
+ $new = (new ServerRequest(
+ $changes['method'] ?? $request->getMethod(),
+ $uri,
+ $headers,
+ $changes['body'] ?? $request->getBody(),
+ $changes['version'] ?? $request->getProtocolVersion(),
+ $request->getServerParams()
+ ))
+ ->withParsedBody($request->getParsedBody())
+ ->withQueryParams($request->getQueryParams())
+ ->withCookieParams($request->getCookieParams())
+ ->withUploadedFiles($request->getUploadedFiles());
+
+ foreach ($request->getAttributes() as $key => $value) {
+ $new = $new->withAttribute($key, $value);
+ }
+
+ return $new;
+ }
+
+ return new Request(
+ $changes['method'] ?? $request->getMethod(),
+ $uri,
+ $headers,
+ $changes['body'] ?? $request->getBody(),
+ $changes['version'] ?? $request->getProtocolVersion()
+ );
+ }
+
+ /**
+ * Read a line from the stream up to the maximum allowed buffer length.
+ *
+ * @param StreamInterface $stream Stream to read from
+ * @param int|null $maxLength Maximum buffer length
+ */
+ public static function readLine(StreamInterface $stream, int $maxLength = null): string
+ {
+ $buffer = '';
+ $size = 0;
+
+ while (!$stream->eof()) {
+ if ('' === ($byte = $stream->read(1))) {
+ return $buffer;
+ }
+ $buffer .= $byte;
+ // Break when a new line is found or the max length - 1 is reached
+ if ($byte === "\n" || ++$size === $maxLength - 1) {
+ break;
+ }
+ }
+
+ return $buffer;
+ }
+
+ /**
+ * Create a new stream based on the input type.
+ *
+ * Options is an associative array that can contain the following keys:
+ * - metadata: Array of custom metadata.
+ * - size: Size of the stream.
+ *
+ * This method accepts the following `$resource` types:
+ * - `Psr\Http\Message\StreamInterface`: Returns the value as-is.
+ * - `string`: Creates a stream object that uses the given string as the contents.
+ * - `resource`: Creates a stream object that wraps the given PHP stream resource.
+ * - `Iterator`: If the provided value implements `Iterator`, then a read-only
+ * stream object will be created that wraps the given iterable. Each time the
+ * stream is read from, data from the iterator will fill a buffer and will be
+ * continuously called until the buffer is equal to the requested read size.
+ * Subsequent read calls will first read from the buffer and then call `next`
+ * on the underlying iterator until it is exhausted.
+ * - `object` with `__toString()`: If the object has the `__toString()` method,
+ * the object will be cast to a string and then a stream will be returned that
+ * uses the string value.
+ * - `NULL`: When `null` is passed, an empty stream object is returned.
+ * - `callable` When a callable is passed, a read-only stream object will be
+ * created that invokes the given callable. The callable is invoked with the
+ * number of suggested bytes to read. The callable can return any number of
+ * bytes, but MUST return `false` when there is no more data to return. The
+ * stream object that wraps the callable will invoke the callable until the
+ * number of requested bytes are available. Any additional bytes will be
+ * buffered and used in subsequent reads.
+ *
+ * @param resource|string|int|float|bool|StreamInterface|callable|\Iterator|null $resource Entity body data
+ * @param array{size?: int, metadata?: array} $options Additional options
+ *
+ * @throws \InvalidArgumentException if the $resource arg is not valid.
+ */
+ public static function streamFor($resource = '', array $options = []): StreamInterface
+ {
+ if (is_scalar($resource)) {
+ $stream = self::tryFopen('php://temp', 'r+');
+ if ($resource !== '') {
+ fwrite($stream, (string) $resource);
+ fseek($stream, 0);
+ }
+
+ return new Stream($stream, $options);
+ }
+
+ switch (gettype($resource)) {
+ case 'resource':
+ /*
+ * The 'php://input' is a special stream with quirks and inconsistencies.
+ * We avoid using that stream by reading it into php://temp
+ */
+
+ /** @var resource $resource */
+ if ((\stream_get_meta_data($resource)['uri'] ?? '') === 'php://input') {
+ $stream = self::tryFopen('php://temp', 'w+');
+ stream_copy_to_stream($resource, $stream);
+ fseek($stream, 0);
+ $resource = $stream;
+ }
+
+ return new Stream($resource, $options);
+ case 'object':
+ /** @var object $resource */
+ if ($resource instanceof StreamInterface) {
+ return $resource;
+ } elseif ($resource instanceof \Iterator) {
+ return new PumpStream(function () use ($resource) {
+ if (!$resource->valid()) {
+ return false;
+ }
+ $result = $resource->current();
+ $resource->next();
+
+ return $result;
+ }, $options);
+ } elseif (method_exists($resource, '__toString')) {
+ return self::streamFor((string) $resource, $options);
+ }
+ break;
+ case 'NULL':
+ return new Stream(self::tryFopen('php://temp', 'r+'), $options);
+ }
+
+ if (is_callable($resource)) {
+ return new PumpStream($resource, $options);
+ }
+
+ throw new \InvalidArgumentException('Invalid resource type: '.gettype($resource));
+ }
+
+ /**
+ * Safely opens a PHP stream resource using a filename.
+ *
+ * When fopen fails, PHP normally raises a warning. This function adds an
+ * error handler that checks for errors and throws an exception instead.
+ *
+ * @param string $filename File to open
+ * @param string $mode Mode used to open the file
+ *
+ * @return resource
+ *
+ * @throws \RuntimeException if the file cannot be opened
+ */
+ public static function tryFopen(string $filename, string $mode)
+ {
+ $ex = null;
+ set_error_handler(static function (int $errno, string $errstr) use ($filename, $mode, &$ex): bool {
+ $ex = new \RuntimeException(sprintf(
+ 'Unable to open "%s" using mode "%s": %s',
+ $filename,
+ $mode,
+ $errstr
+ ));
+
+ return true;
+ });
+
+ try {
+ /** @var resource $handle */
+ $handle = fopen($filename, $mode);
+ } catch (\Throwable $e) {
+ $ex = new \RuntimeException(sprintf(
+ 'Unable to open "%s" using mode "%s": %s',
+ $filename,
+ $mode,
+ $e->getMessage()
+ ), 0, $e);
+ }
+
+ restore_error_handler();
+
+ if ($ex) {
+ /** @var $ex \RuntimeException */
+ throw $ex;
+ }
+
+ return $handle;
+ }
+
+ /**
+ * Safely gets the contents of a given stream.
+ *
+ * When stream_get_contents fails, PHP normally raises a warning. This
+ * function adds an error handler that checks for errors and throws an
+ * exception instead.
+ *
+ * @param resource $stream
+ *
+ * @throws \RuntimeException if the stream cannot be read
+ */
+ public static function tryGetContents($stream): string
+ {
+ $ex = null;
+ set_error_handler(static function (int $errno, string $errstr) use (&$ex): bool {
+ $ex = new \RuntimeException(sprintf(
+ 'Unable to read stream contents: %s',
+ $errstr
+ ));
+
+ return true;
+ });
+
+ try {
+ /** @var string|false $contents */
+ $contents = stream_get_contents($stream);
+
+ if ($contents === false) {
+ $ex = new \RuntimeException('Unable to read stream contents');
+ }
+ } catch (\Throwable $e) {
+ $ex = new \RuntimeException(sprintf(
+ 'Unable to read stream contents: %s',
+ $e->getMessage()
+ ), 0, $e);
+ }
+
+ restore_error_handler();
+
+ if ($ex) {
+ /** @var $ex \RuntimeException */
+ throw $ex;
+ }
+
+ return $contents;
+ }
+
+ /**
+ * Returns a UriInterface for the given value.
+ *
+ * This function accepts a string or UriInterface and returns a
+ * UriInterface for the given value. If the value is already a
+ * UriInterface, it is returned as-is.
+ *
+ * @param string|UriInterface $uri
+ *
+ * @throws \InvalidArgumentException
+ */
+ public static function uriFor($uri): UriInterface
+ {
+ if ($uri instanceof UriInterface) {
+ return $uri;
+ }
+
+ if (is_string($uri)) {
+ return new Uri($uri);
+ }
+
+ throw new \InvalidArgumentException('URI must be a string or UriInterface');
+ }
+}
diff --git a/lib/ilovepdf-php-master/.gitignore b/vendor/ilovepdf/ilovepdf-php/.gitignore
similarity index 76%
rename from lib/ilovepdf-php-master/.gitignore
rename to vendor/ilovepdf/ilovepdf-php/.gitignore
index 4e55b58..723fc56 100644
--- a/lib/ilovepdf-php-master/.gitignore
+++ b/vendor/ilovepdf/ilovepdf-php/.gitignore
@@ -4,4 +4,5 @@
.DS_Store
/tests/data/
composer.lock
-clover.xml
\ No newline at end of file
+clover.xml
+.phpunit*
\ No newline at end of file
diff --git a/lib/ilovepdf-php-master/changelog.md b/vendor/ilovepdf/ilovepdf-php/changelog.md
similarity index 58%
rename from lib/ilovepdf-php-master/changelog.md
rename to vendor/ilovepdf/ilovepdf-php/changelog.md
index 7bd382a..ad62756 100644
--- a/lib/ilovepdf-php-master/changelog.md
+++ b/vendor/ilovepdf/ilovepdf-php/changelog.md
@@ -1,6 +1,26 @@
Changelog
---------
+
+v1.2.2
+
+* Compatibility with php 8.1
+* Upgraded php version requirements
+* Only composer use mode
+* Code cleaned
+* Improved exception messages
+
+v1.2.1
+
+* New tool editpdf added
+
+v1.1.18
+
+* Php 8 compatibility
+* Upgraded php version requirements
+* Added Watermark with images
+* Improved download to browser method
+
v1.0.11
* Bug AuthException warning
diff --git a/lib/ilovepdf-php-master/composer.json b/vendor/ilovepdf/ilovepdf-php/composer.json
similarity index 62%
rename from lib/ilovepdf-php-master/composer.json
rename to vendor/ilovepdf/ilovepdf-php/composer.json
index ca8ad10..80dc4b9 100644
--- a/lib/ilovepdf-php-master/composer.json
+++ b/vendor/ilovepdf/ilovepdf-php/composer.json
@@ -21,10 +21,18 @@
}
},
"require": {
- "php": ">=5.5.9",
- "ext-curl": "*"
+ "php": ">=7.3",
+ "firebase/php-jwt": "^6.0",
+ "guzzlehttp/guzzle": "^7.4",
+ "ext-json": "*"
},
"require-dev": {
- "phpunit/phpunit": "^6.1"
+ "phpunit/phpunit": "^9.5",
+ "vimeo/psalm": "^4.21"
+ },
+ "config": {
+ "allow-plugins": {
+ "composer/package-versions-deprecated": true
+ }
}
}
diff --git a/vendor/ilovepdf/ilovepdf-php/phpunit.xml b/vendor/ilovepdf/ilovepdf-php/phpunit.xml
new file mode 100644
index 0000000..a34b465
--- /dev/null
+++ b/vendor/ilovepdf/ilovepdf-php/phpunit.xml
@@ -0,0 +1,14 @@
+
+
+
+
+ src/
+
+
+
+
+ tests
+ ./tests/TestCase.php
+
+
+
\ No newline at end of file
diff --git a/vendor/ilovepdf/ilovepdf-php/psalm.xml b/vendor/ilovepdf/ilovepdf-php/psalm.xml
new file mode 100644
index 0000000..7c0333d
--- /dev/null
+++ b/vendor/ilovepdf/ilovepdf-php/psalm.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
diff --git a/lib/ilovepdf-php-master/readme.md b/vendor/ilovepdf/ilovepdf-php/readme.md
similarity index 76%
rename from lib/ilovepdf-php-master/readme.md
rename to vendor/ilovepdf/ilovepdf-php/readme.md
index 260636a..231d3bc 100644
--- a/lib/ilovepdf-php-master/readme.md
+++ b/vendor/ilovepdf/ilovepdf-php/readme.md
@@ -1,8 +1,8 @@
iLovePDF Api - Php Library
--------------------------
-[![Build Status](https://travis-ci.org/ilovepdf/ilovepdf-php.svg?branch=master)](https://travis-ci.org/ilovepdf/ilovepdf-php)
[![Latest Stable Version](https://poser.pugx.org/ilovepdf/ilovepdf-php/version)](https://packagist.org/packages/ilovepdf/ilovepdf-php)
+[![Total Downloads](https://poser.pugx.org/ilovepdf/ilovepdf-php/downloads.svg)](https://packagist.org/packages/ilovepdf/ilovepdf-php)
[![License](https://poser.pugx.org/ilovepdf/ilovepdf-php/license)](https://packagist.org/packages/ilovepdf/ilovepdf-php)
A library in php for [iLovePDF Api](https://developer.ilovepdf.com)
@@ -13,12 +13,10 @@ Develop and automate PDF processing tasks like Compress PDF, Merge PDF, Split PD
## Requirements
-PHP 5.6 and later.
+PHP 7.4 and later.
## Install
-### Using composer
-
You can install the library via [Composer](http://getcomposer.org/). Run the following command:
```bash
@@ -31,20 +29,13 @@ To use the library, use Composer's [autoload](https://getcomposer.org/doc/00-int
require_once('vendor/autoload.php');
```
-
-### Manual Installation
-
-If you do not wish to use Composer, you can download the [latest release](https://github.com/ilovepdf/ilovepdf-php/releases). Then, to use the library, include the `init.php` file.
-
-```php
-require_once('/path/to/ilovepdf-php/init.php');
-```
-
## Getting Started
Simple usage looks like:
```php
+use Ilovepdf\Ilovepdf;
+
$ilovepdf = new Ilovepdf('project_public_id','project_secret_key');
$myTask = $ilovepdf->newTask('compress');
$file1 = $myTask->addFile('file1.pdf');
diff --git a/vendor/ilovepdf/ilovepdf-php/samples/chained_task.php b/vendor/ilovepdf/ilovepdf-php/samples/chained_task.php
new file mode 100644
index 0000000..d500c1f
--- /dev/null
+++ b/vendor/ilovepdf/ilovepdf-php/samples/chained_task.php
@@ -0,0 +1,32 @@
+newTask('split');
+
+$splitTask->addFile('your_file.pdf');
+
+//get the 2nd page
+$splitTask->setRanges("2");
+// run the task
+$splitTask->execute();
+
+//and create a new task from last action
+$convertTask = $splitTask->next('pdfjpg');
+
+// process files
+$convertTask->execute();
+
+// and finally download file. If no path is set, it will be downloaded on current folder
+$convertTask->download('path/to/download');
\ No newline at end of file
diff --git a/lib/ilovepdf-php-master/samples/compress_advanced.php b/vendor/ilovepdf/ilovepdf-php/samples/compress_advanced.php
similarity index 100%
rename from lib/ilovepdf-php-master/samples/compress_advanced.php
rename to vendor/ilovepdf/ilovepdf-php/samples/compress_advanced.php
diff --git a/lib/ilovepdf-php-master/samples/compress_basic.php b/vendor/ilovepdf/ilovepdf-php/samples/compress_basic.php
similarity index 100%
rename from lib/ilovepdf-php-master/samples/compress_basic.php
rename to vendor/ilovepdf/ilovepdf-php/samples/compress_basic.php
diff --git a/vendor/ilovepdf/ilovepdf-php/samples/editpdf_advanced.php b/vendor/ilovepdf/ilovepdf-php/samples/editpdf_advanced.php
new file mode 100644
index 0000000..c2352bc
--- /dev/null
+++ b/vendor/ilovepdf/ilovepdf-php/samples/editpdf_advanced.php
@@ -0,0 +1,65 @@
+addFile('your_file.pdf');
+
+// Upload Image file to Ilovepdf servers
+$imageFile = $editpdfTask->addFile('your_image.jpg');
+$svgFile = $editpdfTask->addFile('your_svg.svg');
+
+// Create ImageElement
+$imageElement = new ImageElement();
+$imageElement->setCoordinates(300, 600)
+ ->setPages(3)
+ ->setOpacity(40)
+ ->setFile($imageFile);
+
+// Create TextElement
+$textElement = new TextElement();
+$textElement->setText("This is a sample text")
+ ->setCoordinates(300, 600)
+ ->setPages(2)
+ ->setTextAlign("center")
+ ->setFontFamily("Times New Roman")
+ ->setFontColor("#FB8B24") // Orange
+ ->setBold();
+
+// Create SvgElement
+$svgElement = new SvgElement();
+$svgElement->setFile($svgFile);
+
+// Add elements to Editpdf task in order of drawing (important if elements overlap!)
+$editpdfTask->addElement($imageElement);
+$editpdfTask->addElement($textElement);
+$editpdfTask->addElement($svgElement);
+
+foreach($editpdfTask->getElements() as $editpdfElement){
+ $isElemValid = $editpdfElement->validate();
+
+ if(!$isElemValid){
+ $validationErrors = $editpdfElement->getErrors();
+
+ // Output what went wrong
+ echo "{$editpdfElement->getType()} element has errors:\n";
+ var_dump($validationErrors);
+ exit(1);
+ }
+}
+
+$editpdfTask->setOutputFilename('editpdf-advanced');
+$editpdfTask->execute();
+$editpdfTask->download('downloads');
diff --git a/vendor/ilovepdf/ilovepdf-php/samples/editpdf_basic.php b/vendor/ilovepdf/ilovepdf-php/samples/editpdf_basic.php
new file mode 100644
index 0000000..40a8556
--- /dev/null
+++ b/vendor/ilovepdf/ilovepdf-php/samples/editpdf_basic.php
@@ -0,0 +1,30 @@
+addFile('your_file.pdf');
+
+// Upload Image file to Ilovepdf servers
+$imageFile = $editpdfTask->addFile('your_image.jpg');
+
+// Create ImageElement
+$imageElem = new ImageElement();
+$imageElem->setFile($imageFile);
+
+// Add image element to Editpdf task
+$editpdfTask->addElement($imageElem);
+
+$editpdfTask->setOutputFilename('editpdf-basic');
+$editpdfTask->execute();
+$editpdfTask->download('downloads');
diff --git a/lib/ilovepdf-php-master/samples/extract_advanced.php b/vendor/ilovepdf/ilovepdf-php/samples/extract_advanced.php
similarity index 100%
rename from lib/ilovepdf-php-master/samples/extract_advanced.php
rename to vendor/ilovepdf/ilovepdf-php/samples/extract_advanced.php
diff --git a/lib/ilovepdf-php-master/samples/extract_basic.php b/vendor/ilovepdf/ilovepdf-php/samples/extract_basic.php
similarity index 100%
rename from lib/ilovepdf-php-master/samples/extract_basic.php
rename to vendor/ilovepdf/ilovepdf-php/samples/extract_basic.php
diff --git a/vendor/ilovepdf/ilovepdf-php/samples/get_remaining_files.php b/vendor/ilovepdf/ilovepdf-php/samples/get_remaining_files.php
new file mode 100644
index 0000000..cf602a0
--- /dev/null
+++ b/vendor/ilovepdf/ilovepdf-php/samples/get_remaining_files.php
@@ -0,0 +1,26 @@
+getRemainingFiles();
+
+
+//print your remaining files
+echo $remainingFiles;
+
+//only start new process if you have enough files
+if($remainingFiles>0) {
+ //start the task
+ $myTask = $ilovepdf->newTask('merge');
+}
\ No newline at end of file
diff --git a/vendor/ilovepdf/ilovepdf-php/samples/htmlpdf_advanced.php b/vendor/ilovepdf/ilovepdf-php/samples/htmlpdf_advanced.php
new file mode 100644
index 0000000..f6a1ab1
--- /dev/null
+++ b/vendor/ilovepdf/ilovepdf-php/samples/htmlpdf_advanced.php
@@ -0,0 +1,33 @@
+addUrl('https://ilovepdf.com');
+
+// set page margin
+$myTask->setPageMargin(20);
+
+// set one large page
+$myTask->setSinglePage(true);
+
+// and set name for output file.
+// the task will set the correct file extension for you.
+$myTask->setOutputFilename('ilovepdf_web');
+
+// process files
+$myTask->execute();
+
+// and finally download file. If no path is set, it will be downloaded on current folder
+$myTask->download('path/to/download');
\ No newline at end of file
diff --git a/vendor/ilovepdf/ilovepdf-php/samples/htmlpdf_basic.php b/vendor/ilovepdf/ilovepdf-php/samples/htmlpdf_basic.php
new file mode 100644
index 0000000..73e60db
--- /dev/null
+++ b/vendor/ilovepdf/ilovepdf-php/samples/htmlpdf_basic.php
@@ -0,0 +1,22 @@
+addUrl('https://ilovepdf.com');
+
+// process files
+$myTask->execute();
+
+// and finally download file. If no path is set, it will be downloaded on current folder
+$myTask->download();
\ No newline at end of file
diff --git a/lib/ilovepdf-php-master/samples/imagepdf_advanced.php b/vendor/ilovepdf/ilovepdf-php/samples/imagepdf_advanced.php
similarity index 100%
rename from lib/ilovepdf-php-master/samples/imagepdf_advanced.php
rename to vendor/ilovepdf/ilovepdf-php/samples/imagepdf_advanced.php
diff --git a/lib/ilovepdf-php-master/samples/imagepdf_basic.php b/vendor/ilovepdf/ilovepdf-php/samples/imagepdf_basic.php
similarity index 100%
rename from lib/ilovepdf-php-master/samples/imagepdf_basic.php
rename to vendor/ilovepdf/ilovepdf-php/samples/imagepdf_basic.php
diff --git a/lib/ilovepdf-php-master/samples/merge_advanced.php b/vendor/ilovepdf/ilovepdf-php/samples/merge_advanced.php
similarity index 100%
rename from lib/ilovepdf-php-master/samples/merge_advanced.php
rename to vendor/ilovepdf/ilovepdf-php/samples/merge_advanced.php
diff --git a/lib/ilovepdf-php-master/samples/merge_basic.php b/vendor/ilovepdf/ilovepdf-php/samples/merge_basic.php
similarity index 100%
rename from lib/ilovepdf-php-master/samples/merge_basic.php
rename to vendor/ilovepdf/ilovepdf-php/samples/merge_basic.php
diff --git a/vendor/ilovepdf/ilovepdf-php/samples/officepdf_basic.php b/vendor/ilovepdf/ilovepdf-php/samples/officepdf_basic.php
new file mode 100644
index 0000000..b45d2e6
--- /dev/null
+++ b/vendor/ilovepdf/ilovepdf-php/samples/officepdf_basic.php
@@ -0,0 +1,22 @@
+addFile('/path/to/file/document.docx');
+
+// process files
+$myTask->execute();
+
+// and finally download file. If no path is set, it will be downloaded on current folder
+$myTask->download();
\ No newline at end of file
diff --git a/lib/ilovepdf-php-master/samples/pdfa_advanced.php b/vendor/ilovepdf/ilovepdf-php/samples/pdfa_advanced.php
similarity index 100%
rename from lib/ilovepdf-php-master/samples/pdfa_advanced.php
rename to vendor/ilovepdf/ilovepdf-php/samples/pdfa_advanced.php
diff --git a/lib/ilovepdf-php-master/samples/pdfa_basic.php b/vendor/ilovepdf/ilovepdf-php/samples/pdfa_basic.php
similarity index 100%
rename from lib/ilovepdf-php-master/samples/pdfa_basic.php
rename to vendor/ilovepdf/ilovepdf-php/samples/pdfa_basic.php
diff --git a/vendor/ilovepdf/ilovepdf-php/samples/pdfjpg_advanced.php b/vendor/ilovepdf/ilovepdf-php/samples/pdfjpg_advanced.php
new file mode 100644
index 0000000..689db73
--- /dev/null
+++ b/vendor/ilovepdf/ilovepdf-php/samples/pdfjpg_advanced.php
@@ -0,0 +1,31 @@
+addFile('/path/to/file/document1.pdf');
+$file2 = $myTask->addFile('/path/to/file/document2.pdf');
+
+// set extract mode
+$myTask->setMode('pages'); // Set the process mode: convert each page to image or extract all images in pdf
+
+// and set name for output file.
+// the task will set the correct file extension for you.
+$myTask->setOutputFilename('pdf_file_name');
+$myTask->setPackagedFilename('zip_file_name');
+
+// process files
+$myTask->execute();
+
+// and finally download file. If no path is set, it will be downloaded on current folder
+$myTask->download();
\ No newline at end of file
diff --git a/vendor/ilovepdf/ilovepdf-php/samples/pdfjpg_basic.php b/vendor/ilovepdf/ilovepdf-php/samples/pdfjpg_basic.php
new file mode 100644
index 0000000..4137c45
--- /dev/null
+++ b/vendor/ilovepdf/ilovepdf-php/samples/pdfjpg_basic.php
@@ -0,0 +1,22 @@
+addFile('/path/to/file/document.pdf');
+
+// process files
+$myTask->execute();
+
+// and finally download file. If no path is set, it will be downloaded on current folder
+$myTask->download();
\ No newline at end of file
diff --git a/lib/ilovepdf-php-master/samples/protect_basic.php b/vendor/ilovepdf/ilovepdf-php/samples/protect_basic.php
similarity index 100%
rename from lib/ilovepdf-php-master/samples/protect_basic.php
rename to vendor/ilovepdf/ilovepdf-php/samples/protect_basic.php
diff --git a/lib/ilovepdf-php-master/samples/repair_advanced.php b/vendor/ilovepdf/ilovepdf-php/samples/repair_advanced.php
similarity index 100%
rename from lib/ilovepdf-php-master/samples/repair_advanced.php
rename to vendor/ilovepdf/ilovepdf-php/samples/repair_advanced.php
diff --git a/lib/ilovepdf-php-master/samples/repair_basic.php b/vendor/ilovepdf/ilovepdf-php/samples/repair_basic.php
similarity index 100%
rename from lib/ilovepdf-php-master/samples/repair_basic.php
rename to vendor/ilovepdf/ilovepdf-php/samples/repair_basic.php
diff --git a/lib/ilovepdf-php-master/samples/rotate_advanced.php b/vendor/ilovepdf/ilovepdf-php/samples/rotate_advanced.php
similarity index 100%
rename from lib/ilovepdf-php-master/samples/rotate_advanced.php
rename to vendor/ilovepdf/ilovepdf-php/samples/rotate_advanced.php
diff --git a/lib/ilovepdf-php-master/samples/rotate_basic.php b/vendor/ilovepdf/ilovepdf-php/samples/rotate_basic.php
similarity index 100%
rename from lib/ilovepdf-php-master/samples/rotate_basic.php
rename to vendor/ilovepdf/ilovepdf-php/samples/rotate_basic.php
diff --git a/vendor/ilovepdf/ilovepdf-php/samples/sign_advanced.php b/vendor/ilovepdf/ilovepdf-php/samples/sign_advanced.php
new file mode 100644
index 0000000..f124aff
--- /dev/null
+++ b/vendor/ilovepdf/ilovepdf-php/samples/sign_advanced.php
@@ -0,0 +1,106 @@
+
+ setVerifySignatureVerification(true)->
+ setSubject($emailSubject)->
+ setMessage($emailBody)->
+ setReminders($reminderDays)->
+ setLockOrder(false)->
+ setExpirationDays($daysUntilSignatureExpires)->
+ setLanguage($taskLanguage)->
+ setUuidVisible(true);
+
+// We first upload the files that we are going to use
+$file = $signTask->addFile('/path/to/file/document.pdf');
+
+// Set brand
+$signTask->setBrand('My brand name', '/path/to/file/brand_logo.png');
+
+//////////////
+// ELEMENTS //
+//////////////
+// Let's define the elements to be placed in the documents
+$elements = [];
+
+$signatureElement = new ElementSignature();
+$signatureElement->setPosition(20, -20)
+ ->setPages("1,2"); //we can define the pages with a comma
+
+$dateElement = new ElementDate();
+$dateElement->setPosition(30, -30)
+ ->setPages("1-2"); // ranges can also be defined this way
+
+$initialsElement = new ElementInitials();
+$initialsElement->setPosition(40, -40)
+ ->setPages("1,2,3-6"); // You can define multiple ranges
+
+$inputElement = new ElementInput();
+$inputElement->setPosition(50, -50)
+ ->setLabel("Passport Number")
+ ->setText("Please put your passport number")
+ ->setPages("1");
+
+$nameElement = new ElementName();
+$nameElement->setPosition(60, -60)
+ ->setSize(40)
+ ->setPages("1");
+
+$textElement = new ElementText();
+$textElement->setPosition(70, -70)
+ ->setText("This is a text field")
+ ->setSize(40)
+ ->setPages("1");
+
+// Add Elements
+$elements[]= $signatureElement;
+$elements[]= $dateElement;
+$elements[]= $initialsElement;
+$elements[]= $inputElement;
+$elements[]= $nameElement;
+$elements[]= $textElement;
+
+///////////////
+// RECEIVERS //
+///////////////
+// Create the receivers
+$signer = new Signer("Signer","signer@email.com");
+$validator = new Validator("Validator","validator@email.com");
+$witness = new Witness("Witness","witness@email.com");
+
+// Add elements to the receivers that need it
+$signer->addElements($file, $elements);
+
+// Add all receivers to the Sign task
+$signTask->addReceiver($validator);
+$signTask->addReceiver($signer);
+$signTask->addReceiver($witness);
+
+// Lastly send the signature request
+$signature = $signTask->execute()->result;
+var_dump($signature);
\ No newline at end of file
diff --git a/vendor/ilovepdf/ilovepdf-php/samples/sign_basic.php b/vendor/ilovepdf/ilovepdf-php/samples/sign_basic.php
new file mode 100644
index 0000000..29c2f42
--- /dev/null
+++ b/vendor/ilovepdf/ilovepdf-php/samples/sign_basic.php
@@ -0,0 +1,29 @@
+addFile('/path/to/file');
+
+// Add signers and their elements;
+$signatureElement = new ElementSignature();
+$signatureElement->setPosition(20, -20)
+ ->setPages("1")
+ ->setSize(40);
+
+// Create a signer
+$signer = new Signer("name","signer@email.com");
+
+// Assign the signer an element to be signed
+$signer->addElements($file, $signatureElement);
+
+$signTask->addReceiver($signer);
+$signature = $signTask->execute()->result;
+var_dump($signature);
\ No newline at end of file
diff --git a/vendor/ilovepdf/ilovepdf-php/samples/sign_management.php b/vendor/ilovepdf/ilovepdf-php/samples/sign_management.php
new file mode 100644
index 0000000..2b39d07
--- /dev/null
+++ b/vendor/ilovepdf/ilovepdf-php/samples/sign_management.php
@@ -0,0 +1,47 @@
+getSignaturesList();
+
+// Get the first page, with max number of 50 entries per page (default is 20, max is 100).
+$signatureRequest->getSignaturesList(0, 50);
+
+// Get the current status of the signature:
+$signatureRequest->getSignatureStatus($signatureToken);
+
+// Get information about a specific receiver:
+$signatureRequest->getReceiverInfo($receiverToken);
+
+// Download the audit file on the filesystem
+$signatureRequest->downloadAuditFile($signatureToken, "./", "audit3");
+
+// Download the original files on the filesystem:
+$signatureRequest->downloadOriginalFiles($signatureToken, "./", "original3");
+
+// Download the created signed files on the filesystem:
+$signatureRequest->downloadSignedFiles($signatureToken, "./", "signed4");
+
+// Correct the email address of a receiver in the event that the email was delivered to an invalid email address
+$signatureRequest->fixReceiverEmail($receiverToken, "newemail@email.com");
+
+// Correct the mobile number of a signer in the event that the SMS was delivered to an invalid mobile number
+$signatureRequest->fixSignerPhone($receiverToken, "34666666666");
+
+// This endpoint sends an email reminder to pending receivers. It has a daily limit quota (check the docs to know the daily quota)
+$signatureRequest->sendReminders($signatureToken);
+
+// Increase the number of days to '4' in order to prevent the request from expiring and give receivers extra time to perform remaining actions.
+$signatureRequest->increaseExpirationDays($signatureToken, 4);
+
+// Void a signature that is currently in progress
+$signatureRequest->voidSignature($signatureToken);
diff --git a/lib/ilovepdf-php-master/samples/split_advanced.php b/vendor/ilovepdf/ilovepdf-php/samples/split_advanced.php
similarity index 100%
rename from lib/ilovepdf-php-master/samples/split_advanced.php
rename to vendor/ilovepdf/ilovepdf-php/samples/split_advanced.php
diff --git a/lib/ilovepdf-php-master/samples/split_advanced_merge.php b/vendor/ilovepdf/ilovepdf-php/samples/split_advanced_merge.php
similarity index 100%
rename from lib/ilovepdf-php-master/samples/split_advanced_merge.php
rename to vendor/ilovepdf/ilovepdf-php/samples/split_advanced_merge.php
diff --git a/lib/ilovepdf-php-master/samples/split_basic.php b/vendor/ilovepdf/ilovepdf-php/samples/split_basic.php
similarity index 100%
rename from lib/ilovepdf-php-master/samples/split_basic.php
rename to vendor/ilovepdf/ilovepdf-php/samples/split_basic.php
diff --git a/lib/ilovepdf-php-master/samples/try_catch_errors.php b/vendor/ilovepdf/ilovepdf-php/samples/try_catch_errors.php
similarity index 100%
rename from lib/ilovepdf-php-master/samples/try_catch_errors.php
rename to vendor/ilovepdf/ilovepdf-php/samples/try_catch_errors.php
diff --git a/lib/ilovepdf-php-master/samples/unlock_advanced.php b/vendor/ilovepdf/ilovepdf-php/samples/unlock_advanced.php
similarity index 100%
rename from lib/ilovepdf-php-master/samples/unlock_advanced.php
rename to vendor/ilovepdf/ilovepdf-php/samples/unlock_advanced.php
diff --git a/lib/ilovepdf-php-master/samples/unlock_basic.php b/vendor/ilovepdf/ilovepdf-php/samples/unlock_basic.php
similarity index 100%
rename from lib/ilovepdf-php-master/samples/unlock_basic.php
rename to vendor/ilovepdf/ilovepdf-php/samples/unlock_basic.php
diff --git a/lib/ilovepdf-php-master/samples/validatepdfa_advanced.php b/vendor/ilovepdf/ilovepdf-php/samples/validatepdfa_advanced.php
similarity index 100%
rename from lib/ilovepdf-php-master/samples/validatepdfa_advanced.php
rename to vendor/ilovepdf/ilovepdf-php/samples/validatepdfa_advanced.php
diff --git a/lib/ilovepdf-php-master/samples/validatepdfa_basic.php b/vendor/ilovepdf/ilovepdf-php/samples/validatepdfa_basic.php
similarity index 100%
rename from lib/ilovepdf-php-master/samples/validatepdfa_basic.php
rename to vendor/ilovepdf/ilovepdf-php/samples/validatepdfa_basic.php
diff --git a/lib/ilovepdf-php-master/samples/watermark_advanced.php b/vendor/ilovepdf/ilovepdf-php/samples/watermark_advanced.php
similarity index 100%
rename from lib/ilovepdf-php-master/samples/watermark_advanced.php
rename to vendor/ilovepdf/ilovepdf-php/samples/watermark_advanced.php
diff --git a/lib/ilovepdf-php-master/samples/watermark_basic.php b/vendor/ilovepdf/ilovepdf-php/samples/watermark_basic.php
similarity index 100%
rename from lib/ilovepdf-php-master/samples/watermark_basic.php
rename to vendor/ilovepdf/ilovepdf-php/samples/watermark_basic.php
diff --git a/vendor/ilovepdf/ilovepdf-php/samples/watermark_basic_image.php b/vendor/ilovepdf/ilovepdf-php/samples/watermark_basic_image.php
new file mode 100644
index 0000000..2c5353b
--- /dev/null
+++ b/vendor/ilovepdf/ilovepdf-php/samples/watermark_basic_image.php
@@ -0,0 +1,29 @@
+addFile('/path/to/file/document.pdf');
+
+$watermakImage = $myTask->addElementFile('/path/to/image/image.png');
+
+// set mode to image
+$myTask->setMode("image");
+
+// set the image
+$myTask->setImageFile($watermakImage);
+
+// process files
+$myTask->execute();
+
+// and finally download the unlocked file. If no path is set, it will be downloaded on current folder
+$myTask->download();
\ No newline at end of file
diff --git a/vendor/ilovepdf/ilovepdf-php/samples/webhook_listen.php b/vendor/ilovepdf/ilovepdf-php/samples/webhook_listen.php
new file mode 100644
index 0000000..645801c
--- /dev/null
+++ b/vendor/ilovepdf/ilovepdf-php/samples/webhook_listen.php
@@ -0,0 +1,19 @@
+setWorkerServer($_POST['server']);
+$myTask->setTask($_POST['task']);
+
+//and download the file
+$myTask->download();
\ No newline at end of file
diff --git a/vendor/ilovepdf/ilovepdf-php/samples/webhook_send.php b/vendor/ilovepdf/ilovepdf-php/samples/webhook_send.php
new file mode 100644
index 0000000..f4c9a50
--- /dev/null
+++ b/vendor/ilovepdf/ilovepdf-php/samples/webhook_send.php
@@ -0,0 +1,23 @@
+addFile('/path/to/file/document.pdf');
+
+//set the webhook that will recibe the notification once file is ready to download
+$myTask->setWebhook('http://your_url.com');
+
+
+// We don't download here because with the webhook we ordered the files must be processed in background.
+// Notification will be sent once it's ready
diff --git a/lib/ilovepdf-php-master/src/CompressTask.php b/vendor/ilovepdf/ilovepdf-php/src/CompressTask.php
similarity index 50%
rename from lib/ilovepdf-php-master/src/CompressTask.php
rename to vendor/ilovepdf/ilovepdf-php/src/CompressTask.php
index 52f5036..027deab 100644
--- a/lib/ilovepdf-php-master/src/CompressTask.php
+++ b/vendor/ilovepdf/ilovepdf-php/src/CompressTask.php
@@ -1,6 +1,7 @@
tool = 'compress';
- parent::__construct($publicKey, $secretKey, true);
+ parent::__construct($publicKey, $secretKey, $makeStart);
}
/**
- * @param $level string
+ * @param string $level
*
* values: ["extreme"|"recommended"|"low"]
* default: "recommended"
+ *
+ * @return CompressTask
*/
- public function setCompressionLevel($level)
+ public function setCompressionLevel(string $level): self
{
$this->checkValues($level, $this->compressionLevelValues);
diff --git a/vendor/ilovepdf/ilovepdf-php/src/Editpdf/Element.php b/vendor/ilovepdf/ilovepdf-php/src/Editpdf/Element.php
new file mode 100644
index 0000000..aabbfbc
--- /dev/null
+++ b/vendor/ilovepdf/ilovepdf-php/src/Editpdf/Element.php
@@ -0,0 +1,227 @@
+ 'This parameter is required',
+ 'custom' => '%message'
+ ];
+
+ /**
+ * @var string|null
+ */
+ private $type;
+
+ /**
+ * @var string|null
+ */
+ private $pages;
+
+ /**
+ * @var integer
+ */
+ private $rotation = 0;
+
+ /**
+ * @var integer
+ */
+ private $opacity = 100;
+
+ /**
+ * @var array|null
+ */
+ private $coordinates;
+
+ /**
+ * @var array
+ */
+ private $errors = [];
+
+
+ public function __construct()
+ {
+ $className = explode("\\", static::class);
+ $className = array_pop($className);
+ $className = str_replace("Element", "", $className);
+ $this->type = strtolower($className);
+ }
+
+ /**
+ * @return string|null
+ */
+ public function getType()
+ {
+ return $this->type;
+ }
+
+ /**
+ * @return string|null
+ */
+ public function getPages()
+ {
+ return $this->pages;
+ }
+
+ /**
+ * @param string $pages
+ * @return $this
+ */
+ public function setPages(string $pages)
+ {
+ $this->pages = $pages;
+ return $this;
+ }
+
+ /**
+ * @return int
+ */
+ public function getRotation()
+ {
+ return $this->rotation;
+ }
+
+ /**
+ * @param int $rotation
+ * @return $this
+ */
+ public function setRotation(int $rotation)
+ {
+ $isValid = $rotation >= 0 && $rotation <= 360;
+ if (!$isValid) {
+ throw new \InvalidArgumentException("Rotation must be an integer between 0 and 360");
+ }
+ $this->rotation = $rotation;
+ return $this;
+ }
+
+ /**
+ * @return int
+ */
+ public function getOpacity()
+ {
+ return $this->opacity;
+ }
+
+ /**
+ * @param int $opacity
+ * @return $this
+ */
+ public function setOpacity(int $opacity)
+ {
+ $isValid = $opacity >= 0 && $opacity <= 100;
+ if (!$isValid) {
+ throw new \InvalidArgumentException("Opacity must be an integer between 0 and 100");
+ }
+ $this->opacity = $opacity;
+ return $this;
+ }
+
+ /**
+ * @return array|null
+ */
+ public function getCoordinates()
+ {
+ return $this->coordinates;
+ }
+
+ /**
+ * @param float $x
+ * @param float $y
+ * @return $this
+ */
+ public function setCoordinates(float $x, float $y)
+ {
+ $isValid = $x >= 0 && $y >= 0;
+ if (!$isValid) {
+ throw new \InvalidArgumentException("x and y must be greater than 0");
+ }
+
+ $this->coordinates = ['x' => $x, 'y' => $y];
+ return $this;
+ }
+
+ /**
+ * @return TextElement
+ */
+ static public function createText()
+ {
+ $instance = new TextElement();
+ return $instance;
+ }
+
+ /**
+ * @return ImageElement
+ */
+ static public function createImage()
+ {
+ $instance = new ImageElement();
+ return $instance;
+ }
+
+ /**
+ * @return SvgElement
+ */
+ static public function createSvg()
+ {
+ $instance = new SvgElement();
+ return $instance;
+ }
+
+ /**
+ * @return bool
+ */
+ public function validate()
+ {
+ $this->errors = [];
+
+ return empty($this->errors);
+ }
+
+ /**
+ * @return array
+ */
+ public function getErrors()
+ {
+ return $this->errors;
+ }
+
+ /**
+ * @param string $attrName
+ * @param string $errorType
+ * @param array $params
+ * @return void
+ */
+ function addError(string $attrName, string $errorType, array $params = [])
+ {
+ $msg = self::VALIDATION_ERROR_MESSAGE[$errorType] ?? null;
+ if ($msg === null) throw new \InvalidArgumentException("Unknown errorType '{$errorType}'");
+ $formattedMsg = Helper::namedSprintf($msg, $params);
+
+ if (!array_key_exists($attrName, $this->errors)) $this->errors[$attrName] = [];
+
+ $this->errors[$attrName][] = $formattedMsg;
+ }
+
+ /**
+ * @return array
+ */
+ public function __toArray()
+ {
+ return [
+ 'type' => $this->type,
+ 'pages' => $this->pages,
+ 'rotation' => $this->rotation,
+ 'opacity' => $this->opacity,
+ 'coordinates' => $this->coordinates,
+ ];
+ }
+}
\ No newline at end of file
diff --git a/vendor/ilovepdf/ilovepdf-php/src/Editpdf/ImageElement.php b/vendor/ilovepdf/ilovepdf-php/src/Editpdf/ImageElement.php
new file mode 100644
index 0000000..69b3c39
--- /dev/null
+++ b/vendor/ilovepdf/ilovepdf-php/src/Editpdf/ImageElement.php
@@ -0,0 +1,55 @@
+file = $file;
+ }
+
+ /**
+ * @return bool
+ */
+ public function validate()
+ {
+ parent::validate();
+
+ if ($this->file === null) $this->addError('file', 'required');
+ if ($this->file && empty($this->file->server_filename)) {
+ $this->addError('file', 'custom', ['message' => 'server_filename not present in file']);
+ }
+
+ return empty($this->getErrors());
+ }
+
+ /**
+ * @return array
+ */
+ public function __toArray()
+ {
+ $data = array_merge(
+ parent::__toArray(),
+ [
+ 'server_filename' => $this->file ? $this->file->getServerFilename() : null,
+ 'dimensions' => $this->dimensions // From DimensionableTrait
+ ]
+ );
+ return $data;
+ }
+}
\ No newline at end of file
diff --git a/vendor/ilovepdf/ilovepdf-php/src/Editpdf/SvgElement.php b/vendor/ilovepdf/ilovepdf-php/src/Editpdf/SvgElement.php
new file mode 100644
index 0000000..82dd937
--- /dev/null
+++ b/vendor/ilovepdf/ilovepdf-php/src/Editpdf/SvgElement.php
@@ -0,0 +1,56 @@
+file = $file;
+ return $this;
+ }
+
+ /**
+ * @return bool
+ */
+ public function validate()
+ {
+ parent::validate();
+
+ if ($this->file === null) $this->addError('file', 'required');
+ if ($this->file && empty($this->file->server_filename)) {
+ $this->addError('file', 'custom', ['message' => 'server_filename not present in file']);
+ }
+
+ return empty($this->getErrors());
+ }
+
+ /**
+ * @return array
+ */
+ public function __toArray()
+ {
+ $data = array_merge(
+ parent::__toArray(),
+ [
+ 'server_filename' => $this->file ? $this->file->getServerFilename() : null,
+ 'dimensions' => $this->dimensions // From DimensionableTrait
+ ]
+ );
+ return $data;
+ }
+}
\ No newline at end of file
diff --git a/vendor/ilovepdf/ilovepdf-php/src/Editpdf/TextElement.php b/vendor/ilovepdf/ilovepdf-php/src/Editpdf/TextElement.php
new file mode 100644
index 0000000..de95313
--- /dev/null
+++ b/vendor/ilovepdf/ilovepdf-php/src/Editpdf/TextElement.php
@@ -0,0 +1,310 @@
+text;
+ }
+
+ /**
+ * @param string $text
+ * @return $this
+ */
+ public function setText(string $text): self
+ {
+ $this->text = $text;
+ return $this;
+ }
+
+ /**
+ * @return string|null
+ */
+ public function getTextAlign(): ?string
+ {
+ return $this->text_align;
+ }
+
+ /**
+ * @param string $textAlign
+ * @return $this
+ */
+ public function setTextAlign(string $textAlign): self
+ {
+ if (!in_array($textAlign, self::TEXT_ALIGN_VALUES)) {
+ throw new \InvalidArgumentException("Text align must be one of the following values: " . implode(',', self::TEXT_ALIGN_VALUES));
+ }
+ $this->text_align = $textAlign;
+ return $this;
+ }
+
+ /**
+ * @return string|null
+ */
+ public function getFontFamily(): ?string
+ {
+ return $this->font_family;
+ }
+
+ /**
+ * @param string $font_family
+ * @return $this
+ */
+ public function setFontFamily(string $font_family): self
+ {
+ if (!in_array($font_family, self::FONT_FAMILY_VALUES)) {
+ throw new \InvalidArgumentException("Font family must be one of the following values: " . implode(',', self::FONT_FAMILY_VALUES));
+ }
+ $this->font_family = $font_family;
+ return $this;
+ }
+
+ /**
+ * @return string|null
+ */
+ public function getFontColor(): ?string
+ {
+ return $this->font_color;
+ }
+
+ /**
+ * @param string $font_color
+ * @return $this
+ */
+ public function setFontColor(string $font_color): self
+ {
+ if (!Helper::isValidColor($font_color)) {
+ throw new \InvalidArgumentException("Font color must be a 6-character hex value (e.g '#ABCDEF') or 'transparent'");
+ }
+ $this->font_color = $font_color;
+ return $this;
+ }
+
+ /**
+ * @param float $font_size
+ * @return $this
+ */
+ public function setFontSize(float $font_size): self
+ {
+ $isValid = $font_size > 0;
+ if (!$isValid) {
+ throw new \InvalidArgumentException("Font size must be a float greater than 0");
+ }
+ $this->font_size = $font_size;
+ return $this;
+ }
+
+ /**
+ * @return float|null
+ */
+ public function getFontSize(): ?float
+ {
+ return $this->font_size;
+ }
+
+ /**
+ * @return $this
+ */
+ public function setBold()
+ {
+ $this->is_bold = true;
+ return $this;
+ }
+
+ /**
+ * @return $this
+ */
+ public function unsetBold()
+ {
+ $this->is_bold = false;
+ return $this;
+ }
+
+ /**
+ * @return bool
+ */
+ public function isBold()
+ {
+ return $this->is_bold;
+ }
+
+ /**
+ * @return $this
+ */
+ public function setItalic()
+ {
+ $this->is_italic = true;
+ return $this;
+ }
+
+ /**
+ * @return $this
+ */
+ public function unsetItalic()
+ {
+ $this->is_italic = false;
+ return $this;
+ }
+
+ /**
+ * @return bool
+ */
+ public function isItalic()
+ {
+ return $this->is_italic;
+ }
+
+ /**
+ * @return $this
+ */
+ public function setUnderline()
+ {
+ $this->is_underline = true;
+ return $this;
+ }
+
+ /**
+ * @return $this
+ */
+ public function unsetUnderline()
+ {
+ $this->is_underline = false;
+ return $this;
+ }
+
+ /**
+ * @return bool|null
+ */
+ public function isUnderline()
+ {
+ return $this->is_underline;
+ }
+
+ /**
+ * @return string
+ */
+ private function computeFontStyle()
+ {
+ if ($this->is_bold && $this->is_italic) {
+ return "Bold Italic";
+ } else if ($this->is_bold) {
+ return "Bold";
+ } else if ($this->is_italic) {
+ return "Italic";
+ }
+
+ return "Regular";
+ }
+
+ /**
+ * @return float|null
+ */
+ public function getLetterSpacing()
+ {
+ return $this->letter_spacing;
+ }
+
+ /**
+ * @param float $num
+ * @return $this
+ */
+ public function setLetterSpacing(float $num)
+ {
+ $isValid = $num >= -20;
+ if (!$isValid) {
+ throw new \InvalidArgumentException("Letter spacing must be a number greater or equal to 0");
+ }
+ $this->letter_spacing = $num;
+ return $this;
+ }
+
+ /**
+ * @return bool
+ */
+ public function validate()
+ {
+ $parentIsValid = parent::validate();
+
+ if ($this->text === null) $this->addError('text', 'required');
+
+ return empty($this->getErrors());
+ }
+
+ /**
+ * @return array
+ */
+ public function __toArray()
+ {
+ $data = array_merge(
+ parent::__toArray(),
+ [
+ 'text' => $this->text,
+ 'text_align' => $this->text_align,
+ 'font_family' => $this->font_family,
+ 'font_size' => $this->font_size,
+ 'font_style' => $this->computeFontStyle(),
+ 'font_color' => $this->font_color,
+ 'letter_spacing' => $this->letter_spacing,
+ 'underline_text' => $this->is_underline,
+ ]
+ );
+ return $data;
+ }
+
+}
\ No newline at end of file
diff --git a/vendor/ilovepdf/ilovepdf-php/src/Editpdf/Traits/DimensionableTrait.php b/vendor/ilovepdf/ilovepdf-php/src/Editpdf/Traits/DimensionableTrait.php
new file mode 100644
index 0000000..fbc4f01
--- /dev/null
+++ b/vendor/ilovepdf/ilovepdf-php/src/Editpdf/Traits/DimensionableTrait.php
@@ -0,0 +1,35 @@
+ 0 && $height > 0;
+ if (!$isValid) {
+ throw new \InvalidArgumentException("Width and height must be greater than 0");
+ }
+
+ $this->dimensions = ['w' => $width, 'h' => $height];
+ return $this;
+ }
+
+ /**
+ * @return mixed|null
+ */
+ public function getDimensions()
+ {
+ return $this->dimensions;
+ }
+}
\ No newline at end of file
diff --git a/vendor/ilovepdf/ilovepdf-php/src/EditpdfTask.php b/vendor/ilovepdf/ilovepdf-php/src/EditpdfTask.php
new file mode 100644
index 0000000..3566135
--- /dev/null
+++ b/vendor/ilovepdf/ilovepdf-php/src/EditpdfTask.php
@@ -0,0 +1,66 @@
+tool = 'editpdf';
+ $this->elements = [];
+ parent::__construct($publicKey, $secretKey, $makeStart);
+ }
+
+ /**
+ * adds a editpdf element
+ *
+ * @param $element
+ * @return $this
+ */
+ public function addElement(Element $element): self
+ {
+ $this->elements[] = $element;
+ return $this;
+ }
+
+ public function getElements(): array
+ {
+ return $this->elements;
+ }
+
+ public function getElementsData(): array
+ {
+ return array_map(function ($elem): array {
+ return $elem->__toArray();
+ }, $this->elements);
+ }
+
+ public function __toArray()
+ {
+ $data = array_merge(
+ parent::__toArray(),
+ ['elements' => $this->getElementsData()]
+ );
+ return $data;
+ }
+}
diff --git a/vendor/ilovepdf/ilovepdf-php/src/Element.php b/vendor/ilovepdf/ilovepdf-php/src/Element.php
new file mode 100644
index 0000000..2754420
--- /dev/null
+++ b/vendor/ilovepdf/ilovepdf-php/src/Element.php
@@ -0,0 +1,321 @@
+ $value) {
+ if (property_exists(self::class, $name)) {
+ $this->$name = $value;
+ }
+ }
+ }
+ }
+
+ /**
+ * @param string $mode
+ * @return Element
+ */
+ public function setType(string $type): self
+ {
+ $this->type = $type;
+ return $this;
+ }
+
+ /**
+ * @param string $text
+ * @return Element
+ */
+ public function setText(string $text): self
+ {
+ $this->text = $text;
+ return $this;
+ }
+
+ /**
+ * @param string $image
+ * @return Element
+ */
+ public function setImage(string $image): self
+ {
+ $this->image = $image;
+ return $this;
+ }
+
+ /**
+ * @param int $rotation
+ * @return Element
+ */
+ public function setRotation(int $rotation): self
+ {
+ $this->rotation = $rotation;
+ return $this;
+ }
+
+ /**
+ * @param string $font_family
+ * @return Element
+ */
+ public function setFontFamily(string $font_family): self
+ {
+ $this->checkValues($font_family, $this->fontFamilyValues);
+
+ $this->font_family = $font_family;
+ return $this;
+ }
+
+ /**
+ * @param string $font_style
+ * @return Element
+ */
+ public function setFontStyle(string $font_style): self
+ {
+ $this->font_style = $font_style;
+ return $this;
+ }
+
+ /**
+ * @param int $font_size
+ * @return Element
+ */
+ public function setFontSize(int $font_size): self
+ {
+ $this->font_size = $font_size;
+ return $this;
+ }
+
+ /**
+ * @param string $font_color
+ */
+ public function setFontColor(string $font_color): self
+ {
+ $this->font_color = $font_color;
+ return $this;
+ }
+
+ /**
+ * @param int $transparency
+ */
+ public function setTransparency(int $transparency): self
+ {
+ $this->transparency = $transparency;
+ return $this;
+ }
+
+
+ /**
+ * @param string $vertical_position
+ */
+ public function setVerticalPosition(string $vertical_position): self
+ {
+ $this->checkValues($vertical_position, $this->verticalPositionValues);
+
+ $this->vertical_position = $vertical_position;
+ return $this;
+ }
+
+ /**
+ * @param string $horizontal_position
+ */
+ public function setHorizontalPosition(string $horizontal_position): self
+ {
+ $this->checkValues($horizontal_position, $this->horizontalPositionValues);
+
+ $this->horizontal_position = $horizontal_position;
+ return $this;
+ }
+
+ /**
+ * @param int $vertical_position_adjustment
+ */
+ public function setVerticalPositionAdjustment(int $vertical_position_adjustment): self
+ {
+ $this->vertical_position_adjustment = $vertical_position_adjustment;
+ return $this;
+ }
+
+ /**
+ * @param int $horizontal_position_adjustment
+ */
+ public function setHorizontalPositionAdjustment($horizontal_position_adjustment): self
+ {
+ $this->horizontal_position_adjustment = $horizontal_position_adjustment;
+ return $this;
+ }
+
+ /**
+ * @param mixed $server_filename
+ * @return Element
+ */
+ public function setServerFilename(string $server_filename): self
+ {
+ $this->server_filename = $server_filename;
+ return $this;
+ }
+
+ /**
+ * @param File $file
+ * @return Element
+ */
+ public function setFile(File $file): self
+ {
+ $this->server_filename = $file->getServerFilename();
+ return $this;
+ }
+
+ /**
+ * @param mixed $value
+ * @param mixed $allowedValues
+ * @return bool
+ */
+ public function checkValues($value, $allowedValues): bool
+ {
+ if (!in_array($value, $allowedValues)) {
+ throw new \InvalidArgumentException('Invalid element value "' . $value . '". Must be one of: ' . implode(',', $allowedValues));
+ }
+
+ return true;
+ }
+}
\ No newline at end of file
diff --git a/lib/ilovepdf-php-master/src/Exceptions/AuthException.php b/vendor/ilovepdf/ilovepdf-php/src/Exceptions/AuthException.php
similarity index 100%
rename from lib/ilovepdf-php-master/src/Exceptions/AuthException.php
rename to vendor/ilovepdf/ilovepdf-php/src/Exceptions/AuthException.php
diff --git a/lib/ilovepdf-php-master/src/Exceptions/DownloadException.php b/vendor/ilovepdf/ilovepdf-php/src/Exceptions/DownloadException.php
similarity index 100%
rename from lib/ilovepdf-php-master/src/Exceptions/DownloadException.php
rename to vendor/ilovepdf/ilovepdf-php/src/Exceptions/DownloadException.php
diff --git a/vendor/ilovepdf/ilovepdf-php/src/Exceptions/ExtendedException.php b/vendor/ilovepdf/ilovepdf-php/src/Exceptions/ExtendedException.php
new file mode 100644
index 0000000..0bcac94
--- /dev/null
+++ b/vendor/ilovepdf/ilovepdf-php/src/Exceptions/ExtendedException.php
@@ -0,0 +1,84 @@
+error) && $responseBody->error->type) {
+ $this->type = $responseBody->error->type;
+ }
+ if ($responseBody && isset($responseBody->error) && isset($responseBody->error->param)) {
+ $this->params = $responseBody->error->param;
+ }
+ if ($this->params) {
+ if (is_array($this->params)) {
+ if (is_object($this->params[0])) {
+ $firstError = $this->params[0]->error; //test unlock fail
+ } else {
+ $firstError = $this->params[0];
+ }
+ } else {
+ $params = json_decode(json_encode($this->params), true);
+ $firstError = $this->getFirstErrorString($params);
+ }
+ parent::__construct($message . ' (' . $firstError . ')', $code, $previous);
+ } else {
+ if ($responseBody && $responseBody->message) {
+ $message .= ' (' . $responseBody->message . ')';
+ }
+ parent::__construct($message, $code, $previous);
+ }
+ }
+
+ private function getFirstErrorString($error){
+ if (!is_string($error)) {
+ return $this->getFirstErrorString(array_values($error)[0]);
+ }
+ return $error;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getErrors()
+ {
+ if (!is_countable($this->params)) {
+ return [];
+ }
+ return $this->params;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getType()
+ {
+ return $this->type;
+ }
+}
diff --git a/vendor/ilovepdf/ilovepdf-php/src/Exceptions/NotImplementedException.php b/vendor/ilovepdf/ilovepdf-php/src/Exceptions/NotImplementedException.php
new file mode 100644
index 0000000..a937533
--- /dev/null
+++ b/vendor/ilovepdf/ilovepdf-php/src/Exceptions/NotImplementedException.php
@@ -0,0 +1,7 @@
+tool = 'extract';
+ parent::__construct($publicKey, $secretKey, $makeStart);
+ }
+
+ /**
+ * @param boolean $detailed
+ * @return $this
+ */
+ public function setDetailed($detailed): self
+ {
+ $this->detailed = $detailed;
+ return $this;
+ }
+
+
+ /**
+ * @param bool $by_word
+ */
+ public function setByWord(bool $by_word): self
+ {
+ $this->by_word = $by_word;
+ return $this;
+ }
+}
diff --git a/vendor/ilovepdf/ilovepdf-php/src/File.php b/vendor/ilovepdf/ilovepdf-php/src/File.php
new file mode 100644
index 0000000..6cb4f14
--- /dev/null
+++ b/vendor/ilovepdf/ilovepdf-php/src/File.php
@@ -0,0 +1,172 @@
+setServerFilename($server_filename);
+ $this->setFilename($filename);
+ }
+
+ /**
+ * @return array
+ */
+ function getFileOptions(): array
+ {
+ return [
+ 'server_filename' => $this->server_filename,
+ 'filename' => $this->filename,
+ 'rotate' => $this->rotate,
+ 'password' => $this->password,
+ 'pdf_pages' => $this->pdf_pages,
+ 'pdf_page_number' => $this->pdf_page_number
+ ];
+ }
+
+
+ /**
+ * @param int $degrees [0|90|180|270]
+ * @return File
+ */
+ function setRotation(int $degrees): self
+ {
+ if ($degrees != 0 && $degrees != 90 && $degrees != 180 && $degrees != 270) {
+ throw new \InvalidArgumentException;
+ }
+ $this->rotate = $degrees;
+ return $this;
+ }
+
+ /**
+ * @param $pdf_pages
+ * @return bool
+ */
+ function setPdfPages($pdf_pages): bool
+ {
+ $this->pdf_pages = $pdf_pages;
+ return true;
+ }
+
+ /**
+ * @param $pdf_page_number
+ * @return bool
+ */
+ function setPdfPageNumber(int $pdf_page_number): bool
+ {
+ $this->pdf_page_number = $pdf_page_number;
+ return true;
+ }
+
+ /**
+ * @param string $password
+ * @return File
+ */
+ function setPassword(string $password): self
+ {
+ $this->password = $password;
+ return $this;
+ }
+
+ /**
+ * @return string
+ */
+ function getServerFilename(): ?string
+ {
+ return $this->server_filename;
+ }
+
+ /**
+ * @return array|null
+ */
+ function getSanitizedPdfPages(): ?array
+ {
+ if (is_null($this->pdf_pages)) {
+ return null;
+ }
+ return array_map(function ($pdf_page):array {
+ list($width, $height) = explode("x", $pdf_page);
+ return ["width" => $width, "height" => $height];
+ }, $this->pdf_pages);
+ }
+
+ function getLastPage(): int
+ {
+ return $this->pdf_page_number;
+ }
+
+ function getPdfPageInfo(int $pageNumber): ?\stdClass
+ {
+ $pdfPages = $this->getSanitizedPdfPages();
+ if (is_null($pdfPages)) {
+ return null;
+ }
+ return $pdfPages[$pageNumber - 1];
+ }
+
+
+ /**
+ * @param string $server_filename
+ * @return File
+ */
+ function setServerFilename(string $server_filename): self
+ {
+ if ($server_filename == '') {
+ throw new \InvalidArgumentException;
+ }
+ $this->server_filename = $server_filename;
+
+ return $this;
+ }
+
+ /**
+ * @param string $filename
+ * @return File
+ */
+ function setFilename(string $filename): self
+ {
+ if ($filename == '') {
+ throw new \InvalidArgumentException;
+ }
+ $this->filename = $filename;
+
+ return $this;
+ }
+}
diff --git a/vendor/ilovepdf/ilovepdf-php/src/HtmlpdfTask.php b/vendor/ilovepdf/ilovepdf-php/src/HtmlpdfTask.php
new file mode 100644
index 0000000..1844b20
--- /dev/null
+++ b/vendor/ilovepdf/ilovepdf-php/src/HtmlpdfTask.php
@@ -0,0 +1,202 @@
+tool = 'htmlpdf';
+ parent::__construct($publicKey, $secretKey, $makeStart);
+
+ return true;
+ }
+
+ /**
+ * @param int $view_width
+ * @return HtmlpdfTask
+ */
+ public function setViewWidth(int $view_width): self
+ {
+ $this->view_width = $view_width;
+ return $this;
+ }
+
+ /**
+ * @param int $view_height
+ * @return HtmlpdfTask
+ */
+ public function setViewHeight(int $view_height): self
+ {
+ $this->view_height = $view_height;
+ return $this;
+ }
+
+ /**
+ * @param int $navigation_timeout
+ * @return HtmlpdfTask
+ */
+ public function setNavigationTimeout(int $navigation_timeout): self
+ {
+ if ($navigation_timeout < 0 || $navigation_timeout > 20) {
+ throw new \InvalidArgumentException('Delay must be under 5 seconds');
+ }
+ $this->navigation_timeout = $navigation_timeout;
+ return $this;
+ }
+
+ /**
+ * @param int $delay
+ * @return HtmlpdfTask
+ */
+ public function setDelay(int $delay): HtmlpdfTask
+ {
+ if ($delay < 0 || $delay > 5) {
+ new \InvalidArgumentException('Delay must be under 5 seconds');
+ }
+ $this->delay = $delay;
+ return $this;
+ }
+
+ /**
+ * @param string $page_size
+ * @return HtmlpdfTask
+ */
+ public function setPageSize(string $page_size): HtmlpdfTask
+ {
+ $this->checkValues($page_size, $this->pageSizeValues);
+ $this->page_size = $page_size;
+ return $this;
+ }
+
+ /**
+ * @param string $page_orientation
+ * @return HtmlpdfTask
+ */
+ public function setPageOrientation(string $page_orientation): HtmlpdfTask
+ {
+ $this->checkValues($page_orientation, $this->pageOrientationyValues);
+
+ $this->page_orientation = $page_orientation;
+ return $this;
+ }
+
+ /**
+ * @param int $page_margin
+ * @return HtmlpdfTask
+ */
+ public function setPageMargin(int $page_margin): HtmlpdfTask
+ {
+ $this->page_margin = $page_margin;
+ return $this;
+ }
+
+ /**
+ * @param bool $remove_popups
+ * @return HtmlpdfTask
+ */
+ public function setRemovePopups(bool $remove_popups): HtmlpdfTask
+ {
+ $this->remove_popups = $remove_popups;
+ return $this;
+ }
+
+ /**
+ * @param bool $single_page
+ * @return HtmlpdfTask
+ */
+ public function setSinglePage(bool $single_page): HtmlpdfTask
+ {
+ $this->single_page = $single_page;
+ return $this;
+ }
+
+ /**
+ * Add an url to process.
+ *
+ * @param string $url
+ * @return File|mixed
+ */
+ public function addUrl($url)
+ {
+ return $this->addFileFromUrl($url);
+ }
+}
diff --git a/vendor/ilovepdf/ilovepdf-php/src/Http/Client.php b/vendor/ilovepdf/ilovepdf-php/src/Http/Client.php
new file mode 100644
index 0000000..69042c1
--- /dev/null
+++ b/vendor/ilovepdf/ilovepdf-php/src/Http/Client.php
@@ -0,0 +1,67 @@
+ self::$allowRedirects,
+ 'http_errors' => false,
+ 'verify' => self::$verify,
+ ];
+
+ $this->client = new \GuzzleHttp\Client(array_merge_recursive($defaultParams, $params));
+ }
+
+ /**
+ * @param string $method
+ * @param string $uri
+ * @param array $options
+ * @return ResponseInterface
+ * @throws \GuzzleHttp\Exception\GuzzleException
+ */
+ public function request(string $method, string $uri = '', array $options = []): ResponseInterface
+ {
+ return $this->client->request($method, $uri, $options);
+ }
+
+ /**
+ * @param bool $follow
+ * @return void
+ */
+ public static function setAllowRedirects(bool $follow): void
+ {
+ self::$allowRedirects = $follow;
+ }
+
+ /**
+ * @param bool $verify
+ */
+ public static function setVerify(bool $verify): void
+ {
+ self::$verify = $verify;
+ }
+}
\ No newline at end of file
diff --git a/vendor/ilovepdf/ilovepdf-php/src/Http/ClientException.php b/vendor/ilovepdf/ilovepdf-php/src/Http/ClientException.php
new file mode 100644
index 0000000..8d42093
--- /dev/null
+++ b/vendor/ilovepdf/ilovepdf-php/src/Http/ClientException.php
@@ -0,0 +1,7 @@
+setApiKeys($publicKey, $secretKey);
+ }
+ }
+
+ /**
+ * @return string The API secret key used for requests.
+ */
+ public function getSecretKey(): string
+ {
+ return $this->secretKey ?? '';
+ }
+
+ /**
+ * @return string The API secret key used for requests.
+ */
+ public function getPublicKey(): string
+ {
+ return $this->publicKey ?? '';
+ }
+
+ /**
+ * Sets the API key to be used for requests.
+ *
+ * @param string $publicKey
+ * @param string $secretKey
+ * @return void
+ */
+ public function setApiKeys(string $publicKey, string $secretKey): void
+ {
+ $this->publicKey = $publicKey;
+ $this->secretKey = $secretKey;
+ }
+
+ /**
+ * @return string The API version used for requests. null if we're using the
+ * latest version.
+ */
+ public static function getApiVersion(): ?string
+ {
+ return self::$apiVersion;
+ }
+
+ /**
+ * @param string $apiVersion The API version to use for requests.
+ */
+ public static function setApiVersion($apiVersion): void
+ {
+ self::$apiVersion = $apiVersion;
+ }
+
+ /**
+ * @return string The JWT to be used on api requests
+ */
+ public function getJWT()
+ {
+// if (!is_null($this->token) && !$this->getFileEncryption()) {
+// return $this->token;
+// }
+
+ // Collect all the data
+ $secret = $this->getSecretKey();
+
+ $currentTime = time();
+ $hostInfo = '';
+
+ // Merge token with presets not to miss any params in custom
+ // configuration
+ $token = array_merge([
+ 'iss' => $hostInfo,
+ 'aud' => $hostInfo,
+ 'iat' => $currentTime - $this->timeDelay,
+ 'nbf' => $currentTime - $this->timeDelay,
+ 'exp' => $currentTime + 3600 + $this->timeDelay
+ ], []);
+
+ // Set up id
+ $token['jti'] = $this->getPublicKey();
+
+ // Set encryptKey
+ if ($this->isFileEncryption() == true) {
+ $token['file_encryption_key'] = $this->getEncrytKey();
+ }
+
+ $this->token = JWT::encode($token, $secret, static::getTokenAlgorithm());
+
+ return $this->token;
+ }
+
+
+ /**
+ * @return string
+ */
+ public static function getTokenAlgorithm()
+ {
+ return 'HS256';
+ }
+
+ /**
+ * @param string $method
+ * @param string $endpoint
+ * @param array $params
+ * @param bool $start
+ *
+ * @return mixed response from server
+ *
+ * @throws AuthException
+ * @throws ProcessException
+ * @throws UploadException
+ */
+ public function sendRequest(string $method, string $endpoint, array $params = [], bool $start = false)
+ {
+ $to_server = self::getStartServer();
+ if (!$start && !is_null($this->getWorkerServer())) {
+ $to_server = $this->workerServer;
+ }
+
+ /** @psalm-suppress PossiblyNullOperand */
+ $timeout = ($endpoint == 'process' || $endpoint == 'upload' || strpos($endpoint, 'download/') === 0) ? $this->timeoutLarge : $this->timeout;
+ $requestConfig = [
+ 'connect_timeout' => $timeout,
+ 'headers' => [
+ 'Authorization' => 'Bearer ' . $this->getJWT(),
+ 'Accept' => 'application/json'
+ ],
+ ];
+
+ $requestParams = $requestConfig;
+ if ($params) {
+ $requestParams = array_merge($requestConfig, $params);
+ }
+
+ $client = new Client($params);
+ $error = null;
+
+ try {
+ /** @psalm-suppress PossiblyNullOperand */
+ $response = $client->request($method, $to_server . '/v1/' . $endpoint, $requestParams);
+ } catch (ClientException $e) {
+ $response = $e->getResponse();
+ $error = $e;
+ }
+ $responseCode = $response->getStatusCode();
+ if ($responseCode != 200 && $responseCode != 201) {
+ $responseBody = json_decode((string)$response->getBody());
+ if ($responseCode == 401) {
+ throw new AuthException($responseBody->name, $responseBody, $responseCode);
+ }
+ if ($endpoint == 'upload') {
+ if (is_string($responseBody)) {
+ throw new UploadException("Upload error", $responseBody, $responseCode);
+ }
+ throw new UploadException($responseBody->error->message, $responseBody, $responseCode);
+ } elseif ($endpoint == 'process') {
+ throw new ProcessException($responseBody->error->message, $responseBody, $responseCode);
+ } elseif (strpos($endpoint, 'download') === 0) {
+ throw new DownloadException($responseBody->error->message, $responseBody, $responseCode);
+ } elseif (strpos($endpoint, 'start') === 0) {
+ if (isset($responseBody->error) && isset($responseBody->error->type)) {
+ throw new StartException($responseBody->error->message, $responseBody, $responseCode);
+ }
+ throw new \Exception('Bad Request');
+ } else {
+ if ($response->getStatusCode() == 429) {
+ throw new \Exception('Too Many Requests');
+ }
+ if ($response->getStatusCode() == 400) {
+ //common process exception
+ if (strpos($endpoint, 'task') !== false) {
+ throw new TaskException('Invalid task id');
+ }
+ //signature exception
+ if(strpos($endpoint, 'signature') !== false){
+ throw new ProcessException($responseBody->error->type, $responseBody, $response->getStatusCode());
+ }
+
+ if (isset($responseBody->error) && isset($responseBody->error->type)) {
+ throw new \Exception($responseBody->error->message);
+ }
+ throw new \Exception('Bad Request');
+ }
+ if (isset($responseBody->error) && isset($responseBody->error->message)) {
+ throw new \Exception($responseBody->error->message);
+ }
+ throw new \Exception('Bad Request');
+ }
+ }
+
+ return $response;
+ }
+
+ /**
+ * @param string $tool Api tool to use
+ * @param bool $makeStart Set to false for chained tasks, because we don't need the start
+ *
+ * @return mixed Return implemented Task class for specified tool
+ *
+ * @throws \Exception
+ */
+ public function newTask(string $tool = '', ?bool $makeStart = true)
+ {
+ $classname = '\\Ilovepdf\\' . ucwords(strtolower($tool)) . 'Task';
+ if (!class_exists($classname)) {
+ throw new \InvalidArgumentException('Invalid tool');
+ }
+
+ if ($tool == '') {
+ $makeStart = false;
+ }
+
+ $task = new $classname($this->getPublicKey(), $this->getSecretKey(), $makeStart);
+ return $task;
+ }
+
+ /**
+ * @param string $server
+ * @return void
+ */
+ public static function setStartServer(string $server)
+ {
+ self::$startServer = $server;
+ }
+
+ /**
+ * @return string
+ */
+ public function getStartServer(): string
+ {
+ return self::$startServer;
+ }
+
+ /**
+ * @return string|null
+ */
+ public function getWorkerServer(): ?string
+ {
+ return $this->workerServer;
+ }
+
+ /**
+ * @param string|null $workerServer
+ * @return void
+ */
+ public function setWorkerServer(?string $workerServer): void
+ {
+ $this->workerServer = $workerServer;
+ }
+
+
+ /**
+ * @param bool $value
+ * @param string|null $encryptKey
+ * @return $this
+ */
+ public function setFileEncryption(?string $encryptKey = null)
+ {
+ $this->setEncryption($encryptKey == null);
+ $this->setEncryptKey($encryptKey);
+
+ return $this;
+ }
+
+ /**
+ * @param bool $enable
+ * @return void
+ */
+ public function enableEncryption(bool $enable)
+ {
+ $this->encrypted = $enable;
+ }
+
+ /**
+ * Compat, this will be removed
+ *
+ * @param bool $enable
+ * @return void
+ */
+ public function setEncryption(bool $enable): void
+ {
+ $this->enableEncryption($enable);
+ }
+
+ /**
+ * @return bool
+ */
+ public function isFileEncryption(): bool
+ {
+ return $this->encrypted;
+ }
+
+ /**
+ * @return string|null
+ */
+ public function getEncrytKey(): ?string
+ {
+ return $this->encryptKey;
+ }
+
+ /**
+ * @param string|null $encryptKey
+ * @return void
+ */
+ public function setEncryptKey(?string $encryptKey = null): void
+ {
+ if ($encryptKey == null) {
+ $encryptKey = IlovepdfTool::rand_sha1(32);
+ }
+ $len = strlen($encryptKey);
+ if ($len != 16 && $len != 24 && $len != 32) {
+ throw new \InvalidArgumentException('Encrypt key should have 16, 14 or 32 chars length');
+ }
+ $this->encryptKey = $encryptKey;
+ }
+
+ /**
+ * @param string $server
+ * @param string $taskId
+ * @return mixed
+ * @throws AuthException
+ * @throws ProcessException
+ * @throws UploadException
+ */
+ public function getStatus(string $server, string $taskId)
+ {
+ $workerServer = $this->getWorkerServer();
+ $this->setWorkerServer($server);
+ $response = $this->sendRequest('get', 'task/' . $taskId);
+ $this->setWorkerServer($workerServer);
+ return json_decode($response->getBody());
+ }
+
+ /**
+ * @param bool $verify
+ */
+ public function verifySsl(bool $verify): void
+ {
+ Client::setVerify($verify);
+ }
+
+ /**
+ * @param bool $follow
+ */
+ public function followLocation(bool $follow): void
+ {
+ Client::setAllowRedirects($follow);
+ }
+
+ /**
+ * @return object
+ * @throws AuthException
+ * @throws ProcessException
+ * @throws UploadException
+ */
+ private function getUpdatedInfo(): object
+ {
+ $data = array('v' => self::VERSION);
+ $body = ['form_params' => $data];
+ $response = self::sendRequest('get', 'info', $body);
+ $this->info = json_decode($response->getBody());
+ return $this->info;
+ }
+
+
+ /**
+ * @return object
+ */
+ public function getInfo()
+ {
+ $info = $this->getUpdatedInfo();
+ return $info;
+ }
+
+ /**
+ * @return integer
+ */
+ public function getRemainingFiles()
+ {
+ $info = $this->getUpdatedInfo();
+ return $info->remaining_files;
+ }
+}
diff --git a/lib/ilovepdf-php-master/src/IlovepdfTool.php b/vendor/ilovepdf/ilovepdf-php/src/IlovepdfTool.php
similarity index 51%
rename from lib/ilovepdf-php-master/src/IlovepdfTool.php
rename to vendor/ilovepdf/ilovepdf-php/src/IlovepdfTool.php
index 2fa71d7..6a604e0 100644
--- a/lib/ilovepdf-php-master/src/IlovepdfTool.php
+++ b/vendor/ilovepdf/ilovepdf-php/src/IlovepdfTool.php
@@ -11,20 +11,22 @@
class IlovepdfTool
{
- public static function rand_sha1($length) {
+ public static function rand_sha1(int $length): string
+ {
$max = ceil($length / 40);
$random = '';
- for ($i = 0; $i < $max; $i ++) {
- $random .= sha1(microtime(true).mt_rand(10000,90000));
+ for ($i = 0; $i < $max; $i++) {
+ $random .= sha1(microtime(true) . mt_rand(10000, 90000));
}
return substr($random, 0, $length);
}
- public static function rand_md5($length) {
+ public static function rand_md5(int $length): string
+ {
$max = ceil($length / 32);
$random = '';
- for ($i = 0; $i < $max; $i ++) {
- $random .= md5(microtime(true).mt_rand(10000,90000));
+ for ($i = 0; $i < $max; $i++) {
+ $random .= md5(microtime(true) . mt_rand(10000, 90000));
}
return substr($random, 0, $length);
}
diff --git a/lib/ilovepdf-php-master/src/ImagepdfTask.php b/vendor/ilovepdf/ilovepdf-php/src/ImagepdfTask.php
similarity index 53%
rename from lib/ilovepdf-php-master/src/ImagepdfTask.php
rename to vendor/ilovepdf/ilovepdf-php/src/ImagepdfTask.php
index 687ed2e..2b65ff7 100644
--- a/lib/ilovepdf-php-master/src/ImagepdfTask.php
+++ b/vendor/ilovepdf/ilovepdf-php/src/ImagepdfTask.php
@@ -4,52 +4,61 @@
/**
- * Class Ilovepdf
+ * Class ImagepdfTask
*
* @package Ilovepdf
*/
class ImagepdfTask extends Task
{
/**
- * @var string
+ * @var string|null
*/
public $orientation;
+ /**
+ * @var string[]
+ */
private $orientationValues = ['portrait', 'landscape'];
/**
- * @var integer
+ * @var integer|null
*/
public $margin;
/**
- * @var boolean
+ * @var bool|null
*/
public $merge_after = true;
/**
- * @var string
+ * @var string|null
*/
public $pagesize;
+ /**
+ * @var string[]
+ */
private $pagesizeValues = ['fit', 'A4', 'letter'];
/**
* CompressTask constructor.
- * @param string $publicKey
- * @param string $secretKey
+ *
+ * @param null|string $publicKey Your public key
+ * @param null|string $secretKey Your secret key
+ * @param bool $makeStart Set to false for chained tasks, because we don't need the start
*/
- function __construct($publicKey, $secretKey)
+ function __construct($publicKey, $secretKey, $makeStart = true)
{
$this->tool = 'imagepdf';
- parent::__construct($publicKey, $secretKey, true);
+ parent::__construct($publicKey, $secretKey, $makeStart);
}
/**
* @param string $orientation
+ * @return $this
*/
- public function setOrientation($orientation)
+ public function setOrientation(string $orientation): self
{
$this->checkValues($orientation, $this->orientationValues);
@@ -58,10 +67,10 @@ public function setOrientation($orientation)
}
/**
- * @param integer $margin
- * @return Task
+ * @param int $margin
+ * @return $this
*/
- public function setMargin($margin)
+ public function setMargin(int $margin): self
{
$this->margin = $margin;
return $this;
@@ -69,9 +78,9 @@ public function setMargin($margin)
/**
* @param string $pagesize
- * @return Task
+ * @return $this
*/
- public function setPagesize($pagesize)
+ public function setPagesize(string $pagesize): self
{
$this->checkValues($pagesize, $this->pagesizeValues);
$this->pagesize = $pagesize;
@@ -79,20 +88,13 @@ public function setPagesize($pagesize)
}
/**
- * @param boolean $merge_after
+ * @param bool $merge_after
+ * @return $this
*/
- public function setMergeAfter($merge_after)
+ public function setMergeAfter(bool $merge_after): self
{
$this->merge_after = $merge_after;
return $this;
}
- /**
- * @param null $processData
- * @return mixed
- */
- public function execute($processData = null)
- {
- return parent::execute(get_object_vars($this));
- }
}
diff --git a/vendor/ilovepdf/ilovepdf-php/src/Lib/Helper.php b/vendor/ilovepdf/ilovepdf-php/src/Lib/Helper.php
new file mode 100644
index 0000000..1ad8244
--- /dev/null
+++ b/vendor/ilovepdf/ilovepdf-php/src/Lib/Helper.php
@@ -0,0 +1,37 @@
+
+ * $str = 'Hello %name!';
+ * $args = array(
+ * '%name' => 'John'
+ * );
+ * $formattedString = Helper::namedSprintf($str, $args);
+ *
+ */
+ static function namedSprintf(string $str, array $args): string
+ {
+ return str_replace(array_keys($args), array_values($args), $str);
+ }
+
+ static function isValidColor(string $str): bool
+ {
+ return $str === 'transparent' || self::validateHexColor($str);
+ }
+}
\ No newline at end of file
diff --git a/vendor/ilovepdf/ilovepdf-php/src/MergeTask.php b/vendor/ilovepdf/ilovepdf-php/src/MergeTask.php
new file mode 100644
index 0000000..a5625fd
--- /dev/null
+++ b/vendor/ilovepdf/ilovepdf-php/src/MergeTask.php
@@ -0,0 +1,26 @@
+tool='merge';
+ parent::__construct($publicKey, $secretKey, $makeStart);
+ }
+}
diff --git a/vendor/ilovepdf/ilovepdf-php/src/OfficepdfTask.php b/vendor/ilovepdf/ilovepdf-php/src/OfficepdfTask.php
new file mode 100644
index 0000000..9276aaf
--- /dev/null
+++ b/vendor/ilovepdf/ilovepdf-php/src/OfficepdfTask.php
@@ -0,0 +1,25 @@
+tool = 'officepdf';
+ parent::__construct($publicKey, $secretKey, $makeStart);
+ }
+}
diff --git a/lib/ilovepdf-php-master/src/PagenumberTask.php b/vendor/ilovepdf/ilovepdf-php/src/PagenumberTask.php
similarity index 63%
rename from lib/ilovepdf-php-master/src/PagenumberTask.php
rename to vendor/ilovepdf/ilovepdf-php/src/PagenumberTask.php
index 8531315..d25910f 100644
--- a/lib/ilovepdf-php-master/src/PagenumberTask.php
+++ b/vendor/ilovepdf/ilovepdf-php/src/PagenumberTask.php
@@ -9,102 +9,115 @@
class PagenumberTask extends Task
{
/**
- * @var boolean
+ * @var bool|null
*/
public $facing_pages;
/**
- * @var boolean
+ * @var boolean|null
*/
public $first_cover;
/**
- * @var string
+ * @var string|null
*/
public $pages;
/**
- * @var integer
+ * @var integer|null
*/
public $starting_number;
/**
- * @var string
+ * @var string|null
*/
public $vertical_position;
+ /**
+ * @var string[]
+ */
private $verticalPositionValues = ['bottom', 'top'];
/**
- * @var string
+ * @var string|null
*/
public $horizontal_position;
+ /**
+ * @var string[]
+ */
private $horizontalPositionValues = ['left', 'center', 'right'];
/**
- * @var integer
+ * @var integer|null
*/
public $vertical_position_adjustment;
/**
- * @var integer
+ * @var integer|null
*/
public $horizontal_position_adjustment;
/**
- * @var string
+ * @var string|null
*/
public $font_family;
+ /**
+ * @var string[]
+ */
private $fontFamilyValues = ['Arial', 'Arial Unicode MS', 'Verdana', 'Courier', 'Times New Roman', 'Comic Sans MS', 'WenQuanYi Zen Hei', 'Lohit Marathi'];
/**
- * @var string
+ * @var string|null
*/
public $font_style;
/**
- * @var integer
+ * @var integer|null
*/
public $font_size;
/**
- * @var string
+ * @var string|null
*/
public $font_color;
/**
- * @var string
+ * @var string|null
*/
public $text;
/**
* AddnumbersTask constructor.
- * @param null $publicKey
- * @param null $secretKey
+ *
+ * @param null|string $publicKey Your public key
+ * @param null|string $secretKey Your secret key
+ * @param bool $makeStart Set to false for chained tasks, because we don't need the start
*/
- function __construct($publicKey, $secretKey)
+ function __construct($publicKey, $secretKey, $makeStart = true)
{
$this->tool = 'pagenumber';
- parent::__construct($publicKey, $secretKey, true);
+ parent::__construct($publicKey, $secretKey, $makeStart);
return true;
}
/**
- * @param boolean $facing_pages
+ * @param bool $facing_pages
+ * @return $this
*/
- public function setFacingPages($facing_pages)
+ public function setFacingPages(bool $facing_pages): self
{
$this->facing_pages = $facing_pages;
return $this;
}
/**
- * @param boolean $first_cover
+ * @param bool $first_cover
+ * @return $this
*/
- public function setFirstCover($first_cover)
+ public function setFirstCover(bool $first_cover): self
{
$this->first_cover = $first_cover;
return $this;
@@ -112,8 +125,9 @@ public function setFirstCover($first_cover)
/**
* @param string $pages
+ * @return $this
*/
- public function setPages($pages)
+ public function setPages(string $pages): self
{
$this->pages = $pages;
return $this;
@@ -121,9 +135,9 @@ public function setPages($pages)
/**
* @param int $starting_number
- * @return Task
+ * @return $this
*/
- public function setStartingNumber($starting_number)
+ public function setStartingNumber(int $starting_number): self
{
$this->starting_number = $starting_number;
return $this;
@@ -131,9 +145,9 @@ public function setStartingNumber($starting_number)
/**
* @param string $vertical_position
- * @return Task
+ * @return $this
*/
- public function setVerticalPosition($vertical_position)
+ public function setVerticalPosition(string $vertical_position): self
{
$this->checkValues($vertical_position, $this->verticalPositionValues);
@@ -143,9 +157,9 @@ public function setVerticalPosition($vertical_position)
/**
* @param string $horizontal_position
- * @return Task
+ * @return $this
*/
- public function setHorizontalPosition($horizontal_position)
+ public function setHorizontalPosition(string $horizontal_position): self
{
$this->checkValues($horizontal_position, $this->horizontalPositionValues);
@@ -165,8 +179,9 @@ public function setHorizontalPositionAdjustment($horizontal_position_adjustment)
/**
* @param int $vertical_position_adjustment
+ * @return $this
*/
- public function setVerticalPositionAdjustment($vertical_position_adjustment)
+ public function setVerticalPositionAdjustment(int $vertical_position_adjustment): self
{
$this->vertical_position_adjustment = $vertical_position_adjustment;
return $this;
@@ -174,8 +189,9 @@ public function setVerticalPositionAdjustment($vertical_position_adjustment)
/**
* @param string $font_family
+ * @return $this
*/
- public function setFontFamily($font_family)
+ public function setFontFamily(string $font_family): self
{
$this->checkValues($font_family, $this->fontFamilyValues);
@@ -183,10 +199,12 @@ public function setFontFamily($font_family)
return $this;
}
+
/**
* @param string $font_style
+ * @return $this
*/
- public function setFontStyle($font_style)
+ public function setFontStyle(string $font_style): self
{
$this->font_style = $font_style;
return $this;
@@ -194,8 +212,9 @@ public function setFontStyle($font_style)
/**
* @param int $font_size
+ * @return $this
*/
- public function setFontSize($font_size)
+ public function setFontSize(int $font_size): self
{
$this->font_size = $font_size;
return $this;
@@ -203,8 +222,9 @@ public function setFontSize($font_size)
/**
* @param string $font_color
+ * @return $this
*/
- public function setFontColor($font_color)
+ public function setFontColor(string $font_color): self
{
$this->font_color = $font_color;
return $this;
@@ -212,20 +232,11 @@ public function setFontColor($font_color)
/**
* @param string $text
+ * @return $this
*/
- public function setText($text)
+ public function setText(string $text): self
{
$this->text = $text;
return $this;
}
-
-
- /**
- * @param null $processData
- * @return mixed
- */
- public function execute($processData = null)
- {
- return parent::execute(get_object_vars($this));
- }
}
diff --git a/lib/ilovepdf-php-master/src/PdfaTask.php b/vendor/ilovepdf/ilovepdf-php/src/PdfaTask.php
similarity index 54%
rename from lib/ilovepdf-php-master/src/PdfaTask.php
rename to vendor/ilovepdf/ilovepdf-php/src/PdfaTask.php
index 13d5934..c64ef81 100644
--- a/lib/ilovepdf-php-master/src/PdfaTask.php
+++ b/vendor/ilovepdf/ilovepdf-php/src/PdfaTask.php
@@ -2,7 +2,7 @@
namespace Ilovepdf;
/**
- * Class CompressTask
+ * Class PdfaTask
*
* @package Ilovepdf
*/
@@ -13,30 +13,34 @@ class PdfaTask extends Task
*/
public $conformance = "pdfa-2b";
-
/**
* @var boolean
*/
public $allow_downgrade = true;
+ /**
+ * @var string[]
+ */
private $conformanceValues = ['pdfa-1b', 'pdfa-1a', 'pdfa-2b', 'pdfa-2u', 'pdfa-2a', 'pdfa-3b', 'pdfa-3u', 'pdfa-3a'];
/**
* CompressTask constructor.
- * @param string $publicKey
- * @param string $secretKey
+ *
+ * @param null|string $publicKey Your public key
+ * @param null|string $secretKey Your secret key
+ * @param bool $makeStart Set to false for chained tasks, because we don't need the start
*/
- function __construct($publicKey, $secretKey)
+ function __construct($publicKey, $secretKey, $makeStart = true)
{
$this->tool = 'pdfa';
- parent::__construct($publicKey, $secretKey, true);
+ parent::__construct($publicKey, $secretKey, $makeStart);
}
/**
* @param string $conformance
- * @return Task
+ * @return $this
*/
- public function setConformance($conformance)
+ public function setConformance($conformance): self
{
$this->checkValues($conformance, $this->conformanceValues);
@@ -44,20 +48,14 @@ public function setConformance($conformance)
return $this;
}
- /**
- * @param null $processData
- * @return mixed
- */
- public function execute($processData = null)
- {
- return parent::execute(get_object_vars($this));
- }
/**
- * @param boolean $allowDowngrade
+ * @param bool $allowDowngrade
+ * @return $this
*/
- public function setAllowDowngrade($allowDowngrade)
+ public function setAllowDowngrade(bool $allowDowngrade): self
{
$this->allow_downgrade = $allowDowngrade;
+ return $this;
}
}
diff --git a/vendor/ilovepdf/ilovepdf-php/src/PdfjpgTask.php b/vendor/ilovepdf/ilovepdf-php/src/PdfjpgTask.php
new file mode 100644
index 0000000..9849149
--- /dev/null
+++ b/vendor/ilovepdf/ilovepdf-php/src/PdfjpgTask.php
@@ -0,0 +1,64 @@
+tool = 'pdfjpg';
+ parent::__construct($publicKey, $secretKey, $makeStart);
+ }
+
+ /**
+ * Set the process mode: convert each page to image or extract all images in pdf
+ *
+ * @param string $mode values:["pages"|"extract"] default: "pages"
+ * @return $this
+ */
+ public function setMode($mode): self
+ {
+ if($mode!="pages" && $mode!="extract"){
+ throw new \InvalidArgumentException();
+ }
+ $this->pdfjpg_mode = $mode;
+
+ return $this;
+ }
+
+ /**
+ * Set image quality for output
+ *
+ * @param int $dpi
+ * @return $this
+ */
+ public function setDpi(int $dpi): self
+ {
+ if($dpi<24 || $dpi>500){
+ throw new \InvalidArgumentException('Invalid dpi value');
+ }
+ $this->dpi = $dpi;
+ return $this;
+ }
+}
diff --git a/vendor/ilovepdf/ilovepdf-php/src/ProtectTask.php b/vendor/ilovepdf/ilovepdf-php/src/ProtectTask.php
new file mode 100644
index 0000000..74a0f2e
--- /dev/null
+++ b/vendor/ilovepdf/ilovepdf-php/src/ProtectTask.php
@@ -0,0 +1,39 @@
+tool = 'protect';
+ parent::__construct($publicKey, $secretKey, $makeStart);
+ }
+
+ /**
+ * @param string $password
+ * @return $this
+ */
+ public function setPassword(string $password): self
+ {
+ $this->password = $password;
+ return $this;
+ }
+}
diff --git a/vendor/ilovepdf/ilovepdf-php/src/RepairTask.php b/vendor/ilovepdf/ilovepdf-php/src/RepairTask.php
new file mode 100644
index 0000000..49d9ad3
--- /dev/null
+++ b/vendor/ilovepdf/ilovepdf-php/src/RepairTask.php
@@ -0,0 +1,24 @@
+tool = 'repair';
+ parent::__construct($publicKey, $secretKey, $makeStart);
+ }
+}
diff --git a/vendor/ilovepdf/ilovepdf-php/src/RotateTask.php b/vendor/ilovepdf/ilovepdf-php/src/RotateTask.php
new file mode 100644
index 0000000..92a6adb
--- /dev/null
+++ b/vendor/ilovepdf/ilovepdf-php/src/RotateTask.php
@@ -0,0 +1,26 @@
+tool = 'rotate';
+ parent::__construct($publicKey, $secretKey, $makeStart);
+ }
+}
diff --git a/vendor/ilovepdf/ilovepdf-php/src/Sign/Elements/ElementAbstract.php b/vendor/ilovepdf/ilovepdf-php/src/Sign/Elements/ElementAbstract.php
new file mode 100644
index 0000000..c5e1075
--- /dev/null
+++ b/vendor/ilovepdf/ilovepdf-php/src/Sign/Elements/ElementAbstract.php
@@ -0,0 +1,178 @@
+ null, 'y' => null];
+
+ /**
+ * @var string
+ */
+ public $pages;
+
+ /**
+ * @var integer
+ */
+ public $size = 18;
+
+ /**
+ * @var
+ */
+ public $content;
+
+ /**
+ * @var
+ */
+ public $info;
+
+ /**
+ * @return string
+ */
+ public function getType(): string
+ {
+ return $this->type;
+ }
+
+ /**
+ * @param string $type
+ * @return ElementAbstract
+ */
+ protected function setType(string $type)
+ {
+ $this->type = $type;
+ return $this;
+ }
+
+ public function getInfo(){
+ if(!is_null($this->info) && !empty($this->info)){
+ return json_encode($this->info);
+ }
+ return $this->info;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getPosition()
+ {
+ return $this->position;
+ }
+
+ /**
+ * @param string $position
+ * @return ElementAbstract
+ */
+ public function setPosition(float $x, float $y)
+ {
+ if($y > 0){
+ throw new \InvalidArgumentException("Invalid Y value: it must be a number lower or equal to 0");
+ }
+
+ if($x < 0){
+ throw new \InvalidArgumentException("Invalid X value: it must be a number greater or equal to 0");
+ }
+
+ $this->position = ['x' => $x, 'y' => $y];
+ return $this;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getPages()
+ {
+ return $this->pages;
+ }
+
+ /**
+ * @param mixed $pages
+ * @return ElementAbstract
+ */
+ public function setPages($pages)
+ {
+ $pages = array_map(function($page){
+ if(strpos($page,'-')){
+ list($firstpage,$lastpage) = explode("-",$page);
+ $firstpage = intval($firstpage);
+ $lastpage = intval($lastpage);
+ if($firstpage <=0 || $lastpage <=0 || ($lastpage < $firstpage)){
+ throw new \InvalidArgumentException("Invalid page range '{$page}'");
+ }
+
+ $page = ($firstpage == $lastpage) ? $firstpage : "{$firstpage}-{$lastpage}";
+ }else{
+ if(intval($page) <=0){
+ throw new \InvalidArgumentException("Invalid page '{$page}': it should be a value greater than 0");
+ }
+ $page = intval($page);
+ }
+ return $page;
+ },explode(",",$pages));
+ $this->pages = implode(',',$pages);
+ return $this;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getSize()
+ {
+ return $this->size;
+ }
+
+ /**
+ * @param mixed $size
+ * @return ElementAbstract
+ */
+ public function setSize(int $size)
+ {
+ if($size <= 0){
+ throw new \InvalidArgumentException("Invalid size: must be a number greater than 0");
+ }
+ $this->size = $size;
+ return $this;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getContent(): ?string
+ {
+ return $this->content;
+ }
+
+ /**
+ * @param mixed $content
+ * @return ElementAbstract
+ */
+ protected function setContent(string $content)
+ {
+ $this->content = $content;
+ return $this;
+ }
+
+ public function __toArray(): array
+ {
+ $pos = $this->getPosition();
+ $pos = trim($pos['x'] . ' ' . $pos['y']);
+ return [
+ 'type' => $this->getType(),
+ 'position' => $pos,
+ 'pages' => $this->getPages(),
+ 'size' => $this->getSize(),
+ 'content' => $this->getContent(),
+ 'info' => $this->getInfo()
+ ];
+ }
+}
\ No newline at end of file
diff --git a/vendor/ilovepdf/ilovepdf-php/src/Sign/Elements/ElementDate.php b/vendor/ilovepdf/ilovepdf-php/src/Sign/Elements/ElementDate.php
new file mode 100644
index 0000000..9b6c7d8
--- /dev/null
+++ b/vendor/ilovepdf/ilovepdf-php/src/Sign/Elements/ElementDate.php
@@ -0,0 +1,25 @@
+setType("date");
+ $this->setContent("Y-m-d");
+ }
+
+ public function setContent(string $content)
+ {
+ if (!in_array($content, $this->dateFormats)) {
+ throw new \InvalidArgumentException("invalid date format, formats must be one of the following: " . implode(",",$this->dateFormats));
+ }
+
+ $this->content = $content;
+ return $this;
+ }
+}
\ No newline at end of file
diff --git a/vendor/ilovepdf/ilovepdf-php/src/Sign/Elements/ElementInitials.php b/vendor/ilovepdf/ilovepdf-php/src/Sign/Elements/ElementInitials.php
new file mode 100644
index 0000000..5c0db81
--- /dev/null
+++ b/vendor/ilovepdf/ilovepdf-php/src/Sign/Elements/ElementInitials.php
@@ -0,0 +1,17 @@
+setType("initials");
+ }
+}
\ No newline at end of file
diff --git a/vendor/ilovepdf/ilovepdf-php/src/Sign/Elements/ElementInput.php b/vendor/ilovepdf/ilovepdf-php/src/Sign/Elements/ElementInput.php
new file mode 100644
index 0000000..6d7ddf7
--- /dev/null
+++ b/vendor/ilovepdf/ilovepdf-php/src/Sign/Elements/ElementInput.php
@@ -0,0 +1,27 @@
+ "input text","description" => null];
+
+ public function __construct()
+ {
+ $this->setType("input");
+ }
+
+ public function setLabel(string $text){
+ $this->info["label"] = $text;
+ return $this;
+ }
+
+ public function setText(string $text){
+ $this->info["description"] = $text;
+ return $this;
+ }
+}
\ No newline at end of file
diff --git a/vendor/ilovepdf/ilovepdf-php/src/Sign/Elements/ElementName.php b/vendor/ilovepdf/ilovepdf-php/src/Sign/Elements/ElementName.php
new file mode 100644
index 0000000..b0d577b
--- /dev/null
+++ b/vendor/ilovepdf/ilovepdf-php/src/Sign/Elements/ElementName.php
@@ -0,0 +1,12 @@
+setType("name");
+ }
+}
\ No newline at end of file
diff --git a/vendor/ilovepdf/ilovepdf-php/src/Sign/Elements/ElementSignature.php b/vendor/ilovepdf/ilovepdf-php/src/Sign/Elements/ElementSignature.php
new file mode 100644
index 0000000..8450cc8
--- /dev/null
+++ b/vendor/ilovepdf/ilovepdf-php/src/Sign/Elements/ElementSignature.php
@@ -0,0 +1,18 @@
+setType("signature");
+ }
+
+}
\ No newline at end of file
diff --git a/vendor/ilovepdf/ilovepdf-php/src/Sign/Elements/ElementText.php b/vendor/ilovepdf/ilovepdf-php/src/Sign/Elements/ElementText.php
new file mode 100644
index 0000000..03d1ddf
--- /dev/null
+++ b/vendor/ilovepdf/ilovepdf-php/src/Sign/Elements/ElementText.php
@@ -0,0 +1,19 @@
+setType("text");
+ $this->setText("text");
+ }
+
+ public function setText(string $text){
+ $this->setContent($text);
+ return $this;
+ }
+
+}
\ No newline at end of file
diff --git a/vendor/ilovepdf/ilovepdf-php/src/Sign/Receivers/ReceiverAbstract.php b/vendor/ilovepdf/ilovepdf-php/src/Sign/Receivers/ReceiverAbstract.php
new file mode 100644
index 0000000..6cfd73a
--- /dev/null
+++ b/vendor/ilovepdf/ilovepdf-php/src/Sign/Receivers/ReceiverAbstract.php
@@ -0,0 +1,99 @@
+setName($name);
+ $this->setEmail($email);
+ }
+
+ /**
+ * @return string
+ */
+ public function getName(): string
+ {
+ return $this->name;
+ }
+
+ /**
+ * @param mixed $name
+ * @return Signer
+ */
+ public function setName($name): ReceiverAbstract
+ {
+ $this->name = $name;
+ return $this;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getEmail(): string
+ {
+ return $this->email;
+ }
+
+ /**
+ * @param mixed $email
+ * @return Signer
+ */
+ public function setEmail($email): ReceiverAbstract
+ {
+ $this->email = $email;
+ return $this;
+ }
+
+ /**
+ * @return string
+ */
+ public function getType(): string
+ {
+ return $this->type;
+ }
+
+ /**
+ * @param string $type
+ * @return Signer
+ */
+ protected function setType(string $type): ReceiverAbstract
+ {
+ $this->type = $type;
+ return $this;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getAccessCode()
+ {
+ return $this->access_code;
+ }
+
+ /**
+ * @param mixed $access_code
+ * @return ReceiverAbstract
+ */
+ public function setAccessCode($access_code): ReceiverAbstract
+ {
+ $this->access_code = $access_code;
+ return $this;
+ }
+
+ public function __toArray()
+ {
+ return [
+ 'name' => $this->getName(),
+ 'email' => $this->getEmail(),
+ 'type' => $this->getType(),
+ 'access_code' => $this->getAccessCode()
+ ];
+ }
+}
\ No newline at end of file
diff --git a/vendor/ilovepdf/ilovepdf-php/src/Sign/Receivers/Signer.php b/vendor/ilovepdf/ilovepdf-php/src/Sign/Receivers/Signer.php
new file mode 100644
index 0000000..eba9c43
--- /dev/null
+++ b/vendor/ilovepdf/ilovepdf-php/src/Sign/Receivers/Signer.php
@@ -0,0 +1,105 @@
+setType("signer");
+ parent::__construct($name,$email);
+ }
+
+ /**
+ * @param File $file
+ * @param ElementAbstract|ElementAbstract[]
+ *
+ * @return Signer
+ */
+ public function addElements(File $file, $elements) : Signer {
+ $serverFilename = $file->getServerFilename();
+ if(!is_array($elements)){
+ $elements = [$elements];
+ }
+
+ if(!array_key_exists($serverFilename, $this->_elements)){
+ $this->_elements[$serverFilename] = ['file' => $file, 'elements' => []];
+ }
+
+ foreach($elements as $elem){
+ array_push($this->_elements[$serverFilename]['elements'], $elem);
+ }
+ return $this;
+ }
+
+ /**
+ * @return string
+ */
+ public function getForceSignatureType(): ?string
+ {
+ return $this->force_signature_type;
+ }
+
+ /**
+ * @param string $force_signature_type
+ * @return Signer
+ */
+ public function setForceSignatureType(string $force_signature_type): Signer
+ {
+ if(!in_array($force_signature_type,$this->valid_force_signature_types)){
+ throw new \InvalidArgumentException("Invalid force_signature_type: {$force_signature_type}, valid arguments are: ".$this->valid_force_signature_types);
+ }
+ $this->force_signature_type = $force_signature_type;
+ return $this;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getPhone(): ?string
+ {
+ return $this->phone;
+ }
+
+ /**
+ * @param mixed $phone
+ * @return Signer
+ */
+ public function setPhone($phone): Signer
+ {
+ $this->phone = $phone;
+ return $this;
+ }
+
+ public function __toArray()
+ {
+ $array = parent::__toArray();
+ $array["force_signature_type"] = $this->getForceSignatureType();
+ $array["access_code"] = $this->getAccessCode();
+ $array["phone"] = $this->getPhone();
+ $array['files'] = $this->getFilesData();
+ return $array;
+ }
+
+ private function getFilesData(){
+ $output = [];
+ foreach($this->_elements as $serverFilename => $item){
+ $elementsData = [];
+ foreach($item['elements'] as $singleElement){
+ $elementsData[] = $singleElement->__toArray();
+ }
+ $output[] = ['server_filename' => $serverFilename, 'elements' => $elementsData];
+ }
+ return $output;
+ }
+}
\ No newline at end of file
diff --git a/vendor/ilovepdf/ilovepdf-php/src/Sign/Receivers/Validator.php b/vendor/ilovepdf/ilovepdf-php/src/Sign/Receivers/Validator.php
new file mode 100644
index 0000000..8168dc2
--- /dev/null
+++ b/vendor/ilovepdf/ilovepdf-php/src/Sign/Receivers/Validator.php
@@ -0,0 +1,14 @@
+setType("validator");
+ parent::__construct($name,$email);
+ }
+}
\ No newline at end of file
diff --git a/vendor/ilovepdf/ilovepdf-php/src/Sign/Receivers/Witness.php b/vendor/ilovepdf/ilovepdf-php/src/Sign/Receivers/Witness.php
new file mode 100644
index 0000000..cf9925a
--- /dev/null
+++ b/vendor/ilovepdf/ilovepdf-php/src/Sign/Receivers/Witness.php
@@ -0,0 +1,14 @@
+setType("viewer");
+ parent::__construct($name,$email);
+ }
+}
\ No newline at end of file
diff --git a/vendor/ilovepdf/ilovepdf-php/src/SignTask.php b/vendor/ilovepdf/ilovepdf-php/src/SignTask.php
new file mode 100644
index 0000000..d0859f2
--- /dev/null
+++ b/vendor/ilovepdf/ilovepdf-php/src/SignTask.php
@@ -0,0 +1,374 @@
+tool = 'sign';
+ parent::__construct($publicKey, $secretKey, $makeStart);
+ }
+
+ function addReceiver(ReceiverAbstract $signer)
+ {
+ $this->signers[] = $signer;
+ return $this;
+ }
+
+ protected function getFileData(string $task){
+ $data = parent::getFileData($task);
+ $data["pdfinfo"] = "1";
+ return $data;
+ }
+
+ protected function getFileFromResponse($response,$filepath){
+ $isPdfFile = substr($filepath, -strlen(".pdf"))=== ".pdf";
+
+ if($isPdfFile){
+ $file = new File($response->body->server_filename, basename($filepath));
+ $file->setPdfPages($response->body->pdf_pages);
+ $file->setPdfPageNumber(intval($response->body->pdf_page_number));
+ return $file;
+ }
+ return parent::getFileFromResponse($response, $filepath);
+ }
+
+ /**
+ * @return string
+ */
+ public function getVerifySignatureVerification(): bool
+ {
+ return $this->verify_enabled;
+ }
+
+ /**
+ * @param bool $verification
+ */
+ public function setVerifySignatureVerification(bool $verification): SignTask
+ {
+ $this->verify_enabled = $verification;
+ return $this;
+ }
+
+ /**
+ * @return string
+ */
+ public function getMessage(): string
+ {
+ return $this->message_signer;
+ }
+
+ /**
+ * @param string $subject
+ */
+ public function setMessage(string $message): SignTask
+ {
+ $this->message_signer = $message;
+ return $this;
+ }
+
+ /**
+ * @return string
+ */
+ public function getSubject(): string
+ {
+ return $this->subject_signer;
+ }
+
+ /**
+ * @param string $subject
+ */
+ public function setSubject(string $subject): SignTask
+ {
+ $this->subject_signer = $subject;
+ return $this;
+ }
+
+ public function getReminders(): int
+ {
+ return $this->reminders;
+ }
+
+ /**
+ * @param int $days_between
+ */
+ public function setReminders(int $days_between): SignTask
+ {
+ $this->reminders = $days_between;
+ return $this;
+ }
+
+ /**
+ * @return int
+ */
+ public function getLockOrder(): int
+ {
+ return intval($this->lock_order);
+ }
+
+ /**
+ * @param int $lock_order
+ * @return SignTask
+ */
+ public function setLockOrder(bool $lock_order): SignTask
+ {
+ $this->lock_order = intval($lock_order);
+ return $this;
+ }
+
+ /**
+ * @return int
+ */
+ public function getExpirationDays(): int
+ {
+ return $this->expiration_days;
+ }
+
+ /**
+ * @param int $expiration_date
+ * @return SignTask
+ */
+ public function setExpirationDays(int $expiration_days): SignTask
+ {
+ $this->expiration_days = $expiration_days;
+ return $this;
+ }
+
+ /**
+ * @param string $brandName
+ * @param string $brandLogo
+ * @return SignTask
+ */
+ function setBrand(string $brand_name, string $brandLogoPath){
+ $brand_logo =$this->uploadBrandLogo($brandLogoPath);
+ $this->brand_name = $brand_name;
+ $this->brand_logo = $brand_logo->server_filename;
+ return $this;
+ }
+
+ /**
+ * @return string
+ */
+ public function getLanguage(): string
+ {
+ return $this->language;
+ }
+
+ /**
+ * @param string $language
+ * @return SignTask
+ */
+ public function setLanguage(string $language): SignTask
+ {
+ $this->language = $language;
+ return $this;
+ }
+
+ /**
+ * @return array
+ */
+ public function getSigners(): array
+ {
+ return $this->signers;
+ }
+
+ /**
+ * @param array $signers
+ * @return SignTask
+ */
+ public function setSigners(array $signers): SignTask
+ {
+ $this->signers = $signers;
+ return $this;
+ }
+
+ public function getSignersData(): array
+ {
+ $data = [];
+ foreach ($this->getSigners() as $signer) {
+ $data[] = $signer->__toArray();
+ }
+ return $data;
+ }
+
+ /**
+ * @return Bool
+ */
+ public function getUuidVisible(): bool
+ {
+ return $this->uuid_visible;
+ }
+
+ /**
+ * @param boolean $uuid_visible
+ * @return SignTask
+ */
+ public function setUuidVisible(bool $uuid_visible): SignTask
+ {
+ $this->uuid_visible = $uuid_visible;
+ return $this;
+ }
+
+ public function __toArray()
+ {
+ $signTaskData = parent::__toArray();
+ if(isset($signTaskData["reminders"]) && $signTaskData["reminders"] > 0){
+ $signTaskData["signer_reminders"] = true;
+ $signTaskData["signer_reminder_days_cycle"] = $signTaskData["reminders"];
+ unset($signTaskData["reminders"]);
+ }
+ $data = array_merge(
+ $signTaskData,
+ array('signers' => $this->getSignersData())
+ );
+ return $data;
+ }
+
+ /**
+ * @param string $filePath
+ * @return File
+ */
+ public function uploadBrandLogo($filePath)
+ {
+ $file = parent::addFile($filePath);
+ if (($key = array_search($file, $this->files)) !== false) {
+ unset($this->files[$key]);
+ }
+ return $file;
+ }
+
+ /**
+ * @return Task
+ * @throws Exceptions\AuthException
+ * @throws Exceptions\ProcessException
+ * @throws Exceptions\UploadException
+ */
+ public function execute()
+ {
+ if($this->task===null){
+ throw new \Exception('Current task not exists');
+ }
+
+ $data = $this->__toArray();
+
+ //clean unwanted vars to be sent
+ unset($data['timeoutLarge']);
+ unset($data['timeout']);
+ unset($data['timeDelay']);
+
+ $body = ['form_params' => $data];
+
+ //$response = parent::sendRequest('post', 'signature', http_build_query($body, null, '&', PHP_QUERY_RFC3986));
+ $response = parent::sendRequest('post', 'signature', $body,false);
+ try {
+ $this->result = json_decode($response->getBody());
+ }
+ catch(\Exception $e){
+ throw new ProcessException('Bad request');
+ }
+ return $this;
+ }
+
+ /**
+ * @param null|string $path
+ * @param null|string $file
+ */
+ public function download($path = null){
+ throw new NotImplementedException("This API call is not available for a SignTask");
+ }
+
+
+ /**
+ * @param bool $enable
+ * @return void
+ */
+ public function enableEncryption(bool $enable)
+ {
+ throw new NotImplementedException("This method is not available for a SignTask");
+ }
+
+ /**
+ * @param string|null $encryptKey
+ * @return Task
+ */
+ public function setFileEncryption(?string $encryptKey = null): Task
+ {
+ throw new NotImplementedException("This method is not available for a SignTask");
+ }
+}
diff --git a/vendor/ilovepdf/ilovepdf-php/src/SignatureManagement.php b/vendor/ilovepdf/ilovepdf-php/src/SignatureManagement.php
new file mode 100644
index 0000000..930a1da
--- /dev/null
+++ b/vendor/ilovepdf/ilovepdf-php/src/SignatureManagement.php
@@ -0,0 +1,204 @@
+ $page,
+ "per-page" => $per_page
+ ];
+ $response = parent::sendRequest("get", "signature/list", $data);
+ $headers = $response->headers;
+ $return = [
+ "signatures" => $response->body,
+ "pagination" => [
+ 'totalCount' => $headers && isset($headers['X-Pagination-Total-Count']) ? $headers['X-Pagination-Total-Count'] : '',
+ 'page' => $headers && isset($headers['X-Pagination-Current-Page']) ? $headers['X-Pagination-Current-Page'] - 1 : '',
+ 'pageSize' => $headers && isset($headers['X-Pagination-Per-Page']) ? $headers['X-Pagination-Per-Page'] : ''
+ ]
+ ];
+ return $return;
+ }
+
+ /**
+ * @param string $signatureId
+ *
+ * @return stdClass
+ */
+ public function getSignatureStatus(string $signatureId): stdClass
+ {
+ return parent::sendRequest("get", "signature/requesterview/{$signatureId}")->body;
+ }
+
+ /**
+ * @param string $signatureId
+ * @param string $pathToSave
+ * @param string $filename
+ *
+ * @return bool
+ */
+ public function downloadAuditFile(string $signatureId, string $pathToSave, string $filename): bool
+ {
+ $response = parent::sendRequest("get", "signature/{$signatureId}/download-audit");
+ return $this->downloadResponseToFile($response, $pathToSave, $filename);
+ }
+
+ /**
+ * @param string $signatureId
+ * @param string $pathToSave
+ * @param string $filename
+ *
+ * @return string
+ */
+ public function downloadOriginalFiles(string $signatureId, string $pathToSave, string $filename): string
+ {
+ $response = parent::sendRequest("get", "signature/{$signatureId}/download-original");
+ return $this->downloadResponseToFile($response, $pathToSave, $filename);
+ }
+
+ /**
+ * @param string $signatureId
+ * @param string $pathToSave
+ * @param string $filename
+ *
+ * @return string
+ */
+ public function downloadSignedFiles(string $signatureId, string $pathToSave, string $filename): string
+ {
+ $response = parent::sendRequest("get", "signature/{$signatureId}/download-signed");
+ return $this->downloadResponseToFile($response, $pathToSave, $filename);
+ }
+
+ /**
+ * @param string $receiverTokenRequester
+ * @param string $newEmail
+ *
+ * @return bool
+ */
+ public function fixReceiverEmail(string $receiverTokenRequester, string $newEmail): bool
+ {
+ $body = [
+ "email" => $newEmail
+ ];
+ $response = parent::sendRequest("put", "signature/signer/fix-email/{$receiverTokenRequester}", $body, false, true);
+ //if above fails, it throws an exception
+ return true;
+ }
+
+ /**
+ * @param string $signerTokenRequester
+ * @param string $newPhone
+ *
+ * @return bool
+ */
+ public function fixSignerPhone(string $signerTokenRequester, string $newPhone): bool
+ {
+ $body = [
+ "phone" => $newPhone
+ ];
+ $response = parent::sendRequest("put", "signature/signer/fix-phone/{$signerTokenRequester}", $body, false, true);
+ //if above fails, it throws an exception
+ return true;
+ }
+
+ /**
+ * @param string $signatureId
+ *
+ * @return bool
+ */
+ public function sendReminders(string $signatureId): bool
+ {
+ $body = [];
+ $response = parent::sendRequest("post", "signature/sendReminder/{$signatureId}", $body, false, true);
+ //if above fails, it throws an exception
+ return true;
+ }
+
+ /**
+ * @param string $signatureId
+ *
+ * @return bool
+ */
+ public function voidSignature(string $signatureId): bool
+ {
+ $body = [];
+ $response = parent::sendRequest("put", "signature/void/{$signatureId}", $body, false, true);
+ //if above fails, it throws an exception
+ return true;
+ }
+
+ /**
+ * @param string $signatureId
+ * @param int $amountOfDays
+ *
+ * @return bool
+ */
+ public function increaseExpirationDays(string $signatureId, int $amountOfDays): bool
+ {
+ $body = [
+ "days" => $amountOfDays
+ ];
+ $response = parent::sendRequest("put", "signature/void/{$signatureId}", $body, false, true);
+ //if above fails, it throws an exception
+ return true;
+ }
+
+ /**
+ * @param string $receiverTokenRequester
+ *
+ * @return stdClass
+ */
+ public function getReceiverInfo(string $receiverTokenRequester): stdClass
+ {
+ return parent::sendRequest("get", "signature/receiver/info/{$receiverTokenRequester}")->body;
+ }
+
+ /**
+ * @param string $tool Api tool to use
+ * @param bool $makeStart Set to false for chained tasks, because we don't need the start
+ *
+ * @return mixed Return implemented Task class for specified tool
+ *
+ * @throws \Exception
+ */
+ public function newTask($tool = '', $makeStart = true)
+ {
+ throw new \Exception("This class is not meant to create a new task; but to manage an existing SignTask");
+ }
+
+ private function getExtensionFromMime(string $mime_type)
+ {
+ return explode("/", $mime_type)[1];
+ }
+
+ protected function downloadResponseToFile($response, string $pathToSave, string $filename): string
+ {
+ if (!is_dir($pathToSave)) {
+ throw new \Exception("{$pathToSave} is not a directory");
+ }
+ $mime_type = $response->headers["Content-Type"];
+ $filePath = "{$pathToSave}/{$filename}." . $this->getExtensionFromMime($mime_type);
+ if (!file_put_contents($filePath, $response->raw_body)) {
+ throw new DownloadException("Download success, but could not save the contents of the file to {$filePath}. Check permissions of the directory", 1, null, $response);
+ }
+ return $filePath;
+ }
+}
diff --git a/lib/ilovepdf-php-master/src/SplitTask.php b/vendor/ilovepdf/ilovepdf-php/src/SplitTask.php
similarity index 55%
rename from lib/ilovepdf-php-master/src/SplitTask.php
rename to vendor/ilovepdf/ilovepdf-php/src/SplitTask.php
index 7aa9a88..fdba65a 100644
--- a/lib/ilovepdf-php-master/src/SplitTask.php
+++ b/vendor/ilovepdf/ilovepdf-php/src/SplitTask.php
@@ -11,22 +11,22 @@
class SplitTask extends Task
{
/**
- * @var string
+ * @var string|null
*/
public $ranges;
/**
- * @var string
+ * @var string|null
*/
public $split_mode;
/**
- * @var integer
+ * @var integer|null
*/
public $fixed_range;
/**
- * @var string
+ * @var string|null
*/
public $remove_pages;
@@ -38,20 +38,22 @@ class SplitTask extends Task
/**
* SplitTask constructor.
- * @param string $publicKey
- * @param string $secretKey
+ *
+ * @param null|string $publicKey Your public key
+ * @param null|string $secretKey Your secret key
+ * @param bool $makeStart Set to false for chained tasks, because we don't need the start
*/
- function __construct($publicKey, $secretKey)
+ function __construct($publicKey, $secretKey, $makeStart = true)
{
$this->tool = 'split';
- parent::__construct($publicKey, $secretKey, true);
+ parent::__construct($publicKey, $secretKey, $makeStart);
}
/**
* @param int $range
*/
- public function setFixedRange($range = 1)
+ public function setFixedRange($range = 1): self
{
$this->split_mode = 'fixed_range';
$this->fixed_range = $range;
@@ -61,7 +63,7 @@ public function setFixedRange($range = 1)
/**
* @param string $pages
*/
- public function setRemovePages($pages)
+ public function setRemovePages(string $pages): self
{
$this->split_mode = 'remove_pages';
$this->remove_pages = $pages;
@@ -69,9 +71,9 @@ public function setRemovePages($pages)
}
/**
- * @param $pages string example: "1,5,10-14", default null
+ * @param string $pages example: "1,5,10-14", default null
*/
- public function setRanges($pages)
+ public function setRanges(string $pages): self
{
$this->split_mode = 'ranges';
$this->ranges = $pages;
@@ -79,21 +81,11 @@ public function setRanges($pages)
}
/**
- * @param boolean $value
+ * @param bool $value
*/
- public function setMergeAfter($value)
+ public function setMergeAfter(bool $value): self
{
$this->merge_after = $value;
return $this;
}
-
- /**
- * @param null $processData
- * @return mixed
- */
- public function execute($processData = null)
- {
- $this->tool = 'split';
- return parent::execute(get_object_vars($this));
- }
}
diff --git a/vendor/ilovepdf/ilovepdf-php/src/Task.php b/vendor/ilovepdf/ilovepdf-php/src/Task.php
new file mode 100644
index 0000000..3e3d4f6
--- /dev/null
+++ b/vendor/ilovepdf/ilovepdf-php/src/Task.php
@@ -0,0 +1,800 @@
+start();
+ }
+ }
+
+ /**
+ * @return void
+ * @throws AuthException
+ * @throws ProcessException
+ * @throws StartException
+ * @throws UploadException
+ */
+ public function start(): void
+ {
+ if($this->tool == null){
+ throw new StartException('Tool must be set');
+ }
+ $data = ['v' => self::VERSION];
+ $body = ['form_params' => $data];
+ $response = parent::sendRequest('get', 'start/' . $this->tool, $body);
+ try {
+ $responseBody = json_decode($response->getBody());
+ } catch (\Exception $e) {
+ throw new StartException('Invalid response');
+ }
+ if (empty($responseBody->server)) {
+ throw new StartException('no server assigned on start');
+ };
+ $this->setWorkerServer('https://' . $responseBody->server);
+ $this->setTask($responseBody->task);
+ }
+
+ /**
+ * @param $nextTool
+ * @return $this
+ * @throws StartException
+ */
+ public function next(string $nextTool): self
+ {
+ $data = [
+ 'v' => self::VERSION,
+ 'task' => $this->getTaskId(),
+ 'tool' => $nextTool
+ ];
+ $body = ['form_params' => $data];
+
+ try {
+ $response = parent::sendRequest('post', 'task/next', $body);
+ $responseBody = json_decode($response->getBody());
+ if (empty($responseBody->task)) {
+ throw new StartException('No task assigned on chained start');
+ };
+ } catch (\Exception $e) {
+ throw new StartException('Error on start chained task');
+ }
+
+ $next = $this->newTask($nextTool);
+ $next->setWorkerServer($this->getWorkerServer());
+
+ $next->setTask($responseBody->task);
+
+ //add files chained
+ foreach ($responseBody->files as $serverFilename => $fileName) {
+ $next->files[] = new File($serverFilename, $fileName);
+ }
+
+ return $next;
+ }
+
+ /**
+ * @param string|null $task
+ * @return $this
+ */
+ public function setTask(?string $task): self
+ {
+ $this->task = $task;
+ return $this;
+ }
+
+ /**
+ * @return string|null
+ */
+ public function getTaskId(): ?string
+ {
+ return $this->task;
+ }
+
+ /**
+ * @param array $files
+ * @return void
+ */
+ public function setFiles(array $files): void
+ {
+ $this->files = $files;
+ }
+
+ /**
+ * @return array
+ */
+ public function getFiles(): array
+ {
+ return $this->files;
+ }
+
+ /**
+ * @return array
+ */
+ public function getFilesArray()
+ {
+ $filesArray = [];
+ foreach ($this->files as $file) {
+ $filesArray[] = $file->getFileOptions();
+ }
+ return $filesArray;
+ }
+
+ /**
+ * @param string|null $server
+ * @param string|null $taskId
+ * @return Task
+ * @throws \Exception
+ */
+ public function getStatus(?string $server = null, ?string $taskId = null)
+ {
+ $server = $server ? $server : $this->getWorkerServer();
+ $taskId = $taskId ? $taskId : $this->getTaskId();
+
+ if ($server == null || $taskId == null) {
+ throw new \Exception('Cannot get status if no file is uploaded');
+ }
+ return parent::getStatus($server, $taskId);
+ }
+
+ /**
+ * @param string $filePath
+ * @return File
+ */
+ public function addFile($filePath)
+ {
+ $this->validateTaskStarted();
+ /** @psalm-suppress PossiblyNullArgument */
+ $file = $this->uploadFile($this->task, $filePath);
+ array_push($this->files, $file);
+ return end($this->files);
+ }
+
+ /**
+ * @param string $url
+ * @return File
+ */
+ public function addFileFromUrl($url)
+ {
+ $this->validateTaskStarted();
+ /** @psalm-suppress PossiblyNullArgument */
+ $file = $this->uploadUrl($this->task, $url);
+ array_push($this->files, $file);
+ return end($this->files);
+ }
+
+ /**
+ * @param string $task
+ * @param string $filepath
+ *
+ * @return File
+ *
+ * @throws AuthException
+ * @throws ProcessException
+ * @throws UploadException
+ */
+ public function uploadFile(string $task, string $filepath)
+ {
+ if (!file_exists($filepath)) {
+ throw new \InvalidArgumentException('File ' . $filepath . ' does not exists');
+ }
+
+ $body = [
+ 'multipart' => [
+ [
+ 'Content-type' => 'multipart/form-data',
+ 'name' => 'file',
+ 'contents' => fopen($filepath, 'r'),
+ 'filename' => basename($filepath)
+ ],
+ ['name' => 'task', 'contents' => $task],
+ ['name' => 'v', 'contents' => self::VERSION]
+ ],
+ ];
+
+ $response = $this->sendRequest('post', 'upload', $body);
+ try {
+ $responseBody = json_decode($response->getBody());
+ }
+ catch(\Exception $e){
+ throw new UploadException('Upload response error');
+ }
+ return new File($responseBody->server_filename, basename($filepath));
+ }
+
+ /**
+ * @param string $filePath
+ * @return File
+ */
+ public function addElementFile($filePath)
+ {
+ $this->validateTaskStarted();
+ /** @psalm-suppress PossiblyNullArgument */
+ return $this->uploadFile($this->task, $filePath);
+ }
+
+ /**
+ * @param string $url
+ * @return File
+ */
+ public function addElementFileFromUrl($url)
+ {
+ $this->validateTaskStarted();
+ /** @psalm-suppress PossiblyNullArgument */
+ return $this->uploadUrl($this->task, $url);
+ }
+
+ /**
+ * @return Task
+ */
+ public function delete()
+ {
+ $this->validateTaskStarted();
+ /** @psalm-suppress PossiblyNullOperand */
+ $response = $this->sendRequest('delete', 'task/' . $this->getTaskId());
+ $this->result = json_decode($response->getBody());
+ return $this;
+ }
+
+ /**
+ * @param string $task
+ * @param string $url
+ *
+ * @return File
+ *
+ * @throws AuthException
+ * @throws ProcessException
+ * @throws UploadException
+ */
+ public function uploadUrl($task, $url)
+ {
+ //$data = ['task' => $task, 'cloud_file' => $url, 'v' => self::VERSION];
+ //$body = ['form_data' => $data];
+ $body = [
+ 'multipart' => [
+ ['name' => 'task', 'contents' => $task],
+ ['name' => 'v', 'contents' => self::VERSION],
+ ['name' => 'cloud_file', 'contents' => $url]
+ ],
+ ];
+ $response = parent::sendRequest('post', 'upload', $body);
+ $responseBody = json_decode($response->getBody());
+ return new File($responseBody->server_filename, basename($url));
+ }
+
+ /**
+ * @param string|null $path
+ * @return void
+ * @throws AuthException
+ * @throws PathException
+ * @throws ProcessException
+ * @throws UploadException
+ * @throws DownloadException
+ */
+ public function download($path = null)
+ {
+ $this->validateTaskStarted();
+
+ if ($path != null && !is_dir($path)) {
+ if (pathinfo($path, PATHINFO_EXTENSION) == '') {
+ throw new PathException('Invalid download path. Use method setOutputFilename() to set the output file name.');
+ }
+ throw new PathException('Invalid download path. Set a valid folder path to download the file.');
+ }
+ /** @psalm-suppress PossiblyNullOperand */
+ $this->downloadFile($this->task);
+
+ if (is_null($path)) $path = '.';
+ /** @psalm-suppress PossiblyNullOperand */
+ $destination = $path . '/' . $this->outputFileName;
+ $file = fopen($destination, "w+");
+ /** @psalm-suppress PossiblyNullArgument */
+ fputs($file, $this->outputFile);
+ fclose($file);
+ return;
+ }
+
+ /**
+ * @return string|null
+ * @throws AuthException
+ * @throws ProcessException
+ * @throws UploadException
+ */
+ public function blob()
+ {
+ $this->downloadFile($this->task);
+ return $this->outputFile;
+ }
+
+ /**
+ * @return void
+ * @throws AuthException
+ * @throws ProcessException
+ * @throws UploadException
+ */
+ public function toBrowser()
+ {
+ $this->downloadFile($this->task);
+
+ if ($this->outputFileName == null || $this->outputFile == null) {
+ throw new DownloadException('No output filename');
+ }
+
+ // Try to change headers.
+ try {
+ if ($this->outputFileType == 'pdf') {
+ header("Content-type:application/pdf");
+ header("Content-Disposition:attachment;filename=\"" . $this->outputFileName . "\"");
+ } else {
+ if (function_exists('mb_strlen')) {
+ $size = mb_strlen($this->outputFile, '8bit');
+ } else {
+ $size = strlen($this->outputFile);
+ }
+ header('Content-Type: application/zip');
+ header("Content-Disposition: attachment; filename=\"" . $this->outputFileName . "\"");
+ header("Content-Length: " . $size);
+ }
+ } catch (\Throwable $th) {
+ // Do nothing.
+ // This happens when output stream is opened and headers
+ // are changed.
+ } finally {
+ echo $this->outputFile;
+ }
+ }
+
+ /**
+ * @param string|null $task
+ * @param string $path
+ *
+ * @throws AuthException
+ * @throws ProcessException
+ * @throws UploadException
+ * @throws DownloadException
+ */
+ private function downloadFile($task): void
+ {
+ $data = array('v' => self::VERSION);
+ $body = ['form_params' => $data];
+ /** @psalm-suppress PossiblyNullOperand */
+ $response = parent::sendRequest('get', 'download/' . $task, $body);
+ $responseHeaders = $response->getHeaders();
+
+
+ if (preg_match("/filename\*\=utf-8\'\'([\W\w]+)/", $responseHeaders['Content-Disposition'][0], $matchesUtf)) {
+ $filename = urldecode(str_replace('"', '', $matchesUtf[1]));
+ } else {
+ preg_match('/ .*filename=\"([\W\w]+)\"/', $responseHeaders['Content-Disposition'][0], $matches);
+ $filename = str_replace('"', '', $matches[1]);
+ }
+ try {
+ $this->outputFile = $response->getBody()->getContents();
+ } catch (\Exception $e) {
+ throw new DownloadException('No file content for download');
+ }
+ $this->outputFileName = $filename;
+ $this->outputFileType = pathinfo($this->outputFileName, PATHINFO_EXTENSION);
+ }
+
+ /**
+ * Enable or disable file encryption
+ * @param bool $value
+ */
+ public function sendEncryptedFiles(bool $value): void
+ {
+ $this->setEncryption($value);
+ }
+
+ /**
+ * @return bool
+ */
+ public function isEncrypted()
+ {
+ return $this->isFileEncryption();
+ }
+
+ /**
+ * Keep compat
+ * @return bool
+ */
+ public function getEncrypted()
+ {
+ return $this->isEncrypted();
+ }
+
+ /**
+ * @return Task
+ * @throws Exceptions\AuthException
+ * @throws Exceptions\ProcessException
+ * @throws Exceptions\UploadException
+ */
+ public function execute()
+ {
+ $this->validateTaskStarted();
+
+ $data = array_merge(
+ $this->__toArray(),
+ ['task' => $this->task, 'files' => $this->files, 'v' => self::VERSION]
+ );
+
+ //clean unwanted vars to be sent
+ unset($data['timeoutLarge']);
+ unset($data['timeout']);
+ unset($data['timeDelay']);
+
+ $body = ['form_params' => $data];
+
+ //$response = parent::sendRequest('post', 'process', http_build_query($body, null, '&', PHP_QUERY_RFC3986));
+ $response = parent::sendRequest('post', 'process', $body);
+
+ $this->result = json_decode($response->getBody());
+
+ return $this;
+ }
+
+ public function __toArray()
+ {
+ $props = [];
+ $reflection = new \ReflectionClass($this);
+ $properties = array_filter(
+ $reflection->getProperties(\ReflectionProperty::IS_PUBLIC),
+ function ($property) {
+ return !$property->isStatic();
+ }
+ );
+ foreach($properties as $property) {
+ $name = $property->name;
+ $props[$name] = $this->$name;
+ }
+
+ return $props;
+ // return call_user_func('get_object_vars', $this);
+ }
+
+
+ /**
+ * @param string $filename Set filename for downloaded zip file
+ * @return Task
+ */
+ public function setPackagedFilename($filename)
+ {
+ $this->packaged_filename = $filename;
+ return $this;
+ }
+
+ /**
+ * @param string $filename Set filename for individual file/s
+ * @return Task
+ */
+ public function setOutputFilename($filename)
+ {
+ $this->output_filename = $filename;
+ return $this;
+ }
+
+ /**
+ * @param File $file
+ * @return $this
+ * @throws AuthException
+ * @throws ProcessException
+ * @throws UploadException
+ */
+ public function deleteFile(File $file)
+ {
+ $this->validateTaskStarted();
+
+ if (($key = array_search($file, $this->files)) !== false) {
+ $body = ['form_params' => ['task' => $this->getTaskId(), 'server_filename' => $file->server_filename, 'v' => self::VERSION]];
+ /** @psalm-suppress PossiblyNullOperand */
+ $this->sendRequest('delete', 'upload/' . $this->getTaskId() . '/' . $file->server_filename, $body);
+ unset($this->files[$key]);
+ }
+ return $this;
+ }
+
+ /**
+ * @param mixed $value
+ * @param mixed $allowedValues
+ * @return bool
+ */
+ public function checkValues($value, $allowedValues): bool
+ {
+ if (!in_array($value, $allowedValues)) {
+ if ($this->tool) {
+ throw new \InvalidArgumentException('Invalid ' . $this->tool . ' value "' . $value . '". Must be one of: ' . implode(',', $allowedValues));
+ }
+ throw new \InvalidArgumentException('No tool is set');
+ }
+
+ return true;
+ }
+
+ /**
+ * @param boolean $try_pdf_repair
+ * @return Task
+ */
+ public function setTryPdfRepair($try_pdf_repair): self
+ {
+ $this->try_pdf_repair = $try_pdf_repair;
+
+ return $this;
+ }
+
+ /**
+ * @param boolean $ignore_errors
+ */
+ public function setIgnoreErrors($ignore_errors): self
+ {
+ $this->ignore_errors = $ignore_errors;
+
+ return $this;
+ }
+
+ /**
+ * @param boolean $ignore_password
+ * @return Task
+ */
+ public function setIgnorePassword($ignore_password): self
+ {
+ $this->ignore_password = $ignore_password;
+
+ return $this;
+ }
+
+
+ /**
+ * alias for setIgnoreError
+ *
+ * Will be deprecated on v2.0
+ *
+ * @param boolean $value If true, and multiple archives are processed it will ignore files with errors and continue process for all others
+ * @return Task
+ */
+ public function ignoreErrors($value): self
+ {
+ $this->ignore_errors = $value;
+
+ return $this;
+ }
+
+ /**
+ * alias for setIgnorePassword
+ *
+ * Will be deprecated on v2.0
+ *
+ * @param boolean $value
+ * @return Task
+ */
+ public function ignorePassword($value): self
+ {
+ $this->ignore_password = $value;
+
+ return $this;
+ }
+
+
+ /**
+ * @param string|null $encryptKey
+ * @return $this
+ * @throws \Exception
+ */
+ public function setFileEncryption(?string $encryptKey = null): self
+ {
+ if (count($this->files) > 0) {
+ throw new \Exception('Encrypth mode cannot be set after file upload');
+ }
+
+ parent::setFileEncryption($encryptKey);
+
+ return $this;
+ }
+
+ /**
+ * set meta values as http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/pdf_reference_1-7.pdf (page 844)
+ *
+ * @param int|string $key
+ * @param int|string|null $value
+ * @return Task
+ */
+ public function setMeta($key, $value)
+ {
+ $this->meta[$key] = $value;
+
+ return $this;
+ }
+
+ /**
+ * @param int|null $custom_int
+ * @return $this
+ */
+ public function setCustomInt(?int $customInt): self
+ {
+ $this->custom_int = $customInt;
+ return $this;
+ }
+
+ /**
+ * @param string|null $custom_string
+ * @return $this
+ */
+ public function setCustomString(?string $customString): self
+ {
+ $this->custom_string = $customString;
+ return $this;
+ }
+
+ /**
+ * @param string|null $tool
+ * @param string|null $status
+ * @param int|null $customInt
+ * @param int|null $page
+ * @return mixed|string|null
+ * @throws AuthException
+ * @throws ProcessException
+ * @throws UploadException
+ */
+ public function listTasks(?string $tool = null, ?string $status = null, ?int $customInt = null, ?int $page = null): array
+ {
+
+ $this->checkValues($status, $this->statusValues);
+
+ $data = [
+ 'tool' => $tool,
+ 'status' => $status,
+ 'custom_int' => $customInt,
+ 'page' => $page,
+ 'v' => self::VERSION,
+ 'secret_key' => $this->getSecretKey()
+ ];
+
+ $body = ['form_params' => $data];
+
+ $response = parent::sendRequest('post', 'task', $body, true);
+ $this->result = json_decode($response->getBody());
+
+ return $this->result;
+ }
+
+ /**
+ * @param string|null $webhook
+ * @return $this
+ */
+ public function setWebhook(?string $webhook): self
+ {
+ $this->webhook = $webhook;
+ return $this;
+ }
+
+ /**
+ * @return void
+ * @throws \Exception
+ */
+ private function validateTaskStarted(): void
+ {
+ if ($this->task === null) {
+ throw new \Exception('Current task does not exists. You must start your task');
+ }
+ }
+}
diff --git a/vendor/ilovepdf/ilovepdf-php/src/UnlockTask.php b/vendor/ilovepdf/ilovepdf-php/src/UnlockTask.php
new file mode 100644
index 0000000..4380e69
--- /dev/null
+++ b/vendor/ilovepdf/ilovepdf-php/src/UnlockTask.php
@@ -0,0 +1,24 @@
+tool = 'unlock';
+ parent::__construct($publicKey, $secretKey, $makeStart);
+ }
+}
diff --git a/lib/ilovepdf-php-master/src/ValidatepdfaTask.php b/vendor/ilovepdf/ilovepdf-php/src/ValidatepdfaTask.php
similarity index 51%
rename from lib/ilovepdf-php-master/src/ValidatepdfaTask.php
rename to vendor/ilovepdf/ilovepdf-php/src/ValidatepdfaTask.php
index c7c48d1..37c67a4 100644
--- a/lib/ilovepdf-php-master/src/ValidatepdfaTask.php
+++ b/vendor/ilovepdf/ilovepdf-php/src/ValidatepdfaTask.php
@@ -1,8 +1,10 @@
tool = 'validatepdfa';
- parent::__construct($publicKey, $secretKey, true);
+ parent::__construct($publicKey, $secretKey, $makeStart);
}
/**
@@ -39,24 +46,20 @@ public function setConformance($conformance)
}
/**
- * @param null $processData
- * @return mixed
+ * @param string|null $path
+ * @return void
+ * @throws DownloadException
*/
- public function execute($processData = null)
- {
- return parent::execute(get_object_vars($this));
- }
-
public function download($path = null)
{
- return;
+ throw new DownloadException('This task have no files to download');
}
public function blob(){
- $this->download();
+ throw new DownloadException('This task have no files to download');
}
public function toBrowser(){
- $this->download();
+ throw new DownloadException('This task have no files to download');
}
}
diff --git a/lib/ilovepdf-php-master/src/WatermarkTask.php b/vendor/ilovepdf/ilovepdf-php/src/WatermarkTask.php
similarity index 56%
rename from lib/ilovepdf-php-master/src/WatermarkTask.php
rename to vendor/ilovepdf/ilovepdf-php/src/WatermarkTask.php
index c705a93..4c60fbc 100644
--- a/lib/ilovepdf-php-master/src/WatermarkTask.php
+++ b/vendor/ilovepdf/ilovepdf-php/src/WatermarkTask.php
@@ -2,6 +2,7 @@
namespace Ilovepdf;
+use Ilovepdf\Element;
/**
* Class WatermarkTask
@@ -11,102 +12,126 @@
class WatermarkTask extends Task
{
/**
- * @var string
+ * @var string|null
*/
public $mode;
/**
- * @var string
+ * @var string[]
*/
- public $text;
+ private $modeValues = ['image', 'text', 'multi'];
/**
- * @var strig
+ * @var string|null
+ */
+ public $text;
+
+ /**
+ * @var string|null
*/
public $image;
/**
- * @var string
+ * @var string|null
*/
public $pages;
/**
- * @var string
+ * @var string|null
*/
public $vertical_position;
+ /**
+ * @var string[]
+ */
private $verticalPositionValues = ['bottom', 'middle', 'top'];
/**
- * @var string
+ * @var string|null
*/
public $horizontal_position;
+ /**
+ * @var string[]
+ */
private $horizontalPositionValues = ['left', 'center', 'right'];
/**
- * @var integer
+ * @var integer|null
*/
public $vertical_position_adjustment;
/**
- * @var integer
+ * @var integer|null
*/
public $horizontal_position_adjustment;
/**
- * @var boolean
+ * @var boolean|null
*/
public $mosaic;
/**
- * @var integer
+ * @var integer|null
*/
public $rotation;
/**
- * @var string
+ * @var string|null
*/
public $font_family;
+ /**
+ * @var string[]
+ */
private $fontFamilyValues = ['Arial', 'Arial Unicode MS', 'Verdana', 'Courier', 'Times New Roman', 'Comic Sans MS', 'WenQuanYi Zen Hei', 'Lohit Marathi'];
/**
- * @var string
+ * @var string|null
*/
public $font_style;
/**
- * @var integer
+ * @var integer|null
*/
public $font_size;
/**
- * @var string
+ * @var string|null
*/
public $font_color;
/**
- * @var integer
+ * @var integer|null
*/
public $transparency;
/**
- * @var string
+ * @var string|null
*/
public $layer;
+ /**
+ * @var string[]
+ */
private $layerValues = ['above', 'below'];
+ /**
+ * @var array
+ */
+ public $elements = [];
+
/**
* WatermarkTask constructor.
- * @param null|string $publicKey
- * @param null|string $secretKey
+ *
+ * @param null|string $publicKey Your public key
+ * @param null|string $secretKey Your secret key
+ * @param bool $makeStart Set to false for chained tasks, because we don't need the start
*/
- function __construct($publicKey, $secretKey)
+ function __construct(?string $publicKey, ?string $secretKey, $makeStart = true)
{
$this->tool='watermark';
- parent::__construct($publicKey, $secretKey, true);
+ parent::__construct($publicKey, $secretKey, $makeStart);
}
@@ -114,7 +139,7 @@ function __construct($publicKey, $secretKey)
/**
* @param string $mode
*/
- public function setMode($mode)
+ public function setMode(string $mode): self
{
$this->mode = $mode;
return $this;
@@ -123,25 +148,34 @@ public function setMode($mode)
/**
* @param string $text
*/
- public function setText($text)
+ public function setText(string $text): self
{
$this->text = $text;
return $this;
}
/**
- * @param strig $image
+ * @param string $image
*/
- public function setImage($image)
+ public function setImage(string $image): self
{
$this->image = $image;
return $this;
}
+ /**
+ * @param File $image
+ */
+ public function setImageFile(File $imageFile): self
+ {
+ $this->image = $imageFile->getServerFilename();
+ return $this;
+ }
+
/**
* @param string $pages
*/
- public function setPages($pages)
+ public function setPages(string $pages): self
{
$this->pages = $pages;
return $this;
@@ -150,7 +184,7 @@ public function setPages($pages)
/**
* @param string $vertical_position
*/
- public function setVerticalPosition($vertical_position)
+ public function setVerticalPosition(string $vertical_position): self
{
$this->checkValues($vertical_position, $this->verticalPositionValues);
@@ -161,7 +195,7 @@ public function setVerticalPosition($vertical_position)
/**
* @param string $horizontal_position
*/
- public function setHorizontalPosition($horizontal_position)
+ public function setHorizontalPosition(string $horizontal_position): self
{
$this->checkValues($horizontal_position, $this->horizontalPositionValues);
@@ -172,7 +206,7 @@ public function setHorizontalPosition($horizontal_position)
/**
* @param int $vertical_position_adjustment
*/
- public function setVerticalPositionAdjustment($vertical_position_adjustment)
+ public function setVerticalPositionAdjustment(int $vertical_position_adjustment): self
{
$this->vertical_position_adjustment = $vertical_position_adjustment;
return $this;
@@ -181,16 +215,16 @@ public function setVerticalPositionAdjustment($vertical_position_adjustment)
/**
* @param int $horizontal_position_adjustment
*/
- public function setHorizontalPositionAdjustment($horizontal_position_adjustment)
+ public function setHorizontalPositionAdjustment(int $horizontal_position_adjustment): self
{
$this->horizontal_position_adjustment = $horizontal_position_adjustment;
return $this;
}
/**
- * @param boolean $mosaic
+ * @param bool $mosaic
*/
- public function setMosaic($mosaic)
+ public function setMosaic(bool $mosaic): self
{
$this->mosaic = $mosaic;
return $this;
@@ -199,7 +233,7 @@ public function setMosaic($mosaic)
/**
* @param int $rotation
*/
- public function setRotation($rotation)
+ public function setRotation(int $rotation): self
{
$this->rotation = $rotation;
return $this;
@@ -208,7 +242,7 @@ public function setRotation($rotation)
/**
* @param string $font_family
*/
- public function setFontFamily($font_family)
+ public function setFontFamily(string $font_family): self
{
$this->checkValues($font_family, $this->fontFamilyValues);
@@ -219,7 +253,7 @@ public function setFontFamily($font_family)
/**
* @param string $font_style
*/
- public function setFontStyle($font_style)
+ public function setFontStyle(string $font_style): self
{
$this->font_style = $font_style;
return $this;
@@ -228,7 +262,7 @@ public function setFontStyle($font_style)
/**
* @param int $font_size
*/
- public function setFontSize($font_size)
+ public function setFontSize($font_size): self
{
$this->font_size = $font_size;
return $this;
@@ -237,7 +271,7 @@ public function setFontSize($font_size)
/**
* @param string $font_color
*/
- public function setFontColor($font_color)
+ public function setFontColor(string $font_color): self
{
$this->font_color = $font_color;
return $this;
@@ -246,7 +280,7 @@ public function setFontColor($font_color)
/**
* @param int $transparency
*/
- public function setTransparency($transparency)
+ public function setTransparency(int $transparency): self
{
$this->transparency = $transparency;
return $this;
@@ -255,11 +289,28 @@ public function setTransparency($transparency)
/**
* @param string $layer
*/
- public function setLayer($layer)
+ public function setLayer(string $layer): self
{
$this->checkValues($layer, $this->layerValues);
$this->layer = $layer;
return $this;
}
+
+ /**
+ * adds a watermark element
+ *
+ * @param Element|array $element
+ * @return $this
+ */
+ public function addElement($element): self
+ {
+
+ if (is_a($element, Element::class)) {
+ $this->elements[] = $element;
+ } elseif (is_array($element)) {
+ $this->elements[] = new Element($element);
+ }
+ return $this;
+ }
}
diff --git a/lib/ilovepdf-php-master/tests/Ilovepdf/FileTest.php b/vendor/ilovepdf/ilovepdf-php/tests/Ilovepdf/FileTest.php
similarity index 89%
rename from lib/ilovepdf-php-master/tests/Ilovepdf/FileTest.php
rename to vendor/ilovepdf/ilovepdf-php/tests/Ilovepdf/FileTest.php
index 4456a2d..54ae15a 100644
--- a/lib/ilovepdf-php-master/tests/Ilovepdf/FileTest.php
+++ b/vendor/ilovepdf/ilovepdf-php/tests/Ilovepdf/FileTest.php
@@ -38,6 +38,7 @@ public function testCanSetRotation(){
public function testSetRotationWithNotAllowedParamTrowsError(){
$rotation = '900';
$file = new File('file_server', 'file_name');
+ $this->expectException(\InvalidArgumentException::class);
$file->setRotation($rotation);
}
@@ -53,21 +54,21 @@ public function testCanSetPassword(){
$this->assertEquals($options['password'], $password);
}
- /*
+ /**
* @test
* @expectedException \InvalidArgumentException
*/
public function testEmptyServerFilenameTrowException(){
+ $this->expectException(\InvalidArgumentException::class);
$file = new File('', 'some_filename');
- $this->assertEquals($file->filename, 'some_filename');
}
- /*
+ /**
* @test
* @expectedException \InvalidArgumentException
*/
public function testEmptyFilenameTrowException(){
+ $this->expectException(\InvalidArgumentException::class);
$file = new File('server_filename', '');
- $this->assertEquals($file->server_filename, 'server_filename');
}
}
\ No newline at end of file
diff --git a/lib/ilovepdf-php-master/tests/Ilovepdf/IloveTest.php b/vendor/ilovepdf/ilovepdf-php/tests/Ilovepdf/IloveTest.php
old mode 100644
new mode 100755
similarity index 100%
rename from lib/ilovepdf-php-master/tests/Ilovepdf/IloveTest.php
rename to vendor/ilovepdf/ilovepdf-php/tests/Ilovepdf/IloveTest.php
diff --git a/lib/ilovepdf-php-master/tests/Ilovepdf/IlovepdfTest.php b/vendor/ilovepdf/ilovepdf-php/tests/Ilovepdf/IlovepdfTest.php
similarity index 91%
rename from lib/ilovepdf-php-master/tests/Ilovepdf/IlovepdfTest.php
rename to vendor/ilovepdf/ilovepdf-php/tests/Ilovepdf/IlovepdfTest.php
index 3072159..f1e1336 100644
--- a/lib/ilovepdf-php-master/tests/Ilovepdf/IlovepdfTest.php
+++ b/vendor/ilovepdf/ilovepdf-php/tests/Ilovepdf/IlovepdfTest.php
@@ -13,7 +13,7 @@ class IlovepdfTest extends TestCase
public $publicKey = "public_key";
public $secretKey = "secret_key";
- public function setUp()
+ public function setUp(): void
{
$this->ilovepdf = new Ilovepdf();
$this->ilovepdf->setApiKeys($this->publicKey, $this->secretKey);
@@ -60,9 +60,11 @@ public function testCanGetJwt()
/**
* @test
+ * @expectedException \Exception
*/
public function testEmptyTaskShouldThrowException()
{
+ $this->expectException(\Exception::class);
$task = $this->ilovepdf->newTask("");
$this->assertNotNull($task);
}
@@ -73,6 +75,7 @@ public function testEmptyTaskShouldThrowException()
*/
public function testNotExistingTaskShouldThrowException()
{
+ $this->expectException(\InvalidArgumentException::class);
$this->ilovepdf->newTask("tralara");
}
@@ -116,6 +119,7 @@ public function testUnsetEncryptRemovesKey()
*/
public function testWrongEncryptKeyThrowsException($key)
{
+ $this->expectException(\InvalidArgumentException::class);
$this->ilovepdf->setFileEncryption(true, $key );
}
diff --git a/lib/ilovepdf-php-master/tests/bootstrap.php b/vendor/ilovepdf/ilovepdf-php/tests/bootstrap.php
old mode 100644
new mode 100755
similarity index 100%
rename from lib/ilovepdf-php-master/tests/bootstrap.php
rename to vendor/ilovepdf/ilovepdf-php/tests/bootstrap.php
diff --git a/vendor/psr/http-client/CHANGELOG.md b/vendor/psr/http-client/CHANGELOG.md
new file mode 100644
index 0000000..babba7c
--- /dev/null
+++ b/vendor/psr/http-client/CHANGELOG.md
@@ -0,0 +1,31 @@
+# Changelog
+
+All notable changes to this project will be documented in this file, in reverse chronological order by release.
+
+## 1.0.3
+
+Add `source` link in composer.json. No code changes.
+
+## 1.0.2
+
+Allow PSR-7 (psr/http-message) 2.0. No code changes.
+
+## 1.0.1
+
+Allow installation with PHP 8. No code changes.
+
+## 1.0.0
+
+First stable release. No changes since 0.3.0.
+
+## 0.3.0
+
+Added Interface suffix on exceptions
+
+## 0.2.0
+
+All exceptions are in `Psr\Http\Client` namespace
+
+## 0.1.0
+
+First release
diff --git a/vendor/psr/http-client/LICENSE b/vendor/psr/http-client/LICENSE
new file mode 100644
index 0000000..cd5e002
--- /dev/null
+++ b/vendor/psr/http-client/LICENSE
@@ -0,0 +1,19 @@
+Copyright (c) 2017 PHP Framework Interoperability Group
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/vendor/psr/http-client/README.md b/vendor/psr/http-client/README.md
new file mode 100644
index 0000000..84af5c5
--- /dev/null
+++ b/vendor/psr/http-client/README.md
@@ -0,0 +1,12 @@
+HTTP Client
+===========
+
+This repository holds all the common code related to [PSR-18 (HTTP Client)][psr-url].
+
+Note that this is not a HTTP Client implementation of its own. It is merely abstractions that describe the components of a HTTP Client.
+
+The installable [package][package-url] and [implementations][implementation-url] are listed on Packagist.
+
+[psr-url]: https://www.php-fig.org/psr/psr-18
+[package-url]: https://packagist.org/packages/psr/http-client
+[implementation-url]: https://packagist.org/providers/psr/http-client-implementation
diff --git a/vendor/psr/http-client/composer.json b/vendor/psr/http-client/composer.json
new file mode 100644
index 0000000..6fed350
--- /dev/null
+++ b/vendor/psr/http-client/composer.json
@@ -0,0 +1,30 @@
+{
+ "name": "psr/http-client",
+ "description": "Common interface for HTTP clients",
+ "keywords": ["psr", "psr-18", "http", "http-client"],
+ "homepage": "https://github.com/php-fig/http-client",
+ "license": "MIT",
+ "authors": [
+ {
+ "name": "PHP-FIG",
+ "homepage": "https://www.php-fig.org/"
+ }
+ ],
+ "support": {
+ "source": "https://github.com/php-fig/http-client"
+ },
+ "require": {
+ "php": "^7.0 || ^8.0",
+ "psr/http-message": "^1.0 || ^2.0"
+ },
+ "autoload": {
+ "psr-4": {
+ "Psr\\Http\\Client\\": "src/"
+ }
+ },
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.0.x-dev"
+ }
+ }
+}
diff --git a/vendor/psr/http-client/src/ClientExceptionInterface.php b/vendor/psr/http-client/src/ClientExceptionInterface.php
new file mode 100644
index 0000000..aa0b9cf
--- /dev/null
+++ b/vendor/psr/http-client/src/ClientExceptionInterface.php
@@ -0,0 +1,10 @@
+=7.0.0",
+ "psr/http-message": "^1.0 || ^2.0"
+ },
+ "autoload": {
+ "psr-4": {
+ "Psr\\Http\\Message\\": "src/"
+ }
+ },
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.0.x-dev"
+ }
+ }
+}
diff --git a/vendor/psr/http-factory/src/RequestFactoryInterface.php b/vendor/psr/http-factory/src/RequestFactoryInterface.php
new file mode 100644
index 0000000..cb39a08
--- /dev/null
+++ b/vendor/psr/http-factory/src/RequestFactoryInterface.php
@@ -0,0 +1,18 @@
+ `RequestInterface`, `ServerRequestInterface`, `ResponseInterface` extend `MessageInterface` because the `Request` and the `Response` are `HTTP Messages`.
+> When using `ServerRequestInterface`, both `RequestInterface` and `Psr\Http\Message\MessageInterface` methods are considered.
+
diff --git a/vendor/psr/http-message/docs/PSR7-Usage.md b/vendor/psr/http-message/docs/PSR7-Usage.md
new file mode 100644
index 0000000..b6d048a
--- /dev/null
+++ b/vendor/psr/http-message/docs/PSR7-Usage.md
@@ -0,0 +1,159 @@
+### PSR-7 Usage
+
+All PSR-7 applications comply with these interfaces
+They were created to establish a standard between middleware implementations.
+
+> `RequestInterface`, `ServerRequestInterface`, `ResponseInterface` extend `MessageInterface` because the `Request` and the `Response` are `HTTP Messages`.
+> When using `ServerRequestInterface`, both `RequestInterface` and `Psr\Http\Message\MessageInterface` methods are considered.
+
+
+The following examples will illustrate how basic operations are done in PSR-7.
+
+##### Examples
+
+
+For this examples to work (at least) a PSR-7 implementation package is required. (eg: zendframework/zend-diactoros, guzzlehttp/psr7, slim/slim, etc)
+All PSR-7 implementations should have the same behaviour.
+
+The following will be assumed:
+`$request` is an object of `Psr\Http\Message\RequestInterface` and
+
+`$response` is an object implementing `Psr\Http\Message\RequestInterface`
+
+
+### Working with HTTP Headers
+
+#### Adding headers to response:
+
+```php
+$response->withHeader('My-Custom-Header', 'My Custom Message');
+```
+
+#### Appending values to headers
+
+```php
+$response->withAddedHeader('My-Custom-Header', 'The second message');
+```
+
+#### Checking if header exists:
+
+```php
+$request->hasHeader('My-Custom-Header'); // will return false
+$response->hasHeader('My-Custom-Header'); // will return true
+```
+
+> Note: My-Custom-Header was only added in the Response
+
+#### Getting comma-separated values from a header (also applies to request)
+
+```php
+// getting value from request headers
+$request->getHeaderLine('Content-Type'); // will return: "text/html; charset=UTF-8"
+// getting value from response headers
+$response->getHeaderLine('My-Custom-Header'); // will return: "My Custom Message; The second message"
+```
+
+#### Getting array of value from a header (also applies to request)
+```php
+// getting value from request headers
+$request->getHeader('Content-Type'); // will return: ["text/html", "charset=UTF-8"]
+// getting value from response headers
+$response->getHeader('My-Custom-Header'); // will return: ["My Custom Message", "The second message"]
+```
+
+#### Removing headers from HTTP Messages
+```php
+// removing a header from Request, removing deprecated "Content-MD5" header
+$request->withoutHeader('Content-MD5');
+
+// removing a header from Response
+// effect: the browser won't know the size of the stream
+// the browser will download the stream till it ends
+$response->withoutHeader('Content-Length');
+```
+
+### Working with HTTP Message Body
+
+When working with the PSR-7 there are two methods of implementation:
+#### 1. Getting the body separately
+
+> This method makes the body handling easier to understand and is useful when repeatedly calling body methods. (You only call `getBody()` once). Using this method mistakes like `$response->write()` are also prevented.
+
+```php
+$body = $response->getBody();
+// operations on body, eg. read, write, seek
+// ...
+// replacing the old body
+$response->withBody($body);
+// this last statement is optional as we working with objects
+// in this case the "new" body is same with the "old" one
+// the $body variable has the same value as the one in $request, only the reference is passed
+```
+
+#### 2. Working directly on response
+
+> This method is useful when only performing few operations as the `$request->getBody()` statement fragment is required
+
+```php
+$response->getBody()->write('hello');
+```
+
+### Getting the body contents
+
+The following snippet gets the contents of a stream contents.
+> Note: Streams must be rewinded, if content was written into streams, it will be ignored when calling `getContents()` because the stream pointer is set to the last character, which is `\0` - meaning end of stream.
+```php
+$body = $response->getBody();
+$body->rewind(); // or $body->seek(0);
+$bodyText = $body->getContents();
+```
+> Note: If `$body->seek(1)` is called before `$body->getContents()`, the first character will be ommited as the starting pointer is set to `1`, not `0`. This is why using `$body->rewind()` is recommended.
+
+### Append to body
+
+```php
+$response->getBody()->write('Hello'); // writing directly
+$body = $request->getBody(); // which is a `StreamInterface`
+$body->write('xxxxx');
+```
+
+### Prepend to body
+Prepending is different when it comes to streams. The content must be copied before writing the content to be prepended.
+The following example will explain the behaviour of streams.
+
+```php
+// assuming our response is initially empty
+$body = $repsonse->getBody();
+// writing the string "abcd"
+$body->write('abcd');
+
+// seeking to start of stream
+$body->seek(0);
+// writing 'ef'
+$body->write('ef'); // at this point the stream contains "efcd"
+```
+
+#### Prepending by rewriting separately
+
+```php
+// assuming our response body stream only contains: "abcd"
+$body = $response->getBody();
+$body->rewind();
+$contents = $body->getContents(); // abcd
+// seeking the stream to beginning
+$body->rewind();
+$body->write('ef'); // stream contains "efcd"
+$body->write($contents); // stream contains "efabcd"
+```
+
+> Note: `getContents()` seeks the stream while reading it, therefore if the second `rewind()` method call was not present the stream would have resulted in `abcdefabcd` because the `write()` method appends to stream if not preceeded by `rewind()` or `seek(0)`.
+
+#### Prepending by using contents as a string
+```php
+$body = $response->getBody();
+$body->rewind();
+$contents = $body->getContents(); // efabcd
+$contents = 'ef'.$contents;
+$body->rewind();
+$body->write($contents);
+```
diff --git a/vendor/psr/http-message/src/MessageInterface.php b/vendor/psr/http-message/src/MessageInterface.php
new file mode 100644
index 0000000..a83c985
--- /dev/null
+++ b/vendor/psr/http-message/src/MessageInterface.php
@@ -0,0 +1,187 @@
+getHeaders() as $name => $values) {
+ * echo $name . ": " . implode(", ", $values);
+ * }
+ *
+ * // Emit headers iteratively:
+ * foreach ($message->getHeaders() as $name => $values) {
+ * foreach ($values as $value) {
+ * header(sprintf('%s: %s', $name, $value), false);
+ * }
+ * }
+ *
+ * While header names are not case-sensitive, getHeaders() will preserve the
+ * exact case in which headers were originally specified.
+ *
+ * @return string[][] Returns an associative array of the message's headers. Each
+ * key MUST be a header name, and each value MUST be an array of strings
+ * for that header.
+ */
+ public function getHeaders(): array;
+
+ /**
+ * Checks if a header exists by the given case-insensitive name.
+ *
+ * @param string $name Case-insensitive header field name.
+ * @return bool Returns true if any header names match the given header
+ * name using a case-insensitive string comparison. Returns false if
+ * no matching header name is found in the message.
+ */
+ public function hasHeader(string $name): bool;
+
+ /**
+ * Retrieves a message header value by the given case-insensitive name.
+ *
+ * This method returns an array of all the header values of the given
+ * case-insensitive header name.
+ *
+ * If the header does not appear in the message, this method MUST return an
+ * empty array.
+ *
+ * @param string $name Case-insensitive header field name.
+ * @return string[] An array of string values as provided for the given
+ * header. If the header does not appear in the message, this method MUST
+ * return an empty array.
+ */
+ public function getHeader(string $name): array;
+
+ /**
+ * Retrieves a comma-separated string of the values for a single header.
+ *
+ * This method returns all of the header values of the given
+ * case-insensitive header name as a string concatenated together using
+ * a comma.
+ *
+ * NOTE: Not all header values may be appropriately represented using
+ * comma concatenation. For such headers, use getHeader() instead
+ * and supply your own delimiter when concatenating.
+ *
+ * If the header does not appear in the message, this method MUST return
+ * an empty string.
+ *
+ * @param string $name Case-insensitive header field name.
+ * @return string A string of values as provided for the given header
+ * concatenated together using a comma. If the header does not appear in
+ * the message, this method MUST return an empty string.
+ */
+ public function getHeaderLine(string $name): string;
+
+ /**
+ * Return an instance with the provided value replacing the specified header.
+ *
+ * While header names are case-insensitive, the casing of the header will
+ * be preserved by this function, and returned from getHeaders().
+ *
+ * This method MUST be implemented in such a way as to retain the
+ * immutability of the message, and MUST return an instance that has the
+ * new and/or updated header and value.
+ *
+ * @param string $name Case-insensitive header field name.
+ * @param string|string[] $value Header value(s).
+ * @return static
+ * @throws \InvalidArgumentException for invalid header names or values.
+ */
+ public function withHeader(string $name, $value): MessageInterface;
+
+ /**
+ * Return an instance with the specified header appended with the given value.
+ *
+ * Existing values for the specified header will be maintained. The new
+ * value(s) will be appended to the existing list. If the header did not
+ * exist previously, it will be added.
+ *
+ * This method MUST be implemented in such a way as to retain the
+ * immutability of the message, and MUST return an instance that has the
+ * new header and/or value.
+ *
+ * @param string $name Case-insensitive header field name to add.
+ * @param string|string[] $value Header value(s).
+ * @return static
+ * @throws \InvalidArgumentException for invalid header names or values.
+ */
+ public function withAddedHeader(string $name, $value): MessageInterface;
+
+ /**
+ * Return an instance without the specified header.
+ *
+ * Header resolution MUST be done without case-sensitivity.
+ *
+ * This method MUST be implemented in such a way as to retain the
+ * immutability of the message, and MUST return an instance that removes
+ * the named header.
+ *
+ * @param string $name Case-insensitive header field name to remove.
+ * @return static
+ */
+ public function withoutHeader(string $name): MessageInterface;
+
+ /**
+ * Gets the body of the message.
+ *
+ * @return StreamInterface Returns the body as a stream.
+ */
+ public function getBody(): StreamInterface;
+
+ /**
+ * Return an instance with the specified message body.
+ *
+ * The body MUST be a StreamInterface object.
+ *
+ * This method MUST be implemented in such a way as to retain the
+ * immutability of the message, and MUST return a new instance that has the
+ * new body stream.
+ *
+ * @param StreamInterface $body Body.
+ * @return static
+ * @throws \InvalidArgumentException When the body is not valid.
+ */
+ public function withBody(StreamInterface $body): MessageInterface;
+}
diff --git a/vendor/psr/http-message/src/RequestInterface.php b/vendor/psr/http-message/src/RequestInterface.php
new file mode 100644
index 0000000..33f85e5
--- /dev/null
+++ b/vendor/psr/http-message/src/RequestInterface.php
@@ -0,0 +1,130 @@
+getQuery()`
+ * or from the `QUERY_STRING` server param.
+ *
+ * @return array
+ */
+ public function getQueryParams(): array;
+
+ /**
+ * Return an instance with the specified query string arguments.
+ *
+ * These values SHOULD remain immutable over the course of the incoming
+ * request. They MAY be injected during instantiation, such as from PHP's
+ * $_GET superglobal, or MAY be derived from some other value such as the
+ * URI. In cases where the arguments are parsed from the URI, the data
+ * MUST be compatible with what PHP's parse_str() would return for
+ * purposes of how duplicate query parameters are handled, and how nested
+ * sets are handled.
+ *
+ * Setting query string arguments MUST NOT change the URI stored by the
+ * request, nor the values in the server params.
+ *
+ * This method MUST be implemented in such a way as to retain the
+ * immutability of the message, and MUST return an instance that has the
+ * updated query string arguments.
+ *
+ * @param array $query Array of query string arguments, typically from
+ * $_GET.
+ * @return static
+ */
+ public function withQueryParams(array $query): ServerRequestInterface;
+
+ /**
+ * Retrieve normalized file upload data.
+ *
+ * This method returns upload metadata in a normalized tree, with each leaf
+ * an instance of Psr\Http\Message\UploadedFileInterface.
+ *
+ * These values MAY be prepared from $_FILES or the message body during
+ * instantiation, or MAY be injected via withUploadedFiles().
+ *
+ * @return array An array tree of UploadedFileInterface instances; an empty
+ * array MUST be returned if no data is present.
+ */
+ public function getUploadedFiles(): array;
+
+ /**
+ * Create a new instance with the specified uploaded files.
+ *
+ * This method MUST be implemented in such a way as to retain the
+ * immutability of the message, and MUST return an instance that has the
+ * updated body parameters.
+ *
+ * @param array $uploadedFiles An array tree of UploadedFileInterface instances.
+ * @return static
+ * @throws \InvalidArgumentException if an invalid structure is provided.
+ */
+ public function withUploadedFiles(array $uploadedFiles): ServerRequestInterface;
+
+ /**
+ * Retrieve any parameters provided in the request body.
+ *
+ * If the request Content-Type is either application/x-www-form-urlencoded
+ * or multipart/form-data, and the request method is POST, this method MUST
+ * return the contents of $_POST.
+ *
+ * Otherwise, this method may return any results of deserializing
+ * the request body content; as parsing returns structured content, the
+ * potential types MUST be arrays or objects only. A null value indicates
+ * the absence of body content.
+ *
+ * @return null|array|object The deserialized body parameters, if any.
+ * These will typically be an array or object.
+ */
+ public function getParsedBody();
+
+ /**
+ * Return an instance with the specified body parameters.
+ *
+ * These MAY be injected during instantiation.
+ *
+ * If the request Content-Type is either application/x-www-form-urlencoded
+ * or multipart/form-data, and the request method is POST, use this method
+ * ONLY to inject the contents of $_POST.
+ *
+ * The data IS NOT REQUIRED to come from $_POST, but MUST be the results of
+ * deserializing the request body content. Deserialization/parsing returns
+ * structured data, and, as such, this method ONLY accepts arrays or objects,
+ * or a null value if nothing was available to parse.
+ *
+ * As an example, if content negotiation determines that the request data
+ * is a JSON payload, this method could be used to create a request
+ * instance with the deserialized parameters.
+ *
+ * This method MUST be implemented in such a way as to retain the
+ * immutability of the message, and MUST return an instance that has the
+ * updated body parameters.
+ *
+ * @param null|array|object $data The deserialized body data. This will
+ * typically be in an array or object.
+ * @return static
+ * @throws \InvalidArgumentException if an unsupported argument type is
+ * provided.
+ */
+ public function withParsedBody($data): ServerRequestInterface;
+
+ /**
+ * Retrieve attributes derived from the request.
+ *
+ * The request "attributes" may be used to allow injection of any
+ * parameters derived from the request: e.g., the results of path
+ * match operations; the results of decrypting cookies; the results of
+ * deserializing non-form-encoded message bodies; etc. Attributes
+ * will be application and request specific, and CAN be mutable.
+ *
+ * @return array Attributes derived from the request.
+ */
+ public function getAttributes(): array;
+
+ /**
+ * Retrieve a single derived request attribute.
+ *
+ * Retrieves a single derived request attribute as described in
+ * getAttributes(). If the attribute has not been previously set, returns
+ * the default value as provided.
+ *
+ * This method obviates the need for a hasAttribute() method, as it allows
+ * specifying a default value to return if the attribute is not found.
+ *
+ * @see getAttributes()
+ * @param string $name The attribute name.
+ * @param mixed $default Default value to return if the attribute does not exist.
+ * @return mixed
+ */
+ public function getAttribute(string $name, $default = null);
+
+ /**
+ * Return an instance with the specified derived request attribute.
+ *
+ * This method allows setting a single derived request attribute as
+ * described in getAttributes().
+ *
+ * This method MUST be implemented in such a way as to retain the
+ * immutability of the message, and MUST return an instance that has the
+ * updated attribute.
+ *
+ * @see getAttributes()
+ * @param string $name The attribute name.
+ * @param mixed $value The value of the attribute.
+ * @return static
+ */
+ public function withAttribute(string $name, $value): ServerRequestInterface;
+
+ /**
+ * Return an instance that removes the specified derived request attribute.
+ *
+ * This method allows removing a single derived request attribute as
+ * described in getAttributes().
+ *
+ * This method MUST be implemented in such a way as to retain the
+ * immutability of the message, and MUST return an instance that removes
+ * the attribute.
+ *
+ * @see getAttributes()
+ * @param string $name The attribute name.
+ * @return static
+ */
+ public function withoutAttribute(string $name): ServerRequestInterface;
+}
diff --git a/vendor/psr/http-message/src/StreamInterface.php b/vendor/psr/http-message/src/StreamInterface.php
new file mode 100644
index 0000000..a62aabb
--- /dev/null
+++ b/vendor/psr/http-message/src/StreamInterface.php
@@ -0,0 +1,158 @@
+
+ * [user-info@]host[:port]
+ *
+ *
+ * If the port component is not set or is the standard port for the current
+ * scheme, it SHOULD NOT be included.
+ *
+ * @see https://tools.ietf.org/html/rfc3986#section-3.2
+ * @return string The URI authority, in "[user-info@]host[:port]" format.
+ */
+ public function getAuthority(): string;
+
+ /**
+ * Retrieve the user information component of the URI.
+ *
+ * If no user information is present, this method MUST return an empty
+ * string.
+ *
+ * If a user is present in the URI, this will return that value;
+ * additionally, if the password is also present, it will be appended to the
+ * user value, with a colon (":") separating the values.
+ *
+ * The trailing "@" character is not part of the user information and MUST
+ * NOT be added.
+ *
+ * @return string The URI user information, in "username[:password]" format.
+ */
+ public function getUserInfo(): string;
+
+ /**
+ * Retrieve the host component of the URI.
+ *
+ * If no host is present, this method MUST return an empty string.
+ *
+ * The value returned MUST be normalized to lowercase, per RFC 3986
+ * Section 3.2.2.
+ *
+ * @see http://tools.ietf.org/html/rfc3986#section-3.2.2
+ * @return string The URI host.
+ */
+ public function getHost(): string;
+
+ /**
+ * Retrieve the port component of the URI.
+ *
+ * If a port is present, and it is non-standard for the current scheme,
+ * this method MUST return it as an integer. If the port is the standard port
+ * used with the current scheme, this method SHOULD return null.
+ *
+ * If no port is present, and no scheme is present, this method MUST return
+ * a null value.
+ *
+ * If no port is present, but a scheme is present, this method MAY return
+ * the standard port for that scheme, but SHOULD return null.
+ *
+ * @return null|int The URI port.
+ */
+ public function getPort(): ?int;
+
+ /**
+ * Retrieve the path component of the URI.
+ *
+ * The path can either be empty or absolute (starting with a slash) or
+ * rootless (not starting with a slash). Implementations MUST support all
+ * three syntaxes.
+ *
+ * Normally, the empty path "" and absolute path "/" are considered equal as
+ * defined in RFC 7230 Section 2.7.3. But this method MUST NOT automatically
+ * do this normalization because in contexts with a trimmed base path, e.g.
+ * the front controller, this difference becomes significant. It's the task
+ * of the user to handle both "" and "/".
+ *
+ * The value returned MUST be percent-encoded, but MUST NOT double-encode
+ * any characters. To determine what characters to encode, please refer to
+ * RFC 3986, Sections 2 and 3.3.
+ *
+ * As an example, if the value should include a slash ("/") not intended as
+ * delimiter between path segments, that value MUST be passed in encoded
+ * form (e.g., "%2F") to the instance.
+ *
+ * @see https://tools.ietf.org/html/rfc3986#section-2
+ * @see https://tools.ietf.org/html/rfc3986#section-3.3
+ * @return string The URI path.
+ */
+ public function getPath(): string;
+
+ /**
+ * Retrieve the query string of the URI.
+ *
+ * If no query string is present, this method MUST return an empty string.
+ *
+ * The leading "?" character is not part of the query and MUST NOT be
+ * added.
+ *
+ * The value returned MUST be percent-encoded, but MUST NOT double-encode
+ * any characters. To determine what characters to encode, please refer to
+ * RFC 3986, Sections 2 and 3.4.
+ *
+ * As an example, if a value in a key/value pair of the query string should
+ * include an ampersand ("&") not intended as a delimiter between values,
+ * that value MUST be passed in encoded form (e.g., "%26") to the instance.
+ *
+ * @see https://tools.ietf.org/html/rfc3986#section-2
+ * @see https://tools.ietf.org/html/rfc3986#section-3.4
+ * @return string The URI query string.
+ */
+ public function getQuery(): string;
+
+ /**
+ * Retrieve the fragment component of the URI.
+ *
+ * If no fragment is present, this method MUST return an empty string.
+ *
+ * The leading "#" character is not part of the fragment and MUST NOT be
+ * added.
+ *
+ * The value returned MUST be percent-encoded, but MUST NOT double-encode
+ * any characters. To determine what characters to encode, please refer to
+ * RFC 3986, Sections 2 and 3.5.
+ *
+ * @see https://tools.ietf.org/html/rfc3986#section-2
+ * @see https://tools.ietf.org/html/rfc3986#section-3.5
+ * @return string The URI fragment.
+ */
+ public function getFragment(): string;
+
+ /**
+ * Return an instance with the specified scheme.
+ *
+ * This method MUST retain the state of the current instance, and return
+ * an instance that contains the specified scheme.
+ *
+ * Implementations MUST support the schemes "http" and "https" case
+ * insensitively, and MAY accommodate other schemes if required.
+ *
+ * An empty scheme is equivalent to removing the scheme.
+ *
+ * @param string $scheme The scheme to use with the new instance.
+ * @return static A new instance with the specified scheme.
+ * @throws \InvalidArgumentException for invalid or unsupported schemes.
+ */
+ public function withScheme(string $scheme): UriInterface;
+
+ /**
+ * Return an instance with the specified user information.
+ *
+ * This method MUST retain the state of the current instance, and return
+ * an instance that contains the specified user information.
+ *
+ * Password is optional, but the user information MUST include the
+ * user; an empty string for the user is equivalent to removing user
+ * information.
+ *
+ * @param string $user The user name to use for authority.
+ * @param null|string $password The password associated with $user.
+ * @return static A new instance with the specified user information.
+ */
+ public function withUserInfo(string $user, ?string $password = null): UriInterface;
+
+ /**
+ * Return an instance with the specified host.
+ *
+ * This method MUST retain the state of the current instance, and return
+ * an instance that contains the specified host.
+ *
+ * An empty host value is equivalent to removing the host.
+ *
+ * @param string $host The hostname to use with the new instance.
+ * @return static A new instance with the specified host.
+ * @throws \InvalidArgumentException for invalid hostnames.
+ */
+ public function withHost(string $host): UriInterface;
+
+ /**
+ * Return an instance with the specified port.
+ *
+ * This method MUST retain the state of the current instance, and return
+ * an instance that contains the specified port.
+ *
+ * Implementations MUST raise an exception for ports outside the
+ * established TCP and UDP port ranges.
+ *
+ * A null value provided for the port is equivalent to removing the port
+ * information.
+ *
+ * @param null|int $port The port to use with the new instance; a null value
+ * removes the port information.
+ * @return static A new instance with the specified port.
+ * @throws \InvalidArgumentException for invalid ports.
+ */
+ public function withPort(?int $port): UriInterface;
+
+ /**
+ * Return an instance with the specified path.
+ *
+ * This method MUST retain the state of the current instance, and return
+ * an instance that contains the specified path.
+ *
+ * The path can either be empty or absolute (starting with a slash) or
+ * rootless (not starting with a slash). Implementations MUST support all
+ * three syntaxes.
+ *
+ * If the path is intended to be domain-relative rather than path relative then
+ * it must begin with a slash ("/"). Paths not starting with a slash ("/")
+ * are assumed to be relative to some base path known to the application or
+ * consumer.
+ *
+ * Users can provide both encoded and decoded path characters.
+ * Implementations ensure the correct encoding as outlined in getPath().
+ *
+ * @param string $path The path to use with the new instance.
+ * @return static A new instance with the specified path.
+ * @throws \InvalidArgumentException for invalid paths.
+ */
+ public function withPath(string $path): UriInterface;
+
+ /**
+ * Return an instance with the specified query string.
+ *
+ * This method MUST retain the state of the current instance, and return
+ * an instance that contains the specified query string.
+ *
+ * Users can provide both encoded and decoded query characters.
+ * Implementations ensure the correct encoding as outlined in getQuery().
+ *
+ * An empty query string value is equivalent to removing the query string.
+ *
+ * @param string $query The query string to use with the new instance.
+ * @return static A new instance with the specified query string.
+ * @throws \InvalidArgumentException for invalid query strings.
+ */
+ public function withQuery(string $query): UriInterface;
+
+ /**
+ * Return an instance with the specified URI fragment.
+ *
+ * This method MUST retain the state of the current instance, and return
+ * an instance that contains the specified URI fragment.
+ *
+ * Users can provide both encoded and decoded fragment characters.
+ * Implementations ensure the correct encoding as outlined in getFragment().
+ *
+ * An empty fragment value is equivalent to removing the fragment.
+ *
+ * @param string $fragment The fragment to use with the new instance.
+ * @return static A new instance with the specified fragment.
+ */
+ public function withFragment(string $fragment): UriInterface;
+
+ /**
+ * Return the string representation as a URI reference.
+ *
+ * Depending on which components of the URI are present, the resulting
+ * string is either a full URI or relative reference according to RFC 3986,
+ * Section 4.1. The method concatenates the various components of the URI,
+ * using the appropriate delimiters:
+ *
+ * - If a scheme is present, it MUST be suffixed by ":".
+ * - If an authority is present, it MUST be prefixed by "//".
+ * - The path can be concatenated without delimiters. But there are two
+ * cases where the path has to be adjusted to make the URI reference
+ * valid as PHP does not allow to throw an exception in __toString():
+ * - If the path is rootless and an authority is present, the path MUST
+ * be prefixed by "/".
+ * - If the path is starting with more than one "/" and no authority is
+ * present, the starting slashes MUST be reduced to one.
+ * - If a query is present, it MUST be prefixed by "?".
+ * - If a fragment is present, it MUST be prefixed by "#".
+ *
+ * @see http://tools.ietf.org/html/rfc3986#section-4.1
+ * @return string
+ */
+ public function __toString(): string;
+}
diff --git a/vendor/ralouphie/getallheaders/LICENSE b/vendor/ralouphie/getallheaders/LICENSE
new file mode 100644
index 0000000..be5540c
--- /dev/null
+++ b/vendor/ralouphie/getallheaders/LICENSE
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) 2014 Ralph Khattar
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/vendor/ralouphie/getallheaders/README.md b/vendor/ralouphie/getallheaders/README.md
new file mode 100644
index 0000000..9430d76
--- /dev/null
+++ b/vendor/ralouphie/getallheaders/README.md
@@ -0,0 +1,27 @@
+getallheaders
+=============
+
+PHP `getallheaders()` polyfill. Compatible with PHP >= 5.3.
+
+[![Build Status](https://travis-ci.org/ralouphie/getallheaders.svg?branch=master)](https://travis-ci.org/ralouphie/getallheaders)
+[![Coverage Status](https://coveralls.io/repos/ralouphie/getallheaders/badge.png?branch=master)](https://coveralls.io/r/ralouphie/getallheaders?branch=master)
+[![Latest Stable Version](https://poser.pugx.org/ralouphie/getallheaders/v/stable.png)](https://packagist.org/packages/ralouphie/getallheaders)
+[![Latest Unstable Version](https://poser.pugx.org/ralouphie/getallheaders/v/unstable.png)](https://packagist.org/packages/ralouphie/getallheaders)
+[![License](https://poser.pugx.org/ralouphie/getallheaders/license.png)](https://packagist.org/packages/ralouphie/getallheaders)
+
+
+This is a simple polyfill for [`getallheaders()`](http://www.php.net/manual/en/function.getallheaders.php).
+
+## Install
+
+For PHP version **`>= 5.6`**:
+
+```
+composer require ralouphie/getallheaders
+```
+
+For PHP version **`< 5.6`**:
+
+```
+composer require ralouphie/getallheaders "^2"
+```
diff --git a/vendor/ralouphie/getallheaders/composer.json b/vendor/ralouphie/getallheaders/composer.json
new file mode 100644
index 0000000..de8ce62
--- /dev/null
+++ b/vendor/ralouphie/getallheaders/composer.json
@@ -0,0 +1,26 @@
+{
+ "name": "ralouphie/getallheaders",
+ "description": "A polyfill for getallheaders.",
+ "license": "MIT",
+ "authors": [
+ {
+ "name": "Ralph Khattar",
+ "email": "ralph.khattar@gmail.com"
+ }
+ ],
+ "require": {
+ "php": ">=5.6"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^5 || ^6.5",
+ "php-coveralls/php-coveralls": "^2.1"
+ },
+ "autoload": {
+ "files": ["src/getallheaders.php"]
+ },
+ "autoload-dev": {
+ "psr-4": {
+ "getallheaders\\Tests\\": "tests/"
+ }
+ }
+}
diff --git a/vendor/ralouphie/getallheaders/src/getallheaders.php b/vendor/ralouphie/getallheaders/src/getallheaders.php
new file mode 100644
index 0000000..c7285a5
--- /dev/null
+++ b/vendor/ralouphie/getallheaders/src/getallheaders.php
@@ -0,0 +1,46 @@
+ 'Content-Type',
+ 'CONTENT_LENGTH' => 'Content-Length',
+ 'CONTENT_MD5' => 'Content-Md5',
+ );
+
+ foreach ($_SERVER as $key => $value) {
+ if (substr($key, 0, 5) === 'HTTP_') {
+ $key = substr($key, 5);
+ if (!isset($copy_server[$key]) || !isset($_SERVER[$key])) {
+ $key = str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', $key))));
+ $headers[$key] = $value;
+ }
+ } elseif (isset($copy_server[$key])) {
+ $headers[$copy_server[$key]] = $value;
+ }
+ }
+
+ if (!isset($headers['Authorization'])) {
+ if (isset($_SERVER['REDIRECT_HTTP_AUTHORIZATION'])) {
+ $headers['Authorization'] = $_SERVER['REDIRECT_HTTP_AUTHORIZATION'];
+ } elseif (isset($_SERVER['PHP_AUTH_USER'])) {
+ $basic_pass = isset($_SERVER['PHP_AUTH_PW']) ? $_SERVER['PHP_AUTH_PW'] : '';
+ $headers['Authorization'] = 'Basic ' . base64_encode($_SERVER['PHP_AUTH_USER'] . ':' . $basic_pass);
+ } elseif (isset($_SERVER['PHP_AUTH_DIGEST'])) {
+ $headers['Authorization'] = $_SERVER['PHP_AUTH_DIGEST'];
+ }
+ }
+
+ return $headers;
+ }
+
+}
diff --git a/vendor/symfony/deprecation-contracts/CHANGELOG.md b/vendor/symfony/deprecation-contracts/CHANGELOG.md
new file mode 100644
index 0000000..7932e26
--- /dev/null
+++ b/vendor/symfony/deprecation-contracts/CHANGELOG.md
@@ -0,0 +1,5 @@
+CHANGELOG
+=========
+
+The changelog is maintained for all Symfony contracts at the following URL:
+https://github.com/symfony/contracts/blob/main/CHANGELOG.md
diff --git a/vendor/symfony/deprecation-contracts/LICENSE b/vendor/symfony/deprecation-contracts/LICENSE
new file mode 100644
index 0000000..0ed3a24
--- /dev/null
+++ b/vendor/symfony/deprecation-contracts/LICENSE
@@ -0,0 +1,19 @@
+Copyright (c) 2020-present Fabien Potencier
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is furnished
+to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/vendor/symfony/deprecation-contracts/README.md b/vendor/symfony/deprecation-contracts/README.md
new file mode 100644
index 0000000..9814864
--- /dev/null
+++ b/vendor/symfony/deprecation-contracts/README.md
@@ -0,0 +1,26 @@
+Symfony Deprecation Contracts
+=============================
+
+A generic function and convention to trigger deprecation notices.
+
+This package provides a single global function named `trigger_deprecation()` that triggers silenced deprecation notices.
+
+By using a custom PHP error handler such as the one provided by the Symfony ErrorHandler component,
+the triggered deprecations can be caught and logged for later discovery, both on dev and prod environments.
+
+The function requires at least 3 arguments:
+ - the name of the Composer package that is triggering the deprecation
+ - the version of the package that introduced the deprecation
+ - the message of the deprecation
+ - more arguments can be provided: they will be inserted in the message using `printf()` formatting
+
+Example:
+```php
+trigger_deprecation('symfony/blockchain', '8.9', 'Using "%s" is deprecated, use "%s" instead.', 'bitcoin', 'fabcoin');
+```
+
+This will generate the following message:
+`Since symfony/blockchain 8.9: Using "bitcoin" is deprecated, use "fabcoin" instead.`
+
+While not recommended, the deprecation notices can be completely ignored by declaring an empty
+`function trigger_deprecation() {}` in your application.
diff --git a/vendor/symfony/deprecation-contracts/composer.json b/vendor/symfony/deprecation-contracts/composer.json
new file mode 100644
index 0000000..c6d02d8
--- /dev/null
+++ b/vendor/symfony/deprecation-contracts/composer.json
@@ -0,0 +1,35 @@
+{
+ "name": "symfony/deprecation-contracts",
+ "type": "library",
+ "description": "A generic function and convention to trigger deprecation notices",
+ "homepage": "https://symfony.com",
+ "license": "MIT",
+ "authors": [
+ {
+ "name": "Nicolas Grekas",
+ "email": "p@tchwork.com"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
+ }
+ ],
+ "require": {
+ "php": ">=8.1"
+ },
+ "autoload": {
+ "files": [
+ "function.php"
+ ]
+ },
+ "minimum-stability": "dev",
+ "extra": {
+ "branch-alias": {
+ "dev-main": "3.4-dev"
+ },
+ "thanks": {
+ "name": "symfony/contracts",
+ "url": "https://github.com/symfony/contracts"
+ }
+ }
+}
diff --git a/vendor/symfony/deprecation-contracts/function.php b/vendor/symfony/deprecation-contracts/function.php
new file mode 100644
index 0000000..2d56512
--- /dev/null
+++ b/vendor/symfony/deprecation-contracts/function.php
@@ -0,0 +1,27 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+if (!function_exists('trigger_deprecation')) {
+ /**
+ * Triggers a silenced deprecation notice.
+ *
+ * @param string $package The name of the Composer package that is triggering the deprecation
+ * @param string $version The version of the package that introduced the deprecation
+ * @param string $message The message of the deprecation
+ * @param mixed ...$args Values to insert in the message using printf() formatting
+ *
+ * @author Nicolas Grekas
+ */
+ function trigger_deprecation(string $package, string $version, string $message, mixed ...$args): void
+ {
+ @trigger_error(($package || $version ? "Since $package $version: " : '').($args ? vsprintf($message, $args) : $message), \E_USER_DEPRECATED);
+ }
+}
diff --git a/vendor/symfony/polyfill-php73/LICENSE b/vendor/symfony/polyfill-php73/LICENSE
new file mode 100644
index 0000000..7536cae
--- /dev/null
+++ b/vendor/symfony/polyfill-php73/LICENSE
@@ -0,0 +1,19 @@
+Copyright (c) 2018-present Fabien Potencier
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is furnished
+to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/vendor/symfony/polyfill-php73/Php73.php b/vendor/symfony/polyfill-php73/Php73.php
new file mode 100644
index 0000000..65c35a6
--- /dev/null
+++ b/vendor/symfony/polyfill-php73/Php73.php
@@ -0,0 +1,43 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Polyfill\Php73;
+
+/**
+ * @author Gabriel Caruso
+ * @author Ion Bazan
+ *
+ * @internal
+ */
+final class Php73
+{
+ public static $startAt = 1533462603;
+
+ /**
+ * @param bool $asNum
+ *
+ * @return array|float|int
+ */
+ public static function hrtime($asNum = false)
+ {
+ $ns = microtime(false);
+ $s = substr($ns, 11) - self::$startAt;
+ $ns = 1E9 * (float) $ns;
+
+ if ($asNum) {
+ $ns += $s * 1E9;
+
+ return \PHP_INT_SIZE === 4 ? $ns : (int) $ns;
+ }
+
+ return [$s, (int) $ns];
+ }
+}
diff --git a/vendor/symfony/polyfill-php73/README.md b/vendor/symfony/polyfill-php73/README.md
new file mode 100644
index 0000000..032fafb
--- /dev/null
+++ b/vendor/symfony/polyfill-php73/README.md
@@ -0,0 +1,18 @@
+Symfony Polyfill / Php73
+========================
+
+This component provides functions added to PHP 7.3 core:
+
+- [`array_key_first`](https://php.net/array_key_first)
+- [`array_key_last`](https://php.net/array_key_last)
+- [`hrtime`](https://php.net/function.hrtime)
+- [`is_countable`](https://php.net/is_countable)
+- [`JsonException`](https://php.net/JsonException)
+
+More information can be found in the
+[main Polyfill README](https://github.com/symfony/polyfill/blob/main/README.md).
+
+License
+=======
+
+This library is released under the [MIT license](LICENSE).
diff --git a/vendor/symfony/polyfill-php73/Resources/stubs/JsonException.php b/vendor/symfony/polyfill-php73/Resources/stubs/JsonException.php
new file mode 100644
index 0000000..f06d6c2
--- /dev/null
+++ b/vendor/symfony/polyfill-php73/Resources/stubs/JsonException.php
@@ -0,0 +1,16 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+if (\PHP_VERSION_ID < 70300) {
+ class JsonException extends Exception
+ {
+ }
+}
diff --git a/vendor/symfony/polyfill-php73/bootstrap.php b/vendor/symfony/polyfill-php73/bootstrap.php
new file mode 100644
index 0000000..d6b2153
--- /dev/null
+++ b/vendor/symfony/polyfill-php73/bootstrap.php
@@ -0,0 +1,31 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+use Symfony\Polyfill\Php73 as p;
+
+if (\PHP_VERSION_ID >= 70300) {
+ return;
+}
+
+if (!function_exists('is_countable')) {
+ function is_countable($value) { return is_array($value) || $value instanceof Countable || $value instanceof ResourceBundle || $value instanceof SimpleXmlElement; }
+}
+if (!function_exists('hrtime')) {
+ require_once __DIR__.'/Php73.php';
+ p\Php73::$startAt = (int) microtime(true);
+ function hrtime($as_number = false) { return p\Php73::hrtime($as_number); }
+}
+if (!function_exists('array_key_first')) {
+ function array_key_first(array $array) { foreach ($array as $key => $value) { return $key; } }
+}
+if (!function_exists('array_key_last')) {
+ function array_key_last(array $array) { return key(array_slice($array, -1, 1, true)); }
+}
diff --git a/vendor/symfony/polyfill-php73/composer.json b/vendor/symfony/polyfill-php73/composer.json
new file mode 100644
index 0000000..48295ef
--- /dev/null
+++ b/vendor/symfony/polyfill-php73/composer.json
@@ -0,0 +1,36 @@
+{
+ "name": "symfony/polyfill-php73",
+ "type": "library",
+ "description": "Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions",
+ "keywords": ["polyfill", "shim", "compatibility", "portable"],
+ "homepage": "https://symfony.com",
+ "license": "MIT",
+ "authors": [
+ {
+ "name": "Nicolas Grekas",
+ "email": "p@tchwork.com"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
+ }
+ ],
+ "require": {
+ "php": ">=7.1"
+ },
+ "autoload": {
+ "psr-4": { "Symfony\\Polyfill\\Php73\\": "" },
+ "files": [ "bootstrap.php" ],
+ "classmap": [ "Resources/stubs" ]
+ },
+ "minimum-stability": "dev",
+ "extra": {
+ "branch-alias": {
+ "dev-main": "1.28-dev"
+ },
+ "thanks": {
+ "name": "symfony/polyfill",
+ "url": "https://github.com/symfony/polyfill"
+ }
+ }
+}