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


PHP ezcConsoleOutput::isValidFormatCode方法代碼示例

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


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

示例1: getFormatCode

 /**
  * Returns the code for a given formating option of a given type.
  *
  * $type is the type of formating ('color', 'bgcolor' or 'style'), $key the
  * name of the format to lookup. Returns the numeric code for the requested
  * format or 0 if format or type do not exist.
  * 
  * @see ezcConsoleOutput::isValidFormatCode()
  * 
  * @param string $type Formatting type.
  * @param string $key  Format option name.
  * @return int The code representation.
  */
 protected function getFormatCode($type, $key)
 {
     if (!ezcConsoleOutput::isValidFormatCode($type, $key)) {
         return 0;
     }
     return ezcConsoleOutput::${$type}[$key];
 }
開發者ID:sakshika,項目名稱:ATM,代碼行數:20,代碼來源:output.php

示例2: array

<?php

class ezcConsoleOutput
{
    protected static $color = array('gray' => 30);
    public static function isValidFormatCode($type, $key)
    {
        return isset(self::${$type}[$key]);
    }
}
var_dump(ezcConsoleOutput::isValidFormatCode('color', 'gray'));
開發者ID:badlamer,項目名稱:hhvm,代碼行數:11,代碼來源:bug53347.php

示例3: __set

 /**
  * Overloaded __set() method to gain read-only access to properties.
  * It also performs checks on setting others.
  *
  * @throws ezcBasePropertyNotFoundException
  *         If the setting you try to access does not exists
  * @throws ezcBaseValueException
  *         If trying to set an invalid value for a setting.
  * 
  * @param string $propertyName Name of the attrinbute to access.
  * @param string $val The value to set.
  * @ignore
  */
 public function __set($propertyName, $val)
 {
     if (!isset($this->properties[$propertyName])) {
         throw new ezcBasePropertyNotFoundException($propertyName);
     }
     // Extry handling of multi styles
     if ($propertyName === 'style') {
         if (!is_array($val)) {
             $val = array($val);
         }
         foreach ($val as $style) {
             if (!ezcConsoleOutput::isValidFormatCode($propertyName, $style)) {
                 throw new ezcBaseValueException($propertyName, $style, 'valid ezcConsoleOutput format code');
             }
         }
         $this->properties['style'] = $val;
         return;
     }
     // Continue normal handling
     if (($propertyName === "color" || $propertyName === "bgcolor") && !ezcConsoleOutput::isValidFormatCode($propertyName, $val)) {
         throw new ezcBaseValueException($propertyName, $val, 'valid ezcConsoleOutput format code');
     }
     $this->properties[$propertyName] = $val;
 }
開發者ID:sakshika,項目名稱:ATM,代碼行數:37,代碼來源:output_format.php


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