Code Duplication    Length = 16-18 lines in 2 locations

src/Rules/Json.php 1 location

@@ 16-31 (lines=16) @@
13
14
use TheSupportGroup\Common\Validator\Contracts\Rules\RuleInterface;
15
16
class Json extends BaseRule implements RuleInterface
17
{
18
    public function isValid()
19
    {
20
        if ($this->isNotRequiredAndEmpty()) {
21
            return true;
22
        }
23
24
        return $this->Json()->validate($this->getParams()[1]);
25
    }
26
27
    public function getMessage()
28
    {
29
        return 'Field :field: is not json';
30
    }
31
}
32

src/Rules/Url.php 1 location

@@ 16-33 (lines=18) @@
13
14
use TheSupportGroup\Common\Validator\Contracts\Rules\RuleInterface;
15
16
class Url extends BaseRule implements RuleInterface
17
{
18
    public function isValid()
19
    {
20
        if ($this->isNotRequiredAndEmpty()) {
21
            return true;
22
        }
23
24
        $input = trim($this->getParams()[1]);
25
26
        return $this->Url()->validate($input);
27
    }
28
29
    public function getMessage()
30
    {
31
        return 'Field :field: is not URL';
32
    }
33
}
34