/** * @param string $module * @param string $source * @param ArrayObject $errors */ public function __construct($module, $source, ArrayObject $errors) { $this->module = $module; $this->source = $source; $this->errors = $errors; parent::__construct(Core_Strings::format('Invalid source for module %s (errors: %d)', $this->module, count($this->errors))); }
/** */ protected function output($result) { switch ($application = $this->config->application) { case 'dot': case 'neato': case 'fdp': case 'circo': case 'twopi': Proc::Pipe(Core_Strings::format('%s -T%s %s', $application, $this->config->format, $this->config->output ? ' -o ' . $this->config->output : ''), 'w')->write($result)->close(); break; default: throw new Dev_Diagram_Exception(Core_Strings::format('Unknown application (%s)', $application)); } }
/** * @param Dev_Source_Module $module * @param Dev_Source_Check_Result $result */ public function run(Dev_Source_Module $module, Dev_Source_Check_Result $result) { $this->result = $result; $this->module = $module; try { $xml = Dev_Source::Library($module->name)->xml; set_error_handler(array($this, 'error_handler'), E_WARNING); $xml->relaxNGValidate('etc/tao-doc.rng'); restore_error_handler(); } catch (Dev_Source_InvalidSourceException $e) { foreach ($e->errors as $error) { $result->add_error($this, $module, Core_Strings::format("%s: %d : %s", $module->name, $error->line, $error->message)); } } }
public function test_format() { $this->assertEquals(Core_Strings::format("%04d-%02d-%02d", '1988', '08', '01'), "1988-08-01"); }
/** * Возвращает строку в виде пригодном для PDO * * @return string */ protected function as_pdo_string() { return Core_Strings::format("%s:host=%s;dbname=%s", $this->type, $this->host, $this->database) . ($this->port ? ";port={$this->port}" : '') . ($this->scheme ? ";scheme={$this->scheme}" : ''); }
/** * Устанавливает значение по ключу с заданным таймаутом или с таймаутом по умолчанию * * @param string $key * @param $value * @param int $timeout * * @return boolean */ public function set($key, $value, $timeout = null) { try { $timeout = is_null($timeout) ? $this->timeout : $timeout; Events::call('cache.set', $key, $value, $timeout); $t = $timeout === 0 ? $timeout : time() + Core::if_null($timeout, $this->timeout); $f = IO_FS::File($this->path($key)); $s = $f->open('w+')->text(); $s->write_line(Core_Strings::format('%10d', $t))->write(serialize($value))->close(); $f->set_permission(); if ($this->use_array_cache) { $this->values[$key] = $value; $this->timestamps[$key] = $t; } return true; } catch (Exception $e) { return false; } }