http://phing.info/

Source Code Coverage

Designed for use with PHPUnit2, Xdebug and Phing.

Methods: 1 LOC: 62 Statements: 8
Legend: executednot executeddead code
Source file Statements Methods Total coverage
Uri.php 100.0% 100.0% 100.0%
 
1
<?php
2
/**
3
 * Xyster Framework
4
 *
5
 * This source file is subject to the new BSD license that is bundled
6
 * with this package in the file LICENSE.txt.
7
 * It is also available through the world-wide-web at this URL:
8
 * http://www.opensource.org/licenses/bsd-license.php
9
 *
10
 * @category  Xyster
11
 * @package   Xyster_Validate
12
 * @copyright Copyright LibreWorks, LLC (http://libreworks.net)
13
 * @license   http://www.opensource.org/licenses/bsd-license.php New BSD License
14
 * @version   $Id: Uri.php 418 2010-10-18 21:40:08Z jonathanhawk $
15
 */
16
namespace Xyster\Validate;
17
/**
18
 * A URI validator
19
 *
20
 * @category  Xyster
21
 * @package   Xyster_Validate
22
 * @copyright Copyright LibreWorks, LLC (http://libreworks.net)
23
 * @license   http://www.opensource.org/licenses/bsd-license.php New BSD License
24
 */
25
class Uri extends \Zend_Validate_Abstract
26 1
{
27
    /**
28
     * Validation failure message key for when the file is not an image
29
     *
30
     */
31
    const NOT_URI = 'notUri';
32
33
    /**
34
     * Validation failure message template definitions
35
     *
36
     * @var array
37
     */
38
    protected $_messageTemplates = array(
39
        self::NOT_URI => "'%value%' does not appear to be a correct URI",
40
    );
41
42
    /**
43
     * Defined by Zend_Validate_Interface
44
     *
45
     * Returns true if dimensions of file specified by $value are between width
46
     * and height options, dimensions being exact if strict is true.
47
     *
48
     * @param  mixed $value
49
     * @return boolean
50
     */
51
    public function isValid($value)
52
    {
53 1
        $this->_setValue($value);
54
55 1
        if ( !\Zend_Uri::check($value) ) {
56 1
            $this->_error(self::NOT_URI);
57 1
            return false;
58
        }
59
60 1
        return true;
61
    }
62 1
}


Report generated at 2010-10-18T17:19:48-04:00