build static site
@param  string $type accepts public or local
@throws \InvalidArgumentException
184300
private function build(string $type)
    {
        if (!in_array($type, ['public', 'local'])) {
            throw new \InvalidArgumentException('type accepts public or local');
        }
        if (!$this->called) {
            $url = $type === 'public' ? $this->config->env['public'] : $this->config->env['local'];
            $url = rtrim($url, '/');
            Util::clearDirectory($this->config->path('cache'));
            $articles        = ArticleGenerator::getArticles($this->config->path('article'), $url);
            $paths = $this->config->paths;
            $articles->each(function ($article) use ($paths) {
                $article->createCache("{$paths['cache']}/article");
            });
            $this->generator = new SiteGenerator($this->config, $articles);
            $this->called    = true;
        }
        Util::clearDirectory($this->config->path($type), true);
        $this->generator->generate($type);
    }
996442
public function setEncodingType($type)
    {
        if ($type === false || $type === self::RFC1738 || $type === self::RFC3986) {
            $this->encoding = $type;
        } else {
            throw new \InvalidArgumentException('Invalid URL encoding type');
        }

        return $this;
    }
1159930
public function build($type)
    {
        if (!isset($this->types[$type])) {
            throw new \Exception("Unknown request type.");
        }
        return new $this->types[$type]();
    }
945160
public function setType($type)
    {
        if (gettype($type) === 'string') {
            $this->type = $type;
        } else {
            $msg = "Type must be a string, '" . gettype($type) . "' given.";
            throw new InvalidArgumentException($msg);
        }
    }
224229
public function setType($type)
    {
        if (!in_array($type, array(
            self::TYPE_CORE,
            self::TYPE_DISTRIBUTION,
            self::TYPE_CAMPAIGN,
            self::TYPE_MILESTONE,
            self::TYPE_ACTIVITY,
            self::TYPE_OPERATION,
            self::TYPE_CHANNEL,
            self::TYPE_LOCATION,
            self::TYPE_SECURITY,
            self::TYPE_REPORT,
            self::TYPE_REPORT_ANALYTICS,
            self::TYPE_REPORT_BUDGET,
            self::TYPE_REPORT_SALES,
            self::TYPE_HOOK,
            self::TYPE_SYMFONY,
        ))) {
            throw new \InvalidArgumentException("Invalid bundle type.");
        }
        $this->type = $type;

        return $this;
    }
127127
private function constructFile($type)
    {
        // try to see if we have user defined plugin
        $class = 'PhroznPlugin\\Site\\View\\' . ucfirst($type);
        if (!class_exists($class)) {
            $class = 'Phrozn\\Site\\View\\' . ucfirst($type);
            if (!class_exists($class)) {
                //throw new \RuntimeException("View of type '{$type}' not found..");
                $class = 'Phrozn\\Site\\View\\Plain';
            }
        }
        $object = new $class;
        $object->setInputRootDir($this->getInputRootDir());
        $object->setInputFile($this->getInputFile());
        return $object;
    }
950441
public function setType($type)
    {
        if (!in_array($type, self::TYPES)) {
            throw new \InvalidArgumentException("bad type {$type}");
        }
        $this->type = $type;

        return $this;
    }
205921
private function createAdSection($type)
    {
        // Check Ad type
        $adTypeClassName = '\\Sokil\\Vast\\Ad\\' . $type;
        if (!class_exists($adTypeClassName)) {
            throw new \InvalidArgumentException(sprintf('Ad type %s not supported', $type));
        }
        
        // create dom node
        $adDomElement = $this->domDocument->createElement('Ad');
        $this->domDocument->documentElement->appendChild($adDomElement);

        // create type element
        $adTypeDomElement = $this->domDocument->createElement($type);
        $adDomElement->appendChild($adTypeDomElement);
        
        // create ad section
        $adSection = new $adTypeClassName($adDomElement);
        
        // cache
        $this->vastAdNodeList[] = $adSection;
        
        return $adSection;
    }
1055894
public function make($type)
    {
        if ($instance = array_get($this->resolved, $type)) {
            return $instance;
        }

        return $this->build($type);
    }
989847
public function load($resource, $type = null)
    {
        $config = include $resource;

        if (!is_array($config)) {
            throw new \InvalidArgumentException(
                sprintf('The file "%s" did not return a valid PHP array when included', $resource)
            );
        }

        return $config;
    }
399234
public function load($resource, $type = null) 
    {
        $path = $this->locator->locate($resource);
        
        if (!stream_is_local($path)) {
            throw new \InvalidArgumentException(sprintf('This is not a local file "%s".', $path));
        }

        if (!file_exists($path)) {
            throw new \InvalidArgumentException(sprintf('File "%s" not found.', $path));
        }

        $returnArray = include $path;
        
        if(false === is_array($returnArray)) {
            throw ConfigException::configNotArray($path);
        }
        
        $this->loaded[$resource] = $path;
        
        return $returnArray;
    }
1194794
public function setType($type)
    {
        if (!isset($this->types[$type])) {
            throw new InvalidArgumentException('type must be one of:' . implode(', ', array_keys($this->types)));
        }

        $this->type = $type;

        return $this;
    }
39844
public function addResource($resource, string $type = 'file'): void
    {
        if (is_array($resource)) {
            $this->addResourceArray($resource);
            return;
        }

        if (is_string($resource)) {
            switch ($type) {
                case 'json':
                    $this->addResourceString($resource);
                    break;
                case 'file':
                    $this->addResourceFile($resource);
                    break;
                default:
                    throw new \InvalidArgumentException("Invalid resource type");
            }
        }
    }
338198
public static function create($type)
	{
		$generator = sprintf("Keygen\Generators\%sGenerator", ucfirst($type));

		if (class_exists($generator)) {
			$generator = new $generator;

			if ($generator instanceof Generator) {
				return $generator;
			}
		}

		throw new InvalidArgumentException('Cannot create unknown generator type.');
	}
773396
static function factory($type)
    {
        switch (strtolower($type)) {
            case 'anonymous':
                $filename  = dirname(__FILE__) . '/SASL/Anonymous.php';
                $classname = 'Auth_SASL_Anonymous';
                break;

            case 'login':
                $filename  = dirname(__FILE__) . '/SASL/Login.php';
                $classname = 'Auth_SASL_Login';
                break;

            case 'plain':
                $filename  = dirname(__FILE__) . '/SASL/Plain.php';
                $classname = 'Auth_SASL_Plain';
                break;

            case 'external':
                $filename  = dirname(__FILE__) . '/SASL/External.php';
                $classname = 'Auth_SASL_External';
                break;

            case 'crammd5':
                // $msg = 'Deprecated mechanism name. Use IANA-registered name: CRAM-MD5.';
                // trigger_error($msg, E_USER_DEPRECATED);
            case 'cram-md5':
                $filename  = dirname(__FILE__) . '/SASL/CramMD5.php';
                $classname = 'Auth_SASL_CramMD5';
                break;

            case 'digestmd5':
                // $msg = 'Deprecated mechanism name. Use IANA-registered name: DIGEST-MD5.';
                // trigger_error($msg, E_USER_DEPRECATED);
            case 'digest-md5':
                // $msg = 'DIGEST-MD5 is a deprecated SASL mechanism as per RFC-6331. Using it could be a security risk.';
                // trigger_error($msg, E_USER_NOTICE);
                $filename  = dirname(__FILE__) . '/SASL/DigestMD5.php';
                $classname = 'Auth_SASL_DigestMD5';
                break;

            default:
                $scram = '/^SCRAM-(.{1,9})$/i';
                $matches = [];
                if (preg_match($scram, $type, $matches))
                {
                    $hash = $matches[1];
                    $filename = dirname(__FILE__) .'/SASL/SCRAM.php';
                    $classname = 'Auth_SASL_SCRAM';
                    $parameter = $hash;
                    break;
                }
                throw new InvalidArgumentException('Invalid SASL mechanism type');
                break;
        }

        require_once $filename;
        if (isset($parameter)) {
            $obj = new $classname($parameter);
        } else {
            $obj = new $classname();
        }

        return $obj;
    }
423138
public function setType($type)
    {
        if (!in_array($type, [Constants::GROUP_TYPE_AV_CHAT_ROOM, Constants::GROUP_TYPE_B_CHAT_ROOM, Constants::GROUP_TYPE_CHAT_ROOM, Constants::GROUP_TYPE_PRIVATE, Constants::GROUP_TYPE_PUBLIC])) {
            throw new InvalidArgumentException('Group type is incorrect.');
        }
        $this->setParameter('Type', $type);
        return $this;
    }
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));
        }
    }