Passed
Push — master ( f4807a...5c5c3f )
by Vicens
04:38
created

Captcha::routes()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 9
rs 9.6666
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 1
1
<?php
2
3
namespace Vicens\Captcha\Facades;
4
5
use Illuminate\Support\HtmlString;
6
use Illuminate\Support\Facades\Route;
7
use Illuminate\Support\Facades\Config;
8
use Illuminate\Support\Facades\Facade;
9
10
class Captcha extends Facade
0 ignored issues
show
Coding Style introduced by
Captcha does not seem to conform to the naming convention (Utils?$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
11
{
12
13
14
    protected static function getFacadeAccessor()
15
    {
16
        return 'captcha';
17
    }
18
19
    /**
20
     * 生成验证码图片标签
21
     *
22
     * @return string
0 ignored issues
show
Documentation introduced by
Should the return type not be HtmlString?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
23
     */
24
    public static function image()
25
    {
26
        return new HtmlString('<img src="' . self::src() . '" alt="captcha"/>');
27
    }
28
29
    /**
30
     * 获取图片验证码的URL
31
     *
32
     * @return string
33
     */
34
    public static function src()
35
    {
36
        return self::url();
37
    }
38
39
    /**
40
     * 返回验证码的URL
41
     *
42
     * @return string
43
     */
44
    public static function url()
45
    {
46
        return Route::to(Config::get('captcha.routeName', 'captcha'));
47
    }
48
}