本文整理汇总了PHP中Config::getIveeClassName方法的典型用法代码示例。如果您正苦于以下问题:PHP Config::getIveeClassName方法的具体用法?PHP Config::getIveeClassName怎么用?PHP Config::getIveeClassName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Config
的用法示例。
在下文中一共展示了Config::getIveeClassName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sanityCheckSkillLevel
/**
* Sanity checks a skill level (verify it's an integer between 0 and 5)
*
* @param int $skillLevel the value to be checked
*
* @return bool true on success
* @throws \iveeCore\Exceptions\InvalidParameterValueException if $skillLevel is not a valid skill level
*/
public static function sanityCheckSkillLevel($skillLevel)
{
if ($skillLevel < 0 or $skillLevel > 5 or !is_int($skillLevel)) {
$exceptionClass = Config::getIveeClassName('InvalidParameterValueException');
throw new $exceptionClass("Skill level needs to be an integer between 0 and 5");
}
return true;
}
示例2: queryAttributes
/**
* Gets all necessary data from SQL.
*
* @return array
* @throws iveCore\Exceptions\TypeIdNotFoundException when a typeId is not found
*/
protected function queryAttributes()
{
$sdeClass = Config::getIveeClassName('SDE');
$row = $sdeClass::instance()->query("SELECT\n it.groupID,\n ig.categoryID,\n it.typeName,\n it.volume,\n it.portionSize,\n it.basePrice,\n it.marketGroupID,\n iap.typeID as blueprintTypeID\n FROM invTypes AS it\n JOIN industryActivityProducts as iap ON iap.productTypeID = it.typeID\n JOIN invGroups AS ig ON it.groupID = ig.groupID\n WHERE it.published = 1\n AND iap.activityID = 1\n AND it.typeID = " . $this->id . ";")->fetch_assoc();
if (empty($row)) {
self::throwException('TypeIdNotFoundException', "typeId " . $this->id . " not found");
}
return $row;
}
示例3: getReactions
/**
* Gets the Reaction object(s) this product can be produced from
*
* @return array with Reaction objects(s)
*/
public function getReactions()
{
$typeClass = Config::getIveeClassName('Type');
$ret = array();
foreach ($this->productOfReactionIDs as $reactionID) {
$ret[$reactionID] = $typeClass::getById($reactionID);
}
return $ret;
}
示例4: getItem
/**
* Gets item from Memcached.
*
* @param string $key under which the item is stored
*
* @return mixed
* @throws \iveeCrest\Exceptions\KeyNotFoundInCacheException if key is not found
*/
public function getItem($key)
{
$item = $this->memcached->get(md5($this->uniqId . '_' . $key));
if ($this->memcached->getResultCode() == \Memcached::RES_NOTFOUND) {
$exceptionClass = Config::getIveeClassName('KeyNotFoundInCacheException');
throw new $exceptionClass("Key not found in memcached.");
}
//count memcached hit
$this->hits++;
return $item;
}
示例5: queryAttributes
/**
* Gets all necessary data from SQL.
*
* @return array
* @throws \iveeCore\Exceptions\TypeIdNotFoundException if the typeId is not found
*/
protected function queryAttributes()
{
//lookup SDE class
$sdeClass = Config::getIveeClassName('SDE');
$sde = $sdeClass::instance();
$row = $sde->query("SELECT\n it.groupID,\n ig.categoryID,\n it.typeName,\n it.volume,\n it.portionSize,\n it.basePrice,\n it.marketGroupID,\n 0 as productTypeID,\n 0 as maxProductionLimit\n FROM invTypes AS it\n JOIN invGroups AS ig ON it.groupID = ig.groupID\n WHERE it.published = 1\n AND it.typeID = " . $this->id . ";")->fetch_assoc();
if (empty($row)) {
self::throwException('TypeIdNotFoundException', "Relic ID=" . $this->id . " not found");
}
return $row;
}
示例6: subtractMaterial
/**
* Subtracts materials from the total material array.
*
* @param int $typeId of the material
* @param int $quantity of the material
*
* @return void
* @throws \iveeCore\Exceptions\InvalidParameterValueException
*/
public function subtractMaterial($typeId, $quantity)
{
$exceptionClass = Config::getIveeClassName('InvalidParameterValueException');
if (!isset($this->materials[$typeId])) {
throw new $exceptionClass('Trying to subtract materials of typeId ' . (int) $typeId . " from MaterialMap, which doesn't occur");
} elseif ($quantity > $this->materials[$typeId]) {
throw new $exceptionClass('Trying to subtract more materials of typeId ' . (int) $typeId . " from MaterialMap than is available");
}
$this->materials[$typeId] -= $quantity;
if ($this->materials[$typeId] == 0) {
unset($this->materials[$typeId]);
}
}
示例7: __construct
/**
* Constructor. Use \iveeCore\Speciality::getById() to instantiate Speciality objects instead.
*
* @param int $id of requested Speciality
*
* @return \iveeCore\Speciality
* @throws \iveeCore\Exceptions\SpecialityIdNotFoundException if the specialityID is not found
*/
protected function __construct($id)
{
$this->id = (int) $id;
$sdeClass = Config::getIveeClassName('SDE');
$sde = $sdeClass::instance();
$row = $sde->query("SELECT specialityName\n FROM iveeSpecialities\n WHERE specialityID = " . $this->id . ';')->fetch_assoc();
if (empty($row)) {
static::throwException('SpecialityIdNotFoundException', "Speciality ID=" . $this->id . " not found");
}
//set data to attributes
$this->name = $row['specialityName'];
$res = $sde->query("SELECT groupID\n FROM iveeSpecialityGroups\n WHERE specialityID = " . $this->id . ';');
while ($row = $res->fetch_assoc()) {
$this->specialityGroupIDs[(int) $row['groupID']] = 1;
}
}
示例8: getMaterialMap
/**
* Returns a clone of the MaterialMap for this process, WITHOUT sub-processes. Will return an empty new MaterialMap
* object if this process has no material requirements.
*
* @return \iveeCore\MaterialMap
*/
public function getMaterialMap()
{
if (isset($this->materials)) {
return clone $this->materials;
//we return a clone so the original doesn't get altered
} else {
$materialClass = Config::getIveeClassName('MaterialMap');
return new $materialClass();
}
}
示例9: getBestReprocessingStation
/**
* Gets the best station for reprocessing in the system, based on the yield, which is dependent on the base
* reprocessing efficiency and the standings from it's corporation to the character. If multiple stations have the
* same yield, the first of those is returned.
*
* @return \iveeCore\Station
* @throws \iveeCore\Exceptions\NoRelevantDataException when there is no station with Reprocessing Plant (16)
* service in system
*/
public function getBestReprocessingStation()
{
$bestStation = null;
$bestYield = 0.0;
foreach ($this->getSolarSystem()->getStationsWithService(16) as $station) {
$yield = $station->getReprocessingEfficiency() * $this->getCharacterModifier()->getReprocessingTaxFactor($station->getCorporationId());
if ($yield > $bestYield) {
$bestYield = $yield;
$bestStation = $station;
}
}
if (is_null($bestStation)) {
$exceptionClass = Config::getIveeClassName('NoRelevantDataException');
throw new $exceptionClass('No Station with Reprocessing Plant service in System');
}
return $bestStation;
}
示例10: getReprocessingMaterialMap
/**
* Returns a MaterialMap object representing the reprocessing materials of the item
*
* @param int $batchSize number of items being reprocessed, needs to be multiple of portionSize
* @param float $equipmentYield the reprocessing yield of the station or array
* @param float $taxFactor the tax imposed by station as factor (<1.0)
* @param float $implantBonusFactor the reprocessing bonus given by an implant as factor (>1.0)
*
* @return \iveeCore\MaterialMap
* @throws \iveeCore\Exceptions\NotReprocessableException if item is not reprocessable
* @throws \iveeCore\Exceptions\InvalidParameterValueException if batchSize is not multiple of portionSize or if
* $equipmentYield or $implantBonusPercent is not sane
*/
public function getReprocessingMaterialMap($batchSize, $equipmentYield = 0.5, $taxFactor = 0.95, $implantBonusFactor = 1.0)
{
if (!$this->isReprocessable()) {
self::throwException('NotReprocessableException', $this->name . ' is not reprocessable');
}
$exceptionClass = Config::getIveeClassName('InvalidParameterValueException');
$defaultsClass = Config::getIveeClassName('Defaults');
$defaults = $defaultsClass::instance();
if ($batchSize % $this->portionSize != 0) {
throw new $exceptionClass('Reprocessing batch size needs to be multiple of ' . $this->portionSize);
}
if ($equipmentYield > 1) {
throw new $exceptionClass('Equipment reprocessing yield can never be > 1.0');
}
if ($implantBonusFactor > 1.04) {
throw new $exceptionClass('No implants has reprocessing bonus > 4%');
}
if ($taxFactor > 1) {
throw new $exceptionClass('Reprocessing tax cannot be lower than 0%');
}
//if (compressed) ore or ice
if ($this->getCategoryID() == 25) {
//Reprocessing, Reprocessing Efficiency and specific Processing skills
$yield = $equipmentYield * (1 + 0.03 * $defaults->getSkillLevel(3385)) * (1 + 0.02 * $defaults->getSkillLevel(3389)) * (1 + 0.02 * $defaults->getSkillLevel($this->getReprocessingSkillID())) * $implantBonusFactor;
} else {
$yield = $equipmentYield * (1 + 0.02 * $defaults->getSkillLevel(12196));
}
//Scrapmetal Processing skills
$materialsClass = Config::getIveeClassName('MaterialMap');
$rmat = new $materialsClass();
$numPortions = $batchSize / $this->portionSize;
foreach ($this->getMaterials() as $typeID => $quantity) {
$rmat->addMaterial($typeID, round($quantity * $yield * $numPortions * $taxFactor));
}
return $rmat;
}
示例11: getItem
/**
* Gets item from Memcached.
*
* @param string $key under which the item is stored
*
* @return mixed
* @throws \iveeCrest\Exceptions\KeyNotFoundInCacheException if key is not found
*/
public function getItem($key)
{
//$ckey = md5($this->uniqId . '_' . $key);
$ckey = $key;
if (empty($this->cache2[$ckey])) {
$exceptionClass = Config::getIveeClassName('KeyNotFoundInCacheException');
throw new $exceptionClass("Key not found in cache.");
}
$citem = $this->cache2[$ckey];
$item = $citem['value'];
$ttl = $item->getCacheTTL();
$expire = $citem['expire'];
if (strpos($key, "oauth/token") !== false) {
echo time2s() . "getItem() token cache_TTL {$ttl}\n";
}
if (strpos($key, "orders/sell") !== false) {
//echo time2s()."getItem() order cache_TTL $ttl\n";
}
// TODO: do we need to throw an exception on TTL expiration?
//$this->cache2[$ckey]['value']->getCacheTTL();
if (time() >= $expire) {
$exceptionClass = Config::getIveeClassName('KeyNotFoundInCacheException');
throw new $exceptionClass("Key not found in cache.");
echo time2s . ">>> cache item expired {$key}\n";
}
//count cache hit
$this->hits++;
return $item;
}
示例12: printData
/**
* Prints data about this process
*
* @return void
*/
public function printData()
{
$typeClass = Config::getIveeClassName('Type');
$utilClass = Config::getIveeClassName('Util');
echo "Average total success times:" . PHP_EOL;
print_r($this->getTotalSuccessTimes());
echo "Average total success materials:" . PHP_EOL;
foreach ($this->getTotalSuccessMaterialMap()->getMaterials() as $typeID => $amount) {
echo $amount . 'x ' . $typeClass::getById($typeID)->getName() . PHP_EOL;
}
echo "Total average success material cost: " . $utilClass::quantitiesToReadable($this->getTotalSuccessMaterialBuyCost()) . "ISK" . PHP_EOL;
echo "Total average success slot cost: " . $utilClass::quantitiesToReadable($this->getTotalSuccessProcessCost()) . "ISK" . PHP_EOL;
echo "Total average success cost: " . $utilClass::quantitiesToReadable($this->getTotalSuccessCost()) . "ISK" . PHP_EOL;
echo "Total profit: " . $utilClass::quantitiesToReadable($this->getTotalProfit()) . "ISK" . PHP_EOL;
}
示例13: getSkillMapForActivity
/**
* Returns SkillMap of minimum skill requirements for activity.
*
* @param int $activityId of the desired activity. See ProcessData constants.
*
* @return \iveeCore\SkillMap
*/
protected function getSkillMapForActivity($activityId)
{
if (isset($this->activitySkills[(int) $activityId])) {
return clone $this->activitySkills[(int) $activityId];
} else {
$skillMapClass = Config::getIveeClassName('SkillMap');
return new $skillMapClass();
}
}
示例14: printData
/**
* Prints data about this process
*
* @return void
*/
public function printData()
{
$typeClass = Config::getIveeClassName('Type');
$utilClass = Config::getIveeClassName('Util');
echo "Total slot time: " . $utilClass::secondsToReadable($this->getTotalTime()) . PHP_EOL;
//iterate over materials
foreach ($this->getTotalMaterialMap()->getMaterials() as $typeID => $amount) {
echo $amount . 'x ' . $typeClass::getById($typeID)->getName() . PHP_EOL;
}
echo "Material cost: " . $utilClass::quantitiesToReadable($this->getTotalMaterialBuyCost()) . "ISK" . PHP_EOL;
echo "Slot cost: " . $utilClass::quantitiesToReadable($this->getTotalProcessCost()) . "ISK" . PHP_EOL;
echo "Total cost: " . $utilClass::quantitiesToReadable($this->getTotalCost()) . "ISK" . PHP_EOL;
echo "Total profit: " . $utilClass::quantitiesToReadable($this->getTotalProfit()) . "ISK" . PHP_EOL;
}
示例15: __construct
/**
* Constructor. Use \iveeCore\Team::getById() to instantiate Team objects instead.
*
* @param int $id of the Team
*
* @return \iveeCore\Team
* @throws \iveeCore\Exceptions\TeamIdNotFoundException if teamID is not found
*/
protected function __construct($id)
{
$this->id = (int) $id;
$sdeClass = Config::getIveeClassName('SDE');
$sde = $sdeClass::instance();
$row = $sde->query("SELECT solarSystemID, UNIX_TIMESTAMP(expiryTime) as expiryTime, UNIX_TIMESTAMP(creationTime) as\n creationTime, activityID, teamName, costModifier, specID, w0BonusID, w0BonusValue, w0SpecID, w1BonusID,\n w1BonusValue, w1SpecID, w2BonusID, w2BonusValue, w2SpecID, w3BonusID, w3BonusValue, w3SpecID\n FROM iveeTeams WHERE teamID = " . $this->id . ";")->fetch_assoc();
if (empty($row)) {
static::throwException('TeamIdNotFoundException', "teamID " . $this->id . " not found");
}
//set data to attributes
$this->solarSystemID = (int) $row['solarSystemID'];
$this->expiryTime = (int) $row['expiryTime'];
$this->creationTime = (int) $row['creationTime'];
$this->activityID = (int) $row['activityID'];
$this->name = $row['teamName'];
$this->costModifier = 1.0 + $row['costModifier'] / 100;
//convert percent to factor
$this->specialityID = (int) $row['specID'];
$this->bonusIDs = array((int) $row['w0BonusID'], (int) $row['w1BonusID'], (int) $row['w2BonusID'], (int) $row['w3BonusID']);
$this->bonusValues = array((double) $row['w0BonusValue'], (double) $row['w1BonusValue'], (double) $row['w2BonusValue'], (double) $row['w3BonusValue']);
$specialityClass = Config::getIveeClassName('Speciality');
$this->workerSpecialities = array($specialityClass::getById((int) $row['w0SpecID']), $specialityClass::getById((int) $row['w1SpecID']), $specialityClass::getById((int) $row['w2SpecID']), $specialityClass::getById((int) $row['w3SpecID']));
}