Example #1
0
 public function __construct(Manager $manager, array $config)
 {
     parent::__construct($manager, $config);
     $this->setDelayProvider(Manager::readConfig($config, self::CFG_DELAY_PROVIDER, 'usleep'));
     $this->setRandomProvider(Manager::readConfig($config, self::CFG_RANDOM_PROVIDER, 'mt_rand'));
     $this->delayUnit = Manager::readConfig($config, self::CFG_DELAY_UNIT, 1000);
 }
Example #2
0
 public function __construct(Manager $manager, array $config)
 {
     parent::__construct($manager, $config);
     $this->dialogs = Manager::readConfig($config, self::CFG_ERROR_DIALOGS);
     $this->loading = Manager::readConfig($config, self::CFG_LOADING_ICON);
     $this->interval = intval(Manager::readConfig($config, self::CFG_CHECK_INTERVAL, self::DEFAULT_INTERVAL));
     $this->timeout = intval(Manager::readConfig($config, self::CFG_TIMEOUT, self::DEFAULT_TIMEOUT));
     if (!is_array($this->dialogs)) {
         throw new \InvalidArgumentException('Dialogs is not an array');
     }
     array_walk($this->dialogs, [__CLASS__, 'assertDialogRule']);
     Screen::assertRules($this->loading);
     if ($this->interval <= 0) {
         $this->interval = self::DEFAULT_INTERVAL;
         $this->logger->warning('%s: Interval is not positive integer, use default value %u.', [__CLASS__, self::DEFAULT_INTERVAL]);
     }
     $this->delayOffset = intval($this->delay * 0.15);
     if ($this->timeout < $this->interval * 3) {
         $this->timeout = $this->interval * 3;
         $this->logger->warning('%s: Timeout is not science, use minimum value %u.', [__CLASS__, $this->timeout]);
     }
     $this->screen = Screen::instance($manager, $this->app);
     $this->delay = Delay::instance($manager, $this->app);
     $this->input = Input::instance($manager, $this->app);
 }
Example #3
0
File: ADB.php Project: acgrid/adbot
 public function __construct(Manager $manager, array $config)
 {
     parent::__construct($manager, $config);
     $this->shell = new Shell($this->logger);
     $this->adb = $manager->getConstant(self::CONST_ADB_BIN, 'adb');
     $this->host = $manager->getConstant(self::CONST_ADB_HOST);
 }
Example #4
0
 public function __construct(Manager $manager, array $config)
 {
     parent::__construct($manager, $config);
     $this->adb = ADB::instance($manager, $config[Manager::RES_CONFIG_APP]);
     $this->savePath = Manager::readConfig($config, self::CFG_SCREEN_SHOT_PATH, $manager->path . DIRECTORY_SEPARATOR . 'screenshot' . DIRECTORY_SEPARATOR);
     $this->defaultDistance = Manager::readConfig($config, self::CFG_DEFAULT_DISTANCE, 8);
 }
Example #5
0
 public function __construct(Manager $manager, array $config)
 {
     parent::__construct($manager, $config);
     $this->test = Manager::readConfig($config, self::CFG_TEST_KEY, self::DEFAULT_TEST_VALUE);
     $this->testRequired = Manager::readConfig($config, self::CFG_TEST_REQUIRED_KEY);
     $this->provider = $manager->readCallback(Manager::readConfig($config, self::CFG_TEST_PROVIDER, function () {
         return self::STUB_METHOD_CLOSURE;
     }));
 }
Example #6
0
 public function __construct(Manager $manager, array $config)
 {
     parent::__construct($manager, $config);
     $this->screen = Screen::instance($manager, $this->app);
     if (isset($config[self::CFG_RULES])) {
         $this->setRules($config[self::CFG_RULES]);
     }
     $this->setDefaultConfig($config);
 }
Example #7
0
 public function __construct(Manager $manager, array $config)
 {
     parent::__construct($manager, $config);
     $this->setRetryLimit(Manager::readConfig($config, Manager::RES_CONFIG_RETRY, self::DEFAULT_RETRY_LIMIT));
     $this->setRetryDelay(Manager::readConfig($config, Manager::RES_CONFIG_RETRY, self::DEFAULT_RETRY_DELAY));
     $this->retryOffset = intval($this->retryDelay / 10);
     $this->position = Position::instance($manager, $this->app);
     $this->delay = Delay::instance($manager, $this->app);
     $this->adb = ADB::instance($manager, $this->app);
     $this->scr = Screen::instance($manager, $this->app);
 }
Example #8
0
 public function __construct(Manager $manager, array $config)
 {
     parent::__construct($manager, $config);
     $this->setRandomProvider(Manager::readConfig($config, self::CFG_RANDOM_PROVIDER, 'mt_rand'));
     $this->maxSlope = Manager::readConfig($config, self::CFG_MAX_SLOPE, mt_getrandmax());
 }