当前位置: 首页>>代码示例>>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;未经允许,请勿转载。