Skip to content

Commit

Permalink
Updated Documentation
Browse files Browse the repository at this point in the history
Added icon for static methods and properties. Minor styles and docs
fixes.
  • Loading branch information
Iván Melgrati committed Feb 25, 2018
1 parent ad58f96 commit af97387
Show file tree
Hide file tree
Showing 14 changed files with 88 additions and 96 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.1.0
1.1.1
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "imelgrat/code-validator",
"type": "library",
"version" : "v1.1-stable",
"version" : "v1.1.1",
"description": "A PHP class for validating EAN, IMEI, ISBN, GTIN, SSCC, GSIN, UPC and other similar codes.",
"keywords": ["IMEI", "IMEI code", "EAN", "UPC", "GTIN", "ISBN", "EAN code", "UPC code", "GTIN code", "ISBN code", "code validation"],
"homepage": "https://github.com/imelgrat/code-validator",
Expand Down
70 changes: 28 additions & 42 deletions docs/classes/CodeValidator.html

Large diffs are not rendered by default.

17 changes: 17 additions & 0 deletions docs/css/template.css
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,23 @@ h3.public:before {
width: 1.2em;
}

h3 span.static::before {
font-family: FontAwesome;
content: "\f02e";
color: #3a87ad;
display: inline-block;
width: 1.2em;
font-weight: 800;
}
h3 span.instance::before {
font-family: FontAwesome;
content: "\f1f3";
color: transparent;
display: inline-block;
width: 1.2em;
font-weight: 800;
}

.class #summary section .span4:first-of-type,
.class #summary section .span6:first-of-type {
padding-left: 21px;
Expand Down
11 changes: 5 additions & 6 deletions docs/files/code-validator.html
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<i class="icon-ellipsis-vertical"></i>
</a>
<a href="../index.html">CodeValidator</a>
<a class="brand" href="../index.html">CodeValidator</a>
<div class="nav-collapse">
<ul class="nav pull-right">
<li class="dropdown" id="charts-menu">
Expand Down Expand Up @@ -137,10 +137,10 @@
<div class="accordion" style="margin-bottom: 0">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-167813870"></a>
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-1317173720"></a>
<a href="../namespaces/default.html" style="margin-left: 30px; padding-left: 0">\</a>
</div>
<div id="namespace-167813870" class="accordion-body collapse in">
<div id="namespace-1317173720" class="accordion-body collapse in">
<div class="accordion-inner">


Expand Down Expand Up @@ -199,7 +199,7 @@ <h2>Tags</h2>
version
</th>
<td>
<p>v1.1.0 stable</p>
<p>v1.1.1</p>
</td>
</tr>
</table>
Expand Down Expand Up @@ -249,8 +249,7 @@ <h1><i class="icon-pushpin"></i></h1>
<section class="row-fluid">
<section class="span10 offset1">
<hr />
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor </a> and authored by <a target="_blank" href="https://imelgrat.me">Iv&aacute;n Melgrati</a>
on February 25th, 2018 at 04:37.
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor </a> and authored by <a target="_blank" href="https://imelgrat.me">Iv&aacute;n Melgrati</a> on February 25th, 2018 at 16:44.
</section>
</section>
</section>
Expand Down
20 changes: 9 additions & 11 deletions docs/files/code-validator.php.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*
* @package CodeValidator
* @author Ivan Melgrati
* @version v1.1.0 stable
* @version v1.1.1
*/

if (!class_exists('CodeValidator'))
Expand All @@ -16,8 +16,7 @@
* @author Ivan Melgrati
* @copyright Copyright 2018 by Ivan Melgrati
* @link
* @license https://github.com//imelgrat/code-validator/blob/master/LICENSE
* @version v1.1.0 stable
* @license https://github.com/imelgrat/code-validator/blob/master/LICENSE
*/
class CodeValidator
{
Expand All @@ -32,7 +31,7 @@

/**
* Calculate a check digit using the Modulo-10 algorithm used for EAN/UPC/GTIN codes.
*
*
* @link https://en.wikipedia.org/wiki/Check_digit
* @link http://www.gs1.org/how-calculate-check-digit-manually
* @param string $code the code to calculate the check digit for
Expand Down Expand Up @@ -228,19 +227,18 @@
}

/**
* Determine whether a code is valid using the ISBN algorithm (either ISBN 10 or 13 digits). It also validates whether the code has the right length.
* Determine whether a code is valid using the ISBN algorithm (either ISBN 10). It also validates whether the code has the right length.
*
* For ISBN-10 each of the first nine digits of the ten-digit ISBN (excluding the check digit itself) is multiplied by a number in a sequence from 10 to 2 and the remainder of the sum with (respect to 11) is computed. The resulting remainder, plus the check digit, must equal a multiple of 11 (either 0 or 11). For ISBN-13 the check-digit is calculated using the {@link CodeValidator::calculateEANCheckDigit()} function, making it compatible with EAN codes.
* For ISBN-10 each of the first nine digits of the ten-digit ISBN (excluding the check digit itself) is multiplied by a number in a sequence from 10 to 2 and the remainder of the sum with (respect to 11) is computed. The resulting remainder, plus the check digit, must equal a multiple of 11 (either 0 or 11).
*
* @link https://en.wikipedia.org/wiki/International_Standard_Book_Number
* @param string $code the code to validate
* @param int $length The length of the ISBN code to validate (either 10 or 13 digits)
* @return bool
*/
protected static function validateISBNCheckDigit($code, $length = 13)
protected static function validateISBNCheckDigit($code)
{
// Check if the string length matches the code's desired length and contains only digits (after removing hyphens)
if (strlen($code) == $length && preg_match('/^[0-9]+$/', $code))
if (strlen($code) == 10 && preg_match('/^[0-9]+$/', $code))
{
if (CodeValidator::calculateISBNCheckDigit(substr($code, 0, -1)) == substr($code, -1, 1))
{
Expand Down Expand Up @@ -314,8 +312,8 @@
*
* An EAN-13 always has 13 digits:
*
* 1. **GS1 Prefix**: The first 3 digits - usually identifying the national [GS1](http://www.gs1.org/) Member Organization to which the manufacturer is registered (not necessarily where the product is actually made). The GS1 Prefix is 978 or 979, when the EAN-13 symbol encodes a conversion of an International Standard Book Number (ISBN).
* Likewise the prefix is 979 for International Standard Music Number (ISMN) and 977 for International Standard Serial Number (ISSN).
* 1. **GS1 Prefix**: The first 3 digits - usually identifying the national [GS1](http://www.gs1.org/) Member Organization to which the manufacturer is registered (not necessarily where the product is actually made). The GS1 Prefix is equal to 978 when the EAN-13 symbol encodes a conversion of an International Standard Book Number (ISBN).
* Likewise the prefix is equal to 979 for International Standard Music Number (ISMN) and 977 for International Standard Serial Number (ISSN).
* 2. **Manufacturer Code**: The manufacturer code is a unique code assigned to each manufacturer by the numbering authority indicated by the GS1 Prefix. All products produced by a given company will use the same manufacturer code.
* 3. **Product Code**: The product code is assigned by the manufacturer. The product code immediately follows manufacturer code. The total length of manufacturer code plus product code should be 9 or 10 digits depending on the length of country code(2-3 digits).
* 4. **Check digit**: The check digit is an additional digit, used to verify that a barcode has been entered correctly.
Expand Down
5 changes: 2 additions & 3 deletions docs/graphs/class.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<i class="icon-ellipsis-vertical"></i>
</a>
<a href="../index.html">CodeValidator</a>
<a class="brand" href="../index.html">CodeValidator</a>
<div class="nav-collapse">
<ul class="nav pull-right">
<li class="dropdown" id="charts-menu">
Expand Down Expand Up @@ -144,8 +144,7 @@ <h1><i class="icon-pushpin"></i></h1>
<section class="row-fluid">
<section class="span10 offset1">
<hr />
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor </a> and authored by <a target="_blank" href="https://imelgrat.me">Iv&aacute;n Melgrati</a>
on February 25th, 2018 at 04:37.
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor </a> and authored by <a target="_blank" href="https://imelgrat.me">Iv&aacute;n Melgrati</a> on February 25th, 2018 at 16:44.
</section>
</section>
</section>
Expand Down
9 changes: 4 additions & 5 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<i class="icon-ellipsis-vertical"></i>
</a>
<a href="index.html">CodeValidator</a>
<a class="brand" href="index.html">CodeValidator</a>
<div class="nav-collapse">
<ul class="nav pull-right">
<li class="dropdown" id="charts-menu">
Expand Down Expand Up @@ -89,10 +89,10 @@
<div class="accordion" style="margin-bottom: 0">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-1327530821"></a>
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-1498733116"></a>
<a href="namespaces/default.html" style="margin-left: 30px; padding-left: 0">\</a>
</div>
<div id="namespace-1327530821" class="accordion-body collapse in">
<div id="namespace-1498733116" class="accordion-body collapse in">
<div class="accordion-inner">


Expand Down Expand Up @@ -169,8 +169,7 @@ <h1><i class="icon-pushpin"></i></h1>
<section class="row-fluid">
<section class="span10 offset1">
<hr />
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor </a> and authored by <a target="_blank" href="https://imelgrat.me">Iv&aacute;n Melgrati</a>
on February 25th, 2018 at 04:37.
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor </a> and authored by <a target="_blank" href="https://imelgrat.me">Iv&aacute;n Melgrati</a> on February 25th, 2018 at 16:44.
</section>
</section>
</section>
Expand Down
9 changes: 4 additions & 5 deletions docs/namespaces/default.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<i class="icon-ellipsis-vertical"></i>
</a>
<a href="../index.html">CodeValidator</a>
<a class="brand" href="../index.html">CodeValidator</a>
<div class="nav-collapse">
<ul class="nav pull-right">
<li class="dropdown" id="charts-menu">
Expand Down Expand Up @@ -89,10 +89,10 @@
<div class="accordion" style="margin-bottom: 0">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-249571951"></a>
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-1011832054"></a>
<a href="../namespaces/default.html" style="margin-left: 30px; padding-left: 0">\</a>
</div>
<div id="namespace-249571951" class="accordion-body collapse in">
<div id="namespace-1011832054" class="accordion-body collapse in">
<div class="accordion-inner">


Expand Down Expand Up @@ -169,8 +169,7 @@ <h1><i class="icon-pushpin"></i></h1>
<section class="row-fluid">
<section class="span10 offset1">
<hr />
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor </a> and authored by <a target="_blank" href="https://imelgrat.me">Iv&aacute;n Melgrati</a>
on February 25th, 2018 at 04:37.
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor </a> and authored by <a target="_blank" href="https://imelgrat.me">Iv&aacute;n Melgrati</a> on February 25th, 2018 at 16:44.
</section>
</section>
</section>
Expand Down
5 changes: 2 additions & 3 deletions docs/reports/deprecated.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<i class="icon-ellipsis-vertical"></i>
</a>
<a href="../index.html">CodeValidator</a>
<a class="brand" href="../index.html">CodeValidator</a>
<div class="nav-collapse">
<ul class="nav pull-right">
<li class="dropdown" id="charts-menu">
Expand Down Expand Up @@ -134,8 +134,7 @@ <h1><i class="icon-pushpin"></i></h1>
<section class="row-fluid">
<section class="span10 offset1">
<hr />
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor </a> and authored by <a target="_blank" href="https://imelgrat.me">Iv&aacute;n Melgrati</a>
on February 25th, 2018 at 04:37.
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor </a> and authored by <a target="_blank" href="https://imelgrat.me">Iv&aacute;n Melgrati</a> on February 25th, 2018 at 16:44.
</section>
</section>
</section>
Expand Down
5 changes: 2 additions & 3 deletions docs/reports/errors.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<i class="icon-ellipsis-vertical"></i>
</a>
<a href="../index.html">CodeValidator</a>
<a class="brand" href="../index.html">CodeValidator</a>
<div class="nav-collapse">
<ul class="nav pull-right">
<li class="dropdown" id="charts-menu">
Expand Down Expand Up @@ -133,8 +133,7 @@ <h1><i class="icon-pushpin"></i></h1>
<section class="row-fluid">
<section class="span10 offset1">
<hr />
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor </a> and authored by <a target="_blank" href="https://imelgrat.me">Iv&aacute;n Melgrati</a>
on February 25th, 2018 at 04:37.
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor </a> and authored by <a target="_blank" href="https://imelgrat.me">Iv&aacute;n Melgrati</a> on February 25th, 2018 at 16:44.
</section>
</section>
</section>
Expand Down
5 changes: 2 additions & 3 deletions docs/reports/markers.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<i class="icon-ellipsis-vertical"></i>
</a>
<a href="../index.html">CodeValidator</a>
<a class="brand" href="../index.html">CodeValidator</a>
<div class="nav-collapse">
<ul class="nav pull-right">
<li class="dropdown" id="charts-menu">
Expand Down Expand Up @@ -133,8 +133,7 @@ <h1><i class="icon-pushpin"></i></h1>
<section class="row-fluid">
<section class="span10 offset1">
<hr />
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor </a> and authored by <a target="_blank" href="https://imelgrat.me">Iv&aacute;n Melgrati</a>
on February 25th, 2018 at 04:37.
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor </a> and authored by <a target="_blank" href="https://imelgrat.me">Iv&aacute;n Melgrati</a> on February 25th, 2018 at 16:44.
</section>
</section>
</section>
Expand Down
4 changes: 2 additions & 2 deletions phpdoc.dist.xml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<?xml version="1.0" encoding="UTF-8" ?>
<phpdoc>
<title>A PHP class for validating EAN, IMEI, ISBN, GTIN, SSCC, GSIN, UPC and other similar codes.</title>
<title>CodeValidator</title>
<parser>
<target>docs</target>
</parser>
<transformer>
<target>docs</target>
</transformer>
<transformations>
<template name="responsive" />
<template name="clean" />
</transformations>
<files>
<directory>src</directory>
Expand Down
Loading

0 comments on commit af97387

Please sign in to comment.