j84reginato/my-eval

View on GitHub
src/Exceptions/UnknownFunctionException.php

Summary

Maintainability
A
0 mins
Test Coverage
<?php

declare(strict_types=1);

namespace MyEval\Exceptions;

/**
 * Exception thrown when parsing or evaluating expressions containing an unknown function symbol.
 *
 * This should not happen under normal circumstances.
 */
class UnknownFunctionException extends MathParserException
{
    /**
     * Create a UnknownFunctionException.
     *
     * @param string $unknow
     */
    public function __construct(string $unknow)
    {
        parent::__construct("Unknown function $unknow encountered.");

        $this->data = $unknow;
    }

    /**
     * Get the unknown function that was encountered.
     *
     * @return string
     */
    public function getUnknownFunction(): string
    {
        return $this->data;
    }
}