Updating menu parameter

@param $config
@param $serviceData
@return null
338846
private function updateMenu(stdClass $config, stdClass $serviceData)
    {
        $menuItem = [
            "route"         => 'admin.' . $serviceData->serviceRouteName . '.index',
            "translation"   => $serviceData->translationsLocation . '.page_title',
            "icon"          => $serviceData->serviceIcon,
            "aclPermission" => $serviceData->aclPrefix . "_list",
            "priority"      => 10,
        ];

        $newMenu = true;

            //TODO check if adminMenu exists if not create []
        foreach ( $config->adminMenu as &$existingMenuItem ) {
            if( $existingMenuItem->route == $menuItem['route'] ) {
                if( $this->confirm('Duplicate Menu item found with ' . $existingMenuItem->path . ' path. Confirm override', 'no') ) {
                    $existingMenuItem = $menuItem;
                    $newMenu = false;
                    break;
                } else {
                    $this->abort('Can not override existing configuration. Aborting...');

                    return null;
                }
            }
        }

        if ($newMenu)
            $config->adminMenu = array_merge ($config->adminMenu, [$menuItem]);

        return $config;
    }
370040
public function configurationObjectAfter(GetConfigurationObjectDTO $serviceDataTransferObject)
    {
        $this->delay(
            self::PRIORITY_SAVE_OBJECT_IN_CACHE,
            function (GetConfigurationObjectDTO $serviceDataTransferObject) {
                $cacheHash = $this->getConfigurationObjectCacheHash($serviceDataTransferObject);

                if (false === isset($this->configurationObjectsFetchedFromCache[$cacheHash])) {
                    $this->getCacheInstance()->set($cacheHash, $serviceDataTransferObject->getResult());
                }
            }
        );
    }
171225
private function processMainConfiguration(array &$serviceConnArguments, $resolvedConnConfig)
    {
        if (array_key_exists('master', $serviceConnArguments)) {
            $this->replaceConnectionArguments($serviceConnArguments['master'], $resolvedConnConfig);
        } elseif (array_key_exists('global', $serviceConnArguments)) {
            $this->replaceConnectionArguments($serviceConnArguments['global'], $resolvedConnConfig);
        } else {
            $this->replaceConnectionArguments($serviceConnArguments, $resolvedConnConfig);
        }
    }
184706
public function updateMetadata(SiteConfig $config, SiteTree $owner, &$metadata) {

		// decode into array
		$data = json_decode($owner->OpenGraphData, true);

		// check for data or throw an error
		if ($data) {

			// check if off
			if ($data['og:type'] !== 'off') {

				// Header
				$metadata .= $owner->MarkupComment('Open Graph');

				// Type
				$metadata .= $owner->MarkupOpenGraph('og:type', $data['og:type']);

				// URL
				$metadata .= $owner->MarkupOpenGraph('og:url', $owner->AbsoluteLink());

				// Site Name
				$siteName = ($data['og:site_name']) ? $data['og:site_name'] : $config->Title;
				$metadata .= $owner->MarkupOpenGraph('og:site_name', $siteName, true);

				// Title
				$title = ($data['og:title']) ? $data['og:title'] : $owner->Title;
				$metadata .= $owner->MarkupOpenGraph('og:title', $title, true);

				// Description
				$description = ($data['og:description']) ? $data['og:description'] : $owner->GenerateDescription();
				$metadata .= $owner->MarkupOpenGraph('og:description', $description, true);

				// Image
				if ($owner->OpenGraphImage()->exists()) {
					$metadata .= $owner->MarkupOpenGraph('og:image', $owner->OpenGraphImage()->getAbsoluteURL());
				}

			} else {

				// OFF
				$metadata .= $owner->MarkupComment('Open Graph [ off ]');

			}

		} else {

			// ERROR
			$metadata .= $owner->MarkupComment('Open Graph [ error ]');

		}

	}
226878
private function connect($config) {
		try {
			$this->pdoObject = new \PDO(
					$config["type"].':host=' . $config["serverName"] . ';dbname='
					. $config["dbName"] . ';port=' . $config["port"],
					$config["user"], $config["password"]);
			$this->pdoObject->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
			$this->pdoObject->exec("SET CHARACTER SET utf8");

		} catch (\PDOException $e) {
			print "Error!: " . $e->getMessage() . "<br/>";
		}
	}
651227
public function command($config = array())
    {
        $config = new ObjectConfigJson($config);
        $config->append(array(
            'id'      => '',
            'href'    => '',
            'icon'    => '',
            'allowed' => true,
            'disabled'=> false,
            'data'    => array(),
            'attribs' => array(
                'href'  => '#',
                'class' => array('toolbar')
            )
        ));

        $translator = $this->getObject('translator');

        if ($config->allowed === false)
        {
            $config->attribs->title = $translator->translate('You are not allowed to perform this action');
            $config->attribs->class->append(array('k-is-disabled', 'k-is-unauthorized'));
        }

        //Create the id
        $config->attribs['id'] = 'command-'.$config->id;

        $config->attribs->class->append(array('k-button', 'k-button--default', 'k-button-'.$config->id));

        if ($config->id === 'new' || $config->id === 'save') {
            $config->attribs->class->append(array('k-button--success'));
        }

        //Add the data attributes
        foreach($config->data as $key => $value) {
            $config->attribs['data-'.$key] = (string) $value;
        }

        //Create the href
        if(!empty($config->href)) {
            $config->attribs['href'] = $config->href;
        }

        $attribs = clone $config->attribs;
        $attribs->class = implode(" ", ObjectConfig::unbox($attribs->class));

        $html = '<a '.$this->buildAttributes($attribs).'>';

        $html .= '<span class="'.$config->icon.'" aria-hidden="true"></span> ';
        $html .= '<span class="k-button__text">';
        $html .= $translator->translate($config->label);
        $html .= '</span>';
        $html .= '</a>';

        return $html;
    }
984608
protected function getServiceInstanceDatabase(ServiceDbInterface $instance)
    {
        $port = current($instance->getHostPorts());

        return (new Database($this->databaseInfoMapping()))
            ->setPort($port)
            ->setUser($instance->username())
            ->setPassword($instance->password())
            ->setProtocol($instance->protocol())
            ->setHostname($instance->getName())
            ->setDatabase($instance->database());
    }
243615
public static void updateParameter(final HierarchicalConfiguration config, final String subKey, final String nameKey, final String valueKey,
		final Map<String, String> parameters) {
		for (HierarchicalConfiguration subConfig : config.configurationsAt(subKey)) {
			subConfig.clear();
		}
		String newNameKey = subKey + "(-1)." + nameKey;
		String newValueKey = subKey + '.' + valueKey;
		for (Map.Entry<String, String> parameter : parameters.entrySet()) {
			config.addProperty(newNameKey, parameter.getKey());
			config.addProperty(newValueKey, parameter.getValue());
		}
	}
624837
public static function generalServiceManager(Iterable $serviceConfig = NULL, $selfRefNames= []) {
        if(!static::$serviceManager) {
            if(is_null($serviceConfig))
                throw new ServiceException(sprintf("First call of %s must pass a service configuration", __METHOD__), 13);

            /** @var ServiceManager $man */
            $man = static::$serviceManager = new static($serviceConfig);
            $man->selfReferenceNames = array_merge($man->selfReferenceNames, $selfRefNames);

            if($n = self::getGlobalVariableName())
                $GLOBALS[$n] = $man;
        }
        return static::$serviceManager;
    }
1199090
public function setupService($service, array $config)
    {
        $app = $this->getApp();

        $app->container->set(
            '@' . $service,
            new ServiceDefinition($this, $service, $config)
        );
    }
822126
function (update,menu) {
    this.config.disabled = false;
    if (update) MathJax.Hub.Queue(["Reprocess",MathJax.Hub]);
  }
235845
public function connect(array $config){
		Connection::alias($config, 'database', 'file');
		Connection::alias($config, 'updateLimit', 'update_limit');

		$defaults = array(
			'memory' => false,
			'resource' => null,
			'updateLimit' => false,
			'charset' => 'UTF-8',
			'dbcharset' => 'UTF-8',
			'persistent' => false,
			'unbuffered' => false
		);

		$config += $defaults;

		if($config['memory'])
			$config['database'] = ':memory:';

		// Connect
		if(is_resource($config['resource']))
			$connection = $config['resource'];
		elseif(!isset($config['database']))
			throw new DriverException("No database file selected.");
		elseif($config['persistent'])
			$connection = @sqlite_popen($config['database'], 0666, $error);
		else
			$connection = @sqlite_open($config['database'], 0666, $error);

		if(!is_resource($connection))
			throw new DriverException("Opening database file '$config[database]' failed.");

		$this->resource = $connection;
		$this->updateLimit = (bool) $config['updateLimit'];

		// Set charset
		$this->dbCharset = $config['dbcharset'];
		$this->charset = $config['charset'];
		if(strcasecmp($this->dbCharset, $this->charset) === 0)
			$this->dbCharset = $this->charset = null;

		$this->unbuffered = $config['unbuffered'];
		$this->persistent = $config['persistent'];
	}
334140
public function update( $model, $config = [] ) {

		$admin = isset( $config[ 'admin' ] ) ? $config[ 'admin' ] : false;

		$attributes = isset( $config[ 'attributes' ] ) ? $config[ 'attributes' ] : [];

		if( $admin ) {

			$attributes	= ArrayHelper::merge( $attributes, [ 'status' ] );
		}

		return parent::update( $model, [
			'attributes' => $attributes
		]);
	}
855490
private function getServiceArgs(array $serviceHandler, array $serviceData): array
    {
        list($className, $method) = $serviceHandler;
        $rc = new \ReflectionClass($className);
        $rm = $rc->getMethod($method);
        $mps = $rm->getParameters();
        $params = $serviceData['params'] ?? [];

        if (empty($params)) {
            return [];
        }

        $index = 0;
        $args = [];
        foreach ($mps as $mp) {
            $name = $mp->getName();
            if (! isset($params[$index])) {
                break;
            }
            $args[$name] = $params[$index];
            $index++;
        }

        return $args;
    }
444981
public function objectConversionAfter(ConfigurationObjectConversionDTO $serviceDataTransferObject)
    {
        $result = $serviceDataTransferObject->getResult();

        if (is_object($result)) {
            foreach (Core::get()->getGettablePropertiesOfObject($result) as $propertyName) {
                $property = Core::get()->getObjectService()->getObjectProperty($result, $propertyName);

                $this->checkProperty($serviceDataTransferObject, $property, $propertyName);
            }
        }
    }
1054491
private function insertParameters($config)
    {
        foreach ($config as $k => $v) {
            if ($this->isArray($v)) {
                $config[$k] = $this->insertParameters($v);
            } elseif ($this->isString($v)) {
                $str = $this->str($v)->trim();
                if ($str->startsWith('%') && $str->endsWith('%')) {
                    $parameter = $str->trim('%')->val();
                    if (isset($this->parameters[$parameter])) {
                        $config[$k] = $this->parameters[$parameter];
                    } else {
                        throw new ServiceManagerException(ServiceManagerException::PARAMETER_NOT_FOUND, [
                                $parameter,
                                $this->serviceName
                            ]
                        );
                    }

                }
            }
        }

        return $config;
    }
1199329
private function setConfig($config)
	{
		foreach ($config as $key => $value) {
			$this->setConfigParam($key, $value);
		}

	}