Get a xpath expression builder to convert css selectors to xpath

@param string $errorMessage
@return \FluentDOM\Xpath\Transformer
@throws \LogicException
189930
public static function getXPathTransformer(
    string $errorMessage = 'No CSS selector support installed'
  ): \FluentDOM\Xpath\Transformer {
    foreach (self::$_xpathTransformers as $index => $transformer) {
      if (is_string($transformer) && class_exists($transformer)) {
        self::$_xpathTransformers[$index] = new $transformer();
      } elseif (is_callable($transformer)) {
        self::$_xpathTransformers[$index] = $transformer();
      }
      if (self::$_xpathTransformers[$index] instanceof \FluentDOM\Xpath\Transformer) {
        return self::$_xpathTransformers[$index];
      }
      unset(self::$_xpathTransformers[$index]);
    }
    throw new \LogicException($errorMessage);
  }
258060
public static function create($errorCode, $customErrorMessage = '')
    {
        $customErrorMessage = (string) $customErrorMessage;
        if ($customErrorMessage !== null) {
            return new static($customErrorMessage, $errorCode);
        }
        switch ($errorCode) {
            case static::ERROR_FAILED_TO_READ_FILE:
                return new static(t('Failed to read the SVG file.'), $errorCode);
            case static::ERROR_FAILED_TO_WRITE_FILE:
                return new static(t('Failed to write the SVG file.'), $errorCode);
            case static::ERROR_FAILED_TO_PARSE_XML:
                return new static(t('Failed to parse the SVG file.'), $errorCode);
            case static::ERROR_FAILED_TO_GENERATE_XML:
                return new static(t('Failed to generate the XML of the SVG file.'), $errorCode);
        }
    }
696188
public function setMaxLength(string $elementName, int $maxLength, string $errorMessage = null): \IvoPetkov\BearFrameworkAddons\Form\Constraints
    {
        if ($errorMessage === null) {
            $errorMessage = sprintf(__('ivopetkov.form.The length of this field must be atmost %s characters.'), $maxLength);
        }
        $this->data[] = ['maxLength', $errorMessage, $elementName, $maxLength];
        return $this;
    }
296605
protected function translateErrorMessage($errorCode)
    {
        $message = self::UNKNOWN_ERROR_MESSAGE;

        if (isset(self::$errorMessages[$errorCode])) {
            $message = self::$errorMessages[$errorCode];
        }

        return $message;
    }
1168555
public function publishSystemTemplate($templateMessage) {
    	try{
			if (empty($templateMessage))
				throw new Exception('Paramer "templateMessage" is required');


    		$params = json_decode($templateMessage,TRUE);

    		$ret = $this->SendRequest->curl('/message/system/publish_template.json',$params,'json','im','POST');
    		if(empty($ret))
    			throw new Exception('bad request');
    		return $ret;

    	}catch (Exception $e) {
    		print_r($e->getMessage());
    	}
   }
984152
public function toXmlString(WxSendMsg $msg)
    {
        if ($msg instanceof WxSendTextMsg) {
            return $this->sendTextMsgToXmlString($msg);
        } elseif ($msg instanceof WxSendImageMsg) {
            return $this->sendImageMsgToXmlString($msg);
        } elseif ($msg instanceof WxSendVoiceMsg) {
            return $this->sendVoiceMsgToXmlString($msg);
        } elseif ($msg instanceof WxSendVideoMsg) {
            return $this->sendVideoMsgToXmlString($msg);
        } elseif ($msg instanceof WxSendMusicMsg) {
            return $this->sendMusicMsgToXmlString($msg);
        } elseif ($msg instanceof WxSendNewsMsg) {
            return $this->sendNewsMsgToXmlString($msg);
        }

        throw new \InvalidArgumentException("unknown wx send msg");
    }
175745
public function getValidationMessageFor($element)
    {
        $errorLabel = $this->getElement($element)->getParent()->find('css', '.sylius-validation-error');

        if (null === $errorLabel) {
            throw new ElementNotFoundException(
                $this->getSession(),
                'Validation message', 'css', '.sylius-validation-error')
            ;
        }

        return $errorLabel->getText();
    }
928553
public function setErrorMessage($errorMessage)
    {
        $this->errorMessage = $errorMessage;
        $this->setValidator($this->getDefaultValidator());

        return $this;
    }
139751
public TextInputDialogBuilder setValidationPattern(final Pattern pattern, final String errorMessage) {
        return setValidator(new TextInputDialogResultValidator() {
            @Override
            public String validate(String content) {
                Matcher matcher = pattern.matcher(content);
                if(!matcher.matches()) {
                    if(errorMessage == null) {
                        return "Invalid input";
                    }
                    return errorMessage;
                }
                return null;
            }
        });
    }
438434
public function getHTMLFormatted($config, $errors = null) {
        $ret = array();

        $this->generator = new HTMLPurifier_Generator($config, $this->context);
        if ($errors === null) $errors = $this->errors;

        // 'At line' message needs to be removed

        // generation code for new structure goes here. It needs to be recursive.
        foreach ($this->lines as $line => $col_array) {
            if ($line == -1) continue;
            foreach ($col_array as $col => $struct) {
                $this->_renderStruct($ret, $struct, $line, $col);
            }
        }
        if (isset($this->lines[-1])) {
            $this->_renderStruct($ret, $this->lines[-1]);
        }

        if (empty($errors)) {
            return '<p>' . $this->locale->getMessage('ErrorCollector: No errors') . '</p>';
        } else {
            return '<ul><li>' . implode('</li><li>', $ret) . '</li></ul>';
        }

    }
419657
public static function getCodeByMessage(string $errorMessage): int
    {
        $code = array_search($errorMessage, self::MESSAGES);
        if ($code === false) {
            $code = self::UNKNOWN_ERROR;
        }
        return (int)$code;
    }
462789
private function obtainDecoder(string $decoderId): MessageDecoder
    {
        if (true === $this->decodersLocator->has($decoderId))
        {
            /** @var MessageDecoder $decoder */
            $decoder = $this->decodersLocator->get($decoderId);

            return $decoder;
        }

        throw new \LogicException(
            \sprintf('Could not find decoder "%s" in the service container', $decoderId)
        );
    }
360642
public function get_message($rule)
	{
		if ( ! array_key_exists($rule, $this->error_messages))
		{
			return false;
		}

		return $this->error_messages[$rule];
	}
1346733
protected function getErrorMessage($errorCode)
    {
        if (!isset($this->errorMessageMatrix[$errorCode])) {
            $this->errorMessageMatrix[$errorCode] = 'ERROR_MSG_UNKNOWN';
        }

        // if additional information exist -> add it here
        if ($this->info) {
            if (is_string($this->info)) {
                $this->errorMessageMatrix[$errorCode] .= ' '.$this->info;
            } elseif (count($this->info) != 1 || $this->info[0] != null) {
                foreach ($this->info as $info) {
                    $info = serialize($info);
                    $this->errorMessageMatrix[$errorCode] .= ' '.$info;
                }
            }
        }

        // Return constructed error message
        return $this->errorMessageMatrix[$errorCode];
    }
148320
protected static function fail(
        int $errorCode = ErrorCodes::INVALID_VALUE,
        string $messageTemplate = Messages::INVALID_VALUE,
        array $messageParams = []
    ): RuleInterface {
        return new Fail($errorCode, $messageTemplate, $messageParams);
    }
76362
public static function invalidFunctionMessage($messageFormat, \ReflectionFunctionAbstract $reflection)
    {
        return self::construct(
                array_merge(
                        [
                                'Invalid function %s defined in %s lines %d-%d: ' . $messageFormat,
                                $reflection->getName(),
                                $reflection->getFileName(),
                                $reflection->getStartLine(),
                                $reflection->getEndLine()
                        ],
                        array_slice(func_get_args(), 2)
                )
        );
    }
839533
protected function handleError($customMessage = null)
    {
        $message = new stdClass();
        $message->is_error = true;
        if (null !== $customMessage) {
            $message->message = $customMessage;
        }

        return $message;
    }