當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。