Completed
Push — master ( 2dffbe...813169 )
by Jose Luis
14:24
created

FieldTypeImplementationTrait::presentFront()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 5
rs 9.4285
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Hechoenlaravel\JarvisFoundation\Field;
4
5
/**
6
 * Trait FieldTypeImplementationTrait
7
 * @package Hechoenlaravel\JarvisFoundation\Field
8
 */
9
trait FieldTypeImplementationTrait
10
{
11
    /**
12
     * Gererate a slug based on name or other parameter
13
     * @param $name
14
     * @return string
15
     */
16
    public function generateSlug($name)
17
    {
18
        return str_slug($name);
19
    }
20
21
    /**
22
     * Pre Assign Event to do anything the fieldType needs to.
23
     * @param $command
24
     */
25
    public function preAssignEvent($command)
0 ignored issues
show
Unused Code introduced by
The parameter $command is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
26
    {
27
    }
28
29
    /**
30
     * By default wont do anything before saving
31
     * @param $value
32
     * @return mixed
33
     */
34
    public function preSaveEvent($value)
35
    {
36
        return $value;
37
    }
38
39
    /**
40
     * By default it returns the raw value
41
     * @return mixed
42
     */
43
    public function presentFront()
44
    {
45
        return $this->value;
0 ignored issues
show
Bug introduced by
The property value does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
46
47
    }
48
}
49