@param array|object $data
@param string       $name

@return null|string
421857
public function resolveFileUrl($data, string $name)
    {
        $value = '';
        if (null !== $data) {
            if (is_array($data) && isset($data[$name])) {
                $value = $data[$name];
            } elseif (is_object($data) && property_exists($data, $name)) {
                $value = $data->{$name};
            }

            return is_string($value) ? $value : '';
        }

        return $value;
    }
256168
public function show($name = null, $data = []) {
        Factory::timer()->record('view render');
        return $this->showContent($this->renderHtml($name, $data));
    }
829686
private function getView(string $name, array $data = [])
    {
        $filesystemLoader = new FilesystemLoader(__DIR__.'/views/%name%');
        $templating = new PhpEngine(new TemplateNameParser(), $filesystemLoader);
        return $templating->render($name . '.phtml', $data);
    }
324570
public function getVar($name)
    {
        return isset($this->data[$name]) ? $this->data[$name] : null;
    }
885026
public function triggerEvent($name, array $data = [])
    {
        try {
            /** @var EventInterface $event */
            $event = $this->createEventObject($name, $data);
        } catch (\InvalidArgumentException $exception) {
            return $this;
        }

        foreach ($this->options['events'][$name]['listeners'] as $eventListener) {
            if ($event->isPropagationStopped()) {
                $this->loggerInstance->makeLogEvent($name, $eventListener, self::EVENT_STATUS_BREAK);
                break;
            }

            $this->executeListener($eventListener, $event, $name);
        }

        return $this;
    }
1220079
private function getData($data, $name = null, $default = null)
    {
        if ($name == null) {
            return $data;
        }

        $value = $default;
        if (is_array($data) && array_key_exists($name, $data)) {
            $value = $data[$name];
        }

        return $value;
    }
924171
public function render($name, array $data = [])
    {
        $content = $this->partial($name, $data);

        if (isset($this->layout)) {
            $template = new PhpTemplate($this->manager);
            $template->sections['content'] = $content;
            return $template->render($this->layout, array_merge($data, $this->layoutData));
        }
        
        return $content;
    }
535982
public static function fromArray(array $data)
    {
        $result = '';
        foreach ($data as $name => $value) {
            $value = StringHelper::toString($value, "'", Serialize::SERIALIZE_JSON);
            $result .= "$name=$value; ";
        }

        return $result === '' ? null : rtrim($result);
    }
529238
public function getAttribute($name)
    {
        return array_key_exists($name, $this->data['data']) ? $this->data['data'][$name] : null;
    }
1314969
protected function renderHtml($name = null, $data = []) {
        if (is_array($name)) {
            $data = $name;
            $name = null;
        }
        return $this->renderFile($this->getViewFile($name), $data);
    }
164684
public function getView($name, $data = [])
    {
        $view = 'missing-page';

        if (view()->exists('page::' . $name)) {
            $view = $name;
        }

        return view('page::' . $view, $data);
    }
729444
public function __getData(string $name)
    {
        if (isset($this->data[$name])) {
            return $this->data[$name];
        }

        return null;
    }
451935
public function setCustomActions($name, $data = null)
    {
        $actions = is_array($name) ? $name : [$name => $data];

        foreach ($actions as $key => $value) {
            $this->customActions[$key] = $value;
        }

        return $this;
    }
537189
public function param($name = '')
    {
        switch ($this->method) {
            case 'POST':
                $data = $this->post();
                break;
            case 'GET':
                $data = $this->get();
                break;
        }

        if (empty($name)) {
            return $data;
        } else {
            return isset($data[$name]) ? $data[$name] : null;
        }
    }
344690
public function load($name)
  {
    if (isset($this->_data[$name])) {
      if (is_null($this->_data[$name])) {
        $data = array();
      } else {
        $data = $this->_data[$name];
      }
    } else {
      if (is_null($this->_stored)) {
        $data = array();
      } else {
        $data = $this->_stored->load($name);
      }
    }
    
    return $data;
  }
1015834
public function make(string $name, array $data = [], \Closure $callback = null)
    {
        $this->setWidgetName($name);
        $this->data = $data;
        /*
         | If second param given as closure then we will
         | return callback
         */
        if (!is_null($callback) && $callback instanceof \Closure) {
            return $callback($this);
        }

        /*
         | return object
         */
        return $this->render();
    }
1356294
protected function encode($name, $data)
    {
        if (is_string($data)) {
            return $data;
        }

        $data = json_encode($data);

        if (json_last_error()) {
            throw new Exception(
                "Erro json encode [ {$name} ] - " . $this->lastJsonErrorMessage(json_last_error()), 500
            );
        }

        return $data;
    }