芝麻web文件管理V1.00
编辑当前文件:/home/royashxg/bit-alphas-ltd.com/user/project/vendor/fakerphp/faker/src/Faker/Generator.php
container = $container ?: Extension\ContainerBuilder::getDefault(); } /** * @template T of Extension\Extension * * @param class-string
$id * * @throws ContainerExceptionInterface * @throws Extension\ExtensionNotFound * * @return T */ public function ext(string $id): Extension\Extension { if (!$this->container->has($id)) { throw new Extension\ExtensionNotFound(sprintf( 'No Faker extension with id "%s" was loaded.', $id )); } $extension = $this->container->get($id); if ($extension instanceof Extension\GeneratorAwareExtension) { $extension = $extension->withGenerator($this); } return $extension; } public function addProvider($provider) { array_unshift($this->providers, $provider); } public function getProviders() { return $this->providers; } public function seed($seed = null) { if ($seed === null) { mt_srand(); } else { mt_srand((int) $seed, MT_RAND_PHP); } } public function format($format, $arguments = []) { return call_user_func_array($this->getFormatter($format), $arguments); } /** * @param string $format * * @return callable */ public function getFormatter($format) { if (isset($this->formatters[$format])) { return $this->formatters[$format]; } if (method_exists($this, $format)) { $this->formatters[$format] = [$this, $format]; return $this->formatters[$format]; } // "Faker\Core\Barcode->ean13" if (preg_match('|^([a-zA-Z0-9\\\]+)->([a-zA-Z0-9]+)$|', $format, $matches)) { $this->formatters[$format] = [$this->ext($matches[1]), $matches[2]]; return $this->formatters[$format]; } foreach ($this->providers as $provider) { if (method_exists($provider, $format)) { $this->formatters[$format] = [$provider, $format]; return $this->formatters[$format]; } } throw new \InvalidArgumentException(sprintf('Unknown format "%s"', $format)); } /** * Replaces tokens ('{{ tokenName }}') with the result from the token method call * * @param string $string String that needs to bet parsed * * @return string */ public function parse($string) { $callback = function ($matches) { return $this->format($matches[1]); }; return preg_replace_callback('/\{\{\s?(\w+)\s?\}\}/u', $callback, $string); } /** * Get a random MIME type * * @example 'video/avi' */ public function mimeType() { return $this->ext(Extension\FileExtension::class)->mimeType(); } /** * Get a random file extension (without a dot) * * @example avi */ public function fileExtension() { return $this->ext(Extension\FileExtension::class)->extension(); } /** * Get a full path to a new real file on the system. */ public function filePath() { return $this->ext(Extension\FileExtension::class)->filePath(); } /** * Get an actual blood type * * @example 'AB' */ public function bloodType(): string { return $this->ext(Extension\BloodExtension::class)->bloodType(); } /** * Get a random resis value * * @example '+' */ public function bloodRh(): string { return $this->ext(Extension\BloodExtension::class)->bloodRh(); } /** * Get a full blood group * * @example 'AB+' */ public function bloodGroup(): string { return $this->ext(Extension\BloodExtension::class)->bloodGroup(); } /** * Get a random EAN13 barcode. * * @example '4006381333931' */ public function ean13(): string { return $this->ext(Extension\BarcodeExtension::class)->ean13(); } /** * Get a random EAN8 barcode. * * @example '73513537' */ public function ean8(): string { return $this->ext(Extension\BarcodeExtension::class)->ean8(); } /** * Get a random ISBN-10 code * * @see http://en.wikipedia.org/wiki/International_Standard_Book_Number * * @example '4881416324' */ public function isbn10(): string { return $this->ext(Extension\BarcodeExtension::class)->isbn10(); } /** * Get a random ISBN-13 code * * @see http://en.wikipedia.org/wiki/International_Standard_Book_Number * * @example '9790404436093' */ public function isbn13(): string { return $this->ext(Extension\BarcodeExtension::class)->isbn13(); } /** * Returns a random number between $int1 and $int2 (any order) * * @example 79907610 */ public function numberBetween($int1 = 0, $int2 = 2147483647): int { return $this->ext(Extension\NumberExtension::class)->numberBetween((int) $int1, (int) $int2); } /** * Returns a random number between 0 and 9 */ public function randomDigit(): int { return $this->ext(Extension\NumberExtension::class)->randomDigit(); } /** * Generates a random digit, which cannot be $except */ public function randomDigitNot($except): int { return $this->ext(Extension\NumberExtension::class)->randomDigitNot((int) $except); } /** * Returns a random number between 1 and 9 */ public function randomDigitNotZero(): int { return $this->ext(Extension\NumberExtension::class)->randomDigitNotZero(); } /** * Return a random float number * * @example 48.8932 */ public function randomFloat($nbMaxDecimals = null, $min = 0, $max = null): float { return $this->ext(Extension\NumberExtension::class)->randomFloat( $nbMaxDecimals !== null ? (int) $nbMaxDecimals : null, (float) $min, $max !== null ? (float) $max : null ); } /** * Returns a random integer with 0 to $nbDigits digits. * * The maximum value returned is mt_getrandmax() * * @param int|null $nbDigits Defaults to a random number between 1 and 9 * @param bool $strict Whether the returned number should have exactly $nbDigits * * @example 79907610 */ public function randomNumber($nbDigits = null, $strict = false): int { return $this->ext(Extension\NumberExtension::class)->randomNumber( $nbDigits !== null ? (int) $nbDigits : null, (bool) $strict ); } /** * Get a version number in semantic versioning syntax 2.0.0. (https://semver.org/spec/v2.0.0.html) * * @param bool $preRelease Pre release parts may be randomly included * @param bool $build Build parts may be randomly included * * @example 1.0.0 * @example 1.0.0-alpha.1 * @example 1.0.0-alpha.1+b71f04d */ public function semver(bool $preRelease = false, bool $build = false): string { return $this->ext(Extension\VersionExtension::class)->semver($preRelease, $build); } /** * @deprecated */ protected function callFormatWithMatches($matches) { trigger_deprecation('fakerphp/faker', '1.14', 'Protected method "callFormatWithMatches()" is deprecated and will be removed.'); return $this->format($matches[1]); } /** * @param string $attribute * * @deprecated Use a method instead. */ public function __get($attribute) { trigger_deprecation('fakerphp/faker', '1.14', 'Accessing property "%s" is deprecated, use "%s()" instead.', $attribute, $attribute); return $this->format($attribute); } /** * @param string $method * @param array $attributes */ public function __call($method, $attributes) { return $this->format($method, $attributes); } public function __destruct() { $this->seed(); } public function __wakeup() { $this->formatters = []; } }