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();
 }
Example #2
0
 public function __construct($host, $username, $password, $schema, $port)
 {
     $this->host = $host;
     $this->username = $username;
     $this->password = $password;
     $this->schema = $schema;
     $this->port = $port;
     $this->input = \ThreadedFactory::create();
     $this->output = \ThreadedFactory::create();
     $this->start();
 }
 /**
  * @return ThreadedFactory
  */
 public static function getInstance()
 {
     if (self::$instance === null) {
         global $threadedFactoryInstance;
         if ($threadedFactoryInstance instanceof ThreadedFactory) {
             self::$instance = $threadedFactoryInstance;
         } else {
             new ThreadedFactory();
         }
     }
     return self::$instance;
 }
Example #4
0
 /**
  * @param string $logFile
  * @param bool   $logDebug
  *
  * @throws \RuntimeException
  */
 public function __construct($logFile, $logDebug = false, $write = true)
 {
     if (static::$logger instanceof MainLogger) {
         throw new \RuntimeException("MainLogger has been already created");
     }
     static::$logger = $this;
     $this->write = $write;
     if ($write) {
         touch($logFile);
         $this->logFile = $logFile;
         $this->logDebug = (bool) $logDebug;
     }
     $this->logStream = \ThreadedFactory::create();
     $this->start();
 }
Example #5
0
 /**
  * @param \ThreadedLogger $logger
  * @param \ClassLoader    $loader
  * @param int             $port
  * @param string          $interface
  *
  * @throws \Exception
  */
 public function __construct(\ThreadedLogger $logger, \ClassLoader $loader, $port, $interface = "0.0.0.0")
 {
     $this->port = (int) $port;
     if ($port < 1 or $port > 65536) {
         throw new \Exception("Invalid port range");
     }
     $this->interface = $interface;
     $this->logger = $logger;
     $this->loader = $loader;
     $loadPaths = [];
     $this->addDependency($loadPaths, new \ReflectionClass($logger));
     $this->addDependency($loadPaths, new \ReflectionClass($loader));
     $this->loadPaths = array_reverse($loadPaths);
     $this->shutdown = false;
     $this->externalQueue = \ThreadedFactory::create();
     $this->internalQueue = \ThreadedFactory::create();
     if (\Phar::running(true) !== "") {
         $this->mainPath = \Phar::running(true);
     } else {
         $this->mainPath = getcwd() . DIRECTORY_SEPARATOR;
     }
     $this->start(PTHREADS_INHERIT_NONE);
 }
 /**
  * @param ClassLoader $parent
  */
 public function __construct(ClassLoader $parent = \null)
 {
     $this->parent = $parent;
     $this->lookup = \ThreadedFactory::create();
     $this->classes = \ThreadedFactory::create();
 }
Example #7
0
 /**
  * @param \Threaded $threaded
  */
 public function __construct()
 {
     $this->buffer = \ThreadedFactory::create();
     $this->start();
 }