Hydrate $class with the provided $templates.

@param  \stdClass[]         $templates
@param  GroupClassInterface $class
@return GroupClass
341936
public function hydrate($templates, $class)
    {
        if (is_array($templates) && !empty($templates)) {
            $availableParameters = array_filter($templates, function ($template) use ($class) {
                return !$class->hasParameterWithName($template->name);
            });
            if (!empty($availableParameters)) {
                $class->setAvailableParameters(array_values($availableParameters));
            }
            foreach ($templates as $template) {
                $parameter = $class->getParameterByName($template->name);
                if ($parameter != null) {
                    $this->groupParameterHydrator->hydrate($template, $parameter);
                }
            }
        }
    }
1114517
public static function hydrateCollection(array $customClasses)
    {
        $hydrated = [];

        foreach ($customClasses as $customClass) {
            $hydrated[] = self::hydrate($customClass);
        }

        return $hydrated;
    }
683862
public function setClass($class, $namespace = '', $argv = null)
    {
        if (2 < func_num_args()) {
            $argv = func_get_args();
            $argv = array_slice($argv, 2);
        }
        
        $methods = [];
        if (is_array($class)) {
            $methods = $class['methods'];
            $class = $class['class'];
        }
        
        $obj = $class;
        if ($this->container->has($class)) {
            $obj = $this->container->get($class);
        }
        
        $reflection = Reflection::reflectClass($obj, $argv, $namespace);
        
        foreach ($reflection->getMethods() as $method) {
            $docComment = $method->getDocComment();
            if (($docComment !== false && (new DocBlockReflection($docComment))->hasTag('invokable')) || in_array($method->getName(), $methods)) {
                $definition = $this->_buildSignature($method, $class);
                $this->addMethodServiceMap($definition);
            }
        }
        
        return $this;
    }
365281
public function removeClass($class)
    {
        $classes = $this->get('class');
        if ($classes) {
            $classes = trim(preg_replace('/(^| ){1}' . $class . '( |$){1}/i', ' ', $classes));
            $this->set('class', $classes);
        }

        return $this;
    }
79652
public function createHydratorFor($objectClass)
    {
        $metadata = $this->getMetadata($objectClass);
        $propertyAccessStrategy = $metadata->isPropertyAccessStrategyEnabled();

        $hydrator = new Hydrator\Hydrator($this, $propertyAccessStrategy);
        if ($this->classResolver) {
            $hydrator->setClassResolver($this->classResolver);
        }

        $fieldsWithHydrationStrategy = $metadata->computeFieldsWithHydrationStrategy();

        $mappedFieldNames = $metadata->getMappedFieldNames();

        foreach ($mappedFieldNames as $mappedFieldName) {

            $strategy = null;

            if ($metadata->isMappedFieldWithStrategy($mappedFieldName)) {

                $fieldStrategy = $fieldsWithHydrationStrategy[$mappedFieldName];
                $strategy = new ClosureHydrationStrategy(
                    $fieldStrategy[$metadata::INDEX_EXTRACTION_STRATEGY],
                    $fieldStrategy[$metadata::INDEX_HYDRATION_STRATEGY]
                );
            }

            if ($metadata->isMappedDateField($mappedFieldName)) {

                $readDateConverter = $metadata->getReadDateFormatByMappedField($mappedFieldName, null);
                $writeDateConverter = $metadata->getWriteDateFormatByMappedField($mappedFieldName, null);

                if (! is_null($readDateConverter) && ! is_null($writeDateConverter)) {
                    $strategy = new DateHydrationStrategy($readDateConverter, $writeDateConverter, $strategy);
                } else {
                    throw new ObjectMappingException(
                        sprintf(
                            'The date field "%s" should provide "readDateConverter" and "writeDateConverter" metadata.',
                            $mappedFieldName
                        )
                    );
                }
            }

            if (! is_null($strategy)) {
                $hydrator->addStrategy($mappedFieldName, $strategy);
            }
        }

        //------------------------------------------------------------------------------------------
        if ($metadata->eventsExist()) {
            $hydrator = new Hydrator\EventHydrator($hydrator, $this);
        }

        return $hydrator;
    }
882701
public static function hydrate(stdClass $summary)
    {
        $hydrated = new SummaryEntity();

        if (isset($summary->id)) {
            $hydrated->setId($summary->id);
        }

        if (isset($summary->line)) {
            $hydrated->setLine($summary->line);
        }

        if (isset($summary->content)) {
            $hydrated->setContent($summary->content);
        }

        if (isset($summary->highlighted_content)) {
            $hydrated->setHighlightedContent($summary->highlighted_content);
        }

        if (isset($summary->file)) {
            $hydrated->setFile(FileHydrator::hydrate($summary->file));
        }

        if (isset($summary->function)) {
            $hydrated->setFunction(CustomFunctionHydrator::hydrate($summary->function));
        }

        if (isset($summary->class)) {
            $hydrated->setClass(CustomClassHydrator::hydrate($summary->class));
        }

        return $hydrated;
    }
289145
public function setContainerClass(string $containerClass)
    {
        if (!\class_exists($containerClass)
            || (
                $containerClass !== DIContainer::class
                && !\is_subclass_of($containerClass, DIContainer::class)
            )
        ) {
            throw new \InvalidArgumentException(
                \sprintf('class "%s" must extend %s', $containerClass, DIContainer::class)
            );
        }

        $this->containerClass = $containerClass;

        return $this;
    }
851558
public function updateTemplate(TemplateInterface $template)
    {
        $template->setRevision($template->getRevision() + 1);

        $this->dumper->dumpTemplate($template);
    }
426373
public function filter(&$text, TemplateInterface $template)
    {
        $matches = array();

        if(preg_match_all('#<ktml:toolbar([^>]*)>#siU', $text, $matches))
        {
            foreach($matches[0] as $key => $match)
            {
                $attributes = $this->parseAttributes($matches[1][$key]);

                //Create attributes array
                $config = new ObjectConfig($attributes);
                $config->append(array(
                    'type'  => 'actionbar',
                ));

                if($this->getIdentifier()->type != 'lib')
                {
                    if ($this->getIdentifier()->domain) {
                        $identifier = 'com://'.$this->getIdentifier()->domain.'/'.$this->getIdentifier()->package.'.template.helper.'.$config->type;
                    } else {
                        $identifier = 'com:'.$this->getIdentifier()->package.'.template.helper.'.$config->type;
                    }
                } else {
                    $identifier = 'lib:template.helper.'.$config->type;
                }

                $helper = $this->getObject('template.helper.factory')->createHelper($identifier);

                $html = '';
                if($toolbar = $this->getToolbar($helper->getToolbarType()))
                {
                    $config->toolbar = $toolbar; //set the toolbar in the config
                    
                    $html = $helper->render($config);
                }

                //Remove placeholder
                $text = str_replace($match, $html, $text);
            }
        }
    }
822924
protected function resolve( $class )
	{
		$instance = UniversalBuilder::resolveClass( $class );

		if ( isset( $this->command ) )
			$instance->setCommand( $this->command );

		return $instance;
	}
807117
public function make($class)
    {
        $action = $this->container->make($class);
        $action->setEvents($this->container->make('events'));

        return $action;
    }
257151
protected function hydrateItem($objectClass, array $item)
    {
        $object = $this->createObjectToHydrate($objectClass);

        if (0 == count($item)) {
            return $object;
        }

        $hydrator = $this->objectManager->getHydratorFor($objectClass);

        return $hydrator->hydrate($item, $object);
    }
1087033
public function setGroupClass(string $classname)
    {
        if (!class_exists($classname) || !is_subclass_of($classname, GroupInterface::class))
            throw new DomainException("Invalid group class: $classname");
        $this->group_class = $classname;
        return $this;
    }
940143
public function on($class)
    {
        $this->instance = is_string($class) ? $this->container !== null ? $this->container->make($class) : new $class : $class;
        
        return $this;
    }
355022
public function setTemplate($template)
    {
        if (!$this->id) {
            $this->getContentRoute()->setClassType(get_class($this));
            $this->getContentRoute()->setLocale($this->getLocale());
        }
        $this->getContentRoute()->setTemplate($template);

        return $this;
    }
1085469
protected function resolveClass(?ContainerInterface $container = null, string $class)
    {
        if ($container instanceof ContainerInterface && $container->has($class)) {
            return $container->get($class);
        }

        return new $class();
    }
761272
public function addClass($class)
    {
        if (is_array($class)) {
            foreach ($class as $c) {
                $this->addClass($class);
            }

            return $this;
        }
        $this->template->append('class', ' '.$class);

        return $this;
    }