public function __toString() { switch ($length = count($this->decoratedObjects)) { case 0: return "Context specific empty object with tag [{$this->tag}]"; case 1: $decoratedType = Identifier::getShortName($this->decoratedObjects[0]->getType()); return "Context specific {$decoratedType} with tag [{$this->tag}]"; default: return "{$length} context specific objects with tag [{$this->tag}]"; } }
function printObject(Object $object, $depth = 0) { $treeSymbol = ''; $depthString = str_repeat('─', $depth); if ($depth > 0) { $treeSymbol = '├'; } $name = Identifier::getShortName($object->getType()); echo "{$treeSymbol}{$depthString}{$name} : "; echo $object->__toString() . PHP_EOL; $content = $object->getContent(); if (is_array($content)) { foreach ($object as $child) { printObject($child, $depth + 1); } } }
function printObject(Object $object, $depth = 0) { $treeSymbol = ''; $depthString = str_repeat('━', $depth); if ($depth > 0) { $treeSymbol = '┣'; } $name = strtoupper(Identifier::getShortName($object->getType())); echo "{$treeSymbol}{$depthString}<b>{$name}</b> : "; echo $object->__toString() . '<br/>'; $content = $object->getContent(); if (is_array($content)) { foreach ($object as $child) { printObject($child, $depth + 1); } } }
/** * @param OutputInterface $output * @param Object $object * @param int $depth * @return void * @throws \FG\ASN1\Exception\NotImplementedException */ private function printObject(OutputInterface $output, Object $object, $depth = 0) { $treeSymbol = ''; $depthString = str_repeat('─', $depth); if ($depth > 0) { $treeSymbol = '├'; } $name = Identifier::getShortName($object->getType()); $output->write("{$treeSymbol}{$depthString}<comment>{$name}</comment> : "); $output->writeln($object->__toString()); $content = $object->getContent(); if (is_array($content)) { foreach ($object as $child) { $this->printObject($output, $child, $depth + 1); } } }
function printObject(Object $object, $depth = 0) { $name = strtoupper(Identifier::getShortName($object->getType())); $treeSymbol = ''; $depthString = str_repeat('━', $depth); if ($depth > 0) { $treeSymbol = '┣'; $name = ' ' . $name; } echo "{$treeSymbol}{$depthString}{$name} : "; echo $object->__toString() . PHP_EOL; $content = $object->getContent(); if ($content instanceof Object) { printObject($content, $depth + 1); } elseif (is_array($content)) { foreach ($object as $child) { printObject($child, $depth + 1); } } }
public function __toString() { $decoratedType = Identifier::getShortName($this->decoratedObject->getType()); return "Context specific {$decoratedType} with tag [{$this->tag}]"; }