php TYPO3-Flow-Utility-Arrays类(方法)实例源码

下面列出了php TYPO3-Flow-Utility-Arrays 类(方法)源码代码实例,从而了解它的用法。

作者:kszym    项目:flow-development-collectio   
/**
  * @return void
  */
 protected function initializeAction()
 {
     $this->objects = $this->widgetConfiguration['objects'];
     $this->configuration = Arrays::arrayMergeRecursiveOverrule($this->configuration, $this->widgetConfiguration['configuration'], true);
     $this->numberOfPages = (int) ceil(count($this->objects) / (int) $this->configuration['itemsPerPage']);
     $this->maximumNumberOfLinks = (int) $this->configuration['maximumNumberOfLinks'];
 }

作者:phluzer    项目:sites.phlu.c   
/**
  * Create a new user
  *
  * This command creates a new user which has access to the backend user interface.
  *
  * More specifically, this command will create a new user and a new account at the same time. The created account
  * is, by default, a Neos backend account using the the "Typo3BackendProvider" for authentication. The given username
  * will be used as an account identifier for that new account.
  *
  * If an authentication provider name is specified, the new account will be created for that provider instead.
  *
  * Roles for the new user can optionally be specified as a comma separated list. For all roles provided by
  * Neos, the role namespace "TYPO3.Neos:" can be omitted.
  *
  * @param string $username The username of the user to be created, used as an account identifier for the newly created account
  * @param string $password Password of the user to be created
  * @param string $firstName First name of the user to be created
  * @param string $lastName Last name of the user to be created
  * @param string $department department name of the user to be created
  * @param string $photo photo name of the user to be created
  * @param string $roles A comma separated list of roles to assign. Examples: "Editor, Acme.Foo:Reviewer"
  * @param string $authenticationProvider Name of the authentication provider to use for the new account. Example: "Typo3BackendProvider"
  * @return void
  */
 public function createPhluCommand($username, $password, $firstName, $lastName, $department, $photo, $roles = null, $authenticationProvider = null)
 {
     $user = $this->userService->getUser($username, $authenticationProvider);
     if ($user instanceof User) {
         $this->outputLine('The username "%s" is already in use', array($username));
         $this->quit(1);
     }
     try {
         if ($roles === null) {
             $user = $this->userService->createUserPhlu($username, $password, $firstName, $lastName, $department, $photo, null, $authenticationProvider);
         } else {
             $roleIdentifiers = Arrays::trimExplode(',', $roles);
             $user = $this->userService->createUserPhlu($username, $password, $firstName, $lastName, $department, $photo, $roleIdentifiers, $authenticationProvider);
         }
         $roleIdentifiers = array();
         foreach ($user->getAccounts() as $account) {
             /** @var Account $account */
             foreach ($account->getRoles() as $role) {
                 /** @var Role $role */
                 $roleIdentifiers[$role->getIdentifier()] = true;
             }
         }
         $roleIdentifiers = array_keys($roleIdentifiers);
         if (count($roleIdentifiers) === 0) {
             $this->outputLine('Created user "%s".', array($username));
             $this->outputLine('<b>Please note that this user currently does not have any roles assigned.</b>');
         } else {
             $this->outputLine('Created user "%s" and assigned the following role%s: %s.', array($username, count($roleIdentifiers) > 1 ? 's' : '', implode(', ', $roleIdentifiers)));
         }
     } catch (\Exception $exception) {
         $this->outputLine($exception->getMessage());
         $this->quit(1);
     }
 }

作者:robertlemk    项目:flow-development-collectio   
/**
  * This method walks through the view configuration and applies
  * matching configurations in the order of their specifity score.
  * Possible options are currently the viewObjectName to specify
  * a different class that will be used to create the view and
  * an array of options that will be set on the view object.
  *
  * @param \TYPO3\Flow\Mvc\ActionRequest $request
  * @return array
  */
 public function getViewConfiguration(ActionRequest $request)
 {
     $cacheIdentifier = $this->createCacheIdentifier($request);
     $viewConfiguration = $this->cache->get($cacheIdentifier);
     if ($viewConfiguration === false) {
         $configurations = $this->configurationManager->getConfiguration('Views');
         $requestMatcher = new RequestMatcher($request);
         $context = new Context($requestMatcher);
         $matchingConfigurations = array();
         foreach ($configurations as $order => $configuration) {
             $requestMatcher->resetWeight();
             if (!isset($configuration['requestFilter'])) {
                 $matchingConfigurations[$order]['configuration'] = $configuration;
                 $matchingConfigurations[$order]['weight'] = $order;
             } else {
                 $result = $this->eelEvaluator->evaluate($configuration['requestFilter'], $context);
                 if ($result === false) {
                     continue;
                 }
                 $matchingConfigurations[$order]['configuration'] = $configuration;
                 $matchingConfigurations[$order]['weight'] = $requestMatcher->getWeight() + $order;
             }
         }
         usort($matchingConfigurations, function ($configuration1, $configuration2) {
             return $configuration1['weight'] > $configuration2['weight'];
         });
         $viewConfiguration = array();
         foreach ($matchingConfigurations as $key => $matchingConfiguration) {
             $viewConfiguration = Arrays::arrayMergeRecursiveOverrule($viewConfiguration, $matchingConfiguration['configuration']);
         }
         $this->cache->set($cacheIdentifier, $viewConfiguration);
     }
     return $viewConfiguration;
 }

作者:sins    项目:TYPO3.Flo   
/**
  *
  * @param string $type
  * @param boolean $showHiddenProperties if TRUE, the hidden properties are shown as configured in settings "supertypeResolver.hiddenProperties" are shown as well. FALSE by default
  * @return array
  * @throws \TYPO3\Form\Exception\TypeDefinitionNotFoundException if a type definition was not found
  * @internal
  */
 public function getMergedTypeDefinition($type, $showHiddenProperties = FALSE)
 {
     if (!isset($this->configuration[$type])) {
         throw new \TYPO3\Form\Exception\TypeDefinitionNotFoundException(sprintf('Type "%s" not found. Probably some configuration is missing.', $type), 1325686909);
     }
     $mergedTypeDefinition = array();
     if (isset($this->configuration[$type]['superTypes'])) {
         foreach ($this->configuration[$type]['superTypes'] as $superTypeName => $enabled) {
             // Skip unset node types
             if ($enabled === FALSE || $enabled === NULL) {
                 continue;
             }
             // Make this setting backwards compatible with old array schema (deprecated since 2.0)
             if (!is_bool($enabled)) {
                 $superTypeName = $enabled;
             }
             $mergedTypeDefinition = \TYPO3\Flow\Utility\Arrays::arrayMergeRecursiveOverrule($mergedTypeDefinition, $this->getMergedTypeDefinition($superTypeName, $showHiddenProperties));
         }
     }
     $mergedTypeDefinition = \TYPO3\Flow\Utility\Arrays::arrayMergeRecursiveOverrule($mergedTypeDefinition, $this->configuration[$type]);
     unset($mergedTypeDefinition['superTypes']);
     if ($showHiddenProperties === FALSE && isset($this->settings['supertypeResolver']['hiddenProperties']) && is_array($this->settings['supertypeResolver']['hiddenProperties'])) {
         foreach ($this->settings['supertypeResolver']['hiddenProperties'] as $propertyName) {
             unset($mergedTypeDefinition[$propertyName]);
         }
     }
     return $mergedTypeDefinition;
 }

作者:putheakhe    项目:Radmiraal.Emberj   
/**
  * @param string $version
  * @param boolean $loadJQuery
  * @param boolean $loadEmberData
  * @param boolean $minified
  * @return string
  * @throws \Exception
  */
 public function render($version = NULL, $loadJQuery = FALSE, $loadEmberData = FALSE, $minified = TRUE)
 {
     $defaults = $this->getConfigurationArray('defaults', $version, $minified);
     $version = $this->findVersionToLoad($version);
     // Make sure the requested version has Ember-data configured
     if ($loadEmberData && $this->settings['versions'][$version]['hasData'] === FALSE) {
         throw new \Exception(sprintf('Version %s has no Ember-data configured', $version));
     }
     // Merge defaults and version configuration (version configuration overrides defaults)
     $configuration = Arrays::arrayMergeRecursiveOverrule($defaults, $this->getConfigurationArray($version, $version, $minified), FALSE, FALSE);
     // Remove jQuery
     if ($loadJQuery === FALSE && isset($configuration['requirements']['jquery'])) {
         unset($configuration['requirements']['jquery']);
     }
     // Build the includes array
     $includes = array();
     foreach ($configuration['requirements'] as $requirement) {
         $includes[] = $requirement['path'];
     }
     $includes[] = $this->getResourcePath($this->settings['paths']['ember'], $version, $minified);
     if ($loadEmberData === TRUE) {
         $includes[] = $this->getResourcePath($this->settings['paths']['ember-data'], $version, $minified);
     }
     // Generate script tags
     $baseUrl = $this->resourcePublisher->getStaticResourcesWebBaseUri();
     $includes = array_map(function ($file) use($baseUrl) {
         return sprintf('<script src="%sPackages/%s"></script>', $baseUrl, $file);
     }, $includes);
     return implode('', $includes);
 }

作者:admayki    项目:TYPO3.CouchD   
/**
  * Construct a couch DB connection from basic connection parameters for one
  * given database.
  *
  * @param string $host
  * @param integer $port
  * @param string $username
  * @param string $password
  * @param array $options
  */
 public function __construct($host, $port = 5984, $username = NULL, $password = NULL, array $options = array())
 {
     $this->options['host'] = (string) $host;
     $this->options['port'] = (int) $port;
     $this->options['username'] = $username;
     $this->options['password'] = $password;
     $this->options = \TYPO3\Flow\Utility\Arrays::arrayMergeRecursiveOverrule($this->options, $options, TRUE);
 }

作者:robertlemk    项目:Flowpack.ElasticSearch.ContentRepositoryAdapto   
/**
  * @param ElasticSearchQueryResult $queryResultObject
  * @param NodeInterface $node
  * @param array|string $path
  * @return array
  */
 public function render(ElasticSearchQueryResult $queryResultObject, NodeInterface $node, $path = NULL)
 {
     $hitArray = $queryResultObject->searchHitForNode($node);
     if (!empty($path)) {
         return \TYPO3\Flow\Utility\Arrays::getValueByPath($hitArray, $path);
     }
     return $hitArray;
 }

作者:radmiraa    项目:neos-development-collectio   
/**
  * Merges the given context properties with sane defaults for the context implementation.
  *
  * @param array $contextProperties
  * @return array
  */
 protected function mergeContextPropertiesWithDefaults(array $contextProperties)
 {
     $contextProperties = $this->removeDeprecatedProperties($contextProperties);
     $defaultContextProperties = array('workspaceName' => 'live', 'currentDateTime' => $this->now, 'dimensions' => array(), 'targetDimensions' => array(), 'invisibleContentShown' => FALSE, 'removedContentShown' => FALSE, 'inaccessibleContentShown' => FALSE, 'currentSite' => NULL, 'currentDomain' => NULL);
     $mergedProperties = Arrays::arrayMergeRecursiveOverrule($defaultContextProperties, $contextProperties, TRUE);
     $this->mergeDimensionValues($contextProperties, $mergedProperties);
     $this->mergeTargetDimensionContextProperties($contextProperties, $mergedProperties, $defaultContextProperties);
     return $mergedProperties;
 }

作者:lightwer    项目:surfcaptai   
/**
  * This method is called when the form of this step has been submitted
  *
  * @param array $formValues
  * @return void
  */
 public function postProcessFormValues(array $formValues)
 {
     if (empty($formValues['defaultDeploymentPath']) === FALSE) {
         $this->distributionSettings = Arrays::setValueByPath($this->distributionSettings, 'Lightwerk.SurfCaptain.frontendSettings.defaultDeploymentPath', $formValues['defaultDeploymentPath']);
     }
     if (empty($formValues['defaultUser']) === FALSE) {
         $this->distributionSettings = Arrays::setValueByPath($this->distributionSettings, 'Lightwerk.SurfCaptain.frontendSettings.defaultUser', $formValues['defaultUser']);
     }
     $this->configurationSource->save(FLOW_PATH_CONFIGURATION . ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, $this->distributionSettings);
 }

作者:sakona99    项目:flow-logi   
/**
  * @param Request $httpRequest
  * @param array $matchResults
  * @return ActionRequest
  */
 protected function createActionRequest(Request $httpRequest, array $matchResults = NULL)
 {
     $actionRequest = new ActionRequest($httpRequest);
     if ($matchResults !== NULL) {
         $requestArguments = $actionRequest->getArguments();
         $mergedArguments = Arrays::arrayMergeRecursiveOverrule($requestArguments, $matchResults);
         $actionRequest->setArguments($mergedArguments);
     }
     return $actionRequest;
 }

作者:nlx-sasch    项目:flow-development-collectio   
/**
  * @test
  */
 public function ignoredClassesCanBeOverwrittenBySettings()
 {
     $object = new ApplicationContext('Development');
     $this->assertEquals('TYPO3\\Flow\\Core\\ApplicationContext prototype object', Debugger::renderDump($object, 10, TRUE));
     Debugger::clearState();
     $currentConfiguration = ObjectAccess::getProperty($this->configurationManager, 'configurations', TRUE);
     $configurationOverwrite['Settings']['TYPO3']['Flow']['error']['debugger']['ignoredClasses']['TYPO3\\\\Flow\\\\Core\\\\.*'] = FALSE;
     $newConfiguration = Arrays::arrayMergeRecursiveOverrule($currentConfiguration, $configurationOverwrite);
     ObjectAccess::setProperty($this->configurationManager, 'configurations', $newConfiguration, TRUE);
     $this->assertContains('rootContextString', Debugger::renderDump($object, 10, TRUE));
 }

作者:sins    项目:TYPO3.Flo   
/**
  * @param string $persistenceIdentifier the persistence identifier for the form.
  * @param string $factoryClass The fully qualified class name of the factory (which has to implement \TYPO3\Form\Factory\FormFactoryInterface)
  * @param string $presetName name of the preset to use
  * @param array $overrideConfiguration factory specific configuration
  * @return string the rendered form
  */
 public function render($persistenceIdentifier = NULL, $factoryClass = 'TYPO3\\Form\\Factory\\ArrayFormFactory', $presetName = 'default', array $overrideConfiguration = array())
 {
     if (isset($persistenceIdentifier)) {
         $overrideConfiguration = Arrays::arrayMergeRecursiveOverrule($this->formPersistenceManager->load($persistenceIdentifier), $overrideConfiguration);
     }
     $factory = $this->objectManager->get($factoryClass);
     $formDefinition = $factory->build($overrideConfiguration, $presetName);
     $response = new Response($this->controllerContext->getResponse());
     $form = $formDefinition->bind($this->controllerContext->getRequest(), $response);
     return $form->render();
 }

作者:kaystrobac    项目:Famelo.Surf.SharedHostin   
/**
  * Executes this task
  *
  * @param \TYPO3\Surf\Domain\Model\Node $node
  * @param \TYPO3\Surf\Domain\Model\Application $application
  * @param \TYPO3\Surf\Domain\Model\Deployment $deployment
  * @param array $options
  * @return void
  * @throws \TYPO3\Surf\Exception\TaskExecutionException
  */
 public function execute(Node $node, Application $application, Deployment $deployment, array $options = array())
 {
     parent::execute($node, $application, $deployment, $options);
     $settingsPatch = \Symfony\Component\Yaml\Yaml::parse(file_get_contents($this->resourcePath . '/Settings.yaml'));
     $settings = (array) \Symfony\Component\Yaml\Yaml::parse(FLOW_PATH_ROOT . '/Configuration/Settings.yaml');
     $settings = \TYPO3\Flow\Utility\Arrays::arrayMergeRecursiveOverrule($settings, $settingsPatch);
     $patchedSettings = $this->temporaryPath . '/Settings.yaml';
     file_put_contents($patchedSettings, \Symfony\Component\Yaml\Yaml::dump($settings, 999));
     $patchedSettingsTargetPath = $deployment->getApplicationReleasePath($application) . '/Configuration/Settings.yaml';
     $this->copy($patchedSettings, $patchedSettingsTargetPath);
 }

作者:hhoecht    项目:neos-development-collectio   
/**
  * Merges the given context properties with sane defaults for the context implementation.
  *
  * @param array $contextProperties
  * @return array
  */
 protected function mergeContextPropertiesWithDefaults(array $contextProperties)
 {
     $contextProperties = $this->removeDeprecatedProperties($contextProperties);
     $defaultContextProperties = array('workspaceName' => 'live', 'currentDateTime' => $this->now, 'dimensions' => array(), 'targetDimensions' => array(), 'invisibleContentShown' => false, 'removedContentShown' => false, 'inaccessibleContentShown' => false, 'currentSite' => null, 'currentDomain' => null);
     if (!isset($contextProperties['currentSite'])) {
         $defaultContextProperties = $this->setDefaultSiteAndDomainFromCurrentRequest($defaultContextProperties);
     }
     $mergedProperties = Arrays::arrayMergeRecursiveOverrule($defaultContextProperties, $contextProperties, true);
     $this->mergeDimensionValues($contextProperties, $mergedProperties);
     $this->mergeTargetDimensionContextProperties($contextProperties, $mergedProperties, $defaultContextProperties);
     return $mergedProperties;
 }

作者:neo    项目:Neos.NeosI   
/**
  * @return void
  */
 protected function initializeView(FluidView $fluidView)
 {
     $user = $this->getUserData($this['username']);
     $excludedProjects = Arrays::trimExplode(',', $this['excludedprojects']);
     $decodedProjects = $this->getProjectsData($user['id']);
     $projects = [];
     foreach ($decodedProjects['objects'] as $project) {
         if (!in_array($project['slug'], $excludedProjects)) {
             $projects[] = $project;
         }
     }
     $fluidView->assign('projects', $projects);
 }

作者:putheakhe    项目:Radmiraal.Emberj   
/**
  * @param string $packageKey
  * @param array $classNames
  * @return void
  */
 public function findModelImplementations($packageKey, array &$classNames)
 {
     // TODO: OPTIMIZE and CLEANUP!
     $this->ignoredProperties = \TYPO3\Flow\Utility\Arrays::getValueByPath($this->settings, 'properties._exclude');
     foreach ($this->getModelNames() as $entityClassName) {
         if (substr($entityClassName, 0, strlen($packageKey)) === str_replace('.', '\\', $packageKey)) {
             if (isset($classNames[$entityClassName])) {
                 continue;
             }
             $classNames[$entityClassName] = $this->findModelProperties($entityClassName);
         }
     }
 }

作者:Weissheite    项目:Weissheiten.OAuth2.ClientInstagra   
/**
  * @param string $grantType One of this' interface GRANT_TYPE_* constants
  * @param array $additionalParameters Additional parameters for the request
  * @return mixed
  * @throws \Flowpack\OAuth2\Client\Exception
  * @see http://tools.ietf.org/html/rfc6749#section-4.1.3
  */
 protected function requestAccessToken($grantType, $additionalParameters = array())
 {
     $parameters = array('grant_type' => $grantType, 'client_id' => $this->clientIdentifier, 'client_secret' => $this->clientSecret);
     $parameters = Arrays::arrayMergeRecursiveOverrule($parameters, $additionalParameters, FALSE, FALSE);
     $request = Request::create(new Uri($this->endpointUri), 'POST', $parameters);
     $request->setHeader('Content-Type', 'application/x-www-form-urlencoded');
     $response = $this->requestEngine->sendRequest($request);
     if ($response->getStatusCode() !== 200) {
         throw new OAuth2Exception(sprintf('The response when requesting the access token was not as expected, code and message was: %d %s', $response->getStatusCode(), $response->getContent()), 1383749757);
     }
     $responseComponents = json_decode($response->getContent(), true);
     return $responseComponents['access_token'];
 }

作者:hlube    项目:neos-development-collectio   
/**
  * Iterate through the segments of the current request path
  * find the corresponding module configuration and set controller & action
  * accordingly
  *
  * @param string $value
  * @return boolean|integer
  */
 protected function matchValue($value)
 {
     $format = pathinfo($value, PATHINFO_EXTENSION);
     if ($format !== '') {
         $value = substr($value, 0, strlen($value) - strlen($format) - 1);
     }
     $segments = Arrays::trimExplode('/', $value);
     $currentModuleBase = $this->settings['modules'];
     if ($segments === array() || !isset($currentModuleBase[$segments[0]])) {
         return self::MATCHRESULT_NOSUCHMODULE;
     }
     $modulePath = array();
     $level = 0;
     $moduleConfiguration = null;
     $moduleController = null;
     $moduleAction = 'index';
     foreach ($segments as $segment) {
         if (isset($currentModuleBase[$segment])) {
             $modulePath[] = $segment;
             $moduleConfiguration = $currentModuleBase[$segment];
             if (isset($moduleConfiguration['controller'])) {
                 $moduleController = $moduleConfiguration['controller'];
             } else {
                 $moduleController = null;
             }
             if (isset($moduleConfiguration['submodules'])) {
                 $currentModuleBase = $moduleConfiguration['submodules'];
             } else {
                 $currentModuleBase = array();
             }
         } else {
             if ($level === count($segments) - 1) {
                 $moduleMethods = array_change_key_case(array_flip(get_class_methods($moduleController)), CASE_LOWER);
                 if (array_key_exists($segment . 'action', $moduleMethods)) {
                     $moduleAction = $segment;
                     break;
                 }
             }
             return self::MATCHRESULT_NOSUCHMODULE;
         }
         $level++;
     }
     if ($moduleController === null) {
         return self::MATCHRESULT_NOCONTROLLER;
     }
     $this->value = array('module' => implode('/', $modulePath), 'controller' => $moduleController, 'action' => $moduleAction);
     if ($format !== '') {
         $this->value['format'] = $format;
     }
     return self::MATCHRESULT_FOUND;
 }

作者:anih    项目:Flowpack.SingleSignOn.Clien   
/**
  * Notify SSO servers about the logged out client
  *
  * All active authentication tokens of type SingleSignOnToken will be
  * used to get the registered global session id and send a request
  * to the session service on the SSO server.
  *
  * @return void
  */
 public function logout()
 {
     $allConfiguration = $this->configurationManager->getConfiguration(\TYPO3\Flow\Configuration\ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, 'TYPO3.Flow');
     $tokens = $this->securityContext->getAuthenticationTokensOfType('Flowpack\\SingleSignOn\\Client\\Security\\SingleSignOnToken');
     foreach ($tokens as $token) {
         $providerName = $token->getAuthenticationProviderName();
         $serverIdentifier = \TYPO3\Flow\Utility\Arrays::getValueByPath($allConfiguration, 'security.authentication.providers.' . $providerName . '.providerOptions.server');
         if ($serverIdentifier !== NULL) {
             $ssoClient = $this->ssoClientFactory->create();
             $ssoServer = $this->ssoServerFactory->create($serverIdentifier);
             $ssoServer->destroySession($ssoClient, $token->getGlobalSessionId());
         }
     }
 }

作者:mgoldbec    项目:neos-development-collectio   
/**
  * @return void
  */
 protected function initializeAction()
 {
     $this->parentNode = $this->widgetConfiguration['parentNode'];
     $this->nodes = $this->widgetConfiguration['nodes'];
     $this->nodeTypeFilter = $this->widgetConfiguration['nodeTypeFilter'] ?: null;
     $this->configuration = Arrays::arrayMergeRecursiveOverrule($this->configuration, $this->widgetConfiguration['configuration'], true);
     $this->maximumNumberOfNodes = $this->configuration['maximumNumberOfNodes'];
     $numberOfNodes = $this->parentNode === null ? count($this->nodes) : $this->parentNode->getNumberOfChildNodes($this->nodeTypeFilter);
     if ($this->maximumNumberOfNodes > 0 && $numberOfNodes > $this->maximumNumberOfNodes) {
         $numberOfNodes = $this->maximumNumberOfNodes;
     }
     $this->numberOfPages = ceil($numberOfNodes / (int) $this->configuration['itemsPerPage']);
     $this->maximumNumberOfLinks = (int) $this->configuration['maximumNumberOfLinks'];
 }


问题


面经


文章

微信
公众号

扫码关注公众号