示例#1
0
 /**
  * writeConstants
  *
  * @param WriterInterface $writer
  *
  * @return void
  */
 protected function writeConstants(WriterInterface $writer)
 {
     if (empty($this->constants)) {
         return;
     }
     foreach ($this->constants as $i => $constant) {
         $writer->writeln($constant->generate())->newline();
     }
     if (!$this->hasMethods()) {
         $writer->popln();
     }
 }
 /**
  * writeUseReplacement
  *
  * @param WriterInterface $writer
  * @param string $alias
  * @param string $method
  * @param string $replacement
  * @param string $visibility
  *
  * @return void
  */
 protected function writeConflictReplacement(WriterInterface $writer, $alias, $method, $replacement)
 {
     $writer->writeln(sprintf('%s::%s insteadof %s;', $alias, $method, $replacement));
 }
示例#3
0
 /**
  * {@inheritdoc}
  */
 protected function openBlock(WriterInterface $writer)
 {
     return $writer->writeln('/*');
 }
示例#4
0
 /**
  * getObjectBody
  *
  * @param Writer $writer
  *
  * @return Writer
  */
 protected function writeObjectBody(WriterInterface $writer)
 {
     if (empty($this->methods)) {
         return $writer;
     }
     if ($this->hasItemsBeforeMethods()) {
         $writer->newline();
     }
     foreach ($this->methods as $method) {
         $writer->writeln($method)->newline();
     }
     $writer->popln();
     return $writer;
 }
示例#5
0
 /**
  * blockLine
  *
  * @param WriterInterface $writer
  * @param array $lines
  *
  * @return void
  */
 protected function blockLines(WriterInterface $writer, array $lines)
 {
     if ($this->inline && 1 === count($lines)) {
         $this->setInline = true;
         $prefix = ' ';
     } else {
         $prefix = ' * ';
     }
     foreach ($lines as $line) {
         $writer->writeln($prefix . $line);
     }
 }