File tree Expand file tree Collapse file tree 2 files changed +2
-44
lines changed Expand file tree Collapse file tree 2 files changed +2
-44
lines changed Original file line number Diff line number Diff line change @@ -36,8 +36,8 @@ protected function mountDependencies($override = false)
3636 /**
3737 * 指定屬性或屬性名稱;嘗試解析它定義的型別,並進行依賴注入。
3838 *
39- * @param \ReflectionProperty|string $property
40- * @param bool $override
39+ * @param \ReflectionProperty|string $property
40+ * @param bool $override
4141 * @return void
4242 *
4343 * @throws \ReflectionException
Original file line number Diff line number Diff line change 33namespace A2Workspace \AutoMount \Support ;
44
55use ReflectionClass ;
6- use ReflectionObject ;
76use ReflectionProperty ;
87use ReflectionNamedType ;
98
@@ -63,45 +62,4 @@ public static function getPropertyHintedClassName(ReflectionProperty $property):
6362
6463 return $ name ;
6564 }
66-
67- /**
68- * 取得包含類別名的完整屬性名稱。
69- *
70- * @param \ReflectionProperty $property
71- * @return string
72- */
73- public static function getPropertyFullName (ReflectionProperty $ property ): string
74- {
75- return sprintf (
76- '%s::$%s ' ,
77- $ property ->getDeclaringClass ()->getName (),
78- $ property ->getName ()
79- );
80- }
81-
82- /**
83- * 取得物件的動態屬性 (dynamic properties) 列表。
84- *
85- * 回傳一個陣列,包含物件在執行階段宣告的,且未定義為成員的屬性。
86- *
87- * @param object $object
88- * @return array
89- */
90- public static function getDynamicProperties (object $ object ): array
91- {
92- $ reflector = new ReflectionObject ($ object );
93-
94- $ properties = $ reflector ->getProperties ();
95- $ properties = array_filter ($ properties , function (ReflectionProperty $ property ) {
96- return ! $ property ->isDefault ();
97- });
98-
99- $ results = [];
100-
101- foreach ($ properties as $ property ) {
102- $ results [$ property ->getName ()] = $ property ->getValue ($ object );
103- }
104-
105- return $ results ;
106- }
10765}
You can’t perform that action at this time.
0 commit comments