當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。