@@ -21,7 +21,7 @@ abstract class Entity extends \Wtf\Root
21
21
*/
22
22
protected function __getEntityName (): string
23
23
{
24
- return ($ pos = strrpos (get_class ($ this ), '\\' )) ? substr (get_class ($ this ), $ pos + 1 ) : get_class ($ this );
24
+ return ($ pos = \ strrpos (\ get_class ($ this ), '\\' )) ? \ substr (\ get_class ($ this ), $ pos + 1 ) : \ get_class ($ this );
25
25
}
26
26
27
27
/**
@@ -32,9 +32,9 @@ protected function __getEntityName(): string
32
32
*/
33
33
public function __call (?string $ method = null , array $ params = [])
34
34
{
35
- $ parts = preg_split ('/([A-Z][^A-Z]*)/ ' , $ method , -1 , PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE );
36
- $ type = array_shift ($ parts );
37
- $ relation = strtolower (implode ('_ ' , $ parts ));
35
+ $ parts = \ preg_split ('/([A-Z][^A-Z]*)/ ' , $ method , -1 , PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE );
36
+ $ type = \ array_shift ($ parts );
37
+ $ relation = \ strtolower (\ implode ('_ ' , $ parts ));
38
38
39
39
if ('get ' === $ type && isset ($ this ->getRelations ()[$ relation ])) {
40
40
return $ this ->loadRelation ($ relation );
@@ -80,7 +80,7 @@ public function getData(): array
80
80
*/
81
81
public function setData (array $ data )
82
82
{
83
- $ this ->data = array_merge ($ this ->data , $ data );
83
+ $ this ->data = \ array_merge ($ this ->data , $ data );
84
84
85
85
return $ this ;
86
86
}
@@ -149,9 +149,9 @@ public function validate(string $method = 'save'): array
149
149
public function load ($ value , $ field = 'id ' , array $ fields = null ): self
150
150
{
151
151
$ data = $ this ->medoo ->get ($ this ->getTable (), $ fields ?? '* ' , [$ field => $ value ]);
152
- $ this ->data = is_array ($ data ) ? $ data : []; //handle empty result gracefuly
152
+ $ this ->data = \ is_array ($ data ) ? $ data : []; //handle empty result gracefuly
153
153
$ this ->sentry ->breadcrumbs ->record ([
154
- 'message ' => 'Entity ' .$ this ->__getEntityName ().'::load( ' .$ value .', ' .$ field .', [ ' .implode (', ' , $ fields ?? []).') ' ,
154
+ 'message ' => 'Entity ' .$ this ->__getEntityName ().'::load( ' .$ value .', ' .$ field .', [ ' .\ implode (', ' , $ fields ?? []).') ' ,
155
155
'data ' => ['query ' => $ this ->medoo ->last ()],
156
156
'category ' => 'Database ' ,
157
157
'level ' => 'info ' ,
@@ -172,7 +172,7 @@ public function loadAll(array $where = [], bool $assoc = false): Collection
172
172
{
173
173
$ allData = $ this ->medoo ->select ($ this ->getTable (), '* ' , $ where );
174
174
$ this ->sentry ->breadcrumbs ->record ([
175
- 'message ' => 'Entity ' .$ this ->__getEntityName ().'::loadAll( ' .print_r ($ where , true ).') ' ,
175
+ 'message ' => 'Entity ' .$ this ->__getEntityName ().'::loadAll( ' .\ print_r ($ where , true ).') ' ,
176
176
'data ' => ['query ' => $ this ->medoo ->last ()],
177
177
'category ' => 'Database ' ,
178
178
'level ' => 'info ' ,
0 commit comments