/var/www/vhosts/ihelp.ro/httpdocs/vendor/cakephp/cakephp/src/View
NameSizeModeActions
Exception/-0755rm
Form/-0755rm
Helper/-0755rm
Widget/-0755rm
AjaxView.php10880644editdlrm
Cell.php90450644editdlrm
CellTrait.php44460644editdlrm
Helper.php73290644editdlrm
HelperRegistry.php48600644editdlrm
JsonView.php58780644editdlrm
NegotiationRequiredView.php18360644editdlrm
SerializedView.php36900644editdlrm
StringTemplate.php115640644editdlrm
StringTemplateTrait.php28640644editdlrm
View.php523500644editdlrm
ViewBlock.php64040644editdlrm
ViewBuilder.php176020644editdlrm
ViewVarsTrait.php30690644editdlrm
XmlView.php47980644editdlrm
Edit: /var/www/vhosts/ihelp.ro/httpdocs/vendor/cakephp/cakephp/src/View/Cell.php (9045B)
*/ protected $_validCellOptions = []; /** * Caching setup. * * @var array|bool */ protected $_cache = false; /** * Constructor. * * @param \Cake\Http\ServerRequest $request The request to use in the cell. * @param \Cake\Http\Response $response The response to use in the cell. * @param \Cake\Event\EventManagerInterface|null $eventManager The eventManager to bind events to. * @param array $cellOptions Cell options to apply. */ public function __construct( ServerRequest $request, Response $response, ?EventManagerInterface $eventManager = null, array $cellOptions = [] ) { if ($eventManager !== null) { $this->setEventManager($eventManager); } $this->request = $request; $this->response = $response; $this->modelFactory('Table', [$this->getTableLocator(), 'get']); $this->_validCellOptions = array_merge(['action', 'args'], $this->_validCellOptions); foreach ($this->_validCellOptions as $var) { if (isset($cellOptions[$var])) { $this->{$var} = $cellOptions[$var]; } } if (!empty($cellOptions['cache'])) { $this->_cache = $cellOptions['cache']; } $this->initialize(); } /** * Initialization hook method. * * Implement this method to avoid having to overwrite * the constructor and calling parent::__construct(). * * @return void */ public function initialize(): void { } /** * Render the cell. * * @param string|null $template Custom template name to render. If not provided (null), the last * value will be used. This value is automatically set by `CellTrait::cell()`. * @return string The rendered cell. * @throws \Cake\View\Exception\MissingCellTemplateException * When a MissingTemplateException is raised during rendering. * @throws \BadMethodCallException */ public function render(?string $template = null): string { $cache = []; if ($this->_cache) { $cache = $this->_cacheConfig($this->action, $template); } $render = function () use ($template) { try { $reflect = new ReflectionMethod($this, $this->action); $reflect->invokeArgs($this, $this->args); } catch (ReflectionException $e) { throw new BadMethodCallException(sprintf( 'Class %s does not have a "%s" method.', static::class, $this->action )); } $builder = $this->viewBuilder(); if ($template !== null) { $builder->setTemplate($template); } $className = static::class; $namePrefix = '\View\Cell\\'; /** @psalm-suppress PossiblyFalseOperand */ $name = substr($className, strpos($className, $namePrefix) + strlen($namePrefix)); $name = substr($name, 0, -4); if (!$builder->getTemplatePath()) { $builder->setTemplatePath( static::TEMPLATE_FOLDER . DIRECTORY_SEPARATOR . str_replace('\\', DIRECTORY_SEPARATOR, $name) ); } $template = $builder->getTemplate(); $view = $this->createView(); try { return $view->render($template, false); } catch (MissingTemplateException $e) { $attributes = $e->getAttributes(); throw new MissingCellTemplateException( $name, $attributes['file'], $attributes['paths'], null, $e ); } }; if ($cache) { return Cache::remember($cache['key'], $render, $cache['config']); } return $render(); } /** * Generate the cache key to use for this cell. * * If the key is undefined, the cell class and action name will be used. * * @param string $action The action invoked. * @param string|null $template The name of the template to be rendered. * @return array The cache configuration. */ protected function _cacheConfig(string $action, ?string $template = null): array { if (empty($this->_cache)) { return []; } $template = $template ?: 'default'; $key = 'cell_' . Inflector::underscore(static::class) . '_' . $action . '_' . $template; $key = str_replace('\\', '_', $key); $default = [ 'config' => 'default', 'key' => $key, ]; if ($this->_cache === true) { return $default; } /** @psalm-suppress PossiblyFalseOperand */ return $this->_cache + $default; } /** * Magic method. * * Starts the rendering process when Cell is echoed. * * *Note* This method will trigger an error when view rendering has a problem. * This is because PHP will not allow a __toString() method to throw an exception. * * @return string Rendered cell * @throws \Error Include error details for PHP 7 fatal errors. */ public function __toString(): string { try { return $this->render(); } catch (Exception $e) { trigger_error(sprintf( 'Could not render cell - %s [%s, line %d]', $e->getMessage(), $e->getFile(), $e->getLine() ), E_USER_WARNING); return ''; } catch (Error $e) { throw new Error(sprintf( 'Could not render cell - %s [%s, line %d]', $e->getMessage(), $e->getFile(), $e->getLine() ), 0, $e); } } /** * Debug info. * * @return array */ public function __debugInfo(): array { return [ 'action' => $this->action, 'args' => $this->args, 'request' => $this->request, 'response' => $this->response, 'viewBuilder' => $this->viewBuilder(), ]; } }