當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Utils::isIntOrPercent方法代碼示例

本文整理匯總了PHP中Khill\Lavacharts\Utils::isIntOrPercent方法的典型用法代碼示例。如果您正苦於以下問題:PHP Utils::isIntOrPercent方法的具體用法?PHP Utils::isIntOrPercent怎麽用?PHP Utils::isIntOrPercent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Khill\Lavacharts\Utils的用法示例。


在下文中一共展示了Utils::isIntOrPercent方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: barGroupWidth

 /**
  * The width of a group of bars, specified in either of these formats:
  * - Pixels (e.g. 50).
  * - Percentage of the available width for each group (e.g. '20%'),
  *   where '100%' means that groups have no space between them.
  *
  * @param  int|string $barGroupWidth
  * @return \Khill\Lavacharts\Charts\Chart
  * @throws \Khill\Lavacharts\Exceptions\InvalidConfigValue
  */
 public function barGroupWidth($barGroupWidth)
 {
     if (Utils::isIntOrPercent($barGroupWidth) === false) {
         throw new InvalidConfigValue(static::TYPE . '->' . __FUNCTION__, 'int|string', 'String only if representing a percent. "50%"');
     }
     return $this->setOption(__FUNCTION__, ['groupWidth' => $barGroupWidth]);
 }
開發者ID:tahertechs,項目名稱:lavacharts,代碼行數:17,代碼來源:BarGroupWidthTrait.php

示例2: barGroupWidth

 /**
  * The width of a group of bars, specified in either of these formats:
  * - Pixels (e.g. 50).
  * - Percentage of the available width for each group (e.g. '20%'),
  *   where '100%' means that groups have no space between them.
  *
  * @param  mixed       $barGroupWidth
  * @return BarChart
  */
 public function barGroupWidth($barGroupWidth)
 {
     if (Utils::isIntOrPercent($barGroupWidth)) {
         $this->addOption(array('bar' => array('groupWidth' => $barGroupWidth)));
     } else {
         throw $this->invalidConfigValue(__FUNCTION__, 'string | int', 'must be a valid int or percent [ 50 | 65% ]');
     }
     return $this;
 }
開發者ID:antoniotajuelo,項目名稱:lavacharts,代碼行數:18,代碼來源:BarChart.php

示例3: height

 /**
  * Sets the height of the chart in the container.
  *
  * @param  int                $height Amount in pixels
  * @throws InvalidConfigValue
  * @return ChartArea
  */
 public function height($height)
 {
     if (Utils::isIntOrPercent($height)) {
         $this->height = $height;
     } else {
         throw new InvalidConfigValue(__FUNCTION__, 'int | string', 'representing pixels or a percent.');
     }
     return $this;
 }
開發者ID:alvarobfdev,項目名稱:applog,代碼行數:16,代碼來源:ChartArea.php

示例4: testIntOrPercentWithBadParams

 /**
  * @dataProvider badParamsProvider
  */
 public function testIntOrPercentWithBadParams($value)
 {
     $this->assertFalse(Utils::isIntOrPercent($value));
 }
開發者ID:alvarobfdev,項目名稱:applog,代碼行數:7,代碼來源:UtilsIsIntOrPercentTest.php

示例5: setIntOrPercentOption

 /**
  * Sets the value of an integer option.
  *
  * @param  string $option Option to set.
  * @param  int    $value Value of the option.
  * @return \Khill\Lavacharts\JsonConfig
  * @throws \Khill\Lavacharts\Exceptions\InvalidConfigValue
  * @throws \Khill\Lavacharts\Exceptions\InvalidOption
  */
 protected function setIntOrPercentOption($option, $value)
 {
     if (Utils::isIntOrPercent($value) === false) {
         throw new InvalidConfigValue(static::TYPE . '->' . $option, 'int|string', 'String only if representing a percent. "50%"');
     }
     $this->options->set($option, $value);
     return $this;
 }
開發者ID:tahertechs,項目名稱:lavacharts,代碼行數:17,代碼來源:JsonConfig.php


注:本文中的Khill\Lavacharts\Utils::isIntOrPercent方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。