当前位置: 首页>>代码示例>>PHP>>正文


PHP Type::__construct方法代码示例

本文整理汇总了PHP中Type::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP Type::__construct方法的具体用法?PHP Type::__construct怎么用?PHP Type::__construct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Type的用法示例。


在下文中一共展示了Type::__construct方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 public function __construct($value = null, array $options = null)
 {
     if (is_string($value)) {
         $value = trim($value);
     }
     parent::__construct($value, $options);
 }
开发者ID:karwana,项目名称:penelope,代码行数:7,代码来源:Text.php

示例2: __construct

 /**
  * 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;
             }
         }
     }
 }
开发者ID:Covert-Inferno,项目名称:iveeCore,代码行数:40,代码来源:Reaction.php

示例3: __construct

 public function __construct(Type $type)
 {
     $described = $type->getTypeDescription()->describe();
     $described[static::$propertyPrefix . 'allowNull'] = true;
     parent::__construct(new TypeDescription("", $described));
     $this->type = $type;
 }
开发者ID:mmagyar,项目名称:typage-php,代码行数:7,代码来源:Nullable.php

示例4: __construct

 /**
  * 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);
         }
     }
 }
开发者ID:Covert-Inferno,项目名称:iveeCore,代码行数:35,代码来源:Decryptor.php

示例5: __construct

 /**
  * 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 . ']');
     }
 }
开发者ID:melogamepay,项目名称:xp-framework,代码行数:13,代码来源:MapType.class.php

示例6: __construct

 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);
 }
开发者ID:Garyao,项目名称:TelegramLibrary,代码行数:8,代码来源:User.php

示例7: __construct

 /**
  * 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);
 }
开发者ID:johannes85,项目名称:core,代码行数:14,代码来源:WildcardType.class.php

示例8: __construct

 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);
 }
开发者ID:Garyao,项目名称:TelegramLibrary,代码行数:8,代码来源:Contact.php

示例9: __construct

 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;
 }
开发者ID:mmagyar,项目名称:typage-php,代码行数:8,代码来源:Either.php

示例10: __construct

 /**
  * 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);
 }
开发者ID:johannes85,项目名称:core,代码行数:14,代码来源:FunctionType.class.php

示例11: __construct

 /**
  * 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);
 }
开发者ID:johannes85,项目名称:core,代码行数:16,代码来源:TypeUnion.class.php

示例12: __construct

 /**
  * 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 . ']', []);
     }
 }
开发者ID:johannes85,项目名称:core,代码行数:15,代码来源:MapType.class.php

示例13: __construct

 /**
  * 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);
 }
开发者ID:Covert-Inferno,项目名称:iveeCore,代码行数:18,代码来源:Blueprint.php

示例14: __construct

 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);
         }
     }
 }
开发者ID:Garyao,项目名称:TelegramLibrary,代码行数:12,代码来源:UserProfilePhotos.php

示例15: __construct

 /**
  * 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'];
     }
 }
开发者ID:Covert-Inferno,项目名称:iveeCore,代码行数:21,代码来源:ReactionProduct.php


注:本文中的Type::__construct方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。