本文整理汇总了PHP中self::setKey方法的典型用法代码示例。如果您正苦于以下问题:PHP self::setKey方法的具体用法?PHP self::setKey怎么用?PHP self::setKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类self
的用法示例。
在下文中一共展示了self::setKey方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createFromArray
public static function createFromArray(array $getUserInfoResponse)
{
$user = new self();
$user->setEmail($getUserInfoResponse['Login']);
$user->setKey($getUserInfoResponse['Key']);
return $user;
}
示例2: getByKey
/**
* @param string $key
* @return Property_Predefined
*/
public static function getByKey($key)
{
$property = new self();
$property->setKey($key);
$property->getResource()->getByKey();
return $property;
}
示例3: getByKey
/**
* @static
* @param $id - translation key
* @param bool $create - creates an empty translation entry if the key doesn't exists
* @param bool $returnIdIfEmpty - returns $id if no translation is available
* @return Translation_Website
*/
public static function getByKey($id, $create = false, $returnIdIfEmpty = false)
{
$translation = new self();
try {
$translation->getResource()->getByKey($id);
} catch (Exception $e) {
if (!$create) {
throw new Exception($e->getMessage());
} else {
$translation->setKey($id);
$translation->setDate(time());
$translations = array();
foreach (Pimcore_Tool::getValidLanguages() as $lang) {
$translations[$lang] = "";
}
$translation->setTranslations($translations);
$translation->save();
}
}
if ($returnIdIfEmpty) {
$translations = $translation->getTranslations();
foreach ($translations as $key => $value) {
$translations[$key] = $value ?: $id;
}
$translation->setTranslations($translations);
}
return $translation;
}
示例4: setForScope
public static function setForScope($scope, array $settings)
{
/** @var \Octo\System\Store\SettingStore $settingStore */
$settingStore = Store::get('Setting');
foreach ($settings as $key => $value) {
$setting = new self();
$setting->setKey($key);
$setting->setValue($value);
$setting->setScope($scope);
$settingStore->saveByReplace($setting);
}
}
示例5: parseFromXml
/**
* @param \SimpleXMLElement $xmlElement
* @return Consumer
*/
public static function parseFromXml(\SimpleXMLElement $xmlElement)
{
$consumer = new self();
if (!empty($xmlElement->key)) {
$consumer->setKey((string) $xmlElement->key);
}
if (!empty($xmlElement->secret)) {
$consumer->setSecret((string) $xmlElement->secret);
}
if (!empty($xmlElement->name)) {
$consumer->setName((string) $xmlElement->name);
}
return $consumer;
}
示例6: set
public static function set($_key, $_value, $_lifetime = 60, $_options = null)
{
if ($_lifetime < 0) {
$_lifetime = 0;
}
$cache = new self();
$cache->setKey($_key);
$cache->setValue($_value);
$cache->setLifetime($_lifetime);
if ($_options != null) {
$cache->options = json_encode($_options, JSON_UNESCAPED_UNICODE);
}
return $cache->save();
}
示例7: getByKey
/**
* @param string $key
* @return self
*/
public static function getByKey($key)
{
$cacheKey = "property_predefined_" . $key;
try {
$property = \Zend_Registry::get($cacheKey);
if (!$property) {
throw new \Exception("Predefined property in registry is null");
}
} catch (\Exception $e) {
$property = new self();
$property->setKey($key);
$property->getDao()->getByKey();
\Zend_Registry::set($cacheKey, $property);
}
return $property;
}
示例8: fetch
public function fetch($rows)
{
$return = array();
foreach ($rows as $row) {
$obj = new self($this->_className);
if (!empty($this->_key)) {
$obj->setKey($this->_key);
}
foreach ($row as $field => $value) {
if (!is_integer($field)) {
$obj->{$field} = $value;
}
}
$return[] = clone $obj;
}
return $return;
}
示例9: set
/**
* set data for key
*
* @param $key
* @param $data
*/
public static function set($key, $data)
{
$configEntry = self::get($key, TRUE);
if (!$configEntry) {
$configEntry = new self();
$configEntry->setKey($key);
}
$configEntry->setData($data);
$configEntry->save();
}
示例10: fromArray
/**
* {@inheritdoc}
*/
public static function fromArray(array $values)
{
$message = new self();
$values = array_merge(['asset_id' => null, 'bundle_name' => null, 'version' => null, 'checksum' => null, 'size' => null, 'key' => null], $values);
$message->setAssetId($values['asset_id']);
$message->setBundleName($values['bundle_name']);
$message->setVersion($values['version']);
$message->setChecksum($values['checksum']);
$message->setSize($values['size']);
$message->setKey($values['key']);
return $message;
}
示例11: fromArray
/**
* {@inheritdoc}
*/
public static function fromArray(array $values)
{
$message = new self();
$values = array_merge(['key' => null, 'value' => null], $values);
$message->setKey($values['key']);
$message->setValue($values['value']);
return $message;
}
示例12: fromArray
/**
* {@inheritdoc}
*/
public static function fromArray(array $values)
{
$message = new self();
$values = array_merge(['festival_type' => null, 'key' => null, 'vector' => null], $values);
$message->setFestivalType($values['festival_type']);
$message->setKey($values['key']);
$message->setVector($values['vector']);
return $message;
}
示例13: createFromArray
/**
* @param array $issueData
* @return JiraIssue
*/
public static function createFromArray(array $issueData)
{
$issue = new self();
if (isset($issueData['id'])) {
$issue->setId($issueData['id']);
}
if (isset($issueData['key'])) {
$issue->setKey($issueData['key']);
}
if (isset($issueData['exand'])) {
$issue->setExpand(explode(',', $issueData['expand']));
}
if (!empty($issueData['fields'])) {
$issue->setFields($issueData['fields']);
}
return $issue;
}