HEX
Server: LiteSpeed
System: Linux eko108.isimtescil.net 4.18.0-477.21.1.lve.1.el8.x86_64 #1 SMP Tue Sep 5 23:08:35 UTC 2023 x86_64
User: uyarreklamcomtr (11202)
PHP: 7.4.33
Disabled: opcache_get_status
Upload Files
File: /var/www/vhosts/uyarreklam.com.tr/httpdocs/Exception.tar
ArgumentCount.php000064400000002664151537426020010065 0ustar00<?php

namespace WpOrg\Requests\Exception;

use WpOrg\Requests\Exception;

/**
 * Exception for when an incorrect number of arguments are passed to a method.
 *
 * Typically, this exception is used when all arguments for a method are optional,
 * but certain arguments need to be passed together, i.e. a method which can be called
 * with no arguments or with two arguments, but not with one argument.
 *
 * Along the same lines, this exception is also used if a method expects an array
 * with a certain number of elements and the provided number of elements does not comply.
 *
 * @package Requests\Exceptions
 * @since   2.0.0
 */
final class ArgumentCount extends Exception {

	/**
	 * Create a new argument count exception with a standardized text.
	 *
	 * @param string $expected The argument count expected as a phrase.
	 *                         For example: `at least 2 arguments` or `exactly 1 argument`.
	 * @param int    $received The actual argument count received.
	 * @param string $type     Exception type.
	 *
	 * @return \WpOrg\Requests\Exception\ArgumentCount
	 */
	public static function create($expected, $received, $type) {
		// phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_debug_backtrace
		$stack = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 2);

		return new self(
			sprintf(
				'%s::%s() expects %s, %d given',
				$stack[1]['class'],
				$stack[1]['function'],
				$expected,
				$received
			),
			$type
		);
	}
}
Http/Status304.php000064400000000714151537426020007715 0ustar00<?php
/**
 * Exception for 304 Not Modified responses
 *
 * @package Requests\Exceptions
 */

namespace WpOrg\Requests\Exception\Http;

use WpOrg\Requests\Exception\Http;

/**
 * Exception for 304 Not Modified responses
 *
 * @package Requests\Exceptions
 */
final class Status304 extends Http {
	/**
	 * HTTP status code
	 *
	 * @var integer
	 */
	protected $code = 304;

	/**
	 * Reason phrase
	 *
	 * @var string
	 */
	protected $reason = 'Not Modified';
}
Http/Status305.php000064400000000703151537426020007714 0ustar00<?php
/**
 * Exception for 305 Use Proxy responses
 *
 * @package Requests\Exceptions
 */

namespace WpOrg\Requests\Exception\Http;

use WpOrg\Requests\Exception\Http;

/**
 * Exception for 305 Use Proxy responses
 *
 * @package Requests\Exceptions
 */
final class Status305 extends Http {
	/**
	 * HTTP status code
	 *
	 * @var integer
	 */
	protected $code = 305;

	/**
	 * Reason phrase
	 *
	 * @var string
	 */
	protected $reason = 'Use Proxy';
}
Http/Status306.php000064400000000714151537426020007717 0ustar00<?php
/**
 * Exception for 306 Switch Proxy responses
 *
 * @package Requests\Exceptions
 */

namespace WpOrg\Requests\Exception\Http;

use WpOrg\Requests\Exception\Http;

/**
 * Exception for 306 Switch Proxy responses
 *
 * @package Requests\Exceptions
 */
final class Status306 extends Http {
	/**
	 * HTTP status code
	 *
	 * @var integer
	 */
	protected $code = 306;

	/**
	 * Reason phrase
	 *
	 * @var string
	 */
	protected $reason = 'Switch Proxy';
}
Http/Status400.php000064400000000711151537426020007707 0ustar00<?php
/**
 * Exception for 400 Bad Request responses
 *
 * @package Requests\Exceptions
 */

namespace WpOrg\Requests\Exception\Http;

use WpOrg\Requests\Exception\Http;

/**
 * Exception for 400 Bad Request responses
 *
 * @package Requests\Exceptions
 */
final class Status400 extends Http {
	/**
	 * HTTP status code
	 *
	 * @var integer
	 */
	protected $code = 400;

	/**
	 * Reason phrase
	 *
	 * @var string
	 */
	protected $reason = 'Bad Request';
}
Http/Status401.php000064400000000714151537426020007713 0ustar00<?php
/**
 * Exception for 401 Unauthorized responses
 *
 * @package Requests\Exceptions
 */

namespace WpOrg\Requests\Exception\Http;

use WpOrg\Requests\Exception\Http;

/**
 * Exception for 401 Unauthorized responses
 *
 * @package Requests\Exceptions
 */
final class Status401 extends Http {
	/**
	 * HTTP status code
	 *
	 * @var integer
	 */
	protected $code = 401;

	/**
	 * Reason phrase
	 *
	 * @var string
	 */
	protected $reason = 'Unauthorized';
}
Http/Status402.php000064400000000730151537426020007712 0ustar00<?php
/**
 * Exception for 402 Payment Required responses
 *
 * @package Requests\Exceptions
 */

namespace WpOrg\Requests\Exception\Http;

use WpOrg\Requests\Exception\Http;

/**
 * Exception for 402 Payment Required responses
 *
 * @package Requests\Exceptions
 */
final class Status402 extends Http {
	/**
	 * HTTP status code
	 *
	 * @var integer
	 */
	protected $code = 402;

	/**
	 * Reason phrase
	 *
	 * @var string
	 */
	protected $reason = 'Payment Required';
}
Http/Status403.php000064400000000703151537426020007713 0ustar00<?php
/**
 * Exception for 403 Forbidden responses
 *
 * @package Requests\Exceptions
 */

namespace WpOrg\Requests\Exception\Http;

use WpOrg\Requests\Exception\Http;

/**
 * Exception for 403 Forbidden responses
 *
 * @package Requests\Exceptions
 */
final class Status403 extends Http {
	/**
	 * HTTP status code
	 *
	 * @var integer
	 */
	protected $code = 403;

	/**
	 * Reason phrase
	 *
	 * @var string
	 */
	protected $reason = 'Forbidden';
}
Http/Status404.php000064400000000703151537426020007714 0ustar00<?php
/**
 * Exception for 404 Not Found responses
 *
 * @package Requests\Exceptions
 */

namespace WpOrg\Requests\Exception\Http;

use WpOrg\Requests\Exception\Http;

/**
 * Exception for 404 Not Found responses
 *
 * @package Requests\Exceptions
 */
final class Status404 extends Http {
	/**
	 * HTTP status code
	 *
	 * @var integer
	 */
	protected $code = 404;

	/**
	 * Reason phrase
	 *
	 * @var string
	 */
	protected $reason = 'Not Found';
}
Http/Status405.php000064400000000736151537426020007723 0ustar00<?php
/**
 * Exception for 405 Method Not Allowed responses
 *
 * @package Requests\Exceptions
 */

namespace WpOrg\Requests\Exception\Http;

use WpOrg\Requests\Exception\Http;

/**
 * Exception for 405 Method Not Allowed responses
 *
 * @package Requests\Exceptions
 */
final class Status405 extends Http {
	/**
	 * HTTP status code
	 *
	 * @var integer
	 */
	protected $code = 405;

	/**
	 * Reason phrase
	 *
	 * @var string
	 */
	protected $reason = 'Method Not Allowed';
}
Http/Status406.php000064400000000722151537426020007717 0ustar00<?php
/**
 * Exception for 406 Not Acceptable responses
 *
 * @package Requests\Exceptions
 */

namespace WpOrg\Requests\Exception\Http;

use WpOrg\Requests\Exception\Http;

/**
 * Exception for 406 Not Acceptable responses
 *
 * @package Requests\Exceptions
 */
final class Status406 extends Http {
	/**
	 * HTTP status code
	 *
	 * @var integer
	 */
	protected $code = 406;

	/**
	 * Reason phrase
	 *
	 * @var string
	 */
	protected $reason = 'Not Acceptable';
}
Http/Status407.php000064400000000777151537426020007732 0ustar00<?php
/**
 * Exception for 407 Proxy Authentication Required responses
 *
 * @package Requests\Exceptions
 */

namespace WpOrg\Requests\Exception\Http;

use WpOrg\Requests\Exception\Http;

/**
 * Exception for 407 Proxy Authentication Required responses
 *
 * @package Requests\Exceptions
 */
final class Status407 extends Http {
	/**
	 * HTTP status code
	 *
	 * @var integer
	 */
	protected $code = 407;

	/**
	 * Reason phrase
	 *
	 * @var string
	 */
	protected $reason = 'Proxy Authentication Required';
}
Http/Status408.php000064400000000725151537426020007724 0ustar00<?php
/**
 * Exception for 408 Request Timeout responses
 *
 * @package Requests\Exceptions
 */

namespace WpOrg\Requests\Exception\Http;

use WpOrg\Requests\Exception\Http;

/**
 * Exception for 408 Request Timeout responses
 *
 * @package Requests\Exceptions
 */
final class Status408 extends Http {
	/**
	 * HTTP status code
	 *
	 * @var integer
	 */
	protected $code = 408;

	/**
	 * Reason phrase
	 *
	 * @var string
	 */
	protected $reason = 'Request Timeout';
}
Http/Status409.php000064400000000700151537426020007716 0ustar00<?php
/**
 * Exception for 409 Conflict responses
 *
 * @package Requests\Exceptions
 */

namespace WpOrg\Requests\Exception\Http;

use WpOrg\Requests\Exception\Http;

/**
 * Exception for 409 Conflict responses
 *
 * @package Requests\Exceptions
 */
final class Status409 extends Http {
	/**
	 * HTTP status code
	 *
	 * @var integer
	 */
	protected $code = 409;

	/**
	 * Reason phrase
	 *
	 * @var string
	 */
	protected $reason = 'Conflict';
}
Http/Status410.php000064400000000664151537426020007717 0ustar00<?php
/**
 * Exception for 410 Gone responses
 *
 * @package Requests\Exceptions
 */

namespace WpOrg\Requests\Exception\Http;

use WpOrg\Requests\Exception\Http;

/**
 * Exception for 410 Gone responses
 *
 * @package Requests\Exceptions
 */
final class Status410 extends Http {
	/**
	 * HTTP status code
	 *
	 * @var integer
	 */
	protected $code = 410;

	/**
	 * Reason phrase
	 *
	 * @var string
	 */
	protected $reason = 'Gone';
}
Http/Status411.php000064400000000725151537426020007716 0ustar00<?php
/**
 * Exception for 411 Length Required responses
 *
 * @package Requests\Exceptions
 */

namespace WpOrg\Requests\Exception\Http;

use WpOrg\Requests\Exception\Http;

/**
 * Exception for 411 Length Required responses
 *
 * @package Requests\Exceptions
 */
final class Status411 extends Http {
	/**
	 * HTTP status code
	 *
	 * @var integer
	 */
	protected $code = 411;

	/**
	 * Reason phrase
	 *
	 * @var string
	 */
	protected $reason = 'Length Required';
}
Http/Status412.php000064400000000741151537426020007715 0ustar00<?php
/**
 * Exception for 412 Precondition Failed responses
 *
 * @package Requests\Exceptions
 */

namespace WpOrg\Requests\Exception\Http;

use WpOrg\Requests\Exception\Http;

/**
 * Exception for 412 Precondition Failed responses
 *
 * @package Requests\Exceptions
 */
final class Status412 extends Http {
	/**
	 * HTTP status code
	 *
	 * @var integer
	 */
	protected $code = 412;

	/**
	 * Reason phrase
	 *
	 * @var string
	 */
	protected $reason = 'Precondition Failed';
}
Http/Status413.php000064400000000760151537426020007717 0ustar00<?php
/**
 * Exception for 413 Request Entity Too Large responses
 *
 * @package Requests\Exceptions
 */

namespace WpOrg\Requests\Exception\Http;

use WpOrg\Requests\Exception\Http;

/**
 * Exception for 413 Request Entity Too Large responses
 *
 * @package Requests\Exceptions
 */
final class Status413 extends Http {
	/**
	 * HTTP status code
	 *
	 * @var integer
	 */
	protected $code = 413;

	/**
	 * Reason phrase
	 *
	 * @var string
	 */
	protected $reason = 'Request Entity Too Large';
}
Http/Status414.php000064400000000747151537426020007725 0ustar00<?php
/**
 * Exception for 414 Request-URI Too Large responses
 *
 * @package Requests\Exceptions
 */

namespace WpOrg\Requests\Exception\Http;

use WpOrg\Requests\Exception\Http;

/**
 * Exception for 414 Request-URI Too Large responses
 *
 * @package Requests\Exceptions
 */
final class Status414 extends Http {
	/**
	 * HTTP status code
	 *
	 * @var integer
	 */
	protected $code = 414;

	/**
	 * Reason phrase
	 *
	 * @var string
	 */
	protected $reason = 'Request-URI Too Large';
}
Http/Status415.php000064400000000752151537426020007722 0ustar00<?php
/**
 * Exception for 415 Unsupported Media Type responses
 *
 * @package Requests\Exceptions
 */

namespace WpOrg\Requests\Exception\Http;

use WpOrg\Requests\Exception\Http;

/**
 * Exception for 415 Unsupported Media Type responses
 *
 * @package Requests\Exceptions
 */
final class Status415 extends Http {
	/**
	 * HTTP status code
	 *
	 * @var integer
	 */
	protected $code = 415;

	/**
	 * Reason phrase
	 *
	 * @var string
	 */
	protected $reason = 'Unsupported Media Type';
}
Http/Status416.php000064400000001005151537426020007713 0ustar00<?php
/**
 * Exception for 416 Requested Range Not Satisfiable responses
 *
 * @package Requests\Exceptions
 */

namespace WpOrg\Requests\Exception\Http;

use WpOrg\Requests\Exception\Http;

/**
 * Exception for 416 Requested Range Not Satisfiable responses
 *
 * @package Requests\Exceptions
 */
final class Status416 extends Http {
	/**
	 * HTTP status code
	 *
	 * @var integer
	 */
	protected $code = 416;

	/**
	 * Reason phrase
	 *
	 * @var string
	 */
	protected $reason = 'Requested Range Not Satisfiable';
}
Http/Status417.php000064400000000736151537426020007726 0ustar00<?php
/**
 * Exception for 417 Expectation Failed responses
 *
 * @package Requests\Exceptions
 */

namespace WpOrg\Requests\Exception\Http;

use WpOrg\Requests\Exception\Http;

/**
 * Exception for 417 Expectation Failed responses
 *
 * @package Requests\Exceptions
 */
final class Status417 extends Http {
	/**
	 * HTTP status code
	 *
	 * @var integer
	 */
	protected $code = 417;

	/**
	 * Reason phrase
	 *
	 * @var string
	 */
	protected $reason = 'Expectation Failed';
}
Http/Status418.php000064400000001054151537426020007721 0ustar00<?php
/**
 * Exception for 418 I'm A Teapot responses
 *
 * @link https://tools.ietf.org/html/rfc2324
 *
 * @package Requests\Exceptions
 */

namespace WpOrg\Requests\Exception\Http;

use WpOrg\Requests\Exception\Http;

/**
 * Exception for 418 I'm A Teapot responses
 *
 * @link https://tools.ietf.org/html/rfc2324
 *
 * @package Requests\Exceptions
 */
final class Status418 extends Http {
	/**
	 * HTTP status code
	 *
	 * @var integer
	 */
	protected $code = 418;

	/**
	 * Reason phrase
	 *
	 * @var string
	 */
	protected $reason = "I'm A Teapot";
}
Http/Status428.php000064400000001107151537426020007721 0ustar00<?php
/**
 * Exception for 428 Precondition Required responses
 *
 * @link https://tools.ietf.org/html/rfc6585
 *
 * @package Requests\Exceptions
 */

namespace WpOrg\Requests\Exception\Http;

use WpOrg\Requests\Exception\Http;

/**
 * Exception for 428 Precondition Required responses
 *
 * @link https://tools.ietf.org/html/rfc6585
 *
 * @package Requests\Exceptions
 */
final class Status428 extends Http {
	/**
	 * HTTP status code
	 *
	 * @var integer
	 */
	protected $code = 428;

	/**
	 * Reason phrase
	 *
	 * @var string
	 */
	protected $reason = 'Precondition Required';
}
Http/Status429.php000064400000001163151537426020007724 0ustar00<?php
/**
 * Exception for 429 Too Many Requests responses
 *
 * @link https://tools.ietf.org/html/draft-nottingham-http-new-status-04
 *
 * @package Requests\Exceptions
 */

namespace WpOrg\Requests\Exception\Http;

use WpOrg\Requests\Exception\Http;

/**
 * Exception for 429 Too Many Requests responses
 *
 * @link https://tools.ietf.org/html/draft-nottingham-http-new-status-04
 *
 * @package Requests\Exceptions
 */
final class Status429 extends Http {
	/**
	 * HTTP status code
	 *
	 * @var integer
	 */
	protected $code = 429;

	/**
	 * Reason phrase
	 *
	 * @var string
	 */
	protected $reason = 'Too Many Requests';
}
Http/Status431.php000064400000001145151537426020007715 0ustar00<?php
/**
 * Exception for 431 Request Header Fields Too Large responses
 *
 * @link https://tools.ietf.org/html/rfc6585
 *
 * @package Requests\Exceptions
 */

namespace WpOrg\Requests\Exception\Http;

use WpOrg\Requests\Exception\Http;

/**
 * Exception for 431 Request Header Fields Too Large responses
 *
 * @link https://tools.ietf.org/html/rfc6585
 *
 * @package Requests\Exceptions
 */
final class Status431 extends Http {
	/**
	 * HTTP status code
	 *
	 * @var integer
	 */
	protected $code = 431;

	/**
	 * Reason phrase
	 *
	 * @var string
	 */
	protected $reason = 'Request Header Fields Too Large';
}
Http/Status500.php000064400000000747151537426020007721 0ustar00<?php
/**
 * Exception for 500 Internal Server Error responses
 *
 * @package Requests\Exceptions
 */

namespace WpOrg\Requests\Exception\Http;

use WpOrg\Requests\Exception\Http;

/**
 * Exception for 500 Internal Server Error responses
 *
 * @package Requests\Exceptions
 */
final class Status500 extends Http {
	/**
	 * HTTP status code
	 *
	 * @var integer
	 */
	protected $code = 500;

	/**
	 * Reason phrase
	 *
	 * @var string
	 */
	protected $reason = 'Internal Server Error';
}
Http/Status501.php000064400000000725151537426020007716 0ustar00<?php
/**
 * Exception for 501 Not Implemented responses
 *
 * @package Requests\Exceptions
 */

namespace WpOrg\Requests\Exception\Http;

use WpOrg\Requests\Exception\Http;

/**
 * Exception for 501 Not Implemented responses
 *
 * @package Requests\Exceptions
 */
final class Status501 extends Http {
	/**
	 * HTTP status code
	 *
	 * @var integer
	 */
	protected $code = 501;

	/**
	 * Reason phrase
	 *
	 * @var string
	 */
	protected $reason = 'Not Implemented';
}
Http/Status502.php000064400000000711151537426020007712 0ustar00<?php
/**
 * Exception for 502 Bad Gateway responses
 *
 * @package Requests\Exceptions
 */

namespace WpOrg\Requests\Exception\Http;

use WpOrg\Requests\Exception\Http;

/**
 * Exception for 502 Bad Gateway responses
 *
 * @package Requests\Exceptions
 */
final class Status502 extends Http {
	/**
	 * HTTP status code
	 *
	 * @var integer
	 */
	protected $code = 502;

	/**
	 * Reason phrase
	 *
	 * @var string
	 */
	protected $reason = 'Bad Gateway';
}
Http/Status503.php000064400000000741151537426020007716 0ustar00<?php
/**
 * Exception for 503 Service Unavailable responses
 *
 * @package Requests\Exceptions
 */

namespace WpOrg\Requests\Exception\Http;

use WpOrg\Requests\Exception\Http;

/**
 * Exception for 503 Service Unavailable responses
 *
 * @package Requests\Exceptions
 */
final class Status503 extends Http {
	/**
	 * HTTP status code
	 *
	 * @var integer
	 */
	protected $code = 503;

	/**
	 * Reason phrase
	 *
	 * @var string
	 */
	protected $reason = 'Service Unavailable';
}
Http/Status504.php000064400000000725151537426020007721 0ustar00<?php
/**
 * Exception for 504 Gateway Timeout responses
 *
 * @package Requests\Exceptions
 */

namespace WpOrg\Requests\Exception\Http;

use WpOrg\Requests\Exception\Http;

/**
 * Exception for 504 Gateway Timeout responses
 *
 * @package Requests\Exceptions
 */
final class Status504 extends Http {
	/**
	 * HTTP status code
	 *
	 * @var integer
	 */
	protected $code = 504;

	/**
	 * Reason phrase
	 *
	 * @var string
	 */
	protected $reason = 'Gateway Timeout';
}
Http/Status505.php000064400000000766151537426020007727 0ustar00<?php
/**
 * Exception for 505 HTTP Version Not Supported responses
 *
 * @package Requests\Exceptions
 */

namespace WpOrg\Requests\Exception\Http;

use WpOrg\Requests\Exception\Http;

/**
 * Exception for 505 HTTP Version Not Supported responses
 *
 * @package Requests\Exceptions
 */
final class Status505 extends Http {
	/**
	 * HTTP status code
	 *
	 * @var integer
	 */
	protected $code = 505;

	/**
	 * Reason phrase
	 *
	 * @var string
	 */
	protected $reason = 'HTTP Version Not Supported';
}
Http/Status511.php000064400000001145151537426020007714 0ustar00<?php
/**
 * Exception for 511 Network Authentication Required responses
 *
 * @link https://tools.ietf.org/html/rfc6585
 *
 * @package Requests\Exceptions
 */

namespace WpOrg\Requests\Exception\Http;

use WpOrg\Requests\Exception\Http;

/**
 * Exception for 511 Network Authentication Required responses
 *
 * @link https://tools.ietf.org/html/rfc6585
 *
 * @package Requests\Exceptions
 */
final class Status511 extends Http {
	/**
	 * HTTP status code
	 *
	 * @var integer
	 */
	protected $code = 511;

	/**
	 * Reason phrase
	 *
	 * @var string
	 */
	protected $reason = 'Network Authentication Required';
}
Http/StatusUnknown.php000064400000001712151537426020011045 0ustar00<?php
/**
 * Exception for unknown status responses
 *
 * @package Requests\Exceptions
 */

namespace WpOrg\Requests\Exception\Http;

use WpOrg\Requests\Exception\Http;
use WpOrg\Requests\Response;

/**
 * Exception for unknown status responses
 *
 * @package Requests\Exceptions
 */
final class StatusUnknown extends Http {
	/**
	 * HTTP status code
	 *
	 * @var integer|bool Code if available, false if an error occurred
	 */
	protected $code = 0;

	/**
	 * Reason phrase
	 *
	 * @var string
	 */
	protected $reason = 'Unknown';

	/**
	 * Create a new exception
	 *
	 * If `$data` is an instance of {@see \WpOrg\Requests\Response}, uses the status
	 * code from it. Otherwise, sets as 0
	 *
	 * @param string|null $reason Reason phrase
	 * @param mixed $data Associated data
	 */
	public function __construct($reason = null, $data = null) {
		if ($data instanceof Response) {
			$this->code = (int) $data->status_code;
		}

		parent::__construct($reason, $data);
	}
}
Http.php000064400000003006151537426020006200 0ustar00<?php
/**
 * Exception based on HTTP response
 *
 * @package Requests\Exceptions
 */

namespace WpOrg\Requests\Exception;

use WpOrg\Requests\Exception;
use WpOrg\Requests\Exception\Http\StatusUnknown;

/**
 * Exception based on HTTP response
 *
 * @package Requests\Exceptions
 */
class Http extends Exception {
	/**
	 * HTTP status code
	 *
	 * @var integer
	 */
	protected $code = 0;

	/**
	 * Reason phrase
	 *
	 * @var string
	 */
	protected $reason = 'Unknown';

	/**
	 * Create a new exception
	 *
	 * There is no mechanism to pass in the status code, as this is set by the
	 * subclass used. Reason phrases can vary, however.
	 *
	 * @param string|null $reason Reason phrase
	 * @param mixed $data Associated data
	 */
	public function __construct($reason = null, $data = null) {
		if ($reason !== null) {
			$this->reason = $reason;
		}

		$message = sprintf('%d %s', $this->code, $this->reason);
		parent::__construct($message, 'httpresponse', $data, $this->code);
	}

	/**
	 * Get the status message.
	 *
	 * @return string
	 */
	public function getReason() {
		return $this->reason;
	}

	/**
	 * Get the correct exception class for a given error code
	 *
	 * @param int|bool $code HTTP status code, or false if unavailable
	 * @return string Exception class name to use
	 */
	public static function get_class($code) {
		if (!$code) {
			return StatusUnknown::class;
		}

		$class = sprintf('\WpOrg\Requests\Exception\Http\Status%d', $code);
		if (class_exists($class)) {
			return $class;
		}

		return StatusUnknown::class;
	}
}
InvalidArgument.php000064400000001425151537426020010355 0ustar00<?php
declare( strict_types=1 );

namespace Automattic\WooCommerce\GoogleListingsAndAds\Exception;

use InvalidArgumentException;

defined( 'ABSPATH' ) || exit;

/**
 * Class InvalidArgument
 *
 * @package Automattic\WooCommerce\GoogleListingsAndAds\Exception
 */
class InvalidArgument extends InvalidArgumentException implements GoogleListingsAndAdsException {

	/**
	 * Create a new instance of the exception when an argument value is not an object.
	 *
	 * @param string $name   The name of the argument.
	 * @param string $method The name of the method/function.
	 *
	 * @return static
	 */
	public static function not_object( string $name, string $method ) {
		return new static( sprintf( 'The argument "%s" provided to the function "%s" must be an object.', $name, $method ) );
	}
}
Transport/Curl.php000064400000002565151537426020010173 0ustar00<?php
/**
 * CURL Transport Exception.
 *
 * @package Requests\Exceptions
 */

namespace WpOrg\Requests\Exception\Transport;

use WpOrg\Requests\Exception\Transport;

/**
 * CURL Transport Exception.
 *
 * @package Requests\Exceptions
 */
final class Curl extends Transport {

	const EASY  = 'cURLEasy';
	const MULTI = 'cURLMulti';
	const SHARE = 'cURLShare';

	/**
	 * cURL error code
	 *
	 * @var integer
	 */
	protected $code = -1;

	/**
	 * Which type of cURL error
	 *
	 * EASY|MULTI|SHARE
	 *
	 * @var string
	 */
	protected $type = 'Unknown';

	/**
	 * Clear text error message
	 *
	 * @var string
	 */
	protected $reason = 'Unknown';

	/**
	 * Create a new exception.
	 *
	 * @param string $message Exception message.
	 * @param string $type    Exception type.
	 * @param mixed  $data    Associated data, if applicable.
	 * @param int    $code    Exception numerical code, if applicable.
	 */
	public function __construct($message, $type, $data = null, $code = 0) {
		if ($type !== null) {
			$this->type = $type;
		}

		if ($code !== null) {
			$this->code = (int) $code;
		}

		if ($message !== null) {
			$this->reason = $message;
		}

		$message = sprintf('%d %s', $this->code, $this->reason);
		parent::__construct($message, $this->type, $data, $this->code);
	}

	/**
	 * Get the error message.
	 *
	 * @return string
	 */
	public function getReason() {
		return $this->reason;
	}

}
Transport.php000064400000000364151537426020007261 0ustar00<?php
/**
 * Transport Exception
 *
 * @package Requests\Exceptions
 */

namespace WpOrg\Requests\Exception;

use WpOrg\Requests\Exception;

/**
 * Transport Exception
 *
 * @package Requests\Exceptions
 */
class Transport extends Exception {}
ExceptionInterface.php000064400000001123151545301320011030 0ustar00<?php

/*
 * This file is part of the Symfony package.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\CssSelector\Exception;

/**
 * Interface for exceptions.
 *
 * This component is a port of the Python cssselect library,
 * which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
 *
 * @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
 */
interface ExceptionInterface extends \Throwable
{
}
ExpressionErrorException.php000064400000001201151545301320012276 0ustar00<?php

/*
 * This file is part of the Symfony package.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\CssSelector\Exception;

/**
 * ParseException is thrown when a CSS selector syntax is not valid.
 *
 * This component is a port of the Python cssselect library,
 * which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
 *
 * @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
 */
class ExpressionErrorException extends ParseException
{
}
InternalErrorException.php000064400000001177151545301320011727 0ustar00<?php

/*
 * This file is part of the Symfony package.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\CssSelector\Exception;

/**
 * ParseException is thrown when a CSS selector syntax is not valid.
 *
 * This component is a port of the Python cssselect library,
 * which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
 *
 * @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
 */
class InternalErrorException extends ParseException
{
}
ParseException.php000064400000001176151545301320010212 0ustar00<?php

/*
 * This file is part of the Symfony package.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\CssSelector\Exception;

/**
 * ParseException is thrown when a CSS selector syntax is not valid.
 *
 * This component is a port of the Python cssselect library,
 * which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
 *
 * @author Fabien Potencier <fabien@symfony.com>
 */
class ParseException extends \Exception implements ExceptionInterface
{
}
SyntaxErrorException.php000064400000003204151545301320011432 0ustar00<?php

/*
 * This file is part of the Symfony package.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\CssSelector\Exception;

use Symfony\Component\CssSelector\Parser\Token;

/**
 * ParseException is thrown when a CSS selector syntax is not valid.
 *
 * This component is a port of the Python cssselect library,
 * which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
 *
 * @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
 */
class SyntaxErrorException extends ParseException
{
    /**
     * @return self
     */
    public static function unexpectedToken(string $expectedValue, Token $foundToken)
    {
        return new self(sprintf('Expected %s, but %s found.', $expectedValue, $foundToken));
    }

    /**
     * @return self
     */
    public static function pseudoElementFound(string $pseudoElement, string $unexpectedLocation)
    {
        return new self(sprintf('Unexpected pseudo-element "::%s" found %s.', $pseudoElement, $unexpectedLocation));
    }

    /**
     * @return self
     */
    public static function unclosedString(int $position)
    {
        return new self(sprintf('Unclosed/invalid string at %s.', $position));
    }

    /**
     * @return self
     */
    public static function nestedNot()
    {
        return new self('Got nested ::not().');
    }

    /**
     * @return self
     */
    public static function stringAsFunctionArgument()
    {
        return new self('String not allowed as function argument.');
    }
}
AccountReconnect.php000064400000002254151545721520010524 0ustar00<?php
declare( strict_types=1 );

namespace Automattic\WooCommerce\GoogleListingsAndAds\Exception;

defined( 'ABSPATH' ) || exit;

/**
 * Class AccountReconnect
 *
 * Error messages generated in this class should be translated, as they are intended to be displayed
 * to end users.
 *
 * @since 1.12.5
 *
 * @package Automattic\WooCommerce\GoogleListingsAndAds\Exception
 */
class AccountReconnect extends ExceptionWithResponseData {

	/**
	 * Create a new instance of the exception when the Jetpack account is not connected.
	 *
	 * @return static
	 */
	public static function jetpack_disconnected(): AccountReconnect {
		return new static(
			__( 'Please reconnect your Jetpack account.', 'google-listings-and-ads' ),
			401,
			null,
			[
				'status' => 401,
				'code'   => 'JETPACK_DISCONNECTED',
			]
		);
	}

	/**
	 * Create a new instance of the exception when the Google account is not connected.
	 *
	 * @return static
	 */
	public static function google_disconnected(): AccountReconnect {
		return new static(
			__( 'Please reconnect your Google account.', 'google-listings-and-ads' ),
			401,
			null,
			[
				'status' => 401,
				'code'   => 'GOOGLE_DISCONNECTED',
			]
		);
	}
}
ApiNotReady.php000064400000001542151545721520007445 0ustar00<?php
declare( strict_types=1 );

namespace Automattic\WooCommerce\GoogleListingsAndAds\Exception;

defined( 'ABSPATH' ) || exit;

/**
 * Class ApiNotReady
 *
 * Error messages generated in this class should be translated, as they are intended to be displayed
 * to end users.
 *
 * @since 1.12.0
 *
 * @package Automattic\WooCommerce\GoogleListingsAndAds\Exception
 */
class ApiNotReady extends ExceptionWithResponseData {

	/**
	 * Create a new instance of the exception when an API is not ready and the request needs to be retried.
	 *
	 * @param int $wait Time to wait in seconds.
	 *
	 * @return static
	 */
	public static function retry_after( int $wait ): ApiNotReady {
		return new static(
			__( 'Please retry the request after the indicated number of seconds.', 'google-listings-and-ads' ),
			503,
			null,
			[
				'retry_after' => $wait,
			]
		);
	}
}
ExceptionWithResponseData.php000064400000003230151545721520012365 0ustar00<?php
declare( strict_types=1 );

namespace Automattic\WooCommerce\GoogleListingsAndAds\Exception;

use Exception;
use Throwable;

defined( 'ABSPATH' ) || exit;

/**
 * Class ExceptionWithResponseData
 *
 * @package Automattic\WooCommerce\GoogleListingsAndAds\Exception
 */
class ExceptionWithResponseData extends Exception implements GoogleListingsAndAdsException {

	/** @var array $response_data */
	private $response_data = [];

	/**
	 * Construct the exception. Note: The message is NOT binary safe.
	 *
	 * @link https://php.net/manual/en/exception.construct.php
	 *
	 * @param string         $message [optional] The Exception message to throw.
	 * @param int            $code [optional] The Exception code.
	 * @param Throwable|null $previous [optional] The previous throwable used for the exception chaining.
	 * @param array          $data [optional] Extra data to attach to the exception (ostensibly for use in an HTTP response).
	 */
	public function __construct( string $message = '', int $code = 0, ?Throwable $previous = null, array $data = [] ) {
		parent::__construct( $message, $code, $previous );

		if ( ! empty( $data ) && is_array( $data ) ) {
			$this->response_data = $data;
		}
	}

	/**
	 * @param bool $with_message include the message in the returned data array.
	 *
	 * @return array
	 */
	public function get_response_data( bool $with_message = false ): array {
		if ( $with_message ) {
			return array_merge( [ 'message' => $this->getMessage() ], $this->response_data );
		}
		return $this->response_data;
	}

	/**
	 * @param array $response_data
	 */
	public function set_response_data( array $response_data ) {
		$this->response_data = $response_data;
	}
}
ExtensionRequirementException.php000064400000003706151545721520013346 0ustar00<?php
declare( strict_types=1 );

namespace Automattic\WooCommerce\GoogleListingsAndAds\Exception;

defined( 'ABSPATH' ) || exit;

/**
 * Class ExtensionRequirementException
 *
 * Error messages generated in this class should be translated, as they are intended to be displayed
 * to end users. We pass the translated message as a function so they are only translated when shown.
 * This prevents translation functions to be called before init which is not allowed in WP 6.7+.
 *
 * @package Automattic\WooCommerce\GoogleListingsAndAds\Exception
 */
class ExtensionRequirementException extends RuntimeExceptionWithMessageFunction implements GoogleListingsAndAdsException {

	/**
	 * Create a new instance of the exception when a required plugin/extension isn't activated.
	 *
	 * @param string $plugin_name The name of the missing required plugin.
	 *
	 * @return static
	 */
	public static function missing_required_plugin( string $plugin_name ): ExtensionRequirementException {
		return new static(
			sprintf(
				'Google for WooCommerce requires %1$s to be enabled.', // Fallback exception message.
				$plugin_name
			),
			0,
			null,
			fn () => sprintf(
				/* translators: 1 the missing plugin name */
				__( 'Google for WooCommerce requires %1$s to be enabled.', 'google-listings-and-ads' ),
				$plugin_name
			)
		);
	}

	/**
	 * Create a new instance of the exception when an incompatible plugin/extension is activated.
	 *
	 * @param string $plugin_name The name of the incompatible plugin.
	 *
	 * @return static
	 */
	public static function incompatible_plugin( string $plugin_name ): ExtensionRequirementException {
		return new static(
			sprintf(
				'Google for WooCommerce is incompatible with %1$s.', // Fallback exception message.
				$plugin_name
			),
			0,
			null,
			fn () => sprintf(
				/* translators: 1 the incompatible plugin name */
				__( 'Google for WooCommerce is incompatible with %1$s.', 'google-listings-and-ads' ),
				$plugin_name
			)
		);
	}
}
GoogleListingsAndAdsException.php000064400000000442151545721520013147 0ustar00<?php
declare( strict_types=1 );

namespace Automattic\WooCommerce\GoogleListingsAndAds\Exception;

use Throwable;

/**
 * This interface is used for all of our exceptions so that we can easily catch only our own exceptions.
 */
interface GoogleListingsAndAdsException extends Throwable {}
InvalidArray.php000064400000001605151545721520007653 0ustar00<?php
declare( strict_types=1 );

namespace Automattic\WooCommerce\GoogleListingsAndAds\Exception;

use InvalidArgumentException;

defined( 'ABSPATH' ) || exit;

/**
 * Class InvalidArray
 *
 * @package Automattic\WooCommerce\GoogleListingsAndAds\Exception
 */
class InvalidArray extends InvalidArgumentException implements GoogleListingsAndAdsException {

	/**
	 * Return a new instance of the exception when specific keys are missing from an array.
	 *
	 * @param string $method       The method where the keys were to be provided.
	 * @param array  $missing_keys The array of key names that were missing. This should be value-based.
	 *
	 * @return static
	 */
	public static function missing_keys( string $method, array $missing_keys ) {
		return new static(
			sprintf(
				'The array provided to %s was missing the following keys: %s',
				$method,
				join( ',', $missing_keys )
			)
		);
	}
}
InvalidAsset.php000064400000003165151545721520007657 0ustar00<?php
declare( strict_types=1 );

namespace Automattic\WooCommerce\GoogleListingsAndAds\Exception;

use LogicException;

/**
 * Class InvalidAsset
 *
 * @package Automattic\WooCommerce\GoogleListingsAndAds\Exception
 */
class InvalidAsset extends LogicException implements GoogleListingsAndAdsException {

	/**
	 * Return an instance of the exception when an asset attempts to be enqueued without first being
	 * registered.
	 *
	 * @param string $handle The asset handle.
	 *
	 * @return static
	 */
	public static function asset_not_registered( string $handle ) {
		return new static(
			sprintf(
				'The asset "%s" was not registered before it was enqueued. The register() method must be called during init.',
				$handle
			)
		);
	}

	/**
	 * Return an instance of the exception when an asset handle is invalid.
	 *
	 * @param string $handle The invalid handle.
	 *
	 * @return static
	 */
	public static function invalid_handle( string $handle ) {
		return new static( sprintf( 'The asset handle "%s" is invalid.', $handle ) );
	}

	/**
	 * Return a new instance of the exception when an asset with the given handle already exists.
	 *
	 * @param string $handle The asset handle that exists.
	 *
	 * @return static
	 */
	public static function handle_exists( string $handle ) {
		return new static( sprintf( 'The asset handle "%s" already exists.', $handle ) );
	}

	/**
	 * Create a new exception for an unreadable asset.
	 *
	 * @param string $path
	 *
	 * @return static
	 */
	public static function invalid_path( string $path ) {
		return new static( sprintf( 'The asset "%s" is unreadable. Do build scripts need to be run?', $path ) );
	}
}
InvalidClass.php000064400000003272151545721520007644 0ustar00<?php
declare( strict_types=1 );

namespace Automattic\WooCommerce\GoogleListingsAndAds\Exception;

use LogicException;

/**
 * Class InvalidClass
 *
 * @package Automattic\WooCommerce\GoogleListingsAndAds\Exception
 */
class InvalidClass extends LogicException implements GoogleListingsAndAdsException {

	/**
	 * Create a new instance of the exception when a class should implement an interface but does not.
	 *
	 * @param string $class_name     The class name.
	 * @param string $interface_name The interface name.
	 *
	 * @return static
	 */
	public static function should_implement( string $class_name, string $interface_name ) {
		return new static(
			sprintf(
				'The class "%s" must implement the "%s" interface.',
				$class_name,
				$interface_name
			)
		);
	}

	/**
	 * Create a new instance of the exception when a class should NOT implement an interface but it does.
	 *
	 * @param string $class_name     The class name.
	 * @param string $interface_name The interface name.
	 *
	 * @return static
	 */
	public static function should_not_implement( string $class_name, string $interface_name ): InvalidClass {
		return new static(
			sprintf(
				'The class "%s" must NOT implement the "%s" interface.',
				$class_name,
				$interface_name
			)
		);
	}

	/**
	 * Create a new instance of the exception when a class should override a method but does not.
	 *
	 * @param string $class_name  The class name.
	 * @param string $method_name The method name.
	 *
	 * @return static
	 */
	public static function should_override( string $class_name, string $method_name ) {
		return new static(
			sprintf(
				'The class "%s" must override the "%s()" method.',
				$class_name,
				$method_name
			)
		);
	}
}
InvalidDomainName.php000064400000001675151545721520010614 0ustar00<?php
declare( strict_types=1 );

namespace Automattic\WooCommerce\GoogleListingsAndAds\Exception;

use InvalidArgumentException;

defined( 'ABSPATH' ) || exit;


/**
 * Class InvalidDomainName
 *
 * @package Automattic\WooCommerce\GoogleListingsAndAds\Exception
 */
class InvalidDomainName extends InvalidArgumentException implements GoogleListingsAndAdsException {
	/**
	 * Create a new instance of the exception when a Merchant Center account can't be created
	 * because of an invalid top-level domain name.
	 *
	 * @param string $domain_name The top level domain name.
	 *
	 * @return static
	 */
	public static function create_account_failed_invalid_top_level_domain_name( string $domain_name ): InvalidDomainName {
		return new static(
		/* translators: 1 top level domain name. */
			sprintf( __( 'Unable to create an account, the domain name "%s" must end with a valid top-level domain name.', 'google-listings-and-ads' ), $domain_name )
		);
	}
}
InvalidMeta.php000064400000001157151545721520007465 0ustar00<?php
declare( strict_types=1 );

namespace Automattic\WooCommerce\GoogleListingsAndAds\Exception;

use LogicException;

defined( 'ABSPATH' ) || exit;

/**
 * Class InvalidMeta
 *
 * @package Automattic\WooCommerce\GoogleListingsAndAds\Exception
 */
class InvalidMeta extends LogicException implements GoogleListingsAndAdsException {

	/**
	 * Create a new instance of the exception when an invalid meta key is provided.
	 *
	 * @param string $key The meta key.
	 *
	 * @return static
	 */
	public static function invalid_key( string $key ) {
		return new static( sprintf( 'The meta key "%s" is not valid.', $key ) );
	}
}
InvalidOption.php000064400000001200151545721520010034 0ustar00<?php
declare( strict_types=1 );

namespace Automattic\WooCommerce\GoogleListingsAndAds\Exception;

use LogicException;

defined( 'ABSPATH' ) || exit;

/**
 * Class InvalidOption
 *
 * @package Automattic\WooCommerce\GoogleListingsAndAds\Exception
 */
class InvalidOption extends LogicException implements GoogleListingsAndAdsException {

	/**
	 * Create a new instance of the exception when an invalid option name is provided.
	 *
	 * @param string $name The option name.
	 *
	 * @return static
	 */
	public static function invalid_name( string $name ) {
		return new static( sprintf( 'The option name "%s" is not valid.', $name ) );
	}
}
InvalidProperty.php000064400000001347151545721520010424 0ustar00<?php
declare( strict_types=1 );

namespace Automattic\WooCommerce\GoogleListingsAndAds\Exception;

use LogicException;

/**
 * InvalidProperty class.
 *
 * @package Automattic\WooCommerce\GoogleListingsAndAds\Exception
 */
class InvalidProperty extends LogicException implements GoogleListingsAndAdsException {

	/**
	 * Create a new instance of the exception for a class property that should not be null.
	 *
	 * @param string $class_name The class name.
	 * @param string $property   The class property name.
	 *
	 * @return static
	 */
	public static function not_null( string $class_name, string $property ) {
		return new static(
			sprintf(
				'The class "%s" property "%s" must be set.',
				$class_name,
				$property
			)
		);
	}
}
InvalidQuery.php000064400000010474151545721520007706 0ustar00<?php
declare( strict_types=1 );

namespace Automattic\WooCommerce\GoogleListingsAndAds\Exception;

use InvalidArgumentException;

defined( 'ABSPATH' ) || exit;

/**
 * Class InvalidQuery
 *
 * @package Automattic\WooCommerce\GoogleListingsAndAds\Exception
 */
class InvalidQuery extends InvalidArgumentException implements GoogleListingsAndAdsException {

	/**
	 * Create a new instance of the exception when a column is not valid for a given table.
	 *
	 * @param string $name        The column name.
	 * @param string $table_class The table class name.
	 *
	 * @return static
	 */
	public static function from_column( string $name, string $table_class ): InvalidQuery {
		return new static( sprintf( 'The column "%s" is not valid for table class "%s".', $name, $table_class ) );
	}

	/**
	 * Create a new instance of the exception when a column is not valid.
	 *
	 * @param string $name        The column name.
	 *
	 * @return static
	 */
	public static function invalid_column( string $name ): InvalidQuery {
		return new static( sprintf( 'The column "%s" is not valid, it should only contain the characters "a-zA-Z0-9._"', $name ) );
	}

	/**
	 * Create a new instance of the exception when a column is not valid for ordering.
	 *
	 * @param string $name The column name.
	 *
	 * @return static
	 */
	public static function invalid_order_column( string $name ): InvalidQuery {
		return new static( sprintf( 'The column "%s" is not valid for ordering results.', $name ) );
	}

	/**
	 * @param string $compare
	 *
	 * @return static
	 */
	public static function from_compare( string $compare ): InvalidQuery {
		return new static( sprintf( 'The compare value "%s" is not valid.', $compare ) );
	}

	/**
	 * @param string $relation
	 *
	 * @return static
	 */
	public static function where_relation( string $relation ): InvalidQuery {
		return new static( sprintf( 'The where relation value "%s" is not valid.', $relation ) );
	}

	/**
	 * Create a new instance of the exception when there is an error inserting data into the DB.
	 *
	 * @param string $error
	 *
	 * @return InvalidQuery
	 */
	public static function from_insert( string $error ): InvalidQuery {
		return new static( sprintf( 'Error inserting data into the database: "%s"', $error ) );
	}

	/**
	 * Create a new instance of the exception when trying to set an auto increment ID.
	 *
	 * @param string $table_class
	 * @param string $column_name
	 *
	 * @return InvalidQuery
	 */
	public static function cant_set_id( string $table_class, string $column_name = 'id' ): InvalidQuery {
		return new static( sprintf( 'Cannot set column "%s" for table class "%s".', $column_name, $table_class ) );
	}

	/**
	 * Create a new instance of the exception when there is an error deleting data from the DB.
	 *
	 * @param string $error
	 *
	 * @return InvalidQuery
	 */
	public static function from_delete( string $error ): InvalidQuery {
		return new static( sprintf( 'Error deleting data into the database: "%s"', $error ) );
	}

	/**
	 * Create a new instance of the exception when there is an error updating data in the DB.
	 *
	 * @param string $error
	 *
	 * @return InvalidQuery
	 */
	public static function from_update( string $error ): InvalidQuery {
		return new static( sprintf( 'Error updating data in the database: "%s"', $error ) );
	}

	/**
	 * Create a new instance of the exception when an empty where clause is provided.
	 *
	 * @return InvalidQuery
	 */
	public static function empty_where(): InvalidQuery {
		return new static( 'Where clause cannot be an empty array.' );
	}

	/**
	 * Create a new instance of the exception when an empty set of columns is provided.
	 *
	 * @return InvalidQuery
	 */
	public static function empty_columns(): InvalidQuery {
		return new static( 'Columns list cannot be an empty array.' );
	}

	/**
	 * Create a new instance of the exception when an invalid resource name is used.
	 *
	 * @return InvalidQuery
	 */
	public static function resource_name(): InvalidQuery {
		return new static( 'The resource name can only include alphanumeric and underscore characters.' );
	}

	/**
	 * Create a new instance of the exception when an invalid value is used for a column.
	 *
	 * @param string $name The column name.
	 *
	 * @return InvalidQuery
	 */
	public static function invalid_value( string $name ): InvalidQuery {
		return new static( sprintf( 'The value for column "%s" is not valid.', $name ) );
	}
}
InvalidService.php000064400000002325151545721520010175 0ustar00<?php
declare( strict_types=1 );

namespace Automattic\WooCommerce\GoogleListingsAndAds\Exception;

use InvalidArgumentException;

/**
 * InvalidService class.
 *
 * @package Automattic\WooCommerce\GoogleListingsAndAds\Exception
 */
class InvalidService extends InvalidArgumentException implements GoogleListingsAndAdsException {

	/**
	 * Create a new instance of the exception for a service class name that is
	 * not recognized.
	 *
	 * @param string|object $service Class name of the service that was not recognized.
	 *
	 * @return static
	 */
	public static function from_service( $service ) {
		$message = sprintf(
			'The service "%s" cannot be registered because it is not recognized.',
			is_object( $service ) ? get_class( $service ) : (string) $service
		);

		return new static( $message );
	}

	/**
	 * Create a new instance of the exception for a service identifier that is
	 * not recognized.
	 *
	 * @param string $service_id Identifier of the service that is not being recognized.
	 *
	 * @return static
	 */
	public static function from_service_id( string $service_id ) {
		$message = sprintf( 'The service ID "%s" cannot be retrieved because is not recognized.', $service_id );

		return new static( $message );
	}
}
InvalidState.php000064400000001211151545721520007646 0ustar00<?php
declare( strict_types=1 );

namespace Automattic\WooCommerce\GoogleListingsAndAds\Exception;

use InvalidArgumentException;

defined( 'ABSPATH' ) || exit;

/**
 * Class InvalidState
 *
 * @package Automattic\WooCommerce\GoogleListingsAndAds\Exception
 */
class InvalidState extends InvalidArgumentException implements GoogleListingsAndAdsException {

	/**
	 * Create a new instance of the exception when an invalid state is requested.
	 *
	 * @param string $state
	 *
	 * @return InvalidState
	 */
	public static function from_state( string $state ): InvalidState {
		return new static( sprintf( 'The state %s is not valid.', $state ) );
	}
}
InvalidTerm.php000064400000001231151545721520007477 0ustar00<?php
declare( strict_types=1 );

namespace Automattic\WooCommerce\GoogleListingsAndAds\Exception;

use InvalidArgumentException;

defined( 'ABSPATH' ) || exit;

/**
 * Class InvalidTerm
 *
 * @package Automattic\WooCommerce\GoogleListingsAndAds\Exception
 */
class InvalidTerm extends InvalidArgumentException implements GoogleListingsAndAdsException {

	/**
	 * Create a new instance of the exception when a text contains invalid terms.
	 *
	 * @param string $text
	 *
	 * @return InvalidTerm
	 */
	public static function contains_invalid_terms( string $text ): InvalidTerm {
		return new static( sprintf( 'The text "%s" contains invalid terms.', $text ) );
	}
}
InvalidType.php000064400000001366151545721520007522 0ustar00<?php
declare( strict_types=1 );

namespace Automattic\WooCommerce\GoogleListingsAndAds\Exception;

use InvalidArgumentException;

defined( 'ABSPATH' ) || exit;

/**
 * Class InvalidType
 *
 * @package Automattic\WooCommerce\GoogleListingsAndAds\Exception
 */
class InvalidType extends InvalidArgumentException implements GoogleListingsAndAdsException {

	/**
	 * Create a new instance of the exception when an invalid type is provided.
	 *
	 * @param string   $type
	 * @param string[] $valid_types
	 *
	 * @return InvalidType
	 */
	public static function from_type( string $type, array $valid_types ): InvalidType {
		return new static(
			sprintf(
				'Invalid type "%s". Valid types are: "%s"',
				$type,
				join( '", "', $valid_types )
			)
		);
	}
}
InvalidValue.php000064400000006165151545721520007657 0ustar00<?php
declare( strict_types=1 );

namespace Automattic\WooCommerce\GoogleListingsAndAds\Exception;

use LogicException;

defined( 'ABSPATH' ) || exit;

/**
 * Class InvalidValue
 *
 * @package Automattic\WooCommerce\GoogleListingsAndAds\Exception
 */
class InvalidValue extends LogicException implements GoogleListingsAndAdsException {

	/**
	 * Create a new instance of the exception when a value is not a positive integer.
	 *
	 * @param string $method The method that requires a positive integer.
	 *
	 * @return static
	 */
	public static function negative_integer( string $method ) {
		return new static( sprintf( 'The method "%s" requires a positive integer value.', $method ) );
	}

	/**
	 * Create a new instance of the exception when a value is not a string.
	 *
	 * @param string $key The name of the value.
	 *
	 * @return static
	 */
	public static function not_string( string $key ) {
		return new static( sprintf( 'The value of %s must be of type string.', $key ) );
	}

	/**
	 * Create a new instance of the exception when a value is not a string.
	 *
	 * @param string $key The name of the value.
	 *
	 * @return static
	 */
	public static function not_integer( string $key ): InvalidValue {
		return new static( sprintf( 'The value of %s must be of type integer.', $key ) );
	}

	/**
	 * Create a new instance of the exception when a value is not an instance of a given class.
	 *
	 * @param string $class_name The name of the class that the value must be an instance of.
	 * @param string $key        The name of the value.
	 *
	 * @return static
	 */
	public static function not_instance_of( string $class_name, string $key ) {
		return new static( sprintf( 'The value of %s must be an instance of %s.', $key, $class_name ) );
	}

	/**
	 * Create a new instance of the exception when a value is empty.
	 *
	 * @param string $key The name of the value.
	 *
	 * @return static
	 *
	 * @since 1.2.0
	 */
	public static function is_empty( string $key ): InvalidValue {
		return new static( sprintf( 'The value of %s can not be empty.', $key ) );
	}

	/**
	 * Create a new instance of the exception when a value is not from a predefined list of allowed values.
	 *
	 * @param mixed $key            The name of the value.
	 * @param array $allowed_values The list of allowed values.
	 *
	 * @return static
	 */
	public static function not_in_allowed_list( $key, array $allowed_values ): InvalidValue {
		return new static( sprintf( 'The value of %s must be either of [%s].', $key, implode( ', ', $allowed_values ) ) );
	}

	/**
	 * Create a new instance of the exception when a value isn't a valid coupon ID.
	 *
	 * @param mixed $value The provided coupon ID that isn't valid.
	 *
	 * @return static
	 */
	public static function not_valid_coupon_id( $value ): InvalidValue {
		return new static( sprintf( 'Invalid coupon ID: %s', $value ) );
	}

	/**
	 * Create a new instance of the exception when a value isn't a valid product ID.
	 *
	 * @param mixed $value The provided product ID that isn't valid.
	 *
	 * @return static
	 */
	public static function not_valid_product_id( $value ): InvalidValue {
		return new static( sprintf( 'Invalid product ID: %s', $value ) );
	}
}
InvalidVersion.php000064400000005330151545721520010221 0ustar00<?php
declare( strict_types=1 );

namespace Automattic\WooCommerce\GoogleListingsAndAds\Exception;

defined( 'ABSPATH' ) || exit;

/**
 * Class InvalidVersion
 *
 * Error messages generated in this class should be translated, as they are intended to be displayed
 * to end users. We pass the translated message as a function so they are only translated when shown.
 * This prevents translation functions to be called before init which is not allowed in WP 6.7+.
 *
 * @package Automattic\WooCommerce\GoogleListingsAndAds\Exception
 */
class InvalidVersion extends RuntimeExceptionWithMessageFunction implements GoogleListingsAndAdsException {

	/**
	 * Create a new instance of the exception when an invalid version is detected.
	 *
	 * @param string $requirement
	 * @param string $found_version
	 * @param string $minimum_version
	 *
	 * @return static
	 */
	public static function from_requirement( string $requirement, string $found_version, string $minimum_version ): InvalidVersion {
		return new static(
			sprintf(
				'Google for WooCommerce requires %1$s version %2$s or higher. You are using version %3$s.', // Fallback exception message.
				$requirement,
				$minimum_version,
				$found_version
			),
			0,
			null,
			fn () => sprintf(
				/* translators: 1 is the required component, 2 is the minimum required version, 3 is the version in use on the site */
				__( 'Google for WooCommerce requires %1$s version %2$s or higher. You are using version %3$s.', 'google-listings-and-ads' ),
				$requirement,
				$minimum_version,
				$found_version
			)
		);
	}

	/**
	 * Create a new instance of the exception when a requirement is missing.
	 *
	 * @param string $requirement
	 * @param string $minimum_version
	 *
	 * @return InvalidVersion
	 */
	public static function requirement_missing( string $requirement, string $minimum_version ): InvalidVersion {
		return new static(
			sprintf(
				'Google for WooCommerce requires %1$s version %2$s or higher.', // Fallback exception message.
				$requirement,
				$minimum_version
			),
			0,
			null,
			fn () => sprintf(
				/* translators: 1 is the required component, 2 is the minimum required version */
				__( 'Google for WooCommerce requires %1$s version %2$s or higher.', 'google-listings-and-ads' ),
				$requirement,
				$minimum_version
			)
		);
	}

	/**
	 * Create a new instance of the exception when an invalid architecture is detected.
	 *
	 * @since 2.3.9
	 * @return InvalidVersion
	 */
	public static function invalid_architecture(): InvalidVersion {
		return new static(
			'Google for WooCommerce requires a 64 bit version of PHP.', // Fallback exception message.
			0,
			null,
			fn () => __( 'Google for WooCommerce requires a 64 bit version of PHP.', 'google-listings-and-ads' )
		);
	}
}
RuntimeExceptionWithMessageFunction.php000064400000003133151545721520014435 0ustar00<?php
declare( strict_types=1 );

namespace Automattic\WooCommerce\GoogleListingsAndAds\Exception;

use Exception;
use RuntimeException;
use Throwable;

defined( 'ABSPATH' ) || exit;

/**
 * Class RuntimeExceptionWithMessageFunction
 *
 * The purpose of this Exception type is to be able to throw an exception early,
 * but translate the string late. This is because WP 6.7+ requires translations
 * to happen after the init hook.
 *
 * @package Automattic\WooCommerce\GoogleListingsAndAds\Exception
 */
class RuntimeExceptionWithMessageFunction extends RuntimeException implements GoogleListingsAndAdsException {

	/** @var callable $message_function */
	private $message_function;

	/**
	 * Construct the exception
	 *
	 * @param string         $message [optional] The Exception message to throw.
	 * @param int            $code [optional] The Exception code.
	 * @param Throwable|null $previous [optional] The previous throwable used for the exception chaining.
	 * @param callable|null  $message_function [optional] Function to format/translate the message string.
	 */
	public function __construct( string $message = '', int $code = 0, ?Throwable $previous = null, ?callable $message_function = null ) {
		parent::__construct( $message, $code, $previous );
		$this->message_function = $message_function;
	}

	/**
	 * Override getMessage function to return message from function if available.
	 *
	 * @return string Exception message.
	 */
	public function get_formatted_message(): string {
		if ( is_callable( $this->message_function ) ) {
			return ( $this->message_function )();
		}

		return parent::getMessage();
	}
}
ValidateInterface.php000064400000003712151545721520010641 0ustar00<?php
declare( strict_types=1 );

namespace Automattic\WooCommerce\GoogleListingsAndAds\Exception;

/**
 * Trait ValidateInterface
 *
 * @package Automattic\WooCommerce\GoogleListingsAndAds\Exception
 */
trait ValidateInterface {

	/**
	 * Validate that a class implements a given interface.
	 *
	 * @param string $class_name      The class name.
	 * @param string $interface_name The interface name.
	 *
	 * @throws InvalidClass When the given class does not implement the interface.
	 */
	protected function validate_interface( string $class_name, string $interface_name ) {
		$implements = class_implements( $class_name );
		if ( ! array_key_exists( $interface_name, $implements ) ) {
			throw InvalidClass::should_implement( $class_name, $interface_name );
		}
	}

	/**
	 * Validate that an object is an instance of an interface.
	 *
	 * @param object $object_instance The object to validate.
	 * @param string $interface_name  The interface name.
	 *
	 * @throws InvalidClass When the given object does not implement the interface.
	 */
	protected function validate_instanceof( $object_instance, string $interface_name ) {
		$class_name = '';
		if ( is_object( $object_instance ) ) {
			$class_name = get_class( $object_instance );
		}

		if ( ! $object_instance instanceof $interface_name ) {
			throw InvalidClass::should_implement( $class_name, $interface_name );
		}
	}

	/**
	 * Validate that an object is NOT an instance of an interface.
	 *
	 * @param object $object_instance The object to validate.
	 * @param string $interface_name  The interface name.
	 *
	 * @throws InvalidClass When the given object implements the interface.
	 */
	protected function validate_not_instanceof( $object_instance, string $interface_name ) {
		$class_name = '';
		if ( is_object( $object_instance ) ) {
			$class_name = get_class( $object_instance );
		}

		if ( $object_instance instanceof $interface_name ) {
			throw InvalidClass::should_not_implement( $class_name, $interface_name );
		}
	}
}
WPError.php000064400000001603151545721520006624 0ustar00<?php
declare( strict_types=1 );

namespace Automattic\WooCommerce\GoogleListingsAndAds\Exception;

use RuntimeException;
use WP_Error;

/**
 * Class WPError.
 *
 * Used to convert a WP_Error object to a thrown exception.
 *
 * @package Automattic\WooCommerce\GoogleListingsAndAds\Exception
 */
class WPError extends RuntimeException implements GoogleListingsAndAdsException {

	/**
	 * Convert a WP_Error object to a throwable exception.
	 *
	 * @param WP_Error $error The error object.
	 *
	 * @return static
	 */
	public static function from_error( WP_Error $error ) {
		$message     = $error->get_error_message();
		$code        = $error->get_error_code();
		$string_code = '';
		if ( ! is_numeric( $code ) ) {
			$string_code = $code;
			$code        = 0;
		}

		return new static(
			sprintf( 'A WP Error was generated. Code: "%s" Message: "%s".', $string_code, $message ),
			$code
		);
	}
}
WPErrorTrait.php000064400000002605151545721520007633 0ustar00<?php
declare( strict_types=1 );

namespace Automattic\WooCommerce\GoogleListingsAndAds\Exception;

use Exception;
use Throwable;
use WP_Error;

/**
 * Trait WPErrorTrait
 *
 * @package Automattic\WooCommerce\GoogleListingsAndAds\Exception
 */
trait WPErrorTrait {

	/**
	 * Check for a WP_Error object and throw an exception if we found one.
	 *
	 * @param mixed|WP_Error $maybe_error
	 *
	 * @throws WPError When the object is a WP_Error.
	 */
	protected function check_for_wp_error( $maybe_error ) {
		if ( ! $maybe_error instanceof WP_Error ) {
			return;
		}

		if ( $maybe_error->has_errors() ) {
			throw WPError::from_error( $maybe_error );
		}
	}

	/**
	 * Create a WP_Error from an exception.
	 *
	 * @param Throwable $e
	 * @param string    $code
	 * @param array     $data
	 *
	 * @return WP_Error
	 */
	protected function error_from_exception( Throwable $e, string $code, array $data = [] ): WP_Error {
		return new WP_Error( $code, $data['message'] ?? $e->getMessage(), $data );
	}

	/**
	 * Try to decode a JSON string.
	 *
	 * @param string $message
	 *
	 * @return array
	 * @throws Exception When the JSON could not be decoded.
	 */
	protected function json_decode_message( string $message ): array {
		$decoded = json_decode( $message, true );
		if ( null === $decoded || JSON_ERROR_NONE !== json_last_error() ) {
			throw new Exception( 'Could not decode JSON' );
		}

		return $decoded;
	}
}
ContainerException.php000064400000000415151547151510011063 0ustar00<?php

namespace Automattic\WooCommerce\Vendor\League\Container\Exception;

use Automattic\WooCommerce\Vendor\Psr\Container\ContainerExceptionInterface;
use RuntimeException;

class ContainerException extends RuntimeException implements ContainerExceptionInterface
{
}
NotFoundException.php000064400000000432151547151510010674 0ustar00<?php

namespace Automattic\WooCommerce\Vendor\League\Container\Exception;

use Automattic\WooCommerce\Vendor\Psr\Container\NotFoundExceptionInterface;
use InvalidArgumentException;

class NotFoundException extends InvalidArgumentException implements NotFoundExceptionInterface
{
}
Chunk.php000064400000012672151552715220006342 0ustar00<?php

/**
 * Chunk Exception
 *
 * @package Less
 * @subpackage exception
 */
class Less_Exception_Chunk extends Less_Exception_Parser{


	protected $parserCurrentIndex = 0;

	protected $emitFrom = 0;

	protected $input_len;


	/**
	 * Constructor
	 *
	 * @param string $input
	 * @param Exception $previous Previous exception
	 * @param integer $index The current parser index
	 * @param Less_FileInfo|string $currentFile The file
	 * @param integer $code The exception code
	 */
	public function __construct($input, Exception $previous = null, $index = null, $currentFile = null, $code = 0){

		$this->message = 'ParseError: Unexpected input'; //default message

		$this->index = $index;

		$this->currentFile = $currentFile;

		$this->input = $input;
		$this->input_len = strlen($input);

		$this->Chunks();
		$this->genMessage();
	}


	/**
	 * See less.js chunks()
	 * We don't actually need the chunks
	 *
	 */
	protected function Chunks(){
		$level = 0;
		$parenLevel = 0;
		$lastMultiCommentEndBrace = null;
		$lastOpening = null;
		$lastMultiComment = null;
		$lastParen = null;

		for( $this->parserCurrentIndex = 0; $this->parserCurrentIndex < $this->input_len; $this->parserCurrentIndex++ ){
			$cc = $this->CharCode($this->parserCurrentIndex);
			if ((($cc >= 97) && ($cc <= 122)) || ($cc < 34)) {
				// a-z or whitespace
				continue;
			}

			switch ($cc) {

				// (
				case 40:
					$parenLevel++;
					$lastParen = $this->parserCurrentIndex;
					break;

				// )
				case 41:
					$parenLevel--;
					if( $parenLevel < 0 ){
						return $this->fail("missing opening `(`");
					}
					break;

				// ;
				case 59:
					//if (!$parenLevel) { $this->emitChunk();	}
					break;

				// {
				case 123:
					$level++;
					$lastOpening = $this->parserCurrentIndex;
					break;

				// }
				case 125:
					$level--;
					if( $level < 0 ){
						return $this->fail("missing opening `{`");

					}
					//if (!$level && !$parenLevel) { $this->emitChunk(); }
					break;
				// \
				case 92:
					if ($this->parserCurrentIndex < $this->input_len - 1) { $this->parserCurrentIndex++; break; }
					return $this->fail("unescaped `\\`");

				// ", ' and `
				case 34:
				case 39:
				case 96:
					$matched = 0;
					$currentChunkStartIndex = $this->parserCurrentIndex;
					for ($this->parserCurrentIndex = $this->parserCurrentIndex + 1; $this->parserCurrentIndex < $this->input_len; $this->parserCurrentIndex++) {
						$cc2 = $this->CharCode($this->parserCurrentIndex);
						if ($cc2 > 96) { continue; }
						if ($cc2 == $cc) { $matched = 1; break; }
						if ($cc2 == 92) {        // \
							if ($this->parserCurrentIndex == $this->input_len - 1) {
								return $this->fail("unescaped `\\`");
							}
							$this->parserCurrentIndex++;
						}
					}
					if ($matched) { break; }
					return $this->fail("unmatched `" . chr($cc) . "`", $currentChunkStartIndex);

				// /, check for comment
				case 47:
					if ($parenLevel || ($this->parserCurrentIndex == $this->input_len - 1)) { break; }
					$cc2 = $this->CharCode($this->parserCurrentIndex+1);
					if ($cc2 == 47) {
						// //, find lnfeed
						for ($this->parserCurrentIndex = $this->parserCurrentIndex + 2; $this->parserCurrentIndex < $this->input_len; $this->parserCurrentIndex++) {
							$cc2 = $this->CharCode($this->parserCurrentIndex);
							if (($cc2 <= 13) && (($cc2 == 10) || ($cc2 == 13))) { break; }
						}
					} else if ($cc2 == 42) {
						// /*, find */
						$lastMultiComment = $currentChunkStartIndex = $this->parserCurrentIndex;
						for ($this->parserCurrentIndex = $this->parserCurrentIndex + 2; $this->parserCurrentIndex < $this->input_len - 1; $this->parserCurrentIndex++) {
							$cc2 = $this->CharCode($this->parserCurrentIndex);
							if ($cc2 == 125) { $lastMultiCommentEndBrace = $this->parserCurrentIndex; }
							if ($cc2 != 42) { continue; }
							if ($this->CharCode($this->parserCurrentIndex+1) == 47) { break; }
						}
						if ($this->parserCurrentIndex == $this->input_len - 1) {
							return $this->fail("missing closing `*/`", $currentChunkStartIndex);
						}
					}
					break;

				// *, check for unmatched */
				case 42:
					if (($this->parserCurrentIndex < $this->input_len - 1) && ($this->CharCode($this->parserCurrentIndex+1) == 47)) {
						return $this->fail("unmatched `/*`");
					}
					break;
			}
		}

		if( $level !== 0 ){
			if( ($lastMultiComment > $lastOpening) && ($lastMultiCommentEndBrace > $lastMultiComment) ){
				return $this->fail("missing closing `}` or `*/`", $lastOpening);
			} else {
				return $this->fail("missing closing `}`", $lastOpening);
			}
		} else if ( $parenLevel !== 0 ){
			return $this->fail("missing closing `)`", $lastParen);
		}


		//chunk didn't fail


		//$this->emitChunk(true);
	}

	public function CharCode($pos){
		return ord($this->input[$pos]);
	}


	public function fail( $msg, $index = null ){

		if( !$index ){
			$this->index = $this->parserCurrentIndex;
		}else{
			$this->index = $index;
		}
		$this->message = 'ParseError: '.$msg;
	}


	/*
	function emitChunk( $force = false ){
		$len = $this->parserCurrentIndex - $this->emitFrom;
		if ((($len < 512) && !$force) || !$len) {
			return;
		}
		$chunks[] = substr($this->input, $this->emitFrom, $this->parserCurrentIndex + 1 - $this->emitFrom );
		$this->emitFrom = $this->parserCurrentIndex + 1;
	}
	*/

}
Compiler.php000064400000000233151552715220007032 0ustar00<?php

/**
 * Compiler Exception
 *
 * @package Less
 * @subpackage exception
 */
class Less_Exception_Compiler extends Less_Exception_Parser{

}Parser.php000064400000005302151552715220006516 0ustar00<?php

/**
 * Parser Exception
 *
 * @package Less
 * @subpackage exception
 */
class Less_Exception_Parser extends Exception{

	/**
	 * The current file
	 *
	 * @var Less_ImportedFile
	 */
	public $currentFile;

	/**
	 * The current parser index
	 *
	 * @var integer
	 */
	public $index;

	protected $input;

	protected $details = array();


	/**
	 * Constructor
	 *
	 * @param string $message
	 * @param Exception $previous Previous exception
	 * @param integer $index The current parser index
	 * @param Less_FileInfo|string $currentFile The file
	 * @param integer $code The exception code
	 */
	public function __construct($message = null, Exception $previous = null, $index = null, $currentFile = null, $code = 0){

		if (PHP_VERSION_ID < 50300) {
			$this->previous = $previous;
			parent::__construct($message, $code);
		} else {
			parent::__construct($message, $code, $previous);
		}

		$this->currentFile = $currentFile;
		$this->index = $index;

		$this->genMessage();
	}


	protected function getInput(){

		if( !$this->input && $this->currentFile && $this->currentFile['filename'] && file_exists($this->currentFile['filename']) ){
			$this->input = file_get_contents( $this->currentFile['filename'] );
		}
	}



	/**
	 * Converts the exception to string
	 *
	 * @return string
	 */
	public function genMessage(){

		if( $this->currentFile && $this->currentFile['filename'] ){
			$this->message .= ' in '.basename($this->currentFile['filename']);
		}

		if( $this->index !== null ){
			$this->getInput();
			if( $this->input ){
				$line = self::getLineNumber();
				$this->message .= ' on line '.$line.', column '.self::getColumn();

				$lines = explode("\n",$this->input);

				$count = count($lines);
				$start_line = max(0, $line-3);
				$last_line = min($count, $start_line+6);
				$num_len = strlen($last_line);
				for( $i = $start_line; $i < $last_line; $i++ ){
					$this->message .= "\n".str_pad($i+1,$num_len,'0',STR_PAD_LEFT).'| '.$lines[$i];
				}
			}
		}

	}

	/**
	 * Returns the line number the error was encountered
	 *
	 * @return integer
	 */
	public function getLineNumber(){
		if( $this->index ){
			// https://bugs.php.net/bug.php?id=49790
			if (ini_get("mbstring.func_overload")) {
				return substr_count(substr($this->input, 0, $this->index), "\n") + 1;
			} else {
				return substr_count($this->input, "\n", 0, $this->index) + 1;
			}
		}
		return 1;
	}


	/**
	 * Returns the column the error was encountered
	 *
	 * @return integer
	 */
	public function getColumn(){

		$part = substr($this->input, 0, $this->index);
		$pos = strrpos($part,"\n");
		return $this->index - $pos;
	}

}