Passed
Push — develop ( 318470...89abc6 )
by Richard
13:40
created

LsfTextNote   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 10
c 1
b 0
f 0
dl 0
loc 41
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A errorMessages() 0 3 1
A response() 0 3 1
A jsonSerialize() 0 9 1
1
<?php
2
3
namespace Riclep\StoryblokForms\Blocks;
4
5
use Illuminate\Support\Str;
6
use Riclep\Storyblok\Block;
7
8
class LsfTextNote extends Block
9
10
{
11
	// Interface this....
12
	protected string $type = 'input';
13
14
	/**
15
	 * All the Validation rules for this Input
16
	 *
17
	 * @return mixed
18
	 */
19
	public function errorMessages(): mixed
20
	{
21
		return [];
22
	}
23
24
	/**
25
	 * Returns the Input’s response after the form has been submitted and validated
26
	 *
27
	 * @param $input
28
	 * @return array
29
	 */
30
	public function response($input): array
31
	{
32
		return [];
33
	}
34
35
	/**
36
	 * Converts a field to JSON for VueJS
37
	 *
38
	 * @return Collection
0 ignored issues
show
Bug introduced by
The type Riclep\StoryblokForms\Blocks\Collection was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
39
	 */
40
	public function jsonSerialize(): mixed
41
	{
42
		$content = $this->content();
43
		$content['validators'] = [];
44
		$content['dot_name'] = Str::random(10);
45
46
		return collect([
0 ignored issues
show
Bug introduced by
array('component' => $th... 'content' => $content) of type array<string,Illuminate\...port\Collection|string> is incompatible with the type Illuminate\Contracts\Support\Arrayable expected by parameter $value of collect(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

46
		return collect(/** @scrutinizer ignore-type */ [
Loading history...
47
			'component' => $this->component(),
48
			'content' => $content,
49
		]);
50
	}
51
}