@@ -72,6 +72,36 @@ public static function castDoublyLinkedList(\SplDoublyLinkedList $c, array $a, S
72
72
return $ a ;
73
73
}
74
74
75
+ public static function castFileInfo (\SplFileInfo $ c , array $ a , Stub $ stub , $ isNested )
76
+ {
77
+ $ prefix = Caster::PREFIX_VIRTUAL ;
78
+
79
+ return $ a + array (
80
+ $ prefix .'path ' => $ c ->getPath (),
81
+ $ prefix .'filename ' => $ c ->getFilename (),
82
+ $ prefix .'basename ' => $ c ->getBasename (),
83
+ $ prefix .'pathname ' => $ c ->getPathname (),
84
+ $ prefix .'extension ' => $ c ->getExtension (),
85
+ $ prefix .'realPath ' => $ c ->getRealPath (),
86
+ $ prefix .'perms ' => new ConstStub (sprintf ('0%o ' , $ c ->getPerms ()), $ c ->getPerms ()),
87
+ $ prefix .'inode ' => $ c ->getInode (),
88
+ $ prefix .'size ' => $ c ->getSize (),
89
+ $ prefix .'owner ' => $ c ->getOwner (),
90
+ $ prefix .'group ' => $ c ->getGroup (),
91
+ $ prefix .'aTime ' => new ConstStub (date ('Y-m-d H:i:s ' , $ c ->getATime ()), $ c ->getATime ()),
92
+ $ prefix .'mTime ' => new ConstStub (date ('Y-m-d H:i:s ' , $ c ->getMTime ()), $ c ->getMTime ()),
93
+ $ prefix .'cTime ' => new ConstStub (date ('Y-m-d H:i:s ' , $ c ->getCTime ()), $ c ->getCTime ()),
94
+ $ prefix .'type ' => $ c ->getType (),
95
+ $ prefix .'writable ' => $ c ->isWritable (),
96
+ $ prefix .'readable ' => $ c ->isReadable (),
97
+ $ prefix .'executable ' => $ c ->isExecutable (),
98
+ $ prefix .'file ' => $ c ->isFile (),
99
+ $ prefix .'dir ' => $ c ->isDir (),
100
+ $ prefix .'link ' => $ c ->isLink (),
101
+ $ prefix .'linkTarget ' => $ c ->isLink () ? $ c ->getLinkTarget () : null ,
102
+ );
103
+ }
104
+
75
105
public static function castFixedArray (\SplFixedArray $ c , array $ a , Stub $ stub , $ isNested )
76
106
{
77
107
$ a += array (
0 commit comments