本文整理汇总了PHP中Property::getName方法的典型用法代码示例。如果您正苦于以下问题:PHP Property::getName方法的具体用法?PHP Property::getName怎么用?PHP Property::getName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Property
的用法示例。
在下文中一共展示了Property::getName方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: add
/**
* Adds a Property. If Property already exists an Exception will be thrown.
*
* @param Property $property
*
* @return $this
*
* @throws \Exception
*/
public function add(Property $property)
{
// Property already exists?
if (null !== $this->get($property->getName())) {
throw new \Exception("Property with name '{$property->getName()}' already exists");
}
$this->elements[] = $property;
return $this;
}
示例2: loadXML
public function loadXML($xml)
{
$dom = new \SimpleXMLElement($xml);
if (!isset($dom->tokenXPath) || count($dom->tokenXPath) != 1) {
throw new \LengthException('exactly one tokenXPath has to be provided');
}
$this->tokenXPath = $dom->tokenXPath;
if (!isset($dom->tokenValueXPath) || count($dom->tokenValueXPath) != 1) {
throw new \LengthException('exactly one tokenValueXPath has to be provided');
}
$this->tokenValueXPath = $dom->tokenValueXPath;
if (!isset($dom->properties) || !isset($dom->properties->property) || count($dom->properties->property) == 0) {
throw new \LengthException('no token properties defined');
}
$n = 1;
$names = array();
foreach ($dom->properties->property as $i) {
$prop = new Property($i, $n++);
$this->properties[] = $prop;
$names[] = $prop->getName();
}
if (count($names) !== count(array_unique($names))) {
throw new \RuntimeException('property names are not unique');
}
if (isset($dom->namespaces) && isset($dom->namespaces->namespace)) {
foreach ($dom->namespaces->namespace as $i) {
$this->namespaces[(string) $i->prefix[0]] = (string) $i->uri[0];
}
}
}
示例3: add
/**
* @param Property $property
*/
public function add(Property $property)
{
$propertyName = $property->getName();
if (isset($this->properties[$propertyName])) {
$existantProperty = $this->properties[$propertyName];
$this->properties[$propertyName] = $existantProperty->merge($property);
} else {
$this->properties[$propertyName] = $property;
}
}
示例4: __construct
public function __construct(Property $property, User $user, $action)
{
$this->user = $user;
$this->property = $property;
$this->name = $property->getName();
$this->datatype = $property->getDatatype();
$this->description = $property->getDescription();
$this->descr = $property->getDescr();
$this->action = $action;
$this->action_time = new \DateTime();
}
示例5: addProperty
/**
* Bit of a messy way to add properties at a position. Just so it doesn't muck about the generated property order.
* As it's an associative array there's not a lot else that can be done.
* It's not crucial that the order stays the same either.
*
* @param Property $property
* @param null $insert_position
* @param boolean $get_only
*/
public function addProperty(Property $property, $insert_position = null, $get_only = false)
{
$key_name = strtolower($property->getName());
if (isset($this->properties[$key_name]) && $get_only) {
return;
}
$property->setModel($this);
//This is so it can be retrospectively added in the case of deprecation.
if ($insert_position !== null) {
$properties = array();
$property_position = 0;
foreach ($this->properties as $existing_name => $existing_property) {
if ($property_position++ === $insert_position) {
$properties[$key_name] = $property;
}
$properties[$existing_name] = $existing_property;
}
//Otherwise it's at the end (or after)
if ($insert_position >= $property_position) {
$properties[$key_name] = $property;
}
$this->properties = $properties;
} else {
$this->properties[$key_name] = $property;
}
}
示例6: 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;
}
示例7: addProperty
public function addProperty(Property $property)
{
$this->properties[$property->getName()] = $property;
return $this;
}
示例8: hasProperty
/**
* Whether or a given property is available in the collection of
* properties for this object instance
*
* @param \Puml\Model\Property $property
*
* @return boolean
* @since 0.1
*/
public function hasProperty(Property $property)
{
return isset($this->properties[$property->getName()]);
}
示例9: with
public function with(Property $property) : self
{
$clone = clone $this;
$clone->properties[$property->getName()] = $property;
return $clone;
}
示例10: addProperty
public function addProperty(Property $property)
{
$property->setEntity($this);
$this->properties[$property->getName()] = $property;
}
示例11: addProperty
public function addProperty(Property $property)
{
$this->properties[strtolower(preg_replace('/([a-z])([A-Z])/', '$1_$2', $property->getName()))] = $property;
}