/var/www/vhosts/ihelp.ro/httpdocs/vendor/cakephp/debug_kit/src/Panel
Edit: /var/www/vhosts/ihelp.ro/httpdocs/vendor/cakephp/debug_kit/src/Panel/VariablesPanel.php (3824B)
getErrors();
foreach ($entity->getVisible() as $property) {
$v = $entity[$property];
if ($v instanceof EntityInterface) {
$errors[$property] = $this->_getErrors($v);
} elseif (is_array($v)) {
foreach ($v as $key => $varValue) {
if ($varValue instanceof EntityInterface) {
$errors[$property][$key] = $this->_getErrors($varValue);
}
}
}
}
return Hash::filter($errors);
}
/**
* Safely retrieves debug information from an object
* and applies a callback.
*
* @param callable $walker The walker to apply on the debug info array.
* @param object $item The item whose debug info to retrieve.
* @return array|string
*/
protected function _walkDebugInfo(callable $walker, $item)
{
try {
$info = $item->__debugInfo();
} catch (\Exception $exception) {
return sprintf(
'Could not retrieve debug info - %s. Error: %s in %s, line %d',
get_class($item),
$exception->getMessage(),
$exception->getFile(),
$exception->getLine()
);
}
return array_map($walker, $info);
}
/**
* Shutdown event
*
* @param \Cake\Event\EventInterface $event The event
* @return void
*/
public function shutdown(EventInterface $event)
{
/** @var \Cake\Controller\Controller $controller */
$controller = $event->getSubject();
$errors = [];
$content = [];
$vars = $controller->viewBuilder()->getVars();
$varsMaxDepth = (int)Configure::read('DebugKit.variablesPanelMaxDepth', 5);
foreach ($vars as $k => $v) {
// Get the validation errors for Entity
if ($v instanceof EntityInterface) {
$errors[$k] = $this->_getErrors($v);
} elseif ($v instanceof Form) {
$formErrors = $v->getErrors();
if ($formErrors) {
$errors[$k] = $formErrors;
}
}
$content[$k] = Debugger::exportVarAsNodes($v, $varsMaxDepth);
}
$this->_data = [
'variables' => $content,
'errors' => $errors,
'varsMaxDepth' => $varsMaxDepth,
];
}
/**
* Get summary data for the variables panel.
*
* @return string
*/
public function summary()
{
if (!isset($this->_data['variables'])) {
return '0';
}
return (string)count($this->_data['variables']);
}
}