find messages based on error type.
2. use message for a method/parameter set.
3. use message for a specific method.
4. use message for a type.
5. use general error message.

@param $type
@param $method
@param $parameter
@return string
433511
public function find($type, $method, $parameter)
    {
        if (strpos($method, '::filter_') !== false) {
            $method = substr($method, strpos($method, '::filter_') + 9);
        }
        if ($message = $this->findForMethod($method, $parameter)) {
            return $message;
        }
        // 4. use message for a specific type. 
        if (isset($this->messages['_type_'][$type])) {
            return $this->messages['_type_'][$type];
        }

        // 5. use general error message.
        return (string) Helper::arrGet($this->messages, '0', '');
    }
728057
private function type($message, $type)
    {
        $this->type = $type;

        $this->message = $message;

        return $this;
    }
490720
public function getMessage($type, $id = null)
    {
        $result = null;
        if (null === $id) {
            if (array_key_exists($type, $this->messages)) {
                $result = $this->messages[$type];

                if (!$this->persistMessages) {
                    unset($this->messages[$type]);
                }
            }
        }

        if (null !== $id) {
            if (array_key_exists($type, $this->messages)) {
                if (array_key_exists($id, $this->messages[$type])) {
                    $result = $this->messages[$type][$id];
                    if (!$this->persistMessages) {
                        unset($this->messages[$type][$id]);
                    }
                }
            }
        }

        return $result;
    }
883535
public function errorHandler(int $type, string $message, string $file, int $line) :void
    {
        $this->whichError($message, $type, $file, $line);
    }
127052
public function decodeParameter($type, $param)
    {
        if (!is_string($type)) {
            throw new InvalidArgumentException('The type to decodeParameter must be string.');
        }
        return $this->decodeParameters([$type], $param)[0];
    }
190449
public function hasRequiredParameter($parameter, $type = NULL) {
    return $this->hasParameter($parameter, $type) && $this->getParameterByName($parameter)->isRequired();
  }
1150850
public function log($message, $type = null)
	{
		$this->log[] = array('message' => $message, 'type' => $type);

		if (!$this->ignoreCallbacks && isset($this->callbacks['message']) && is_callable($this->callbacks['message']))
		{
			$this->callbacks['message']($message, $type);
		}
	}
789298
public function setMessage($message, $type = 'info', $parameters = [])
    {
        $this->getSession()->getFlashBag()->add($type, $this->translate($message, $parameters));
    }
562704
private function formatType(
        \ReflectionType $type,
        \ReflectionMethod $method,
        \ReflectionParameter $parameter = null
    ) {
        $name      = (string) $type;
        $nameLower = strtolower($name);

        if ('self' === $nameLower) {
            $name = $method->getDeclaringClass()->getName();
        }

        if ('parent' === $nameLower) {
            $name = $method->getDeclaringClass()->getParentClass()->getName();
        }

        if ( ! $type->isBuiltin() && ! class_exists($name) && ! interface_exists($name)) {
            if (null !== $parameter) {
                throw UnexpectedValueException::invalidParameterTypeHint(
                    $method->getDeclaringClass()->getName(),
                    $method->getName(),
                    $parameter->getName()
                );
            }

            throw UnexpectedValueException::invalidReturnTypeHint(
                $method->getDeclaringClass()->getName(),
                $method->getName()
            );
        }

        if ( ! $type->isBuiltin()) {
            $name = '\\' . $name;
        }

        if ($type->allowsNull()
            && (null === $parameter || ! $parameter->isDefaultValueAvailable() || null !== $parameter->getDefaultValue())
        ) {
            $name = '?' . $name;
        }

        return $name;
    }
43810
public function parameterize($method)
    {
        $parameterArray = array();
        switch ($method) {
            case 'create':
            case 'update':
                $parameterArray['email'] = $this->getEmail();
                $parameterArray['description'] = $this->getDescription();
                break;
            case 'getOne':
                $parameterArray['count'] = 1;
                $parameterArray['offset'] = 0;
                break;
            case 'getAll':
                $parameterArray = $this->getFilter();
                break;
            case 'delete':
                break;
        }

        return $parameterArray;
    }
129191
function param($param, $type = null) {
		if ($param instanceof ExpressibleInterface) {
			$param = $param->get();
		}
		if ($param instanceof Expr) {
			return (string) $param;
		}
		
		$this->params[] = $param;
		$this->types[]  = $type;
		
		return "\$".count($this->params);
	}
450496
private function doCallbackMethod($type = null)
    {
        $callback = $type;
        if (is_null($callback)) {
            $callback = $this->messageTypes[$_POST['lti_message_type']];
        }
        if (isset($this->callbackHandler[$callback])) {
            $result = call_user_func($this->callbackHandler[$callback], $this);

            // Callback function may return HTML or a redirect URL
            if (is_string($result)) {
                if ((substr($result, 0, 7) == 'http://') || (substr($result, 0, 8) == 'https://')) {
                    $this->redirectUrl = $result;
                } else {
                    if (is_null($this->output)) {
                        $this->output = '';
                    }
                    $this->output .= $result;
                }
            }
        } else if (is_null($type)) {
            throw new Exception('Message type not supported');
        }
    }
247938
public function getMessageCount($type)
	{
		switch ($type)
		{
			case Output::FATAL:
				return sizeof($this->fatals);
			case Output::ERROR:
				return sizeof($this->errors);
			case Output::WARNING:
				return sizeof($this->warnings);
			case Output::NOTICE:
				return sizeof($this->notices);
		}
		return 0;
	}
651344
public function getMessages($type)
    {
        return $this->hasMessages($type)
            ? $_SESSION[$this->alias][$type]
            : null;
    }
317560
public function getMessage($type = null, $key = 'messages')
    {
        if (isset($type)) {
            $key .= ".$type";
        }

        $message = $this->get($key, array());
        $this->delete($key);
        return $message;
    }
702651
public function message($type, $message)
    {
        if ( $this->session->has('flashMessages') ) {
            $flashMessages = $this->session->get('flashMessages');
            $flashMessages[] = ['type' => $type, 'message' => $message];
            $this->session->set('flashMessages', $flashMessages);
        } else {
            $this->session->set('flashMessages', [['type' => $type, 'message' => $message]]);
        }
    }
1245252
public static function setMethod($method) {

		if(false === is_string($method)) {
  			return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($method)), E_USER_ERROR);
  		}

		$_SERVER['REQUEST_METHOD'] = strtoupper($method);
	}