Rise error message for Column Exceptions

@param  array  $params   message params
@param  int    $line     error line
@param  string $filename file error
@return Column
761089
public function rise(array $params, $line, $filename)
    {

        $this->invoke = [
            'COLUMN_DOES_NOT_SUPPORT' => function ($params, $filename, $line) {
                // set message for not supported column type
                $this->message = "The type {" . $params[1] . "} of column `" . $params[2] . "` does not supported. File: " . $filename . " Line: " . $line;
            },
            'COLUMN_DOES_NOT_EXISTS' => function ($params, $filename, $line) {
                // set message for not existing column
                $this->message = "Column `" . implode("`, `", $params[1]) . "` not exists in " . $params[2] . ". Only `" . implode("`, `", $params[3]) . "`. File: " . $filename . " Line: " . $line;

            },
            'ORDER_TYPES_DOES_NOT_EXISTS' => function ($params, $filename, $line) {
                // set message for not supported order type
                $this->message = "The order type(s) {" . implode(",", $params[1]) . "} does not supported in order clause. File: " . $filename . " Line: " . $line;

            },
            'EMPTY_LIST' => function ($params, $filename, $line) {
                // set message for empty search list
                $this->message = $params[1] . ". File: " . $filename . " Line: " . $line;
            }];

        $this->invoke[current($params)]($params, $filename, $line);

        return $this;
    }
268841
@Factory
    public static Matcher<Proc> raisesException(String regex) {
        return new Raises(IsThrowable.exception(regex));
    }
702090
protected function pdoException(string $query, array $params) : void
    {
        $this->createException($this->pdo->errorInfo()[2], $query, $params);
    }
309106
public function remove(string $filename, array $params = [])
    {
        $path = $this->buildAttachmentsPath($filename);

        return $this->delete($path, $params);
    }
382542
protected function processFile($column, $file, $filename, $name = null)
  {
    if (!is_file($file)) {
      Exception::ThrowError(Exception::FILE_NOT_EXISTS, $file);
    }

    $ext  = strtolower(pathinfo($file, PATHINFO_EXTENSION));
    $size = filesize($file);

    $this->copyFile($file, $this->getFilesPath() . $filename);

    return $this->setSerialized(
      $column,
      array(
        'file'      => $filename,
        'extension' => $ext,
        'size'      => $size,
        'name'      => $name,
      )
    );
  }
1082792
public function errorHandler($code, $message, $file, $line)
    {
        switch ($code) {
            case E_NOTICE:
            case E_USER_NOTICE:
                $exception = new Errors\Notice($message, $code, 1, $file, $line);
                break;
            case E_WARNING:
            case E_USER_WARNING:
                $exception = new Errors\Warning($message, $code, 1, $file, $line);
                break;
            case E_ERROR:
            case E_CORE_ERROR:
            case E_RECOVERABLE_ERROR:
            case E_USER_ERROR:
                $exception = new Errors\Fatal($message, $code, 1, $file, $line);
                break;
            default:
                $exception = new Errors\Error($message, $code, 1, $file, $line);
                break;
        }

        $this->exceptionHandler($exception);

        if ($this->oldErrorHandler) {
            return call_user_func(
                $this->oldErrorHandler,
                $code,
                $message,
                $file,
                $line
            );
        }

        return false;
    }
261922
private static function _formatFilePath($filename, $format, $extras = array(), $addHostname = false)
    {
        // we can parse scalars also
        if(is_scalar($extras)) {
            $extras = array($extras);
        }

        if(!is_array($extras)) {
            throw new \Exception('Extras parameter must be array');
        }

        $dot_pos  = strrpos($filename, '.');
        if(!$dot_pos) {
            $filename .= '.log';
            $dot_pos  = strrpos($filename, '.');
        }

        $tmp = strlen($filename) - $dot_pos;

        switch ($format) {
            case self::LOGPATH_FORMAT_COMPLEX:
                // add short date and 24 hour format as last parama
                $extras[] = $addHostname
                    ? substr($filename, 0, $dot_pos) . '_' . gethostname()
                    : substr($filename, 0, $dot_pos);
                $extras = array_merge($extras, explode('-', date("H-d-m-Y", Tools::ts())));
                // reverse order or extras array so that year is first, month etc...
                $extras = array_reverse($extras);
                $glue = DIRECTORY_SEPARATOR;
                break;

            default:
            case self::LOGPATH_FORMAT_SIMPLE:
                // add machine hostname to extra array
                $extras[] = substr($filename, 0, $dot_pos);
                if($addHostname) {
                    $extras[] = gethostname();
                }
                $extras[] = date("Y-m-d", Tools::ts());
                $glue = '_';
                break;
        }

        return implode($glue, $extras) . substr($filename,  "-{$tmp}", $tmp);
    }
526860
public function remove(string $filename, array $params = [])
    {
        $path = $this->buildDownloadsPath($filename);

        return $this->delete($path, $params);
    }
257309
public function column(string $statement, array $params = [], int $offset = 0)
    {
        $stmt = $this->prepare($statement);
        if (!$this->is1DArray($params)) {
            throw new Issues\MustBeOneDimensionalArray(
                'Only one-dimensional arrays are allowed.'
            );
        }
        $stmt->execute($params);
        return $stmt->fetchAll(
            \PDO::FETCH_COLUMN,
            $offset
        );
    }
133596
public static function checkFile($filename)
    {
        $fileContents = (is_file($filename) && is_readable($filename)) ? @file_get_contents($filename) : false;
        if ($fileContents === false) {
            throw new Exception('Failed to load the file '.$filename);
        }

        return static::checkString($fileContents, $filename);
    }
1128604
private function getDfColumn($line, $columnName)
    {
        $columnPatterns = [
            'filesystem' => '#^(.+?)(\s+[0-9])#',
            'total' => '#([0-9]+)\s+[0-9]+\s+[0-9]+\s+[0-9]+%\s+#',
            'used' => '#([0-9]+)\s+[0-9]+\s+[0-9]+%\s+#',
            'available' => '#([0-9]+)\s+[0-9]+%\s+#',
            'path' => '#%\s+(/.+)$#',
        ];
        if (!isset($columnPatterns[$columnName])) {
            throw new \InvalidArgumentException("Invalid df column: $columnName");
        }
        if (!preg_match($columnPatterns[$columnName], $line, $matches)) {
            throw new \RuntimeException("Failed to find column '$columnName' in df line: \n$line");
        }

        return trim($matches[1]);
    }
43144
protected static function throwParamException(
        array $params,
        string $key,
        \Throwable $exception
    ) {
        $message = $exception->getMessage();

        if (self::isDebug()) {
            echo(
                "\n<pre>\n"
                . "Param Error: " . $message
                . "\n key: {$key}"
                // . "\n params: " . Json::encode($params, JSON_PRETTY_PRINT, 3)
                . "\n params dump: " . var_export($params, true)
                . "\n</pre>\n"
            );
        }

        throw $exception;
    }
232526
public static function appendLines(string $filename, array $lines, string $separator = "\n"): int
    {
        if (self::exist($filename)) {
            $existingLines = self::getLines($filename);
            $lines = array_merge($existingLines, $lines);
            return self::putLines($filename, $lines, $separator);
        }
        return self::putLines($filename, $lines, $separator);
    }
1006744
public function loadFile($filename)
    {
        foreach (file($filename, FILE_IGNORE_NEW_LINES) as $line) {
            if (2 !== substr_count($line, ':')) {
                throw new DAV\Exception('Malformed htdigest file. Every line should contain 2 colons');
            }
            list($username, $realm, $A1) = explode(':', $line);

            if (!preg_match('/^[a-zA-Z0-9]{32}$/', $A1)) {
                throw new DAV\Exception('Malformed htdigest file. Invalid md5 hash');
            }
            $this->users[$realm.':'.$username] = $A1;
        }
    }
1162248
private function newUpdateEntry($column, $param)
    {
        if (!empty($this->columnwhitelist)) {
            if (!in_array($column, $this->columnwhitelist)) {
                throw (new \Exception('Column in update list not found in white list'));
            }
        }
        $newupdate = new \stdClass();
        $newupdate->column = $column;
        $newupdate->param = $this->newBindEntry($param, ':up');
        $this->updates[] = $newupdate;
    }
25252
public function orderByField($column, array $params = [])
    {
        if (count($params) <= 0) return $this;

        $this->order->addByField($column, $params);
        return $this;
    }
766841
public static function log($data, $fileName = 'log', $ext='txt', $format='Ymd') {
        $filePath = Config::getx('path_temp') . 'logs'. DIRECTORY_SEPARATOR;
        if (!is_dir($filePath)) {
            if(!mkdir($filePath,0755,true)){
                throw new \Exception('Create log dir is fail!');
            }
        }
        $message = '[' . date("Y-m-d h:i:s") . ']  ';
        if($data instanceof \Throwable) {
            $message .= $data->getMessage().' in '.$data->getFile().':'.$data->getLine();
        }
        else {
            $message .= (is_array($data) ? print_r($data, true) : $data);
        }
        $message .="\n";
        $format = date($format);
        $fileName = "{$filePath}{$fileName}_{$format}.{$ext}";
        error_log($message, 3, $fileName);
    }