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


PHP Console::getScreenSize方法代码示例

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


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

示例1: determineOwnSize

 /**
  * Determines and set the size of the frame, if the attributes were not set
  * before.
  *
  * TODO: Create dummy parent frame with size of console and fire the resize
  * event.
  */
 protected function determineOwnSize()
 {
     // True for the outermost frame only
     if ($this->width == null || $this->height === null) {
         // TODO: allow to define fixed size in which the frame is beeing rendered within.
         $screenSize = Console::getScreenSize();
         if ($screenSize === false) {
             throw new UserException('Couldnt determine console window size!');
         }
         list($screenWidth, $screenHeight) = $screenSize;
         if ($this->width === null && $this->layout === self::LAYOUT_HORIZONTAL) {
             if (is_float($this->size)) {
                 $this->width = intval(round($screenWidth * $this->size));
             } elseif (is_integer($this->size)) {
                 $this->width = $this->size;
             } else {
                 $this->width = $screenWidth;
             }
         }
         if ($this->height === null && $this->layout === self::LAYOUT_VERTICAL) {
             if (is_float($this->size)) {
                 $this->height = intval(round($screenHeight * $this->size));
             } elseif (is_integer($this->size)) {
                 $this->height = $this->size;
             } else {
                 $this->height = $screenHeight;
             }
         }
         if ($this->width === null) {
             $this->width = $screenWidth;
         }
         if ($this->height === null) {
             $this->height = $screenHeight;
         }
         if ($this->width > $screenWidth || $this->height > $screenHeight) {
             throw new UserException('GUI dimensions are too large!');
         }
         $this->trigger(self::EVENT_FRAME_RESIZE, $this->createResizeEvent());
     }
 }
开发者ID:coksnuss,项目名称:yii2-cli-layoutbuilder,代码行数:47,代码来源:GuiFrame.php

示例2: getScreenWidth

 protected function getScreenWidth() : int
 {
     return Console::getScreenSize(true)[0];
 }
开发者ID:ltd-beget,项目名称:yiiic,代码行数:4,代码来源:Yiiic.php

示例3: clearScreen

 public static function clearScreen()
 {
     $size = \yii\helpers\Console::getScreenSize();
     echo str_repeat("\n", $size[0]);
 }
开发者ID:carono,项目名称:yii2-installer,代码行数:5,代码来源:Console.php


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