has() 공개 정적인 메소드

public static has ( $object, $path ) : boolean
리턴 boolean true if property path is valid
 /**
  * Load cache models from xml mapping.
  * @param SimpleXmlElement cache node.
  */
 protected function loadCacheModel($node)
 {
     $cacheModel = new TSqlMapCacheModel();
     $properties = array('id', 'implementation');
     foreach ($node->attributes() as $name => $value) {
         if (in_array(strtolower($name), $properties)) {
             $cacheModel->{'set' . $name}((string) $value);
         }
     }
     $cache = Prado::createComponent($cacheModel->getImplementationClass(), $cacheModel);
     $this->setObjectPropFromNode($cache, $node, $properties);
     foreach ($node->xpath('property') as $propertyNode) {
         $name = $propertyNode->attributes()->name;
         if ($name === null || $name === '') {
             continue;
         }
         $value = $propertyNode->attributes()->value;
         if ($value === null || $value === '') {
             continue;
         }
         if (!TPropertyAccess::has($cache, $name)) {
             continue;
         }
         TPropertyAccess::set($cache, $name, $value);
     }
     $this->loadFlushInterval($cacheModel, $node);
     $cacheModel->initialize($cache);
     $this->_manager->addCacheModel($cacheModel);
     foreach ($node->xpath('flushOnExecute') as $flush) {
         $this->loadFlushOnCache($cacheModel, $node, $flush);
     }
 }
예제 #2
0
 public function testHasDynamicProperties()
 {
     $testobj = new _PropertyAccessTestHelperDynamicProperties();
     self::assertEquals(true, TPropertyAccess::has($testobj, 'a'));
     self::assertEquals(true, TPropertyAccess::has($testobj, 'b'));
     self::assertEquals(true, TPropertyAccess::has($testobj, 'c'));
     self::assertEquals(true, TPropertyAccess::has($testobj, 'A'));
     self::assertEquals(true, TPropertyAccess::has($testobj, 'B'));
     self::assertEquals(true, TPropertyAccess::has($testobj, 'C'));
 }