File: Example_Locale.php

package info (click to toggle)
php-validate 0.8.5-4.2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye
  • size: 244 kB
  • sloc: php: 758; xml: 492; makefile: 2
file content (109 lines) | stat: -rw-r--r-- 3,381 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4: */
// +----------------------------------------------------------------------+
// | Copyright (c) 1997-2005 [Your Name]                                  |
// +----------------------------------------------------------------------+
// | This source file is subject to the New BSD license, That is bundled  |
// | with this package in the file LICENSE, and is available through      |
// | the world-wide-web at                                                |
// | http://www.opensource.org/licenses/bsd-license.php                   |
// | If you did not receive a copy of the new BSDlicense and are unable   |
// | to obtain it through the world-wide-web, please send a note to       |
// | pajoye@php.net so we can mail you a copy immediately.                |
// +----------------------------------------------------------------------+
// | Author: Tomas V.V.Cox  <cox@idecnet.com>                             |
// |         Pierre-Alain Joye <pajoye@php.net>                           |
// +----------------------------------------------------------------------+
//
/**
 * Specific validation methods for data used in the [LocaleName]
 *
 * @category   Validate
 * @package    Validate_[LocaleName]
 * @author     [Your Name] <example@example.org>
 * @copyright  1997-2005 [Your name]
 * @license    http://www.opensource.org/licenses/bsd-license.php  New BSD License
 * @version    CVS: $Id$
 * @link       http://pear.php.net/package/Validate_[LocaleName]
 */

/**
 * Data validation class for the [LocaleName]
 *
 * This class provides methods to validate:
 *  - SSN
 *  - Postal code
 *  - Telephone number
 *
 * @category   Validate
 * @package    Validate_[LocaleName]
 * @author     [Your Name] <example@example.org>
 * @copyright  1997-2005 [Your name]
 * @license    http://www.opensource.org/licenses/bsd-license.php  New BSD License
 * @version    Release: @package_version@
 * @link       http://pear.php.net/package/Validate_[LocaleName]
 */
class Validate_LocaleName
{
    /**
     * validates a postcode
     *
     * [Further info goes here]
     *
     * @access public
     * @author [Your name] <example@example.org>
     * @param  string the postcode to be validated
     * @param  bool   optional; strong checks (e.g. against a list of postcodes) (not implanted)
     *
     * @return bool true on success false on failure
     */
    function postalCode($postcode, $strong = false)
    {
        if (ctype_digit($number)) {
            return true;
        }

        return false;
    }

    /**
     * Validates a social security number
     *
     * [Further info goes here]
     *
     * @access  public
     * @author  [Your name] <example@example.org>
     * @param   string $ssn SSN
     *
     * @return  bool true on success false on failure
     */
    function ssn($ssn)
    {
        if (ctype_digit($number)) {
            return true;
        }

        return false;
    }

    /**
     * Validate a phone number
     *
     * [Further info goes here]
     *
     * @access public
     * @author [Your name] <example@example.org>
     * @param  string $number the tel number
     *
     * @return bool true on success false on failure
     */
    function phoneNumber($number)
    {
        if (ctype_digit($number)) {
            return true;
        }

        return false;
    }
}
?>