Get the reason why an operation can't be performed.

@param string $operation The value of one of the OPERATION_... constants.

@return string empty string if the operation CAN be performed
198629
public function whyCantDo($operation)
    {
        if (!is_string($operation)) {
            return 'Invalid $operation';
        }
        if (!isset($this->operationErrors[$operation])) {
            switch ($operation) {
                case static::OPERATION_MOVE:
                    $error = $this->whyCantMove();
                    break;
                case static::OPERATION_ALIAS:
                    $error = $this->whyCantAlias();
                    break;
                case static::OPERATION_COPY:
                    $error = $this->whyCantCopy();
                    break;
                case static::OPERATION_COPYALL:
                    $error = $this->whyCantDo(static::OPERATION_COPY);
                    if ($error === '') {
                        $error = $this->whyCantCopyAll();
                    }
                    break;
                case static::OPERATION_COPYVERSION:
                    $error = $this->whyCantCopyVersion();
                    break;
                default:
                    return 'Invalid $operation';
            }
            $this->operationErrors[$operation] = $error;
        }

        return $this->operationErrors[$operation];
    }
700719
protected function _operator($operator, $conditions, &$states)
    {
        if (isset($this->_operators[$operator])) {
            $config = $this->_operators[$operator];
        } elseif (substr($operator, -2) === '()') {
            $op = substr($operator, 0, -2);
            if (isset($this->_operators[$op])) {
                return '(' . $this->_operator($op, $conditions, $states) . ')';
            }
            $config = ['builder' => 'function'];
        } else {
            throw new SqlException("Unexisting operator `'{$operator}'`.");
        }
        $parts = $this->_conditions($conditions, $states);

        $operator = (is_array($parts) && next($parts) === 'NULL' && isset($config['null'])) ? $config['null'] : $operator;
        $operator = $operator[0] === ':' ? strtoupper(substr($operator, 1)) : $operator;

        if (isset($config['builder'])) {
            $builder = $this->_builders[$config['builder']];
            return $builder($operator, $parts);
        }
        if (isset($config['format'])) {
            return sprintf($config['format'], join(", ", $parts));
        }
        return join(" {$operator} ", $parts);
    }
484963
public function isOperationValid(OperationInterface $operation)
    {
        if ($this->operationManager->findByMiraklIdAndPaymentVoucherNumber(
            $operation->getMiraklId(),
            $operation->getPaymentVoucher()
        )
        ) {
            throw new AlreadyCreatedOperationException($operation);
        }

        if (!$this->operationManager->isValid($operation)) {
            throw new InvalidOperationException($operation);
        }

        ModelValidator::validate($operation);

        return true;
    }
211269
private static function getOperation(string $sql): string
    {
        // remove annotion and blank
        $sql = preg_replace('/\/\*[^\/]+\*\//', '', $sql);
        $sql = trim($sql);
        $sql = strtoupper($sql);

        if (strpos($sql, 'INSERT') === 0) {
            return self::RETURN_INSERTID;
        }

        if (strpos($sql, 'UPDATE') === 0 || strpos($sql, 'DELETE') === 0 || strpos($sql, 'REPLACE') === 0) {
            return self::RETURN_ROWS;
        }

        return self::RETURN_FETCH;
    }
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;
    }
1349048
final protected static function isOperatorValid (string $operator) : bool
	{
		// Arithmetic Operators
		$operators1 = ['+', '-', '*', '/', '%'];
		// Bitwise Operators
		$operators2 = ['&', '|', '^'];
		// Comparison Operators
		$operators3 = ['=', '<', '>', '>=', '<=', '<>'];
		// Compound Operators
		$operators4 = ['+=', '-=', '*=', '/=', '%=', '&=', '^-=', '|*='];
		// Logical Operators
		$operators5 = ['ALL', 'AND', 'ANY', 'BETWEEN', 'EXISTS', 'IN', 'LIKE', 'NOT', 'OR', 'SOME'];
		$operators 	= array_merge($operators1, $operators2, $operators3, $operators4, $operators5);
		return in_array(strtoupper($operator), $operators);
	}
406412
public java.lang.String getOperation() {
    java.lang.Object ref = operation_;
    if (ref instanceof java.lang.String) {
      return (java.lang.String) ref;
    } else {
      com.google.protobuf.ByteString bs = 
          (com.google.protobuf.ByteString) ref;
      java.lang.String s = bs.toStringUtf8();
      operation_ = s;
      return s;
    }
  }
1107061
static public function getLabel($operator)
    {
        static::isValid($operator, true);

        // TODO translations
        switch (intval($operator)) {
            case static::NOT_EQUAL:
                return 'est différent de';
            case static::LOWER_THAN:
                return 'est inférieur à';
            case static::LOWER_THAN_OR_EQUAL:
                return 'est inférieur ou égal à';
            case static::GREATER_THAN:
                return 'est supérieur à';
            case static::GREATER_THAN_OR_EQUAL:
                return 'est supérieur ou égal à';
            case static::IN:
            case static::MEMBER:
                return 'est parmi';
            case static::NOT_IN:
            case static::NOT_MEMBER:
                return 'n\'est pas parmi';
            case static::LIKE:
                return 'contient';
            case static::NOT_LIKE:
                return 'ne contient pas';
            case static::START_WITH:
                return 'commence par';
            case static::NOT_START_WITH:
                return 'ne commence pas par';
            case static::END_WITH:
                return 'se termine par';
            case static::NOT_END_WITH:
                return 'ne se termine pas par';
            default:
                return 'est égal à';
        }
    }
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);
    }
408529
public static function compare($a, $b, string $operator): bool
    {
        switch ($operator) {
            case '>':
                return $a > $b;
            case '>=':
                return $a >= $b;
            case '=':
            case '==':
                return $a == $b;
            case '===':
                return $a === $b;
            case '<=':
                return $a <= $b;
            case '<':
                return $a < $b;
            case '!=':
            case '<>':
                return $a != $b;
            case '!==':
                return $a !== $b;
            default:
                throw new InvalidArgumentException(sprintf('Invalid operator "%s" provided', $operator));
        }
    }
1050234
public function getOperation($operation)
    {
        $operationId = Utilities::getEntityId(
            $operation,
            'WindowsAzure\MediaServices\Models\Operation'
        );

        return Operation::createFromOptions($this->_getEntity("Operations('{$operationId}')"));
    }
10110
protected function buildOperation($operation)
    {
        $body      = $this->document->getElementsByTagNameNS(self::SOAP_ENVELOPE, 'Body')->item(0);
        $operation = $this->document->createElementNS(self::ETP_NAME_SPACE, 'etp:' . $operation);

        return $body->appendChild($operation);
    }
1341035
public static function getComparator($operator)
    {
        if (!isset(self::$operators[$operator])) {
            if (count(self::$operatorsMap)) {
                self::initMap();
            }

            if (!isset(self::$operators[$operator])) {
                throw new \Exception(sprintf('"%s" operator not found', $operator));
            }
        }

        return self::$operators[$operator];
    }
706430
function getOperationData($operation, $bindingType = 'soap')
    {
        if ($bindingType == 'soap') {
            $bindingType = 'http://schemas.xmlsoap.org/wsdl/soap/';
        } elseif ($bindingType == 'soap12') {
            $bindingType = 'http://schemas.xmlsoap.org/wsdl/soap12/';
        }
        // loop thru ports
        foreach ($this->ports as $port => $portData) {
            // binding type of port matches parameter
            if ($portData['bindingType'] == $bindingType) {
                // get binding
                //foreach($this->bindings[ $portData['binding'] ]['operations'] as $bOperation => $opData) {
                foreach (array_keys($this->bindings[$portData['binding']]['operations']) as $bOperation) {
                    // note that we could/should also check the namespace here
                    if ($operation == $bOperation) {
                        $opData = $this->bindings[$portData['binding']]['operations'][$operation];

                        return $opData;
                    }
                }
            }
        }
    }
1176490
protected function getOperator(string $operator): callable
    {
        if (!$this->hasOperator($operator)) {
            throw new OperatorNotFoundException($operator, sprintf('Operator "%s" does not exist.', $operator));
        }

        return $this->operators[$operator];
    }
1084132
public function find(string $operation, string $locale)
    {
        $model = $this->notifications->first(function ($value) use($operation, $locale) {
            return $value->code === $locale && ($value->title === $operation || $value->name === $operation);
        });

        return $model ? $model->content : false;
    }
1174611
public static function validate(string $operator)
    {
        if (!isset(self::$operators[$operator])) {
            throw InvalidArgumentException::format(
                'Invalid condition operator: expecting one of (%s), \'%s\' given',
                Debug::formatValues(array_keys(self::$operators)), $operator
            );
        }
    }