Checks if for a given instance the required fields are not null.

@param string       $returnTypeClass The class type of the instance.
@param object|array $instance        The instance to check.

@return bool
544642
public function isValid(string $returnTypeClass, $instance): bool
    {
        if (array_key_exists($returnTypeClass, $this->getRequiredFields()) === false) {
            return false;
        }
        foreach ($this->getRequiredFields()[$returnTypeClass] as $property) {
            if (is_array($instance)) {
                foreach ($instance as $item) {
                    if ($item->{$property} === null) {
                        return false;
                    }
                }
            } elseif ($instance->{$property} === null) {
                return false;
            }
        }
        return true;
    }
646119
public function isSatisfiedBy(ReturnType\TypeInterface $type)
    {
        if ($type->isRealType()) {
            return Types::T_ARRAY == $type->getDataType();
        }

        return $type->isCollection();
    }
492893
public function autoload($class)
    {
        if (isset($this->classes[$class])) {
            require $this->classes[$class];

            return true;
        }
        // fallback for classes defined with leading backslash
        if (strpos($class, '\\') === 0) {
            $class = substr($class, 1);

            return $this->autoload($class);
        }

        return false;
    }
986480
public function validation($instance = true)
	{
		if ($instance instanceof Validation)
		{
			$this->validation = $instance;
			return $instance;
		}

		if (empty($this->validation) and $instance === true)
		{
			$this->validation = \Validation::forge($this);
		}

		return $this->validation;
	}
28416
public function getEntityListColumnType($columnTypeClass)
    {
        if (isset($this->columnTypes[$columnTypeClass])) {
            return $this->columnTypes[$columnTypeClass];
        }
        elseif (class_exists($columnTypeClass)) {
            return new $columnTypeClass();
        }
    }
27365
public <T> boolean registerPojo(Class<T> typeClass)
    {
        assert typeClass != null;

        final HasSchema<?> last = pojoMapping.putIfAbsent(typeClass.getName(),
                new LazyRegister<T>(typeClass, this));
        
        return last == null || (last instanceof LazyRegister);
    }
1033833
public function attach($returnType, $definition = null)
    {
        if (!$returnType instanceof TypeInterface) {
            $wrong = \is_object($returnType) ? 'instance of '.\get_class($returnType) : \gettype($returnType);

            throw new InvalidArgumentException(
                sprintf('Expecting an instance of %s, got %s', TypeInterface::class, $wrong)
            );
        }

        parent::attach($returnType, $definition);

        return $this;
    }
1119109
public function getInstanceType($instanceName) {
		if (isset($this->declaredInstances[$instanceName]['class'])) {
			return $this->declaredInstances[$instanceName]['class'];
		} else {
			return null;
		}
	}
782645
public function isSatisfiedBy(ReturnType\TypeInterface $type)
    {
        return $type->isRealType() && Types::T_DOUBLE == $type->getDataType();
    }
557003
public function isSatisfiedBy(ReturnType\TypeInterface $type)
    {
        switch ($type->getDataType()) {
            case Types::T_NUMBER:
            case Types::T_RESOURCE:
            case Types::T_VARIABLE:
            case Types::T_CALLABLE:
            case Types::T_ITERABLE:
                return true;
            default:
                return false;
        }
    }
1240655
protected static function checkInternalClass($instance, $class, array $args = [])
    {
        if (null !== $instance) {
            return;
        }

        $messages = [];
        foreach ($args as $name => $value) {
            $messages[] = sprintf('%s => %s', $name, $value);
        }

        throw new \RuntimeException(sprintf(
            'Unable to create internal class: %s, with params: %s',
            $class,
            implode(', ', $messages)
        ));
    }
1070711
private function getTypeClassInstance(string $type)
    {
        $classname = isset($this->classesMap[$type]) ? $this->classesMap[$type]['class'] : false;

        return $classname ? new $classname() : false;
    }
1011537
public function autoload($class)
    {
        $isFallback = $this->isFallbackAutoloader();
        if (false !== strpos($class, self::NS_SEPARATOR)) {
            if ($this->loadClass($class, self::LOAD_NS)) {
                return $class;
            } elseif ($isFallback) {
                return $this->loadClass($class, self::ACT_AS_FALLBACK);
            }
            return false;
        }
        if (false !== strpos($class, self::PREFIX_SEPARATOR)) {
            if ($this->loadClass($class, self::LOAD_PREFIX)) {
                return $class;
            } elseif ($isFallback) {
                return $this->loadClass($class, self::ACT_AS_FALLBACK);
            }
            return false;
        }
        if ($isFallback) {
            return $this->loadClass($class, self::ACT_AS_FALLBACK);
        }
        return false;
    }
80073
public function validateObject($instance)
    {
        if (null !== $this->validator) {
            $violations = $this->validator->validate($instance);

            if (!empty($violations)) {
                throw new ValidationException($violations);
            }
        }
    }
1264517
public function getReturnType()
    {
        $isBuiltin  = false;
        $returnType = $this->functionLikeNode->getReturnType();
        $isNullable = $returnType instanceof NullableType;

        if ($isNullable) {
            $returnType = $returnType->type;
        }
        if ($returnType instanceof Identifier) {
            $isBuiltin = true;
            $returnType = $returnType->toString();
        } elseif (is_object($returnType)) {
            $returnType = $returnType->toString();
        } elseif (is_string($returnType)) {
            $isBuiltin = true;
        } else {
            return null;
        }

        return new ReflectionType($returnType, $isNullable, $isBuiltin);
    }
588285
public function isSatisfiedBy(ReturnType\TypeInterface $type)
    {
        if (false == $type->isRealType()) {
            return false;
        }

        switch ($type->getDataType()) {
            case Types::T_INT:
            case Types::T_UINT:
            case Types::T_CHAR:
            case Types::T_UCHAR:
            case Types::T_LONG:
            case Types::T_ULONG:
                return true;
            default:
                return false;
        }
    }
709927
static boolean isInstanceOfType(Object instance, Class<?> clazz) {
    if (clazz.isInterface()) {
      throw new UnsupportedOperationException(
          "Under GWT, we can't determine whether an object is an instance of an interface Class");
    }

    for (Class<?> current = instance.getClass();
        current != null;
        current = current.getSuperclass()) {
      if (current.equals(clazz)) {
        return true;
      }
    }
    return false;
  }