public function readInto(\blaze\lang\StringBuffer $buffer = null, $off = -1, $len = -1) { $result = $this->read($len); $read = strlen($result); if ($off < 0) { $buffer->append($result); } else { $buffer->insert($result, $off); } return $read; }
public function readInto(\blaze\lang\StringBuffer $buffer = null, $off = -1, $len = -1) { $result = unserialize($this->getNext()); $read = strlen($str); if ($len != -1 && $read != $len) { throw new \blaze\io\StreamCorruptedException('Tried to read ' . $len . ' chars for the next token but the token has ' . $read . ' characters.'); } if ($off < 0) { $buffer->append($result); } else { $buffer->insert($result, $off); } return $read; }
public function generate(\blaze\lang\StringBuffer $buffer) { $buffer->append("\t" . '/**' . PHP_EOL); $buffer->append("\t" . ' * @var ' . $this->type . PHP_EOL); $buffer->append("\t" . ' */' . PHP_EOL); $buffer->append("\t" . 'private $'); $buffer->append($this->name); $buffer->append(';' . PHP_EOL . PHP_EOL); $buffer->append("\t" . '/**' . PHP_EOL); $buffer->append("\t" . ' * @return ' . $this->type . PHP_EOL); $buffer->append("\t" . ' */' . PHP_EOL); $buffer->append("\t" . 'public function get' . $this->name->toUpperCase(true)->toNative() . '(){' . PHP_EOL); $buffer->append("\t" . "\t" . ' return $this->' . $this->name . ';' . PHP_EOL); $buffer->append("\t" . '}' . PHP_EOL . PHP_EOL); $buffer->append("\t" . '/**' . PHP_EOL); $buffer->append("\t" . ' * @param ' . $this->type . ' $' . $this->name . PHP_EOL); $buffer->append("\t" . ' */' . PHP_EOL); $buffer->append("\t" . 'public function set' . $this->name->toUpperCase(true)->toNative() . '($' . $this->name . '){' . PHP_EOL); $buffer->append("\t" . "\t" . ' $this->' . $this->name . ' = $' . $this->name . ';' . PHP_EOL); $buffer->append("\t" . '}' . PHP_EOL . PHP_EOL); }
public function generate(\blaze\lang\StringBuffer $buffer) { $buffer->append("\t" . '/**' . PHP_EOL); $buffer->append("\t" . ' * @var blaze\\collections\\Set[' . $this->classDescriptor->getFullName() . ']' . PHP_EOL); $buffer->append("\t" . ' */' . PHP_EOL); $buffer->append("\t" . 'private $'); $buffer->append($this->fieldDescriptor->getName()); $buffer->append(';' . PHP_EOL . PHP_EOL); $buffer->append("\t" . '/**' . PHP_EOL); $buffer->append("\t" . ' * @return blaze\\collections\\Set[' . $this->classDescriptor->getFullName() . ']' . PHP_EOL); $buffer->append("\t" . ' */' . PHP_EOL); $buffer->append("\t" . 'public function get' . $this->fieldDescriptor->getName()->toUpperCase(true)->toNative() . '(){' . PHP_EOL); $buffer->append("\t" . "\t" . ' return $this->' . $this->fieldDescriptor->getName() . ';' . PHP_EOL); $buffer->append("\t" . '}' . PHP_EOL . PHP_EOL); $buffer->append("\t" . '/**' . PHP_EOL); $buffer->append("\t" . ' * @param blaze\\collections\\Set[' . $this->classDescriptor->getFullName() . '] $' . $this->fieldDescriptor->getName() . PHP_EOL); $buffer->append("\t" . ' */' . PHP_EOL); $buffer->append("\t" . 'public function set' . $this->fieldDescriptor->getName()->toUpperCase(true)->toNative() . '($' . $this->fieldDescriptor->getName() . '){' . PHP_EOL); $buffer->append("\t" . "\t" . ' $this->' . $this->fieldDescriptor->getName() . ' = $' . $this->fieldDescriptor->getName() . ';' . PHP_EOL); $buffer->append("\t" . '}' . PHP_EOL . PHP_EOL); }
public function generate(\blaze\lang\StringBuffer $buffer) { if ($this->package != null) { $packageName = $this->package; $className = $this->name; } else { $idx = $this->name->lastIndexOf('\\'); $packageName = $this->name->substring(0, $idx)->toNative(); $className = $this->name->substring($idx + 1)->toNative(); } $buffer->append('<?php ' . PHP_EOL . PHP_EOL); $buffer->append('namespace '); $buffer->append($packageName); $buffer->append(';' . PHP_EOL . PHP_EOL); $buffer->append('class '); $buffer->append($className); $buffer->append(' extends \\blaze\\lang\\Object {' . PHP_EOL . PHP_EOL); foreach ($this->identifiers as $member) { $member->generate($buffer); } foreach ($this->singleFields as $member) { $member->generate($buffer); } foreach ($this->collectionFields as $member) { $member->generate($buffer); } $buffer->append('}'); }