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


PHP core_kernel_classes_Class::isSubClassOf方法代码示例

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


在下文中一共展示了core_kernel_classes_Class::isSubClassOf方法的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: testContext

 public function testContext()
 {
     $this->assertEquals(count($this->targetSubjectClass->getInstances()), 1);
     $this->assertEquals(count($this->targetSubjectSubClass->getInstances()), 1);
     $this->assertEquals(count($this->targetSubjectClass->getInstances()), 1);
     // If get instances in the sub classes of the targetSubjectClass, we should get 2 instances
     $this->assertEquals(count($this->targetSubjectClass->getInstances(true)), 2);
     $this->assertTrue($this->targetMovieClass->isSubClassOf($this->targetWorkClass));
     $this->assertEquals(count($this->targetWorkClass->getSubClasses()), 1);
     $this->assertTrue($this->targetProducerProperty->isMultiple());
 }
开发者ID:nagyist,项目名称:extension-generis-hard,代码行数:11,代码来源:HardImplTest.php

示例3: verifyParams

 protected function verifyParams($params)
 {
     $this->finalReport = new \common_report_Report(\common_report_Report::TYPE_SUCCESS);
     $class_uri = array_shift($params);
     $deliveryRootClass = DeliveryAssemblyService::singleton()->getRootClass();
     if (is_null($class_uri)) {
         $deliveryClass = $deliveryRootClass;
     } else {
         $deliveryClass = new \core_kernel_classes_Class($class_uri);
         if (!$deliveryClass->isSubClassOf($deliveryRootClass)) {
             $msg = "Usage: php index.php '" . __CLASS__ . "' [CLASS_URI]" . PHP_EOL;
             $msg .= "CLASS_URI : a valid delivery class uri" . PHP_EOL . PHP_EOL;
             $msg .= "Uri : " . $class_uri . " is not a valid delivery class" . PHP_EOL;
             $this->finalReport->add(\common_report_Report::createFailure($msg));
         }
     }
     $this->deliveryClass = $deliveryClass;
 }
开发者ID:oat-sa,项目名称:extension-tao-delivery-rdf,代码行数:18,代码来源:cleanDeliveryExecutions.php

示例4: 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

示例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: testIsSubClassOf

 public function testIsSubClassOf()
 {
     $class = new core_kernel_classes_Class(GENERIS_BOOLEAN);
     $subClass = $class->createSubClass('test', 'test');
     $this->assertTrue($class->isSubClassOf(new core_kernel_classes_Class(CLASS_GENERIS_RESOURCE)));
     $this->assertTrue($subClass->isSubClassOf($class));
     $this->assertFalse($subClass->isSubClassOf($subClass));
     $this->assertTrue($subClass->isSubClassOf(new core_kernel_classes_Class(CLASS_GENERIS_RESOURCE)));
     $subClass->delete();
 }
开发者ID:oat-sa,项目名称:generis,代码行数:10,代码来源:ClassTest.php


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