本文整理汇总了PHP中Writer类的典型用法代码示例。如果您正苦于以下问题:PHP Writer类的具体用法?PHP Writer怎么用?PHP Writer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Writer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: serialize
public static function serialize($var, $simple = false)
{
$stream = new BytesIO();
$writer = new Writer($stream, $simple);
$writer->serialize($var);
return $stream->toString();
}
开发者ID:iwillhappy1314,项目名称:laravel-admin,代码行数:7,代码来源:Formatter.php
示例2: run
public function run()
{
$writer = new Writer($this->config['parameters'], $this->config['dataFolder']);
$tables = $this->config['storage']['input']['tables'];
foreach ($tables as $table) {
$writer->write($table);
}
}
开发者ID:keboola,项目名称:gd-metrics-writer,代码行数:8,代码来源:Application.php
示例3: exampleStripNodes
/**
* Strip statements
*
* @expectOutputRegex #echo 'bar';#
*/
public function exampleStripNodes()
{
$reader = new Reader("<?php require 'Foo.php'; echo 'bar';");
$writer = new Writer();
$writer->apply(new Action\NodeStripper('Expr_Include'));
// Outputs the echo statement
echo $writer->write($reader->readAll());
}
开发者ID:bonroyage,项目名称:classtools,代码行数:13,代码来源:TransformerExamples.php
示例4: testPhpParserException
public function testPhpParserException()
{
$traverser = $this->getMock('PhpParser\\NodeTraverser');
$traverser->expects($this->once())->method('traverse')->will($this->throwException(new \PhpParser\Error('error')));
$writer = new Writer($traverser);
$this->setExpectedException('hanneskod\\classtools\\Exception\\RuntimeException');
$writer->write([]);
}
开发者ID:bonroyage,项目名称:classtools,代码行数:8,代码来源:WriterTest.php
示例5: testWriteIntegers
public function testWriteIntegers()
{
$w = new Writer(tmpfile(), array('hasHeader' => true));
$numbers = array('zero' => 0, 'one' => 1, 'two' => 2, 'three' => 3, 'four' => 4, 'five' => 5);
$w->write($numbers);
foreach ($w as $line) {
$this->assertEquals($line, $numbers);
}
}
开发者ID:mmerian,项目名称:csv,代码行数:9,代码来源:WriterTest.php
示例6: generate
public function generate()
{
$parseData = \EventController::callFilter(self::EventName, $this->data->getValue());
$view = new View($this->tpl->getValue());
$view->addHelper(new ViewHelper());
$view->set($parseData);
$content = $view->render();
$writer = new Writer($this->url->getValue());
$writer->write($content);
}
开发者ID:gudwin,项目名称:extasy,代码行数:10,代码来源:Page.php
示例7: testRender
public function testRender()
{
$writer = new Writer();
$property = new \ReflectionProperty($writer, 'collection');
$property->setAccessible(true);
$meta = new Meta(array('test' => 'fun'));
$writer->add($meta);
$writer->add($meta);
$this->assertEquals("<meta test=\"fun\" />\n<meta test=\"fun\" />\n", $writer->render());
}
开发者ID:mauris,项目名称:htmlmeta,代码行数:10,代码来源:WriterTest.php
示例8: execute
public function execute()
{
$iterator = new \DirectoryIterator($this->inputDir);
$interpreter = new Interpreter();
$operations = [];
foreach ($iterator as $path) {
if ($path->getExtension() === 'rst') {
$operations[] = $interpreter->parse(file_get_contents($path->getRealPath()));
}
}
$operations = array_values(array_filter($operations));
usort($operations, function ($a, $b) {
return strlen($a['path']) - strlen($b['path']);
});
$writer = new Writer($this->outputDir, $this->namespace, $operations);
$writer->write();
}
开发者ID:php-opencloud,项目名称:scraper,代码行数:17,代码来源:Finder.php
示例9: endElement
/**
* Handles closing elements of the xml file.
*
* @param $name The local name (without prefix), or the empty string if
* Namespace processing is not being performed.
*/
public function endElement($name)
{
if (self::DEBUG) {
print "endElement(" . $name . ") called\n";
}
if ($name == "dataset") {
if ($this->currBuilder !== null) {
$this->sqlWriter->write($this->currBuilder->getTableEndSql());
}
$this->sqlWriter->write(call_user_func(array($this->builderClazz, 'getDatabaseEndSql')));
}
}
开发者ID:RafalFilipek,项目名称:Propel2,代码行数:18,代码来源:XmlToDataSQL.php
示例10: testSaveGlobalUseStatements
public function testSaveGlobalUseStatements()
{
$reader = new Reader(<<<EOF
<?php
use random\\Exception;
class ClassName
{
}
EOF
);
$expected = <<<EOF
namespace {
use random\\Exception;
class ClassName
{
}
}
EOF;
$writer = new Writer();
$this->assertEquals($expected, $writer->write($reader->read('ClassName')));
}
开发者ID:bonroyage,项目名称:classtools,代码行数:21,代码来源:UseStmtTranslationTest.php
示例11: testWriter
public function testWriter()
{
$writer = new Writer();
$writer->addService('http://www.myopenid.com/server', array('http://specs.openid.net/auth/2.0/signon'));
$writer->addService('http://www.myopenid.com/server', array('http://specs.openid.net/auth/2.0/signon'), 20);
$actual = $writer->toString();
$expected = <<<'XML'
<?xml version="1.0" encoding="UTF-8"?>
<xrds:XRDS xmlns="xri://$xrd*($v*2.0)" xmlns:xrds="xri://$xrds">
<XRD>
<Service>
<Type>http://specs.openid.net/auth/2.0/signon</Type>
<URI>http://www.myopenid.com/server</URI>
</Service>
<Service priority="20">
<Type>http://specs.openid.net/auth/2.0/signon</Type>
<URI>http://www.myopenid.com/server</URI>
</Service>
</XRD>
</xrds:XRDS>
XML;
$this->assertXmlStringEqualsXmlString($expected, $actual);
}
开发者ID:k42b3,项目名称:psx-ws,代码行数:23,代码来源:WriterTest.php
示例12: init
public function init(SurveyObj $survey, $sLanguageCode, FormattingOptions $oOptions)
{
parent::init($survey, $sLanguageCode, $oOptions);
$this->workbook = new XLSXWriter();
$this->workbook->setTempDir(Yii::app()->getConfig('tempdir'));
$worksheetName = $survey->languageSettings['surveyls_title'];
$worksheetName = substr(str_replace(array('*', ':', '/', '\\', '?', '[', ']'), array(' '), $worksheetName), 0, 31);
// Remove invalid characters
if ($worksheetName == '') {
$worksheetName = 'survey_' . $survey->id;
}
$this->currentSheet = $worksheetName;
$this->forceDownload = !($oOptions->output == 'file');
}
开发者ID:sickpig,项目名称:LimeSurvey,代码行数:14,代码来源:ExcelWriter.php
示例13: testWriteAndRead
public function testWriteAndRead()
{
$config = new Config(array('default' => array('test' => 'foo')));
$this->writer->toFile($this->getTestAssetFileName(), $config);
$config = $this->reader->fromFile($this->getTestAssetFileName());
$this->assertEquals('foo', $config['default']['test']);
}
开发者ID:rikaix,项目名称:zf2,代码行数:7,代码来源:AbstractWriterTestCase.php
示例14: testSetException
/**
* @covers Itkg\Batch\State::setException
*/
public function testSetException()
{
$e = new \Exception();
$this->object->setException($e);
$this->assertEquals($e, $this->object->getException());
$this->assertEquals(1, $this->object->getStatus());
}
开发者ID:itkg,项目名称:batch,代码行数:10,代码来源:StateTest.php
示例15: testFormatBatch
/**
* test formatBatch
*/
public function testFormatBatch()
{
$text = "it's a test";
$text2 = "it's another test";
$record = array('message' => $text);
$record2 = array('message' => $text2);
$this->assertEquals($text . $text2, $this->object->formatBatch(array($record, $record2)));
}
开发者ID:itkg,项目名称:log,代码行数:11,代码来源:StringFormatterTest.php
示例16: dispatch
/**
* Dispatch all raised events.
*
* @param array $events
*/
public function dispatch(array $events)
{
foreach ($events as $event) {
$eventName = $this->getEventName($event);
$this->event->fire($eventName, $event);
$this->log->info("{$eventName} was fired.");
}
}
开发者ID:DeSmart,项目名称:laravel-domain-core,代码行数:13,代码来源:EventDispatcher.php
示例17: init
public function init(SurveyObj $survey, $sLanguageCode, FormattingOptions $oOptions)
{
parent::init($survey, $sLanguageCode, $oOptions);
if ($oOptions->output == 'display') {
header("Content-Disposition: attachment; filename=survey_" . $survey->id . "_R_syntax_file.R");
header("Content-type: application/download; charset=UTF-8");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Pragma: public");
$this->handle = fopen('php://output', 'w');
} elseif ($oOptions->output == 'file') {
$this->handle = fopen($this->filename, 'w');
}
$this->out('data <- read.csv("survey_' . $survey->id . '_R_data_file.csv", quote = "\'\\"", na.strings=c("", "\\"\\""), stringsAsFactors=FALSE)');
$this->out("");
$this->out("");
$oOptions->headingFormat = 'code';
// Always use fieldcodes
// R specific stuff
Yii::app()->loadHelper("export");
$tmpFieldmap = SPSSFieldMap($survey->id);
foreach ($tmpFieldmap as $field => $values) {
$fieldmap[$values['title']] = $values;
if (array_key_exists('sql_name', $values)) {
$fieldmap[$values['sql_name']] = $values;
}
}
$this->customFieldmap = $fieldmap;
}
开发者ID:jdbaltazar,项目名称:survey-office,代码行数:28,代码来源:RSyntaxWriter.php
示例18: init
public function init(SurveyObj $survey, $sLanguageCode, FormattingOptions $oOptions)
{
parent::init($survey, $sLanguageCode, $oOptions);
$this->survey = $survey;
if ($oOptions->output == 'display') {
//header("Content-Disposition: attachment; filename=results-survey".$survey->id.".html");
header("Content-type: text/html; charset=UTF-8");
$this->handle = fopen('php://output', 'w');
} elseif ($oOptions->output == 'file') {
$this->handle = fopen($this->filename, 'w');
}
$this->groupMap = array();
$index = 0;
foreach ($oOptions->selectedColumns as $column) {
if (isset($survey->fieldMap[$column])) {
$question = $survey->fieldMap[$column];
} else {
// Token field
$question = array('gid' => 0, 'qid' => '');
}
$question['index'] = $index;
$this->groupMap[intval($question['gid'])][] = $question;
$index++;
}
}
开发者ID:jdbaltazar,项目名称:survey-office,代码行数:25,代码来源:HtmlWriter.php
示例19: init
public function init(SurveyObj $survey, $sLanguageCode, FormattingOptions $oOptions)
{
parent::init($survey, $sLanguageCode, $oOptions);
App()->setLanguage($sLanguageCode);
if ($oOptions->output == 'display') {
header("Content-Disposition: attachment; filename=results-survey" . $survey->id . ".doc");
header("Content-type: application/vnd.ms-word");
}
$sOutput = '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<style>
table {
border-collapse:collapse;
}
td, th {
border:solid black 1.0pt;
}
th {
background: #c0c0c0;
}
</style>';
if ($oOptions->output == 'display') {
echo $sOutput;
} elseif ($oOptions->output == 'file') {
$this->file = fopen($this->filename, 'w');
$this->output = $sOutput;
}
}
开发者ID:wrenchpilot,项目名称:LimeSurvey,代码行数:27,代码来源:DocWriter.php
示例20: end
public function end()
{
$schemas = $this->document->getPhysicalModel()->getCatalog()->getSchemas();
$filename = $schemas[0]->getName() . '.' . $this->document->getFormatter()->getFileExtension();
$this->storage->save($filename, (string) $this->aggregate);
parent::end();
}
开发者ID:codifico,项目名称:mysql-workbench-schema-exporter,代码行数:7,代码来源:AggregateWriter.php
注:本文中的Writer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论