public function __toString()
 {
     $member = '';
     foreach ($this->member as $name => $value) {
         $member .= '    ' . ($value['static'] ? 'static ' : '') . $value['type'] . ' ' . $name;
         if (isset($value['default'])) {
             $member .= ' = ';
             if ($value['isString']) {
                 $member .= $value['default'];
             } else {
                 switch (gettype($value['default'])) {
                     case 'array':
                         $member .= \phpOMS\Utils\ArrayUtils::stringify($value['default']);
                         break;
                     case 'integer':
                     case 'float':
                     case 'double':
                         $member .= $value['default'];
                         break;
                     case 'string':
                         $member .= '"' . $value['default'] . '"';
                         break;
                     case 'object':
                         $member .= get_class($value['default']) . '()';
                         // TODO: implement object with parameters -> Reflection
                         break;
                     case 'boolean':
                         $member .= $value['default'] ? 'true' : 'false';
                         break;
                     case 'NULL':
                         $member .= 'null';
                         break;
                     default:
                         throw new \Exception('Unknown default type');
                 }
             }
         }
         $member .= ';' . PHP_EOL;
     }
     return '<?php' . PHP_EOL . (isset($this->namespace) ? 'namespace ' . $this->namespace . ';' . PHP_EOL : '') . 'abstract class' . $this->class . (isset($this->extends) ? ' extends ' . $this->extends : '') . (isset($this->implements) ? ' implements ' . implode(',', $this->implements) : '') . ' {' . PHP_EOL . $member . '}';
 }
Exemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 public function detach($event)
 {
     $this->events = \phpOMS\Utils\ArrayUtils::unsetArray($event, $this->events, '/');
 }
Exemplo n.º 3
0
 /**
  * Remove data
  *
  * @param string $path  Path to the element to delete
  * @param string $delim Delim used inside path
  *
  * @since  1.0.0
  * @author Dennis Eichhorn
  */
 public function remove($path, $delim)
 {
     $this->json = \phpOMS\Utils\ArrayUtils::unsetArray($path, $this->json, $delim);
 }