@param bool $randomMode
@param string $options

@return bool
553297
protected function executeTool($randomMode, $options)
    {
        return true === $randomMode ? $this->phpUnitRandomizerProcessor->process(
            $options
        ) : $this->phpUnitProcessor->process($options);
    }
1061041
public function stream_open(string $uri, string $mode, int $options, &$openedPath): bool
    {
        list($protocol, $path) = $this->parseUri($uri);

        $this->meta = $this->checkResource($path);


        $path = $this->meta->getRealPath();

        /** @noinspection ReturnFalseInspection */
        $this->body = $this->decorate($protocol, \file_get_contents($path), $path);

        return true;
    }
121528
public function setEnabled(Enabled $enabled)
    {
        $randomMode = false === $enabled->value() ? new PhpUnitRandomMode(false) : $this->randomMode;
        $options = false === $enabled->value() ? new PhpUnitOptions(null) : $this->options;
        
        return new self(
            new Undefined(false),
            $enabled,
            $randomMode,
            $options
        );
    }
1230278
public function findRandom(Query $query, array $options)
    {
        $query->order('rand()');

        if (!$query->clause('limit')) {
            $query->limit(1);
        }

        return $query;
    }
1000320
public static function choice(string $description, $options, $default = null, bool $allowExit = true): string
    {
        return Choose::one($description, $options, $default, $allowExit);
    }
1321208
public static function buildMock($expectedStatus, $optional = false)
    {
        $returnValue = null;

        
        self::incrementMockCount();
        $returnValue = new common_configuration_Mock($expectedStatus, 'MockComponentCheck_' . self::getMockCount());
        $returnValue->setOptional($optional);
        

        return $returnValue;
    }
413806
public function setPossibleOptions( $options )
	{
		if( !is_array( $options ) )														//  no Array given
			throw InvalidArgumentException( 'No array given.' );						//  throw Exception
		if( $options === $this->possibleOptions )										//  threse Options are already set
			return FALSE;																//  do nothing
		$this->possibleOptions	= $options;												//  set new Options
		return TRUE;																	//  indicate Success
	}
1254759
public function newSession($uid, $options = array()) {
		BLog::addToLog('[Users.Session]: SessionStart()');
		//Checking options...
		if (!isset($options['interval'])) {
			$options['interval'] = 10800;
		}
		//Conncting to the database
		$db = BFactory::getDBO();
		if (empty($db)) {
			return false;
		}
		//-------------------------------------------
		// PHP porn :-(
		//-------------------------------------------
		$DTI_GENERAL = (int)$options['interval'];
		$DTI_D = (int)($DTI_GENERAL / 86400);
		$DTI_GENERAL -= $DTI_D * 86400;
		$DTI_H = (int)($DTI_GENERAL / 3600);
		$DTI_GENERAL -= $DTI_H * 3600;
		$DTI_M = (int)($DTI_GENERAL / 60);
		$DTI_GENERAL -= $DTI_M * 60;
		$DTI_S = $DTI_GENERAL;
		$DTI_STRING = 'P0Y0M' . $DTI_D . 'DT' . $DTI_H . 'H' . $DTI_M . 'M' . $DTI_S . 'S';
		$DTI = new \DateInterval($DTI_STRING);
		//-------------------------------------------
		// Variables
		//-------------------------------------------
		$sessid = sha1(uniqid(rand(), 1));
		$nowdate = new \DateTime();
		$enddate = new \DateTime();
		$enddate->add($DTI);

		if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
			$ip = $_SERVER['HTTP_CLIENT_IP'];
		} elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
			$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
		} else {
			$ip = $_SERVER['REMOTE_ADDR'];
		}
		$ipv4 = ip2long($ip);
		//Object for cache.
		$obj = array();
		$obj['sessionid'] = $sessid;
		$obj['start'] = $nowdate->format('Y-m-d H:i:s');
		$obj['end'] = $enddate->format('Y-m-d H:i:s');
		$obj['lastaction'] = $nowdate->format('Y-m-d H:i:s');
		$obj['interval'] = (int)$options['interval'];
		$obj['updatestep'] = $options['updatestep'];
		$obj['userid'] = $uid;
		$obj['data'] = '{}';
		$obj['ipv4'] = $ipv4;
		//-------------------------------------------
		//Forming query...
		//-------------------------------------------
		$qr = 'insert into `sessions` (`sessionid`,`ipv4`,`start`,`end`,' . 'lastaction,userid,`data`,updatestep,`interval`) values (' . $db->escapeString($obj['sessionid']) . ', ' . sprintf('%u', $obj['ipv4']) . ', ' . $db->escapeString($obj['start']) . ', ' . $db->escapeString($obj['end']) . ', ' . $db->escapeString($obj['lastaction']) . ', ' . $obj['userid'] . ',' . $db->escapeString($obj['data']) . ', ' . $obj['updatestep'] . ',' . $obj['interval'] . ')';
		$q = $db->Query($qr);
		if (empty($q)) {
			return false;
		}
		//-------------------------------------------
		// Updating last action
		//-------------------------------------------
		$qr = 'update users set last_action=NOW() where id=' . $obj['userid'];
		$q = $db->Query($qr);
		if (empty($q)) {
			return false;
		}
		//-------------------------------------------
		// Inserting into log...
		//-------------------------------------------
		$qr = 'insert into `users_iplog` (`user`,`dt`,`IPv4`,`UserAgent`) values (' . $obj['userid'] . ',' . $db->escapeString($obj['start']) . ', ' . sprintf('%u', $obj['ipv4']) . ', ' . $db->escapeString($_SERVER['HTTP_USER_AGENT']) . ')';
		$q = $db->Query($qr);
		if (empty($q)) {
			return false;
		}
		$busers = BUsers::getInstance();
		$me = $busers->itemGet($obj['userid']);
		$me->updatecache();
		//-------------------------------------------
		// Set cache...
		//-------------------------------------------
		$bCache = BFactory::getCache();
		if ($bCache) {
			$bCache->set('session:' . $obj['sessionid'], $obj, 600);
		}
		//Set cookie
		$expire = time() + $options['interval'] + 3600;//+1 hour
		//$expire=0;
		if (DEBUG_MODE) {
			BLog::addToLog('[Users.Session]: SessionStart() enddate=' . $enddate->format('Y-m-d H:i:s'));
			BLog::addToLog('[Users.Session]: SessionStart() nowdate=' . $nowdate->format('Y-m-d H:i:s'));
			BLog::addToLog('[Users.Session]: Interval: ' . $options['interval']);
			BLog::addToLog('[Users.Session]: Set cookie. Expire=' . $expire);
		}
		//BDebug::print_html();die('SetCookie!');
		setcookie('brillsecret', $uid . ':' . $sessid, $expire, '/', BHOSTNAME);
		return true;
	}
1211902
public function random ()
	{
		$arr	= $this->getArrayCopy ();
		$rand	= array_rand ($arr);
		return isset ($arr[$rand])? $arr[$rand] : FALSE;
	}
981967
public function delete($table, $options = array())
    {
        $query_string = 'DELETE FROM `' . $this->pref . $table . '`' . $this->opt($options);

        try {
            $stmt = $this->doQuery($query_string);
            return $stmt->rowCount();
        } catch (\Exception $e) {
            print_r($e->getMessage());
            return false;
        }
    }
364418
protected function required_options($required, $options = array())
  {
      $required = explode(',', $required);
      foreach ($required as $r) {
          if (!array_key_exists(trim($r), $options)) {
              throw new Exception($r.' parameter is required!');
              break;

              return false;
          }
      }

      return true;
  }
1041463
def get_random_item(enum: Any, rnd: Optional[Random] = None) -> Any:
    
    if rnd and isinstance(rnd, Random):
        return rnd.choice(list(enum))
    return random_module.choice(list(enum))
145670
function randomString(options) {
  var set = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz';

  if (options.symbols === true) {
    set += '!@#$%^&*()<>?/[]{},.:;';
  }

  var key = '';
  for (var i = 0; i < options.length; i++) {
    key += set.charAt(Math.floor(Math.random() * set.length));
  }

  return key;
}
45088
private function hasAddressPart($address, $addressPart, $optional = false)
    {
        if ($optional && null === $addressPart) {
            return true;
        }

        return false !== strpos($address, $addressPart);
    }
461303
private static function _OpenMcrypt ($key, $options) {
		$td = mcrypt_module_open($options['cipher'], $options['algorithm_directory'],  $options['module'], $options['mode_directory']);
		$iv_size = mcrypt_enc_get_iv_size($td);
		$iv = mcrypt_create_iv($iv_size, $options['random_source']);
		mcrypt_generic_init($td, $key, $iv);
		return $td;
	}
978662
public function validates($options = [])
    {
        $success = true;
        foreach ($this as $entity) {
            if (!$entity->validates($options)) {
                $success = false;
            }
        }
        return $success;
    }
1078870
function setLadderMode($mode, $multicall = false)
    {
        if ($mode !== 0 && $mode !== 1) {
            throw new InvalidArgumentException('mode = ' . print_r($mode, true));
        }

        return $this->execute(ucfirst(__FUNCTION__), array($mode), $multicall);
    }