3 class Kint_Objects_SplFileInfo extends KintObject
5 public function parse( & $variable )
7 if ( !KINT_PHP53 || !is_object( $variable ) || !$variable instanceof SplFileInfo ) return false;
9 $this->name = 'SplFileInfo';
10 $this->value = $variable->getBasename();
14 $perms = $variable->getPerms();
16 if ( ( $perms & 0xC000 ) === 0xC000 ) {
17 $type = 'File socket';
19 } elseif ( ( $perms & 0xA000 ) === 0xA000 ) {
20 $type = 'File symlink';
22 } elseif ( ( $perms & 0x8000 ) === 0x8000 ) {
25 } elseif ( ( $perms & 0x6000 ) === 0x6000 ) {
26 $type = 'Block special file';
28 } elseif ( ( $perms & 0x4000 ) === 0x4000 ) {
31 } elseif ( ( $perms & 0x2000 ) === 0x2000 ) {
32 $type = 'Character special file';
34 } elseif ( ( $perms & 0x1000 ) === 0x1000 ) {
35 $type = 'FIFO pipe file';
38 $type = 'Unknown file';
43 $flags[] = ( ( $perms & 0x0100 ) ? 'r' : '-' );
44 $flags[] = ( ( $perms & 0x0080 ) ? 'w' : '-' );
45 $flags[] = ( ( $perms & 0x0040 ) ? ( ( $perms & 0x0800 ) ? 's' : 'x' ) : ( ( $perms & 0x0800 ) ? 'S' : '-' ) );
48 $flags[] = ( ( $perms & 0x0020 ) ? 'r' : '-' );
49 $flags[] = ( ( $perms & 0x0010 ) ? 'w' : '-' );
50 $flags[] = ( ( $perms & 0x0008 ) ? ( ( $perms & 0x0400 ) ? 's' : 'x' ) : ( ( $perms & 0x0400 ) ? 'S' : '-' ) );
53 $flags[] = ( ( $perms & 0x0004 ) ? 'r' : '-' );
54 $flags[] = ( ( $perms & 0x0002 ) ? 'w' : '-' );
55 $flags[] = ( ( $perms & 0x0001 ) ? ( ( $perms & 0x0200 ) ? 't' : 'x' ) : ( ( $perms & 0x0200 ) ? 'T' : '-' ) );
57 $size = sprintf( '%.2fK', $variable->getSize() / 1024 );
58 $flags = implode( $flags );
59 $path = $variable->getRealPath();
62 'File information' => array(