Issues (16)

src/Casts/CleanHtml.php (2 issues)

1
<?php
2
3
namespace Mews\Purifier\Casts;
4
5
use Illuminate\Contracts\Database\Eloquent\CastsAttributes;
6
7
class CleanHtml implements CastsAttributes
8
{
9
    use WithConfig;
10
11
    /**
12
     * Clean the HTML when casting the given value.
13
     *
14
     * @param  \Illuminate\Database\Eloquent\Model  $model
15
     * @param  string  $key
16
     * @param  mixed  $value
17
     * @param  array  $attributes
18
     * @return array
19
     */
20
    public function get($model, $key, $value, $attributes)
21
    {
22
        return clean($value, $this->config);
0 ignored issues
show
Bug Best Practice introduced by
The expression return clean($value, $this->config) also could return the type string which is incompatible with the documented return type array.
Loading history...
23
    }
24
25
    /**
26
     * Prepare the given value for storage by cleaning the HTML.
27
     *
28
     * @param  \Illuminate\Database\Eloquent\Model  $model
29
     * @param  string  $key
30
     * @param  array  $value
31
     * @param  array  $attributes
32
     * @return string
33
     */
34
    public function set($model, $key, $value, $attributes)
35
    {
36
        return clean($value, $this->config);
0 ignored issues
show
Bug Best Practice introduced by
The expression return clean($value, $this->config) returns the type array which is incompatible with the documented return type string.
Loading history...
37
    }
38
}
39