public function dump($value) : string
    {
        $value = (array) $value;
        $result = [];
        $current = '';
        $missingField = false;
        try {
            foreach ($this->fields as $name => $syntax) {
                $current = $name;
                if (!array_key_exists($name, $value)) {
                    $missingField = true;
                    break;
                }
                $result[] = $syntax->dump($value[$name]);
            }
        } catch (DumpException $e) {
            throw new DumpException($this, $value, "Unable to dump the field '{$current}'", [], $e);
        }

        if ($missingField)
            throw new DumpException($this, $value, "Missing field '{$name}'");

        return Text::join($result, $this->separator);
    }
public function dump($value) : string
    {
        $value = (array) $value;
        $result = [];
        $current = '';
        $missingField = false;
        try {
            foreach ($this->fields as $name => $syntax) {
                $current = $name;
                if (!array_key_exists($name, $value)) {
                    $missingField = true;
                    break;
                }
                $result[] = $syntax->dump($value[$name]);
            }
        } catch (DumpException $e) {
            throw new DumpException($this, $value, "Unable to dump the field '{$current}'", [], $e);
        }

        if ($missingField)
            throw new DumpException($this, $value, "Missing field '{$name}'");

        return Text::join($result, $this->separator);
    }
public function dump ( $ value ) : string { $ value = ( array ) $ value ; $ result = [ ] ; $ current = '' ; $ missingField = false ; try { foreach ( $ this -> fields as $ name => $ syntax ) { $ current = $ name ; if ( ! array_key_exists ( $ name , $ value ) ) { $ missingField = true ; break ; } $ result [ ] = $ syntax -> dump ( $ value [ $ name ] ) ; } } catch ( DumpException $ e ) { throw new DumpException ( $ this , $ value , "Unable to dump the field '{$current}'" , [ ] , $ e ) ; } if ( $ missingField ) throw new DumpException ( $ this , $ value , "Missing field '{$name}'" ) ; return Text :: join ( $ result , $ this -> separator ) ; }
Transforms an object to a string based
on the fields or throws a DumpException.

@param  mixed $value
@return string

@throws Tarsana\Syntax\Exceptions\DumpException
Transforms an object to a string based on the fields or throws a DumpException .