class Kint_Parsers_FsPath in Devel 8
Same name and namespace in other branches
- 8.2 kint/kint/parsers/custom/fspath.php \Kint_Parsers_FsPath
Hierarchy
- class \kintVariableData
- class \kintParser
- class \Kint_Parsers_FsPath
- class \kintParser
Expanded class hierarchy of Kint_Parsers_FsPath
File
- kint/
kint/ parsers/ custom/ fspath.php, line 3
View source
class Kint_Parsers_FsPath extends kintParser {
protected function _parse(&$variable) {
if (!KINT_PHP53 || !is_string($variable) || strlen($variable) > 2048 || preg_match('[[:?<>"*|]]', $variable) || !@is_readable($variable)) {
return false;
}
try {
$fileInfo = new SplFileInfo($variable);
$flags = array();
$perms = $fileInfo
->getPerms();
if (($perms & 0xc000) === 0xc000) {
$type = 'File socket';
$flags[] = 's';
}
elseif (($perms & 0xa000) === 0xa000) {
$type = 'File symlink';
$flags[] = 'l';
}
elseif (($perms & 0x8000) === 0x8000) {
$type = 'File';
$flags[] = '-';
}
elseif (($perms & 0x6000) === 0x6000) {
$type = 'Block special file';
$flags[] = 'b';
}
elseif (($perms & 0x4000) === 0x4000) {
$type = 'Directory';
$flags[] = 'd';
}
elseif (($perms & 0x2000) === 0x2000) {
$type = 'Character special file';
$flags[] = 'c';
}
elseif (($perms & 0x1000) === 0x1000) {
$type = 'FIFO pipe file';
$flags[] = 'p';
}
else {
$type = 'Unknown file';
$flags[] = 'u';
}
// owner
$flags[] = $perms & 0x100 ? 'r' : '-';
$flags[] = $perms & 0x80 ? 'w' : '-';
$flags[] = $perms & 0x40 ? $perms & 0x800 ? 's' : 'x' : ($perms & 0x800 ? 'S' : '-');
// group
$flags[] = $perms & 0x20 ? 'r' : '-';
$flags[] = $perms & 0x10 ? 'w' : '-';
$flags[] = $perms & 0x8 ? $perms & 0x400 ? 's' : 'x' : ($perms & 0x400 ? 'S' : '-');
// world
$flags[] = $perms & 0x4 ? 'r' : '-';
$flags[] = $perms & 0x2 ? 'w' : '-';
$flags[] = $perms & 0x1 ? $perms & 0x200 ? 't' : 'x' : ($perms & 0x200 ? 'T' : '-');
$this->type = $type;
$this->size = sprintf('%.2fK', $fileInfo
->getSize() / 1024);
$this->value = implode($flags);
} catch (Exception $e) {
return false;
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
kintParser:: |
private static | property | ||
kintParser:: |
private static | property | ||
kintParser:: |
private static | property | ||
kintParser:: |
private static | property | ||
kintParser:: |
private static | property | ||
kintParser:: |
private static | property | ||
kintParser:: |
private static | property | ||
kintParser:: |
private static | property | ||
kintParser:: |
public static | function | ||
kintParser:: |
final public static | function | * the only public entry point to return a parsed representation of a variable * * @static * * | |
kintParser:: |
public static | function | ||
kintParser:: |
private static | function | ||
kintParser:: |
private static | function | ||
kintParser:: |
private static | function | ||
kintParser:: |
private static | function | ||
kintParser:: |
private static | function | ||
kintParser:: |
private static | function | ||
kintParser:: |
private static | function | ||
kintParser:: |
private static | function | ||
kintParser:: |
private static | function | ||
kintParser:: |
private static | function | ||
kintParser:: |
private static | function | ||
kintParser:: |
private static | function | ||
kintParser:: |
private static | function | ||
kintVariableData:: |
public | property | @var string | |
kintVariableData:: |
public | property | * * the array is a separate possible representation of the dumped var | |
kintVariableData:: |
public | property | @var string | |
kintVariableData:: |
public | property | @var string | |
kintVariableData:: |
public | property | @var int | |
kintVariableData:: |
public | property | @var string | |
kintVariableData:: |
public | property | @var string inline value | |
kintVariableData:: |
public | property | @var kintVariableData[] array of alternative representations for same variable, don't use in custom parsers | |
kintVariableData:: |
private static | property | ||
kintVariableData:: |
protected static | function | ||
kintVariableData:: |
protected static | function | * returns whether the array: * 1) is numeric and * 2) in sequence starting from zero * * | |
kintVariableData:: |
protected static | function | ||
kintVariableData:: |
protected static | function | ||
Kint_Parsers_FsPath:: |
protected | function |
* main and usually single method a custom parser must implement
*
* Overrides kintParser:: |