Check the conformance of the given package key
public isPackageKeyValid ( string $packageKey ) | ||
$packageKey | string | The package key to validate |
/** * Kickstart a new site package * * This command generates a new site package with basic TypoScript and Sites.xml * * @param string $packageKey The packageKey for your site * @param string $siteName The siteName of your site * @return string */ public function siteCommand($packageKey, $siteName) { if (!$this->packageManager->isPackageKeyValid($packageKey)) { $this->outputLine('Package key "%s" is not valid. Only UpperCamelCase in the format "Vendor.PackageKey", please!', array($packageKey)); $this->quit(1); } if ($this->packageManager->isPackageAvailable($packageKey)) { $this->outputLine('Package "%s" already exists.', array($packageKey)); $this->quit(1); } $generatedFiles = $this->generatorService->generateSitePackage($packageKey, $siteName); $this->outputLine(implode(PHP_EOL, $generatedFiles)); }
/** * Checks the syntax of the given $packageKey and quits with an error message if it's not valid * * @param string $packageKey * @return void */ protected function validatePackageKey($packageKey) { if (!$this->packageManager->isPackageKeyValid($packageKey)) { $this->outputLine('Package key "%s" is not valid. Only UpperCamelCase with alphanumeric characters in the format <VendorName>.<PackageKey>, please!', array($packageKey)); exit(1); } }
/** * Create a new package * * This command creates a new package which contains only the mandatory * directories and files. * * @Flow\FlushesCaches * @param string $packageKey The package key of the package to create * @param string $packageType The package type of the package to create * @return string * @see neos.kickstarter:kickstart:package */ public function createCommand($packageKey, $packageType = PackageInterface::DEFAULT_COMPOSER_TYPE) { if (!$this->packageManager->isPackageKeyValid($packageKey)) { $this->outputLine('The package key "%s" is not valid.', [$packageKey]); $this->quit(1); } if ($this->packageManager->isPackageAvailable($packageKey)) { $this->outputLine('The package "%s" already exists.', [$packageKey]); $this->quit(1); } if (!ComposerUtility::isFlowPackageType($packageType)) { $this->outputLine('The package must be a Flow package, but "%s" is not a valid Flow package type.', [$packageType]); $this->quit(1); } $package = $this->packageManager->createPackage($packageKey, ['type' => $packageType], null); $this->outputLine('Created new package "' . $packageKey . '" at "' . $package->getPackagePath() . '".'); }