Create a build closure for a given class

@param string $classname The class that need to be build
@param string $entry     Cache entry to search

@return Closure
427611
protected function build(string $classname, string $entry) : Closure
    {
        if (isset($this->dependencies[$entry])) {
            return $this->dependencies[$entry];
        }

        return function () use ($classname) {
            return $this->make($classname);
        };
    }
702337
public function setClass($classname) {
		$this->class      = trim($classname, '\\');
		$this->reflection = null;
		
		$this->reset();
		
		return $this;
	}
1078853
public function instance($classname)
    {
        // Find the class instance, and register the class if the instance is not found.
        if(!($instance = jaxon()->getPluginManager()->getRegisteredObject($classname)))
        {
            $instance = jaxon()->registerClass($classname, [], true);
        }
        if(($instance))
        {
            $this->initInstance($instance);
        }
        return $instance;
    }
414970
public static function fromRawEntry($entry)
	{
		$className = get_called_class();
		$class = new $className();

		foreach ($entry as $property=> $value)
			$class->{$property} = $value;

		return $class;
	}
6979
public function buildFromClass($classname)
	{
		$reflectionClass = new ReflectionClass($classname);

		$classDefinition = new ClassDefinition();
		$classDefinition->name = $reflectionClass->getName();
		$classDefinition->namespace = $reflectionClass->getNamespaceName();

		$reflectionProperties = $this->classPropertyFinder->findProperties($reflectionClass);

		foreach ($reflectionProperties as $reflectionProperty) {
			$classDefinition->properties[$reflectionProperty->getName()] = $this->buildPropertyDefinition($reflectionProperty);
		}

		return $classDefinition;
	}
602241
protected function _buildEntryCache()
    {
        $this->_entries = array();
        foreach ($this->_element->childNodes as $child) {
            if ($child->localName == $this->_entryElementName) {
                $this->_entries[] = $child;
            }
        }
    }
363214
public final function set(string $className, $value): CacheInterface
   {
       return $this->cache->set($className, $value);
   }
530108
public function create(string $className)
    {
        if (!class_exists($className)) {
            $classFileName = $this->fileNameforClass($className);
            $this->createFile($classFileName, $className, 'class.tmpl');
            $this->console->writeLine(
                    'Class ' . $className . ' created at ' . $classFileName
            );
        } else {
            $this->console->writeLine(
                    'Class ' . $className
                    . ' already exists, skipped creating the class'
            );
        }
    }
1071361
public function createClassConstant(string $className, string $constantName): ClassConstFetch
    {
        $classNameNode = in_array($className, ['static', 'parent', 'self'], true) ? new Name(
            $className
        ) : new FullyQualified($className);

        $classConstFetchNode = $this->builderFactory->classConstFetch($classNameNode, $constantName);
        $classConstFetchNode->class->setAttribute(AttributeKey::RESOLVED_NAME, $classNameNode);

        return $classConstFetchNode;
    }
923348
public function build(): DeleteEntryRequest
	{
		$instance = new DeleteEntryRequest();
		if ($this->cacheId === null) {
			throw new BuilderException('Property [cacheId] is required.');
		}
		$instance->cacheId = $this->cacheId;
		if ($this->request === null) {
			throw new BuilderException('Property [request] is required.');
		}
		$instance->request = $this->request;
		return $instance;
	}
1347284
protected function prepareClassReflectionForUsage($className)
    {
        if (!$this->initialized) {
            $this->initialize();
        }
        $className = $this->cleanClassName($className);
        $this->loadOrReflectClassIfNecessary($className);

        return $className;
    }
992378
protected function buildClassEventCallback($class, $prefix)
	{
		list($class, $method) = $this->parseClassEvent($class, $prefix);

		// Once we have the class and method name, we can build the Closure to resolve
		// the instance out of the IoC container and call the method on it with the
		// given arguments that are passed to the Closure as the composer's data.
		return function() use ($class, $method)
		{
			$callable = array($this->container->make($class), $method);

			return call_user_func_array($callable, func_get_args());
		};
	}
264754
public function build($className)
    {
        $footprint = $this->_footprintRegistry->get($className);

        $parentClass = $footprint->getParent();
        if (!$parentClass) {
            $parentClass = $this->_baseClassRegistry->find($className);
        }


        if ($footprint->isInterface()) {
            $generator = new InterfaceGenerator();
        } else {
            $traits = $this->_traitRegistry->findByClass($className);

            $generator = new ClassGenerator();
            $generator->useTraits($traits);
        }

        $generator->setName($className);
        $generator->setExtendedClass($parentClass);
        $generator->setImplementedInterfaces($footprint->getInterfaces());

        foreach ($footprint->getConstants() as $name => $value) {
            $generator->addConstant($name, $value);
        }

        $file = new FileGenerator();
        $file->setClass($generator);

        return $file;
    }
597331
public function build(string $className): interfaces\commands\Command
    {
        $params = is_subclass_of($className, interfaces\commands\ExecutableCommand::class) ? [$this->bus] : [];

        /** @var interfaces\commands\Command $command */
        $command = \Yii::createObject($className, $params);

        $this->prepareCommand($command);

        return $command;
    }
444855
protected function createProjectClass($className)
    {
        $arguments = func_get_args();
        array_shift($arguments);

        return $this->_projectLoader->createClass($className, $arguments);
    }
1366576
public function resolveEntryNameByContext($entryName, $context = null)
    {
        if (!interface_exists($entryName) && !class_exists($entryName)) {
            return null;
        }

        if (null === $context) {
            return $entryName;
        }

        $contextClass = $this->buildClassNameContext($context);
        $className = $this->buildClassNameByEntryName($entryName);

        $resolveByContext = $this->resolve($className, $contextClass);
        if (null !== $resolveByContext) {
            return $resolveByContext;
        }

        return $this->resolve($className, $className);
    }
892870
public function loadMetadataForClass(
        string $className,
        Mapping\ClassMetadata $metadata,
        Mapping\ClassMetadataBuildingContext $metadataBuildingContext
    ) : Mapping\ClassMetadata {
        $reflectionClass = $metadata->getReflectionClass();

        if (! $reflectionClass) {
            // this happens when running annotation driver in combination with
            // static reflection services. This is not the nicest fix
            $reflectionClass = new ReflectionClass($metadata->getClassName());
        }

        $classAnnotations = $this->getClassAnnotations($reflectionClass);
        $classMetadata    = $this->convertClassAnnotationsToClassMetadata(
            $reflectionClass,
            $classAnnotations,
            $metadata,
            $metadataBuildingContext
        );

        // Evaluate @Cache annotation
        if (isset($classAnnotations[Annotation\Cache::class])) {
            $cacheAnnot = $classAnnotations[Annotation\Cache::class];
            $cache      = $this->convertCacheAnnotationToCacheMetadata($cacheAnnot, $metadata);

            $classMetadata->setCache($cache);
        }

        // Evaluate annotations on properties/fields
        /** @var ReflectionProperty $reflProperty */
        foreach ($reflectionClass->getProperties() as $reflectionProperty) {
            if ($reflectionProperty->getDeclaringClass()->getName() !== $reflectionClass->getName()) {
                continue;
            }

            $propertyAnnotations = $this->getPropertyAnnotations($reflectionProperty);
            $property            = $this->convertPropertyAnnotationsToProperty(
                $propertyAnnotations,
                $reflectionProperty,
                $classMetadata,
                $metadataBuildingContext
            );

            if (! $property) {
                continue;
            }

            $metadata->addProperty($property);
        }

        $this->attachPropertyOverrides($classAnnotations, $reflectionClass, $metadata, $metadataBuildingContext);

        return $classMetadata;
    }