function kintParser::_parse_resource

File

kint/kint/inc/kintParser.class.php, line 538

Class

kintParser

Code

private static function _parse_resource(&$variable, kintVariableData $variableData) {
    $resourceType = get_resource_type($variable);
    $variableData->type = "resource ({$resourceType})";
    if ($resourceType === 'stream' && ($meta = stream_get_meta_data($variable))) {
        if (isset($meta['uri'])) {
            $file = $meta['uri'];
            if (function_exists('stream_is_local')) {
                // Only exists on PHP >= 5.2.4
                if (stream_is_local($file)) {
                    $file = Kint::shortenPath($file);
                }
            }
            $variableData->value = $file;
        }
    }
}