本文整理汇总了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;
}
示例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());
}
示例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;
}
示例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;
}
示例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;
}
示例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();
}