public function __construct($value = null, array $options = null) { if (is_string($value)) { $value = trim($value); } parent::__construct($value, $options); }
/** * Constructor. Use iveeCore\Type::getById() to instantiate Reaction objects. * * @param int $id of the Reaction object * * @throws Exception if typeId is not found */ protected function __construct($id) { //call parent constructor parent::__construct($id); //get data from SQL $row = $this->queryAttributes(); //set data to object attributes $this->setAttributes($row); $materialMapClass = Config::getIveeClassName('MaterialMap'); $this->cycleInputMaterialMap = new $materialMapClass(); $this->cycleOutputMaterialMap = new $materialMapClass(); $sdeClass = Config::getIveeClassName('SDE'); //get reaction materials $res = $sdeClass::instance()->query('SELECT itr.input, itr.typeID, itr.quantity * IFNULL(COALESCE(dta.valueInt, dta.valueFloat), 1) as quantity FROM invTypeReactions as itr JOIN invTypes as it ON itr.typeID = it.typeID LEFT JOIN dgmTypeAttributes as dta ON itr.typeID = dta.typeID WHERE it.published = 1 AND (dta.attributeID = 726 OR dta.attributeID IS NULL) AND itr.reactionTypeID = ' . $this->id . ';'); while ($row = $res->fetch_assoc()) { if ($row['input'] == 1) { $this->cycleInputMaterialMap->addMaterial($row['typeID'], $row['quantity']); } else { $this->cycleOutputMaterialMap->addMaterial($row['typeID'], $row['quantity']); if (Type::getById($row['typeID'])->isReprocessable()) { $this->isAlchemy = true; } } } }
public function __construct(Type $type) { $described = $type->getTypeDescription()->describe(); $described[static::$propertyPrefix . 'allowNull'] = true; parent::__construct(new TypeDescription("", $described)); $this->type = $type; }
/** * Constructor. Use iveeCore\Type::getById() to instantiate Decryptor objects instead. * * @param int $id of the Decryptor object * * @throws \iveeCore\Exceptions\UnexpectedDataException when loading Decryptor data fails */ protected function __construct($id) { //call parent constructor parent::__construct($id); //lookup SDE class $sdeClass = Config::getIveeClassName('SDE'); //fetch decryptor modifiers from DB $res = $sdeClass::instance()->query("SELECT\n attributeID,\n valueFloat\n FROM dgmTypeAttributes\n WHERE\n typeID = " . $this->id . "\n AND attributeID IN (1112, 1113, 1114, 1124);"); //set modifiers to object while ($row = $res->fetch_assoc()) { switch ($row['attributeID']) { case 1112: $this->probabilityModifier = (double) $row['valueFloat']; break; case 1113: $this->meModifier = (int) $row['valueFloat']; break; case 1114: $this->teModifier = (int) $row['valueFloat']; break; case 1124: $this->runModifier = (int) $row['valueFloat']; break; default: self::throwException('UnexpectedDataException', "Error loading data for Decryptor ID=" . $this->id); } } }
/** * Creates a new array type instance * * @param var component */ public function __construct($component) { if ($component instanceof Type) { parent::__construct('[:' . $component->getName() . ']'); } else { parent::__construct('[:' . $component . ']'); } }
public function __construct(\stdClass $data, \Tekook\TelegramLibrary\TelegramBotApi $api) { parent::__construct($data, $api); $this->checkData("id", true); $this->checkData("first_name", true); $this->checkData("last_name", false, true); $this->checkData("username", false, true); }
/** * Creates a new array type instance * * @param lang.XPClass $base * @param lang.Type[] $components */ public function __construct(XPClass $base, array $components) { $this->base = $base; $this->components = $components; parent::__construct(sprintf('%s<%s>', $base->getName(), implode(',', array_map(function ($e) { return $e->getName(); }, $components))), null); }
public function __construct(\stdClass $data) { parent::__construct($data); $this->checkData("phone_number", true); $this->checkData("first_name", true); $this->checkData("last_name", false, true); $this->checkData("user_id", false, true); }
public function __construct(Type $type, $defaultValue, $defaultOnWrongType = false, $defaultOnNull = true) { parent::__construct(new TypeDescription("Either", [static::$propertyPrefix . "expected" => $type->getTypeDescription()->describe(), static::$propertyPrefix . "orDefault" => $defaultValue, static::$propertyPrefix . "defaultOnWrongType" => $defaultOnWrongType, static::$propertyPrefix . "defaultOnNull" => $defaultOnNull])); $this->defaultValue = $defaultValue; $this->defaultOnWrongType = $defaultOnWrongType; $this->defaultOnNull = $defaultOnNull; $this->type = $type; }
/** * Creates a new array type instance * * @param lang.Type[] $signature * @param lang.Type $returns */ public function __construct(array $signature = null, $returns) { $this->signature = $signature; $this->returns = $returns; parent::__construct(sprintf('(function(%s): %s)', null === $signature ? '?' : implode(',', array_map(function ($e) { return $e->getName(); }, $signature)), $this->returns->getName()), null); }
/** * Creates a new type union instance * * @param lang.Type[] $types * @throws lang.IllegalArgumentException */ public function __construct(array $types) { if (sizeof($types) < 2) { throw new IllegalArgumentException('A type union consists of at least 2 types'); } $this->types = $types; parent::__construct(implode('|', array_map(function ($type) { return $type->getName(); }, $types)), null); }
/** * Creates a new array type instance * * @param var component */ public function __construct($component) { if ($component instanceof Type) { $this->component = $component; parent::__construct('[:' . $component->getName() . ']', []); } else { $this->component = Type::forName($component); parent::__construct('[:' . $component . ']', []); } }
/** * Constructor. Use iveeCore\Type::getById() to instantiate Blueprint objects instead. * * @param int $id of the Blueprint object * * @throws \iveeCore\Exceptions\TypeIdNotFoundException if the typeId is not found */ protected function __construct($id) { //call parent constructor parent::__construct($id); //lookup SDE class $sdeClass = Config::getIveeClassName('SDE'); $sde = $sdeClass::instance(); $this->loadActivityMaterials($sde); $this->loadActivitySkills($sde); $this->loadActivityTimes($sde); }
public function __construct(\stdClass $data) { parent::__construct($data); $this->checkData("total_count", true); $this->checkData("photos", true); foreach ($data->photos as $key => $photos) { $this->photos[$key] = array(); foreach ($photos as $photo) { $this->photos[$key][] = new PhotoSize($photo); } } }
/** * Constructor. Use iveeCore\Type::getById() to instantiate ReactionProduct objects instead. * * @param int $id of the ReactionProduct object * * @throws \iveeCore\Exceptions\TypeIdNotFoundException if typeId is not found */ protected function __construct($id) { //call parent constructor parent::__construct($id); $sdeClass = Config::getIveeClassName('SDE'); //fetch reactions this type can result from $res = $sdeClass::instance()->query("(SELECT reactionTypeID\n FROM invTypeReactions as itr\n JOIN invTypes as it ON it.typeID = itr.reactionTypeID\n WHERE itr.typeID = " . $this->id . "\n AND itr.input = 0\n AND it.published = 1)\n UNION\n (SELECT itr.reactionTypeID\n FROM invTypes as it\n JOIN invTypeMaterials as itm ON itm.typeID = it.typeID\n JOIN invTypeReactions as itr ON itr.typeID = it.typeID\n WHERE it.groupID = 428\n AND it.published = 1\n AND materialTypeID = " . $this->id . "\n AND itr.input = 0);"); if (empty($res)) { static::throwException('TypeIdNotFoundException', "ReactionProduct ID=" . $this->id . " not found"); } while ($row = $res->fetch_assoc()) { $this->productOfReactionIds[] = (int) $row['reactionTypeID']; } }
public function __construct($id, $count, $rf, $shield, array $cost, $power, $weapons_tech = 0, $shields_tech = 0, $armour_tech = 0) { parent::__construct($id, $count); $this->rf = $rf; $this->originalShield = $this->shield = $shield; $this->originalHull = $this->hull = COST_TO_ARMOUR * array_sum($cost); $this->originalPower = $this->power = $power; $this->currentShield = SHIELD_CELLS * $count; $this->currentLife = $this->hull * $count; $this->lastShots = 0; $this->lastShipHit = 0; $this->cost = $cost; $this->setWeaponsTech($weapons_tech); $this->setArmourTech($armour_tech); $this->setShieldsTech($shields_tech); }
/** * ShipType::__construct() * * @param int $id * @param int $count * @param array $rf * @param int $shield * @param array $cost * @param int $power * @param int $weapons_tech * @param int $shields_tech * @param int $armour_tech * @return */ public function __construct($id, $count, $rf, $shield, array $cost, $power, $weapons_tech = null, $shields_tech = null, $armour_tech = null) { parent::__construct($id, 0); $this->rf = $rf; $this->lastShots = 0; $this->lastShipHit = 0; $this->cost = $cost; $this->originalShield = $shield; $this->originalPower = $power; $this->singleShield = $shield; $this->singleLife = COST_TO_ARMOUR * array_sum($cost); $this->singlePower = $power; $this->increment($count); $this->setWeaponsTech($weapons_tech); $this->setArmourTech($armour_tech); $this->setShieldsTech($shields_tech); }
/** * Constructor * * @param var ref either a class name, a ReflectionClass instance or an object * @throws lang.IllegalStateException */ public function __construct($ref) { if ($ref instanceof ReflectionClass) { $this->_reflect = $ref; $this->_class = $ref->getName(); } else { if (is_object($ref)) { $this->_reflect = new ReflectionClass($ref); $this->_class = get_class($ref); } else { try { $this->_reflect = new ReflectionClass((string) $ref); } catch (ReflectionException $e) { throw new IllegalStateException($e->getMessage()); } $this->_class = $ref; } } parent::__construct(xp::nameOf($this->_class)); }
public function __construct(\stdClass $data, \Tekook\TelegramLibrary\TelegramBotApi $api) { parent::__construct($data, $api); $this->checkData("message", true); $this->message = new \Tekook\TelegramLibrary\Types\Message($data->message, $api); }
/** * Construct the object * * @param string $name The identifier for the class * @param string $restriction The restriction(datatype) of the values */ function __construct($name, $restriction) { parent::__construct($name, $restriction); $this->values = array(); }
/** * Constructor. Use \iveeCore\Type::getById() to instantiate Sellable objects instead. * * @param int $id of the Sellable object * * @return \iveeCore\Sellable * @throws \iveeCore\Exceptions\TypeIdNotFoundException if typeID is not found */ protected function __construct($id) { //call parent constructor parent::__construct($id); $sdeClass = Config::getIveeClassName('SDE'); $sde = $sdeClass::instance(); $defaultsClass = Config::getIveeClassName('Defaults'); $defaults = $defaultsClass::instance(); //get market data $row = $sde->query("SELECT\n iveeTrackedPrices.typeID,\n UNIX_TIMESTAMP(lastHistUpdate) AS histDate,\n UNIX_TIMESTAMP(lastPriceUpdate) AS priceDate,\n iveeTrackedPrices.avgVol AS vol,\n iveeTrackedPrices.avgTx AS tx,\n ah.low,\n ah.high,\n ah.avg,\n ap.sell,\n ap.buy,\n ap.supplyIn5,\n ap.demandIn5,\n ap.avgSell5OrderAge,\n ap.avgBuy5OrderAge\n FROM iveeTrackedPrices\n LEFT JOIN iveePrices AS ah ON iveeTrackedPrices.newestHistData = ah.id\n LEFT JOIN iveePrices AS ap ON iveeTrackedPrices.newestPriceData = ap.id\n WHERE iveeTrackedPrices.typeID = " . $this->id . "\n AND iveeTrackedPrices.regionID = " . (int) $defaults->getDefaultRegionID() . ";")->fetch_assoc(); //set data to attributes if (isset($row['histDate'])) { $this->histDate = (int) $row['histDate']; } if (isset($row['priceDate'])) { $this->priceDate = (int) $row['priceDate']; } if (isset($row['vol'])) { $this->avgVol = (double) $row['vol']; } if (isset($row['sell'])) { $this->sellPrice = (double) $row['sell']; } if (isset($row['buy'])) { $this->buyPrice = (double) $row['buy']; } if (isset($row['tx'])) { $this->avgTx = (double) $row['tx']; } if (isset($row['low'])) { $this->low = (double) $row['low']; } if (isset($row['high'])) { $this->high = (double) $row['high']; } if (isset($row['avg'])) { $this->avg = (double) $row['avg']; } if (isset($row['supplyIn5'])) { $this->supplyIn5 = (int) $row['supplyIn5']; } if (isset($row['demandIn5'])) { $this->demandIn5 = (int) $row['demandIn5']; } if (isset($row['avgSell5OrderAge'])) { $this->avgSell5OrderAge = (int) $row['avgSell5OrderAge']; } if (isset($row['avgBuy5OrderAge'])) { $this->avgBuy5OrderAge = (int) $row['avgBuy5OrderAge']; } }
public function __construct(\stdClass $data) { parent::__construct($data); $this->checkData("file_id", true); $this->checkData("file_size", false, true); }
/** * * @param TypeDescription $typeDescription * @param bool $allowNull */ public function __construct(TypeDescription $typeDescription, $allowNull = false) { parent::__construct($typeDescription); $this->allowNull = $allowNull; }
public function __construct($name, $dataType) { parent::__construct($name, $dataType); }
public function __construct() { parent::__construct(new TypeDescription("None", null)); }
public function __construct(\stdClass $data) { parent::__construct($data); $this->checkData("longitude", true); $this->checkData("latitude", true); }
public function __construct(\stdClass $data) { parent::__construct($data); $this->checkData("id", true); $this->checkData("title", true); }
/** * Construct the object * * @param string $name The identifier for the class * @param string $restriction The restriction(datatype) of the values */ public function __construct($name, $restriction) { parent::__construct($name, $restriction); $this->value = ''; }
/** * @param string|nulll $class */ public function __construct($class) { parent::__construct('object'); $this->class = $class; }
/** * Construct the object * * @param string $name The identifier for the class * @param string $restriction The restriction(datatype) of the values */ public function __construct($name) { parent::__construct($name, null); $this->members = array(); }