home *** CD-ROM | disk | FTP | other *** search
/ Cricao de Sites - 650 Layouts Prontos / WebMasters.iso / Servidores / xampp-win32-1.6.7-installer.exe / php / PEAR / Services / W3C / CSSValidator / Response.php < prev    next >
Encoding:
PHP Script  |  2008-07-02  |  4.2 KB  |  144 lines

  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. class Services_W3C_CSSValidator_Response
  54. {
  55.     /**
  56.      * The address of the document validated. In EARL terms, this is
  57.      * the TestSubject.
  58.      *
  59.      * @var    string
  60.      */
  61.     public $uri;
  62.  
  63.     /**
  64.      * Location of the service which provided the validation result. In EARL terms,
  65.      * this is the Assertor.
  66.      *
  67.      * @var    string
  68.      */
  69.     public $checkedby;
  70.  
  71.     /**
  72.      * The CSS level (or profile) in use during the validation.
  73.      *
  74.      * @var    string
  75.      */
  76.     public $csslevel;
  77.  
  78.     /**
  79.      * The actual date of the validation.
  80.      *
  81.      * @var    string
  82.      */
  83.     public $date;
  84.  
  85.     /**
  86.      * Whether or not the document validated passed or not formal validation
  87.      *
  88.      * @var    bool
  89.      */
  90.     public $validity;
  91.  
  92.     /**
  93.      * Array of Services_W3C_CSSValidator_Error objects (if applicable)
  94.      *
  95.      * @var    array
  96.      */
  97.     public $errors = array();
  98.  
  99.     /**
  100.      * Array of Services_W3C_CSSValidator_Warning objects (if applicable)
  101.      *
  102.      * @var    array
  103.      */
  104.     public $warnings = array();
  105.  
  106.     /**
  107.      * Returns the validity of the checked document.
  108.      *
  109.      * @return bool
  110.      */
  111.     public function isValid()
  112.     {
  113.         return $this->validity;
  114.     }
  115.  
  116.     /**
  117.      * Adds a new error on stack
  118.      *
  119.      * @param object $error instance of Services_W3C_CSSValidator_Error class
  120.      *
  121.      * @return void
  122.      */
  123.     public function addError($error)
  124.     {
  125.         if ($error instanceof Services_W3C_CSSValidator_Error) {
  126.             $this->errors[] = $error;
  127.         }
  128.     }
  129.  
  130.     /**
  131.      * Adds a new warning on stack
  132.      *
  133.      * @param object $warning instance of Services_W3C_CSSValidator_Warning class
  134.      *
  135.      * @return void
  136.      */
  137.     public function addWarning($warning)
  138.     {
  139.         if ($warning instanceof Services_W3C_CSSValidator_Warning) {
  140.             $this->warnings[] = $warning;
  141.         }
  142.     }
  143. }
  144. ?>