Вход Регистрация
Файл: vendor/fakerphp/faker/src/Faker/Core/Barcode.php
Строк: 61
<?php

declare(strict_types=1);

namespace 
FakerCore;

use 
FakerCalculator;
use 
FakerExtension;

/**
 * @experimental This class is experimental and does not fall under our BC promise
 */
final class Barcode implements ExtensionBarcodeExtension
{
    private function 
ean(int $length 13): string
    
{
        
$code ExtensionHelper::numerify(str_repeat('#'$length 1));

        return 
sprintf('%s%s'$codeCalculatorEan::checksum($code));
    }

    public function 
ean13(): string
    
{
        return 
$this->ean();
    }

    public function 
ean8(): string
    
{
        return 
$this->ean(8);
    }

    public function 
isbn10(): string
    
{
        
$code ExtensionHelper::numerify(str_repeat('#'9));

        return 
sprintf('%s%s'$codeCalculatorIsbn::checksum($code));
    }

    public function 
isbn13(): string
    
{
        
$code '97' mt_rand(89) . ExtensionHelper::numerify(str_repeat('#'9));

        return 
sprintf('%s%s'$codeCalculatorEan::checksum($code));
    }
}
Онлайн: 1
Реклама