has() public static method

public static has ( $object, $path ) : boolean
return 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);
     }
 }
Example #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'));
 }