| Server IP : 127.0.1.1 / Your IP : 216.73.216.152 Web Server : Apache/2.4.52 (Ubuntu) System : Linux bahcrestlinepropertiesllc 5.15.0-113-generic #123-Ubuntu SMP Mon Jun 10 08:16:17 UTC 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.33 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /var/www/bahcrestline/core/vendor/laravel/tinker/src/ |
Upload File : |
<?php
namespace Laravel\Tinker;
use Exception;
use Symfony\Component\VarDumper\Caster\Caster;
class TinkerCaster
{
/**
* Application methods to include in the presenter.
*
* @var array
*/
private static $appProperties = [
'configurationIsCached',
'environment',
'environmentFile',
'isLocal',
'routesAreCached',
'runningUnitTests',
'version',
'path',
'basePath',
'configPath',
'databasePath',
'langPath',
'publicPath',
'storagePath',
'bootstrapPath',
];
/**
* Get an array representing the properties of an application.
*
* @param \Illuminate\Foundation\Application $app
* @return array
*/
public static function castApplication($app)
{
$results = [];
foreach (self::$appProperties as $property) {
try {
$val = $app->$property();
if (! is_null($val)) {
$results[Caster::PREFIX_VIRTUAL.$property] = $val;
}
} catch (Exception $e) {
//
}
}
return $results;
}
/**
* Get an array representing the properties of a collection.
*
* @param \Illuminate\Support\Collection $collection
* @return array
*/
public static function castCollection($collection)
{
return [
Caster::PREFIX_VIRTUAL.'all' => $collection->all(),
];
}
/**
* Get an array representing the properties of an html string.
*
* @param \Illuminate\Support\HtmlString $htmlString
* @return array
*/
public static function castHtmlString($htmlString)
{
return [
Caster::PREFIX_VIRTUAL.'html' => $htmlString->toHtml(),
];
}
/**
* Get an array representing the properties of a model.
*
* @param \Illuminate\Database\Eloquent\Model $model
* @return array
*/
public static function castModel($model)
{
$attributes = array_merge(
$model->getAttributes(), $model->getRelations()
);
$visible = array_flip(
$model->getVisible() ?: array_diff(array_keys($attributes), $model->getHidden())
);
$results = [];
foreach (array_intersect_key($attributes, $visible) as $key => $value) {
$results[(isset($visible[$key]) ? Caster::PREFIX_VIRTUAL : Caster::PREFIX_PROTECTED).$key] = $value;
}
return $results;
}
}