Renders the index page

@param GluggiFinder $finder
@param GluggiConfig $config

@return Response
187331
public function index (GluggiFinder $finder, GluggiConfig $config)
    {
        return $this->render("@Gluggi/Gluggi/index.html.twig", [
            "types" => $finder->getAllTypes(),
            "pageTitle" => "Index",
            "infoAction" => $config->getInfoAction(),
            "customTitle" => $config->getTitle(),
        ]);
    }
144146
public function run( $id, $config = [] ) {

		// Find Model
		$model = $this->modelService->getById( $id );

		// Delete/Render if exist
		if( isset( $model ) ) {

			$type = $this->modelService->getParentType();

			$gallery = $model->modelContent->gallery;

			if( empty( $gallery ) ) {

				$name	= !empty( $model->name ) ? $model->name : $model->title;
				$title	= !empty( $model->title ) ? $model->title : $name;

				$gallery = $this->galleryService->createByParams([
					'type' => $type, 'status' => Gallery::STATUS_ACTIVE,
					'name' => $name, 'title' => $title,
					'siteId' => Yii::$app->core->siteId
				]);

				Yii::$app->factory->get( 'modelContentService' )->linkModel( $model->modelContent, 'galleryId', $gallery );
			}

			return $this->controller->render( 'items', [
				'parent' => $model,
				'gallery' => $gallery,
				'items' => $gallery->files
			]);
		}

		// Model not found
		throw new NotFoundHttpException( Yii::$app->coreMessage->getMessage( CoreGlobal::ERROR_NOT_FOUND ) );
	}
1099664
protected function run(Config $config): ResultInterface
    {
        $includes = $config->compileIncludes();

        return $this->validator->validate(...$includes);
    }
283899
public function renderAction(ComponentInterface $component, array $config, ContentInterface $content)
    {
        //
        // Data validation
        //
        if (!$component->getData('text')) {
            $this->container->get('logger')->warning(
                'Incomplete text component, "text" field has to be fullfilled.',
                array(
                    'component_id' => $component->getId(),
                    'content_class' => get_class($content),
                    'content_id' => $content->getId()
                )
            );

            return new Response('');
        }

        $templateParameters = array(
            'config' => $config,
            'content' => $content,
        );

        //
        // Medias
        //
        $templateParameters['images'] = (new EntityCollection((array) $component->getData('images')))
            ->map(function ($imageId) {
                return $this->get('synapse.image.loader')->retrieve($imageId);
            })
            ->filter(function ($image) {
                return (bool) $image;
            })
            ->map(function (ImageInterface $image) use ($config) {
                return $image->setDefaultFormat(
                    empty($config['images']['format']) ? null : $config['images']['format']
                );
            })
        ;
        if (!$config['images']['multiple']) {
            $templateParameters['image'] = $templateParameters['images']->first();
        }

        //
        // Resolution
        //
        return $this->get('synapse')
            ->createDecorator($component)
            ->decorate($templateParameters)
        ;
    }
177835
protected function run(Config $config): ResultInterface
    {
        if (! method_exists('WPSEO_Utils', 'is_development_mode')) {
            return ResultFactory::makeError($this, 'WPSEO_Utils::is_development_mode method not exist');
        }

        return WPSEO_Utils::is_development_mode()
            ? ResultFactory::makeFailure($this, 'Yoast SEO is in development mode')
            : ResultFactory::makeSuccess($this);
    }
1222565
public function htmlTitle (GluggiConfig $config, $pageTitle)
    {
        $segments = !is_array($pageTitle)
            ? [$pageTitle]
            : $pageTitle;

        $mainTitle = "Gluggi";

        if (null !== $config->getTitle())
        {
            $mainTitle .= " ({$config->getTitle()})";
        }

        $segments[] = $mainTitle;

        return new Response(
            htmlspecialchars(
                implode(" // ", $segments)
            )
        );
    }
1172914
public function addConfig($config, $watcher)
  {
    if (!$this->root) {
      return;
    }
    $config = realpath($config);

    $filesystem = new Filesystem();
    $relativePath = $filesystem->makePathRelative($config, $this->root);
    if (substr($relativePath, 0, 2) == "..") {
      return;
    }

    if (!isset($this->configs[$watcher])) {
      $this->configs[$watcher] = array();
    }
    $this->configs[$watcher][] = $config;
  }
1047943
public function pages($config = array())
    {
        $config = new ModelPaginator($config);
        $config->append(array(
            'url'      => null,
            'total'    => 0,
            'display'  => 2,
            'offset'   => 0,
            'limit'    => 0,
            'show_limit' => true,
            'show_count' => false
        ))->append(array(
            'show_pages' => $config->count !== 1
        ));

        $pages = $config->pages;

        $html = '';

        $html .= $pages->previous->active ? '<li>'.$this->page($pages->previous, $config->url).'</li>' : '';

        $previous = null;
        foreach ($pages->offsets as $page)
        {
            if ($previous && $page->page - $previous->page > 1) {
                $html .= '<li class="k-is-disabled"><span>&hellip;</span></li>';
            }

            $html .= '<li class="'.($page->active && !$page->current ? '' : 'k-is-active').'">';
            $html .= $this->page($page, $config->url);
            $html .= '</li>';

            $previous = $page;
        }

        $html  .= $pages->next->active ? '<li>'.$this->page($pages->next, $config->url).'</li>' : '';

        return $html;
    }
1271767
public function load(array $config)
    {
        foreach ($config as $id => $classname) {
            $serviceId = $this->generateBundleServiceId($id);

            if (false === $this->container->hasDefinition($serviceId)) {
                $baseDir = $this->buildBundleBaseDirectoryFromClassname($classname);
                $this->bundlesBaseDir[$serviceId] = $baseDir;
                $this->container->setDefinition(
                    $serviceId,
                    $this->buildBundleDefinition($classname, $id, $baseDir)
                );

                $this->bundleInfos[$id] = [
                    'main_class' => $classname,
                    'base_dir'   => $baseDir,
                ];
            }
        }

        if (0 < count($this->bundlesBaseDir)) {
            $this->loadFullBundles();
        }
    }
774331
public function render(Document $reportDom, Config $config)
    {
        foreach ($reportDom->firstChild->query('./report') as $reportEl) {
            foreach ($reportEl->query('.//table') as $tableEl) {
                $this->renderTableElement($tableEl, $config);
            }
        }
    }
395823
public function renderContainer( $config = [] ) {

		$containerView = CodeGenUtil::isAbsolutePath( $this->containerView, true ) ? $this->containerView : "$this->template/$this->containerView";

		return $this->render( $containerView, [ 'widget' => $this ] );
	}
207290
private function loadSerializerClassMap(Finder $finder)
    {
        $classMap = [];
        foreach ($finder as $file) {
            $document = new \DOMDocument();
            $document->load($file);

            $xpath = new \DOMXPath($document);

            $classMap = array_reduce(
                iterator_to_array($xpath->query('//class')),
                function (array $classMap, \DOMElement $element) {
                    $classMap[$element->getAttribute('name')] = $element;
                    return $classMap;
                },
                $classMap
            );
        }

        return $classMap;
    }
1004230
public function renderWidget( $config = [] ) {

		if( !isset( $this->slug ) ) {

            throw new InvalidConfigException( "The slider slug option is required." );
        }

		$this->model = $this->modelService->getBySlug( $this->slug );

		$model	= $this->model;
		$items 	= [];

		if( !isset( $model ) ) {

			return "<div>Slider having slug set to $this->slug does not exist. Please create it via admin.</div>";
        }

		// Configure
		$this->configureSlider();

		// Views Path
		$slidePath = "$this->template/slide";

		// Generate Slides Html

		$slides = $model->slides;

        foreach( $slides as $slide ) {

            $items[] = $this->render( $slidePath, [
				'widget' => $this, 'fxOptions' => $this->fxOptions, 'slide' => $slide,
				'genericContent' => $this->genericContent
			]);
        }

		// Register JS
		$modelOptions	= json_encode( $this->fxOptions );
		$modelJs		= "jQuery( '.fx-" . $model->slug . "' ).foxslider( $modelOptions );";

		$this->getView()->registerJs( $modelJs, View::POS_READY );

		$htmlContent = implode( "\n", $items );

		if( $this->wrap ) {

			// Apply model options - Overrides widget and template options
			$htmlOptions = json_decode( $model->htmlOptions, true );

			$options = !empty( $htmlOptions ) ? ArrayHelper::merge( $this->options, $htmlOptions ) : $this->options;

			//$options[ 'id' ] = "fxs-{$model->slug}";

			$classOption = isset( $options[ 'class' ] ) ? $options[ 'class' ] : null;
			$classOption = !empty( $classOption ) ? "fx $classOption fx-{$model->slug}" : "fx fx-{$model->slug}";

			$options[ 'class' ] = $classOption;

			return Html::tag( 'div', $htmlContent, $options );
		}

		return $htmlContent;
    }
558609
public function renderWidget( $config = [] ) {

		if( !isset( $this->title ) ) {

			switch( $this->template ) {

				case 'message': {

					$this->title = 'Message';

					break;
				}
				case 'success': {

					$this->title = 'Success';

					break;
				}
				case 'warning': {

					$this->title = 'Alert';

					break;
				}
				case 'error': {

					$this->title = 'Error';

					break;
				}
			}
		}

		if( !isset( $this->size ) ) {

			if( $this->modal && in_array( $this->template, [ 'message', 'success', 'warning', 'error' ] ) ) {

				$this->size = 'medium';
			}
		}

		$widgetHtml = $this->render( $this->template, [
			'widget' => $this
		]);

		return $widgetHtml;
	}
616307
public function load(Config $config)
    {
        $parsed = [];

        if ($this->isFile($this->getPath())) {
            $parsed = $this->parse($this->fetch($this->getPath()));
        }

        if (!is_array($parsed)) {
            $parsed = [];
        }

        $this->apply($parsed, $config);
    }
289934
public function actionAll( $config = [] ) {

		$modelClass = $this->modelService->getModelClass();

		$dataProvider = $this->modelService->getPage();

		return $this->render( 'all', [
			'dataProvider' => $dataProvider,
			'statusMap' => $modelClass::$statusMap
		]);
	}
323654
protected function run(Config $config): ResultInterface
    {
        $outdatedPlugins = WP_CLI::runcommand(
            'plugin list --update=available --fields=name,version,update_version --format=json',
            [
                'return' => true,
                'parse' => 'json',
                'launch' => true,
                'exit_error' => false,
            ]
        );

        $excludes = $config->compileExcludes([]);
        $outdatedPlugins = array_filter($outdatedPlugins, function (array $plugin) use ($excludes): bool {
            return ! in_array($plugin['name'], $excludes, true);
        });

        $messages = array_map(function (array $plugin): string {
            return "${plugin['name']} (${plugin['version']} => ${plugin['update_version']})";
        }, $outdatedPlugins);

        return (empty($messages))
            ? ResultFactory::makeSuccess($this)
            : ResultFactory::makeFailure(
                $this,
                array_merge(['Plugin updates available:'], $messages)
            );
    }