Generate the menu adaptors classes.

@param array $parameters The template parameters
328208
public function generateMenuAdaptors(array $parameters)
    {
        if ($this->demosite) {
            $relPath = '/Helper/Menu/';
            $sourceDir = $this->skeletonDir.$relPath;
            $targetDir = $this->bundle->getPath().$relPath;

            $this->renderSingleFile($sourceDir, $targetDir, 'AdminMenuAdaptor.php', $parameters);

            if ($this->isSymfony4()) {
                return;
            }

            $file = $this->bundle->getPath().'/Resources/config/services.yml';
            if (!is_file($file)) {
                $ymlData = 'services:';
            } else {
                $ymlData = '';
            }
            $ymlData .= "\n\n    ".strtolower($this->bundle->getName()).'.admin_menu_adaptor:';
            $ymlData .= "\n        class: ".$this->bundle->getNamespace()."\Helper\Menu\AdminMenuAdaptor";
            $ymlData .= "\n        tags:";
            $ymlData .= "\n            -  { name: 'kunstmaan_admin.menu.adaptor' }\n";
            file_put_contents($file, $ymlData, FILE_APPEND);

            $this->assistant->writeLine('Generating menu adaptors : <info>OK</info>');
        }
    }
723212
protected function proxyToEval(array $parameters)
    {
        return $this->command(
            'eval', [
            isset($parameters[0]) ? $parameters[0] : null,
            array_slice($parameters, 2),
            isset($parameters[1]) ? $parameters[1] : null,
            ]
        );
    }
904374
public function initialize(array $parameters = array())
        {
            // set default parameters
            foreach ($this->getDefaultParameters() as $key => $value) {
                if (is_array($value)) {
                    $this->parameters->set($key, reset($value));
                } else {
                    $this->parameters->set($key, $value);
                }
            }
            $this->helper->initialize($this, $parameters);
            return $this;
        }
370476
public function initializeParameters($parameters = array())
    {
        $this->parameters = new ParameterContainer;

        Helper::initialize($this, $parameters);

        return $this;
    }
1133937
public function setGlobalParameters($parameters)
    {
        if (!is_array($parameters) && !($parameters instanceof ArrayAccess)) {
            throw new InvalidArgumentException(
                'The $parameters argument must be an array or array accessible object.'
            );
        }

        $this->parameters = $parameters;
    }
1303555
public function initialize(array $parameters = array())
    {
        $this->parameters = new ParameterContainer;

        // set default parameters
        foreach ($this->getDefaultParameters() as $key => $value) {
            if (is_array($value)) {
                $this->parameters->set($key, reset($value));
            } else {
                $this->parameters->set($key, $value);
            }
        }

        Helper::initialize($this, $parameters);

        return $this;
    }
730655
protected function normalize(array $parameters)
    {
        foreach ($parameters as $parameter => $value) {
            if (null !== $this->knownParameters[$parameter]) {
                $parameters[$parameter] = sprintf($this->knownParameters[$parameter], $value);
            }
        }

        return $parameters;
    }
307292
public function setAdapters($adapters)
    {
        $this->adapterClasses = [];
        $this->adapters = [];
        foreach ($adapters as $name => $adapter) {
            $this->setAdapter($name, $adapter);
        }
    }
1300441
private function resolveParameters($parameters): array
    {
        // this will hold our dependencies information
        $dependencies = [];

        // Then loop through the parameters to see what is in the constructor.
        foreach ($parameters as $key => $parameter) {
            // Extract the class name to a dependency.
            $dependency = $parameter->getClass();

            // If it is null, then it is not a class, so we need to see if we've been
            // given a default value. If so, store the value for now.
            if (is_null($dependency)) {
                if ($parameter->isDefaultValueAvailable()) {
                    $dependencies[$key]['type'] = 'default';
                    $dependencies[$key]['value'] = $parameter->getDefaultValue();
                } else {
                    throw new ContainerException('Non class dependency ('.$parameter->name.') requires default value.');
                }
            }
            // Otherwise, it's a class dependency. We will store the class name
            // so that we can create it later.
            else {
                $dependencies[$key]['type'] = 'class';
                $dependencies[$key]['value'] = $dependency->name;
            }
        }

        return $dependencies;
    }
609993
public function all(array $parameters = [])
    {
        $resolver = $this->createOptionsResolver();
        $resolver->setDefined('search');

        return $this->get('namespaces', $resolver->resolve($parameters));
    }
667800
private function parameterBuilder($parameters)
    {
        foreach (get_object_vars($this) as $variable => $value)
        {
            // Except these variables
            if (!in_array($variable, $this->exceptions))
            {
                // Assuming it's not null
                if ($value !== null)
                {
                    // Converts boolean to string
                    if (is_bool($value))
                    {
                        $value = $value ? 'true' : 'false';
                    }

                    switch ($variable)
                    {
                        // Allows LatLng to be passed as an array
                        case 'location':
                            if (is_array($value))
                            {
                                // Just in case it's an associative array
                                $value = array_values($value);
                                $value = $value[0] . ',' . $value[1];
                            }
                            break;

                        // Checks that it's a value rank by value
                        case 'rankby':
                            $value = strtolower($value);

                            if (!in_array($value, array('prominence', 'distance')))
                            {
                                throw new \Exception('Invalid rank by value, please specify either "prominence" or "distance".');
                            }
                            break;

                        // Allows types to be passed as an array
                        case 'types':
                            if (is_array($value))
                            {
                                $value = implode('|', $value);
                            }
                            break;
                    }

                    $parameters[$variable] = $value;
                }
            }
        }
        return $parameters;
    }
438393
private function buildDirectiveParameters($parameters = array())
    {
        $result = array();

        foreach ($parameters as $key => $value) {
            $result[] = $key.'="'.$value.'"';
        }

        return implode(',', $result);
    }
616600
public function getProviderParameters(array $parameters)
    {
        if (isset($parameters['type'])) {
            unset($parameters['type']);
        }

        if (isset($parameters['aliases'])) {
            unset($parameters['aliases']);
        }

        if (isset($parameters['namespace'])) {
            unset($parameters['namespace']);
        }

        return $parameters;
    }
79888
public function setParameters($parameters)
    {
        parent::setParameters($parameters);
        if ($parameters !== null) {
            for ($i = 0, $size = count($parameters); $i < $size; $i++) {
                $paramname = $parameters[$i]->getName();
                switch (strtolower($paramname)) {
                    case self::CONTAINS_KEY:
                        $this->setText($parameters[$i]->getValue());
                        break;
                    case self::CASE_KEY:
                        $this->setCasesensitive($parameters[$i]->getValue());
                        break;
                    case self::WHITESPACE_KEY:
                        $this->setIgnoreWhitespace($parameters[$i]->getValue());
                        break;
                    default:
                        $this->setError("Invalid parameter " . $paramname);
                }
            } // for each param
        } // if params
    }
371219
public function build($parameters = array())
    {
        // sort array by key to generate the container name
        ksort($parameters);

        // needed for new packages installed
        $composerClass = array_filter(get_declared_classes(), function ($item) {
            if (0 === strpos($item, 'ComposerAutoloaderInit')) return true;
        });
        $composerClass = array_pop($composerClass);

        // generate hash
        $parametersHash = md5(serialize($parameters) . $composerClass);

        $containerClass = 'Container' . $parametersHash;

        $isDebug = true;

        $file = sprintf('%s/ladybug_cache/%s.php', sys_get_temp_dir(), $parametersHash);
        $containerConfigCache = new ConfigCache($file, $isDebug);

        if (!$containerConfigCache->isFresh()) {
            $this->initializeContainer();
            $this->loadServices();
            $this->loadThemes();
            $this->loadPlugins();
            $this->setParameters($parameters);

            $this->container->compile();

            $dumper = new PhpDumper($this->container);
            $containerConfigCache->write(
                $dumper->dump(array('class' => $containerClass)),
                $this->container->getResources()
            );
        } else {
            require_once $file;

            $this->container = new $containerClass();
        }

    }
888489
public function setParameters($parameters)
    {
        parent::setParameters($parameters);
        if ($parameters !== null) {
            for ($i = 0, $len = count($parameters); $i < $len; $i++) {
                $paramname = $parameters[$i]->getName();
                switch (strtolower($paramname)) {
                    case self::NAME_KEY:
                        $this->setName($parameters[$i]->getValue());
                        break;
                    case self::CASE_KEY:
                        $this->setCasesensitive(Project::toBoolean($parameters[$i]->getValue()));
                        break;
                    case self::NEGATE_KEY:
                        $this->setNegate(Project::toBoolean($parameters[$i]->getValue()));
                        break;
                    case self::REGEX_KEY:
                        $this->setRegex($parameters[$i]->getValue());
                        break;
                    default:
                        $this->setError("Invalid parameter " . $paramname);
                }
            } // for each param
        } // if params
    }
948298
public function setParameters($parameters)
    {
        parent::setParameters($parameters);
        if ($parameters !== null) {
            for ($i = 0, $size = count($parameters); $i < $size; $i++) {
                $paramname = $parameters[$i]->getName();
                if (self::TYPE_KEY == strtolower($paramname)) {
                    $this->setType($parameters[$i]->getValue());
                } else {
                    $this->setError("Invalid parameter " . $paramname);
                }
            }
        }
    }