本文整理汇总了PHP中Package类的典型用法代码示例。如果您正苦于以下问题:PHP Package类的具体用法?PHP Package怎么用?PHP Package使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Package类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildPackage
/**
* @param string $namespace
* @param array $pathList
* @return Package
*/
private function buildPackage($namespace, array $pathList)
{
$package = new Package();
$package->setNamespace($namespace);
$package->setPathList($pathList);
return $package;
}
示例2: validate
/**
* @see Form::validate()
*/
public function validate()
{
parent::validate();
// validate class path
if (empty($this->classPath)) {
throw new UserInputException('classPath');
}
try {
$package = new Package($this->packageID);
if (!@file_exists(FileUtil::getRealPath(WCF_DIR . $package->getDir() . $this->classPath))) {
throw new UserInputException('classPath', 'doesNotExist');
}
} catch (SystemException $e) {
throw new UserInputException('classPath', 'doesNotExist');
}
try {
CronjobEditor::validate($this->startMinute, $this->startHour, $this->startDom, $this->startMonth, $this->startDow);
} catch (SystemException $e) {
// extract field name
$fieldName = '';
if (preg_match("/cronjob attribute '(.*)'/", $e->getMessage(), $match)) {
$fieldName = $match[1];
}
throw new UserInputException($fieldName, 'notValid');
}
}
示例3: noticePackageUploaded
public function noticePackageUploaded(Package $pkg)
{
$app = $this->app;
$package_url = mfwRequest::makeURL("/package?id={$pkg->getId()}");
ob_start();
include APP_ROOT . '/data/notice_mail_template.php';
$body = ob_get_clean();
$addresses = array();
foreach ($this->rows as $r) {
if ($r['notify']) {
$addresses[] = $r['mail'];
}
}
if (empty($addresses)) {
return;
}
$subject = "New Package Uploaded to {$app->getTitle()}";
$sender = Config::get('mail_sender');
$to = $sender;
$header = "From: {$sender}" . "\nBcc: " . implode(', ', $addresses);
mb_language('uni');
mb_internal_encoding('UTF-8');
if (!mb_send_mail($to, $subject, $body, $header)) {
throw new RuntimeException("mb_send_mail faild (pkg={$pkg->getId()}, {$pkg->getTitle()})");
}
}
示例4: setPackage
public function setPackage(Package $package)
{
if ($this->package !== $package) {
$this->package = $package;
$package->addVersion($this);
}
}
示例5: run
public function run(array $arguments)
{
$json = $this->deps->nearestJson();
$package = new Package(dirname($json));
$porcelain = count($arguments) && $arguments[0] == 'porcelain';
if (!$porcelain) {
Terminal::info("From {$json}\n\n");
Terminal::bold("* project name: " . $package->getName() . "\n");
}
$dependencies = $package->getDependencies();
if ($porcelain) {
echo implode(':', $dependencies) . "\n";
} else {
if ($dependencies) {
Terminal::bold("* dependencies:\n");
foreach ($dependencies as $dep) {
echo " - {$dep} ";
if ($this->deps->hasPackage($dep)) {
Terminal::success("(installed)");
} else {
Terminal::warning("(not installed)");
}
echo "\n";
}
} else {
Terminal::bold("* no dependencies\n");
}
}
}
示例6: process
public function process()
{
//if has a request from submit button, then capture it
$client_data = NULL;
//TEST($json_data);
if (isset($_REQUEST['request'])) {
$input = $_REQUEST['request'];
} else {
//else, get the json data from input
$json_data = file_get_contents('php://input');
//decode data into array
$data = json_decode($json_data, true);
//use a package to store the object
$package = new Package();
//data is in json encode form, so must decode it
$package->get_data_from($data, true);
// get request
$input = $package->get_message();
// get data of clients if available
$client_data = $package->get_data();
}
//change value in $input into lower case
$func = strtolower(trim(str_replace("/", "", $input)));
//replace 'space' with '_'
$func = str_replace(" ", "_", $func);
//if the method exist, call it
if ((int) method_exists($this, $func) > 0) {
$this->{$func}($client_data);
} else {
$this->response('', 404);
}
// If the method not exist with in this class, response would be "Page not found".
}
示例7: testRegister
public function testRegister()
{
$app = $this->app;
$package = new Package();
$package->register($app);
$this->assertTrue($app->getContainer()->has(Storage\AccessToken::class));
}
示例8: export
public static function export(&$metadata)
{
$package = Doctrine::getTable('Package')->findOneByName($metadata['packageName']);
if (!$package) {
Package_Message::log('debug', 'Creating new package entry for ' . $metadata['packageName'] . '@' . $metadata['basedir']);
$package = new Package();
} else {
Package_Message::log('debug', 'Updating package entry for ' . $metadata['packageName'] . '@' . $metadata['basedir'] . ' (' . $package['package_id'] . ')');
}
$registryIgnoreKeys = array_flip(array('packageName', 'displayName', 'version', 'packageStatus', 'directory', 'configure_instance', 'navStructures', 'datastore_id', 'type', 'upgrades', 'downgrades', 'basedir', 'status', 'models'));
$package['name'] = $metadata['packageName'];
$package['display_name'] = $metadata['displayName'];
$package['version'] = $metadata['version'];
$package['type'] = $metadata['type'];
$package['status'] = $metadata['status'];
$package['basedir'] = $metadata['basedir'];
$package['navigation'] = $metadata['navStructures'];
$package['registry'] = array_diff_key($metadata, $registryIgnoreKeys);
$package->save();
$metadata['datastore_id'] = $package['package_id'];
if (!empty($metadata['models'])) {
$models = Doctrine::loadModels($metadata['directory'] . '/models', Doctrine::MODEL_LOADING_CONSERVATIVE);
self::integrateNumberType($models, $metadata['datastore_id']);
}
}
示例9: testIssue9Failure
public function testIssue9Failure()
{
$package = new Package();
$package->setMessages(['FOO' => 'The text for "foo."', 'BAR' => 'The text for "bar."']);
// $this->packages->set('Vendor.Package', 'en_UK', $package);
// $this->setExpectedException('Exception');
// $translator = $this->translators->get('Vendor.Package', 'en_UK');
}
示例10: getPackageMetaDataUsesMetaDataReader
/**
* @test
* @author Christopher Hlubek <hlubek@networkteam.com>
* @author Robert Lemke <robert@typo3.org>
*/
public function getPackageMetaDataUsesMetaDataReader()
{
$mockMetaData = $this->getMock('F3\\FLOW3\\Package\\MetaDataInterface');
$mockMetaDataReader = $this->getMock('F3\\FLOW3\\Package\\MetaData\\ReaderInterface');
$package = new Package('FLOW3', FLOW3_PATH_FLOW3);
$package->injectMetaDataReader($mockMetaDataReader);
$mockMetaDataReader->expects($this->once())->method('readPackageMetaData')->will($this->returnValue($mockMetaData));
$this->assertSame($mockMetaData, $package->getPackageMetaData());
}
示例11: getShipment
private function getShipment()
{
$shipment = new Shipment();
$shipment->setFromIsResidential(false)->setFromStateProvinceCode('IN')->setFromPostalCode('46205')->setFromCountryCode('US')->setToIsResidential(true)->setToPostalCode('20101')->setToCountryCode('US');
$package = new Package();
$package->setLength(12)->setWidth(4)->setHeight(3)->setWeight(3);
$shipment->addPackage($package);
return $shipment;
}
示例12: getPackageInstallUsers
public static function getPackageInstallUsers(Package $pkg)
{
$sql = 'SELECT distinct(mail) FROM install_log WHERE package_id = ?';
$rows = mfwDBIBase::getAll($sql, array($pkg->getId()));
$mails = array();
foreach ($rows as $r) {
$mails[] = $r['mail'];
}
return $mails;
}
示例13: component_row
function component_row(Package $package, $indentation, TableCreator $table_creator)
{
$package->with('integration');
$ret = $table_creator->row(array($package->full_name(), $package->integration == null ? 'Architettura del sistema' : $package->integration->public_id()));
$nested = $package->with('packages')->packages;
foreach ($nested as $nuc) {
$ret .= component_row($nuc, $indentation + 1, $table_creator);
}
return $ret;
}
示例14: addIdPackage
/** Dodaje pakiet jako powiązany
*
* @param int|string $idPackage - id definicji we frontend
*/
public function addIdPackage($idPackage)
{
if ($idPackage == '') {
throw new Logger_Exception('Nie podano parametru $idPackage');
}
$this->packageId = $idPackage;
$model = new Package();
$row = $model->findOne($idPackage);
$this->packageName = $row->name;
}
示例15: createManifest
/**
* Generates a manifest JSON file and returns the path.
*
* @param \JWage\APNS\Safari\Package $package
* @return string $manifestJsonPath
*/
public function createManifest(Package $package)
{
$manifestData = array();
foreach (Package::$packageFiles as $rawFile) {
$filePath = sprintf('%s/%s', $package->getPackageDir(), $rawFile);
$manifestData[$rawFile] = sha1(file_get_contents($filePath));
}
$manifestJsonPath = sprintf('%s/manifest.json', $package->getPackageDir());
$manifestJson = json_encode((object) $manifestData);
file_put_contents($manifestJsonPath, $manifestJson);
return $manifestJsonPath;
}