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


PHP Writer::write方法代码示例

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


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

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

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

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

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

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

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

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

示例8: write

 /**
  * 配列をCSV形式で書き出す
  * @access public
  * @see Writer::write()
  */
 function write($arr)
 {
     $enclosure = preg_quote($this->enclosure);
     foreach ($arr as $index => $ar) {
         if (!is_string($ar)) {
             continue;
         }
         // 文字列中に"がある場合は""に置換える
         // RFC4180
         if (mb_strstr($ar, $this->enclosure) !== false) {
             $ar = preg_replace('/' . $enclosure . '/', $this->enclosure . $this->enclosure, $ar);
         }
         // 文字列の場合は囲み文字を追加する
         $ar = $this->enclosure . $ar . $this->enclosure;
         $arr[$index] = $ar;
     }
     parent::write(implode($this->delimiter, $arr) . $this->newLineChar);
 }
开发者ID:weiweiabc109,项目名称:test_project1,代码行数:23,代码来源:CsvWriter.class.php

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

示例10: writeTable

 /**
  * Write PHP array, as table. Input array format: keys are strings,
  * values are (type,value) tuples.
  *
  * @param $d
  *
  * @return Writer
  */
 public function writeTable($d)
 {
     $this->flushBits();
     $table_data = new Writer();
     foreach ($d as $k => $va) {
         list($ftype, $v) = $va;
         $table_data->writeShortStr($k);
         if ($ftype == 'S') {
             $table_data->write('S');
             $table_data->writeLongStr($v);
         } else {
             if ($ftype == 'I') {
                 $table_data->write('I');
                 $table_data->_writeSignedLong($v);
             } else {
                 if ($ftype == 'D') {
                     // 'D' type values are passed Decimal instances.
                     $table_data->write('D');
                     $table_data->writeOctet($v->e);
                     $table_data->_writeSignedLong($v->n);
                 } else {
                     if ($ftype == 'T') {
                         $table_data->write('T');
                         $table_data->writeTimestamp($v);
                     } else {
                         if ($ftype == 'F') {
                             $table_data->write('F');
                             $table_data->writeTable($v);
                         } else {
                             if ($ftype = 'A') {
                                 $table_data->write('A');
                                 $table_data->writeArray($v);
                             }
                         }
                     }
                 }
             }
         }
     }
     $table_data = $table_data->getvalue();
     $this->writeLong(strlen($table_data));
     $this->write($table_data);
     return $this;
 }
开发者ID:zircote,项目名称:amqp,代码行数:52,代码来源:Writer.php

示例11: write

 public function write($output)
 {
     return $this->writer->write($output);
 }
开发者ID:syhol,项目名称:asclay,代码行数:4,代码来源:TerminalFacade.php

示例12: testWriteToMimeDir

 function testWriteToMimeDir()
 {
     $result = Writer::write($this->getComponent());
     $this->assertEquals("BEGIN:VCALENDAR\r\nEND:VCALENDAR\r\n", $result);
 }
开发者ID:ddolbik,项目名称:sabre-vobject,代码行数:5,代码来源:WriterTest.php

示例13: pipe

 function pipe(Writer $writer)
 {
     while ($v = $this->read()) {
         $writer->write($v);
     }
 }
开发者ID:jgswift,项目名称:qio,代码行数:6,代码来源:Reader.php

示例14: appendFile

 /**
  * @param FileWriter $writer
  * @param PhingFile $f
  *
  * @return void
  */
 private function appendFile(Writer $writer, PhingFile $f)
 {
     $in = $this->getFilteredReader(new FileReader($f));
     $text = '';
     while (-1 !== ($buffer = $in->read())) {
         // -1 indicates EOF
         $text .= $buffer;
     }
     if ($this->fixLastLine && ($text[strlen($text) - 1] !== "\n" || $text[strlen($text) - 1] !== "\r")) {
         $text .= $this->eolString;
     }
     $text = $this->appendHeader($text);
     $text = $this->appendFooter($text);
     $writer->write($text);
     if ($f instanceof PhingFile && $this->to instanceof PhingFile) {
         $this->log("Appending contents of " . $f->getPath() . " to " . $this->to->getPath());
     }
 }
开发者ID:kenguest,项目名称:phing,代码行数:24,代码来源:AppendTask.php

示例15: write

 /**
  * Returns the document as a string
  *
  * @param  string  $format  the desired format (optional; if omitted, defaults
  *      to 'rtf')
  * @return  string
  * @throws  InvalidArgumentException  if $format is not a string
  * @since  0.1.0
  */
 public function write($format = 'rtf')
 {
     $string = '';
     // if $format is a string
     if (is_string($format)) {
         $writer = new Writer();
         $string = $writer->write($this->root, $format);
     } else {
         throw new \InvalidArgumentException(__METHOD__ . "() expects parameter one, format, to be a string");
     }
     return $string;
 }
开发者ID:jstewmc,项目名称:rtf,代码行数:21,代码来源:Document.php


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