@param $args
@param $view

@return array
761788
public function customizeViewArguments($args, $view)
    {
        if ('view' == $view) {
            $session = $this->get('session');

            /** @var \MauticPlugin\MauticContactClientBundle\Entity\ContactClient $item */
            $item = $args['viewParameters']['item'];

            // Setup page forms in session
            if ('POST' == $this->request->getMethod() && $this->request->request->has('contactclient_chart')) {
                $chartFilterValues = $this->request->request->get('contactclient_chart');
            } else {
                $chartFilterValues = $session->get('mautic.contactclient.'.$item->getId().'.chartfilter')
                    ? $session->get('mautic.contactclient.'.$item->getId().'.chartfilter')
                    : [
                        'date_from' => $this->get('mautic.helper.core_parameters')->getParameter(
                            'default_daterange_filter',
                            'midnight -1 month'
                        ),
                        'date_to'   => 'midnight tomorrow -1 second',
                        'type'      => '',
                    ];
            }

            if ($this->request->query->has('campaign')) {
                $chartFilterValues['campaign'] = $this->request->query->get('campaign');
            }

            if (!isset($chartFilterValues['campaign']) || empty($chartFilterValues['campaign'])) {
                $chartFilterValues['campaign'] = null;
            }

            $session->set('mautic.contactclient.'.$item->getId().'.chartfilter', $chartFilterValues);

            //Setup for the chart and stats datatable
            /** @var \MauticPlugin\MauticContactClientBundle\Model\ContactClientModel $model */
            $model = $this->getModel('contactclient');

            $unit = $model->getTimeUnitFromDateRange(
                new \DateTime($chartFilterValues['date_from']),
                new \DateTime($chartFilterValues['date_to'])
            );

            $auditLog = $this->getAuditlogs($item);
            $files    = $this->getFiles($item);
            if (in_array($chartFilterValues['type'], [''])) {
                $stats = $model->getStats(
                    $item,
                    $unit,
                    new \DateTime($chartFilterValues['date_from']),
                    new \DateTime($chartFilterValues['date_to']),
                    $chartFilterValues['campaign']
                );
            } else {
                $stats = $model->getStatsBySource(
                    $item,
                    $unit,
                    $chartFilterValues['type'],
                    new \DateTime($chartFilterValues['date_from']),
                    new \DateTime($chartFilterValues['date_to']),
                    $chartFilterValues['campaign']
                );
            }

            $chartFilterForm = $this->get('form.factory')->create(
                'contactclient_chart',
                $chartFilterValues,
                [
                    'action' => $this->generateUrl(
                        'mautic_contactclient_action',
                        [
                            'objectAction' => 'view',
                            'objectId'     => $item->getId(),
                        ]
                    ),
                ]
            );

            $args['viewParameters']['auditlog']        = $auditLog;
            $args['viewParameters']['files']           = $files;
            $args['viewParameters']['stats']           = $stats;
            $args['viewParameters']['chartFilterForm'] = $chartFilterForm->createView();

            //unset($chartFilterValues['campaign']);
            $session->set('mautic.contactclient.'.$item->getId().'.chartfilter', $chartFilterValues);
        }

        return $args;
    }
946079
private function formatArgs(array $args)
    {
        $result = array();
        foreach ($args as $key => $item) {
            if ('object' === $item[0]) {
                $formattedValue = sprintf("<em>object</em>(%s)", $this->abbrClass($item[1]));
            } elseif ('array' === $item[0]) {
                $formattedValue = sprintf("<em>array</em>(%s)", is_array($item[1]) ? $this->formatArgs($item[1]) : $item[1]);
            } elseif ('string'  === $item[0]) {
                $formattedValue = sprintf("'%s'", htmlspecialchars($item[1], ENT_QUOTES | ENT_SUBSTITUTE, $this->charset));
            } elseif ('null' === $item[0]) {
                $formattedValue = '<em>null</em>';
            } elseif ('boolean' === $item[0]) {
                $formattedValue = '<em>' . strtolower(var_export($item[1], true)) . '</em>';
            } elseif ('resource' === $item[0]) {
                $formattedValue = '<em>resource</em>';
            } else {
                $formattedValue = str_replace("\n", '', var_export(htmlspecialchars((string) $item[1], ENT_QUOTES | ENT_SUBSTITUTE, $this->charset), true));
            }

            $result[] = is_int($key) ? $formattedValue : sprintf("'%s' => %s", $key, $formattedValue);
        }

        return implode(', ', $result);
    }
911602
public function load($view, $args = array())
    {
        $view = ltrim($view, '/');

        $segments = explode('/', str_replace('.', '/', $view));

        // Pop file from segments.
        $view = array_pop($segments);

        // Custom directory path.
        $pathOfView = app('path.base').'/'.implode('/', $segments);

        // Add temporary path with a hint type.
        $this->view->addNamespace('custom', $pathOfView);

        return $this->of('custom::'.$view, $args);
    }
22317
protected function getFormFromView(View $view)
    {
        $data = $view->getData();

        if ($data instanceof FormInterface) {
            return $data;
        }

        if (is_array($data) && isset($data['form']) && $data['form'] instanceof FormInterface) {
            return $data['form'];
        }

        return false;
    }
1249497
public function getAll($sql, array $args = [])
    {
        $query = $this->query($sql, $args);
        if (!$query) {
            return [];
        }
        
        $rs = $query->fetchAll(\PDO::FETCH_ASSOC);
        return $rs;
    }
835267
public function find($view)
    {
        // Check to see if the page exists in the database
        $vpage = Vpage::make($view);
        if (! empty($vpage)) {
            return $view . Vpage::EXTENSION_SEPARATOR . $vpage->pagetype;
        }

        throw new InvalidArgumentException("View [$view] not found in vpage table.");
    }
825076
public function getOutputFromView($view, array $parameters = array(),
        array $options = array())
    {
        $this->log(sprintf('Get converted output from view (%s).', $view));

        $html = $this->getTemplatingEngine()->render($view, $parameters);

        return $this->getOutputFromHtml($html, $options);
    }
509428
private function getValue($data, $view)
    {
        if (is_scalar($view)) {
            return false;
        }

        if (is_array($view) || $view instanceof ArrayAccess) {
            if (! isset($view[$data])) {
                return false;
            }

            return $view[$data];
        }

        if (is_object($view)) {
            if (! isset($view->{$data})) {
                return false;
            }

            return $view->{$data};
        }

        return false;
    }
215657
private function data($view) {


		$data['var'] = $this->module->get('var');

		if(isset($view['with']) ) {

			foreach((array) $view['with'] as $name => $value) {

				$data['var'][$name] = $value;
			}
		}

		$data['file'] = $this->getPath($view, $this->module->get('module'));


		return $data;
	}
295971
private function compile_arrays( $view )
	{	
		$tokens = token_get_all( $view );

		$tags = array( 0 => '' );
		$tag_index = 0;
		$in_tag = false;

		// parse all php tags out of the view
		foreach ( $tokens as $token ) 
		{
			if ( is_array( $token ) ) 
			{
				if ( $token[0] === T_OPEN_TAG )
				{
					$in_tag = true;
				}

				if ( $in_tag && !in_array( $token[0], array( T_INLINE_HTML ) ) ) 
				{				
					$tags[$tag_index] .= $token[1];
				}

				if ( $token[0] === T_CLOSE_TAG )
				{
					$in_tag = false;
					$tag_index++;
				}
			}
			else 
			{
				if ( $in_tag )
				{
					$tags[$tag_index] .= $token;
				}
			}
		}

		// lets make the tags search keys
		$tags = array_flip( $tags );

		// now search and replace var in the php sections
		foreach( $tags as $search => &$replace )
		{
			$replace = preg_replace_callback('/(\$[a-zA-Z0-9\_\.\-\>\;]+)/s', function( $match )
			{ 
				$var = $match[1];

				if ( strpos( $var, '.' ) !== false )
				{
					$buffer = '';
					$length = strlen( $var );
					$inside_arr = false;

					for( $i=0;$i<$length;$i++ )
					{
						$char = $var[$i];

						if ( $char == '.' && !$inside_arr  )
						{
							$buffer .= "['";
							$inside_arr = true;
						}
						else
						{
							if ( $inside_arr && in_array( $char, array( ';', '-', ',' ) ) )
							{
								$buffer .= "']";
								$inside_arr = false;
							}

							if ( $char == '.' )
							{
								$buffer .= "']['";
								$inside_arr = true;
							}
							else
							{
								$buffer .= $char;
							}
						}
					}

					if ( $inside_arr )
					{
						$buffer .= "']";
					}

					$var = $buffer;
				}

				return $var;

			}, $search );
		}

		return CCStr::replace( $view, $tags );
	}
922766
public function gather_data( View $view ) {
		$data = [];

		if ( $this->engine->bound( 'data' ) ) {
			$data = $this->engine->make( 'data' );
		}

		$data = array_merge( $view->get_data(), $data );
		$data = array_merge( $this->get_composer( $view ), $data );
		$data = array_merge( $this->get_wildcard_composer(), $data );

		foreach ( $data as $key => $value ) {
			if ( is_callable( $value ) ) {
				$data[$key] = call_user_func( $value, $view );
			}
		}

		$this->engine->bind( 'data', $data );
		$this->reset_composer( $view );
		$this->reset_wildcard_composer();

		return $data;
	}
1364517
public function get_composer( View $view ) {
		$view_name = $view->get_name();

		if ( isset( $this->composers[$view_name] ) ) {
			return $this->composers[$view_name];
		}

		return [];
	}
1056184
private function generateView($view)
    {
        return $this->indenter
            ->indent(view('scaffold-interface::template.views.'.$this->parser->getTemplate().'.'.$view,
                ['parser' => $this->parser, 'dataSystem' => $this->dataSystem])->render());
    }
574940
public function loadBladeTemplate($view, $module, array $args = array())
    {
        \Modularity\Helper\File::maybeCreateDir(MODULARITY_CACHE_DIR);

        if (!$module->templateDir) {
            throw new \LogicException('Class ' . get_class($module) . ' must have property $templateDir');
        }

        $template = \Modularity\Helper\Template::getModuleTemplate($view, $module);
        $templatePath = trailingslashit(dirname($template));
        $view = basename($template, '.blade.php');
        $view = basename($view, '.php');

        if (\Modularity\Helper\Template::isBlade($template)) {
            $blade = new Blade($templatePath, MODULARITY_CACHE_DIR);
            return $blade->view()->make($view, $module->data)->render();
        }

        return $this->loadTemplate($template, $module, $args);
    }
278888
private function makeDataForView($widget, array $args)
    {
        // Here we call the data method on the widget class.
        $viewData = \App::call($widget->controller, ...$args);

        if (($widget->presenter)) {
            // We make an object and call the `present` method on it.
            // Piping the data through the presenter before sending it to view.
            $viewData = \App::call($widget->presenter, [$viewData]);
        }

        $this->_viewData = $viewData;
    }
1070804
public function formatArgs(array $args)
    {
        $result = [];
        foreach ($args as $key => $item) {
            if ('object' === $item[0]) {
                $parts = explode('\\', $item[1]);
                $short = array_pop($parts);
                $formattedValue = sprintf('<em>object</em>(<abbr title="%s">%s</abbr>)', $item[1], $short);
            } elseif ('array' === $item[0]) {
                $formattedValue = sprintf('<em>array</em>(%s)', \is_array($item[1]) ? $this->formatArgs($item[1]) : $item[1]);
            } elseif ('string' === $item[0]) {
                $formattedValue = sprintf("'%s'", htmlspecialchars($item[1], ENT_QUOTES, $this->getCharset()));
            } elseif ('null' === $item[0]) {
                $formattedValue = '<em>null</em>';
            } elseif ('boolean' === $item[0]) {
                $formattedValue = '<em>'.strtolower(var_export($item[1], true)).'</em>';
            } elseif ('resource' === $item[0]) {
                $formattedValue = '<em>resource</em>';
            } else {
                $formattedValue = str_replace("\n", '', var_export(htmlspecialchars((string) $item[1], ENT_QUOTES, $this->getCharset()), true));
            }

            $result[] = \is_int($key) ? $formattedValue : sprintf("'%s' => %s", $key, $formattedValue);
        }

        return implode(', ', $result);
    }
160786
public function watch($view, $args = array(), $type = null)
    {
        try {
            return $this->scope($view, $args, $type);
        } catch (\InvalidArgumentException $e) {
            return $this->of($view, $args, $type);
        }
    }