@param FetcherOperation $operation

@return array
@throws \InvalidArgumentException
192691
protected function getOperationAsArray(FetcherOperation $operation)
    {
        $filters = array();

        if ($operation instanceof SimpleOperation) {
            $filters = $this->addSimpleOperation($operation);
        } else if ($operation instanceof ListOperation) {
            $operations = $operation->getOperations();

            if ($operation->getOperator() === Fetcher::OPERATOR_OR) {
                $filters['$or'] = array_map(
                    function (FetcherOperation $operation) {
                        return $this->getOperationAsArray($operation);
                    },
                    $operations
                );
            } else {
                foreach ($operations as $currentOperation) {
                    $currentFilters = $this->getOperationAsArray($currentOperation);
                    $filters = array_merge_recursive($filters, $currentFilters);
                }
            }
        } else {
            throw new \InvalidArgumentException('Given operation is not supported');
        }

        return $filters;
    }
155389
private function mapOperator($operator)
    {
        if (array_key_exists($operator, $this->shortOperators)) {
            $operator = $this->shortOperators[$operator];
        }

        if (!in_array($operator, $this->allowedOperators)) {
            throw new InvalidArgumentException(sprintf(
                'Invalid operator `%s` given. Valid operators are %s.',
                $operator,
                implode(', ', $this->allowedOperators)
            ));
        }

        return $operator;
    }
1115635
private function getHydraOperations(string $resourceClass, ResourceMetadata $resourceMetadata, string $prefixedShortName, bool $collection): array
    {
        if (null === $operations = $collection ? $resourceMetadata->getCollectionOperations() : $resourceMetadata->getItemOperations()) {
            return [];
        }

        $hydraOperations = [];
        foreach ($operations as $operationName => $operation) {
            $hydraOperations[] = $this->getHydraOperation($resourceClass, $resourceMetadata, $operationName, $operation, $prefixedShortName, $collection ? OperationType::COLLECTION : OperationType::ITEM);
        }

        if (null !== $this->subresourceOperationFactory) {
            foreach ($this->subresourceOperationFactory->create($resourceClass) as $operationId => $operation) {
                $subresourceMetadata = $this->resourceMetadataFactory->create($operation['resource_class']);
                $propertyMetadata = $this->propertyMetadataFactory->create(end($operation['identifiers'])[1], $operation['property']);
                $hydraOperations[] = $this->getHydraOperation($resourceClass, $subresourceMetadata, $operation['route_name'], $operation, "#{$subresourceMetadata->getShortName()}", OperationType::SUBRESOURCE, $propertyMetadata->getSubresource());
            }
        }

        return $hydraOperations;
    }
18425
private function getOperator($operator)
    {
        $operators = $this->getOperators();

        $key = array_search(strtolower($operator), $operators);

        if ($key !== false && array_key_exists($key, $operators)) {
            return $operators[$key];
        }

        $operators = implode(', ', $operators);

        $message = "Operator: $operator cannot be used in an LDAP query. Available operators are $operators";

        throw new InvalidQueryOperator($message);
    }
55609
public function serializeOperations()
    {
        $datas = array();

        foreach ($this->operations as $operation) {
            $method = $operation[0];
            $args = $operation[1];

            foreach ($args as &$arg) {
                if ($arg instanceof self) {
                    $arg = $arg->getHash();
                }
            }

            $datas[] = array($method, $args);
        }

        return serialize($datas);
    }
560886
public function execute(RiakOperation $operation)
    {
        if (empty($this->nodes)) {
            throw new RiakException('There are no nodes in the cluster.');
        }

        $size  = count($this->nodes);
        $index = mt_rand(0, $size - 1);
        $node  = $this->nodes[$index];

        return $node->execute($operation);
    }
1189323
protected function evaluateOperations()
    {
        while ($op = array_shift($this->operations)) {
            $operation = $this->operationResolver->resolveOperation($op['name'], $this->context);
            $lastOperationResult = $operation->evaluate($this, $op['arguments']);
        }
        return $lastOperationResult;
    }
497160
protected function doCall($operation)
    {
        $this->client->send($operation);
        $result = $this->client->recv();
        if(false === $result)
        {
            return false;
        }
        if(null === $result->throwable)
        {
            return $result->result;
        }
        else
        {
            throw $result->throwable;
        }
    }
628139
private function operationFtpConfig($operation)
    {
        $config         = [];
        $config['host'] = isset($operation->host) ? trim($operation->host) : null;
        if (!$config['host']) {
            $this->setLogs('Host is required.', 'error');

            return false;
        } else {
            // Remove schema/port/etc from the host.
            $host = parse_url($config['host'], PHP_URL_HOST);
            if ($host) {
                $config['host'] = $host;
            }
            $this->setLogs($config['host'], 'host');
        }
        $config['username'] = isset($operation->user) ? trim($operation->user) : null;
        if (!$config['username']) {
            $this->setLogs('User is required.', 'error');

            return false;
        } else {
            $this->setLogs($config['username'], 'user');
        }
        $config['password'] = isset($operation->pass) ? trim($operation->pass) : null;
        if (!$config['password']) {
            unset($config['password']);
            $this->setLogs('Password is blank. Assuming anonymous access.', 'warning');
        } else {
            $this->setLogs(str_repeat('*', strlen($config['password'])), 'password');
        }

        $config['privateKey'] = isset($operation->privateKey) ? trim($operation->privateKey) : null;
        if (!$config['privateKey']) {
            unset($config['privateKey']);
        } else {
            $this->setLogs(true, 'privateKey');
        }

        $config['port'] = isset($operation->port) ? (int) $operation->port : null;
        if (!$config['port']) {
            unset($config['port']);
        } else {
            $this->setLogs($config['port'], 'port');
        }

        if ($this->test && isset($operation->rootTest)) {
            $config['root'] = isset($operation->rootTest) ? trim($operation->rootTest) : null;
        }
        if (empty($config['root'])) {
            $config['root'] = isset($operation->root) ? trim($operation->root) : null;
        }
        if (!$config['root']) {
            unset($config['root']);
        } else {
            $this->setLogs($config['root'], 'root');
        }

        $config['passive'] = isset($operation->passive) ? (bool) $operation->passive : true;
        $this->setLogs($config['passive'], 'passive');

        $config['timeout'] = isset($operation->timeout) ? (int) $operation->timeout : 90;
        $this->setLogs($config['timeout'], 'timeout');

        $config['ssl'] = isset($operation->ssl) ? (bool) $operation->ssl : false;
        $this->setLogs($config['ssl'], 'ssl');

        return $config;
    }
98694
private function operationUpdatesContact($operation)
    {
        if (isset($operation->response)) {
            foreach (['headers', 'body'] as $fieldType) {
                if (is_array($operation->response->{$fieldType})) {
                    foreach ($operation->response->{$fieldType} as $field) {
                        if (
                            isset($field->destination)
                            && '' !== $field->destination
                        ) {
                            return true;
                        }
                    }
                }
            }
        }

        return false;
    }
1348641
public function processTransaction(array $transactionData, string $operation): ProcessInterface
    {
        // When hitting the process endpoint, we only need the transactionId and operation key/value pairs, and
        // optionally the transactionAmount if we are capturing a portion of the total amount.
        $transactionData = array_filter($transactionData + ['operation' => $operation], function ($k) {
            return in_array($k, ['transactionId', 'operation', 'transactionAmount']);
        }, ARRAY_FILTER_USE_KEY);

        $uri = $this->getUri('process', $this->getParameters($transactionData));
        /** @var ProcessInterface $response */
        $response = $this->performRequest((string) $uri);

        Assert::isInstanceOf($response, ProcessInterface::class, 'Invalid response');

        return $response;
    }
80157
public function ignorePersistHooksFor(callable $operation, array $persistHooks)
    {
        InvalidArgumentException::verifyAllInstanceOf(__METHOD__, 'persistHooks', $persistHooks, IPersistHook::class);
        $this->ignorePersistHookStack[] = $persistHooks;
        $result                         = $operation();
        array_pop($this->ignorePersistHookStack);

        return $result;
    }
432377
public function getOperationDocs($operation)
    {
        return isset($this->docs['operations'][$operation])
            ? $this->docs['operations'][$operation]
            : null;
    }
1217097
public static function optimize($operations)
    {
        $newOperations = [];
        /** @var $outOperation Operation */
        foreach ($operations as $outIndex => $outOperation) {
            $inOperations = array_slice($operations, $outIndex + 1);

            if ($inOperations) {
                foreach ($inOperations as $inIndex => $inOperation) {
                    // get how many items to fetch
                    $length = $inIndex;

                    $inBetween = array_slice($operations, $outIndex + 1, $length);

                    $result = $outOperation->reduce($inOperation, $inBetween);

                    if ($result) {
                        // add the result of the two merging
                        $newOperations = array_merge($newOperations, $result);
                        // add points that fell in between those that merged
                        $newOperations = array_merge($newOperations, $inBetween);
                        // add points that come after
                        $newOperations = array_merge(
                            $newOperations,
                            array_slice($operations, $outIndex + $inIndex + 2)
                        );

                        return $newOperations;
                    }
                }
                $newOperations[] = $outOperation;
            } else {
                $newOperations[] = $outOperation;
            }
        }

        return $newOperations;
    }
1207303
private function resolveRequirements(Operation $operation): array
    {
        $requirements = [];

        foreach ($operation->getParameters() as $parameter) {
            if ($parameter->getIn() === Parameter::IN_PATH
                && ($schema = $parameter->getSchema()) instanceof ScalarSchema
            ) {
                $requirements[$parameter->getName()] = $this->typePatternResolver->resolve($schema);
            }
        }

        return $requirements;
    }
951452
protected function fetchOperation()
	{
        $operation = $this->getRouteParam('operation');
        
        if ($operation !== null) {
            $operation = $this->parseCanonicalName($operation);
            
            if (preg_match($this->operationPattern, $operation)) {
                return $operation;
            } else {
                return false;
            }
        } else {
            $operation = $this->getRequest()->getHeader(self::HEADER_OPERATION);
            
            if (!$operation) {
                $operation = 'http-'.$this->getRequest()->getMethod();
            } else {
                $operation = $operation->getFieldValue();
            }
            
            return $this->parseCanonicalName($operation);
        }
	}
217079
protected function buildOperationQuery(
            Queries\IScope $scope,
            Queries\IOperation $operation
    ) {
        return new Queries\OperationQuery($scope, $operation);
    }