Webmozart\Assert\Assert::classExists PHP Method

classExists() public static method

public static classExists ( $value, $message = '' )
    public static function classExists($value, $message = '')
    {
        if (!class_exists($value)) {
            static::reportInvalidArgument(sprintf($message ?: 'Expected an existing class name. Got: %s', static::valueToString($value)));
        }
    }

Usage Example

 /**
  * {@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;
 }
All Usage Examples Of Webmozart\Assert\Assert::classExists