ThreadedFactory::create PHP Method

create() public static method

public static create ( Threaded $class = Threaded::class, $arguments ) : Threaded
$class Threaded
return Threaded
    public static function create($class = \Threaded::class, ...$arguments)
    {
        /** @var \Threaded $threaded */
        $threaded = new $class(...$arguments);
        self::getInstance()->threadedList[spl_object_hash($threaded)] = $threaded;
        return $threaded;
    }

Usage Example

示例#1
0
 /**
  * @param string $logFile
  * @param bool   $logDebug
  *
  * @throws \RuntimeException
  */
 public function __construct($logFile, $logDebug = false)
 {
     if (static::$logger instanceof MainLogger) {
         throw new \RuntimeException("MainLogger has been already created");
     }
     static::$logger = $this;
     $this->logStream = \ThreadedFactory::create();
     $this->start();
 }
All Usage Examples Of ThreadedFactory::create