本文整理汇总了PHP中Property::getValue方法的典型用法代码示例。如果您正苦于以下问题:PHP Property::getValue方法的具体用法?PHP Property::getValue怎么用?PHP Property::getValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Property
的用法示例。
在下文中一共展示了Property::getValue方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: compareValue
public function compareValue(Property $a, Property $b)
{
// FIXME: unicode compare and take LANGUAGE into account.
if ($a->getValue() == $b->getValue()) {
return 0;
} elseif ($a->getValue() < $b->getValue()) {
return -1;
} else {
return 1;
}
}
示例2: testToString
public function testToString()
{
$property = new Property('propname', 'propvalue');
$this->assertEquals('PROPNAME', $property->name);
$this->assertEquals('propvalue', $property->value);
$this->assertEquals('propvalue', $property->__toString());
$this->assertEquals('propvalue', (string) $property);
$this->assertEquals('propvalue', $property->getValue());
}
示例3: merge
/**
* @param Property $property
*/
public function merge(Property $property)
{
$value = $property->getValue();
if ($this->isCollection()) {
if (!is_array($value)) {
$value = [$value];
}
$this->value = array_merge($this->value, $value);
} else {
$this->value = $value;
}
return $this;
}
示例4: convertProperty
/**
* Handles conversion of a single property.
*
* @param Component\VCard $input
* @param Component\VCard $output
* @param Property $property
* @param int $targetVersion
* @return void
*/
protected function convertProperty(Component\VCard $input, Component\VCard $output, Property $property, $targetVersion)
{
// Skipping these, those are automatically added.
if (in_array($property->name, array('VERSION', 'PRODID'))) {
return;
}
$parameters = $property->parameters();
$valueType = null;
if (isset($parameters['VALUE'])) {
$valueType = $parameters['VALUE']->getValue();
unset($parameters['VALUE']);
}
if (!$valueType) {
$valueType = $property->getValueType();
}
$newProperty = $output->createProperty($property->name, $property->getParts(), array(), $valueType);
if ($targetVersion === Document::VCARD30) {
if ($property instanceof Property\Uri && in_array($property->name, array('PHOTO', 'LOGO', 'SOUND'))) {
$newProperty = $this->convertUriToBinary($output, $newProperty, $parameters);
} elseif ($property instanceof Property\VCard\DateAndOrTime) {
// In vCard 4, the birth year may be optional. This is not the
// case for vCard 3. Apple has a workaround for this that
// allows applications that support Apple's extension still
// omit birthyears in vCard 3, but applications that do not
// support this, will just use a random birthyear. We're
// choosing 1604 for the birthyear, because that's what apple
// uses.
$parts = DateTimeParser::parseVCardDateTime($property->getValue());
if (is_null($parts['year'])) {
$newValue = '1604-' . $parts['month'] . '-' . $parts['date'];
$newProperty->setValue($newValue);
$newProperty['X-APPLE-OMIT-YEAR'] = '1604';
}
if ($newProperty->name == 'ANNIVERSARY') {
// Microsoft non-standard anniversary
$newProperty->name = 'X-ANNIVERSARY';
// We also need to add a new apple property for the same
// purpose. This apple property needs a 'label' in the same
// group, so we first need to find a groupname that doesn't
// exist yet.
$x = 1;
while ($output->select('ITEM' . $x . '.')) {
$x++;
}
$output->add('ITEM' . $x . '.X-ABDATE', $newProperty->getValue(), array('VALUE' => 'DATE-AND-OR-TIME'));
$output->add('ITEM' . $x . '.X-ABLABEL', '_$!<Anniversary>!$_');
}
} elseif ($property->name === 'KIND') {
switch (strtolower($property->getValue())) {
case 'org':
// vCard 3.0 does not have an equivalent to KIND:ORG,
// but apple has an extension that means the same
// thing.
$newProperty = $output->createProperty('X-ABSHOWAS', 'COMPANY');
break;
case 'individual':
// Individual is implicit, so we skip it.
return;
case 'group':
// OS X addressbook property
$newProperty = $output->createProperty('X-ADDRESSBOOKSERVER-KIND', 'GROUP');
break;
}
}
} elseif ($targetVersion === Document::VCARD40) {
// These properties were removed in vCard 4.0
if (in_array($property->name, array('NAME', 'MAILER', 'LABEL', 'CLASS'))) {
return;
}
if ($property instanceof Property\Binary) {
$newProperty = $this->convertBinaryToUri($output, $newProperty, $parameters);
} elseif ($property instanceof Property\VCard\DateAndOrTime && isset($parameters['X-APPLE-OMIT-YEAR'])) {
// If a property such as BDAY contained 'X-APPLE-OMIT-YEAR',
// then we're stripping the year from the vcard 4 value.
$parts = DateTimeParser::parseVCardDateTime($property->getValue());
if ($parts['year'] === $property['X-APPLE-OMIT-YEAR']->getValue()) {
$newValue = '--' . $parts['month'] . '-' . $parts['date'];
$newProperty->setValue($newValue);
}
// Regardless if the year matched or not, we do need to strip
// X-APPLE-OMIT-YEAR.
unset($parameters['X-APPLE-OMIT-YEAR']);
}
switch ($property->name) {
case 'X-ABSHOWAS':
if (strtoupper($property->getValue()) === 'COMPANY') {
$newProperty = $output->createProperty('KIND', 'ORG');
}
break;
case 'X-ADDRESSBOOKSERVER-KIND':
if (strtoupper($property->getValue()) === 'GROUP') {
//.........这里部分代码省略.........
示例5: storeXtendedProperty
/**
* Store an xtended (unspecified, vendor extension) property.
* @param Property $property The property to store.
* @param string $uid The uid of the CONTACT to associate the new
* record with.
* @return integer The ID of the newly created record.
*/
private function storeXtendedProperty(Property $property, $uid)
{
assert($this->connection !== null);
assert(!empty($uid));
assert(is_string($uid));
$stmt = $this->prepareCannedQuery('store', 'xtended');
$stmt->bindValue(':uid', $uid);
$stmt->bindValue(':name', $property->getName());
$stmt->bindValue(':value', $property->getValue());
$stmt->bindValue(':valuetype', $property->getValueType(false));
$stmt->bindValue('pref', $property->getPref(false), \PDO::PARAM_INT);
$stmt->bindValue(':mediatype', $property->getMediaType());
$stmt->bindValue(':propGroup', $property->getGroup());
$stmt->execute();
$propertyID = $this->connection->lastInsertId();
$this->associateTypes($property, $propertyID, 'xtended');
return $propertyID;
}
示例6: insertProperty
/**
* Добавляет новое свойство БД.
* @global type $DB
* @param \Property $property
* @param string $tableName
*/
static function insertProperty($property, $tableName)
{
global $DB;
$sql = 'INSERT INTO ' . $tableName . ' (PARENT_ID, TYPE, VALUE) VALUES (' . $property->getParentId() . ', "' . $DB->EscapeString($property->getType()) . '", "' . $DB->EscapeString($property->getValue()) . '")';
$DB->Query($sql);
$property->setId($DB->LastID());
}
示例7: dirname
<?php
include dirname(__FILE__) . '/../../bootstrap/Doctrine.php';
$t = new lime_test(7, new lime_output_color());
include dirname(__FILE__) . '/../../testTools.php';
// begin testing
$t->comment('Property class test');
$p = new Property();
$p->hydrate(array('keey' => 'testKey', 'value' => '{"a":1,"b":"geo"}'));
$t->comment('getRawValue()');
$t->is($p->getRawValue(), $p->rawGet('value'), 'getRawValue is really raw');
$t->comment('->getValue()');
$t->is($p->getValue(), array('a' => 1, 'b' => 'geo'), 'json conversion works');
$p->hydrate(array('value' => '{"a":1,"b":"g€e\'ñ"}'));
$t->is($p->getValue(), array('a' => 1, 'b' => "g€e'ñ"), 'json works with weird chars');
$p->hydrate(array('value' => '{"abcd ñep\\"ab\\"":1}'));
$t->is($p->getValue(), array('abcd ñep"ab"' => 1), 'Special chars untouched');
$t->comment('->setValue()');
$arr = array('a' => 1, 'b' => 2);
$p->setValue($arr);
$t->is($p->getValue(), $arr, 'json conversion works fine both ways');
$t->comment('test that changing the currency_decimals property changes the view');
PropertyTable::set('currency_decimals', 2);
$test_invoice->setAmounts();
$t->is($test_invoice->getGrossAmount(), 238.35, 'checking 2 decimals');
PropertyTable::set('currency_decimals', 3);
$test_invoice->setAmounts();
$t->is($test_invoice->getGrossAmount(), 238.354, 'checking 3 decimals');
PropertyTable::set('currency_decimals', 2);
示例8: getLdifProperty
/**
* @brief transform finds the ldif entries associated with the property
* @param Property $property
* @return array|false
*/
public function getLdifProperty($property)
{
$ldifReturn = array();
// Only one value per property, so we loop into types
// then for each one, look into config xml if there are ldif entries matching
$ldifEntries = self::getLdifEntry($property->name, $property['TYPE']);
// If one is found, create a tab entry like tab['ldif_entry']
if ($ldifEntries != null && count($ldifEntries) > 0) {
foreach ($ldifEntries as $ldifEntry) {
if (isset($ldifEntry['unassigned'])) {
if (strcasecmp($property->name, "REV") != 0 && strcasecmp($property->name, "VERSION") != 0 && strcasecmp($property->name, "X-LDAP-DN") != 0) {
// The unassigned properties are set in the ldap unassignedVCardProperty
$ldifReturn[(string) $this->getUnassignedVCardProperty()] = array($property->serialize());
}
} else {
// Last, if the ldif entry has a vcard_position set, take only the value in the position index
$value = $property->getValue();
if (isset($ldifEntry['vcard_position'])) {
//\OC_Log::write('ldapconnector', __METHOD__." position set ".$ldifEntry['vcard_position'], \OC_Log::DEBUG);
$tmpValues = explode(";", $property->getValue());
$value = $tmpValues[$ldifEntry['vcard_position']];
}
//\OC_Log::write('ldapconnector', __METHOD__.__METHOD__." entry : ".$ldifEntry['name']." - value : $value", \OC_Log::DEBUG);
// finally, sets tab['ldif_entry'][] with the value
if (strcmp($value, "") != 0) {
if ($ldifEntry['image']) {
$ldifReturn[(string) $ldifEntry['name']] = array(base64_decode($value));
} else {
$ldifReturn[(string) $ldifEntry['name']] = array($value);
}
}
}
}
}
return $ldifReturn;
}