Services_W3C_CSSValidator
[ class tree: Services_W3C_CSSValidator ] [ index: Services_W3C_CSSValidator ] [ all elements ]

Source for file Response.php

Documentation is available at Response.php

  1. <?php
  2. /**
  3.  * Copyright (c) 2007, Laurent Laville <pear@laurent-laville.org>
  4.  *
  5.  * All rights reserved.
  6.  *
  7.  * Redistribution and use in source and binary forms, with or without
  8.  * modification, are permitted provided that the following conditions
  9.  * are met:
  10.  *
  11.  *     * Redistributions of source code must retain the above copyright
  12.  *       notice, this list of conditions and the following disclaimer.
  13.  *     * Redistributions in binary form must reproduce the above copyright
  14.  *       notice, this list of conditions and the following disclaimer in the
  15.  *       documentation and/or other materials provided with the distribution.
  16.  *     * Neither the name of the authors nor the names of its contributors
  17.  *       may be used to endorse or promote products derived from this software
  18.  *       without specific prior written permission.
  19.  *
  20.  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  21.  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  22.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  23.  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
  24.  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  25.  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  26.  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  27.  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  28.  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  29.  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  30.  * POSSIBILITY OF SUCH DAMAGE.
  31.  *
  32.  * PHP version 5
  33.  *
  34.  * @category Web_Services
  35.  * @package  Services_W3C_CSSValidator
  36.  * @author   Laurent Laville <pear@laurent-laville.org>
  37.  * @license  http://www.opensource.org/licenses/bsd-license.php BSD
  38.  * @version  CVS: $id$
  39.  * @link     http://pear.php.net/package/Services_W3C_CSSValidator
  40.  * @since    File available since Release 0.1.0
  41.  */
  42.  
  43. /**
  44.  * Base class for a W3C CSS Validator Response.
  45.  *
  46.  * @category Web_Services
  47.  * @package  Services_W3C_CSSValidator
  48.  * @author   Laurent Laville <pear@laurent-laville.org>
  49.  * @license  http://www.opensource.org/licenses/bsd-license.php BSD
  50.  * @link     http://pear.php.net/package/Services_W3C_CSSValidator
  51.  * @since    Class available since Release 0.1.0
  52.  */
  53. {
  54.     /**
  55.      * The address of the document validated. In EARL terms, this is
  56.      * the TestSubject.
  57.      *
  58.      * @var    string 
  59.      */
  60.     public $uri;
  61.  
  62.     /**
  63.      * Location of the service which provided the validation result. In EARL terms,
  64.      * this is the Assertor.
  65.      *
  66.      * @var    string 
  67.      */
  68.     public $checkedby;
  69.  
  70.     /**
  71.      * The CSS level (or profile) in use during the validation.
  72.      *
  73.      * @var    string 
  74.      */
  75.     public $csslevel;
  76.  
  77.     /**
  78.      * The actual date of the validation.
  79.      *
  80.      * @var    string 
  81.      */
  82.     public $date;
  83.  
  84.     /**
  85.      * Whether or not the document validated passed or not formal validation
  86.      *
  87.      * @var    bool 
  88.      */
  89.     public $validity;
  90.  
  91.     /**
  92.      * Array of Services_W3C_CSSValidator_Error objects (if applicable)
  93.      *
  94.      * @var    array 
  95.      */
  96.     public $errors = array();
  97.  
  98.     /**
  99.      * Array of Services_W3C_CSSValidator_Warning objects (if applicable)
  100.      *
  101.      * @var    array 
  102.      */
  103.     public $warnings = array();
  104.  
  105.     /**
  106.      * Returns the validity of the checked document.
  107.      *
  108.      * @return bool 
  109.      */
  110.     public function isValid()
  111.     {
  112.         return $this->validity;
  113.     }
  114.  
  115.     /**
  116.      * Adds a new error on stack
  117.      *
  118.      * @param object $error instance of Services_W3C_CSSValidator_Error class
  119.      *
  120.      * @return void 
  121.      */
  122.     public function addError($error)
  123.     {
  124.         if ($error instanceof Services_W3C_CSSValidator_Error{
  125.             $this->errors[$error;
  126.         }
  127.     }
  128.  
  129.     /**
  130.      * Adds a new warning on stack
  131.      *
  132.      * @param object $warning instance of Services_W3C_CSSValidator_Warning class
  133.      *
  134.      * @return void 
  135.      */
  136.     public function addWarning($warning)
  137.     {
  138.         if ($warning instanceof Services_W3C_CSSValidator_Warning{
  139.             $this->warnings[$warning;
  140.         }
  141.     }
  142. }
  143. ?>

Documentation generated on Fri, 23 Nov 2007 13:00:08 -0500 by phpDocumentor 1.4.0. PEAR Logo Copyright © PHP Group 2004.