Exemple #1
0
 public static function prep($upc)
 {
     $upc = parent::prep($upc);
     if ($upc[0] !== '0') {
         if (strlen($upc) <= 7) {
             $upc = '0' . $upc;
         } else {
             throw new RangeException('UPC-E must belong to the 0th number system (Start with 0).', 2304);
         }
         // More than max of 09999999
     }
     if (strlen($upc) === 7) {
         $upc = $upc . self::check_sum($upc);
     }
     return $upc;
 }