本文整理匯總了PHP中self::setOptions方法的典型用法代碼示例。如果您正苦於以下問題:PHP self::setOptions方法的具體用法?PHP self::setOptions怎麽用?PHP self::setOptions使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類self
的用法示例。
在下文中一共展示了self::setOptions方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: fromRouteData
public static function fromRouteData($route, array $params = array(), array $options = array())
{
$internalRoute = new self();
$internalRoute->setRoute($route);
$internalRoute->setParams($params);
$internalRoute->setOptions($options);
return $internalRoute;
}
示例2: factory
/**
* @param Container $old Source container
* @param Container $new Target container
* @param array $options Options that configure process
* @return ContainerMigration
*/
public static function factory(Container $old, Container $new, array $options = array())
{
$migration = new self();
$migration->setOldContainer($old);
$migration->setNewContainer($new);
$migration->setOptions($options);
$migration->setupReadQueue();
$migration->setupWriteQueue();
return $migration;
}
示例3: fetch
public static function fetch($id)
{
if ((int) $id < 1) {
return false;
}
$model = new self();
$db = self::getDb();
$stmt = $db->prepare("SELECT * FROM browsers WHERE id = :id LIMIT 1");
$stmt->execute(array(":id" => $id));
$model->setOptions($stmt->fetch(PDO::FETCH_ASSOC));
$stmt->closeCursor();
return $model;
}
示例4: forge
/**
* forges AppBuilder.
*
* $options = array(
* 'env' => 'env-name', // or array of env-names.
* 'debug' => true, // or false.
* 'env-file' => 'env-file-name',
* )
*
* @param string $app_dir
* @param string|null $var_dir
* @param array $options
* @return AppBuilder
*/
public static function forge($app_dir, $var_dir = null, $options = [])
{
$builder = new self($app_dir, $var_dir);
if (isset($options['debug'])) {
$builder->debug = $options['debug'];
}
// set environment
if (isset($options['env'])) {
// directly specify using 'env'.
$builder->envObj->setEnvironment((array) $options['env']);
} elseif (isset($options['env-file'])) {
// or, set from 'env-file'.
$builder->loadEnvironment($options['env-file']);
}
$options['app-dir'] = $app_dir;
$options['var-dir'] = $var_dir;
$builder->setOptions($options);
return $builder;
}
示例5: createTemporary
public static function createTemporary($_hours)
{
$user = new self();
$user->setLogin('temp_' . config::genKey());
$user->setPassword(config::genKey(45));
$user->setRights('admin', 1);
$user->setOptions('validity_limit', date('Y-m-d H:i:s', strtotime('+' . $_hours . ' hour now')));
$user->save();
return $user;
}
示例6: createAndExec
public static function createAndExec($_type, $_cmd, $_options)
{
$scenarioExpression = new self();
$scenarioExpression->setType($_type);
$scenarioExpression->setExpression($_cmd);
if (is_array($_options)) {
foreach ($_options as $key => $value) {
$scenarioExpression->setOptions($key, $value);
}
}
return $scenarioExpression->execute();
}
示例7: fromArray
/**
* {@inheritdoc}
*/
public static function fromArray(array $values)
{
$message = new self();
$values = array_merge(['name' => null, 'field' => [], 'extension' => [], 'nested_type' => [], 'enum_type' => [], 'extension_range' => [], 'oneof_decl' => [], 'options' => null, 'reserved_range' => [], 'reserved_name' => []], $values);
$message->setName($values['name']);
$message->setOptions($values['options']);
foreach ($values['field'] as $item) {
$message->addField($item);
}
foreach ($values['extension'] as $item) {
$message->addExtension($item);
}
foreach ($values['nested_type'] as $item) {
$message->addNestedType($item);
}
foreach ($values['enum_type'] as $item) {
$message->addEnumType($item);
}
foreach ($values['extension_range'] as $item) {
$message->addExtensionRange($item);
}
foreach ($values['oneof_decl'] as $item) {
$message->addOneofDecl($item);
}
foreach ($values['reserved_range'] as $item) {
$message->addReservedRange($item);
}
foreach ($values['reserved_name'] as $item) {
$message->addReservedName($item);
}
return $message;
}
示例8: fromArray
/**
* {@inheritdoc}
*/
public static function fromArray(array $values)
{
$message = new self();
$values = array_merge(['name' => null, 'number' => null, 'options' => null], $values);
$message->setName($values['name']);
$message->setNumber($values['number']);
$message->setOptions($values['options']);
return $message;
}
示例9: fromArray
/**
* {@inheritdoc}
*/
public static function fromArray(array $values)
{
$message = new self();
$values = array_merge(['name' => null, 'number' => null, 'label' => null, 'type' => null, 'type_name' => null, 'extendee' => null, 'default_value' => null, 'oneof_index' => null, 'json_name' => null, 'options' => null], $values);
$message->setName($values['name']);
$message->setNumber($values['number']);
$message->setLabel($values['label']);
$message->setType($values['type']);
$message->setTypeName($values['type_name']);
$message->setExtendee($values['extendee']);
$message->setDefaultValue($values['default_value']);
$message->setOneofIndex($values['oneof_index']);
$message->setJsonName($values['json_name']);
$message->setOptions($values['options']);
return $message;
}
示例10: fromArray
/**
* {@inheritdoc}
*/
public static function fromArray(array $values)
{
$message = new self();
$values = array_merge(['name' => null, 'package' => null, 'dependency' => [], 'public_dependency' => [], 'weak_dependency' => [], 'message_type' => [], 'enum_type' => [], 'service' => [], 'extension' => [], 'options' => null, 'source_code_info' => null, 'syntax' => null], $values);
$message->setName($values['name']);
$message->setPackage($values['package']);
$message->setOptions($values['options']);
$message->setSourceCodeInfo($values['source_code_info']);
$message->setSyntax($values['syntax']);
foreach ($values['dependency'] as $item) {
$message->addDependency($item);
}
foreach ($values['public_dependency'] as $item) {
$message->addPublicDependency($item);
}
foreach ($values['weak_dependency'] as $item) {
$message->addWeakDependency($item);
}
foreach ($values['message_type'] as $item) {
$message->addMessageType($item);
}
foreach ($values['enum_type'] as $item) {
$message->addEnumType($item);
}
foreach ($values['service'] as $item) {
$message->addService($item);
}
foreach ($values['extension'] as $item) {
$message->addExtension($item);
}
return $message;
}
示例11: fromArray
/**
* {@inheritdoc}
*/
public static function fromArray(array $values)
{
$message = new self();
$values = array_merge(['name' => null, 'value' => [], 'options' => null], $values);
$message->setName($values['name']);
$message->setOptions($values['options']);
foreach ($values['value'] as $item) {
$message->addValue($item);
}
return $message;
}
示例12: decode
/**
* Decode a JSON source string.
*
* Decodes a JSON encoded string. The value returned will be one of the
* following:
* - integer
* - float
* - boolean
* - null
* - StdClass
* - array
* - array of one or more of the above types
*
* @param string $source String to be decoded.
*
* @return mixed The decoded source.
*/
public function decode($source)
{
$decoder = new self($source);
$decoder->setOptions($this->getOptions());
return $decoder->_decode();
}
示例13: createFromRequest
public static function createFromRequest(Request $request)
{
$newConfig = new self();
if ($request->get('options')) {
$newConfig->setOptions($request->get('options'));
} else {
$newConfig->setOptions([]);
}
$newConfig->setStatus($request->get('status'));
return $newConfig;
}
示例14: encode
/**
* Use the JSON encoding scheme for the value specified
*
* @param mixed $value The value to be encoded
*
* @return string The encoded value
*/
public function encode($value)
{
$encoder = new self();
$encoder->setOptions($this->getOptions());
return $encoder->_encode($value);
}
示例15: fromArray
/**
* {@inheritdoc}
*/
public static function fromArray(array $values)
{
$message = new self();
$values = array_merge(['name' => null, 'input_type' => null, 'output_type' => null, 'options' => null, 'client_streaming' => false, 'server_streaming' => false], $values);
$message->setName($values['name']);
$message->setInputType($values['input_type']);
$message->setOutputType($values['output_type']);
$message->setOptions($values['options']);
$message->setClientStreaming($values['client_streaming']);
$message->setServerStreaming($values['server_streaming']);
return $message;
}