本文整理汇总了PHP中Property类的典型用法代码示例。如果您正苦于以下问题:PHP Property类的具体用法?PHP Property怎么用?PHP Property使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Property类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: 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];
}
}
}
开发者ID:acdh-oeaw,项目名称:tokeneditor,代码行数:30,代码来源:Schema.php
示例2: doNode
public function doNode(\SimpleXMLElement $node)
{
$this->id = trim((string) $node['id']);
if ($this->id == '') {
throw new IocException("A bean without id has been found !");
}
$this->className = trim((string) $node['class']);
if ($this->className == '') {
throw new IocException("Bean ({$this->id}) must have a class attribute");
}
$this->scope = trim((string) $node['scope']);
if ($this->scope == '') {
$this->scope = self::SCOPE_SINGLETON;
}
foreach ($node->property as $property) {
$prop = new Property();
$prop->doNode($property);
$this->properties[] = $prop;
}
$this->initMethod = trim((string) $node['init-method']);
$lazyInit = trim((string) $node['lazy-init']);
if ($lazyInit == 'false') {
$this->lazyInit = false;
}
$this->exported = trim((string) $node['export']);
}
开发者ID:rousseau-christopher,项目名称:equinox-core,代码行数:26,代码来源:Component.php
示例3: init
private function init()
{
$this->url = $_SERVER['SCRIPT_NAME'] . "?tab=" . $_GET['tab'] . "&pluginID=" . $_GET['pluginID'];
include_once 'classes/Property.php';
$property = new Property();
if ($this->rrdtool = $property->get_property("path_rrdtool")) {
} else {
print $property->get_error();
exit;
}
if ($this->rrd_dir = $property->get_property("path_rrddir")) {
} else {
print $property->get_error();
exit;
}
if (!$this->rrdtool || $this->rrdtool == '') {
print "Could not find rrdtool";
exit;
}
if (!$this->rrd_dir || $this->rrd_dir == '') {
print "Could not find rrd_dir";
exit;
}
return;
}
开发者ID:precurse,项目名称:netharbour,代码行数:25,代码来源:plugin.php
示例4: addProperty
public function addProperty(Property $property)
{
if ($property->getVarName()) {
$this->properties[$property->getVarName()] = $property;
}
return $this;
}
开发者ID:RapotOR,项目名称:PhpCoder,代码行数:7,代码来源:BasicClass.php
示例5: prepareObjectAttributes
public function prepareObjectAttributes($record)
{
$property = array();
foreach ($record->metas as $meta) {
//
// NEED TO REFACTORED
//
$prop_attr['key_name'] = $meta->meta->key_name;
$prop_attr['value'] = $meta->meta_value;
$prop_attr['descr'] = $meta->meta->descr;
$prop_attr['id'] = $meta->id;
//
// ====
$prop = new Property();
$prop->setAttributes($prop_attr);
$property[] = $prop->getAttributes();
}
$objects = array();
foreach ($record->objects as $object) {
$objects[] = array('name' => $object->name, 'text_value' => $object->text_value, 'descr' => $object->descr, 'id' => $object->id);
}
$attr = $record->getAttributes();
$attr['type'] = $record->type->name;
$attr['property'] = $property;
$attr['objects'] = $objects;
return $attr;
}
开发者ID:rosko,项目名称:AlmazService,代码行数:27,代码来源:YiiResourceFinder.php
示例6: test_destroying_should_cascade
public function test_destroying_should_cascade()
{
$Property = new Property(array('description' => 'This is a Property'));
$Picture = $Property->picture->create(array('title' => 'Front'));
$Property->destroy();
$this->assertFalse($this->Property->find('first', array('default' => false)));
$this->assertFalse($this->Picture->find('first', array('default' => false)));
}
开发者ID:bermi,项目名称:akelos,代码行数:8,代码来源:has_many_specifications.php
示例7: testNoModifiers
public function testNoModifiers()
{
$node = new Property(0, array());
$this->assertTrue($node->isPublic());
$this->assertFalse($node->isProtected());
$this->assertFalse($node->isPrivate());
$this->assertFalse($node->isStatic());
}
开发者ID:hilmysyarif,项目名称:sisfito,代码行数:8,代码来源:PropertyTest.php
示例8: testStaticImplicitlyPublic
public function testStaticImplicitlyPublic()
{
$node = new Property(Class_::MODIFIER_STATIC, array());
$this->assertTrue($node->isPublic());
$this->assertFalse($node->isProtected());
$this->assertFalse($node->isPrivate());
$this->assertTrue($node->isStatic());
}
开发者ID:saj696,项目名称:pipe,代码行数:8,代码来源:PropertyTest.php
示例9: test___construct_returnsSelf_ifNamesIsString
/**
* __construct() should set the names and message if $names is a string
*/
public function test___construct_returnsSelf_ifNamesIsString()
{
$name = 'foo';
$e = new Property($name);
$this->assertEquals([$name], $e->getNames());
$this->assertEquals("Property {$name} could not be found", $e->getMessage());
return;
}
开发者ID:jstewmc,项目名称:transient,代码行数:11,代码来源:PropertyTest.php
示例10: set
/**
* Shorthand to create or update properties
*
* @return void
* @author Carlos Escribano <[email protected]>
**/
public static function set($key, $value)
{
if (!($p = Doctrine::getTable('Property')->findOneBy('keey', $key))) {
$p = new Property();
$p->setKeey($key);
}
$p->setValue($value);
$p->save();
}
开发者ID:solutema,项目名称:siwapp-sf1,代码行数:15,代码来源:PropertyTable.class.php
示例11: 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;
}
开发者ID:davefoster,项目名称:kanbanBoard,代码行数:18,代码来源:PropertyBag.php
示例12: actionCreate
/**
* Creates a new Property model.
* If creation is successful, the browser will be redirected to the 'view' page.
* @return mixed
*/
public function actionCreate()
{
$model = new Property();
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(['view', 'id' => $model->property_id]);
} else {
return $this->render('create', ['model' => $model]);
}
}
开发者ID:sapgv,项目名称:distributive,代码行数:14,代码来源:PropertyCharacteristicController.php
示例13: 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;
}
}
开发者ID:ifnot,项目名称:tagmaker,代码行数:13,代码来源:Tag.php
示例14: it_returns_value_read_with_property_accessor
/**
* @test
*/
function it_returns_value_read_with_property_accessor()
{
$property = 'property';
$data = array('some data');
$propertyValue = 'property value';
$this->accessor->expects($this->once())->method('getValue')->with($data, $property)->willReturn($propertyValue);
$filter = new Property($this->accessor);
$filter->setProperty($property);
$this->assertSame($propertyValue, $filter->filter($data));
}
开发者ID:devhelp,项目名称:normalizer,代码行数:13,代码来源:PropertyTest.php
示例15: __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();
}
开发者ID:samuvack,项目名称:admin,代码行数:11,代码来源:PropertyLog.php
示例16: 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;
}
}
开发者ID:evought,项目名称:vcard-tools,代码行数:11,代码来源:SimplePropertyTrait.php
示例17: setAttributes
public function setAttributes($attr)
{
parent::setAttributes($attr);
$props = $attr['property'];
if (isset($props) && is_array($props)) {
foreach ($props as $propertyAttr) {
$property = new Property();
$property->setAttributes($propertyAttr);
$this->property[] = $property;
}
}
}
开发者ID:rosko,项目名称:AlmazService,代码行数:12,代码来源:Class.php
示例18: update_config
function update_config($values = '')
{
//calls on for the database class
include_once "classes/Property.php";
$property = new Property();
//sets the properties to store them, use a switch statement to store different description based on different properties
if ($property->set_property("Plugin_HelloWorld_greetings", $_POST['Plugin_HelloWorld_greetings'], "Hello World description")) {
return true;
} else {
return false;
}
}
开发者ID:precurse,项目名称:netharbour,代码行数:12,代码来源:plugin.php
示例19: createProperties
private function createProperties()
{
$propertiesList = $this->document->getElementsByTagName('property');
foreach ($propertiesList as $property) {
$obj = new Property();
$name = $property->getAttribute("name");
$value = $property->getAttribute("value");
$obj->setName($name);
$obj->setValue($value);
$this->addProperty($name, $obj);
}
}
开发者ID:rodrigoprestesmachado,项目名称:whiteboard,代码行数:12,代码来源:PropertiesDom.php
示例20: 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;
}
开发者ID:ifnot,项目名称:tagmaker,代码行数:16,代码来源:Property.php
注:本文中的Property类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论