當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Property類代碼示例

本文整理匯總了PHP中Property的典型用法代碼示例。如果您正苦於以下問題:PHP Property類的具體用法?PHP Property怎麽用?PHP Property使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Property類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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 <carlos@markhaus.com>
  **/
 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


注:本文中的Property類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。