MINOR: Whitespace fixes in SimpleTest.

This commit is contained in:
Sam Minnee 2015-08-27 13:11:02 +12:00
parent 680b19a1da
commit 0dcccfafb3
8 changed files with 309 additions and 307 deletions

View File

@ -27,7 +27,7 @@ class SimpleCookie {
var $_path; var $_path;
var $_expiry; var $_expiry;
var $_is_secure; var $_is_secure;
/** /**
* Constructor. Sets the stored values. * Constructor. Sets the stored values.
* @param string $name Cookie key. * @param string $name Cookie key.
@ -49,7 +49,7 @@ class SimpleCookie {
} }
$this->_is_secure = $is_secure; $this->_is_secure = $is_secure;
} }
/** /**
* Sets the host. The cookie rules determine * Sets the host. The cookie rules determine
* that the first two parts are taken for * that the first two parts are taken for
@ -67,7 +67,7 @@ class SimpleCookie {
} }
return false; return false;
} }
/** /**
* Accessor for the truncated host to which this * Accessor for the truncated host to which this
* cookie applies. * cookie applies.
@ -77,7 +77,7 @@ class SimpleCookie {
function getHost() { function getHost() {
return $this->_host; return $this->_host;
} }
/** /**
* Test for a cookie being valid for a host name. * Test for a cookie being valid for a host name.
* @param string $host Host to test against. * @param string $host Host to test against.
@ -87,7 +87,7 @@ class SimpleCookie {
function isValidHost($host) { function isValidHost($host) {
return ($this->_truncateHost($host) === $this->getHost()); return ($this->_truncateHost($host) === $this->getHost());
} }
/** /**
* Extracts just the domain part that determines a * Extracts just the domain part that determines a
* cookie's host validity. * cookie's host validity.
@ -104,7 +104,7 @@ class SimpleCookie {
} }
return false; return false;
} }
/** /**
* Accessor for name. * Accessor for name.
* @return string Cookie key. * @return string Cookie key.
@ -113,7 +113,7 @@ class SimpleCookie {
function getName() { function getName() {
return $this->_name; return $this->_name;
} }
/** /**
* Accessor for value. A deleted cookie will * Accessor for value. A deleted cookie will
* have an empty string for this. * have an empty string for this.
@ -123,7 +123,7 @@ class SimpleCookie {
function getValue() { function getValue() {
return $this->_value; return $this->_value;
} }
/** /**
* Accessor for path. * Accessor for path.
* @return string Valid cookie path. * @return string Valid cookie path.
@ -132,7 +132,7 @@ class SimpleCookie {
function getPath() { function getPath() {
return $this->_path; return $this->_path;
} }
/** /**
* Tests a path to see if the cookie applies * Tests a path to see if the cookie applies
* there. The test path must be longer or * there. The test path must be longer or
@ -147,7 +147,7 @@ class SimpleCookie {
$this->getPath(), $this->getPath(),
strlen($this->getPath())) == 0); strlen($this->getPath())) == 0);
} }
/** /**
* Accessor for expiry. * Accessor for expiry.
* @return string Expiry string. * @return string Expiry string.
@ -159,7 +159,7 @@ class SimpleCookie {
} }
return gmdate("D, d M Y H:i:s", $this->_expiry) . " GMT"; return gmdate("D, d M Y H:i:s", $this->_expiry) . " GMT";
} }
/** /**
* Test to see if cookie is expired against * Test to see if cookie is expired against
* the cookie format time or timestamp. * the cookie format time or timestamp.
@ -180,7 +180,7 @@ class SimpleCookie {
} }
return ($this->_expiry < $now); return ($this->_expiry < $now);
} }
/** /**
* Ages the cookie by the specified number of * Ages the cookie by the specified number of
* seconds. * seconds.
@ -192,7 +192,7 @@ class SimpleCookie {
$this->_expiry -= $interval; $this->_expiry -= $interval;
} }
} }
/** /**
* Accessor for the secure flag. * Accessor for the secure flag.
* @return boolean True if cookie needs SSL. * @return boolean True if cookie needs SSL.
@ -201,7 +201,7 @@ class SimpleCookie {
function isSecure() { function isSecure() {
return $this->_is_secure; return $this->_is_secure;
} }
/** /**
* Adds a trailing and leading slash to the path * Adds a trailing and leading slash to the path
* if missing. * if missing.
@ -227,7 +227,7 @@ class SimpleCookie {
*/ */
class SimpleCookieJar { class SimpleCookieJar {
var $_cookies; var $_cookies;
/** /**
* Constructor. Jar starts empty. * Constructor. Jar starts empty.
* @access public * @access public
@ -235,7 +235,7 @@ class SimpleCookieJar {
function __construct() { function __construct() {
$this->_cookies = array(); $this->_cookies = array();
} }
/** /**
* Removes expired and temporary cookies as if * Removes expired and temporary cookies as if
* the browser was closed and re-opened. * the browser was closed and re-opened.
@ -258,7 +258,7 @@ class SimpleCookieJar {
} }
$this->_cookies = $surviving_cookies; $this->_cookies = $surviving_cookies;
} }
/** /**
* Ages all cookies in the cookie jar. * Ages all cookies in the cookie jar.
* @param integer $interval The old session is moved * @param integer $interval The old session is moved
@ -272,7 +272,7 @@ class SimpleCookieJar {
$this->_cookies[$i]->agePrematurely($interval); $this->_cookies[$i]->agePrematurely($interval);
} }
} }
/** /**
* Sets an additional cookie. If a cookie has * Sets an additional cookie. If a cookie has
* the same name and path it is replaced. * the same name and path it is replaced.
@ -290,7 +290,7 @@ class SimpleCookieJar {
} }
$this->_cookies[$this->_findFirstMatch($cookie)] = $cookie; $this->_cookies[$this->_findFirstMatch($cookie)] = $cookie;
} }
/** /**
* Finds a matching cookie to write over or the * Finds a matching cookie to write over or the
* first empty slot if none. * first empty slot if none.
@ -311,7 +311,7 @@ class SimpleCookieJar {
} }
return count($this->_cookies); return count($this->_cookies);
} }
/** /**
* Reads the most specific cookie value from the * Reads the most specific cookie value from the
* browser cookies. Looks for the longest path that * browser cookies. Looks for the longest path that
@ -335,7 +335,7 @@ class SimpleCookieJar {
} }
return (isset($value) ? $value : false); return (isset($value) ? $value : false);
} }
/** /**
* Tests cookie for matching against search * Tests cookie for matching against search
* criteria. * criteria.
@ -359,7 +359,7 @@ class SimpleCookieJar {
} }
return true; return true;
} }
/** /**
* Uses a URL to sift relevant cookies by host and * Uses a URL to sift relevant cookies by host and
* path. Results are list of strings of form "name=value". * path. Results are list of strings of form "name=value".

View File

@ -5,7 +5,7 @@
* @subpackage WebTester * @subpackage WebTester
* @version $Id: encoding.php 1723 2008-04-08 00:34:10Z lastcraft $ * @version $Id: encoding.php 1723 2008-04-08 00:34:10Z lastcraft $
*/ */
/**#@+ /**#@+
* include other SimpleTest class files * include other SimpleTest class files
*/ */
@ -20,7 +20,7 @@ require_once(dirname(__FILE__) . '/socket.php');
class SimpleEncodedPair { class SimpleEncodedPair {
var $_key; var $_key;
var $_value; var $_value;
/** /**
* Stashes the data for rendering later. * Stashes the data for rendering later.
* @param string $key Form element name. * @param string $key Form element name.
@ -30,7 +30,7 @@ class SimpleEncodedPair {
$this->_key = $key; $this->_key = $key;
$this->_value = $value; $this->_value = $value;
} }
/** /**
* The pair as a single string. * The pair as a single string.
* @return string Encoded pair. * @return string Encoded pair.
@ -39,7 +39,7 @@ class SimpleEncodedPair {
function asRequest() { function asRequest() {
return urlencode($this->_key) . '=' . urlencode($this->_value); return urlencode($this->_key) . '=' . urlencode($this->_value);
} }
/** /**
* The MIME part as a string. * The MIME part as a string.
* @return string MIME part encoding. * @return string MIME part encoding.
@ -51,7 +51,7 @@ class SimpleEncodedPair {
$part .= "\r\n" . $this->_value; $part .= "\r\n" . $this->_value;
return $part; return $part;
} }
/** /**
* Is this the value we are looking for? * Is this the value we are looking for?
* @param string $key Identifier. * @param string $key Identifier.
@ -61,7 +61,7 @@ class SimpleEncodedPair {
function isKey($key) { function isKey($key) {
return $key == $this->_key; return $key == $this->_key;
} }
/** /**
* Is this the value we are looking for? * Is this the value we are looking for?
* @return string Identifier. * @return string Identifier.
@ -70,7 +70,7 @@ class SimpleEncodedPair {
function getKey() { function getKey() {
return $this->_key; return $this->_key;
} }
/** /**
* Is this the value we are looking for? * Is this the value we are looking for?
* @return string Content. * @return string Content.
@ -90,7 +90,7 @@ class SimpleAttachment {
var $_key; var $_key;
var $_content; var $_content;
var $_filename; var $_filename;
/** /**
* Stashes the data for rendering later. * Stashes the data for rendering later.
* @param string $key Key to add value to. * @param string $key Key to add value to.
@ -102,7 +102,7 @@ class SimpleAttachment {
$this->_content = $content; $this->_content = $content;
$this->_filename = $filename; $this->_filename = $filename;
} }
/** /**
* The pair as a single string. * The pair as a single string.
* @return string Encoded pair. * @return string Encoded pair.
@ -111,7 +111,7 @@ class SimpleAttachment {
function asRequest() { function asRequest() {
return ''; return '';
} }
/** /**
* The MIME part as a string. * The MIME part as a string.
* @return string MIME part encoding. * @return string MIME part encoding.
@ -125,7 +125,7 @@ class SimpleAttachment {
$part .= "\r\n\r\n" . $this->_content; $part .= "\r\n\r\n" . $this->_content;
return $part; return $part;
} }
/** /**
* Attempts to figure out the MIME type from the * Attempts to figure out the MIME type from the
* file extension and the content. * file extension and the content.
@ -138,7 +138,7 @@ class SimpleAttachment {
} }
return 'application/octet-stream'; return 'application/octet-stream';
} }
/** /**
* Tests each character is in the range 0-127. * Tests each character is in the range 0-127.
* @param string $ascii String to test. * @param string $ascii String to test.
@ -152,7 +152,7 @@ class SimpleAttachment {
} }
return true; return true;
} }
/** /**
* Is this the value we are looking for? * Is this the value we are looking for?
* @param string $key Identifier. * @param string $key Identifier.
@ -162,7 +162,7 @@ class SimpleAttachment {
function isKey($key) { function isKey($key) {
return $key == $this->_key; return $key == $this->_key;
} }
/** /**
* Is this the value we are looking for? * Is this the value we are looking for?
* @return string Identifier. * @return string Identifier.
@ -171,7 +171,7 @@ class SimpleAttachment {
function getKey() { function getKey() {
return $this->_key; return $this->_key;
} }
/** /**
* Is this the value we are looking for? * Is this the value we are looking for?
* @return string Content. * @return string Content.
@ -190,7 +190,7 @@ class SimpleAttachment {
*/ */
class SimpleEncoding { class SimpleEncoding {
var $_request; var $_request;
/** /**
* Starts empty. * Starts empty.
* @param array $query Hash of parameters. * @param array $query Hash of parameters.
@ -205,7 +205,7 @@ class SimpleEncoding {
$this->clear(); $this->clear();
$this->merge($query); $this->merge($query);
} }
/** /**
* Empties the request of parameters. * Empties the request of parameters.
* @access public * @access public
@ -213,7 +213,7 @@ class SimpleEncoding {
function clear() { function clear() {
$this->_request = array(); $this->_request = array();
} }
/** /**
* Adds a parameter to the query. * Adds a parameter to the query.
* @param string $key Key to add value to. * @param string $key Key to add value to.
@ -232,7 +232,7 @@ class SimpleEncoding {
$this->_addPair($key, $value); $this->_addPair($key, $value);
} }
} }
/** /**
* Adds a new value into the request. * Adds a new value into the request.
* @param string $key Key to add value to. * @param string $key Key to add value to.
@ -242,7 +242,7 @@ class SimpleEncoding {
function _addPair($key, $value) { function _addPair($key, $value) {
$this->_request[] = new SimpleEncodedPair($key, $value); $this->_request[] = new SimpleEncodedPair($key, $value);
} }
/** /**
* Adds a MIME part to the query. Does nothing for a * Adds a MIME part to the query. Does nothing for a
* form encoded packet. * form encoded packet.
@ -254,7 +254,7 @@ class SimpleEncoding {
function attach($key, $content, $filename) { function attach($key, $content, $filename) {
$this->_request[] = new SimpleAttachment($key, $content, $filename); $this->_request[] = new SimpleAttachment($key, $content, $filename);
} }
/** /**
* Adds a set of parameters to this query. * Adds a set of parameters to this query.
* @param array/SimpleQueryString $query Multiple values are * @param array/SimpleQueryString $query Multiple values are
@ -270,7 +270,7 @@ class SimpleEncoding {
} }
} }
} }
/** /**
* Accessor for single value. * Accessor for single value.
* @return string/array False if missing, string * @return string/array False if missing, string
@ -293,7 +293,7 @@ class SimpleEncoding {
return $values; return $values;
} }
} }
/** /**
* Accessor for listing of pairs. * Accessor for listing of pairs.
* @return array All pair objects. * @return array All pair objects.
@ -302,7 +302,7 @@ class SimpleEncoding {
function getAll() { function getAll() {
return $this->_request; return $this->_request;
} }
/** /**
* Renders the query string as a URL encoded * Renders the query string as a URL encoded
* request part. * request part.
@ -327,7 +327,7 @@ class SimpleEncoding {
* @subpackage WebTester * @subpackage WebTester
*/ */
class SimpleGetEncoding extends SimpleEncoding { class SimpleGetEncoding extends SimpleEncoding {
/** /**
* Starts empty. * Starts empty.
* @param array $query Hash of parameters. * @param array $query Hash of parameters.
@ -335,10 +335,10 @@ class SimpleGetEncoding extends SimpleEncoding {
* as lists on a single key. * as lists on a single key.
* @access public * @access public
*/ */
function SimpleGetEncoding($query = false) { function __construct($query = false) {
$this->SimpleEncoding($query); parent::__construct($query);
} }
/** /**
* HTTP request method. * HTTP request method.
* @return string Always GET. * @return string Always GET.
@ -347,7 +347,7 @@ class SimpleGetEncoding extends SimpleEncoding {
function getMethod() { function getMethod() {
return 'GET'; return 'GET';
} }
/** /**
* Writes no extra headers. * Writes no extra headers.
* @param SimpleSocket $socket Socket to write to. * @param SimpleSocket $socket Socket to write to.
@ -355,7 +355,7 @@ class SimpleGetEncoding extends SimpleEncoding {
*/ */
function writeHeadersTo(&$socket) { function writeHeadersTo(&$socket) {
} }
/** /**
* No data is sent to the socket as the data is encoded into * No data is sent to the socket as the data is encoded into
* the URL. * the URL.
@ -364,7 +364,7 @@ class SimpleGetEncoding extends SimpleEncoding {
*/ */
function writeTo(&$socket) { function writeTo(&$socket) {
} }
/** /**
* Renders the query string as a URL encoded * Renders the query string as a URL encoded
* request part for attaching to a URL. * request part for attaching to a URL.
@ -382,7 +382,7 @@ class SimpleGetEncoding extends SimpleEncoding {
* @subpackage WebTester * @subpackage WebTester
*/ */
class SimpleHeadEncoding extends SimpleGetEncoding { class SimpleHeadEncoding extends SimpleGetEncoding {
/** /**
* Starts empty. * Starts empty.
* @param array $query Hash of parameters. * @param array $query Hash of parameters.
@ -393,7 +393,7 @@ class SimpleHeadEncoding extends SimpleGetEncoding {
function __construct($query = false) { function __construct($query = false) {
parent::__construct($query); parent::__construct($query);
} }
/** /**
* HTTP request method. * HTTP request method.
* @return string Always HEAD. * @return string Always HEAD.
@ -411,7 +411,7 @@ class SimpleHeadEncoding extends SimpleGetEncoding {
* @subpackage WebTester * @subpackage WebTester
*/ */
class SimplePostEncoding extends SimpleEncoding { class SimplePostEncoding extends SimpleEncoding {
/** /**
* Starts empty. * Starts empty.
* @param array $query Hash of parameters. * @param array $query Hash of parameters.
@ -425,7 +425,7 @@ class SimplePostEncoding extends SimpleEncoding {
} }
parent::__construct($query); parent::__construct($query);
} }
function hasMoreThanOneLevel($query) { function hasMoreThanOneLevel($query) {
foreach ($query as $key => $value) { foreach ($query as $key => $value) {
if (is_array($value)) { if (is_array($value)) {
@ -449,11 +449,11 @@ class SimplePostEncoding extends SimpleEncoding {
if ($this->hasMoreThanOneLevel($query_)) { if ($this->hasMoreThanOneLevel($query_)) {
$query_ = $this->rewriteArrayWithMultipleLevels($query_); $query_ = $this->rewriteArrayWithMultipleLevels($query_);
} }
return $query_; return $query_;
} }
/** /**
* HTTP request method. * HTTP request method.
* @return string Always POST. * @return string Always POST.
@ -462,7 +462,7 @@ class SimplePostEncoding extends SimpleEncoding {
function getMethod() { function getMethod() {
return 'POST'; return 'POST';
} }
/** /**
* Dispatches the form headers down the socket. * Dispatches the form headers down the socket.
* @param SimpleSocket $socket Socket to write to. * @param SimpleSocket $socket Socket to write to.
@ -472,7 +472,7 @@ class SimplePostEncoding extends SimpleEncoding {
$socket->write("Content-Length: " . (integer)strlen($this->_encode()) . "\r\n"); $socket->write("Content-Length: " . (integer)strlen($this->_encode()) . "\r\n");
$socket->write("Content-Type: application/x-www-form-urlencoded\r\n"); $socket->write("Content-Type: application/x-www-form-urlencoded\r\n");
} }
/** /**
* Dispatches the form data down the socket. * Dispatches the form data down the socket.
* @param SimpleSocket $socket Socket to write to. * @param SimpleSocket $socket Socket to write to.
@ -481,7 +481,7 @@ class SimplePostEncoding extends SimpleEncoding {
function writeTo(&$socket) { function writeTo(&$socket) {
$socket->write($this->_encode()); $socket->write($this->_encode());
} }
/** /**
* Renders the query string as a URL encoded * Renders the query string as a URL encoded
* request part for attaching to a URL. * request part for attaching to a URL.
@ -501,7 +501,7 @@ class SimplePostEncoding extends SimpleEncoding {
*/ */
class SimpleMultipartEncoding extends SimplePostEncoding { class SimpleMultipartEncoding extends SimplePostEncoding {
var $_boundary; var $_boundary;
/** /**
* Starts empty. * Starts empty.
* @param array $query Hash of parameters. * @param array $query Hash of parameters.
@ -513,7 +513,7 @@ class SimpleMultipartEncoding extends SimplePostEncoding {
parent::__construct($query); parent::__construct($query);
$this->_boundary = ($boundary === false ? uniqid('st') : $boundary); $this->_boundary = ($boundary === false ? uniqid('st') : $boundary);
} }
/** /**
* Dispatches the form headers down the socket. * Dispatches the form headers down the socket.
* @param SimpleSocket $socket Socket to write to. * @param SimpleSocket $socket Socket to write to.
@ -523,7 +523,7 @@ class SimpleMultipartEncoding extends SimplePostEncoding {
$socket->write("Content-Length: " . (integer)strlen($this->_encode()) . "\r\n"); $socket->write("Content-Length: " . (integer)strlen($this->_encode()) . "\r\n");
$socket->write("Content-Type: multipart/form-data, boundary=" . $this->_boundary . "\r\n"); $socket->write("Content-Type: multipart/form-data, boundary=" . $this->_boundary . "\r\n");
} }
/** /**
* Dispatches the form data down the socket. * Dispatches the form data down the socket.
* @param SimpleSocket $socket Socket to write to. * @param SimpleSocket $socket Socket to write to.
@ -532,7 +532,7 @@ class SimpleMultipartEncoding extends SimplePostEncoding {
function writeTo(&$socket) { function writeTo(&$socket) {
$socket->write($this->_encode()); $socket->write($this->_encode());
} }
/** /**
* Renders the query string as a URL encoded * Renders the query string as a URL encoded
* request part. * request part.

View File

@ -5,7 +5,7 @@
* @subpackage WebTester * @subpackage WebTester
* @version $Id: form.php 1672 2008-03-02 04:47:34Z edwardzyang $ * @version $Id: form.php 1672 2008-03-02 04:47:34Z edwardzyang $
*/ */
/**#@+ /**#@+
* include SimpleTest files * include SimpleTest files
*/ */
@ -30,7 +30,7 @@ class SimpleForm {
var $_widgets; var $_widgets;
var $_radios; var $_radios;
var $_checkboxes; var $_checkboxes;
/** /**
* Starts with no held controls/widgets. * Starts with no held controls/widgets.
* @param SimpleTag $tag Form tag to read. * @param SimpleTag $tag Form tag to read.
@ -48,7 +48,7 @@ class SimpleForm {
$this->_radios = array(); $this->_radios = array();
$this->_checkboxes = array(); $this->_checkboxes = array();
} }
/** /**
* Creates the request packet to be sent by the form. * Creates the request packet to be sent by the form.
* @param SimpleTag $tag Form tag to read. * @param SimpleTag $tag Form tag to read.
@ -64,7 +64,7 @@ class SimpleForm {
} }
return 'SimpleGetEncoding'; return 'SimpleGetEncoding';
} }
/** /**
* Sets the frame target within a frameset. * Sets the frame target within a frameset.
* @param string $frame Name of frame. * @param string $frame Name of frame.
@ -73,7 +73,7 @@ class SimpleForm {
function setDefaultTarget($frame) { function setDefaultTarget($frame) {
$this->_default_target = $frame; $this->_default_target = $frame;
} }
/** /**
* Accessor for method of form submission. * Accessor for method of form submission.
* @return string Either get or post. * @return string Either get or post.
@ -82,7 +82,7 @@ class SimpleForm {
function getMethod() { function getMethod() {
return ($this->_method ? strtolower($this->_method) : 'get'); return ($this->_method ? strtolower($this->_method) : 'get');
} }
/** /**
* Combined action attribute with current location * Combined action attribute with current location
* to get an absolute form target. * to get an absolute form target.
@ -96,7 +96,7 @@ class SimpleForm {
} }
return $page->expandUrl(new SimpleUrl($action));; return $page->expandUrl(new SimpleUrl($action));;
} }
/** /**
* Absolute URL of the target. * Absolute URL of the target.
* @return SimpleUrl URL target. * @return SimpleUrl URL target.
@ -109,7 +109,7 @@ class SimpleForm {
} }
return $url; return $url;
} }
/** /**
* Creates the encoding for the current values in the * Creates the encoding for the current values in the
* form. * form.
@ -124,7 +124,7 @@ class SimpleForm {
} }
return $encoding; return $encoding;
} }
/** /**
* ID field of form for unique identification. * ID field of form for unique identification.
* @return string Unique tag ID. * @return string Unique tag ID.
@ -133,7 +133,7 @@ class SimpleForm {
function getId() { function getId() {
return $this->_id; return $this->_id;
} }
/** /**
* Adds a tag contents to the form. * Adds a tag contents to the form.
* @param SimpleWidget $tag Input tag to add. * @param SimpleWidget $tag Input tag to add.
@ -148,7 +148,7 @@ class SimpleForm {
$this->_setWidget($tag); $this->_setWidget($tag);
} }
} }
/** /**
* Sets the widget into the form, grouping radio * Sets the widget into the form, grouping radio
* buttons if any. * buttons if any.
@ -164,7 +164,7 @@ class SimpleForm {
$this->_widgets[] = &$tag; $this->_widgets[] = &$tag;
} }
} }
/** /**
* Adds a radio button, building a group if necessary. * Adds a radio button, building a group if necessary.
* @param SimpleRadioButtonTag $tag Incoming form control. * @param SimpleRadioButtonTag $tag Incoming form control.
@ -177,7 +177,7 @@ class SimpleForm {
} }
$this->_widgets[$this->_radios[$tag->getName()]]->addWidget($tag); $this->_widgets[$this->_radios[$tag->getName()]]->addWidget($tag);
} }
/** /**
* Adds a checkbox, making it a group on a repeated name. * Adds a checkbox, making it a group on a repeated name.
* @param SimpleCheckboxTag $tag Incoming form control. * @param SimpleCheckboxTag $tag Incoming form control.
@ -197,7 +197,7 @@ class SimpleForm {
$this->_widgets[$index]->addWidget($tag); $this->_widgets[$index]->addWidget($tag);
} }
} }
/** /**
* Extracts current value from form. * Extracts current value from form.
* @param SimpleSelector $selector Criteria to apply. * @param SimpleSelector $selector Criteria to apply.
@ -218,7 +218,7 @@ class SimpleForm {
} }
return null; return null;
} }
/** /**
* Sets a widget value within the form. * Sets a widget value within the form.
* @param SimpleSelector $selector Criteria to apply. * @param SimpleSelector $selector Criteria to apply.
@ -243,7 +243,7 @@ class SimpleForm {
} }
return $success; return $success;
} }
/** /**
* Used by the page object to set widgets labels to * Used by the page object to set widgets labels to
* external label tags. * external label tags.
@ -260,7 +260,7 @@ class SimpleForm {
} }
} }
} }
/** /**
* Test to see if a form has a submit button. * Test to see if a form has a submit button.
* @param SimpleSelector $selector Criteria to apply. * @param SimpleSelector $selector Criteria to apply.
@ -275,7 +275,7 @@ class SimpleForm {
} }
return false; return false;
} }
/** /**
* Test to see if a form has an image control. * Test to see if a form has an image control.
* @param SimpleSelector $selector Criteria to apply. * @param SimpleSelector $selector Criteria to apply.
@ -290,7 +290,7 @@ class SimpleForm {
} }
return false; return false;
} }
/** /**
* Gets the submit values for a selected button. * Gets the submit values for a selected button.
* @param SimpleSelector $selector Criteria to apply. * @param SimpleSelector $selector Criteria to apply.
@ -309,12 +309,12 @@ class SimpleForm {
if ($additional) { if ($additional) {
$encoding->merge($additional); $encoding->merge($additional);
} }
return $encoding; return $encoding;
} }
} }
return false; return false;
} }
/** /**
* Gets the submit values for an image. * Gets the submit values for an image.
* @param SimpleSelector $selector Criteria to apply. * @param SimpleSelector $selector Criteria to apply.
@ -335,12 +335,12 @@ class SimpleForm {
if ($additional) { if ($additional) {
$encoding->merge($additional); $encoding->merge($additional);
} }
return $encoding; return $encoding;
} }
} }
return false; return false;
} }
/** /**
* Simply submits the form without the submit button * Simply submits the form without the submit button
* value. Used when there is only one button or it * value. Used when there is only one button or it

View File

@ -22,7 +22,7 @@ require_once(dirname(__FILE__) . '/url.php');
*/ */
class SimpleRoute { class SimpleRoute {
var $_url; var $_url;
/** /**
* Sets the target URL. * Sets the target URL.
* @param SimpleUrl $url URL as object. * @param SimpleUrl $url URL as object.
@ -31,7 +31,7 @@ class SimpleRoute {
function __construct($url) { function __construct($url) {
$this->_url = $url; $this->_url = $url;
} }
/** /**
* Resource name. * Resource name.
* @return SimpleUrl Current url. * @return SimpleUrl Current url.
@ -40,7 +40,7 @@ class SimpleRoute {
function getUrl() { function getUrl() {
return $this->_url; return $this->_url;
} }
/** /**
* Creates the first line which is the actual request. * Creates the first line which is the actual request.
* @param string $method HTTP request method, usually GET. * @param string $method HTTP request method, usually GET.
@ -51,7 +51,7 @@ class SimpleRoute {
return $method . ' ' . $this->_url->getPath() . return $method . ' ' . $this->_url->getPath() .
$this->_url->getEncodedRequest() . ' HTTP/1.0'; $this->_url->getEncodedRequest() . ' HTTP/1.0';
} }
/** /**
* Creates the host part of the request. * Creates the host part of the request.
* @return string Host line content. * @return string Host line content.
@ -64,7 +64,7 @@ class SimpleRoute {
} }
return $line; return $line;
} }
/** /**
* Opens a socket to the route. * Opens a socket to the route.
* @param string $method HTTP request method, usually GET. * @param string $method HTTP request method, usually GET.
@ -86,7 +86,7 @@ class SimpleRoute {
} }
return $socket; return $socket;
} }
/** /**
* Factory for socket. * Factory for socket.
* @param string $scheme Protocol to use. * @param string $scheme Protocol to use.
@ -116,7 +116,7 @@ class SimpleProxyRoute extends SimpleRoute {
var $_proxy; var $_proxy;
var $_username; var $_username;
var $_password; var $_password;
/** /**
* Stashes the proxy address. * Stashes the proxy address.
* @param SimpleUrl $url URL as object. * @param SimpleUrl $url URL as object.
@ -131,7 +131,7 @@ class SimpleProxyRoute extends SimpleRoute {
$this->_username = $username; $this->_username = $username;
$this->_password = $password; $this->_password = $password;
} }
/** /**
* Creates the first line which is the actual request. * Creates the first line which is the actual request.
* @param string $method HTTP request method, usually GET. * @param string $method HTTP request method, usually GET.
@ -146,7 +146,7 @@ class SimpleProxyRoute extends SimpleRoute {
return $method . ' ' . $scheme . '://' . $url->getHost() . $port . return $method . ' ' . $scheme . '://' . $url->getHost() . $port .
$url->getPath() . $url->getEncodedRequest() . ' HTTP/1.0'; $url->getPath() . $url->getEncodedRequest() . ' HTTP/1.0';
} }
/** /**
* Creates the host part of the request. * Creates the host part of the request.
* @param SimpleUrl $url URL as object. * @param SimpleUrl $url URL as object.
@ -158,7 +158,7 @@ class SimpleProxyRoute extends SimpleRoute {
$port = $this->_proxy->getPort() ? $this->_proxy->getPort() : 8080; $port = $this->_proxy->getPort() ? $this->_proxy->getPort() : 8080;
return "$host:$port"; return "$host:$port";
} }
/** /**
* Opens a socket to the route. * Opens a socket to the route.
* @param string $method HTTP request method, usually GET. * @param string $method HTTP request method, usually GET.
@ -198,7 +198,7 @@ class SimpleHttpRequest {
var $_encoding; var $_encoding;
var $_headers; var $_headers;
var $_cookies; var $_cookies;
/** /**
* Builds the socket request from the different pieces. * Builds the socket request from the different pieces.
* These include proxy information, URL, cookies, headers, * These include proxy information, URL, cookies, headers,
@ -214,7 +214,7 @@ class SimpleHttpRequest {
$this->_headers = array(); $this->_headers = array();
$this->_cookies = array(); $this->_cookies = array();
} }
/** /**
* Dispatches the content to the route's socket. * Dispatches the content to the route's socket.
* @param integer $timeout Connection timeout. * @param integer $timeout Connection timeout.
@ -231,7 +231,7 @@ class SimpleHttpRequest {
$response = &$this->_createResponse($socket); $response = &$this->_createResponse($socket);
return $response; return $response;
} }
/** /**
* Sends the headers. * Sends the headers.
* @param SimpleSocket $socket Open socket. * @param SimpleSocket $socket Open socket.
@ -251,7 +251,7 @@ class SimpleHttpRequest {
$socket->write("\r\n"); $socket->write("\r\n");
$encoding->writeTo($socket); $encoding->writeTo($socket);
} }
/** /**
* Adds a header line to the request. * Adds a header line to the request.
* @param string $header_line Text of full header line. * @param string $header_line Text of full header line.
@ -260,7 +260,7 @@ class SimpleHttpRequest {
function addHeaderLine($header_line) { function addHeaderLine($header_line) {
$this->_headers[] = $header_line; $this->_headers[] = $header_line;
} }
/** /**
* Reads all the relevant cookies from the * Reads all the relevant cookies from the
* cookie jar. * cookie jar.
@ -271,7 +271,7 @@ class SimpleHttpRequest {
function readCookiesFromJar($jar, $url) { function readCookiesFromJar($jar, $url) {
$this->_cookies = $jar->selectAsPairs($url); $this->_cookies = $jar->selectAsPairs($url);
} }
/** /**
* Wraps the socket in a response parser. * Wraps the socket in a response parser.
* @param SimpleSocket $socket Responding socket. * @param SimpleSocket $socket Responding socket.
@ -301,7 +301,7 @@ class SimpleHttpHeaders {
var $_cookies; var $_cookies;
var $_authentication; var $_authentication;
var $_realm; var $_realm;
/** /**
* Parses the incoming header block. * Parses the incoming header block.
* @param string $headers Header block. * @param string $headers Header block.
@ -320,7 +320,7 @@ class SimpleHttpHeaders {
$this->_parseHeaderLine($header_line); $this->_parseHeaderLine($header_line);
} }
} }
/** /**
* Accessor for parsed HTTP protocol version. * Accessor for parsed HTTP protocol version.
* @return integer HTTP error code. * @return integer HTTP error code.
@ -329,7 +329,7 @@ class SimpleHttpHeaders {
function getHttpVersion() { function getHttpVersion() {
return $this->_http_version; return $this->_http_version;
} }
/** /**
* Accessor for raw header block. * Accessor for raw header block.
* @return string All headers as raw string. * @return string All headers as raw string.
@ -338,7 +338,7 @@ class SimpleHttpHeaders {
function getRaw() { function getRaw() {
return $this->_raw_headers; return $this->_raw_headers;
} }
/** /**
* Accessor for parsed HTTP error code. * Accessor for parsed HTTP error code.
* @return integer HTTP error code. * @return integer HTTP error code.
@ -347,7 +347,7 @@ class SimpleHttpHeaders {
function getResponseCode() { function getResponseCode() {
return (integer)$this->_response_code; return (integer)$this->_response_code;
} }
/** /**
* Returns the redirected URL or false if * Returns the redirected URL or false if
* no redirection. * no redirection.
@ -357,7 +357,7 @@ class SimpleHttpHeaders {
function getLocation() { function getLocation() {
return $this->_location; return $this->_location;
} }
/** /**
* Test to see if the response is a valid redirect. * Test to see if the response is a valid redirect.
* @return boolean True if valid redirect. * @return boolean True if valid redirect.
@ -367,7 +367,7 @@ class SimpleHttpHeaders {
return in_array($this->_response_code, array(301, 302, 303, 307)) && return in_array($this->_response_code, array(301, 302, 303, 307)) &&
(boolean)$this->getLocation(); (boolean)$this->getLocation();
} }
/** /**
* Test to see if the response is an authentication * Test to see if the response is an authentication
* challenge. * challenge.
@ -379,7 +379,7 @@ class SimpleHttpHeaders {
(boolean)$this->_authentication && (boolean)$this->_authentication &&
(boolean)$this->_realm; (boolean)$this->_realm;
} }
/** /**
* Accessor for MIME type header information. * Accessor for MIME type header information.
* @return string MIME type. * @return string MIME type.
@ -388,7 +388,7 @@ class SimpleHttpHeaders {
function getMimeType() { function getMimeType() {
return $this->_mime_type; return $this->_mime_type;
} }
/** /**
* Accessor for authentication type. * Accessor for authentication type.
* @return string Type. * @return string Type.
@ -397,7 +397,7 @@ class SimpleHttpHeaders {
function getAuthentication() { function getAuthentication() {
return $this->_authentication; return $this->_authentication;
} }
/** /**
* Accessor for security realm. * Accessor for security realm.
* @return string Realm. * @return string Realm.
@ -406,7 +406,7 @@ class SimpleHttpHeaders {
function getRealm() { function getRealm() {
return $this->_realm; return $this->_realm;
} }
/** /**
* Writes new cookies to the cookie jar. * Writes new cookies to the cookie jar.
* @param SimpleCookieJar $jar Jar to write to. * @param SimpleCookieJar $jar Jar to write to.
@ -449,7 +449,7 @@ class SimpleHttpHeaders {
$this->_realm = trim($matches[2]); $this->_realm = trim($matches[2]);
} }
} }
/** /**
* Parse the Set-cookie content. * Parse the Set-cookie content.
* @param string $cookie_line Text after "Set-cookie:" * @param string $cookie_line Text after "Set-cookie:"
@ -484,7 +484,7 @@ class SimpleHttpResponse extends SimpleStickyError {
var $_sent; var $_sent;
var $_content; var $_content;
var $_headers; var $_headers;
/** /**
* Constructor. Reads and parses the incoming * Constructor. Reads and parses the incoming
* content and headers. * content and headers.
@ -507,7 +507,7 @@ class SimpleHttpResponse extends SimpleStickyError {
} }
$this->_parse($raw); $this->_parse($raw);
} }
/** /**
* Splits up the headers and the rest of the content. * Splits up the headers and the rest of the content.
* @param string $raw Content to parse. * @param string $raw Content to parse.
@ -525,7 +525,7 @@ class SimpleHttpResponse extends SimpleStickyError {
$this->_headers = new SimpleHttpHeaders($headers); $this->_headers = new SimpleHttpHeaders($headers);
} }
} }
/** /**
* Original request method. * Original request method.
* @return string GET, POST or HEAD. * @return string GET, POST or HEAD.
@ -534,7 +534,7 @@ class SimpleHttpResponse extends SimpleStickyError {
function getMethod() { function getMethod() {
return $this->_encoding->getMethod(); return $this->_encoding->getMethod();
} }
/** /**
* Resource name. * Resource name.
* @return SimpleUrl Current url. * @return SimpleUrl Current url.
@ -543,7 +543,7 @@ class SimpleHttpResponse extends SimpleStickyError {
function getUrl() { function getUrl() {
return $this->_url; return $this->_url;
} }
/** /**
* Original request data. * Original request data.
* @return mixed Sent content. * @return mixed Sent content.
@ -552,7 +552,7 @@ class SimpleHttpResponse extends SimpleStickyError {
function getRequestData() { function getRequestData() {
return $this->_encoding; return $this->_encoding;
} }
/** /**
* Raw request that was sent down the wire. * Raw request that was sent down the wire.
* @return string Bytes actually sent. * @return string Bytes actually sent.
@ -561,7 +561,7 @@ class SimpleHttpResponse extends SimpleStickyError {
function getSent() { function getSent() {
return $this->_sent; return $this->_sent;
} }
/** /**
* Accessor for the content after the last * Accessor for the content after the last
* header line. * header line.
@ -571,7 +571,7 @@ class SimpleHttpResponse extends SimpleStickyError {
function getContent() { function getContent() {
return $this->_content; return $this->_content;
} }
/** /**
* Accessor for header block. The response is the * Accessor for header block. The response is the
* combination of this and the content. * combination of this and the content.
@ -581,7 +581,7 @@ class SimpleHttpResponse extends SimpleStickyError {
function getHeaders() { function getHeaders() {
return $this->_headers; return $this->_headers;
} }
/** /**
* Accessor for any new cookies. * Accessor for any new cookies.
* @return array List of new cookies. * @return array List of new cookies.
@ -590,7 +590,7 @@ class SimpleHttpResponse extends SimpleStickyError {
function getNewCookies() { function getNewCookies() {
return $this->_headers->getNewCookies(); return $this->_headers->getNewCookies();
} }
/** /**
* Reads the whole of the socket output into a * Reads the whole of the socket output into a
* single string. * single string.
@ -606,7 +606,7 @@ class SimpleHttpResponse extends SimpleStickyError {
} }
return $all; return $all;
} }
/** /**
* Test to see if the packet from the socket is the * Test to see if the packet from the socket is the
* last one. * last one.

View File

@ -130,6 +130,7 @@ class SimplePageBuilder extends SimpleSaxListener {
function __construct() { function __construct() {
parent::__construct(); parent::__construct();
} }
/** /**
* Frees up any references so as to allow the PHP garbage * Frees up any references so as to allow the PHP garbage
* collection from unset() to work. * collection from unset() to work.
@ -178,7 +179,7 @@ class SimplePageBuilder extends SimpleSaxListener {
$parser = new SimpleHtmlSaxParser($listener); $parser = new SimpleHtmlSaxParser($listener);
return $parser; return $parser;
} }
/** /**
* Start of element event. Opens a new tag. * Start of element event. Opens a new tag.
* @param string $name Element name. * @param string $name Element name.

View File

@ -30,7 +30,7 @@ class ParallelRegex {
var $_labels; var $_labels;
var $_regex; var $_regex;
var $_case; var $_case;
/** /**
* Constructor. Starts with no patterns. * Constructor. Starts with no patterns.
* @param boolean $case True for case sensitive, false * @param boolean $case True for case sensitive, false
@ -43,7 +43,7 @@ class ParallelRegex {
$this->_labels = array(); $this->_labels = array();
$this->_regex = null; $this->_regex = null;
} }
/** /**
* Adds a pattern with an optional label. * Adds a pattern with an optional label.
* @param string $pattern Perl style regex, but ( and ) * @param string $pattern Perl style regex, but ( and )
@ -58,7 +58,7 @@ class ParallelRegex {
$this->_labels[$count] = $label; $this->_labels[$count] = $label;
$this->_regex = null; $this->_regex = null;
} }
/** /**
* Attempts to match all patterns at once against * Attempts to match all patterns at once against
* a string. * a string.
@ -84,7 +84,7 @@ class ParallelRegex {
} }
return true; return true;
} }
/** /**
* Compounds the patterns into a single * Compounds the patterns into a single
* regular expression separated with the * regular expression separated with the
@ -105,7 +105,7 @@ class ParallelRegex {
} }
return $this->_regex; return $this->_regex;
} }
/** /**
* Accessor for perl regex mode flags to use. * Accessor for perl regex mode flags to use.
* @return string Perl regex flags. * @return string Perl regex flags.
@ -123,7 +123,7 @@ class ParallelRegex {
*/ */
class SimpleStateStack { class SimpleStateStack {
var $_stack; var $_stack;
/** /**
* Constructor. Starts in named state. * Constructor. Starts in named state.
* @param string $start Starting state name. * @param string $start Starting state name.
@ -132,7 +132,7 @@ class SimpleStateStack {
function __construct($start) { function __construct($start) {
$this->_stack = array($start); $this->_stack = array($start);
} }
/** /**
* Accessor for current state. * Accessor for current state.
* @return string State. * @return string State.
@ -141,7 +141,7 @@ class SimpleStateStack {
function getCurrent() { function getCurrent() {
return $this->_stack[count($this->_stack) - 1]; return $this->_stack[count($this->_stack) - 1];
} }
/** /**
* Adds a state to the stack and sets it * Adds a state to the stack and sets it
* to be the current state. * to be the current state.
@ -151,7 +151,7 @@ class SimpleStateStack {
function enter($state) { function enter($state) {
array_push($this->_stack, $state); array_push($this->_stack, $state);
} }
/** /**
* Leaves the current state and reverts * Leaves the current state and reverts
* to the previous one. * to the previous one.
@ -183,7 +183,7 @@ class SimpleLexer {
var $_mode; var $_mode;
var $_mode_handlers; var $_mode_handlers;
var $_case; var $_case;
/** /**
* Sets up the lexer in case insensitive matching * Sets up the lexer in case insensitive matching
* by default. * by default.
@ -200,7 +200,7 @@ class SimpleLexer {
$this->_mode = new SimpleStateStack($start); $this->_mode = new SimpleStateStack($start);
$this->_mode_handlers = array($start => $start); $this->_mode_handlers = array($start => $start);
} }
/** /**
* Adds a token search pattern for a particular * Adds a token search pattern for a particular
* parsing mode. The pattern does not change the * parsing mode. The pattern does not change the
@ -221,7 +221,7 @@ class SimpleLexer {
$this->_mode_handlers[$mode] = $mode; $this->_mode_handlers[$mode] = $mode;
} }
} }
/** /**
* Adds a pattern that will enter a new parsing * Adds a pattern that will enter a new parsing
* mode. Useful for entering parenthesis, strings, * mode. Useful for entering parenthesis, strings,
@ -244,7 +244,7 @@ class SimpleLexer {
$this->_mode_handlers[$new_mode] = $new_mode; $this->_mode_handlers[$new_mode] = $new_mode;
} }
} }
/** /**
* Adds a pattern that will exit the current mode * Adds a pattern that will exit the current mode
* and re-enter the previous one. * and re-enter the previous one.
@ -262,7 +262,7 @@ class SimpleLexer {
$this->_mode_handlers[$mode] = $mode; $this->_mode_handlers[$mode] = $mode;
} }
} }
/** /**
* Adds a pattern that has a special mode. Acts as an entry * Adds a pattern that has a special mode. Acts as an entry
* and exit pattern in one go, effectively calling a special * and exit pattern in one go, effectively calling a special
@ -284,7 +284,7 @@ class SimpleLexer {
$this->_mode_handlers[$special] = $special; $this->_mode_handlers[$special] = $special;
} }
} }
/** /**
* Adds a mapping from a mode to another handler. * Adds a mapping from a mode to another handler.
* @param string $mode Mode to be remapped. * @param string $mode Mode to be remapped.
@ -294,7 +294,7 @@ class SimpleLexer {
function mapHandler($mode, $handler) { function mapHandler($mode, $handler) {
$this->_mode_handlers[$mode] = $handler; $this->_mode_handlers[$mode] = $handler;
} }
/** /**
* Splits the page text into tokens. Will fail * Splits the page text into tokens. Will fail
* if the handlers report an error or if no * if the handlers report an error or if no
@ -328,7 +328,7 @@ class SimpleLexer {
} }
return $this->_invokeParser($raw, LEXER_UNMATCHED); return $this->_invokeParser($raw, LEXER_UNMATCHED);
} }
/** /**
* Sends the matched token and any leading unmatched * Sends the matched token and any leading unmatched
* text to the parser changing the lexer to a new * text to the parser changing the lexer to a new
@ -364,7 +364,7 @@ class SimpleLexer {
$this->_mode->enter($mode); $this->_mode->enter($mode);
return $this->_invokeParser($matched, LEXER_ENTER); return $this->_invokeParser($matched, LEXER_ENTER);
} }
/** /**
* Tests to see if the new mode is actually to leave * Tests to see if the new mode is actually to leave
* the current mode and pop an item from the matching * the current mode and pop an item from the matching
@ -376,7 +376,7 @@ class SimpleLexer {
function _isModeEnd($mode) { function _isModeEnd($mode) {
return ($mode === "__exit"); return ($mode === "__exit");
} }
/** /**
* Test to see if the mode is one where this mode * Test to see if the mode is one where this mode
* is entered for this token only and automatically * is entered for this token only and automatically
@ -388,7 +388,7 @@ class SimpleLexer {
function _isSpecialMode($mode) { function _isSpecialMode($mode) {
return (strncmp($mode, "_", 1) == 0); return (strncmp($mode, "_", 1) == 0);
} }
/** /**
* Strips the magic underscore marking single token * Strips the magic underscore marking single token
* modes. * modes.
@ -399,7 +399,7 @@ class SimpleLexer {
function _decodeSpecial($mode) { function _decodeSpecial($mode) {
return substr($mode, 1); return substr($mode, 1);
} }
/** /**
* Calls the parser method named after the current * Calls the parser method named after the current
* mode. Empty content will be ignored. The lexer * mode. Empty content will be ignored. The lexer
@ -416,7 +416,7 @@ class SimpleLexer {
$handler = $this->_mode_handlers[$this->_mode->getCurrent()]; $handler = $this->_mode_handlers[$this->_mode->getCurrent()];
return $this->_parser->$handler($content, $is_match); return $this->_parser->$handler($content, $is_match);
} }
/** /**
* Tries to match a chunk of text and if successful * Tries to match a chunk of text and if successful
* removes the recognised chunk and any leading * removes the recognised chunk and any leading
@ -448,7 +448,7 @@ class SimpleLexer {
* @subpackage WebTester * @subpackage WebTester
*/ */
class SimpleHtmlLexer extends SimpleLexer { class SimpleHtmlLexer extends SimpleLexer {
/** /**
* Sets up the lexer with case insensitive matching * Sets up the lexer with case insensitive matching
* and adds the HTML handlers. * and adds the HTML handlers.
@ -465,7 +465,7 @@ class SimpleHtmlLexer extends SimpleLexer {
} }
$this->_addInTagTokens(); $this->_addInTagTokens();
} }
/** /**
* List of parsed tags. Others are ignored. * List of parsed tags. Others are ignored.
* @return array List of searched for tags. * @return array List of searched for tags.
@ -475,7 +475,7 @@ class SimpleHtmlLexer extends SimpleLexer {
return array('a', 'base', 'title', 'form', 'input', 'button', 'textarea', 'select', return array('a', 'base', 'title', 'form', 'input', 'button', 'textarea', 'select',
'option', 'frameset', 'frame', 'label'); 'option', 'frameset', 'frame', 'label');
} }
/** /**
* The lexer has to skip certain sections such * The lexer has to skip certain sections such
* as server code, client code and styles. * as server code, client code and styles.
@ -492,7 +492,7 @@ class SimpleHtmlLexer extends SimpleLexer {
$this->addEntryPattern('<!--', 'text', 'comment'); $this->addEntryPattern('<!--', 'text', 'comment');
$this->addExitPattern('-->', 'comment'); $this->addExitPattern('-->', 'comment');
} }
/** /**
* Pattern matches to start and end a tag. * Pattern matches to start and end a tag.
* @param string $tag Name of tag to scan for. * @param string $tag Name of tag to scan for.
@ -502,7 +502,7 @@ class SimpleHtmlLexer extends SimpleLexer {
$this->addSpecialPattern("</$tag>", 'text', 'acceptEndToken'); $this->addSpecialPattern("</$tag>", 'text', 'acceptEndToken');
$this->addEntryPattern("<$tag", 'text', 'tag'); $this->addEntryPattern("<$tag", 'text', 'tag');
} }
/** /**
* Pattern matches to parse the inside of a tag * Pattern matches to parse the inside of a tag
* including the attributes and their quoting. * including the attributes and their quoting.
@ -515,7 +515,7 @@ class SimpleHtmlLexer extends SimpleLexer {
$this->addExitPattern('/>', 'tag'); $this->addExitPattern('/>', 'tag');
$this->addExitPattern('>', 'tag'); $this->addExitPattern('>', 'tag');
} }
/** /**
* Matches attributes that are either single quoted, * Matches attributes that are either single quoted,
* double quoted or unquoted. * double quoted or unquoted.
@ -546,7 +546,7 @@ class SimpleHtmlSaxParser {
var $_tag; var $_tag;
var $_attributes; var $_attributes;
var $_current_attribute; var $_current_attribute;
/** /**
* Sets the listener. * Sets the listener.
* @param SimpleSaxListener $listener SAX event handler. * @param SimpleSaxListener $listener SAX event handler.
@ -559,7 +559,7 @@ class SimpleHtmlSaxParser {
$this->_attributes = array(); $this->_attributes = array();
$this->_current_attribute = ''; $this->_current_attribute = '';
} }
/** /**
* Runs the content through the lexer which * Runs the content through the lexer which
* should call back to the acceptors. * should call back to the acceptors.
@ -570,7 +570,7 @@ class SimpleHtmlSaxParser {
function parse($raw) { function parse($raw) {
return $this->_lexer->parse($raw); return $this->_lexer->parse($raw);
} }
/** /**
* Sets up the matching lexer. Starts in 'text' mode. * Sets up the matching lexer. Starts in 'text' mode.
* @param SimpleSaxParser $parser Event generator, usually $self. * @param SimpleSaxParser $parser Event generator, usually $self.
@ -582,7 +582,7 @@ class SimpleHtmlSaxParser {
$lexer = new SimpleHtmlLexer($parser); $lexer = new SimpleHtmlLexer($parser);
return $lexer; return $lexer;
} }
/** /**
* Accepts a token from the tag mode. If the * Accepts a token from the tag mode. If the
* starting element completes then the element * starting element completes then the element
@ -613,7 +613,7 @@ class SimpleHtmlSaxParser {
} }
return true; return true;
} }
/** /**
* Accepts a token from the end tag mode. * Accepts a token from the end tag mode.
* The element name is converted to lower case. * The element name is converted to lower case.
@ -628,7 +628,7 @@ class SimpleHtmlSaxParser {
} }
return $this->_listener->endElement(strtolower($matches[1])); return $this->_listener->endElement(strtolower($matches[1]));
} }
/** /**
* Part of the tag data. * Part of the tag data.
* @param string $token Incoming characters. * @param string $token Incoming characters.
@ -649,7 +649,7 @@ class SimpleHtmlSaxParser {
} }
return true; return true;
} }
/** /**
* A character entity. * A character entity.
* @param string $token Incoming characters. * @param string $token Incoming characters.
@ -659,7 +659,7 @@ class SimpleHtmlSaxParser {
*/ */
function acceptEntityToken($token, $event) { function acceptEntityToken($token, $event) {
} }
/** /**
* Character data between tags regarded as * Character data between tags regarded as
* important. * important.
@ -671,7 +671,7 @@ class SimpleHtmlSaxParser {
function acceptTextToken($token, $event) { function acceptTextToken($token, $event) {
return $this->_listener->addContent($token); return $this->_listener->addContent($token);
} }
/** /**
* Incoming data to be ignored. * Incoming data to be ignored.
* @param string $token Incoming characters. * @param string $token Incoming characters.
@ -682,7 +682,7 @@ class SimpleHtmlSaxParser {
function ignore($token, $event) { function ignore($token, $event) {
return true; return true;
} }
/** /**
* Decodes any HTML entities. * Decodes any HTML entities.
* @param string $html Incoming HTML. * @param string $html Incoming HTML.
@ -693,7 +693,7 @@ class SimpleHtmlSaxParser {
static function decodeHtml($html) { static function decodeHtml($html) {
return html_entity_decode($html, ENT_QUOTES); return html_entity_decode($html, ENT_QUOTES);
} }
/** /**
* Turns HTML into text browser visible text. Images * Turns HTML into text browser visible text. Images
* are converted to their alt text and tags are supressed. * are converted to their alt text and tags are supressed.
@ -723,14 +723,14 @@ class SimpleHtmlSaxParser {
* @abstract * @abstract
*/ */
class SimpleSaxListener { class SimpleSaxListener {
/** /**
* Sets the document to write to. * Sets the document to write to.
* @access public * @access public
*/ */
function __construct() { function __construct() {
} }
/** /**
* Start of element event. * Start of element event.
* @param string $name Element name. * @param string $name Element name.
@ -742,7 +742,7 @@ class SimpleSaxListener {
*/ */
function startElement($name, $attributes) { function startElement($name, $attributes) {
} }
/** /**
* End of element event. * End of element event.
* @param string $name Element name. * @param string $name Element name.
@ -751,7 +751,7 @@ class SimpleSaxListener {
*/ */
function endElement($name) { function endElement($name) {
} }
/** /**
* Unparsed, but relevant data. * Unparsed, but relevant data.
* @param string $text May include unparsed tags. * @param string $text May include unparsed tags.

View File

@ -5,7 +5,7 @@
* @subpackage WebTester * @subpackage WebTester
* @version $Id: tag.php 1723 2008-04-08 00:34:10Z lastcraft $ * @version $Id: tag.php 1723 2008-04-08 00:34:10Z lastcraft $
*/ */
/**#@+ /**#@+
* include SimpleTest files * include SimpleTest files
*/ */
@ -22,7 +22,7 @@ class SimpleTag {
var $_name; var $_name;
var $_attributes; var $_attributes;
var $_content; var $_content;
/** /**
* Starts with a named tag with attributes only. * Starts with a named tag with attributes only.
* @param string $name Tag name. * @param string $name Tag name.
@ -36,7 +36,7 @@ class SimpleTag {
$this->_attributes = $attributes; $this->_attributes = $attributes;
$this->_content = ''; $this->_content = '';
} }
/** /**
* Check to see if the tag can have both start and * Check to see if the tag can have both start and
* end tags with content in between. * end tags with content in between.
@ -46,7 +46,7 @@ class SimpleTag {
function expectEndTag() { function expectEndTag() {
return true; return true;
} }
/** /**
* The current tag should not swallow all content for * The current tag should not swallow all content for
* itself as it's searchable page content. Private * itself as it's searchable page content. Private
@ -68,7 +68,7 @@ class SimpleTag {
function addContent($content) { function addContent($content) {
$this->_content .= (string)$content; $this->_content .= (string)$content;
} }
/** /**
* Adds an enclosed tag to the content. * Adds an enclosed tag to the content.
* @param SimpleTag $tag New tag. * @param SimpleTag $tag New tag.
@ -76,7 +76,7 @@ class SimpleTag {
*/ */
function addTag(&$tag) { function addTag(&$tag) {
} }
/** /**
* Accessor for tag name. * Accessor for tag name.
* @return string Name of tag. * @return string Name of tag.
@ -85,7 +85,7 @@ class SimpleTag {
function getTagName() { function getTagName() {
return $this->_name; return $this->_name;
} }
/** /**
* List of legal child elements. * List of legal child elements.
* @return array List of element names. * @return array List of element names.
@ -94,7 +94,7 @@ class SimpleTag {
function getChildElements() { function getChildElements() {
return array(); return array();
} }
/** /**
* Accessor for an attribute. * Accessor for an attribute.
* @param string $label Attribute name. * @param string $label Attribute name.
@ -108,7 +108,7 @@ class SimpleTag {
} }
return (string)$this->_attributes[$label]; return (string)$this->_attributes[$label];
} }
/** /**
* Sets an attribute. * Sets an attribute.
* @param string $label Attribute name. * @param string $label Attribute name.
@ -118,7 +118,7 @@ class SimpleTag {
function _setAttribute($label, $value) { function _setAttribute($label, $value) {
$this->_attributes[strtolower($label)] = $value; $this->_attributes[strtolower($label)] = $value;
} }
/** /**
* Accessor for the whole content so far. * Accessor for the whole content so far.
* @return string Content as big raw string. * @return string Content as big raw string.
@ -127,7 +127,7 @@ class SimpleTag {
function getContent() { function getContent() {
return $this->_content; return $this->_content;
} }
/** /**
* Accessor for content reduced to visible text. Acts * Accessor for content reduced to visible text. Acts
* like a text mode browser, normalising space and * like a text mode browser, normalising space and
@ -138,7 +138,7 @@ class SimpleTag {
function getText() { function getText() {
return SimpleHtmlSaxParser::normalise($this->_content); return SimpleHtmlSaxParser::normalise($this->_content);
} }
/** /**
* Test to see if id attribute matches. * Test to see if id attribute matches.
* @param string $id ID to test against. * @param string $id ID to test against.
@ -156,7 +156,7 @@ class SimpleTag {
* @subpackage WebTester * @subpackage WebTester
*/ */
class SimpleBaseTag extends SimpleTag { class SimpleBaseTag extends SimpleTag {
/** /**
* Starts with a named tag with attributes only. * Starts with a named tag with attributes only.
* @param hash $attributes Attribute names and * @param hash $attributes Attribute names and
@ -182,7 +182,7 @@ class SimpleBaseTag extends SimpleTag {
* @subpackage WebTester * @subpackage WebTester
*/ */
class SimpleTitleTag extends SimpleTag { class SimpleTitleTag extends SimpleTag {
/** /**
* Starts with a named tag with attributes only. * Starts with a named tag with attributes only.
* @param hash $attributes Attribute names and * @param hash $attributes Attribute names and
@ -199,7 +199,7 @@ class SimpleTitleTag extends SimpleTag {
* @subpackage WebTester * @subpackage WebTester
*/ */
class SimpleAnchorTag extends SimpleTag { class SimpleAnchorTag extends SimpleTag {
/** /**
* Starts with a named tag with attributes only. * Starts with a named tag with attributes only.
* @param hash $attributes Attribute names and * @param hash $attributes Attribute names and
@ -208,7 +208,7 @@ class SimpleAnchorTag extends SimpleTag {
function __construct($attributes) { function __construct($attributes) {
parent::__construct('a', $attributes); parent::__construct('a', $attributes);
} }
/** /**
* Accessor for URL as string. * Accessor for URL as string.
* @return string Coerced as string. * @return string Coerced as string.
@ -232,7 +232,7 @@ class SimpleWidget extends SimpleTag {
var $_value; var $_value;
var $_label; var $_label;
var $_is_set; var $_is_set;
/** /**
* Starts with a named tag with attributes only. * Starts with a named tag with attributes only.
* @param string $name Tag name. * @param string $name Tag name.
@ -245,7 +245,7 @@ class SimpleWidget extends SimpleTag {
$this->_label = false; $this->_label = false;
$this->_is_set = false; $this->_is_set = false;
} }
/** /**
* Accessor for name submitted as the key in * Accessor for name submitted as the key in
* GET/POST variables hash. * GET/POST variables hash.
@ -255,7 +255,7 @@ class SimpleWidget extends SimpleTag {
function getName() { function getName() {
return $this->getAttribute('name'); return $this->getAttribute('name');
} }
/** /**
* Accessor for default value parsed with the tag. * Accessor for default value parsed with the tag.
* @return string Parsed value. * @return string Parsed value.
@ -264,7 +264,7 @@ class SimpleWidget extends SimpleTag {
function getDefault() { function getDefault() {
return $this->getAttribute('value'); return $this->getAttribute('value');
} }
/** /**
* Accessor for currently set value or default if * Accessor for currently set value or default if
* none. * none.
@ -278,7 +278,7 @@ class SimpleWidget extends SimpleTag {
} }
return $this->_value; return $this->_value;
} }
/** /**
* Sets the current form element value. * Sets the current form element value.
* @param string $value New value. * @param string $value New value.
@ -290,7 +290,7 @@ class SimpleWidget extends SimpleTag {
$this->_is_set = true; $this->_is_set = true;
return true; return true;
} }
/** /**
* Resets the form element value back to the * Resets the form element value back to the
* default. * default.
@ -299,7 +299,7 @@ class SimpleWidget extends SimpleTag {
function resetValue() { function resetValue() {
$this->_is_set = false; $this->_is_set = false;
} }
/** /**
* Allows setting of a label externally, say by a * Allows setting of a label externally, say by a
* label tag. * label tag.
@ -309,7 +309,7 @@ class SimpleWidget extends SimpleTag {
function setLabel($label) { function setLabel($label) {
$this->_label = trim($label); $this->_label = trim($label);
} }
/** /**
* Reads external or internal label. * Reads external or internal label.
* @param string $label Label to test. * @param string $label Label to test.
@ -319,7 +319,7 @@ class SimpleWidget extends SimpleTag {
function isLabel($label) { function isLabel($label) {
return $this->_label == trim($label); return $this->_label == trim($label);
} }
/** /**
* Dispatches the value into the form encoded packet. * Dispatches the value into the form encoded packet.
* @param SimpleEncoding $encoding Form packet. * @param SimpleEncoding $encoding Form packet.
@ -338,7 +338,7 @@ class SimpleWidget extends SimpleTag {
* @subpackage WebTester * @subpackage WebTester
*/ */
class SimpleTextTag extends SimpleWidget { class SimpleTextTag extends SimpleWidget {
/** /**
* Starts with a named tag with attributes only. * Starts with a named tag with attributes only.
* @param hash $attributes Attribute names and * @param hash $attributes Attribute names and
@ -350,7 +350,7 @@ class SimpleTextTag extends SimpleWidget {
$this->_setAttribute('value', ''); $this->_setAttribute('value', '');
} }
} }
/** /**
* Tag contains no content. * Tag contains no content.
* @return boolean False. * @return boolean False.
@ -359,7 +359,7 @@ class SimpleTextTag extends SimpleWidget {
function expectEndTag() { function expectEndTag() {
return false; return false;
} }
/** /**
* Sets the current form element value. Cannot * Sets the current form element value. Cannot
* change the value of a hidden field. * change the value of a hidden field.
@ -381,7 +381,7 @@ class SimpleTextTag extends SimpleWidget {
* @subpackage WebTester * @subpackage WebTester
*/ */
class SimpleSubmitTag extends SimpleWidget { class SimpleSubmitTag extends SimpleWidget {
/** /**
* Starts with a named tag with attributes only. * Starts with a named tag with attributes only.
* @param hash $attributes Attribute names and * @param hash $attributes Attribute names and
@ -393,7 +393,7 @@ class SimpleSubmitTag extends SimpleWidget {
$this->_setAttribute('value', 'Submit'); $this->_setAttribute('value', 'Submit');
} }
} }
/** /**
* Tag contains no end element. * Tag contains no end element.
* @return boolean False. * @return boolean False.
@ -402,7 +402,7 @@ class SimpleSubmitTag extends SimpleWidget {
function expectEndTag() { function expectEndTag() {
return false; return false;
} }
/** /**
* Disables the setting of the button value. * Disables the setting of the button value.
* @param string $value Ignored. * @param string $value Ignored.
@ -412,7 +412,7 @@ class SimpleSubmitTag extends SimpleWidget {
function setValue($value) { function setValue($value) {
return false; return false;
} }
/** /**
* Value of browser visible text. * Value of browser visible text.
* @return string Visible label. * @return string Visible label.
@ -421,7 +421,7 @@ class SimpleSubmitTag extends SimpleWidget {
function getLabel() { function getLabel() {
return $this->getValue(); return $this->getValue();
} }
/** /**
* Test for a label match when searching. * Test for a label match when searching.
* @param string $label Label to test. * @param string $label Label to test.
@ -432,14 +432,14 @@ class SimpleSubmitTag extends SimpleWidget {
return trim($label) == trim($this->getLabel()); return trim($label) == trim($this->getLabel());
} }
} }
/** /**
* Image button as input tag. * Image button as input tag.
* @package SimpleTest * @package SimpleTest
* @subpackage WebTester * @subpackage WebTester
*/ */
class SimpleImageSubmitTag extends SimpleWidget { class SimpleImageSubmitTag extends SimpleWidget {
/** /**
* Starts with a named tag with attributes only. * Starts with a named tag with attributes only.
* @param hash $attributes Attribute names and * @param hash $attributes Attribute names and
@ -448,6 +448,7 @@ class SimpleImageSubmitTag extends SimpleWidget {
function __construct($attributes) { function __construct($attributes) {
parent::__construct('input', $attributes); parent::__construct('input', $attributes);
} }
/** /**
* Tag contains no end element. * Tag contains no end element.
* @return boolean False. * @return boolean False.
@ -456,7 +457,7 @@ class SimpleImageSubmitTag extends SimpleWidget {
function expectEndTag() { function expectEndTag() {
return false; return false;
} }
/** /**
* Disables the setting of the button value. * Disables the setting of the button value.
* @param string $value Ignored. * @param string $value Ignored.
@ -466,7 +467,7 @@ class SimpleImageSubmitTag extends SimpleWidget {
function setValue($value) { function setValue($value) {
return false; return false;
} }
/** /**
* Value of browser visible text. * Value of browser visible text.
* @return string Visible label. * @return string Visible label.
@ -478,7 +479,7 @@ class SimpleImageSubmitTag extends SimpleWidget {
} }
return $this->getAttribute('alt'); return $this->getAttribute('alt');
} }
/** /**
* Test for a label match when searching. * Test for a label match when searching.
* @param string $label Label to test. * @param string $label Label to test.
@ -488,7 +489,7 @@ class SimpleImageSubmitTag extends SimpleWidget {
function isLabel($label) { function isLabel($label) {
return trim($label) == trim($this->getLabel()); return trim($label) == trim($this->getLabel());
} }
/** /**
* Dispatches the value into the form encoded packet. * Dispatches the value into the form encoded packet.
* @param SimpleEncoding $encoding Form packet. * @param SimpleEncoding $encoding Form packet.
@ -506,14 +507,14 @@ class SimpleImageSubmitTag extends SimpleWidget {
} }
} }
} }
/** /**
* Submit button as button tag. * Submit button as button tag.
* @package SimpleTest * @package SimpleTest
* @subpackage WebTester * @subpackage WebTester
*/ */
class SimpleButtonTag extends SimpleWidget { class SimpleButtonTag extends SimpleWidget {
/** /**
* Starts with a named tag with attributes only. * Starts with a named tag with attributes only.
* Defaults are very browser dependent. * Defaults are very browser dependent.
@ -523,7 +524,7 @@ class SimpleButtonTag extends SimpleWidget {
function __construct($attributes) { function __construct($attributes) {
parent::__construct('button', $attributes); parent::__construct('button', $attributes);
} }
/** /**
* Check to see if the tag can have both start and * Check to see if the tag can have both start and
* end tags with content in between. * end tags with content in between.
@ -533,7 +534,7 @@ class SimpleButtonTag extends SimpleWidget {
function expectEndTag() { function expectEndTag() {
return true; return true;
} }
/** /**
* Disables the setting of the button value. * Disables the setting of the button value.
* @param string $value Ignored. * @param string $value Ignored.
@ -543,7 +544,7 @@ class SimpleButtonTag extends SimpleWidget {
function setValue($value) { function setValue($value) {
return false; return false;
} }
/** /**
* Value of browser visible text. * Value of browser visible text.
* @return string Visible label. * @return string Visible label.
@ -552,7 +553,7 @@ class SimpleButtonTag extends SimpleWidget {
function getLabel() { function getLabel() {
return $this->getContent(); return $this->getContent();
} }
/** /**
* Test for a label match when searching. * Test for a label match when searching.
* @param string $label Label to test. * @param string $label Label to test.
@ -570,7 +571,7 @@ class SimpleButtonTag extends SimpleWidget {
* @subpackage WebTester * @subpackage WebTester
*/ */
class SimpleTextAreaTag extends SimpleWidget { class SimpleTextAreaTag extends SimpleWidget {
/** /**
* Starts with a named tag with attributes only. * Starts with a named tag with attributes only.
* @param hash $attributes Attribute names and * @param hash $attributes Attribute names and
@ -579,7 +580,7 @@ class SimpleTextAreaTag extends SimpleWidget {
function __construct($attributes) { function __construct($attributes) {
parent::__construct('textarea', $attributes); parent::__construct('textarea', $attributes);
} }
/** /**
* Accessor for starting value. * Accessor for starting value.
* @return string Parsed value. * @return string Parsed value.
@ -588,7 +589,7 @@ class SimpleTextAreaTag extends SimpleWidget {
function getDefault() { function getDefault() {
return $this->_wrap(SimpleHtmlSaxParser::decodeHtml($this->getContent())); return $this->_wrap(SimpleHtmlSaxParser::decodeHtml($this->getContent()));
} }
/** /**
* Applies word wrapping if needed. * Applies word wrapping if needed.
* @param string $value New value. * @param string $value New value.
@ -598,7 +599,7 @@ class SimpleTextAreaTag extends SimpleWidget {
function setValue($value) { function setValue($value) {
return parent::setValue($this->_wrap($value)); return parent::setValue($this->_wrap($value));
} }
/** /**
* Test to see if text should be wrapped. * Test to see if text should be wrapped.
* @return boolean True if wrapping on. * @return boolean True if wrapping on.
@ -613,7 +614,7 @@ class SimpleTextAreaTag extends SimpleWidget {
} }
return false; return false;
} }
/** /**
* Performs the formatting that is peculiar to * Performs the formatting that is peculiar to
* this tag. There is strange behaviour in this * this tag. There is strange behaviour in this
@ -638,7 +639,7 @@ class SimpleTextAreaTag extends SimpleWidget {
} }
return $text; return $text;
} }
/** /**
* The content of textarea is not part of the page. * The content of textarea is not part of the page.
* @return boolean True. * @return boolean True.
@ -655,7 +656,7 @@ class SimpleTextAreaTag extends SimpleWidget {
* @subpackage WebTester * @subpackage WebTester
*/ */
class SimpleUploadTag extends SimpleWidget { class SimpleUploadTag extends SimpleWidget {
/** /**
* Starts with attributes only. * Starts with attributes only.
* @param hash $attributes Attribute names and * @param hash $attributes Attribute names and
@ -664,7 +665,7 @@ class SimpleUploadTag extends SimpleWidget {
function __construct($attributes) { function __construct($attributes) {
parent::__construct('input', $attributes); parent::__construct('input', $attributes);
} }
/** /**
* Tag contains no content. * Tag contains no content.
* @return boolean False. * @return boolean False.
@ -673,7 +674,7 @@ class SimpleUploadTag extends SimpleWidget {
function expectEndTag() { function expectEndTag() {
return false; return false;
} }
/** /**
* Dispatches the value into the form encoded packet. * Dispatches the value into the form encoded packet.
* @param SimpleEncoding $encoding Form packet. * @param SimpleEncoding $encoding Form packet.
@ -698,7 +699,7 @@ class SimpleUploadTag extends SimpleWidget {
class SimpleSelectionTag extends SimpleWidget { class SimpleSelectionTag extends SimpleWidget {
var $_options; var $_options;
var $_choice; var $_choice;
/** /**
* Starts with attributes only. * Starts with attributes only.
* @param hash $attributes Attribute names and * @param hash $attributes Attribute names and
@ -709,7 +710,7 @@ class SimpleSelectionTag extends SimpleWidget {
$this->_options = array(); $this->_options = array();
$this->_choice = false; $this->_choice = false;
} }
/** /**
* Adds an option tag to a selection field. * Adds an option tag to a selection field.
* @param SimpleOptionTag $tag New option. * @param SimpleOptionTag $tag New option.
@ -720,7 +721,7 @@ class SimpleSelectionTag extends SimpleWidget {
$this->_options[] = &$tag; $this->_options[] = &$tag;
} }
} }
/** /**
* Text within the selection element is ignored. * Text within the selection element is ignored.
* @param string $content Ignored. * @param string $content Ignored.
@ -728,7 +729,7 @@ class SimpleSelectionTag extends SimpleWidget {
*/ */
function addContent($content) { function addContent($content) {
} }
/** /**
* Scans options for defaults. If none, then * Scans options for defaults. If none, then
* the first option is selected. * the first option is selected.
@ -746,7 +747,7 @@ class SimpleSelectionTag extends SimpleWidget {
} }
return ''; return '';
} }
/** /**
* Can only set allowed values. * Can only set allowed values.
* @param string $value New choice. * @param string $value New choice.
@ -762,7 +763,7 @@ class SimpleSelectionTag extends SimpleWidget {
} }
return false; return false;
} }
/** /**
* Accessor for current selection value. * Accessor for current selection value.
* @return string Value attribute or * @return string Value attribute or
@ -785,7 +786,7 @@ class SimpleSelectionTag extends SimpleWidget {
class MultipleSelectionTag extends SimpleWidget { class MultipleSelectionTag extends SimpleWidget {
var $_options; var $_options;
var $_values; var $_values;
/** /**
* Starts with attributes only. * Starts with attributes only.
* @param hash $attributes Attribute names and * @param hash $attributes Attribute names and
@ -796,7 +797,7 @@ class MultipleSelectionTag extends SimpleWidget {
$this->_options = array(); $this->_options = array();
$this->_values = false; $this->_values = false;
} }
/** /**
* Adds an option tag to a selection field. * Adds an option tag to a selection field.
* @param SimpleOptionTag $tag New option. * @param SimpleOptionTag $tag New option.
@ -807,7 +808,7 @@ class MultipleSelectionTag extends SimpleWidget {
$this->_options[] = &$tag; $this->_options[] = &$tag;
} }
} }
/** /**
* Text within the selection element is ignored. * Text within the selection element is ignored.
* @param string $content Ignored. * @param string $content Ignored.
@ -815,7 +816,7 @@ class MultipleSelectionTag extends SimpleWidget {
*/ */
function addContent($content) { function addContent($content) {
} }
/** /**
* Scans options for defaults to populate the * Scans options for defaults to populate the
* value array(). * value array().
@ -831,7 +832,7 @@ class MultipleSelectionTag extends SimpleWidget {
} }
return $default; return $default;
} }
/** /**
* Can only set allowed values. Any illegal value * Can only set allowed values. Any illegal value
* will result in a failure, but all correct values * will result in a failure, but all correct values
@ -858,7 +859,7 @@ class MultipleSelectionTag extends SimpleWidget {
$this->_values = $achieved; $this->_values = $achieved;
return true; return true;
} }
/** /**
* Accessor for current selection value. * Accessor for current selection value.
* @return array List of currently set options. * @return array List of currently set options.
@ -878,14 +879,14 @@ class MultipleSelectionTag extends SimpleWidget {
* @subpackage WebTester * @subpackage WebTester
*/ */
class SimpleOptionTag extends SimpleWidget { class SimpleOptionTag extends SimpleWidget {
/** /**
* Stashes the attributes. * Stashes the attributes.
*/ */
function __construct($attributes) { function __construct($attributes) {
parent::__construct('option', $attributes); parent::__construct('option', $attributes);
} }
/** /**
* Does nothing. * Does nothing.
* @param string $value Ignored. * @param string $value Ignored.
@ -895,7 +896,7 @@ class SimpleOptionTag extends SimpleWidget {
function setValue($value) { function setValue($value) {
return false; return false;
} }
/** /**
* Test to see if a value matches the option. * Test to see if a value matches the option.
* @param string $compare Value to compare with. * @param string $compare Value to compare with.
@ -909,7 +910,7 @@ class SimpleOptionTag extends SimpleWidget {
} }
return trim($this->getContent()) == $compare; return trim($this->getContent()) == $compare;
} }
/** /**
* Accessor for starting value. Will be set to * Accessor for starting value. Will be set to
* the option label if no value exists. * the option label if no value exists.
@ -922,7 +923,7 @@ class SimpleOptionTag extends SimpleWidget {
} }
return $this->getAttribute('value'); return $this->getAttribute('value');
} }
/** /**
* The content of options is not part of the page. * The content of options is not part of the page.
* @return boolean True. * @return boolean True.
@ -939,7 +940,7 @@ class SimpleOptionTag extends SimpleWidget {
* @subpackage WebTester * @subpackage WebTester
*/ */
class SimpleRadioButtonTag extends SimpleWidget { class SimpleRadioButtonTag extends SimpleWidget {
/** /**
* Stashes the attributes. * Stashes the attributes.
* @param array $attributes Hash of attributes. * @param array $attributes Hash of attributes.
@ -950,7 +951,7 @@ class SimpleRadioButtonTag extends SimpleWidget {
$this->_setAttribute('value', 'on'); $this->_setAttribute('value', 'on');
} }
} }
/** /**
* Tag contains no content. * Tag contains no content.
* @return boolean False. * @return boolean False.
@ -959,7 +960,7 @@ class SimpleRadioButtonTag extends SimpleWidget {
function expectEndTag() { function expectEndTag() {
return false; return false;
} }
/** /**
* The only allowed value sn the one in the * The only allowed value sn the one in the
* "value" attribute. * "value" attribute.
@ -976,7 +977,7 @@ class SimpleRadioButtonTag extends SimpleWidget {
} }
return parent::setValue($value); return parent::setValue($value);
} }
/** /**
* Accessor for starting value. * Accessor for starting value.
* @return string Parsed value. * @return string Parsed value.
@ -996,7 +997,7 @@ class SimpleRadioButtonTag extends SimpleWidget {
* @subpackage WebTester * @subpackage WebTester
*/ */
class SimpleCheckboxTag extends SimpleWidget { class SimpleCheckboxTag extends SimpleWidget {
/** /**
* Starts with attributes only. * Starts with attributes only.
* @param hash $attributes Attribute names and * @param hash $attributes Attribute names and
@ -1008,7 +1009,7 @@ class SimpleCheckboxTag extends SimpleWidget {
$this->_setAttribute('value', 'on'); $this->_setAttribute('value', 'on');
} }
} }
/** /**
* Tag contains no content. * Tag contains no content.
* @return boolean False. * @return boolean False.
@ -1017,7 +1018,7 @@ class SimpleCheckboxTag extends SimpleWidget {
function expectEndTag() { function expectEndTag() {
return false; return false;
} }
/** /**
* The only allowed value in the one in the * The only allowed value in the one in the
* "value" attribute. The default for this * "value" attribute. The default for this
@ -1039,7 +1040,7 @@ class SimpleCheckboxTag extends SimpleWidget {
} }
return parent::setValue($value); return parent::setValue($value);
} }
/** /**
* Accessor for starting value. The default * Accessor for starting value. The default
* value is "on". * value is "on".
@ -1070,7 +1071,7 @@ class SimpleTagGroup {
function addWidget(&$widget) { function addWidget(&$widget) {
$this->_widgets[] = &$widget; $this->_widgets[] = &$widget;
} }
/** /**
* Accessor to widget set. * Accessor to widget set.
* @return array All widgets. * @return array All widgets.
@ -1089,7 +1090,7 @@ class SimpleTagGroup {
function getAttribute($label) { function getAttribute($label) {
return false; return false;
} }
/** /**
* Fetches the name for the widget from the first * Fetches the name for the widget from the first
* member. * member.
@ -1101,7 +1102,7 @@ class SimpleTagGroup {
return $this->_widgets[0]->getName(); return $this->_widgets[0]->getName();
} }
} }
/** /**
* Scans the widgets for one with the appropriate * Scans the widgets for one with the appropriate
* ID field. * ID field.
@ -1117,7 +1118,7 @@ class SimpleTagGroup {
} }
return false; return false;
} }
/** /**
* Scans the widgets for one with the appropriate * Scans the widgets for one with the appropriate
* attached label. * attached label.
@ -1133,7 +1134,7 @@ class SimpleTagGroup {
} }
return false; return false;
} }
/** /**
* Dispatches the value into the form encoded packet. * Dispatches the value into the form encoded packet.
* @param SimpleEncoding $encoding Form packet. * @param SimpleEncoding $encoding Form packet.
@ -1150,7 +1151,7 @@ class SimpleTagGroup {
* @subpackage WebTester * @subpackage WebTester
*/ */
class SimpleCheckboxGroup extends SimpleTagGroup { class SimpleCheckboxGroup extends SimpleTagGroup {
/** /**
* Accessor for current selected widget or false * Accessor for current selected widget or false
* if none. * if none.
@ -1167,7 +1168,7 @@ class SimpleCheckboxGroup extends SimpleTagGroup {
} }
return $this->_coerceValues($values); return $this->_coerceValues($values);
} }
/** /**
* Accessor for starting value that is active. * Accessor for starting value that is active.
* @return string/array Widget values or false if none. * @return string/array Widget values or false if none.
@ -1183,7 +1184,7 @@ class SimpleCheckboxGroup extends SimpleTagGroup {
} }
return $this->_coerceValues($values); return $this->_coerceValues($values);
} }
/** /**
* Accessor for current set values. * Accessor for current set values.
* @param string/array/boolean $values Either a single string, a * @param string/array/boolean $values Either a single string, a
@ -1207,7 +1208,7 @@ class SimpleCheckboxGroup extends SimpleTagGroup {
} }
return true; return true;
} }
/** /**
* Tests to see if a possible value set is legal. * Tests to see if a possible value set is legal.
* @param string/array/boolean $values Either a single string, a * @param string/array/boolean $values Either a single string, a
@ -1227,7 +1228,7 @@ class SimpleCheckboxGroup extends SimpleTagGroup {
} }
return ($values == $matches); return ($values == $matches);
} }
/** /**
* Converts the output to an appropriate format. This means * Converts the output to an appropriate format. This means
* that no values is false, a single value is just that * that no values is false, a single value is just that
@ -1245,7 +1246,7 @@ class SimpleCheckboxGroup extends SimpleTagGroup {
return $values; return $values;
} }
} }
/** /**
* Converts false or string into array. The opposite of * Converts false or string into array. The opposite of
* the coercian method. * the coercian method.
@ -1273,7 +1274,7 @@ class SimpleCheckboxGroup extends SimpleTagGroup {
* @subpackage WebTester * @subpackage WebTester
*/ */
class SimpleRadioGroup extends SimpleTagGroup { class SimpleRadioGroup extends SimpleTagGroup {
/** /**
* Each tag is tried in turn until one is * Each tag is tried in turn until one is
* successfully set. The others will be * successfully set. The others will be
@ -1295,7 +1296,7 @@ class SimpleRadioGroup extends SimpleTagGroup {
} }
return true; return true;
} }
/** /**
* Tests to see if a value is allowed. * Tests to see if a value is allowed.
* @param string Attempted value. * @param string Attempted value.
@ -1311,7 +1312,7 @@ class SimpleRadioGroup extends SimpleTagGroup {
} }
return false; return false;
} }
/** /**
* Accessor for current selected widget or false * Accessor for current selected widget or false
* if none. * if none.
@ -1328,7 +1329,7 @@ class SimpleRadioGroup extends SimpleTagGroup {
} }
return false; return false;
} }
/** /**
* Accessor for starting value that is active. * Accessor for starting value that is active.
* @return string/boolean Value of first checked * @return string/boolean Value of first checked
@ -1352,7 +1353,7 @@ class SimpleRadioGroup extends SimpleTagGroup {
* @subpackage WebTester * @subpackage WebTester
*/ */
class SimpleLabelTag extends SimpleTag { class SimpleLabelTag extends SimpleTag {
/** /**
* Starts with a named tag with attributes only. * Starts with a named tag with attributes only.
* @param hash $attributes Attribute names and * @param hash $attributes Attribute names and
@ -1361,7 +1362,7 @@ class SimpleLabelTag extends SimpleTag {
function __construct($attributes) { function __construct($attributes) {
parent::__construct('label', $attributes); parent::__construct('label', $attributes);
} }
/** /**
* Access for the ID to attach the label to. * Access for the ID to attach the label to.
* @return string For attribute. * @return string For attribute.
@ -1378,7 +1379,7 @@ class SimpleLabelTag extends SimpleTag {
* @subpackage WebTester * @subpackage WebTester
*/ */
class SimpleFormTag extends SimpleTag { class SimpleFormTag extends SimpleTag {
/** /**
* Starts with a named tag with attributes only. * Starts with a named tag with attributes only.
* @param hash $attributes Attribute names and * @param hash $attributes Attribute names and
@ -1395,7 +1396,7 @@ class SimpleFormTag extends SimpleTag {
* @subpackage WebTester * @subpackage WebTester
*/ */
class SimpleFrameTag extends SimpleTag { class SimpleFrameTag extends SimpleTag {
/** /**
* Starts with a named tag with attributes only. * Starts with a named tag with attributes only.
* @param hash $attributes Attribute names and * @param hash $attributes Attribute names and
@ -1404,7 +1405,7 @@ class SimpleFrameTag extends SimpleTag {
function __construct($attributes) { function __construct($attributes) {
parent::__construct('frame', $attributes); parent::__construct('frame', $attributes);
} }
/** /**
* Tag contains no content. * Tag contains no content.
* @return boolean False. * @return boolean False.

View File

@ -35,7 +35,7 @@ class SimpleUrl {
var $_y; var $_y;
var $_target; var $_target;
var $_raw = false; var $_raw = false;
/** /**
* Constructor. Parses URL into sections. * Constructor. Parses URL into sections.
* @param string $url Incoming URL. * @param string $url Incoming URL.
@ -57,7 +57,7 @@ class SimpleUrl {
$this->_fragment = (strncmp($url, "#", 1) == 0 ? substr($url, 1) : false); $this->_fragment = (strncmp($url, "#", 1) == 0 ? substr($url, 1) : false);
$this->_target = false; $this->_target = false;
} }
/** /**
* Extracts the X, Y coordinate pair from an image map. * Extracts the X, Y coordinate pair from an image map.
* @param string $url URL so far. The coordinates will be * @param string $url URL so far. The coordinates will be
@ -72,7 +72,7 @@ class SimpleUrl {
} }
return array(false, false); return array(false, false);
} }
/** /**
* Extracts the scheme part of an incoming URL. * Extracts the scheme part of an incoming URL.
* @param string $url URL so far. The scheme will be * @param string $url URL so far. The scheme will be
@ -87,7 +87,7 @@ class SimpleUrl {
} }
return false; return false;
} }
/** /**
* Extracts the username and password from the * Extracts the username and password from the
* incoming URL. The // prefix will be reattached * incoming URL. The // prefix will be reattached
@ -114,7 +114,7 @@ class SimpleUrl {
$url = $prefix . $url; $url = $prefix . $url;
return array(false, false); return array(false, false);
} }
/** /**
* Extracts the host part of an incoming URL. * Extracts the host part of an incoming URL.
* Includes the port number part. Will extract * Includes the port number part. Will extract
@ -143,7 +143,7 @@ class SimpleUrl {
} }
return false; return false;
} }
/** /**
* Extracts the path information from the incoming * Extracts the path information from the incoming
* URL. Strips this path from the URL. * URL. Strips this path from the URL.
@ -159,7 +159,7 @@ class SimpleUrl {
} }
return ''; return '';
} }
/** /**
* Strips off the request data. * Strips off the request data.
* @param string $url URL so far. The request will be * @param string $url URL so far. The request will be
@ -174,7 +174,7 @@ class SimpleUrl {
} }
return ''; return '';
} }
/** /**
* Breaks the request down into an object. * Breaks the request down into an object.
* @param string $raw Raw request. * @param string $raw Raw request.
@ -193,7 +193,7 @@ class SimpleUrl {
} }
return $request; return $request;
} }
/** /**
* Accessor for protocol part. * Accessor for protocol part.
* @param string $default Value to use if not present. * @param string $default Value to use if not present.
@ -203,7 +203,7 @@ class SimpleUrl {
function getScheme($default = false) { function getScheme($default = false) {
return $this->_scheme ? $this->_scheme : $default; return $this->_scheme ? $this->_scheme : $default;
} }
/** /**
* Accessor for user name. * Accessor for user name.
* @return string Username preceding host. * @return string Username preceding host.
@ -212,7 +212,7 @@ class SimpleUrl {
function getUsername() { function getUsername() {
return $this->_username; return $this->_username;
} }
/** /**
* Accessor for password. * Accessor for password.
* @return string Password preceding host. * @return string Password preceding host.
@ -221,7 +221,7 @@ class SimpleUrl {
function getPassword() { function getPassword() {
return $this->_password; return $this->_password;
} }
/** /**
* Accessor for hostname and port. * Accessor for hostname and port.
* @param string $default Value to use if not present. * @param string $default Value to use if not present.
@ -231,7 +231,7 @@ class SimpleUrl {
function getHost($default = false) { function getHost($default = false) {
return $this->_host ? $this->_host : $default; return $this->_host ? $this->_host : $default;
} }
/** /**
* Accessor for top level domain. * Accessor for top level domain.
* @return string Last part of host. * @return string Last part of host.
@ -241,7 +241,7 @@ class SimpleUrl {
$path_parts = pathinfo($this->getHost()); $path_parts = pathinfo($this->getHost());
return (isset($path_parts['extension']) ? $path_parts['extension'] : false); return (isset($path_parts['extension']) ? $path_parts['extension'] : false);
} }
/** /**
* Accessor for port number. * Accessor for port number.
* @return integer TCP/IP port number. * @return integer TCP/IP port number.
@ -249,8 +249,8 @@ class SimpleUrl {
*/ */
function getPort() { function getPort() {
return $this->_port; return $this->_port;
} }
/** /**
* Accessor for path. * Accessor for path.
* @return string Full path including leading slash if implied. * @return string Full path including leading slash if implied.
@ -262,7 +262,7 @@ class SimpleUrl {
} }
return $this->_path; return $this->_path;
} }
/** /**
* Accessor for page if any. This may be a * Accessor for page if any. This may be a
* directory name if ambiguious. * directory name if ambiguious.
@ -275,7 +275,7 @@ class SimpleUrl {
} }
return $matches[1]; return $matches[1];
} }
/** /**
* Gets the path to the page. * Gets the path to the page.
* @return string Path less the page. * @return string Path less the page.
@ -287,7 +287,7 @@ class SimpleUrl {
} }
return $matches[1]; return $matches[1];
} }
/** /**
* Accessor for fragment at end of URL after the "#". * Accessor for fragment at end of URL after the "#".
* @return string Part after "#". * @return string Part after "#".
@ -296,7 +296,7 @@ class SimpleUrl {
function getFragment() { function getFragment() {
return $this->_fragment; return $this->_fragment;
} }
/** /**
* Sets image coordinates. Set to false to clear * Sets image coordinates. Set to false to clear
* them. * them.
@ -312,7 +312,7 @@ class SimpleUrl {
$this->_x = (integer)$x; $this->_x = (integer)$x;
$this->_y = (integer)$y; $this->_y = (integer)$y;
} }
/** /**
* Accessor for horizontal image coordinate. * Accessor for horizontal image coordinate.
* @return integer X value. * @return integer X value.
@ -321,7 +321,7 @@ class SimpleUrl {
function getX() { function getX() {
return $this->_x; return $this->_x;
} }
/** /**
* Accessor for vertical image coordinate. * Accessor for vertical image coordinate.
* @return integer Y value. * @return integer Y value.
@ -330,7 +330,7 @@ class SimpleUrl {
function getY() { function getY() {
return $this->_y; return $this->_y;
} }
/** /**
* Accessor for current request parameters * Accessor for current request parameters
* in URL string form. Will return teh original request * in URL string form. Will return teh original request
@ -350,7 +350,7 @@ class SimpleUrl {
} }
return ''; return '';
} }
/** /**
* Adds an additional parameter to the request. * Adds an additional parameter to the request.
* @param string $key Name of parameter. * @param string $key Name of parameter.
@ -361,7 +361,7 @@ class SimpleUrl {
$this->_raw = false; $this->_raw = false;
$this->_request->add($key, $value); $this->_request->add($key, $value);
} }
/** /**
* Adds additional parameters to the request. * Adds additional parameters to the request.
* @param hash/SimpleFormEncoding $parameters Additional * @param hash/SimpleFormEncoding $parameters Additional
@ -372,7 +372,7 @@ class SimpleUrl {
$this->_raw = false; $this->_raw = false;
$this->_request->merge($parameters); $this->_request->merge($parameters);
} }
/** /**
* Clears down all parameters. * Clears down all parameters.
* @access public * @access public
@ -381,7 +381,7 @@ class SimpleUrl {
$this->_raw = false; $this->_raw = false;
$this->_request = new SimpleGetEncoding(); $this->_request = new SimpleGetEncoding();
} }
/** /**
* Gets the frame target if present. Although * Gets the frame target if present. Although
* not strictly part of the URL specification it * not strictly part of the URL specification it
@ -392,7 +392,7 @@ class SimpleUrl {
function getTarget() { function getTarget() {
return $this->_target; return $this->_target;
} }
/** /**
* Attaches a frame target. * Attaches a frame target.
* @param string $frame Name of frame. * @param string $frame Name of frame.
@ -402,7 +402,7 @@ class SimpleUrl {
$this->_raw = false; $this->_raw = false;
$this->_target = $frame; $this->_target = $frame;
} }
/** /**
* Renders the URL back into a string. * Renders the URL back into a string.
* @return string URL in canonical form. * @return string URL in canonical form.
@ -430,7 +430,7 @@ class SimpleUrl {
$coords = $this->getX() === false ? '' : '?' . $this->getX() . ',' . $this->getY(); $coords = $this->getX() === false ? '' : '?' . $this->getX() . ',' . $this->getY();
return "$scheme$identity$host$port$path$encoded$fragment$coords"; return "$scheme$identity$host$port$path$encoded$fragment$coords";
} }
/** /**
* Replaces unknown sections to turn a relative * Replaces unknown sections to turn a relative
* URL into an absolute one. The base URL can * URL into an absolute one. The base URL can
@ -462,7 +462,7 @@ class SimpleUrl {
$coords = $this->getX() === false ? '' : '?' . $this->getX() . ',' . $this->getY(); $coords = $this->getX() === false ? '' : '?' . $this->getX() . ',' . $this->getY();
return new SimpleUrl("$scheme://$identity$host$port$path$encoded$fragment$coords"); return new SimpleUrl("$scheme://$identity$host$port$path$encoded$fragment$coords");
} }
/** /**
* Replaces unknown sections of the path with base parts * Replaces unknown sections of the path with base parts
* to return a complete absolute one. * to return a complete absolute one.
@ -482,7 +482,7 @@ class SimpleUrl {
} }
return $base->getPath(); return $base->getPath();
} }
/** /**
* Simple test to see if a path part is relative. * Simple test to see if a path part is relative.
* @param string $path Path to test. * @param string $path Path to test.
@ -492,7 +492,7 @@ class SimpleUrl {
function _isRelativePath($path) { function _isRelativePath($path) {
return (substr($path, 0, 1) != '/'); return (substr($path, 0, 1) != '/');
} }
/** /**
* Extracts the username and password for use in rendering * Extracts the username and password for use in rendering
* a URL. * a URL.
@ -505,7 +505,7 @@ class SimpleUrl {
} }
return false; return false;
} }
/** /**
* Replaces . and .. sections of the path. * Replaces . and .. sections of the path.
* @param string $path Unoptimised path. * @param string $path Unoptimised path.
@ -516,7 +516,7 @@ class SimpleUrl {
$path = preg_replace('|/\./|', '/', $path); $path = preg_replace('|/\./|', '/', $path);
return preg_replace('|/[^/]+/\.\./|', '/', $path); return preg_replace('|/[^/]+/\.\./|', '/', $path);
} }
/** /**
* A pipe seperated list of all TLDs that result in two part * A pipe seperated list of all TLDs that result in two part
* domain names. * domain names.