-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit dca0d1f
Showing
12 changed files
with
710 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
The MIT License | ||
|
||
Copyright (c) 2008 – 2010 Chris Smith | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
libphp-vin | ||
========== | ||
|
||
libphp-vin is a library for PHP to decode [vehicle identification numbers] [1] (VIN). | ||
|
||
[1]: http://en.wikipedia.org/wiki/Vehicle_Identification_Number "Vehicle Identification Number" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<?php | ||
/** | ||
* PHP VIN Utility Library | ||
* | ||
* LICENSE | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in | ||
* all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
* THE SOFTWARE. | ||
* | ||
* @package libphp-vin | ||
* @subpackage CheckDigit\Calculator | ||
* @copyright Copyright (c) 2010 Chris Smith (http://www.cs278.org/) | ||
* @license http://www.opensource.org/licenses/mit-license.php MIT License | ||
* @version | ||
*/ | ||
namespace libphpvin\CheckDigit; | ||
|
||
/** | ||
* Check digit calculator interface | ||
* | ||
* @package libphp-vin | ||
* @subpackage CheckDigit\Calculator | ||
* @copyright Copyright (c) 2010 Chris Smith (http://www.cs278.org/) | ||
* @license http://www.opensource.org/licenses/mit-license.php MIT License | ||
*/ | ||
interface Calculator | ||
{ | ||
public function __construct($vin); | ||
|
||
public function getVin(); | ||
|
||
public function setVin($vin); | ||
|
||
public function isValid(); | ||
|
||
public function getCheckDigit(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<?php | ||
/** | ||
* PHP VIN Utility Library | ||
* | ||
* LICENSE | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in | ||
* all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
* THE SOFTWARE. | ||
* | ||
* @package libphp-vin | ||
* @subpackage CheckDigit\Calculator | ||
* @copyright Copyright (c) 2010 Chris Smith (http://www.cs278.org/) | ||
* @license http://www.opensource.org/licenses/mit-license.php MIT License | ||
* @version | ||
*/ | ||
namespace libphpvin\CheckDigit\Calculator; | ||
|
||
/** | ||
* @package libphp-vin | ||
* @subpackage CheckDigit\Calculator | ||
* @copyright Copyright (c) 2010 Chris Smith (http://www.cs278.org/) | ||
* @license http://www.opensource.org/licenses/mit-license.php MIT License | ||
*/ | ||
abstract class Abstract implements \libphpvin\CheckDigit\Calculator | ||
{ | ||
protected $_vin; | ||
|
||
public function __construct($vin) | ||
{ | ||
$this->setVin($vin); | ||
} | ||
|
||
public function getVin() | ||
{ | ||
return $this->_vin; | ||
} | ||
|
||
public function setVin($vin) | ||
{ | ||
$this->_vin = $vin; | ||
|
||
return $this; | ||
} | ||
|
||
public function isValid() | ||
{ | ||
return $this->getVin()->getCheckDigit() === $this->getCheckDigit(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<?php | ||
/** | ||
* PHP VIN Utility Library | ||
* | ||
* LICENSE | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in | ||
* all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
* THE SOFTWARE. | ||
* | ||
* @package libphp-vin | ||
* @subpackage CheckDigit\Calculator | ||
* @copyright Copyright (c) 2010 Chris Smith (http://www.cs278.org/) | ||
* @license http://www.opensource.org/licenses/mit-license.php MIT License | ||
* @version | ||
*/ | ||
namespace libphpvin\CheckDigit\Calculator; | ||
|
||
/** | ||
* VIN check digit calculator for VINs with no check digit | ||
* | ||
* @package libphp-vin | ||
* @subpackage CheckDigit\Calculator | ||
* @copyright Copyright (c) 2010 Chris Smith (http://www.cs278.org/) | ||
* @license http://www.opensource.org/licenses/mit-license.php MIT License | ||
*/ | ||
class None extends Abstract | ||
{ | ||
public function isValid() | ||
{ | ||
return true; | ||
} | ||
|
||
public function getCheckDigit() | ||
{ | ||
return ''; | ||
} | ||
} |
Oops, something went wrong.