@param string $type
@param bool $detect_text

@return string
541175
public function parse_db_type( $type, $detect_text = false ) {
		switch ( true ) {
			case stristr( $type, 'TINYINT(1)' ) !== false:
				return 'bool';
			case stristr( $type, 'INT' ) !== false:
				return 'int';
			case stristr( $type, 'BIT' ) !== false:
				return 'bool';
			case stristr( $type, 'BOOLEAN' ) !== false:
				return 'bool';
			case stristr( $type, 'DECIMAL' ) !== false:
				return 'number';
			case stristr( $type, 'FLOAT' ) !== false:
				return 'float';
			case stristr( $type, 'DOUBLE' ) !== false:
				return 'number';
			case stristr( $type, 'REAL' ) !== false:
				return 'number';
			case $detect_text && stristr( $type, 'TEXT' ) !== false:
				return 'text';
		}

		return 'string';
	}
430971
protected function createDetection(string $path, $type = Detection::TYPE_VIRUS, $description = null): Detection
    {
        return new Detection($path, $type, $description);
    }
1152523
public function get_type_value($type = null, $type_cast = false)
    {

        if (empty($type)) return "null";

        if (strpos(strtolower($type), 'int') !== false) {
            return ($type_cast) ? '(int)' : 0;
        }

        if (strpos(strtolower($type), 'float') !== false) {
            return ($type_cast) ? '(float)' : 0;
        }

        if (strpos(strtolower($type), 'char') !== false) {
            return ($type_cast) ? '(string)' : "''";
        }

        if (strpos(strtolower($type), 'enum') !== false) {
            return ($type_cast) ? '(string)' : "''";
        }

        if (strpos(strtolower($type), 'dec') !== false) {
            return ($type_cast) ? '(float)' : 0;
        }

        if (strpos(strtolower($type), 'text') !== false) {
            return ($type_cast) ? '(string)' : "''";
        }

        if (strpos(strtolower($type), 'bit') !== false) {
            return ($type_cast) ? '(string)' : "''";
        }

        if (strpos(strtolower($type), 'bool') !== false) {
            return ($type_cast) ? '(boolean)' : "false";
        }

        if (strpos(strtolower($type), 'datetime') !== false) {
            return ($type_cast) ? '(string)' : "'0000-00-00 00:00:00'";
        }

        if (strpos(strtolower($type), 'date') !== false) {
            return ($type_cast) ? '(string)' : "'0000-00-00'";
        }

        if (strpos(strtolower($type), 'year') !== false) {
            return ($type_cast) ? '(string)' : "'0000'";
        }

        if (strpos(strtolower($type), 'time') !== false) {
            return ($type_cast) ? '(int)' : 0;
        }

        if (strpos(strtolower($type), 'double')) {
            return ($type_cast) ? '(double)' : 0;
        }

        return "null";
    }
698564
public function addListAlert($text, $type = 'primary', $icon = 'info-circle')
    {
        $this->listAlerts[] = [
            'Text' => $text,
            'Type' => $type,
            'Icon' => $icon
        ];
        
        return $this;
    }
91159
public function chatSend($sender, $receiver, $content, $type = 'text') {
        $result = $this->httpPost(self::WECHAT_CHAT_SEND_PREFIX, [
            'access_token' => $this->getAccessToken(),
            'receiver' => json_encode($receiver),
            'sender' => $sender,
            'msgtype' => $type,
            $type => json_encode($content),
        ]);
        return ($result['errmsg'] == 'ok') ? true : $result['errmsg'];
    }
1324094
public function into($text, $value, $type = null)
    {
        return str_replace('?', $this->value($value, $type), $text);
    }
828628
public function alert($message, $type = 'info') 
	{
		Argument::i()
			->test(2, 'string')
			->test(3, 'string');

		return Alert::i($message, $type);
	}
1113498
public function notificationAjax(string $title, string $message, string $type = 'default', bool $send_payload = TRUE): void
    {
        if ($this->isAjax())
        {
            $this->payload->notifications[] = $this->createNotification($title, $message, $type);

            if ($send_payload === TRUE)
            {
                $this->sendPayload();
            }
        }
    }
688991
public function message($title='', $text='', $type='', $options=[])
    {
        $this->params['title'] = $title;
        $this->params['text'] = $text;
        $this->params['type'] = $type;
        if (isset($options)) {
            $this->params = array_merge($this->params, $options);
        }

        
        session()->flash('sweetalert.json', json_encode($this->params));

        return $this;
    }
429066
public function toastr(string $type, string $message = '', string $title = '', string $options = ''): string
    {
        return "toastr.$type('$message', '$title', $options);";
    }
463385
protected function formatType($type)
    {
        if (preg_match('/^(?:(.*)\.)?_(.*)$/', $type, $matches)) {
            if ($matches[1] !== '') {
                return sprintf("%s.%s[]", $matches[1], $matches[2]);
            } else {
                return $matches[2].'[]';
            }
        } else {
            return $type;
        }
    }
709768
protected static function format_notification_message_text($messagetype,
                                                             $info,
                                                             $course,
                                                             $context,
                                                             $modulename,
                                                             $assignmentname) {
        $formatparams = array('context' => $context->get_course_context());
        $posttext  = format_string($course->shortname, true, $formatparams) .
                     ' -> ' .
                     $modulename .
                     ' -> ' .
                     format_string($assignmentname, true, $formatparams) . "\n";
        $posttext .= '---------------------------------------------------------------------' . "\n";
        $posttext .= get_string($messagetype . 'text', 'assign', $info)."\n";
        $posttext .= "\n---------------------------------------------------------------------\n";
        return $posttext;
    }
310974
function show_message($message, $type = 'notice', $vars = null, $override = true, $timeout = 0)
    {
        if ($this->app->text_exists($message)) {
            $message = $this->app->gettext(array('name' => $message, 'vars' => $vars));
        }

        printf("[%s] %s\n", strtoupper($type), $message);
    }
156793
private function _msg($message, $rule_type)
    {
        if (is_string($message)) {
            return $message;
        } elseif (isset($message[$rule_type])) {
            return $message[$rule_type];
        } else {
            return 'INVALID';
        }
    }
925209
public function randText($type)
    {
        $string = '';
        switch ($type) {
            case 'en':
                $str = 'ABCDEFGHJKLMNPQRSTUVWXY3456789';
                for ($i = 0; $i < $this->textNum; ++$i) {
                    $string = $string.','.$str[mt_rand(0, 29)];
                }
                break;
            case 'cn':
                for ($i = 0; $i < $this->textNum; ++$i) {
                    $string = $string.','.chr(rand(0xB0, 0xCC)).chr(rand(0xA1, 0xBB));
                }
                $string = iconv('GB2312', 'UTF-8', $string); //转换编码到utf8
                break;
        }

        return substr($string, 1);
    }
802026
function _remove_type_callback(&$mime, $ext_type, $type_info)
    {
        // temporarily we'll put match to false
        $matched = false;
        list($ext, $type) = $ext_type;
        if ($type_info['wildcard']) {
            if (substr($type, 0, strpos($type, '/')) == $type_info['type']) {
                $matched = true;
            }
        } elseif ($type == $type_info['type']) {
            $matched = true;
        }
        if ($matched) {
            $this->remove_extension($ext);
            $type_info['last_match'] = true;
        } elseif ($type_info['last_match']) {
            // we do not need to continue if the previous type matched, but this type didn't.
            // because all types are sorted in alphabetical order, we can be sure there will be
            // no further successful matches.
            return false;
        }
        return true;
    }
791524
protected function inline($type, $title, $text = null)
    {
        $html   = (string) $text;
        $inline = <<<EOD
           $(document).ready(function(){                 
                swal($.extend({}, APP.swal.$type(), {
                    title: '$title',
                    text: '$html',                    
                    showConfirmButton: false,
                    showCancelButton: true,
                    cancelButtonText: 'Ok',
                    closeOnConfirm: false,
                    closeOnCancel: true
                }));
        });
EOD;
        return $inline;
    }