preparing auto attached groups before registering any asset files
@return self object
323725
private function prepareAssets()
	{
		$lib = $this;
		$attached_groups = $this->getAttachedGroups();
		array_walk($lib->attached_groups, function($group_name) use($lib){
			$groups = $lib->getGroups();
			$group_contents = $groups[$group_name];
			array_walk($group_contents, function($value, $key) use($lib, $group_name){
				switch($key)
				{
					case 'css':
					array_walk($value, function($value, $key) use($lib, $group_name){
						$lib->registerCss($group_name.'/'.$value,$group_name);
					});
					break;
					case 'js':
					array_walk($value, function($value, $key) use($lib, $group_name){
						$lib->registerJs($group_name.'/'.$value,$lib->getOption('jsPosition'),$group_name);
					});
					break;
				}
			});
		});
		return $this;
	}
1068948
public static function autodiscover()
    {
        // Search through all composer packages in vendor
        foreach (glob(BASE_PATH . '/vendor/*', GLOB_ONLYDIR) as $vendor) {
            foreach (glob($vendor . '/*', GLOB_ONLYDIR) as $directory) {
                if (file_exists($directory . '/_register_database.php')) {
                    include_once($directory . '/_register_database.php');
                }
            }
        }
    }
946950
public function registerAssets()
    {
        $view = $this->getView();
        RemoteModalAsset::register($view);
 	$uuid = uniqid();

    	$js = "rm_$uuid = new RemoteModal('#$this->id');\n";
    	$js .= "$(document).on('click', '[role=\"$this->id\"]', function (event){ \n ";
        $js .= "event.preventDefault(); \n";
        $js.= "rm_$uuid.open(this, null);\n";
    	$js .="});\n";
	$view->registerJs($js,\yii\web\View::POS_READY);
    }
1220930
protected function prepareSlackAttachment()
    {
        $attachments = [ ];

        foreach ($this->stats as $stats) {
            $name = $stats['name'];

            $fields = [ ];

            foreach ($stats['values'] as $stat) {
                $count = $stat['value'];
                $since = $stat['since'];

                $fields[] = [
                    "title" => "Since " . $since,
                    "value" => $count,
                    "short" => true
                ];
            }

            $attachments[] = [
                'color'  => 'grey',
                "title"  => "New " . $name . "s",
                "fields" => $fields
            ];
        }

        return $attachments;
    }
156596
public function attachScripts()
    {
        if ($this->isScriptsAttached())
            return $this;

        $view = $this->getView();
        $view->inlineScript()
            // we can change target of js files with static_uri_helper config key
            ->appendFile($view->staticsUri('Yima.Widgetator.JS.Jquery.Json'))
            ->appendFile($view->staticsUri('Yima.Widgetator.JS.Jquery.Ajaxq'))
            ->appendFile($view->staticsUri('Yima.Widgetator.JS.Jquery.WidgetAjaxy'))

            /*
            ->appendScript(
                str_replace(
                    '{{url}}',
                    $view->url('yimaWidgetator_restLoadWidget'),
                    file_get_contents(__DIR__.DS.'WidgetAjaxy.js')
                )
            )
            */
        ;

        $this->isScriptAttached = true;

        return $this;
    }
982118
private function localizeAsset()
    {
        if ($this->getArgument('localize')) {
            wp_localize_script(
                $this->getSlug(),
                $this->getArgument('localize')['var'],
                $this->getArgument('localize')['callback']
            );
        }

        return $this;
    }
1077175
protected function setUp()
	{
		$this->register(array(
			'finding' => Finding::class,
			'route' => Route::class,
			'group' => Group::class
			));

        $this->addDefaultGroupHandler(new ClosureHandler());
        $this->addDefaultGroupHandler(new ArrayHandler());
//        $this->addDefaultGroupHandler(new PathHandler());

		return $this;
	}
1045340
protected function setUp()
    {
        if (empty($this->asset)) {
            return;
        }

        $this->asset = $this->normalizePath($this->asset);
        $this->realPath = $this->locateResource();

        // The asset has not been located, so the full path is the asset itself
        if (null === $this->realPath) {
            $this->realPath = $this->asset;
        }
        $this->absolutePath = $this->retrieveBundleWebFolder();
    }
803997
public function targetId(): self
    {
        $this->set('target', 'id');

        $this->addBeforeRender(function () {
            $value = (string) $this->get('value');

            if (! ctype_digit($value)) {
                return;
            }

            /** @var Attachment $attach */
            $attach = Dashboard::model(Attachment::class);

            $url = optional($attach::find($value))->url();

            $this->set('url', $url);
        });

        return $this;
    }
393988
public function prepareAssets($assets_directory, \Smarty_Internal_Template $smarty)
    {
        // Be sure to use the proper path separator
        if (DS != '/') {
            $assets_directory = str_replace('/', DS, $assets_directory);
        }

        // Set the current template assets directory
        self::$assetsDirectory = $assets_directory;

        /** @var SmartyParser $smartyParser */
        $smartyParser = $smarty->smarty;

        $this->prepareTemplateAssets($smartyParser->getTemplateDefinition(), $assets_directory, $smartyParser);
    }
226265
public function registerAssets()
    {
        $view = $this->getView();
        $id = $this->options['id'];
        $settings = $this->settings;
        $assets = $this->assets;
        if ($this->preset) {
            $preset = $this->getPreset($this->preset);
            if (isset($preset['settings'])) {
                $settings = ArrayHelper::merge($preset['settings'], $settings);
            }
            if (isset($preset['assets'])) {
                $assets = ArrayHelper::merge($preset['assets'], $assets);
            }
        }
        $settings = Json::encode($settings);
        $js = "CodeMirror.fromTextArea(document.getElementById('$id'), $settings);";
        $view->registerJs($js);
        CodemirrorAsset::register($this->view, $assets);
    }
977789
public function setGroups($groups): self
    {
        if ($groups === null) {
            $this->groups = [];

            return $this;
        }

        if (is_array($groups)) {
            $this->groups = $groups;

            return $this;
        }

        $this->groups = explode(',', $groups);

        return $this;
    }
1197474
protected function registerAssets()
    {
        if ($this->hasTitle()) {
            $view = $this->getView();
            AlertAsset::register($view);
            $js = "sweetAlert({$this->getOptions()}, {$this->callback});";
            $view->registerJs($js, $view::POS_END);
        }
    }
942991
private function initialize()
    {
        foreach ($this->globs as $glob) {
            $glob = VarUtils::resolve($glob, $this->getVars(), $this->getValues());

            if (false !== $paths = glob($glob)) {
                foreach ($paths as $path) {
                    if (is_file($path)) {
                        $asset = new FileAsset($path, array(), $this->getSourceRoot(), null, $this->getVars());
                        $asset->setValues($this->getValues());
                        $this->add($asset);
                    }
                }
            }
        }

        $this->initialized = true;
    }
340720
public function init()
    {
        craft()->on('assets.onSaveAsset', function (Event $event) {
            $this->copyAsset($event->params['asset']);
        });

        craft()->on('assets.onReplaceFile', function (Event $event) {
            $this->copyAsset($event->params['asset']);
        });

        craft()->on('assets.onBeforeDeleteAsset', function (Event $event) {
            $this->deleteAsset($event->params['asset']);
        });
    }
1112849
public function requireEditorAssets()
    {
        $this->assets->requireAsset('core/file-manager');
        $this->assets->requireAsset('editor/ckeditor4');

        $plugins = $this->pluginManager->getSelectedPluginObjects();

        foreach ($plugins as $plugin) {
            /** @var Plugin $plugin */
            $group = $plugin->getRequiredAssets();
            $this->assets->requireAsset($group);
        }
    }
1016355
protected function registerAttachment()
	{
		$this->app->bind('Attachment', function($app, $params)
        {
			$config = $app->make('Config', array('name' => $params['name'], 'options' => $params['options']));
			$interpolator = $app->make('Interpolator');
			$imageProcessor = $app->make($params['options']['image_processing_library']);
			$resizer = $app->make('Resizer', array('imageProcessor' => $imageProcessor));
			$IOWrapper = $app->make('IOWrapper');

            $attachment = new Attachment($config, $interpolator, $resizer, $IOWrapper);
            
            $storageDriver = $app->make($params['options']['storage'], array('attachment' => $attachment));
            $attachment->setStorageDriver($storageDriver);

            return $attachment;
        });
	}