@@ -14,7 +14,7 @@ trait EntityTrait
14
14
{
15
15
use ObjectTrait;
16
16
17
- public function __construct (Model $ model , string $ id , ?stdClass $ data = null )
17
+ final public function __construct (Model $ model , string $ id , ?stdClass $ data = null )
18
18
{
19
19
$ this ->model = $ model ;
20
20
$ this ->data = $ data ;
@@ -24,7 +24,7 @@ public function __construct(Model $model, string $id, ?stdClass $data = null)
24
24
$ this ->data ->id = $ id ;
25
25
}
26
26
27
- public function __set ($ name , $ value ) : void
27
+ final public function __set ($ name , $ value ) : void
28
28
{
29
29
if ($ name === 'id ' ) {
30
30
throw new OverridingIdentityOfEntityException ('You can not change the "id" of an entity! ' );
@@ -35,12 +35,12 @@ public function __set($name, $value) : void
35
35
$ this ->data ->{$ name } = $ value ;
36
36
}
37
37
38
- public function __unset ($ name )
38
+ final public function __unset ($ name )
39
39
{
40
40
unset($ this ->data ->{$ name });
41
41
}
42
42
43
- public static function createFromJsonFile (string $ jsonFilePath , string $ id ) : EntityInterface
43
+ final public static function createFromJsonFile (string $ jsonFilePath , string $ id ) : EntityInterface
44
44
{
45
45
if (!file_exists ($ jsonFilePath )) {
46
46
throw new CouldNotFindJSONSchemaFileException (
@@ -51,17 +51,17 @@ public static function createFromJsonFile(string $jsonFilePath, string $id) : En
51
51
return self ::createFromJson ($ json , $ id );
52
52
}
53
53
54
- public static function createFromJson (string $ json , string $ id ) : EntityInterface
54
+ final public static function createFromJson (string $ json , string $ id ) : EntityInterface
55
55
{
56
- return new self (new Model ($ json ), $ id );
56
+ return new static (new Model ($ json ), $ id );
57
57
}
58
58
59
- public function entityId () : string
59
+ final public function entityId () : string
60
60
{
61
61
return $ this ->data ->id ;
62
62
}
63
63
64
- public function validatePartially (array $ requiredFields ) : bool
64
+ final public function validatePartially (array $ requiredFields ) : bool
65
65
{
66
66
$ model = $ this ->model ->getModel ();
67
67
$ model ->required = $ requiredFields ;
0 commit comments