本文整理汇总了PHP中self::setConfig方法的典型用法代码示例。如果您正苦于以下问题:PHP self::setConfig方法的具体用法?PHP self::setConfig怎么用?PHP self::setConfig使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类self
的用法示例。
在下文中一共展示了self::setConfig方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: parse
/**
* Parses a template file and declares view variables in this scope for the
* template to have access to them. Loads localized templates based on the current
* active locale.
* @param string The name of the template to load
* @param array an associative array of values to assign in the template
* @param string The file extension of the template to be loaded
* @return string The parsed html.
*/
public static function parse($path, $variables = array(), $extension = '.php', $allowDebug = true)
{
$tpl = new self();
$tpl->injectVariables($variables);
$tpl->setViewName($path);
$tpl->setConfig("file_extention", $extension);
if (!(bool) $tpl->getConfig("allow_debug")) {
$tpl->setConfig("allow_debug", false);
} else {
$tpl->setConfig("allow_debug", $allowDebug);
}
return $tpl->compile();
}
示例2: load
public static function load(Config $cfg, DB $db, $id)
{
$stmt = $db->prepare('
SELECT
`id`,
`initiated_at`,
`customer_address`,
`currency_amount`,
`bitcoin_price`,
`bitcoin_amount`,
`txid`,
`ntxid`,
`status`,
`cur_code`,
`finalized_at`,
`message`,
`notice`,
`email_to_notify`
FROM `purchases`
WHERE `id`=:id
');
$stmt->execute(array(':id' => $id));
$row = $stmt->fetchAll(PDO::FETCH_ASSOC)[0];
$purchase = new self();
$purchase->setConfig($cfg)->setInitiatedAt(new DateTime($row['initiated_at']))->setCustomerAddress(new BitcoinAddress($row['customer_address']))->setCurrencyAmount(new Amount($row['currency_amount']))->setBitcoinPrice(new Amount($row['bitcoin_price']))->setBitcoinAmount(new Amount($row['bitcoin_amount']))->setCurrency($row['cur_code'])->setFinalizedAt(new DateTime($row['finalized_at']))->setTXID($row['txid'])->setNTXID($row['txid'])->setStatus($row['status'])->setMessage($row['message'])->setNotice($row['notice'])->setEmailToNotify($row['email_to_notify'])->setId($id);
return $purchase;
}
示例3: loadFromArray
/**
* @param string $base
* @param string $label
* @param array $properties
* @throws PlinthException
*/
public static function loadFromArray($base, $label, $properties)
{
if (!isset($properties['path'])) {
throw new PlinthException('Please define the path for you component.');
}
if (!isset($properties['config']) && !isset($properties['routing'])) {
throw new PlinthException('Please define at least a config or routing.');
}
$self = new self($base, $label, $properties['path']);
if (isset($properties['config'])) {
if (!file_exists(__APP_CONFIG_PATH . $properties['config'])) {
throw new PlinthException('The config you defined does not exist.');
}
$self->setConfig($properties['config']);
}
if (isset($properties['routing'])) {
if (!file_exists(__APP_CONFIG_PATH . $properties['routing'])) {
throw new PlinthException('The routing you defined does not exist.');
}
$self->setRouting($properties['routing']);
}
if (isset($properties['configMergeDefault']) && $properties['configMergeDefault']) {
$self->enableDefaultConfigMerge();
}
if (isset($properties['routingMergeDefault']) && $properties['routingMergeDefault']) {
$self->enableDefaultRoutingMerge();
}
return $self;
}
示例4: create
/**
* @param $missingConfigurationKey
* @param array $config
*
* @return InvalidRepositoryConfig
*/
public static function create($missingConfigurationKey, array $config)
{
$e = new self('This configuration property must be provided: ' . $missingConfigurationKey);
$e->setMissingConfigurationKey($missingConfigurationKey);
$e->setConfig($config);
return $e;
}
示例5: create
/**
* @param string $oldText
* @param string $newText
* @param HtmlDiffConfig|null $config
*
* @return self
*/
public static function create($oldText, $newText, HtmlDiffConfig $config = null)
{
$diff = new self($oldText, $newText);
if (null !== $config) {
$diff->setConfig($config);
}
return $diff;
}
示例6: fromJson
/**
* @param string $json
*
* @return BuildScript
*/
public static function fromJson($json)
{
$data = json_decode($json, true);
$obj = new self();
$obj->setBuildScript($data['build']);
$obj->setRunScript($data['run']);
$obj->setConfig($data['config']);
return $obj;
}
示例7: search
/**
* @param string $query
* @param int $offset
* @param int $perPage
* @param array $config
* @return Pimcore_Google_Cse
*/
public function search($query, $offset = 0, $perPage = 10, $config = array())
{
$list = new self();
$list->setConfig($config);
$list->setOffset($offset);
$list->setPerPage($perPage);
$list->setQuery($query);
return $list;
}
示例8: factory
/**
* Factory method to create a new OpenstackClient
*
* @static
*
* @param array|Collection $config Configuration data. Array keys:
* auth_url - Authentication service URL
* username - API username
* password - API password
* tenantName - API tenantName
*
* @return \Guzzle\Common\FromConfigInterface|OpenstackClient|\Guzzle\Service\Client
*/
public static function factory($config = array())
{
$default = array('compute_type' => 'compute', 'identity_type' => 'identity', 'storage_type' => 'storage', 'region' => 'RegionOne');
$required = array('auth_url');
$config = Inspector::prepareConfig($config, $default, $required);
$client = new self($config->get('auth_url'), $config->get('username'), $config->get('password'), $config->get('tenantName'));
$client->setConfig($config);
return $client;
}
示例9: factory
/**
* Factory method to create a new OpenstackClient
*
* @static
*
* @param array|Collection $config Configuration data. Array keys:
* auth_url - Authentication service URL
* username - API username
* password - API password
* tenantName - API tenantName
*
* @return \Guzzle\Common\FromConfigInterface|OpenstackClient|\Guzzle\Service\Client
*/
public static function factory($config = array(), EventDispatcherInterface $eventDispatcher = null)
{
$default = array('compute_type' => 'compute', 'identity_type' => 'identity', 'storage_type' => 'storage', 'region' => 'RegionOne');
$required = array('auth_url');
$config = Collection::fromConfig($config, $default, $required);
$client = new self($config->get('auth_url'), $config->get('username'), $config->get('password'), $config->get('tenantName'), $eventDispatcher);
$client->setConfig($config);
$client->region = $config->get('region');
return $client;
}
示例10: factory
/**
* Factory method to create a new ComputeClient
*
* @static
*
*
* @param array|Collection $config Configuration data. Array keys:
* base_url - Base URL of web service
* token - Authentication token
* tenant_id Tenant id
*
* @return \Guzzle\Common\FromConfigInterface|ComputeClient|\Guzzle\Service\Client
*/
public static function factory($config = array())
{
$default = array();
$required = array('base_url', 'token', 'tenant_id');
$config = Inspector::prepareConfig($config, $default, $required);
$client = new self($config->get('base_url'), $config->get('token'), $config->get('tenant_id'));
$client->setConfig($config);
$client->getEventDispatcher()->addSubscriber(new AuthenticationObserver());
return $client;
}
示例11: factory
/**
* Create an instance of the client
*
* @param array $config
*
* @return \GuzzleAmazonWebservices\ProductAdvertising
*/
public static function factory($config = array())
{
$defaults = array('base_url' => '{{scheme}}://{{locale}}/onca/xml', 'scheme' => 'http', 'locale' => self::LOCALE_US, 'version' => self::VERSION);
$required = array('access_key', 'secret_key', 'associate_tag');
$config = Inspector::prepareConfig($config, $defaults, $required);
$signature = new SignatureV2($config->get('access_key'), $config->get('secret_key'));
$client = new self($config->get('base_url'), $config->get('access_key'), $config->get('secret_key'), $config->get('associate_tag'), $config->get('version'));
$client->setConfig($config);
$client->addSubscriber(new SignaturePlugin($signature, $config->get('version')));
return $client;
}
示例12: factory
public static function factory($config = array())
{
$default = array('base_url' => '{scheme}://mtgox.com/', 'scheme' => 'https');
$required = array('base_url', 'api_key', 'api_secret');
$config = Inspector::prepareConfig($config, $default, $required);
$client = new self($config->get('base_url'), $config->get('api_key'), $config->get('api_secret'));
$client->setConfig($config);
// Uncomment the following two lines to use an XML service description
$client->setDescription(ServiceDescription::factory(__DIR__ . '/' . 'client.xml'));
return $client;
}
示例13: factory
/**
* Get client instance
*
* @param array $config
*
* @return ProductAdvertisingClient
*/
public static function factory($config)
{
$defaults = array('base_url' => 'http://webservices.amazon.com/onca/xml?Service=AWSECommerceService', 'version' => self::VERSION);
$required = array('access_key', 'secret_key');
$config = Inspector::prepareConfig($config, $defaults, $required);
$signature = new SignatureV2($config->get('access_key'), $config->get('secret_key'));
$client = new self($config->get('base_url'), $config->get('access_key'), $config->get('secret_key'), $config->get('version'), $signature);
$client->setConfig($config);
// Sign the request last
$client->getEventManager()->attach(new QueryStringAuthPlugin($signature, $config->get('version')), -9999);
return $client;
}
示例14: factory
/**
* Factory method to create a new MediawikiApiClient
*
* @param array|Collection $config Configuration data. Array keys:
* base_url - Base URL of web service
*
* @throws InvalidArgumentException
* @return MediawikiApiClient
*/
public static function factory($config = array())
{
$required = array('base_url');
$config = Collection::fromConfig($config, array(), $required);
$client = new self($config->get('base_url'));
$cookiePlugin = new CookiePlugin(new ArrayCookieJar());
$client->addSubscriber($cookiePlugin);
$client->setConfig($config);
$client->setUserAgent('addwiki-guzzle-mediawiki-client');
$client->setDescription(ServiceDescription::factory(dirname(__DIR__) . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR . 'mediawiki.json'));
return $client;
}
示例15: factory
/**
* Factory method to create a new SmsBoxClient
*
* @param array|Collection $config Configuration data. Array keys:
*
* base_url - Base URL of the smsBox service endpoint
* username - API username
* password - API password
*
* @return SmsBoxClient
*/
static function factory($config = array())
{
$default = array('test' => false);
$required = array('base_url', 'username', 'password');
$config = Inspector::prepareConfig($config, $default, $required);
$client = new self($config->get('base_url'), $config->get('username'), $config->get('password'), $config->get('test'));
$client->setConfig($config);
// Add the XML service description to the client
$description = ServiceDescription::factory(__DIR__ . DIRECTORY_SEPARATOR . 'guzzle_smsbox.xml');
$client->setDescription($description);
return $client;
}