Step 1: Configure Package.

@param  string  $type
@return mixed
512796
private function stepOne($type)
    {
        $input = $this->ask('Please enter the name of the Package:', $this->data['name']);

        if (Str::length($input) > 3) {
            $name = Str::studly($input);
        } else {
            $name = Str::upper($input);
        }

        $this->data['name'] = $name;

        //
        $input = $this->ask('Please enter the slug of the Package:', $this->data['slug']);

        if (Str::length($input) > 3) {
            $slug = Str::snake($input);
        } else {
            $slug = Str::lower($input);
        }

        $this->data['slug'] = $slug;

        if ($type == 'module') {
            $namespace = $this->packages->getModulesNamespace();

            $vendor = basename(str_replace('\\', '/',  $namespace));
        } else if ($type == 'theme') {
            $namespace = $this->packages->getThemesNamespace();

            $vendor = basename(str_replace('\\', '/',  $namespace));
        } else {
            if (strpos($this->data['package'], '/') > 0) {
                list ($vendor) = explode('/', $this->data['package']);
            } else {
                $vendor = 'AcmeCorp';
            }

            if (empty($vendor = $this->ask('Please enter the vendor of the Package:', $vendor))) {
                $vendor = 'AcmeCorp';
            }
        }

        $this->data['package'] = Str::studly($vendor) .'/' .$name;

        $this->data['lower_package'] = Str::snake($vendor, '-') .'/' .str_replace('_', '-', $slug);

        //
        $this->data['namespace'] = $this->ask('Please enter the namespace of the Package:', $this->data['namespace']);

        $this->data['license'] = $this->ask('Please enter the license of the Package:', $this->data['license']);

        $this->comment('You have provided the following information:');

        $this->comment('Name:       ' .$this->data['name']);
        $this->comment('Slug:       ' .$this->data['slug']);
        $this->comment('Package:    ' .$this->data['package']);
        $this->comment('Namespace:  ' .$this->data['namespace']);
        $this->comment('License:    ' .$this->data['license']);

        if ($this->confirm('Do you wish to continue?')) {
            $this->generate($type);
        } else {
            return $this->stepOne($type);
        }

        return true;
    }
1220887
public static function requestHandler($type)
    {
        if (! self::validateRequest($type)) {
            return false;
        }

        App::setCurrentID(self::$config['app']);

        self::loadRemoteComplements();

        switch (self::$config['request']) {
            case 'load-complements':
                self::complementsLoadRequest();
                break;
            case 'change-state':
                self::changeStateRequest();
                break;
            case 'install':
                self::installRequest();
                break;
            case 'update':
                self::installRequest(true);
                break;
            case 'uninstall':
                self::uninstallRequest();
                break;
            default:
                self::$errors[] = [
                    'message' => 'Unknown request: ' . self::$config['request'],
                ];
                echo json_encode(['errors' => self::$errors]);
                break;
        }

        if (empty(App::getOption('development-environment'))) {
            die;
        }
    }
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;
    }
156735
public static function factory($type)
    {
        switch ($type) {
            case self::JSON:
                return Arrayto\Json::factory();
            case self::CSV:
                return Arrayto\Csv::factory();
            case self::TSV:
                return Arrayto\Tsv::factory();
            case self::LTSV:
                return Arrayto\Ltsv::factory();
            case self::XML:
                return Arrayto\Xml::factory();
        }

        throw new \InvalidArgumentException();
    }
259627
public function delCert(string $type): ConfigInterface
    {
        $type = mb_strtolower($type);
        $this->throwIfNotInArray($type, self::CERTS);
        unset($this->_certs[$type]);
        return $this;
    }
1014322
public function getConfig($type = self::CONFIG_ALL)
    {
        if ($type == self::CONFIG_ALL) {
            return $this->config;
        }

        return isset($this->config[$type]) ? $this->config[$type] : [];
    }
726924
public function type($type = null)
    {
        if ($type !== null) {
            $this->type = $type;
            return $this;
        }
        return $this->type;
    }
156905
public function getCode($type = 'default')
    {
        $code = $this->exception->getCode();
        if (empty($this->exception->getCode())) {
            $code = config($this->configFile.'.codes.'.$type);
        }

        return $code;
    }
185934
private function buildType($type)
    {
        if ($type instanceof TypeInterface) {
            return $type;
        }

        if (substr($type, -2) === '[]') {
            return new ArrayType($this->buildType(substr($type, 0, -2)));
        }

        return new Type($type);
    }
1113961
public function withType(string $type): self
    {
        $metadata = clone $this;
        $metadata->type = $type;

        return $metadata;
    }
1321784
public function getType($type)
    {
        if (!$this->hasType($type)) {
            $this->metaTypeList[$type] = new $type();
        }

        return $this->metaTypeList[$type];
    }
828429
public function create($type)
    {
        $typeOptions    = $this->getOption(self::OPTION_MAPPERS);
        $typeOption     = isset($typeOptions[$type]) ? $typeOptions[$type] : $this->throwException();
        $importerString = isset($typeOption[self::OPTION_MAPPERS_IMPORTER]) ? $typeOption[self::OPTION_MAPPERS_IMPORTER] : $this->throwException();
        $importer       = $this->buildService($importerString, ImportServiceInterface::class);

        if (isset($typeOption[self::OPTION_MAPPERS_MAPPER])) {
            $mapperString = $typeOption[self::OPTION_MAPPERS_MAPPER];
            $mapper       = $this->buildService($mapperString);
        } else {
            $mapper = $this->getDefaultMapper();
        }

        $this->propagate($mapper);
        $importer->setMapper($mapper);

        return $importer;
    }
90106
public function findPackageConfiguration($package)
    {
        $paths = [
            $this->paths->getBasePath().'vendor/%s/src/config',
            $this->paths->getBasePath().'vendor/%s/config',
            $this->paths->getRocketeerPath().'/vendor/%s/src/config',
            $this->paths->getRocketeerPath().'/vendor/%s/config',
            $this->paths->getUserHomeFolder().'/.composer/vendor/%s/src/config',
            $this->paths->getUserHomeFolder().'/.composer/vendor/%s/config',
        ];

        // Check for the first configuration path that exists
        $paths = array_map(function ($path) use ($package) {
            return sprintf($path, $package);
        }, $paths);

        return $paths;
    }
296706
private function buildOperation($type, $package)
    {
        $vendorDir = $this->kernel->getRootDir().'/../vendor';
        $targetDir = $package->getTargetDir() ?: '';
        $packageDir = empty($targetDir) ?
            $package->getPrettyName() :
            "{$package->getName()}/{$targetDir}";
        $fqcn = $this->detector->detectBundle("{$vendorDir}/{$packageDir}");

        return new Operation($type, $package, $fqcn);
    }
203064
public function withType(string $type): self
    {
        $this->type = UserPermissionEnum::ensureValid($type);
        return $this;
    }
1216735
public function type($type)
    {
        $types = is_array($type) ? $type : func_get_args();

        $this->types = array_merge($this->types, $types);

        return $this;
    }
399321
public function setContentType($type)
    {
        $this->headerBag->appendPair('Content-Type', sprintf('%s;charset=%s', $type, $this->charset));
        return $this;
    }