src/Schema.php
public function setField($path, $value) {
        if (is_string($path)) {
            if (strpos($path, '.') !== false && strpos($path, '/') === false) {
                trigger_error('Field selectors must be separated by "/" instead of "."', E_USER_DEPRECATED);
                $path = explode('.', $path);
            } else {
                $path = explode('/', $path);
            }
        }

        $selection = &$this->schema;
        foreach ($path as $i => $subSelector) {
            if (is_array($selection)) {
                if (!isset($selection[$subSelector])) {
                    $selection[$subSelector] = [];
                }
            } elseif ($selection instanceof Schema) {
                $selection->setField(array_slice($path, $i), $value);
                return $this;
            } else {
                $selection = [$subSelector => []];
            }
            $selection = &$selection[$subSelector];
        }

        $selection = $value;
        return $this;
    }
public function setField($path, $value) {
        if (is_string($path)) {
            if (strpos($path, '.') !== false && strpos($path, '/') === false) {
                trigger_error('Field selectors must be separated by "/" instead of "."', E_USER_DEPRECATED);
                $path = explode('.', $path);
            } else {
                $path = explode('/', $path);
            }
        }

        $selection = &$this->schema;
        foreach ($path as $i => $subSelector) {
            if (is_array($selection)) {
                if (!isset($selection[$subSelector])) {
                    $selection[$subSelector] = [];
                }
            } elseif ($selection instanceof Schema) {
                $selection->setField(array_slice($path, $i), $value);
                return $this;
            } else {
                $selection = [$subSelector => []];
            }
            $selection = &$selection[$subSelector];
        }

        $selection = $value;
        return $this;
    }
public function setField ( $ path , $ value ) { if ( is_string ( $ path ) ) { if ( strpos ( $ path , '.' ) !== false && strpos ( $ path , '/' ) === false ) { trigger_error ( 'Field selectors must be separated by "/" instead of "."' , E_USER_DEPRECATED ) ; $ path = explode ( '.' , $ path ) ; } else { $ path = explode ( '/' , $ path ) ; } } $ selection = & $ this -> schema ; foreach ( $ path as $ i => $ subSelector ) { if ( is_array ( $ selection ) ) { if ( ! isset ( $ selection [ $ subSelector ] ) ) { $ selection [ $ subSelector ] = [ ] ; } } elseif ( $ selection instanceof Schema ) { $ selection -> setField ( array_slice ( $ path , $ i ) , $ value ) ; return $ this ; } else { $ selection = [ $ subSelector => [ ] ] ; } $ selection = & $ selection [ $ subSelector ] ; } $ selection = $ value ; return $ this ; }
Set a schema field.

@param string|array $path The JSON schema path of the field with parts separated by slashes.
@param mixed $value The new value.
@return $this
Set a schema field .