/** * buildOperations * * @param BasicOperationCollection $operationCollection * @param array $operationServiceNames * @param Options $operationOptions * @param Options $operationPriorities * * @return void */ protected function buildOperations(BasicOperationCollection $operationCollection, array $operationServiceNames, Options $operationOptions, Options $operationPriorities) { $queue = new \SplPriorityQueue(); $defaultPriority = count($operationServiceNames); foreach ($operationServiceNames as $name => $middlewareService) { // Allows over-riding with nulls if (empty($middlewareService)) { continue; } $priority = $operationPriorities->get($name); if (empty($priority)) { $priority = $defaultPriority; $defaultPriority--; } $queue->insert($name, $priority); } foreach ($queue as $name) { $operationCollection->addOperation($this->buildOperation($name, $this->serviceManager->get($operationServiceNames[$name]), $operationOptions->getOptions($name), $operationPriorities->get($name, 0))); } }
/** * buildPropertyListOption * * @param Request $request * @param Options $options * * @return void */ public function buildPropertyListOption(Request $request, Options $options) { $filterPropertyList = $this->getFilterPropertyList($request, null); $propertyListMerged = $options->get('propertyListMerged', false); // Nothing to be done if ($filterPropertyList === null && $propertyListMerged) { return; } $defaultPropertyList = $options->get('propertyList', []); if (empty($defaultPropertyList)) { $options->set('propertyList', $filterPropertyList); return; } $list = $this->buildPropertyList($defaultPropertyList, $filterPropertyList); $options->set('propertyList', $list); $options->set('propertyListMerged', true); }
/** * getPropertyDepthLimit * * @param Options $options * @param int $default * * @return int */ public function getPropertyDepthLimit(Options $options, $default = 1) { return (int) $options->get('propertyDepthLimit', $default); }