当前位置: 首页>>代码示例>>PHP>>正文


PHP core_kernel_classes_Class::equals方法代码示例

本文整理汇总了PHP中core_kernel_classes_Class::equals方法的典型用法代码示例。如果您正苦于以下问题:PHP core_kernel_classes_Class::equals方法的具体用法?PHP core_kernel_classes_Class::equals怎么用?PHP core_kernel_classes_Class::equals使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在core_kernel_classes_Class的用法示例。


在下文中一共展示了core_kernel_classes_Class::equals方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: deleteClass

 /**
  * Delete a subclass
  *
  * @access public
  * @author Joel Bout, <joel@taotesting.com>
  * @param  Class clazz
  * @return boolean
  */
 public function deleteClass(core_kernel_classes_Class $clazz)
 {
     $returnValue = (bool) false;
     if ($clazz->isSubClassOf($this->getRootClass()) && !$clazz->equals($this->getRootClass())) {
         $returnValue = $clazz->delete();
     } else {
         common_Logger::w('Tried to delete class ' . $clazz->getUri() . ' as if it were a subclass of ' . $this->getRootClass()->getUri());
     }
     return (bool) $returnValue;
 }
开发者ID:swapnilaptara,项目名称:tao-aptara-assess,代码行数:18,代码来源:class.ClassService.php

示例2: deleteClass

 /**
  * Delete a subclass
  *
  * @access public
  * @author Joel Bout, <joel@taotesting.com>
  * @param core_kernel_classes_Class $clazz            
  * @return boolean
  */
 public function deleteClass(core_kernel_classes_Class $clazz)
 {
     $returnValue = (bool) false;
     if ($clazz->isSubClassOf($this->getRootClass()) && !$clazz->equals($this->getRootClass())) {
         $returnValue = true;
         $subclasses = $clazz->getSubClasses(false);
         foreach ($subclasses as $subclass) {
             $returnValue = $returnValue && $this->deleteClass($subclass);
         }
         foreach ($clazz->getProperties() as $classProperty) {
             $returnValue = $returnValue && $this->deleteClassProperty($classProperty);
         }
         $returnValue = $returnValue && $clazz->delete();
     } else {
         common_Logger::w('Tried to delete class ' . $clazz->getUri() . ' as if it were a subclass of ' . $this->getRootClass()->getUri());
     }
     return (bool) $returnValue;
 }
开发者ID:nagyist,项目名称:tao-core,代码行数:26,代码来源:class.ClassService.php

示例3: isInstanceOf

 /**
  * Whenever or not the current resource is
  * an instance of the specified class
  *
  * @access public
  * @author Joel Bout, <joel.bout@tudor.lu>
  * @param  Class class
  * @return boolean
  */
 public function isInstanceOf(core_kernel_classes_Class $class)
 {
     $returnValue = (bool) false;
     foreach ($this->getTypes() as $type) {
         if ($class->equals($type) || $type->isSubClassOf($class)) {
             $returnValue = true;
             break;
         }
     }
     return (bool) $returnValue;
 }
开发者ID:oat-sa,项目名称:generis,代码行数:20,代码来源:class.Resource.php

示例4: isCampaignClass

 /**
  * is the class either the campaign class or a subclass of it
  *
  * @access public
  * @author Joel Bout, <joel@taotesting.com>
  * @param  Class clazz
  * @return boolean
  */
 public function isCampaignClass(core_kernel_classes_Class $clazz)
 {
     return $this->campaignClass->equals($clazz) || $clazz->isSubClassOf($this->campaignClass);
 }
开发者ID:nagyist,项目名称:extension-tao-campaign,代码行数:12,代码来源:class.CampaignService.php

示例5: getOrCreatePath

 /**
  * 
  * @param string $path
  * @return \core_kernel_classes_Class
  */
 private function getOrCreatePath($path)
 {
     if ($path === '') {
         $clazz = $this->getRootClass();
     } else {
         $clazz = new \core_kernel_classes_Class(\tao_helpers_uri::decode($path));
         if (!$clazz->isSubClassOf($this->getRootClass()) && !$clazz->equals($this->getRootClass()) && !$clazz->exists()) {
             // consider $path to be a label
             $found = false;
             foreach ($this->getRootClass()->getSubClasses() as $subclass) {
                 if ($subclass->getLabel() === $path) {
                     $found = true;
                     $clazz = $subclass;
                     break;
                 }
             }
             if (!$found) {
                 $clazz = $this->getRootClass()->createSubClass($path);
             }
         }
     }
     return $clazz;
 }
开发者ID:nagyist,项目名称:extension-tao-mediamanager,代码行数:28,代码来源:MediaSource.php

示例6: testSetType

 public function testSetType()
 {
     $this->hardify();
     $this->setProperties();
     $this->targetSongClass = $this->targetWorkClass->createSubClass('Song', 'The Song Class');
     $instance = $this->targetWorkClass->createInstance('setType test instance');
     $sanityCheckInstance = $this->targetWorkClass->createInstance('sanityCheck setType test');
     // verify everything is sane to begin with
     $this->assertIsA($instance, 'core_kernel_classes_resource');
     $this->assertTrue($instance->exists());
     $this->assertIsA($sanityCheckInstance, 'core_kernel_classes_resource');
     $this->assertTrue($sanityCheckInstance->exists());
     $instfound = 0;
     $sanityfound = 0;
     foreach ($this->targetWorkClass->getInstances() as $workInst) {
         if ($workInst->equals($instance)) {
             $instfound++;
         }
         if ($workInst->equals($sanityCheckInstance)) {
             $sanityfound++;
         }
     }
     $this->assertEquals($instfound, 1);
     $this->assertEquals($sanityfound, 1);
     foreach ($this->targetSongClass->getInstances() as $songInst) {
         $this->assertFalse($songInst->equals($instance), 'instance in getInstances of targetSongclass');
         $this->assertFalse($songInst->equals($sanityCheckInstance), 'sanity check instance in getInstances of targetSongclass');
     }
     $types = $instance->getTypes();
     $this->assertEquals(count($types), 1);
     $this->assertTrue($this->targetWorkClass->equals(current($types)));
     // remove the old type (targetWorkClass)
     $this->assertTrue($instance->removeType($this->targetWorkClass));
     $types = $instance->getTypes();
     $this->assertEquals(count($types), 0);
     $sanityfound = 0;
     foreach ($this->targetWorkClass->getInstances() as $workInst) {
         if ($workInst->equals($sanityCheckInstance)) {
             $sanityfound++;
         }
         $this->assertFalse($workInst->equals($instance), 'instance still in getInstances() of class after removeType()');
     }
     $this->assertEquals($sanityfound, 1);
     foreach ($this->targetSongClass->getInstances() as $songInst) {
         $this->assertFalse($songInst->equals($instance), 'instance in getInstances of targetSongclass');
         $this->assertFalse($songInst->equals($sanityCheckInstance), 'sanity check instance in getInstances of targetSongclass');
     }
     // set the new type (targetSongClass)
     $this->assertTrue($instance->setType($this->targetSongClass));
     $types = $instance->getTypes();
     $this->assertEquals(count($types), 1);
     $this->assertTrue($this->targetSongClass->equals(current($types)));
     $sanityfound = 0;
     foreach ($this->targetWorkClass->getInstances() as $workInst) {
         if ($workInst->equals($sanityCheckInstance)) {
             $sanityfound++;
         }
         $this->assertFalse($workInst->equals($instance), 'instance still in getInstances() of class after removeType()');
     }
     $this->assertEquals($sanityfound, 1);
     $instfound = 0;
     foreach ($this->targetSongClass->getInstances() as $songInst) {
         if ($songInst->equals($instance)) {
             $instfound++;
         }
         $this->assertFalse($songInst->equals($sanityCheckInstance), 'sanity check instance in getInstances of targetSongclass');
     }
     $this->assertEquals($instfound, 1);
     // cleanup and check cleanup
     $this->assertTrue($instance->delete());
     $this->assertFalse($instance->exists());
     $this->assertTrue($sanityCheckInstance->delete());
     $this->assertFalse($sanityCheckInstance->exists());
     foreach ($this->targetWorkClass->getInstances() as $workInst) {
         $this->assertFalse($workInst->equals($instance), 'instance still in getInstances() of class targetWorkClass after delete()');
         $this->assertFalse($workInst->equals($sanityCheckInstance), 'instance still in getInstances() of class targetWorkClass after delete()');
     }
     foreach ($this->targetSongClass->getInstances() as $songInst) {
         $this->assertFalse($songInst->equals($instance), 'instance still in getInstances() of class targetSongClass after delete()');
         $this->assertFalse($songInst->equals($sanityCheckInstance), 'instance still in getInstances() of class targetSongClass after delete()');
     }
 }
开发者ID:nagyist,项目名称:extension-generis-hard,代码行数:82,代码来源:HardImplTest.php


注:本文中的core_kernel_classes_Class::equals方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。