File tree Expand file tree Collapse file tree 1 file changed +13
-7
lines changed
Expand file tree Collapse file tree 1 file changed +13
-7
lines changed Original file line number Diff line number Diff line change 1111trait Properties
1212{
1313 /** @var array */
14- protected $ properties = [];
14+ private $ properties = [];
1515
1616 /** @var array */
17- protected $ mutatedProperties = [];
17+ private $ mutatedProperties = [];
1818
1919 /** @var bool Whether accessors and mutators are enabled */
2020 protected $ accessorsAndMutatorsEnabled = false ;
2121
22+ /**
23+ * Get whether this class has any properties
24+ *
25+ * @return bool
26+ */
27+ public function hasProperties ()
28+ {
29+ return ! empty ($ this ->properties );
30+ }
31+
2232 /**
2333 * Get whether a property with the given key exists
2434 *
@@ -97,10 +107,6 @@ protected function setProperty($key, $value)
97107 {
98108 $ this ->properties [$ key ] = $ value ;
99109
100- if ($ this ->accessorsAndMutatorsEnabled ) {
101- $ this ->mutateProperty ($ key );
102- }
103-
104110 return $ this ;
105111 }
106112
@@ -119,7 +125,7 @@ protected function mutateProperty($key)
119125 $ value = array_key_exists ($ key , $ this ->properties )
120126 ? $ this ->properties [$ key ]
121127 : null ;
122- $ this ->mutatedProperties [$ key ] = $ value ; // Prevents repeated checks
128+ $ this ->mutatedProperties [$ key ] = true ; // Prevents repeated checks
123129
124130 $ mutator = Str::camel ('mutate_ ' . $ key ) . 'Property ' ;
125131 if (method_exists ($ this , $ mutator )) {
You can’t perform that action at this time.
0 commit comments