method decodeContents documentation in bbn\File\System
Returns the decoded content of the given file with a predefined or given decoding function
function(string $file, $decoder = NULL, $as_array = false)
{
if ($c = $this->getContents($file)) {
if (is_callable($decoder)) {
return $decoder($c);
} else {
$encoding = false;
if (!$decoder) {
$encoding = bbn\Str::fileExt($file);
} elseif (is_string($decoder)) {
$encoding = $decoder;
}
switch ($encoding) {
case 'json':
return json_decode($c, $as_array);
case 'yml':
case 'yaml':
return yaml_parse($c);
default:
return unserialize($c);
}
}
}
return null;
}
Returns the decoded content of the given file with a predefined or given decoding function BBN is a suite of PHP and JS libraries and VueJS components - all open-source! bbn.io, build applications, the quick way
This website uses cookies to ensure you get the best experience on our website.
© 2011-2025
BBN Solutions