本文整理汇总了PHP中Webmozart\Assert\Assert::classExists方法的典型用法代码示例。如果您正苦于以下问题:PHP Assert::classExists方法的具体用法?PHP Assert::classExists怎么用?PHP Assert::classExists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Webmozart\Assert\Assert
的用法示例。
在下文中一共展示了Assert::classExists方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: registerTagHandler
/**
* {@inheritDoc}
*/
public function registerTagHandler($tagName, $handler)
{
Assert::stringNotEmpty($tagName);
Assert::stringNotEmpty($handler);
Assert::classExists($handler);
Assert::implementsInterface($handler, StaticMethod::class);
if (strpos($tagName, '\\') && $tagName[0] !== '\\') {
throw new \InvalidArgumentException('A namespaced tag must have a leading backslash as it must be fully qualified');
}
$this->tagHandlerMappings[$tagName] = $handler;
}
示例2: __construct
/**
* ContaoRepository constructor.
*
* @param string $modelClass Model class.
*/
public function __construct($modelClass)
{
Assert::classExists($modelClass);
Assert::subclassOf($modelClass, 'Model');
$this->modelClass = $modelClass;
}
示例3: getReflectionClassWithProperty
/**
* Get a reflection class that has this property.
*
* @param string $class
* @param string $propertyName
*
* @return \ReflectionClass|null
*
* @throws \InvalidArgumentException
*/
protected static function getReflectionClassWithProperty($class, $propertyName)
{
Assert::string($class, 'First argument to Reflection::getReflectionClassWithProperty must be string. Variable of type "%s" was given.');
Assert::classExists($class, 'Could not find class "%s"');
$refl = new \ReflectionClass($class);
if ($refl->hasProperty($propertyName)) {
return $refl;
}
if (false === ($parent = get_parent_class($class))) {
// No more parents
return;
}
return self::getReflectionClassWithProperty($parent, $propertyName);
}