Permalink
Browse files

Remove Validate_LI

  • Loading branch information...
1 parent 0e345af commit a637ca1689bd5b756151dce46a9a7b76fa3948ae @CloCkWeRX CloCkWeRX committed Dec 9, 2011
Showing with 0 additions and 221 deletions.
  1. +0 −81 Validate/LI.php
  2. +0 −81 package_LI.xml
  3. +0 −59 tests/validate_LI_postalcodes.phpt
View
@@ -1,81 +0,0 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4: */
-/**
- * Methods for validation in Liechtenstein
- *
- * PHP Version 5
- *
- * 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.
- *
- * @category Validate
- * @package Validate_LI
- * @author Christian Weiske <cweiske@php.net>
- * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
- * @version SVN: $Id: DE.php 242590 2007-09-16 17:35:37Z kguest $
- * @link http://pear.php.net/package/Validate_DE
- */
-
-/**
- * Data validation class for Liechtenstein
- *
- * This class provides methods to validate:
- * - Postal code
- *
- * @category Validate
- * @package Validate_LI
- * @author Christian Weiske <cweiske@php.net>
- * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
- * @version Release: @package_version@
- * @link http://pear.php.net/package/Validate_DE
- */
-class Validate_LI
-{
- /**
- * Validate a Liechtenstein postcode.
- * Liechtenstein uses the same codes as Switzerland.
- *
- * @param string $postcode postcode to validate
- * @param bool $strong optional; strong checks (e.g. against a list of
- * postcodes)
- *
- * @return bool true if postcode is ok, false otherwise
- *
- * @link http://en.wikipedia.org/wiki/Postal_codes_in_Liechtenstein
- * @link http://www.geopostcodes.com/index.php?pg=browse&grp=0&niv=3&id=9&l=0&sort=1
- */
- public static function postalCode($postcode, $strong = false)
- {
- if (!$strong) {
- return (bool)preg_match('/^[0-9]{4}$/', $postcode);
- }
-
- //list is from geopostcodes.com
- $codes = array(
- 9485,
- 9486,
- 9487,
- 9488,
- 9489,
- 9490,
- 9491,
- 9492,
- 9493,
- 9494,
- 9495,
- 9496,
- 9486,
- 9497,
- 9498,
- );
-
- return in_array($postcode, $codes);
- }
-
-}
-?>
View
@@ -1,81 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<package packagerversion="1.6.1"
- version="2.0"
- xmlns="http://pear.php.net/dtd/package-2.0"
- xmlns:tasks="http://pear.php.net/dtd/tasks-1.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0 http://pear.php.net/dtd/tasks-1.0.xsd http://pear.php.net/dtd/package-2.0 http://pear.php.net/dtd/package-2.0.xsd"
->
- <name>Validate_LI</name>
- <channel>pear.php.net</channel>
- <summary>Validation class for Liechtenstein</summary>
- <description>Package containes locale validation for Liechtenstein such as:
- * Postal Code
- </description>
-
- <lead>
- <name>Christian Weiske</name>
- <user>cweiske</user>
- <email>cweiske@php.net</email>
- <active>yes</active>
- </lead>
-
- <date>2010-08-04</date>
-
- <version>
- <release>0.1.0</release>
- <api>0.1.0</api>
- </version>
-
- <stability>
- <release>alpha</release>
- <api>alpha</api>
- </stability>
-
- <license uri="http://www.opensource.org/licenses/bsd-license.php">New BSD</license>
-
- <notes>
- - First version with postal code validation
- </notes>
- <contents>
- <dir name="/">
- <file name="Validate/LI.php" role="php">
- <tasks:replace from="@package_version@" to="version" type="package-info" />
- </file>
- <file name="tests/validate_LI_postalcodes.phpt" role="test" />
- </dir>
- </contents>
-
- <dependencies>
- <required>
- <php>
- <min>5.2.0</min>
- </php>
- <pearinstaller>
- <min>1.8.0</min>
- </pearinstaller>
- </required>
- </dependencies>
-
- <phprelease />
-
- <changelog>
-
- <release>
- <version>
- <release>0.1.0</release>
- <api>0.1.0</api>
- </version>
- <stability>
- <release>alpha</release>
- <api>alpha</api>
- </stability>
- <date>2010-08-04</date>
- <license uri="http://www.opensource.org/licenses/bsd-license.php">New BSD</license>
- <notes>
- - Initial release
- </notes>
- </release>
-
- </changelog>
-</package>
@@ -1,59 +0,0 @@
---TEST--
-Test liechtenstein postal codes
---FILE--
-<?php
-$noYes = array('NO', 'YES');
-if (is_file(dirname(__FILE__) . '/../Validate/LI.php')) {
- require_once dirname(__FILE__) . '/../Validate/LI.php';
-} else {
- require_once 'Validate/LI.php';
-}
-
-
-$postalCodes = array(
- 1234,//ok
- 9238,//ok
- 'a123',//no
- '923Z',//no
- 123,//no
- 12,//no
- 1,//no
-);
-
-foreach ($postalCodes as $postalCode) {
- echo "{$postalCode}: "
- . $noYes[
- Validate_LI::postalCode($postalCode)
- ] . "\n";
-}
-
-$postalCodesStrong = array(
- 9485,//ok
- 9491,//ok
- 9499,//no
- 9500,//no
- 12345,//no
-);
-
-echo "strong\n";
-foreach ($postalCodesStrong as $postalCode) {
- echo "{$postalCode}: "
- . $noYes[
- Validate_LI::postalCode($postalCode, true)
- ] . "\n";
-}
-?>
---EXPECT--
-1234: YES
-9238: YES
-a123: NO
-923Z: NO
-123: NO
-12: NO
-1: NO
-strong
-9485: YES
-9491: YES
-9499: NO
-9500: NO
-12345: NO

0 comments on commit a637ca1

Please sign in to comment.