public function toObject(bool $minimal = false)
    {
        $object = new stdClass;

        foreach ($this as $key => $value) {
            if ('_' === substr($key, 0, 1)) {
                continue;
            }

            if ($minimal && !$this->{'_'.$key}) {
                continue;
            }

            switch ($key) {
                case 'variables':
                    $object->$key = [];

                    foreach ($value as $name => $variable) {
                        $object->$key[$variable->getName()] = (object) [
                            'name' => $variable->getName(),
                            'value' => $variable->getValue(),
                            'type' => $variable->getType(),
                            'valueInfo' => $variable->getValueInfo()
                        ];
                    }

                    break;

                case 'cascade':
                    $object->$key = $value ? 'true' : 'false';
                    break;

                case 'tenantIdIn':
                    $object->$key = implode(',', $value);
                    break;

                default:
                    $object->$key = $value;
            }
        }

        return $object;
    }
public function toObject(bool $minimal = false)
    {
        $object = new stdClass;

        foreach ($this as $key => $value) {
            if ('_' === substr($key, 0, 1)) {
                continue;
            }

            if ($minimal && !$this->{'_'.$key}) {
                continue;
            }

            switch ($key) {
                case 'variables':
                    $object->$key = [];

                    foreach ($value as $name => $variable) {
                        $object->$key[$variable->getName()] = (object) [
                            'name' => $variable->getName(),
                            'value' => $variable->getValue(),
                            'type' => $variable->getType(),
                            'valueInfo' => $variable->getValueInfo()
                        ];
                    }

                    break;

                case 'cascade':
                    $object->$key = $value ? 'true' : 'false';
                    break;

                case 'tenantIdIn':
                    $object->$key = implode(',', $value);
                    break;

                default:
                    $object->$key = $value;
            }
        }

        return $object;
    }
{@inheritdoc}