This repository was archived by the owner on Jun 11, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +43
-2
lines changed Expand file tree Collapse file tree 3 files changed +43
-2
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+ /**
3+ * Created by PhpStorm.
4+ * User: inhere
5+ * Date: 2018/5/2
6+ * Time: 上午10:12
7+ */
8+
9+ namespace Toolkit \ObjUtil ;
10+
11+ use Toolkit \ObjUtil \Traits \PropertyAccessByGetterSetterTrait ;
12+
13+ /**
14+ * Class Configurable
15+ * @package Toolkit\ObjUtil
16+ */
17+ class Configurable
18+ {
19+ use PropertyAccessByGetterSetterTrait;
20+
21+ /**
22+ * Configurable constructor.
23+ * @param array $config
24+ */
25+ public function __construct (array $ config = [])
26+ {
27+ if ($ config ) {
28+ Obj::init ($ this , $ config );
29+ }
30+
31+ $ this ->init ();
32+ }
33+
34+ /**
35+ * init
36+ */
37+ protected function init ()
38+ {
39+ // init something ...
40+ }
41+ }
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ trait ArrayAccessByGetterSetterTrait
2727 */
2828 public function offsetExists ($ offset ): bool
2929 {
30- return property_exists ($ this , $ offset );
30+ return \ property_exists ($ this , $ offset );
3131 }
3232
3333 /**
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ trait ArrayAccessByPropertyTrait
2727 */
2828 public function offsetExists ($ offset ): bool
2929 {
30- return property_exists ($ this , $ offset );
30+ return \ property_exists ($ this , $ offset );
3131 }
3232
3333 /**
You can’t perform that action at this time.
0 commit comments