当前位置: 首页>>代码示例>>PHP>>正文


PHP Writer类代码示例

本文整理汇总了PHP中Writer的典型用法代码示例。如果您正苦于以下问题:PHP Writer类的具体用法?PHP Writer怎么用?PHP Writer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Writer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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

示例10: 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

示例11: 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

示例12: 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

示例13: 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

示例14: 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

示例15: 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


注:本文中的Writer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。