Checks if the class can be injected
@param array $classArray
@param string|null $className
@return boolean
763996
private function canInject(array $classArray, $className = null) {
        $className = ($className === null) ? $this->getClass() : $className;

        if (!self::addInjecting($className)) {
            return false;
        }

        $refClass = new \ReflectionClass($classArray['class']);

        if ($refClass->isSubclassOf('DScribe\Core\AInjector')) {
            $class = new $classArray['class']();

            if (!$class->checkInjections($className))
                return false;
        }
        self::removeInjecting($className);

        return (isset($classArray['params']) && $refClass->getConstructor()) ?
                $refClass->newInstanceArgs($classArray['params']) :
                $refClass->newInstance();
    }
562977
private function extractIdentifierFromData(string $className, array $data) : array
    {
        return $this->objectRepositoryFactory
            ->getRepository($className)
            ->getObjectIdentifierFromData($data);
    }
1283888
public function hasClass($className)
    {
        foreach ($this->meta['classes'] as $classInMeta) {
            if ($classInMeta === $className) {
                return true;
            }
        }

        return false;
    }
981333
protected function getInstance($classname, $params)
    {
        $components = UIComponentsRegistry::get('ui-components');
        if (is_null($components)) {
            return false;
        }
        $object = $components->first(function ($value, $key) use($classname) {
            return $value instanceof $classname;
        });
        if (!$object) {
            return false;
        }

        $attributes       = array_only(array_get($params, 'data'), ['x', 'y', 'width', 'height', 'disabled', 'id']);
        $attributes['id'] = isset($params['id']) ? $params['id'] : null;

        $object->setAttributes($attributes);
        return $object;
    }
45179
private static boolean isClassAvailable(final String className) {
        try {
            return LoaderUtil.loadClass(className) != null;
        } catch (final Throwable e) {
            return false;
        }
    }
1011243
private function checkClassHasValidSuffix($className, $classSuffix = null)
    {
        if ($classSuffix === '*') {
            return true;
        }
        $classSuffixPos = strrpos($className, $classSuffix);
        return $classSuffixPos === (strlen($className) - strlen($classSuffix));
    }
99453
public function addClass($classname)
    {
        $classArr = $this->getClassArray();
        $classArr[] = $classname;
        return $this->setClassArray($classArr);
    }
431025
public static function isClassAttribute($className, $attrName)
    {
        if (!self::attributesSetFor($className)) {
            // # TODO: this logic doesn't make sense because the classes implementing
            // # AttributedModelTrait require a piece of code to register their attributes.
            // return false;
            throw new Exception\RuntimeException(
                sprintf("Attributes not set for class %s", $className)
            );
        }
        // return in_array($attrName, self::$classAttributes[$className]);
        return self::$classAttributes[$className]->exists($attrName);
    }
725675
public function isTransient($className)
    {
        if (!\class_exists($className)) {
            return false;
        }

        $instances = \class_implements($className);
        if ($instances === false) {
            return false;
        }

        if (!\in_array(EntityInterface::class, $instances)) {
            return false;
        }
//        if (!\in_array(DatabaseEntityInterface::class, $instances)) {
//            return false;
//        }

        return true;
    }
649281
private function containsClassName($className, array $allowedClassNames)
    {
        foreach ($allowedClassNames as $allowedClassName) {
            if (false !== stripos($className, $allowedClassName)) {
                return true;
            }
        }

        return false;
    }
350745
protected function isPrefixable($objectOrClassName): bool
    {
        if (is_string($objectOrClassName)) {
            return in_array(Prefixable::class, class_implements($objectOrClassName), true);
        }

        if (is_object($objectOrClassName)) {
            return $objectOrClassName instanceof Prefixable;
        }

        return false;
    }
1002108
private function findConstructorInjection(array $injections, string $class_name)
    {
        foreach($injections as $injection)
        {
            if (isset($injection['new'])){
                $new_params = $injection['new'];
                if (is_array($new_params)){
                    // "injections" : [ "new" : [ param1, param2, ... ] ]
                    return $injection;
                }
            }
            else{
                // process autowired constructor
                $class = new \ReflectionClass($class_name);
                $constructor = $class->getConstructor();
                $params = $constructor->getParameters();
                $injection_params = [];
                foreach($params as $p){
                    if ($p->hasType() && $p->getClass()){
                        $class_name = $p->getName();
                        if ($class_name === ContainerInterface::class){
                            $injection_params[] = '@this';
                        }
                        else{
                            $injection_params[] = '@resolve: ' . $p->getName();
                        }
                    }
                    else{
                        throw( new CompileErrorException(
                            'Type hinting was not found in constructor: class=' . $class_name . ' param=' . $p->getName(),
                            $this->state) );
                    }
                }
            }
        }
        return null;
    }
167402
public function isTransient($className)
    {
        foreach ($this->drivers as $driver) {
            if (false !== $driver->isTransient($className)) {
                return true;
            }
        }

        return false;
    }
300900
public synchronized boolean isClassAffected(String className) {
        if (isOnMustRunList(className)) {
            return true;
        }
        boolean isAffected = true;
        String fullMethodName = className + "." + CLASS_EXT;
        Set<RegData> regData = mStorer.load(mRootDir, className, CLASS_EXT);
        isAffected = isAffected(regData);
        recordTestAffectedOutcome(fullMethodName, isAffected);
        return isAffected;
    }
14059
public static function boot($className)
    {
        if (!class_exists($className)) {
            return false;
        }

        $bootstrap = new $className;
        $dispatcher = Dispatcher::getInstance();

        $class = new \ReflectionClass($className);
        foreach ($class->getMethods(\ReflectionMethod::IS_PUBLIC) as $method) {
            $methodName = $method->name;
            if (!$method->isStatic() && substr_compare('_init', $methodName, 0, 5) === 0) {
                $bootstrap->$methodName($dispatcher);
            }
        }

        return true;
    }
448689
public static boolean isClassAvailable(final String className) {
        try {
            final Class<?> clazz = loadClass(className);
            return clazz != null;
        } catch (final ClassNotFoundException | LinkageError e) {
            return false;
        } catch (final Throwable e) {
            LowLevelLogUtil.logException("Unknown error checking for existence of class: " + className, e);
            return false;
        }
    }
189706
public function canAutoCreate($className)
    {
        foreach ($this->autoCreateWhiteList as $regex) {
            if (preg_match($regex, $className)) {
                return true;
            }
        }

        return false;
    }