Пример #1
0
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);
        }
    }
}
Пример #2
0
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);
        }
    }
}
Пример #3
0
 /**
  * @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);
         }
     }
 }
Пример #4
0
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);
        }
    }
}
Пример #5
0
 /**
  * @param \FG\ASN1\Object $children
  *
  * @throws \Exception
  *
  * @return string
  */
 private function getD(Object $children)
 {
     if (!$children instanceof OctetString) {
         throw new \Exception('Unable to load the key');
     }
     return $children->getContent();
 }