示例#1
0
 /**
  * The possible options are:
  * - debug_level: level of debug if it's not specified it's set by debugObject to DEBUG_DEFAULT_LEVEL
  * - logfile (string): path to the logging file (Default: @see debugCsv::DEFAULT_DEBUG_CSV_PATH).
  * - append (bool): if true new debug information are appended at the end of the file;
  *   if it's false the file is deleted and recreated each time (Default: true).
  * - delimiter (char): sets the field delimiter (one character only). Default: @see DEBUG_DEFAULT_CSV_DELIMITER.  
  * - enclosure (char): the optional enclosure parameter sets the field enclosure (one character only). Default: @see DEBUG_DEFAULT_CSV_ENCLOSURE.
  * @param array $options
  */
 public function __construct($options = null)
 {
     parent::__construct($options);
     $this->_logfile = !isset($options['logfile']) ? $options['logfile'] : DEBUG_DEFAULT_LOGFILE;
     $this->_append = filter_var($options['append'], FILTER_VALIDATE_BOOLEAN, array('options' => array('default' => DEBUG_DEFAULT_LOG_APPEND)));
     $this->_delimiter = !isset($options['delimiter']) || !is_char($options['delimiter']) ? DEBUG_DEFAULT_CSV_DELIMITER : $options['delimiter'];
     $this->_enclosure = !isset($options['enclosure']) || !is_char($options['enclosure']) ? DEBUG_DEFAULT_CSV_ENCLOSURE : $options['enclosure'];
     if (!$_append) {
         $fd = @fopen($this->_logfile, 'w');
         fclose($fd);
     }
 }
示例#2
0
文件: string.php 项目: tapiau/muyo
 /**
  * @param string|callable|null $char
  * @param string|callable|null $placeholder
  * @return string
  */
 function char_accent_map_dg($char = null, $placeholder = null)
 {
     if (null === $char) {
         $char = tuple_get(0);
     } elseif (is_char($char)) {
         $char = return_dg($char);
     } else {
         debug_enforce_type($char, 'callable');
     }
     if (is_null($placeholder)) {
         $placeholder = return_dg('-');
     } elseif (is_string($placeholder)) {
         $placeholder = return_dg($placeholder);
     } else {
         debug_enforce_type($placeholder, 'callable');
     }
     $map = char_accent_map_element();
     return function () use($map, $char, $placeholder) {
         $args = func_get_args();
         $c = call_user_func_array($char, $args);
         $ret = array_key_exists($c, $map) ? $map[$c] : call_user_func_array($placeholder, $args);
         return $ret;
     };
 }