Add the asset to the current list
@param string $type the asset type: img, css, js, audio, video, font, etc.
@param string $uri the asset URI
545947
private function addAsset($type, $uri)
    {
        if(!array_key_exists($type, $this->assets)){
            $this->assets[$type] = array();
        }
        if(!empty($uri) && !in_array($uri, $this->assets[$type])){
            $this->assets[$type][] = $uri;
        }
    }
54165
public function addIndex($type, $index)
    {
        if (!isset($this->indexes[$type])) {
            $this->indexes[$type] = [];
        }

        $this->indexes[$type][] = $index;
    }
742242
private function add(string $name, string $type) : bool
  {
    $maps = ModulusCLI::$appdir . 'app' . DIRECTORY_SEPARATOR . 'Http' . DIRECTORY_SEPARATOR . 'QueryMaps';
    $map = $maps . DIRECTORY_SEPARATOR . $name . '.php';
    $namespace = '';

    if (substr_count($name, '/') > 0) {
      ModulusCLI::_dir(substr($map, 0, strrpos($map, DIRECTORY_SEPARATOR)));
      $namespace = substr($name, 0, strrpos($name, DIRECTORY_SEPARATOR));
      $name = str_replace($namespace . DIRECTORY_SEPARATOR, '', $name);

      $namespace = '\\' . str_replace('/', '\\', $namespace);
    }

    ModulusCLI::_dir($maps);

    if (strtolower($type) == 'model') $type = 'map_template';
    if (strtolower($type) == 'group') $type = 'map_group_template';

    $content = Template::asset($type);
    $content = str_replace('{map_name}', $name, $content);
    $content = str_replace('{namespace}', $namespace, $content);

    if (file_exists($map)) {
      return false;
    }
    else {
      file_put_contents($map, $content);
      return true;
    }
  }
500300
public function pasteFile($type)
    {
        $this->event(YouweFileManagerEvents::BEFORE_FILE_PASTED);
        $this->resolveImage();
        $this->getDriver()->pasteFile($this->getCurrentFile(), $type);
        $this->event(YouweFileManagerEvents::AFTER_FILE_PASTED);
    }
1082326
public function addCallback( $type, $callback ) {
		if ( !isset( $this->callbacks[$type] ) ) {
			$this->callbacks[$type] = [];
		}
		$this->callbacks[$type][] = $callback;
	}
1292549
public function setType( $type )
	{
		if ( $type == $this->getType() ) { return; }

		$this->_checkType( $type );

		$this->_values['type'] = (string) $type;
		$this->setModified();
	}
1096151
private function addExternalResources($type, $href)
    {
        $resources = array();
        if ($this->externalResources->has($type)) {
            $resources = $this->externalResources->get($type);
        }

        if (!in_array($href, $resources)) {
            $resources[] = $href;
        }

        $this->externalResources->set($type, $resources);
    }
556833
protected function setupAssets($type, $files = [])
    {
        $srcFiles = [];
        $minFiles = [];
        foreach ($files as $file) {
            $srcFiles[] = "{$file}.{$type}";
            $minFiles[] = "{$file}.min.{$type}";
        }
        if (empty($this->$type)) {
            //$this->$type = YII_DEBUG ? $srcFiles : $minFiles;
            $this->$type = $srcFiles;
        }
    }
1311425
public function addDefaultPerms(ResourceType $type)
    {
        /** @var MaskDecoder[] $decoders */
        $decoders = $this->maskRepo->findBy(['resourceType' => $type]);

        $actionNames = [];
        foreach ($decoders as $decoder) {
            $actionNames[] = $decoder->getName();
        }

        $createdPerms = [];
        // Add only non-existent default actions
        $defaultActions = array_diff(self::$defaultActions, $actionNames);

        foreach ($defaultActions as $i => $action) {
            $maskDecoder = new MaskDecoder();
            $maskDecoder->setValue(pow(2, $i));
            $maskDecoder->setName($action);
            $maskDecoder->setResourceType($type);
            $this->om->persist($maskDecoder);
            $createdPerms[$action] = $maskDecoder;
        }

        $this->om->flush();
    }
213089
public function addFileType($type): self
    {
        $type = '.' . trim($type, '. ');

        if (!isset($this->watchedTypes[$type])) {
            $this->watchedTypes[$type] = true;
        }

        return $this;
    }
354568
public function dispatchAssets($type)
    {
        switch ($type) {
            case 'css':
            case 'js':
                $headers = [
                    'Content-Type' => $type === 'css' ? 'text/css; charset=utf-8' : 'text/javascript; charset=utf-8',
                    'Cache-Control' => 'max-age=86400',
                ];
                $content = $this->renderBuffer(function () {
                    return $this->bar->dispatchAssets();
                });
                break;
            default:
                $headers = [
                    'Content-Type' => 'text/javascript; charset=utf-8',
                ];
                $content = $this->dispatch();
                break;
        }

        return [
            array_merge($headers, [
                'Content-Length' => strlen($content),
            ]),
            $content,
        ];
    }
951073
public function addCredential($type)
    {
        $this->data_type = $type;

        $this->setTitleEditCredential();
        $this->setBreadcrumbEditCredential();

        $this->credential->callHandler($type, 'edit');
    }
1358867
public function registerStyleAsset($path, $type = null, $media = null, $rel = 'stylesheet')
    {
        if ( ! array_key_exists($path, $this->styleAssets)) {
            $this->styleAssets[ $path ] = [
                'type'  => $type,
                'media' => $media,
                'rel'   => $rel,
            ];
        }

        return $this;
    }
866303
public function setOutputType($type)
    {
        if (preg_match('/(png|gif|jpe?g|tif?f|webp)/i', $type)) {
            $this->outputType = sprintf('image/%s', strtolower($type));
            return;
        } else {
            throw new \InvalidArgumentException(sprintf('Invalid output format %s', $type));
        }
    }
552171
public function setType($type)
    {
        switch($type)
        {
            case self::YOUTUBE:
                return new Services\Youtube();
                break;

            case self::VIMEO:
                return new Services\Vimeo();
                break;

            default:
                throw new \InvalidArgumentException("$type is not a valid video site");
        }
    }
1298576
public function setOutputType($type)
    {
        if (preg_match('/(png|gif|jpe?g|tif?f|webp)/i', $type)) {
            $this->resource->setImageFormat($type);
        } else {
            throw new \InvalidArgumentException(sprintf('Invalid output format %s', $type));
        }
    }
471760
public function addType(Type $type)
    {
        $name = $type->getName();

        if (!Type::hasType($name)) {
            Type::addType($name, get_class($type));
        }

        $this->types[$name] = $type;
    }