فهرست منبع

Wesmiler OTC 提交更新 0729

APPLE 3 سال پیش
والد
کامیت
6898e448cb

+ 4 - 0
.env

@@ -37,6 +37,10 @@ REDIS_PASSWORD=derkj&6688
 REDIS_PORT=6379
 REDIS_DB=6
 
+#socket
+SOCKET_PORT=6520
+
+
 MAIL_DRIVER=smtp
 MAIL_HOST=smtp.163.com
 MAIL_PORT=25

+ 92 - 0
vendor/fakerphp/faker/src/Faker/Container/ContainerBuilder.php

@@ -0,0 +1,92 @@
+<?php
+
+declare(strict_types=1);
+
+namespace Faker\Container;
+
+use Faker\Core;
+use Faker\Extension\BarcodeExtension;
+use Faker\Extension\BloodExtension;
+use Faker\Extension\ColorExtension;
+use Faker\Extension\DateTimeExtension;
+use Faker\Extension\FileExtension;
+use Faker\Extension\NumberExtension;
+use Faker\Extension\UuidExtension;
+use Faker\Extension\VersionExtension;
+
+/**
+ * @experimental This class is experimental and does not fall under our BC promise
+ */
+final class ContainerBuilder
+{
+    /**
+     * @var array<string, callable|object|string>
+     */
+    private $definitions = [];
+
+    /**
+     * @param callable|object|string $value
+     *
+     * @throws \InvalidArgumentException
+     */
+    public function add($value, string $name = null): self
+    {
+        if (!is_string($value) && !is_callable($value) && !is_object($value)) {
+            throw new \InvalidArgumentException(sprintf(
+                'First argument to "%s::add()" must be a string, callable or object.',
+                self::class
+            ));
+        }
+
+        if ($name === null) {
+            if (is_string($value)) {
+                $name = $value;
+            } elseif (is_object($value)) {
+                $name = get_class($value);
+            } else {
+                throw new \InvalidArgumentException(sprintf(
+                    'Second argument to "%s::add()" is required not passing a string or object as first argument',
+                    self::class
+                ));
+            }
+        }
+
+        $this->definitions[$name] = $value;
+
+        return $this;
+    }
+
+    public function build(): ContainerInterface
+    {
+        return new Container($this->definitions);
+    }
+
+    /**
+     * Get an array with extension that represent the default English
+     * functionality.
+     */
+    public static function defaultExtensions(): array
+    {
+        return [
+            BarcodeExtension::class => Core\Barcode::class,
+            BloodExtension::class => Core\Blood::class,
+            ColorExtension::class => Core\Color::class,
+            DateTimeExtension::class => Core\DateTime::class,
+            FileExtension::class => Core\File::class,
+            NumberExtension::class => Core\Number::class,
+            VersionExtension::class => Core\Version::class,
+            UuidExtension::class => Core\Uuid::class,
+        ];
+    }
+
+    public static function getDefault(): ContainerInterface
+    {
+        $instance = new self();
+
+        foreach (self::defaultExtensions() as $id => $definition) {
+            $instance->add($definition, $id);
+        }
+
+        return $instance->build();
+    }
+}

+ 230 - 0
vendor/fakerphp/faker/src/Faker/Core/DateTime.php

@@ -0,0 +1,230 @@
+<?php
+
+namespace Faker\Core;
+
+use Faker\Extension\DateTimeExtension;
+use Faker\Extension\GeneratorAwareExtension;
+use Faker\Extension\GeneratorAwareExtensionTrait;
+use Faker\Extension\Helper;
+
+/**
+ * @experimental
+ *
+ * @since 1.20.0
+ */
+final class DateTime implements DateTimeExtension, GeneratorAwareExtension
+{
+    use GeneratorAwareExtensionTrait;
+
+    /**
+     * @var string[]
+     */
+    private $centuries = ['I', 'II', 'III', 'IV', 'V', 'VI', 'VII', 'VIII', 'IX', 'X', 'XI', 'XII', 'XIII', 'XIV', 'XV', 'XVI', 'XVII', 'XVIII', 'XIX', 'XX', 'XXI'];
+
+    /**
+     * @var string
+     */
+    private $defaultTimezone = null;
+
+    /**
+     * Get the POSIX-timestamp of a DateTime, int or string.
+     *
+     * @param \DateTime|float|int|string $until
+     *
+     * @return false|int
+     */
+    protected function getTimestamp($until = 'now')
+    {
+        if (is_numeric($until)) {
+            return (int) $until;
+        }
+
+        if ($until instanceof \DateTime) {
+            return $until->getTimestamp();
+        }
+
+        return strtotime(empty($until) ? 'now' : $until);
+    }
+
+    /**
+     * Get a DateTime created based on a POSIX-timestamp.
+     *
+     * @param int $timestamp the UNIX / POSIX-compatible timestamp
+     */
+    protected function getTimestampDateTime(int $timestamp): \DateTime
+    {
+        return new \DateTime('@' . $timestamp);
+    }
+
+    protected function setDefaultTimezone(string $timezone = null): void
+    {
+        $this->defaultTimezone = $timezone;
+    }
+
+    protected function getDefaultTimezone(): ?string
+    {
+        return $this->defaultTimezone;
+    }
+
+    protected function resolveTimezone(?string $timezone): string
+    {
+        if ($timezone !== null) {
+            return $timezone;
+        }
+
+        return null === $this->defaultTimezone ? date_default_timezone_get() : $this->defaultTimezone;
+    }
+
+    /**
+     * Internal method to set the timezone on a DateTime object.
+     */
+    protected function setTimezone(\DateTime $dateTime, ?string $timezone): \DateTime
+    {
+        $timezone = $this->resolveTimezone($timezone);
+
+        return $dateTime->setTimezone(new \DateTimeZone($timezone));
+    }
+
+    public function dateTime($until = 'now', string $timezone = null): \DateTime
+    {
+        return $this->setTimezone(
+            $this->getTimestampDateTime($this->unixTime($until)),
+            $timezone
+        );
+    }
+
+    public function dateTimeAD($until = 'now', string $timezone = null): \DateTime
+    {
+        $min = (PHP_INT_SIZE > 4) ? -62135597361 : -PHP_INT_MAX;
+
+        return $this->setTimezone(
+            $this->getTimestampDateTime($this->generator->numberBetween($min, $this->getTimestamp($until))),
+            $timezone
+        );
+    }
+
+    public function dateTimeBetween($from = '-30 years', $until = 'now', string $timezone = null): \DateTime
+    {
+        $start = $this->getTimestamp($from);
+        $end = $this->getTimestamp($until);
+
+        if ($start > $end) {
+            throw new \InvalidArgumentException('"$from" must be anterior to "$until".');
+        }
+
+        $timestamp = $this->generator->numberBetween($start, $end);
+
+        return $this->setTimezone(
+            $this->getTimestampDateTime($timestamp),
+            $timezone
+        );
+    }
+
+    public function dateTimeInInterval($from = '-30 years', string $interval = '+5 days', string $timezone = null): \DateTime
+    {
+        $intervalObject = \DateInterval::createFromDateString($interval);
+        $datetime = $from instanceof \DateTime ? $from : new \DateTime($from);
+
+        $other = (clone $datetime)->add($intervalObject);
+
+        $begin = min($datetime, $other);
+        $end = $datetime === $begin ? $other : $datetime;
+
+        return $this->dateTimeBetween($begin, $end, $timezone);
+    }
+
+    public function dateTimeThisWeek($until = 'sunday this week', string $timezone = null): \DateTime
+    {
+        return $this->dateTimeBetween('monday this week', $until, $timezone);
+    }
+
+    public function dateTimeThisMonth($until = 'last day of this month', string $timezone = null): \DateTime
+    {
+        return $this->dateTimeBetween('first day of this month', $until, $timezone);
+    }
+
+    public function dateTimeThisYear($until = 'last day of december', string $timezone = null): \DateTime
+    {
+        return $this->dateTimeBetween('first day of january', $until, $timezone);
+    }
+
+    public function dateTimeThisDecade($until = 'now', string $timezone = null): \DateTime
+    {
+        $year = floor(date('Y') / 10) * 10;
+
+        return $this->dateTimeBetween("first day of january $year", $until, $timezone);
+    }
+
+    public function dateTimeThisCentury($until = 'now', string $timezone = null): \DateTime
+    {
+        $year = floor(date('Y') / 100) * 100;
+
+        return $this->dateTimeBetween("first day of january $year", $until, $timezone);
+    }
+
+    public function date(string $format = 'Y-m-d', $until = 'now'): string
+    {
+        return $this->dateTime($until)->format($format);
+    }
+
+    public function time(string $format = 'H:i:s', $until = 'now'): string
+    {
+        return $this->date($format, $until);
+    }
+
+    public function unixTime($until = 'now'): int
+    {
+        return $this->generator->numberBetween(0, $this->getTimestamp($until));
+    }
+
+    public function iso8601($until = 'now'): string
+    {
+        return $this->date(\DateTime::ISO8601, $until);
+    }
+
+    public function amPm($until = 'now'): string
+    {
+        return $this->date('a', $until);
+    }
+
+    public function dayOfMonth($until = 'now'): string
+    {
+        return $this->date('d', $until);
+    }
+
+    public function dayOfWeek($until = 'now'): string
+    {
+        return $this->date('l', $until);
+    }
+
+    public function month($until = 'now'): string
+    {
+        return $this->date('m', $until);
+    }
+
+    public function monthName($until = 'now'): string
+    {
+        return $this->date('F', $until);
+    }
+
+    public function year($until = 'now'): string
+    {
+        return $this->date('Y', $until);
+    }
+
+    public function century(): string
+    {
+        return Helper::randomElement($this->centuries);
+    }
+
+    public function timezone(string $countryCode = null): string
+    {
+        if ($countryCode) {
+            $timezones = \DateTimeZone::listIdentifiers(\DateTimeZone::PER_COUNTRY, $countryCode);
+        } else {
+            $timezones = \DateTimeZone::listIdentifiers();
+        }
+
+        return Helper::randomElement($timezones);
+    }
+}

+ 0 - 137
vendor/fakerphp/faker/src/Faker/Extension/Container.php

@@ -1,137 +0,0 @@
-<?php
-
-declare(strict_types=1);
-
-namespace Faker\Extension;
-
-use Psr\Container\ContainerInterface;
-
-/**
- * A simple implementation of a container.
- *
- * @experimental This class is experimental and does not fall under our BC promise
- */
-final class Container implements ContainerInterface
-{
-    /**
-     * @var array<string, callable|object|string>
-     */
-    private $definitions;
-
-    private $services = [];
-
-    /**
-     * Create a container object with a set of definitions. The array value MUST
-     * produce an object that implements Extension.
-     *
-     * @param array<string, callable|object|string> $definitions
-     */
-    public function __construct(array $definitions)
-    {
-        $this->definitions = $definitions;
-    }
-
-    /**
-     * @param string $id
-     *
-     * @throws \InvalidArgumentException
-     * @throws \RuntimeException
-     * @throws ContainerException
-     * @throws NotInContainerException
-     *
-     * @return Extension
-     */
-    public function get($id)
-    {
-        if (!is_string($id)) {
-            throw new \InvalidArgumentException(sprintf(
-                'First argument of %s::get() must be string',
-                self::class
-            ));
-        }
-
-        if (array_key_exists($id, $this->services)) {
-            return $this->services[$id];
-        }
-
-        if (!$this->has($id)) {
-            throw new NotInContainerException(sprintf(
-                'There is not service with id "%s" in the container.',
-                $id
-            ));
-        }
-
-        $definition = $this->definitions[$id];
-
-        if (is_callable($definition)) {
-            try {
-                $service = $definition();
-            } catch (\Throwable $e) {
-                throw new ContainerException(
-                    sprintf(
-                        'Error while invoking callable for "%s"',
-                        $id
-                    ),
-                    0,
-                    $e
-                );
-            }
-        } elseif (is_object($definition)) {
-            $service = $definition;
-        } elseif (is_string($definition)) {
-            if (!class_exists($definition)) {
-                throw new ContainerException(sprintf(
-                    'Could not instantiate class "%s". Class was not found.',
-                    $id
-                ));
-            }
-
-            try {
-                $service = new $definition();
-            } catch (\Throwable $e) {
-                throw new ContainerException(
-                    sprintf(
-                        'Could not instantiate class "%s"',
-                        $id
-                    ),
-                    0,
-                    $e
-                );
-            }
-        } else {
-            throw new ContainerException(sprintf(
-                'Invalid type for definition with id "%s"',
-                $id
-            ));
-        }
-
-        if (!$service instanceof Extension) {
-            throw new \RuntimeException(sprintf(
-                'Service resolved for identifier "%s" does not implement the %s" interface.',
-                $id,
-                Extension::class
-            ));
-        }
-
-        $this->services[$id] = $service;
-
-        return $service;
-    }
-
-    /**
-     * @param string $id
-     *
-     * @throws \InvalidArgumentException
-     */
-    public function has($id): bool
-    {
-        if (!is_string($id)) {
-            throw new \InvalidArgumentException(sprintf(
-                'First argument of %s::get() must be string',
-                self::class
-            ));
-        }
-
-        return array_key_exists($id, $this->definitions);
-    }
-}

+ 0 - 14
vendor/fakerphp/faker/src/Faker/Extension/NotInContainerException.php

@@ -1,14 +0,0 @@
-<?php
-
-declare(strict_types=1);
-
-namespace Faker\Extension;
-
-use Psr\Container\NotFoundExceptionInterface;
-
-/**
- * @experimental This class is experimental and does not fall under our BC promise
- */
-final class NotInContainerException extends \RuntimeException implements NotFoundExceptionInterface
-{
-}